Commit Graph

8191 Commits

Author SHA1 Message Date
Corinna Vinschen 03c991fed4 * path.cc (symlink_info::check_shortcut): Use ro_u_empty rather than
local UNICODE_STRING object.
	(symlink_info::check_sysfile): Ditto.  Return immediately if NtOpenFile
	failed to avoid closing random handle.  Improve debug output in case
	NtReadFile failed.
2010-06-09 12:32:14 +00:00
Corinna Vinschen b7d3e6d7d2 * path.cc (symlink_info::check): Set h to NULL after closing handle
in udf check.  Remove overagressive bracketing.  Don't set h to NULL
	without closing the handle.  Fix using wrong handle in checking
	file system when using parent directory handle.
2010-06-08 15:25:09 +00:00
Corinna Vinschen 814e854e2c * include/sys/stdio.h: Remove _GNU_SOURCE guard around getline
and getdelim prototypes since they are SUSv4 now.
2010-06-07 09:16:11 +00:00
Corinna Vinschen fad9568b0a * ntdll.h (STATUS_BAD_NETWORK_PATH): Define.
(STATUS_BAD_NETWORK_NAME): Define.
	* path.cc (symlink_info::check): Convert STATUS_BAD_NETWORK_PATH and
	STATUS_BAD_NETWORK_NAME into an immediate ENOENT.
2010-06-02 14:52:34 +00:00
Corinna Vinschen ded1f66c2d * exceptions.cc (open_stackdumpfile): Correctly append .stackdump
suffix.

	* nlsfuncs.cc (rebase_locale_buf): Reorder arguments.  Accommodate
	throughout.  Add pointer to end of buffer and avoid changing pointers
	not pointing into the buffer.
2010-06-01 14:51:47 +00:00
Corinna Vinschen 80a10a3972 * fhandler_netdrive.cc (fhandler_netdrive::exists): Always free WNet
resource if created.
2010-06-01 13:14:37 +00:00
Corinna Vinschen 685e55e254 * cygheap.cc (cygheap_user::set_name): Allow to change the user name
if it only differs by case.
2010-05-31 18:52:02 +00:00
Corinna Vinschen 88addc6476 * fhandler_registry.cc (multi_wcstombs): New function.
(fhandler_registry::fstat): Call multi_wcstombs for strings of type
	REG_MULTI_SZ.
	(fhandler_registry::fill_filebuf): Ditto.
2010-05-26 16:58:44 +00:00
Christopher Faylor fca8f35f11 * hires.h (hires_base::reset): New function.
(hires_us): Specify that hires_base is a public import.
(hires_ms): Ditto.
* times.cc (gtod): Move earlier in file.
(settimeofday): Reset gtod so that base will be subsequently recalculated.
2010-05-26 14:48:17 +00:00
Corinna Vinschen 1ee8d76ca0 * path.cc (symlink_info::check): Don't try to handle remote reparse
points as symlinks.  Explain why.
2010-05-26 14:24:47 +00:00
Corinna Vinschen 16f52c1461 * include/inttypes.h: Change PTR definitions to int to align with the
stdint.h type definitions of intptr_t/uintptr_t.
2010-05-26 13:37:48 +00:00
Corinna Vinschen 403ab0c013 * fhandler.h (class fhandler_pty_master): Add master_thread member.
* fhandler_tty.cc (fhandler_pty_master::close): Properly detach from
	master thread.
	(fhandler_pty_master::setup): Store cygthread pointer of pty master
	control thread in master_thread.  Don't zap thread handle.
2010-05-26 13:10:55 +00:00
Corinna Vinschen a36728eae0 * nlsfuncs.cc (__set_lc_time_from_win): Use LOCALE_SMONTHNAME1
instead of LOCALE_SABBREVMONTHNAME1 in Japanese and Korean
	locales to get abbreviated month names.  Explain why.
2010-05-26 11:36:17 +00:00
Chris Sutcliffe 5f7eee9ec9 2010-04-27 Danny Smith <dannysmith@users.sourceforge.net>
* mingwex/mb_wc_common.h (get_codepage): Revert change of 2006-09-19.
2010-05-19 02:59:46 +00:00
Christopher Faylor d3258e063c * environ.cc (regopt): Change the first argument to wide char string.
(environ_init): Accommodate change to the first argument of regopt.
* exception.cc (open_stackdumpfile): Accommodate change to the type of progname
in _pinfo.
* external.cc (fillout_pinfo): Ditto.
* fhandler_process.cc (format_process_winexename): Ditto.
(format_process_stat): Ditto.
* fork.cc (fork::parent): Ditto.
* pinfo.cc (pinfo_basic::pinfo_basic): Call GetModuleFileNameW instead of
GetModuleFileName.
(pinfo::thisproc): Accommodate change to the type of progname in _pinfo.
(pinfo_init): Ditto.
* pinfo.h (_pinfo): Change the type of progname to a wide char array.
* registry.h (reg_key::get_int): Change the first argument from constant point
to pointer to constant.
(reg_key::get_string): Ditto.  Change the last argument likewise.
* registry.cc (reg_key::get_int): Accommodate change to the declaration.
(reg_key::get_string): Ditto.
* strace.cc (strace::hello): Accommodate change to the type of progname in
_pinfo.
(strace::vsprntf): Ditto.
2010-05-18 14:30:51 +00:00
Christopher Faylor 27f564e9a3 * Makefile.in (DLL_OFILES): Add pseudo-reloc.o.
* dcrt0.cc (child_info_fork::handle_fork): Call _pei386_runtime_relocator here.
(dll_crt0_1): Ditto for non-fork case.
* dll_init.cc (dll::init): Complain more in comment.  Clean up slightly.
(dll_dllcrt0_1): Call _pei386_runtime_relocator when we know we have a
filled-in per_process structure.
* globals.cc (__cygwin_user_data): Accommodate new fields for
_pei386_runtime_relocator.
* pseudo-reloc.cc: New file adapted from old lib/pseudo-reloc.c.  Include
winsup.h directly.  Collapse #ifdef __CYGWIN__ into one block.  Perform minor
whitespace code reformatting.
(__report_error): Use small_printf to output error.
(_pei386_runtime_relocator): Conditionalize for cygwin to take per_process
pointer parameter.
* winsup.h (_pei386_runtime_relocator): Declare.
* include/cygwin/version.h
(CYGWIN_VERSION_PER_PROCESS_API_VERSION_COMBINED): New macro.
(CYGWIN_VERSION_USER_API_VERSION_COMBINED): Use above macro.
(CYGWIN_VERSION_USE_PSEUDO_RELOC_IN_DLL): New macro.
(CYGWIN_VERSION_API_MINOR): Bump to 227.
* include/sys/cygwin.h: Remove obsolete comment.
(per_process::unused2): Shorten.
(per_process::pseudo_reloc_start): New field.
(per_process::pseudo_reloc_end): Ditto.
(per_process::image_base): Ditto.
* lib/_cygwin_crt0_common.cc: Declare pseudo runtime externs needed for
per_process structure.
(_cygwin_crt0_common): Fill in pseudo_reloc runtime constants.
* lib/pseudo-reloc-dummy.c: New file.  Dummy function to satisify ld.
* lib/pseudo-reloc.c: Delete.
2010-05-07 21:25:19 +00:00
Corinna Vinschen 186bcf2a17 * fhandler_tty.cc (fhandler_tty_slave::init): Disable grabbing
process group ownership of tty in case we're being debugged.
2010-05-07 15:03:27 +00:00
Corinna Vinschen 35c0485d2d * path.cc (path_conv::check): Drop setting sym.pflags before calling
mount_info::conv_to_win32_path since the flag value is overwritten by
	mount_info::conv_to_win32_path anyway.
	Set flags for DOS paths before calling symlink_info::check so they can
	be used in that function already.
2010-05-06 10:04:50 +00:00
Christopher Faylor 73bcd49b1f * dll_init.cc (dll_list::alloc): Add debugging assertion. 2010-05-03 16:40:33 +00:00
Corinna Vinschen 2b749986ad * dlfcn.cc (get_full_path_of_dll): Handle non-existent file. 2010-04-29 13:03:30 +00:00
Corinna Vinschen ef3df0bb7d * new-features.sgml (ov-new1.7.6): Add new "dos" and "inode" mount
options.
	* pathnames.sgml (mount-table): Ditto.
	(pathnames-specialchars): Change description order.  Add paragraph
	to explain new behaviour in terms of leading spaces and trailing dots
	and spaces in pathnames.
2010-04-29 10:58:17 +00:00
Corinna Vinschen 3db442e639 * utils.sgml (mount): Add description for "dos" and "ihash" mount
options.
2010-04-29 10:53:31 +00:00
Corinna Vinschen a361b4715f * path.cc: Include sys/cygwin.h if built for mount(1).
(struct opt): Add "dos" and "ihash" options.
	(from_fstab_line): Call cygwin_internal rather than read_flags if
	built for mount(1).
2010-04-29 10:39:35 +00:00
Corinna Vinschen 5b4c992bf6 * mount.cc (struct opt): Add "dos" and "ihash" options.
(fillout_mntent): Ditto.
	* path.cc (path_conv::get_nt_native_path): Use path_conv's
	has_dos_filenames_only method.
	(path_conv::check): Add PATH_IHASH flag if FS has unreliable inode
	numbers.
	(symlink_info::check_shortcut): Or symlink flags to pflags.
	(symlink_info::check_sysfile): Ditto.  Change test accordingly.
	(symlink_info::check_reparse_point): Ditto.
	(symlink_info::check_nfs_symlink): Ditto.
	(symlink_info::check): Check PATH_DOS flag in call to get_nt_native_path
	to utilize mount flag.  Ditto in test for potential restarting.  Set
	PATH_DOS if FS only allows DOS filename rules.
	* path.h (enum path_types): Add PATH_DOS and PATH_IHASH.
	(path_conv::hasgood_inode): Check PATH_IHASH instead of
	fs.hasgood_inode.
	(path_conv::has_dos_filenames_only): New method.
	* include/sys/mount.h (MOUNT_DOS): New mount flag.
	(MOUNT_IHASH): Ditto.
2010-04-29 10:38:05 +00:00
Corinna Vinschen a82a8dcb4e * mount.cc (oopts): Remove entirely.
(usage): Call cygwin_internal (CW_LST_MNT_OPTS) to create list of
	mount options.
	(print_version): Fix copyright date.
	(main): Replace option processing loop with single call to
	cygwin_internal (CW_CVT_MNT_OPTS).
2010-04-29 08:50:23 +00:00
Corinna Vinschen a11a07231b * external.cc (cygwin_internal): Add CW_CVT_MNT_OPTS to allow mount
flag parsing.  Add CW_LST_MNT_OPTS case to allow mount flag listing.
	* mount.cc (fstab_read_flags): Rename from read_flags.  Make externally
	available.  Change input string to char ** to allow returning faulty
	option.  Add flag for avoiding debug output.
	(fstab_list_flags): New function to create list of options.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_CVT_MNT_OPTS and
	CW_LST_MNT_OPTS.
2010-04-29 08:47:44 +00:00
Corinna Vinschen f00bc469e2 * mount.cc (compare_flags): New function.
(read_flags): Replace loop with bsearch.  Simplify error check.
2010-04-28 15:35:52 +00:00
Corinna Vinschen 8f47a15cef * include/cygwin/version.h: Bump API minor version. 2010-04-28 10:20:34 +00:00
Corinna Vinschen c2bedf3aa3 * new-features.sgml (ov-new1.7.6): Add locale wide-char changes. 2010-04-28 10:19:25 +00:00
Corinna Vinschen 22b6e8101e * locale.cc (print_lc_xxx_charset): Remove.
(enum type_t): Change according to the fact that nl_langinfo now returns
	all locale category values.
	(lc_ctype_names): Add new category members.  Redefine for exclusive
	nl_langinfo usage.
	(lc_numeric_names): Ditto.
	(lc_time_names): Ditto.
	(lc_collate_names): Ditto.
	(lc_monetary_names): Ditto.
	(lc_messages_names): Ditto.
	(print_lc): Change switch according to new type_t values.
2010-04-28 10:00:40 +00:00
Corinna Vinschen be764ea806 * cygwin.din (__locale_mb_cur_max): Export.
* nlsfuncs.cc (__getlocaleinfo): Drop conversion to multibyte.
	(__charfromwchar): New function to convert to multibyte.
	(__eval_datetimefmt): Convert to return wchar_t pointer.  Work on
	wide char string.
	(__set_lc_time_from_win): Take additional pointer to "C" category info
	to accommodate C.foo locales.  Rework to fill wide char members in
	category info.
	(__set_lc_ctype_from_win): New function.
	(__set_lc_numeric_from_win): Take additional pointer to "C" category
	info to accommodate C.foo locales.  Rework to fill wide char members
	in category info.
	(__set_lc_monetary_from_win): Ditto.
	(__set_lc_messages_from_win): Ditto.
	(__get_current_collate_codeset): New function, called from nl_langinfo.
	* include/cygwin/config.h (__HAVE_LOCALE_INFO_EXTENDED__): Define.
2010-04-28 10:00:24 +00:00
Christopher Faylor 9b53b52a80 * spawn.cc (find_exec): Use the first detected errno when lookup fails. 2010-04-27 23:06:48 +00:00
Corinna Vinschen 0f6697b373 * include/regex.h: Include _ansi.h to avoid missing out on preprocessor
macros in sys/_types.h.
2010-04-27 15:18:14 +00:00
Corinna Vinschen 002a34fa14 * mount.h (fs_info::inited): New inline method.
* path.cc (path_conv::check): Clear filesystem info if following a
	symlink.  Use new fs_info::inited method to check if FS info is already
	available.
	(symlink_info::check): Drop fs_update_called.  Use fs_info::inited
	method instead.  Streamline test for leading space and trailing dot or
	space.  Add comments.
2010-04-26 13:48:04 +00:00
Corinna Vinschen 8802178fdd * path.h (get_nt_native_path): Add third parameter to declaration and
declare with regparms.
	* path.cc (get_nt_native_path): Add third parameter to allow conversion
	of leading and trailing dots and spaces on filesystems only supporting
	filenames following DOS rules.
	(path_conv::get_nt_native_path): Call get_nt_native_path according to
	fs.has_dos_filenames_only flag.
	(getfileattr): Accommodate new parameter to get_nt_native_path.
	(symlink_info::check): Revamp fs_update_called handling to call
	fs.update only once per call.  Call get_nt_native_path according to
	fs.has_dos_filenames_only flag.  Streamline filesystem dependent code
	not to be called more than once unnecessarily.  Drop code tweaking
	incoming path for broken filesystems only allowing DOS pathnames.
	Rely on changed get_nt_native_path instead.
	* mount.cc (fillout_mntent): Accommodate new parameter to
	get_nt_native_path.
	* strfuncs.cc (tfx_rev_chars): New conversion table with comment.
	(sys_cp_wcstombs): Use tfx_rev_chars rather than tfx_chars.
2010-04-23 11:07:35 +00:00
Corinna Vinschen b12d6d10ad * path.cc (symlink_info::check): Make sure to restart only once. 2010-04-22 17:42:18 +00:00
Corinna Vinschen 6ff06a0726 * mount.cc (GETVOLINFO_VALID_MASK): Drop FILE_SEQUENTIAL_WRITE_ONCE
from mask.  Expand the comment a bit.
	(WIN_FAT_FLAGS): New define.
	(FS_IS_WINDOWS_FAT): New macro.
	(fs_info::update): Handle remote FS faking to be FAT.  Subsume under
	CIFS.  Check for NWFS and has_buggy_basic_info only for remote
	filesystems.  Add check for has_dos_filenames_only.
	* mount.h (class fs_info): Add has_dos_filenames_only status flag.
	Implement accessors.
	* path.cc (symlink_info::check): Rearrange variable definitions to
	clear them up.  Add a restart label to allow a clean restart within
	the method.  Add a check for broken filesystems only allowing DOS
	pathnames in case we encounter a STATUS_OBJECT_NAME_NOT_FOUND status.
	If all checks point to one of that, restart method with tweaked
	incoming path.  Add lengthy comments to explain what we do.
2010-04-22 17:33:28 +00:00
Corinna Vinschen c43e19442c * path.cc (symlink_info::check): Fix a comment. 2010-04-22 09:43:29 +00:00
Corinna Vinschen ebff53b339 * cygserver.sgml: Note the fact that slave tty/pty handle dispersal is
unsed as of Cygwin 1.7.6.
	* new-features.sgml (ov-new1.7.6): New section.  Add tty/pty and
	setrlimit changes.
2010-04-22 09:05:37 +00:00
Corinna Vinschen 05c98e076e * fhandler_termios.cc (tcinit): Remove previously applied change.
Replace with...
	* fhandler_tty.cc (fhandler_tty_slave::init): Become process group
	leader if called from dtable::init_std_file_from_handle.  Add comment
	to explain.
2010-04-21 19:36:40 +00:00
Corinna Vinschen 179bee57db * dtable.cc (dtable::init_std_file_from_handle): Set access mask for
the slave side of ttys explicitely.  Explain why.
2010-04-21 18:44:39 +00:00
Christopher Faylor 27f1db48c7 * path.cc (cygwin_create_path): Free memory on error. 2010-04-20 14:32:29 +00:00
Corinna Vinschen 9e40fe8112 * cygheap.h (struct init_cygheap): Add rlim_core member.
* cygheap.cc (cygheap_init): Initialize rlim_core to RLIM_INFINITY.
	* exceptions.cc (stackdump): Drop extern declaration of rlim_core.
	Refer to cygheap->rlim_core instead.
	(exception::handle): Disable stackdumping if cygheap->rlim_core is 0.
	Don't set WCOREDUMP flag in exit code, if cygheap->rlim_core is 0.
	(sigpacket::process): Ditto.
	* resource.cc (rlim_core): Remove.
	(getrlimit): Fetch RLIMIT_CORE value from cygheap->rlim_core.
	(setrlimit): Store RLIMIT_CORE value in cygheap->rlim_core.
2010-04-20 10:44:52 +00:00
Christopher Faylor 2ac91a1483 * cygerrno.h: Nevermind. 2010-04-20 03:45:27 +00:00
Christopher Faylor c0f1ded4c4 * transport_pipes.cc: Include ntdef.h to accommodate cygerrno.h. 2010-04-20 03:44:38 +00:00
Christopher Faylor e1b57fc2b9 * cygerrno.h: Protect use of NTSTATUS for only when we need it.
* lib/_cygwin_crt0_common.cc: Remove unneeded declarations.
2010-04-20 03:32:37 +00:00
Christopher Faylor 53755c55a7 * lib/_cygwin_crt0_common.cc: Remove unneeded declarations. 2010-04-20 03:30:32 +00:00
Corinna Vinschen b7b55e90e1 * fhandler_tty.cc (fhandler_tty_slave::fch_set_sd): Remove commented out
code.
2010-04-19 20:00:18 +00:00
Corinna Vinschen cc01c77f7e * autoload.cc (GetNamedPipeClientProcessId): Define.
* fhandler.h (fhandler_tty_slave::fch_open_handles): Declare private.
	(fhandler_tty_slave::fch_close_handles): Ditto.
	(fhandler_tty_slave::cygserver_attach_tty): Drop declaration.
	(fhandler_tty_slave::fstat): Declare public.
	(fhandler_tty_slave::fchmod): Declare public.
	(fhandler_tty_slave::fchown): Declare public.
	(class fhandler_pty_master): Add master_ctl handle.
	(fhandler_pty_master::pty_master_thread): Declare public.
	* fhandler_termios.cc (fhandler_termios::tcinit): If the process
	is started from a non-Cygwin process, make it tty process group
	leader.
	* fhandler_tty.cc: Throughout accommodate additional security related
	arguments in calls to functions creating or opening objects.
	(close_maybe): Move to start of file to reuse it
	in other methods.
	(struct pipe_request): Define.
	(struct pipe_reply): Define.
	(fhandler_tty_slave::open): Throughout, try to open synchronization
	objects with MAXIMUM_ALLOWED permissions.  Drop call to cygserver.
	Try to duplicate pipe handles via master_ctl pipe if duplicating
	directly doesn't work.
	(fhandler_tty_slave::cygserver_attach_tty): Remove.
	(fhandler_tty_slave::init): Close unused incoming pipe handle.
	(fhandler_pty_master::close): Send exit message to master control
	thread and close master_ctl handle.
	(fhandler_pty_master::pty_master_thread): New method, implementing the
	master control thread.
	(pty_master_thread): Static helper to start master control thread.
	(fhandler_pty_master::setup): Simplify creating pipe inheritance.
	Make sure we're the one creating the input_available_event.  Add
	comment to explain why.  Create master_ctl pipe and start master
	control thread.  Close master_ctl handle in case of error.
	* security.cc (alloc_sd): Add code to handle tty objects.  Add comments
	to explain what exactly is required.
	(get_object_sd): New function.
	(get_object_attribute): New function.
	(create_object_sd_from_attribute): New function.
	(set_object_sd): New function.
	(set_object_attribute): New function.
	(set_file_attribute): Change attribute type to mode_t.
	* security.h (set_file_attribute): Change attribute type to mode_t.
	(get_object_sd): Declare.
	(get_object_attribute): Declare.
	(create_object_sd_from_attribute): Declare.
	(set_object_sd): Declare.
	(set_object_attribute): Declare.
	* tty.cc (tty::slave_alive): Implement directly instead of via alive.
	(tty::exists): Open mutex handle with READ_CONTROL access.
	(tty::alive): Remove.
	(tty::open_output_mutex): Convert to inline method.
	(tty::open_input_mutex): Ditto.
	(tty::open_mutex): Take additional ACCESS_MASK parameter for the
	mutex open access mask.
	(tty::open_inuse): New method.
	(tty::create_inuse): Take PSECURITY_ATTRIBUTES parameter.  Drop fmt
	name parameter.  Always create TTY_SLAVE_ALIVE event.
	(tty::get_event): Take additional PSECURITY_ATTRIBUTES parameter for
	CreateEvent.
	* tty.h (class tty): Change declarations according to aforementioned
	changes.
	(tty::open_output_mutex): Implement as inline method.
	(tty::open_input_mutex): Ditto.
2010-04-19 19:52:43 +00:00
Corinna Vinschen 02a33ea774 * dtable.cc (dtable::init_std_file_from_handle): Set dev to
valid content for ptys.  Remove setting FILE_CREATE_PIPE_INSTANCE
	in access flags since it's not needed.  Set the access mask for
	kernel objects according to what's returned by NtQueryInformationFile,
	info class FileAccessInformation.
2010-04-19 16:25:11 +00:00