Commit Graph

5111 Commits

Author SHA1 Message Date
Corinna Vinschen c7b24005e6 * sec_acl.cc (setacl): Use the long time unused ACL_DEFAULT_SIZE
instead of a constant value.
	* security.cc (alloc_sd): Ditto.
2010-06-22 09:54:36 +00:00
Christopher Faylor f074bd3aef * tmpbuf.h: New file.
* flock.cc: Include tmpbuf.h for new tmpbuf functionality.
(allow_others_to_sync): Use tmpbuf rather than tmp_pathbuf.  Explain why.
(lf_setlock): For consistency, use tmpbuf rather than tmp_pathbuf.
(lf_getlock): Ditto.
2010-06-21 19:55:12 +00:00
Christopher Faylor 74434376cf * dcrt0.cc (__api_fatal): Temporarily generate a stackdump. 2010-06-21 17:09:33 +00:00
Christopher Faylor 7b8cf7c89a * tls_pbuf.cc (tmp_pathbuf::w_get): Report what's failing when too many buffers
are in use.
2010-06-21 05:30:42 +00:00
Corinna Vinschen 4365c1598b * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Fetch stat
handle only after checking for NFS.
2010-06-17 10:25:15 +00:00
Corinna Vinschen 342814df29 * fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Use handle
returned by get_stat_handle.
	(fhandler_base::fstat_helper): Reinstatiate code to re-open the file
	when checking for executability if called via fstat.  Explain why.
2010-06-15 15:10:42 +00:00
Corinna Vinschen 5a0d1edba4 * dtable.cc (dtable::dup_worker): Reset path_conv handle in duplicated
fhandler.
	* fhandler.cc (fhandler_base::fstatvfs): Keep handle in created
	path_conv.
	* fhandler.h (fhandler_base::get_stat_access): New method.
	(fhandler_base::get_stat_handle): New method.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Use handle
	returned by get_stat_handle.  Only request inode from system if it
	isn't already set in the fhandler, and only for filesystems supporting
	them.
	(fhandler_base::fstat_fs): Use handle returned by get_stat_handle.
	Change the way open_fs is called.  Explain why.
	(fhandler_base::fstat_helper): Use handle returned by get_stat_handle.
	Never use 0 inode number.  Simplify executable recognition by re-using
	get_stat_handle if file could be opened with sufficient rights.
	(fhandler_disk_file::fstatvfs): Use handle returned by get_stat_handle.
	(fhandler_disk_file::facl): Use handle returned by get_stat_handle in
	GETACL and GETACLCNT cases.
	(fhandler_disk_file::link): Use handle returned by get_stat_handle
	instead of opening file here again.  Add comment.
	(readdir_get_ino): Keep handle in created path_conv and drop
	opening file.
	* ntdll.h (wait_pending): New helper function.
	* path.cc (symlink_info::check): Drop unused 'opt' parameter from
	declaration.  Add path_conv_handle argument.
	(path_conv::check): Make sure conv_handle is closed.  Keep
	PC_KEEP_HANDLE flag in pflags_or.  Accommodate call to sym.check to
	new args.
	(path_conv::~path_conv): Close conv_handle.
	(symlink_info::check_shortcut): Don't re-open file here, just use
	incoming handle.  Drop goto's and label out.
	(symlink_info::check_sysfile): Don't re-open file here, just use
	incoming handle.  Keep track of file position to accommodate the fact
	that file has been opened asynchronously in calling function.
	(symlink_info::check_nfs_symlink): Don't re-open file here, just use
	incoming handle.
	(symlink_info::check): Drop unused 'opt' parameter.  Add
	path_conv_handle argument.  Always try to open file with GENERIC_READ
	rights first to allow reading file content w/o having to re-open the
	file.  Drop back to READ_CONTROL | FILE_READ_ATTRIBUTES otherwise.
	Call symlink test functions (except for check_reparse_point) only if
	file could be opened with GENERIC_READ.  Keep file handle open if
	PC_KEEP_HANDLE is set in pflags.
	* path.h (enum pathconv_arg): Add PC_KEEP_HANDLE flag.
	(class path_conv_handle): New class.
	(class path_conv): Add conv_handle member.
	(path_conv::operator =): Duplicate conv_handle.
	(path_conv::handle): New method.
	(path_conv::access): New method.
	(path_conv::reset_conv_handle): New method.
	(path_conv::close_conv_handle): New method.
2010-06-15 12:05:15 +00:00
Corinna Vinschen 51ec3f5c98 * fhandler_disk_file.cc (fhandler_disk_file::fstatvfs): Fix indentation. 2010-06-15 09:58:56 +00:00
Corinna Vinschen 5e3dd23eee * fhandler_disk_file.cc (path_conv::get_ino_by_handle): Convert from
static function to path_conv method.  Accommodate throughout.
	(path_conv::ndisk_links): Unused, comment out.
	* path.h (path_conv::get_ino_by_handle): Declare.
	(path_conv::ndisk_links): Comment out declaration.
2010-06-15 08:51:55 +00:00
Corinna Vinschen d955b6cfd8 * path.cc (path_conv::check): Return with ENOTDIR if component is a
device.
2010-06-14 21:16:41 +00:00
Corinna Vinschen aec297d5d9 * dlfcn.cc (get_full_path_of_dll): Revert patch from 2010-04-29. 2010-06-14 11:10:30 +00:00
Christopher Faylor 75172e03ac * times.cc (gtod): Move to sharable region. 2010-06-12 16:34:26 +00:00
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
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 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 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 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 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 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
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
Corinna Vinschen bc8a5a9f66 * syscalls.cc (rename): On STATUS_ACCESS_VIOLATION, retry to open
for DELETE until the STATUS_ACCESS_VIOLATION goes away.  Add comment
	to explain why.
2010-04-19 08:09:51 +00:00
Corinna Vinschen b5efa8990f * sec_helper.cc (get_null_sd): Make static. Use PSECURITY_DESCRIPTOR
instead of SECURITY_DESCRIPTOR *.
	(sec_acl): Fix fomratting.
	* security.h (get_null_sd): Drop declaration.
2010-04-17 15:51:09 +00:00
Corinna Vinschen 7cdcd90ca1 * cygerrno.h (seterrno_from_nt_status): Declare.
(__seterrno_from_nt_status): Call seterrno_from_nt_status.
	* errno.cc (seterrno_from_win_error): Set errno without calling
	set_errno to avoid packing strace output with errno messages.
	(seterrno_from_nt_status): New function to print NT status as well as
	resulting Windows error.
2010-04-16 15:42:29 +00:00
Corinna Vinschen 6b0f100a6d * kernel32.cc (CreateEventW): Create event object with EVENT_ALL_ACCESS
access mask.
	(CreateMutexW): Create mutex object with MUTEX_ALL_ACCESS access mask.
	(CreateSemaphoreW): Create semaphore object with SEMAPHORE_ALL_ACCESS
	access mask.
2010-04-15 17:20:59 +00:00
Corinna Vinschen b873ce0686 * sec_helper.cc (set_cygwin_privileges): Enable SE_DEBUG_PRIVILEGE, if
available.  Add comments.
2010-04-15 17:17:59 +00:00
Corinna Vinschen 0ef4bb7c50 * fhandler_socket.cc (get_inet_addr): Only test the file for being a
socket after opening it.  Retry if opening failed with sharing
	violation.  Explain why we do this.
	(fhandler_socket::bind): Create file with no sharing allowed.
2010-04-13 19:56:30 +00:00
Corinna Vinschen 2bba259eb7 * cygheap.cc (cwcsdup): Fix allocation size to accommodate sizeof WCHAR.
(cwcsdup1): Ditto.
2010-04-13 10:01:34 +00:00
Corinna Vinschen 098f9c6e48 * include/cygwin/version.h: Bump DLL minor version number to 5. 2010-04-12 17:01:01 +00:00
Corinna Vinschen 6b1c332f28 * posix.sgml (std-notes): Improve lseek description. 2010-04-12 15:36:48 +00:00
Corinna Vinschen 42e9cefd71 * fhandler_tty.cc (fhandler_tty_slave::open): Add code to duplicate
handles within a single process to simplify openpty case.
	(fhandler_tty_slave::cygserver_attach_tty): Correctly send Windows PID
	to cygserver, rather than the Cygwin PID.
2010-04-12 13:28:06 +00:00
Corinna Vinschen 0250709234 * fhandler.h (class dev_console): Add backspace_keycode member.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Initialize
	backspace_keycode with CERASE.
	(fhandler_console::read): Return dev_state->backspace_keycode if the
	backspace key is pressed.
	(fhandler_console::char_command): Implement DECBKM escape sequence.
2010-04-11 19:11:17 +00:00
Christopher Faylor 1d6adee8ed * fhandler_console.cc (fhandler_console::read): Default to sending CERASE
character if termios VERASE field is zero.
(fhandler_console::fixup_after_fork_exec): Avoid a spurious debug message.
2010-04-10 18:05:52 +00:00
Christopher Faylor 89a903b879 * mkvers.sh: Use modern date formats to construct the date. 2010-04-10 05:46:45 +00:00
Corinna Vinschen 1691abe75e * nlsfuncs.cc (__set_lc_time_from_win): Actually set
_time_locale->md_order to the D_MD_ORDER value written to the buffer.
2010-04-09 21:20:21 +00:00
Christopher Faylor 412f3e61d4 * path.cc (path_conv::set_normalized_path): Use crealloc_abort to avoid a
memory leak.
* path.h (path_conv::operator =): Just use cstrdup to allocate normalized_path,
avoiding attempt to free a pointer which is allocated in another pc.
2010-04-09 16:51:08 +00:00
Corinna Vinschen f8fbd1ea58 * include/cygwin/version.h: Bump DLL minor version number to 4. 2010-04-07 08:55:38 +00:00
Corinna Vinschen 385b0add19 * thread.cc (valid_sched_parameters): Declare extern here.
(sched_set_thread_priority): Ditto.
2010-04-06 15:27:34 +00:00
Corinna Vinschen 249ccad30c * include/sched.h: Remove, overruled by newlib file.
* include/sys/sched.h: Ditto.
2010-04-06 15:16:24 +00:00
Christopher Faylor 35297ebe0b * fhandler_fifo.cc (fhandler_fifo::open): Accommodate previous return value
change to setup_overlapped.
2010-04-06 15:09:44 +00:00
Christopher Faylor 1908518227 * fhandler.h (fhandler_base::has_ongoing_io): Declare virtual method.
* select.cc (peek_pipe): Reorganize slightly.  Don't attempt to check a handle
if it has ongoing I/O.
(select_pipe_info::select_pipe_info): Delete definition.
(select_pipe_info::~select_pipe_info): Delete definition.
(thread_pipe): Get rid of WFMO call.  Reorganize loop.
(pipe_cleanup): Remove dependence on destructor.
(thread_serial): Reorganize loop.
* select.h (select_pipe_info): Empty this class since it no longer has any
special requirements (for now).
* syscalls.cc (readv): Remove an unneeded debug printf.
2010-04-02 22:36:44 +00:00
Christopher Faylor 5151c80c8a * fhandler.h (fhandler_base::setup_overlapped): Delete virtual declaration.
(fhandler_base::destroy_overlapped): Ditto.
(fhandler_base_overlapped): Remove now-unneeded friend.
(fhandler_base_overlapped::setup_overlapped): Return int, remove parameter.
(fhandler_base_overlapped::get_overlapped): Return reference.
(fhandler_base_overlapped::fhandler_base_overlapped): Be more assertive about
zeroing everything.
(fhandler_base_overlapped::fixup_after_fork): Declare new function.
(fhandler_base_overlapped::fixup_after_exec): Ditto.
(fhandler_base_overlapped::dup): Ditto.
(fhandler_base_overlapped::close): Ditto.
* fhandler_fifo.cc (fhandler_fifo::dup): Call fhandler_base_overlapped::dup
rather than fhandler_base::dup.
* pipe.cc (fhandler_pipe::dup): Ditto.
(fhandler_pipe::init): Accommodate change in setup_overlapped arguments for
"opened_properly" case.
2010-04-02 18:55:02 +00:00
Christopher Faylor 60efdd0c4c * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Properly initialize
overlapped part of this class.
2010-04-02 16:43:27 +00:00
Corinna Vinschen 7c972c6354 * fhandler_tty.cc (fhandler_tty_slave::close): Revert previous change. 2010-04-02 16:16:53 +00:00
Christopher Faylor baa671ea26 fix typo 2010-04-02 16:01:58 +00:00
Christopher Faylor dffe690c84 * select.h (select_pipe_info::add_watch_handle): Delete declaration.
* select.cc (select_pipe_info::add_watch_handle): Delete deinition.
(fhandler_pipe::select_read): Delete call to add_watch_handle.
(fhandler_pipe::select_write): Ditto.
(fhandler_pipe::select_except): Ditto.
2010-04-02 15:50:54 +00:00
Christopher Faylor 1ae0a7c5a6 * dtable.cc (dtable::init_std_file_from_handle): Avoid adding fh to fdtab until
we know that it is good.
* fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Handle error
conditions more consistently.  Avoid handle leakage on error.
2010-04-02 15:41:27 +00:00
Corinna Vinschen ed32dd8946 * fhandler_tty.cc (fhandler_tty_slave::close): Avoid potential crash
if former open call has been unsuccessful.
2010-04-02 14:11:45 +00:00
Corinna Vinschen ce3124dc19 * nlsfuncs.cc: Fix indentation. 2010-04-01 20:30:07 +00:00
Corinna Vinschen 57f7ebe1f2 * nlsfuncs.cc (rebase_locale_buf): New helper function to rebase
function pointers in locale structures.  Explain why this is necessary.
	(__set_lc_time_from_win): Use rebase_locale_buf after realloc.
	(__set_lc_numeric_from_win): Ditto.
	(__set_lc_monetary_from_win): Ditto.
2010-04-01 20:13:22 +00:00
Christopher Faylor bc3f0d64c9 * sigproc.cc (wait_sig): Make sure that strace is activated on __SIGSTRACE by
calling new strace::activate function.
* strace.cc (strace::activate): Rename from strace::strace.
* strace.h (strace::activate): Define new function.
(strace::strace): Call activate.
2010-03-31 18:06:02 +00:00
Christopher Faylor e446d6d0f4 * fhandler.h (fhandler_base_overlapped): Temporarily (?) make select_pipe_info
a friend until the fhandler_tty intertangling can be worked out.
* select.cc (select_pipe_info::add_watch_handle): Don't inspect the overlapped
event if we're not waiting for I/O.
(fhandler_tty_common::select_*): Change to standard function.  Don't do kludgy
fhandler_pipe coercion.
2010-03-31 15:00:48 +00:00
Christopher Faylor b791ec4a2c Add missing fhandler.h patch and ChangeLog comment. 2010-03-31 04:39:13 +00:00
Christopher Faylor 2aeef06579 * fhandler.cc (fhandler_base::dup): Call setup_overlapped unconditionally.
(fhandler_base::fork_fixup): Ditto.
(fhandler_base::fixup_after_fork): Ditto.
(fhandler_base::fixup_after_exec): Ditto.
(fhandler_base_overlapped::setup_overlapped): Move to this class from
fhandler_base.
(handler_base_overlapped::destroy_overlapped): Ditto.
(fhandler_base_overlapped::wait_overlapped): Ditto.  Track when we expect
pending I/O.
(fhandler_base_overlapped::read_overlapped): Move to this class from
fhandler_base.  Return error if ongoing I/O.
(fhandler_base_overlapped::write_overlapped): Ditto.
(fhandler_base_overlapped::has_ongoing_io): Semi-reinstate previous function.
* fhandler.h (fhandler_base::wait_overlapped): Move to fhandler_base_overlapped
class.
(fhandler_base::write_overlapped): Ditto.
(fhandler_base::get_overlapped): Ditto.
(fhandler_base::get_overlapped_buffer): Ditto.
(fhandler_base_overlapped): New class.
(fhandler_pipe): Inherit from fhandler_base_overlapped.  Remove overlapped
stuff as a result.
(fhandler_fifo): Ditto.
* pipe.cc (fhandler_pipe::fhandler_pipe): Initialize fhandler_base_overlapped.
(pipe): Put a descriptive name in the fhandler.
2010-03-31 04:26:11 +00:00
Corinna Vinschen d8b4cbe896 * fhandler_socket.cc (fhandler_socket::wait_for_events): Remove call to
sig_dispatch_pending.
2010-03-30 16:20:15 +00:00
Corinna Vinschen ca8eb333c9 2010-03-30 Thomas Wolff <towo@towo.net>
* fhandler.h (class dev_console): Drop vt100_graphics_mode_active.
	Add flags vt100_graphics_mode_G0, vt100_graphics_mode_G1 and
	iso_2022_G1.
	* fhandler_console.cc: Throughout, tune VT100 graphics mode switching
	to follow ISO 2022 strictly.
2010-03-30 16:17:34 +00:00
Corinna Vinschen 298cf05c21 * syscalls.cc (open): Remove call to sig_dispatch_pending. 2010-03-30 14:36:42 +00:00
Corinna Vinschen 83dddecb34 * net.cc: Remove calls to sig_dispatch_pending throughout.
* libc/rexec.cc: Ditto.
2010-03-30 09:25:46 +00:00
Corinna Vinschen e23275a8ac * mount.cc (fs_info::update): Allow variable FILE_SUPPORTS_SPARSE_FILES
flag in netapp flag test.  Add comment.
2010-03-30 08:55:23 +00:00
Corinna Vinschen b3cbb06c9d * spawn.cc (find_exec): Enable finding paths in backslash notation,
especially for the exec[vl]p functions.

	* path.cc (symlink_info::check): Disable returning directories with
	suffix appended here.
2010-03-29 17:15:51 +00:00
Corinna Vinschen ef7fc14537 * include/cygwin/version.h: Bump DLL minor version number to 3. 2010-03-29 15:06:09 +00:00
Corinna Vinschen ce3d89938b * fhandler.cc (fhandler_base::fstat): Keep st_ctime and st_birthtime
fixed to 2006-12-01 00:00 UTC.
2010-03-29 15:02:50 +00:00
Corinna Vinschen f1c6730ba3 * libc/rcmd.c: Enable IPv6. 2010-03-29 09:00:25 +00:00
Christopher Faylor 7a2df116fc change wording 2010-03-28 18:36:02 +00:00
Christopher Faylor e2402ed859 * fhandler.cc (fhandler_base::fstat): Set st_mtime time to current time. 2010-03-28 17:49:35 +00:00
Christopher Faylor c019a66c32 * globals.cc (exit_status): Add new ES_EXIT_STARTING enum.
* dcrt0.cc (cygwin_exit): Set exit_state to ES_EXIT_STARTING prior to calling
real exit.
* dll_init.cc (dll_list::detach): Remove dll from linked list and call
destructors even if exiting.  Don't call __cxa_finalize in exiting case.
2010-03-28 17:27:52 +00:00
Corinna Vinschen 68b0fa820d * nlsfuncs.cc (__set_charset_from_locale): Set default charset for
locales defaulting to codepage 936 to GB2312.
2010-03-27 21:07:17 +00:00
Corinna Vinschen 65b4b495c6 * fhandler_socket.cc (fhandler_socket::evaluate_events): Make erase
const in parameter list.
	(fhandler_socket::wait_for_events): Take a DWORD flags value instead of
	just a bool.  Call evaluate_events with erase flag according to
	MSG_PEEK value in flags.  Replace check for dontwait with check for
	MSG_DONTWAIT in flags.
	(fhandler_socket::connect): Call wait_for_events with 0 flags value.
	(fhandler_socket::accept4): Ditto.
	(fhandler_socket::recv_internal): Save flags in wait_flags.  Drop
	dontwait variable.  Call wait_for_events with wait_flags.
	(fhandler_socket::send_internal): Save MSG_DONTWAIT flag in wait_flags
	and call wait_for_events with wait_flags as argument.  Drop dontwait
	variable.
	* fhandler.h (class fhandler_socket): Change second parameter in
	declaration of wait_for_events to const DWORD.
2010-03-22 10:47:53 +00:00
Corinna Vinschen 0f6de51ae2 * fhandler_disk_file.cc (fhandler_cygdrive::fstat): Add standard read
permissions again.
2010-03-19 10:59:49 +00:00
Christopher Faylor 60698cf37a * shared.cc (init_installation_root): Change to make sure that scope of the
lock lasts the entire function.
2010-03-18 19:10:11 +00:00
Christopher Faylor cef5dfd75a * shared_info.h (user_info): Add dll_crt0_1 as a friend.
(user_info::version): Make LONG to accommodate spinlock use.
(user_info::create): New static function renamed from user_info_create.
(user_info::initialize): New private function renamed from
user_info_initialize.
(SHARED_VERSION): Delete.
(SHARED_VERSION_MAGIC): Ditto.
(USER_VERSION_MAGIC): Ditto.
(SHARED_INFO_CB): Ditto.
(USER_VERSION): Ditto.
(USER_VERSION_MAGIC): Ditto.
(CURR_SHARED_MAGIC): Update.
(CURR_USER_MAGIC): Ditto.
(shared_info::version): Make LONG to accommodate spinlock use.
(shared_info::create): New static function mirroring user_info::create.
(dll_crt0_1): Accommodate change to user_info::initialize.
* spinlock.h (spinlock::setto): New variable member.
(spinlock::done): New function.
(spinlock::spinlock): Generalize to allow arbitrary values and timeouts.  Call
done() when lock is not needed.
* ntdll.h: Make multiple-inclusion safe.
(NtQuerySystemTime): Declare.
* shared.cc (installation_root_inited): Rename from shared_mem_inited.
(init_installation_root): Make inline.  Use a spinlock to ensure that this is
initialized only once per session.
(user_info::initialize): Rename from user_shared_initialize.  Protect with
spinlock on sversion and remove other spinlock-like things.  Remove reference
to user_shared since it is now implicit.  Refer to spinlock version of
multiple_cygwin_problem to ensure that any spinlock is released.
(user_info::create): Rename from user_shared_create.  Accommodate change from
user_shared_initialize to user_info::initialize.
(shared_info::create): New inline function.
(shared_info::initialize): Protect with spinlock on sversion.  Move heap_init
back under specific control of shared_info spinlock.  Remove reference to
SHARED_INFO_CB and just use sizeof(*this).
(memory_init): Move all locking into respective functions where it is needed.
Accommodate name changes.  Remove call to heap_init().
* syscalls.cc (seteuid32): Accommodate name change to user_info::create().
* mount.cc (mount_info::create_root_entry): Report on errors from add_item
since they should be nonexistent.
(mount_info::init): Don't initialize nmounts.  It should already be zero.  Give
more verbose error when root_idx < 0.  Implicitly use this pointer rather than
explicitly referencing mount_table->.
(mount_info::add_item): Minor whitespace fix.
2010-03-15 21:29:15 +00:00
Christopher Faylor 654e623ce0 * sigproc.cc (no_signals_available): Get sense of the test right for previous
botched change.
2010-03-15 15:46:46 +00:00
Christopher Faylor d1ef5f33e6 * sigproc.cc (no_signals_available): Don't try to send a signal if still in
cygwin startup code.
2010-03-15 15:31:32 +00:00
Christopher Faylor f8af64be87 * spinlock.h: New file.
(spinlock): New class.
* shared.cc: Include spinlock.h.
(memory_init): Use new spinlock methods rather than roll-your-own.  Time out
after ten seconds if shared_mem_inited is not initialized.
* sync.h: Update copyright.  Remove vanity attribution.
* sigproc.cc (sigproc_terminate): Avoid attempts to kill the signal thread
while we're still initializing or suffer a deadlock.
2010-03-13 19:34:35 +00:00
Christopher Faylor 084ea5108e Throughout change all calls of low_priority_sleep (0) to yield ().
* miscfuncs.cc (yield): Rename from low_priority_sleep.  Remove all of the
logic which called Sleep() and just use SwitchToThread.
* miscfuncs.h (yield): Rename from low_priority_sleep.
(SLEEP_0_STAY_LOW): Delete unused define.
* shared.cc (memory_init): Move heap_init() call directly after shared memory
initialization to more closely mimic long-standing program flow.
* tty.cc (tty_list::terminate): Replace call to low_priority_sleep with Sleep.
2010-03-12 23:13:48 +00:00
Christopher Faylor c2fe02c48b * shared.cc (memory_init): Fix comment. Fix indentation. 2010-03-10 15:39:52 +00:00
Christopher Faylor bd3b3783f8 * shared_info.h (open_shared): Create function wrapper for common use case.
(open_shared): Change fifth argument to a pointer rather than a reference.
* fhandler_console.cc (fhandler_console::get_tty_stuff): Eliminate use of dummy
variable and call open_shared with constant.
* fhandler_process.cc (format_process_mounts): Ditto.
* pinfo.cc (pinfo::init): Pass pointer to shloc.
* shared.cc (shared_mem_inited): New variable.
(open_shared): Crate function wrapper for common use case.
(open_shared): Accommodate change to fifth argument to a pointer.
(shared_info::initialize): Remove spinlock test.  Simplify function.  Move
get_session_parent_dir call back here.
(memory_init): Protect global shared settings with shared_mem_inited spinlock.
Move get_session_parent_dir call to shared_info::initialize.
2010-03-09 21:26:55 +00:00
Christopher Faylor e8190d8fbf * shared.cc (inst_root_inited): Delete.
* (shared_info::initialize): Reorganize.  Move call to init_installation_root
here under spinlock control.  Move unneeded non-shared_info initialization out
of this function.
(memory_init): Remove call to init_installation_root.  Call heap_init and
get_session_parent_dir here.
2010-03-09 16:07:15 +00:00
Corinna Vinschen 8e75995c7f * syscalls.cc (nt_path_has_executable_suffix): Change storage class of
blessed_executable_suffixes to static.
	(rename): Revert meaning of old_explicit_suffix.  Change the rules
	for appending a .exe suffix and (yikes!) document them.
2010-03-04 16:20:37 +00:00
Corinna Vinschen a9fd742428 * cygwin.din: Export __xdr functions.
* include/cygwin/version.h: Bump version.
	* posix.sgml: Add a few more XDR functions to list
	of implemented Solaris functions.
2010-03-04 09:37:52 +00:00
Corinna Vinschen 53c24915c4 Add XDR support.
* cygwin.din: Export xdr functions.
	* include/cygwin/version.h: Bump version.
	* cygxdr.cc: New.
	* cygxdr.h: New.
	* dcrt0.cc (dll_crt0_1): Print the (rare) xdr-related
	error messages to stderr.
	* Makefile.in: Add cygxdr.
	* posix.sgml: Add new XDR functions to list of implemented Solaris
	functions.
2010-03-03 15:05:19 +00:00
Christopher Faylor cf15694586 * cygtls.h: Replace /*gentls_offsets*/ at end. 2010-03-02 00:49:15 +00:00
Christopher Faylor a9b112ec16 * exception.h: Fix copyright. 2010-03-01 06:39:47 +00:00
Christopher Faylor 98a97ac6cf Update some copyrights.
* cygtls.cc (_cygtls::call): Invoke new exception protection here.
(_cygtls::init_thread): Remove conditionalized exception handler setup.
(exception_list): Delete declaration.
(_cygtls::init_exception_handler): Delete obsolete function.
* cygtls.h: Remove (now) unneeded include.
(_cygtls): Make this a real C++ class.
(_cygtls::handle_exceptions): Remove.
(_cygtls::init_exception_handler): Remove.
(_cygtls::call2): Make private.
(myfault::faulted): Remove unneeded parentheses.
* dcrt0.cc (dll_crt0_1): Remove exception handler setup.
* dlfcn.cc (dlopen): Ditto.
(dlclose): Ditto.
* dll_init.cc (dll_dllcrt0_1): Ditto.
(dll_list::detach): Use new exception handler protection.
* exceptions.cc (dump_exception): Rename to prevent confusion with new class.
(exception::handle): Rename from _cygtls::handle_exceptions.  Accommodate new
exception class.  Accommodate rename to dump_exception.
* tlsoffsets.h: Regenerate.
2010-02-28 15:54:25 +00:00
Christopher Faylor d5d5bf4dd5 * cygtls.h (_cygtls::init_exception_handler): Eliminate argument.
(_cygtls::andreas): Convert to a pointer.
(san): Convert to a real class with methods.  Use a linked list to keep track
of previous handlers on the "stack".
(myfault): Rewrite to use new san class rather than calling directly into
_cygtls.
* cygtls.cc (_cygtls::init_exception_handler): Just assume that we're always
using the standard exception handler.
(_cygtls::init_thread): Reflect loss of argument to init_exception_handler.
* dcrt0.cc (dll_crt0_1): Ditto.
* dfcn.cc (dlopen): Ditto.
(dlclose): Reset the exception handler after FreeLibrary.
* dll_init.cc (dll_list::detach): Make sure that the exception handler is
initialized before calling destructors.
* exceptions.cc (_cygtls::handle_exceptions): Accommodate new andreas pointer.
* thread.cc (verifyable_object_isvalid): Pass objectptr to faulted for explicit
NULL pointer checking.
* tlsoffsets.h: Regenerate.
2010-02-26 21:36:31 +00:00
Christopher Faylor b6336c95b4 * mkimport: cd away from temp directory or Windows will have problems removing
the directory.
2010-02-26 19:37:43 +00:00
Corinna Vinschen 75bd77d246 * libc/strptime.cc: Implement support for era, alt_digits and POSIX
padding and width modifiers.
	(era_info_t): New type.
	(free_era_info): New static function to free era_info_t storage.
	(get_era_info): New static function to create era_info_t storage
	from LC_TIME era information.
	(alt_digits_t): New type.
	(get_alt_digits): New static function to create alt_digits_t storage
	from LC_TIME alt_digits information.
	(free_alt_digits): New static function to free alt_digits_t storage.
	(find_alt_digits): New static function to scan input for alternative
	digits and return them, if any.  Return NULL otherwise.
	(__strptime): New static function taking all code from strptime.
	Implement handling for E, O, +, 0, and width modifiers per POSIX-1.2008.
	(strptime): Convert into wrapper function to provide era_info and
	alt_digits pointers and call __strptime.
	(conv_num): Take additional alt_digits_t parameter and if it's not
	NULL, call find_alt_digits to convert.
2010-02-26 17:53:52 +00:00
Corinna Vinschen f467ede283 * strsig.cc: Fix formatting and copyright. 2010-02-26 16:00:17 +00:00
Pierre Humblet a90dc29d18 2010-02-26 Pierre Humblet <Pierre.Humblet@ieee.org>
* security.cc (check_access): Use user.imp_token if appropriate.
        Set errno and return if DuplicateTokenEx fails .
2010-02-26 14:51:59 +00:00
Corinna Vinschen d91ab868e1 Add missing ChangeLog checkin. 2010-02-26 09:37:12 +00:00
Yaakov Selkowitz 0512608dbc * include/cygwin/signal.h: Define SIGPWR as synonym for SIGLOST.
* strsig.cc: Ditto.
	* include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR.
2010-02-26 05:43:50 +00:00
Corinna Vinschen 1550b620c9 * lc_era.h (lc_era_t): Fix apparent glibc bug in ja_JP era definition. 2010-02-25 16:55:02 +00:00
Corinna Vinschen be71be8e18 * sec_auth.cc (get_full_privileged_inheritable_token): Fix dumb typo
when checking linked token for being a primary token.
2010-02-24 17:30:18 +00:00
Christopher Faylor c6a6b5a3ac * dlfcn.cc (dlopen): Make sure exception handler is really loaded after dynamic
load.
2010-02-24 08:03:44 +00:00
Christopher Faylor fd4a56afe8 * cygtls.cc (_cygtls::init_exception_handler): Force installation of our
exception handler to always be at the beginning.
2010-02-24 00:03:42 +00:00
Christopher Faylor 7414c24a77 * thread.cc (pthread_mutex::unlock): Don't attempt to unlock if there is an
error.
2010-02-23 07:12:38 +00:00
Christopher Faylor 478ea460eb * include/sys/strace.h: Define _STRACE_SPECIAL.
(strace_printf_wrap): Fix NOSTRACE definitions.
(strace_printf_wrap1): Fix NOSTRACE definitions.
(special_printf): Define.
* thread.cc: Perform minor syntax fix in a comment.  Rename
"is_good_initialzer*" to "is_initializer*" throughout.  Use pthread_printf
rather than debug_printf throughout.  Add extra pthread_printf debugging
throughout.
(pthread_mutex::_new_mutex): New constant value.
(pthread_mutex::_unlocked_mutex): Ditto.
(pthread_mutex::_destroyed_mutex): Ditto.
(pthread_mutex::no_owner): Define new function.
(pthread_mutex::can_be_unlocked): Detect no_owner situation.  Handle
PTHREAD_MUTEX_NORMAL as a special case.
(pthread::create_cancel_event): Use C++ boolean values.
(pthread::precreate): Use method to set mutex type.
(pthread_cond::pthread_cond): Ditto.
(pthread_rwlock::pthread_rwlock): Ditto.
(pthread_mutex::pthread_mutex): Set owner to _new_mutex initially.
(pthread_mutex::~pthread_mutex): Reset various elements to make it clearer if
they are incorrectly reused.
(pthread_mutex::lock): Add clarifying comment.
(pthread_mutex::unlock): Attempt to handle various mutex types correctly.  In
particular, reinstate ability to have one thread unlock another thread's mutex
if type == PTHREAD_MUTEX_NORMAL.
(semaphore::_fixup_after_fork): Avoid redundancy.
(pthread_mutex::_fixup_after_fork): Ditto.  Fix debugging statement.
(__pthread_cond_dowait): Accommodate changes to remove previously inexplicable
use can_be_unblocked() as a static function.
* thread.h: Rename "is_good_initialzer*" to "is_initializer*" throughout.
(pthread_mutex): Reorganize.  Make many things private.
(pthread_mutex::no_owner): Define new method.
(pthread_mutex::_new_mutex): Define new constant.
(pthread_mutex::_unlocked_mutex): Ditto.
(pthread_mutex::_destroyed_mutex): Ditto.
2010-02-22 20:36:04 +00:00
Corinna Vinschen f2ecf0ee5b * lc_era.h: Redefine lc_era_t to keep
default date and time formats as well to workaround YA Windows
	shortcoming.  Refresh with latest data.
	* lc_msg.h: Refresh with latest data.
	* nlsfuncs.cc (__eval_datetimefmt): Revert latest change.
	(__set_lc_time_from_win): Rename res to era.  Prefer default date and
	time formats from era array if available.
	(__set_lc_messages_from_win): Rename res to msg.
2010-02-22 11:01:46 +00:00
Corinna Vinschen 5d76584680 * lc_era.h (lc_era): Fix "ja_JP" era_t_fmt entry to use traditional
format.
	* nlsfuncs.cc (dt_flags): Remove DT_ERACAL since crippled era data
	in Windows makes it useless.
	(__eval_datetimefmt): Check if locale's default calender has
	non-gregorian start year.  Use era year also in default date entries,
	if so.
2010-02-20 22:10:26 +00:00
Corinna Vinschen 53a918f3d6 * path.cc (warn_msdos): Enforce extended hex printing of multibyte
pathnames.
2010-02-20 09:17:07 +00:00
Christopher Faylor ff3e6bcbec utils/ChangeLog:
* strace.cc (mnemonic_table): Add pthread mask option.
(usage): Document strace pthread mask option.
* utils.sgml: Ditto.

cygwin/ChangeLog:
* include/sys/strace.h: Remove old code.  Add support for ptrace
tracing.
2010-02-19 17:55:27 +00:00
Corinna Vinschen 6c36e83bab * lc_era.h: New file.
* nlsfuncs.cc: Include lc_era.h.
	(locale_cmp): convert arguments to char** to be usable for both types,
	lc_msg_t and lc_era_t.
	(__set_lc_time_from_win): Handle era-related data
2010-02-19 17:30:19 +00:00
Corinna Vinschen 1929fc8ece * fhandler_disk_file.cc (fhandler_disk_file::opendir): Try to open
directory with stat()-friendly access mask first.  Explain why.
2010-02-19 13:28:49 +00:00
Corinna Vinschen eb67604071 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Set st_rdev
to same value as st_dev.  Avoid useless debug output in executable
	check.  Add filename to debug output.
	(fhandler_disk_file::facl): Simplify code calling fstat methods to
	just call fstat to avoid errors with the cygdrive directory.
2010-02-19 12:37:37 +00:00
Corinna Vinschen 97c8d005d9 * nlsfuncs.cc (eval_datetimefmt): Rename force to flags.
(enum dt_flags): Define.
	(__eval_datetimefmt): Change force to flags and change type to
	dt_flags.  Accommodate throughout.
	(__set_lc_time_from_win): Accommodate above change.  Set era-related
	values to empty strings for now.
2010-02-18 18:07:14 +00:00
Christopher Faylor 90f5de33d5 * fhandler.cc (fhandler_base::setup_overlapped): Revert to starting with handle
in signalled state as it seems to fix some hangs.
2010-02-18 15:07:38 +00:00
Corinna Vinschen 66f2d8f13e * path.cc (path_conv::check): Treat native DOS paths as "noacl". 2010-02-15 13:29:02 +00:00
Corinna Vinschen 93579594b7 * mount.cc (mount_info::conv_to_win32_path): Set UNC path flags to
cygdrive prefix path flags.
2010-02-15 12:42:31 +00:00
Christopher Faylor 8103e40743 * fhandler.cc (fhandler_base::setup_overlapped): Don't set signalled state to
true initially.
(fhandler_base::has_ongoing_io): Delete ill-advised function.
(fhandler_base::read_overlapped): Rely on caller having checked nonblocking
state.  Don't attempt to (incorrectly) check it here.
(fhandler_base::write_overlapped): Remove call to has_ongoing_io.
* select.cc (peek_pipe): Ditto.
* fhandler.h (fhandler_base::has_ongoing_io): Delete declaration.
2010-02-15 01:45:05 +00:00
Christopher Faylor d67a6ce4a8 * regex/regcomp.c (xwcrtomb): Fix one explicable and one inexcplicable C
warning.
2010-02-14 21:28:44 +00:00
Corinna Vinschen 15a9e17656 * regex/regcomp.c (xwcrtomb): Don't convert Unicode chars outside the
base plane always to UTF-8.  Call wcsnrtombs instead to allow arbitrary
	multibyte charsets.
2010-02-13 12:26:06 +00:00
Corinna Vinschen 6b3f923fe2 * regex/regcomp.c (wgetnext): Use size_t as type for n2 since that's
what's returned by mbrtowc.
	* regex/regexec.c (xmbrtowc): Ditto.
2010-02-12 20:17:22 +00:00
Christopher Faylor 2b1407d372 * pthread.cc (pthread_mutex_init): Explicitly fill out third arg to
pthread_mutex::init.
* thread.cc: Remov some obsolete comments.
(verifyable_object_isvalid): Reflect change to use thread_magic_t for magic
numbers.
(pthread_mutex::pthread_mutex): Set magic number to invalid initially until
we've verified that everything is valid.
(pthread_mutex::unlock): Fix a comment.
(verifyable_object::verifyable_object): Delete here.
(~verifyable_object::~verifyable_object): Ditto.
(pthread_mutex::init): Don't run is_good_initializer for non-static objects.
* thread.h (thread_magic_t): New typedef.
(verifyable_object::verifyable_object): Use thread_magic_t;
(verifyable_object::magic): Ditto.
(pthread_mutex::is_good_initializer_or_bad_object): Remove unneeded variable
names.
(pthread_mutex::can_be_unlocked): Ditto.
(pthread_mutex::init): Ditto.  Remove default for third argument.
2010-02-12 20:07:13 +00:00
Christopher Faylor 97e5d3ffa4 fix typo 2010-02-12 18:38:59 +00:00
Corinna Vinschen 7bd2296c83 * regex/regcomp.c (xwcrtomb): New function to convert wide chars
outside of the base plane to UTF-8.  Call throughout instead of
	wcrtomb.
	(wgetnext): Handle surrogate pairs on UTF-16 systems.
	* regex/regexec.c (xmbrtowc): Ditto.
2010-02-12 17:46:39 +00:00
Corinna Vinschen e122c47112 * sec_auth.cc (get_user_local_groups): Retrieve name of well known
builtin group from system.  Explain why.
	* sec_helper.cc (well_known_builtin_sid): New SID for BUILTIN group.
	* security.h (well_known_builtin_sid): Declare.
2010-02-12 17:40:42 +00:00
Pierre Humblet 848dbc8f98 2010-02-11 Pierre Humblet <Pierre.Humblet@ieee.org>
* registry.c (get_registry_hive_path): Add space in string.
2010-02-12 01:04:52 +00:00
Corinna Vinschen 44caccfca2 * regex/engine.c (step): Drop Cygwin-specific definition.
(NONCHAR): Better cast here to make the test work.  Move comment
	from step here.
	(matcher): Disable skipping initial string in multibyte case.
	* regex/regcomp.c (p_bracket): Don't simplify singleton in the invert
	case.
	(p_b_term): Handle early end of pattern after dash in bracket
	expression.
	(singleton): Don't ignore the wides just because there's already a
	singleton in the single byte chars.  Fix condition for a singleton
	wide accordingly.
	(findmust): Check for LC_CTYPE charset, rather than LC_COLLATE charset.
	* regex2.h (CHIN): Fix condition in the icase & invert case.
	(ISWORD): Fix wrong cast to unsigned char.
2010-02-11 21:19:19 +00:00
Corinna Vinschen 87c0903113 * nlsfuncs.cc (initial_setlocale): Move check whether charset has
changed from here...
	(internal_setlocale): ...to here, to avoid unnecessary work when invoked
	via CW_INT_SETLOCALE.
2010-02-11 10:04:51 +00:00
Corinna Vinschen 4f1c922e06 * nlsfuncs.cc (__set_charset_from_locale): Allow "@euro" modifier only
for locales which use EUR as currency.
2010-02-10 12:29:26 +00:00
Corinna Vinschen ae40237a0a * nlsfuncs.cc (__get_lcid_from_locale): Convert iu_CA to iu-Latn-CA
rather than iu-Cans-CA on Vista and later.
	(__set_charset_from_locale): Set default charset for iu_CA to UTF-8.
2010-02-10 10:44:21 +00:00
Christopher Faylor 3700578ee8 * dcrt0.cc (_dll_crt0): Set _main_tls as early as possible.
* thread.cc (pthread_mutex::can_be_unlocked): Remove check for
MUTEX_OWNER_ANONYMOUS since it is racy and unsafe.
(pthread::init_mainthread): Initialize thread directly from _my_tls.
(pthread::self): Ditto.
(pthread::get_tls_self_pointer): Delete.
(pthread_mutex::pthread_mutex): Use an event rather than a semaphore.
(pthread_mutex::lock): Rename from _<func>.  Derive self directly.
(pthread_mutex::tryunlock): Ditto.
(pthread_mutex::destroy): Ditto.
(pthread_mutex::unlock): Ditto.  Accommodate change from semaphore to event.
(pthread_mutex::_fixup_after_fork): Accommodate change from semaphore to event.
(pthread_mutex::init): Don't attempt to initialize a semaphore unless it is in
an initialized state.  Do this check under mutex_initialization_lock.lock
* thread.h (fast_mutex::init): Use event rather than semaphore.
(fast_mutex::lock): Ditto.
(pthread_mutex::_lock): Delete.
(pthread_mutex::_unlock): Ditto.
(pthread_mutex::_trylock): Ditto.
(pthread_mutex::_destroy): Ditto.
(pthread_mutex::get_pthread_self): Ditto.
(pthread_mutex::get_tls_self_pointer): Ditto.
(pthread_mutex::lock): Un-inline.
(pthread_mutex::unlock): Ditto.
(pthread_mutex::trylock): Ditto.
(pthread_mutex::destroy): Ditto.
2010-02-10 07:25:26 +00:00
Christopher Faylor 161387a725 * cygtls.h (struct _cygtls): Remove unneeded elements.
* thread.cc (pthread::exit): Avoid potential double call to _my_tls.remove.
* tlsoffsets.h: Regenerate.
2010-02-10 03:17:32 +00:00
Corinna Vinschen 3d9e3644ee * nlsfuncs.cc (__set_lc_messages_from_win): Fix typo. 2010-02-09 11:44:03 +00:00
Corinna Vinschen 9008eb4041 * lc_msg.h: New file, fix a problem in locales with modifiers. 2010-02-09 11:38:44 +00:00
Corinna Vinschen 09dfe7e025 * lc_msg.h: New file, generated from running Linux system. 2010-02-09 11:16:38 +00:00
Corinna Vinschen 502a4f52ed * lc_msg.h: New file, autogenerated from CLDR data.
* nlsfuncs.cc: Include lc_msg.h.
	(lc_time_buf): Remove.
	(lc_numeric_buf): Remove.
	(lc_monetary_buf): Remove.
	(lc_mbstowcs): Fix previous fix.
	(__set_lc_time_from_win): Take additional pointer to buffer pointer,
	defined in newlib.
	(__set_lc_numeric_from_win): Ditto.
	(__set_lc_monetary_from_win): Ditto.
	(locale_cmp): New static function.
	(__set_lc_messages_from_win): New function to be called from newlib.
2010-02-09 08:59:49 +00:00
Corinna Vinschen f5a73638cd * external.cc (cygwin_internal): Add CW_INT_SETLOCALE case to
allow to call internal_setlocale().
	* nlsfuncs.cc (internal_setlocale): Make externally available.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_INT_SETLOCALE.

	* nlsfuncs.cc (lc_mbstowcs): Fix call to f_mbtowc.
	(__set_locale_from_locale_alias): Ignore "@cjknarrow" modifier.
2010-02-08 09:52:40 +00:00
Corinna Vinschen ab6ef08082 * nlsfuncs.cc (__get_lcid_from_locale): Handle "@cyrillic" modifier
for uz_UZ locale here.
	(__set_charset_from_locale): Accommodate above change.
2010-02-07 17:35:59 +00:00
Corinna Vinschen 07d061aeec * nlsfuncs.cc (__set_locale_from_locale_alias): New function to read
locale aliases from /usr/share/locale/locale.alias.
2010-02-07 13:31:08 +00:00
Corinna Vinschen 689109a76f * nlsfuncs.cc (__get_lcid_from_locale): Handle no_NO as nb_NO, rather
than nn_NO.
2010-02-06 21:57:33 +00:00
Corinna Vinschen 28d3c4fa38 * nlsfuncs.cc (has_modifier): MOve up in file to use in
__get_lcid_from_locale as well.
	(__get_lcid_from_locale): Handle no_NO locale as alias for nn_NO.
	Default all sr_XY locales to Cyrillic script.  Change lcid to Latin
	script if "@latin" modifier has been specified.
	(__set_charset_from_locale): Handle Serbian in codepage 1251 case as
	well.  Also check for sr_BA lcid.  Restrict "@euro" modifier to
	locales otherwise defaulting to ISO-8859-1.
2010-02-06 21:40:53 +00:00
Corinna Vinschen b6b236270e * nlsfuncs.cc (__set_charset_from_locale): Set default charset for
"ka_GE" locale to GEORGIAN-PS, for "kk_KZ" to PT154.
2010-02-06 18:30:18 +00:00
Corinna Vinschen 38d9821daf * path.cc (symlink_info::check_nfs_symlink): Reopen file with
FILE_READ_EA access since, surprisingly, you need it to read EAs even
	on NFS.
2010-02-06 15:57:21 +00:00
Corinna Vinschen b96600ef91 * sec_auth.cc (get_full_privileged_inheritable_token): New function
to fetch token with full privileges from logon token in Vista and
	later, and to make token inheritable.  Add lengthy comments to explain
	the function's job.
	(cygwin_logon_user): Drop calling SetHandleInformation.  Enable TCB
	privilege and call get_full_privileged_inheritable_token.
	(lsaauth): Don't fetch linked token and don't make handle inheritable
	here, just call get_full_privileged_inheritable_token instead.
	(lsaprivkeyauth): Ditto.
2010-02-06 13:13:15 +00:00
Corinna Vinschen 207889c9a7 * nlsfuncs.cc (__set_charset_from_locale): Set default locale for
"uz_UZ" locale to ISO-8859-1, with the "@cyrillic" modifier to UTF-8.
2010-02-05 21:35:34 +00:00
Christopher Faylor e7fd08839e * dll_init.cc (per_module::run_dtors): Use consistent method for running
destructors.
2010-02-05 15:05:22 +00:00
Christopher Faylor 6e3f2c626d * regcomp.c (p_ere): Workaround incorrect compiler warning.
* regerror.c (regatoi): Return non-const string or compiler complains in
certain inexplicable situations.
2010-02-04 21:05:07 +00:00
Corinna Vinschen aec8c3d510 * regex/engine.c (step): Declare and define with `int ch' rather than
`wint_t ch' parameter.  Explain why.
	(NONCHAR): Remove related Cygwin patch here, including wrong comment.
2010-02-04 17:34:44 +00:00
Corinna Vinschen e1e595a649 Replace regex files with multibyte-aware version from FreeBSD.
* Makefile.in (install-headers): Remove extra command to install
	regex.h.
	(uninstall-headers): Remove extra command to uninstall regex.h.
	* nlsfuncs.cc (collate_lcid): Make externally available to allow
	access to collation internals from regex functions.
	(collate_charset): Ditto.
	* wchar.h: Add __cplusplus guards to make C-clean.
	* include/regex.h: New file, replacing regex/regex.h.  Remove UCB
	advertising clause.
	* regex/COPYRIGHT: Accommodate BSD license.  Remove UCB advertising
	clause.
	* regex/cclass.h: Remove.
	* regex/cname.h: New file from FreeBSD.
	* regex/engine.c: Ditto.
	(NONCHAR): Tweak for Cygwin.
	* regex/engine.ih: Remove.
	* regex/mkh: Remove.
	* regex/regcomp.c: New file from FreeBSD.  Tweak slightly for Cygwin.
	Import required collate internals from nlsfunc.cc.
	(p_ere_exp): Add GNU-specific \< and \> handling for word boundaries.
	(p_simp_re): Ditto.
	(__collate_range_cmp): Define.
	(p_b_term): Use Cygwin-specific collate internals.
	(findmust): Ditto.
	* regex/regcomp.ih: Remove.
	* regex/regerror.c: New file from FreeBSD.  Fix a few compiler warnings.
	* regex/regerror.ih: Remove.
	* regex/regex.7: New file from FreeBSD.  Remove UCB advertising clause.
	* regex/regex.h: Remove.  Replaced by include/regex.h.
	* regex/regexec.c: New file from FreeBSD.  Fix a few compiler warnings.
	* regex/regfree.c: New file from FreeBSD.
	* regex/tests: Remove.
	* regex/utils.h: New file from FreeBSD.
2010-02-04 12:35:49 +00:00
Christopher Faylor 66dd5c4ff5 * sigproc.cc (get_proc_lock): Fix error message typo. 2010-02-03 19:57:05 +00:00
Corinna Vinschen 4a49c71595 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Workaround
another bug in NWFS.  Add comment to explain why.  Improve debug output
	in case the NT calls to test for binary fail.
	* path.h (path_conv::fs_is_cifs): New method.
	(path_conv::fs_is_nwfs): New method.
2010-02-03 16:05:33 +00:00
Corinna Vinschen fac3c73ba0 * include/paths.h (_PATH_MNTTAB): Define.
(_PATH_MOUNTED): Define.
	* include/mntent.h: Include paths.h.  Define MNTTAB and MOUNTED as their
	paths.h equivalents.  Add comment.
2010-02-02 11:17:54 +00:00
Christopher Faylor fc6a0dc849 * dcrt0.cc (atexit_lock): Delete.
(cygwin_exit): Remove atexit lock.
(cygwin_atexit): Ditto.  Rename parameter to match newlib.  Call __cxa_atexit
when invoked by a registered DLL.
* dll_init.cc (remove_dll_atexit): Delete.
(dll_list::find): New function.
(dll_list::detach): Use dll_list::find to find dll associated with return
address.  Use __cxa_finalize to run atexit functions associated with the dll.
(cygwin_detach_dll): Don't assume that HANDLE == void *.
* dll_init.h (dll_list::find): Declare.
(__cxa_atexit): Ditto.
(__cxa_finalize): Ditto.
* init.cc (dll_entry): Clarify comment.
2010-02-02 02:00:01 +00:00
Dave Korn a390615010 * how-startup-shutdown-works.txt: Add new document. 2010-02-02 01:54:55 +00:00
Corinna Vinschen 54c4a92634 * sec_auth.cc (lsaauth): Use CYG_LSA_MAGIC as checksum start value to
decouple from Cygwin release.
2010-01-29 19:51:11 +00:00
Corinna Vinschen 0b189c1ef3 * libc/strfmon.c (__setup_vars): Test for an empty string rather than
for a NULL pointer.
2010-01-29 19:38:22 +00:00
Christopher Faylor d5c4cd3f6c * dll_init.cc (remove_dll_atexit): New function.
(dll_list::detach): Run any atexit handlers registered in the DLL prior to
unloading.
2010-01-29 18:34:09 +00:00
Christopher Faylor 2b37c431b1 * libc/strfmon.c (__setup_vars): Fix compiler warning about assigning const
strings.  Compare a pointer to NULL rather than '\0'.
* dll_init.cc (dll_dllcrt0_1): Minor comment fix.
* pipe.cc (fhandler_pipe::create_selectable): Remove Win9x accommodation.
2010-01-29 17:37:54 +00:00
Corinna Vinschen 3432d6f1f7 Throughout, use FileBothDirectoryInformation info class rather than
FileDirectoryInformation info class to avoid problems with incomplete
	filesystem implementations.  Fix comments accordingly.
	* fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Set
	fname->Length to 0 in error case to avoid potential crash in debug
	output.
	(fhandler_disk_file::readdir): Try to speed up the working default case.
	Check for STATUS_INVALID_NETWORK_RESPONSE as potential status value
	returned by filesystems not implementing FileIdBothDirectoryInformation.
	* ntdll.h (STATUS_INVALID_NETWORK_RESPONSE): Define.
	(FILE_BOTH_DIRECTORY_INFORMATION): Rename to official name.
	* path.cc (symlink_info::check): Don't request FILE_READ_EA access, it's
	not required for NFS.  Try to speed up the working default case.  Check
	for STATUS_INVALID_NETWORK_RESPONSE as potential status value returned
	by filesystems not supporting non-NULL EA parameters.  Fix the way
	fs.update is called.  Improve debug output.
2010-01-29 11:20:06 +00:00
Corinna Vinschen 1b52d127bd * Makefile.in (tags, ctags, CTAGS)): Add rules to create tags file. 2010-01-28 11:54:00 +00:00
Corinna Vinschen 8944c6af48 * nlsfuncs.cc (__get_lcid_from_locale): Add comments. Fix typos in
comments.  Make sure to set last_lcid every time.  Return locale
	without territory part as invalid.  Handle modern serbian territory
	names per ISO 3166 on older systems as well.  Add appropriate comment.
	(__set_charset_from_locale): Handle LCID for sr_CS as well to make older
	systems happy.
2010-01-25 21:20:31 +00:00
Corinna Vinschen 0f8df291ac * nlsfuncs.cc (__set_charset_from_locale): Rearrange to set charset
more closely aligned to Glibc.
2010-01-25 11:55:46 +00:00
Corinna Vinschen 27ac64346f * spawn.cc (spawn_guts): Only try to remove long path prefix from
runpath if runpath is not NULL.
2010-01-25 11:21:56 +00:00
Corinna Vinschen 4fc8ae4f7b * nlsfuncs.cc (__get_lcid_from_locale): Fix a comment. Handle special
language/TERRITORY combinations explicitely.  Explain why.
2010-01-25 10:44:56 +00:00
Corinna Vinschen 05fab4a63b * nlsfuncs.cc (__set_charset_from_locale): Fix comment. 2010-01-24 14:43:51 +00:00
Corinna Vinschen 57c7e05ea7 * nlsfuncs.cc (check_codepage): Move from syscalls.cc here.
(internal_setlocale): Ditto.
	(initial_setlocale): Ditto.
	(setlocale): Ditto.
	* strfuncs.cc (__sjis_wctomb): Revert previous patch.
	(__sjis_mbtowc): Ditto.
	* syscalls.cc: Move setlocale-related functions to nlsfuncs.cc.
2010-01-24 12:29:49 +00:00
Corinna Vinschen 6b121156cd * strfuncs.cc (__sjis_wctomb): Special handling for characters which
differ between SJIS and Windows codepage 932, if charset is "SJIS".
	(__sjis_mbtowc): Ditto.
	(_jis_wctomb): Remove.
	(__jis_mbtowc): Remove.
2010-01-23 16:43:17 +00:00
Corinna Vinschen e020bfa85b * nlsfuncs.cc (wcsxfrm): Call LCMapStringW with LCMAP_BYTEREV flag to
allow correct comparison using wcscmp.
2010-01-23 10:11:43 +00:00
Corinna Vinschen bc9fcc287d * posix.sgml (strfmon): Move to implemented SUSv4 API. 2010-01-22 22:33:22 +00:00
Corinna Vinschen 326fb376dd * Makefile.in (DLL_OFILES): Add nlsfunc.o and strfmon.o.
* autoload.cc (LocaleNameToLCID): Define.
	* cygwin.din (strfmon): Export.
	* nlsfuncs.cc: New file.  Define a lot of internal functions called
	from setlocale.
	(wcscoll): Implement locale-aware here, using CompareStringW function.
	(strcoll): Ditto.
	(wcsxfrm): Implement locale-aware here, usingLCMapStringW function.
	(strxfrm): Ditto.
	(__set_charset_from_locale): Replace __set_charset_from_codepage.
	Return Linux-compatible charset.
	* strfuncs.cc (__set_charset_from_codepage): Remove.
	* wchar.h (__set_charset_from_codepage): Drop definition.
	* wincap.h (wincaps::has_localenames): New element.
	* wincap.cc: Implement above element throughout.
	* libc/strfmon.c: New file.
	* libc/strptime.cc: Remove locale constant strings in favor of
	access to locale-specifc data.
	(strptime): Point _CurrentTimeLocale to locale-specific data.
	Throughout use correct locale-specific format fields for all
	locale-specific formats.
	* include/monetary.h: New file.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2010-01-22 22:31:31 +00:00
Corinna Vinschen 43b4aa0f7c * strfuncs.cc: Remove needless includes. 2010-01-18 16:07:22 +00:00
Corinna Vinschen 62910474ac * syscalls.cc (internal_setlocale): Use UTF-8 internally if external
charset is ASCII.
2010-01-17 09:41:01 +00:00
Corinna Vinschen 011560c87d * libc/fnmatch.c: Replace with multibyte capable version from FreeBSD. 2010-01-16 15:11:56 +00:00
Corinna Vinschen 1a8d1e1040 * fhandler_socket.cc (fhandler_socket::accept4): Reset async flag
on accepted socket.
2010-01-16 10:22:58 +00:00
Corinna Vinschen 9d5bf1b13c * fhandler_socket.cc (fhandler_socket::accept4): Set nonblocking
flag exactly according to flags, as on Linux.
	* net.cc (cygwin_accept): Maintain BSD semantics here.
2010-01-15 21:34:27 +00:00
Corinna Vinschen 0d6531551b * cygwin.din (accept4): Export.
* fhandler.h (fhandler_socket::accept4): Rename from accept.  Take
	additional flag parameter.
	* fhandler_socket.cc (fhandler_socket::accept4): Ditto.  Handle
	SOCK_NONBLOCK and SOCK_CLOEXEC flags.
	* net.cc (cygwin_socket): Handle SOCK_NONBLOCK and SOCK_CLOEXEC flags
	in type.  Check for invalid flag values.
	(socketpair): Ditto.
	(cygwin_accept): Accommodate renaming of fhandler_socket::accept
	function to accept4.
	(accept4): New function.
	* posix.sgml: Mention accept4 as GNU extensions.
	* include/cygwin/socket.h (SOCK_NONBLOCK): Define.
	(SOCK_CLOEXEC): Define.
	(_SOCK_FLAG_MASK): Define when building Cygwin.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/socket.h (accept4): Declare.
2010-01-15 15:40:05 +00:00
Corinna Vinschen 14c800a5ba * posix.sgml: Mention dup3 and pipe2 as GNU extensions. 2010-01-15 14:22:42 +00:00
Corinna Vinschen 41d184bb62 * dcrt0.cc (dll_crt0_1): Reset locale to "C" at the last moment before
calling the application's main.
	* syscalls.cc (internal_setlocale): Don't reset locale to "C here.
	Change comment accordingly.
2010-01-14 18:56:24 +00:00