Commit Graph

5551 Commits

Author SHA1 Message Date
Corinna Vinschen e52961c403 * syscalls.cc (check_dir_not_empty): Never count more than 3 directory
entries.
2010-12-12 15:32:45 +00:00
Christopher Faylor f646aeb049 * init.cc (search_for): Put this in shared section or suffer subtle problems
with the tls.
* pinfo.cc (status_exit): Add debug output to report on unexpected exit.
* tls_pbuf.cc (tmp_pathbuf::c_get): Add more details to internal error.
2010-12-12 05:48:29 +00:00
Christopher Faylor 4f26f8486c fix typo 2010-12-09 21:44:22 +00:00
Corinna Vinschen 0dcfb061cf * autoload.cc (RETRY_COUNT): New define.
(std_dll_init): Restructure loop to retry loading a DLL only if
	specific errors occur.  If these errors persist, try to load DLL
	with name only.
2010-12-09 16:50:36 +00:00
Corinna Vinschen 51ecb7d9af * include/strings.h: Remove in favor of equivalent newlib file. 2010-12-08 14:28:18 +00:00
Corinna Vinschen 7695120581 * sec_acl.cc (getacl): Set DEF_CLASS_OBJ permissions to 07 instead
of 0777.
2010-12-08 10:24:20 +00:00
Corinna Vinschen 9de485e8e0 * path.cc (path_conv::check): Don't generate ENOENT for non-existant
CYGDRIVE and NETDRIVE paths.  Add comment.
2010-12-06 13:09:40 +00:00
Corinna Vinschen bdcc0b84ed * net.cc (get_xp_ifs): Fix counting of idx to return stable interface
alias names for interfaces with multiple IPv4 addresses.
2010-12-02 11:39:15 +00:00
Corinna Vinschen 910e31f015 * fhandler_tty.cc (fhandler_tty_slave::dup): Free path_conv strings
to avoid memory leak.  Add comment.
	(fhandler_pty_master::dup): Ditto.
	* path.h (path_conv::free_strings): New method.
2010-11-29 20:51:38 +00:00
Corinna Vinschen 943c59e3e8 * autoload.cc (SendARP): Remove.
* net.cc (get_flags): Set IFF_NOARP flag for PPP and SLIP devices.
	(get_xp_ifs): Unify IFF_BROADCAST setting.  Drop calling SendARP to
	set IFF_NOARP flag.
2010-11-23 15:37:41 +00:00
Corinna Vinschen 5fe7c5e01b * path.cc (symlink_info::check): Don't use FileNetworkOpenInformation
on Netapps.  Relax condition for workaround.  Always request size
	information via FileStandardInformation info class in workaround.
2010-11-23 09:26:16 +00:00
Corinna Vinschen fc0fb0ba13 * mount.cc (NETAPP_IGNORE): Add FILE_PERSISTENT_ACLS.
(FS_IS_NETAPP_DATAONTAP): Drop test for FILE_PERSISTENT_ACLS.
	(fs_info::update): Set filetype to ntfs in remote case, too.  Fix a
	couple of comments.  Add test for Netapps faking to be FAT.

	* mount.h (IMPLEMENT_FS_FLAG): Simplify definition and usage.
2010-11-22 14:19:50 +00:00
Corinna Vinschen 9dda712bd9 * net.cc (get_ipv4fromreg_ipcnt): Fix debug output. Only create debug
output if error is not ERROR_FILE_NOT_FOUND.
	(get_ipv4fromreg): Ditto.
2010-11-22 13:03:00 +00:00
Corinna Vinschen 5c6904b515 * fhandler_tty.cc (fhandler_tty_slave::fchown): Initialize mode to 0. 2010-11-18 18:55:10 +00:00
Corinna Vinschen 8506523421 * posix.sgml: Move llround and llroundf to implemented SUSv4 functions.
* include/cygwin/version.h: Add llround and llroundf to the comment for
	the 233 CYGWIN_VERSION_API_MINOR bump.
2010-11-15 12:44:57 +00:00
Yaakov Selkowitz cc353b9f34 * include/paths.h (_PATH_VARTMP): Define. 2010-11-02 17:38:36 +00:00
Christopher Faylor 49808040c5 * localtime.cc (is_upper): Rename to isupper and include ctype.h to pull in
standard macro.
(lcl_is_set): Define as an enum.
(tzsetwall): Assign lcl_is_set to correct enum values.
(tzset): Ditto.  Copy as much of TZ as will fit to TZ buffer.
2010-10-30 19:22:42 +00:00
Christopher Faylor 3e38e8abf7 * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 233. 2010-10-27 14:22:27 +00:00
Christopher Faylor ec515e9e47 Tweak entry. 2010-10-24 19:33:03 +00:00
Christopher Faylor 5160c5f430 * dcrt0.cc (do_exit): Don't set thread termination until all fds have been
closed since an fd may rely on a thread.
* fhandler_tty.cc: Reformat comment.
(fhandler_pty_master::pty_master_thread): Refuse ERROR_PIPE_CONNECTED state as
an error.
* globals.cc (exit_states): Reorder ES_THREADTERM.
* path.cc (find_fast_cwd_pointers): Remove excessively wordy DEBUGGING output.
2010-10-24 18:50:57 +00:00
Christopher Faylor 488ddaced3 * exceptions.cc (try_to_debug): Improve comment.
* fhandler_tty.cc (fhandler_pty_master::fhandler_pty_master): Add a comment.
2010-10-24 15:26:05 +00:00
Christopher Faylor c4f296c2a9 * pinfo.cc (pinfo::exit): Grab a tty lock before setting pgid. 2010-10-23 18:57:43 +00:00
Christopher Faylor 74882a259a * pinfo.cc (pinfo::exit): Reset tty pgrp to zero if no more handles open.
(_pinfo::set_ctty): Remove debugging stuff.
2010-10-23 18:55:01 +00:00
Christopher Faylor 50ed699a2a * fhandler_tty.cc (fhandler_pty_master::open): Remove debugging printf. 2010-10-23 18:11:20 +00:00
Christopher Faylor 4ce975efd3 * fhandler.h (fhandler_termios::tcinit): Make second argument non-optional.
* fhandler_console.cc (fhandler_console::open): Specify second argument to
tcinit.
* fhandler_termios.cc (fhandler_termios::tcinit): Rename second argument.  Set
pgid to 0 if this is a pty master.
(fhandler_termios::tcgetpgrp): Just return value of pgid.  It will be zero if
not initialized.
* fhandler_tty.cc (fhandler_tty_slave::open): Specify second argument to
tcinit.
(fhandler_tty_slave::ioctl): Implement TIOCGPRP/TIOCSPGRP.  Fix switch
indentation.
(fhandler_tty_master::ioctl): Implement TIOCGPRP/TIOCSPGRP.
* include/sys/termios.h (TIOCGPGRP): Define similarly to Linux.
* include/sys/termios.h (TIOCSPGRP): Ditto.
2010-10-23 18:07:08 +00:00
Christopher Faylor 2d5f37a988 * winsup/cygwin/cygwin.din: Add llround and llroundf. 2010-10-18 15:14:17 +00:00
Christopher Faylor 0e66e62668 fix dates 2010-10-16 17:58:48 +00:00
Corinna Vinschen 05aef9c690 *** empty log message *** 2010-10-09 11:01:03 +00:00
Corinna Vinschen 9c154abedb * cygheap.h (cwdstuff::override_win32_cwd): Declare.
* ntdll.h (struct _PEB): Add members accessed by the fast cwd method
	starting with Vista.
	(struct _KUSER_SHARED_DATA): Define with only the DismountCount.
	(RtlAllocateHeap): Declare.
	(RtlEnterCriticalSection): Declare.
	(RtlFreeHeap): Declare.
	(RtlLeaveCriticalSection): Declare.
	* path.cc (get_user_proc_parms): Remove.
	(struct _FAST_CWD): New structure.
	(fast_cwd_ptr): Define.
	(SharedUserData): Define.
	(peek32): Define.
	(find_fast_cwd_pointers): New function to find the global pointer
	to the current FAST_CWD structure.
	(copy_cwd_str): New helper function.
	(cwdstuff::override_win32_cwd): New method to set the Win32 CWD.
	(cwdstuff::init): Just call override_win32_cwd from here when
	started from native Win32 parent.
	(cwdstuff::set): Access Win32 CWD via PEB reference instead of using
	get_user_proc_parms function.  Memorize old DismountCount before
	opening directory handle.  Call override_win32_cwd to set up Win32 CWD.
	Be more verbose in comments.
	* wincap.h (wincaps::has_fast_cwd): New element.
	* wincap.cc: Implement has_fast_cwd element throughout.
2010-10-09 10:54:13 +00:00
Corinna Vinschen 9810eef4bf * cygwin.din: Export new complex math functions from newlib.
* posix.sgml: Move newly exported complex functions to implemented
	SUSv4 functions.
	* include/cygwin/version.h: Bump API minor version.
2010-10-08 10:51:17 +00:00
Corinna Vinschen dd0821e345 * fhandler.h (fhandler_base::get_stat_access): Delete.
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Always check
	executable suffix to get x-bits for .exe files also in notexec case.
	Always reopen file when checking for file header.
	* ntdll.h (wait_pending): Delete.
	* path.cc (symlink_info::check_shortcut): Drop call to wait_pending
	since file is always opened for sync IO.
	(symlink_info::check_sysfile): Ditto.
	(MIN_STAT_ACCESS): Remove.
	(FULL_STAT_ACCESS): Remove.
	(symlink_info::check): Drop access flag.  Revert to open file with
	just read attributes access.  Reorder symlink check to check for
	reparse points first.  Don't check reparse points for anything else,
	even on remote drives.  Open file for GENERIC_READ when trying to
	read shortcuts or system-bit symlinks. Accommodate dropped access
	flag in call to path_conv_handle::set.
	* path.h (class path_conv_handle): Drop access flag and accommodate
	all related methods.
2010-10-07 14:03:26 +00:00
Corinna Vinschen 3748b3e8e7 * posix_ipc.cc (ipc_mutex_init): Call NtCreateMutant to make sure the
access mask is correct.
	(ipc_cond_init): Take additional parameter to differ between send and
	receive event.  Call NtCreateEvent to make sure the access mask is
	correct.
	(ipc_cond_timedwait): Reset Event prior to calling WFMO.
	(struct mq_info): Split mqi_wait into two events, mqi_waitsend and
	mqi_waitrecv.
	(mq_open): Calloc mqinfo.  Create mqi_waitsend and mqi_waitrecv events.
	Make sure all synchronization objects are closed in case of an error.
	(_mq_send): Wait for mqi_waitsend event.  Signal mqi_waitrecv event.
	(_mq_receive): Wait for mqi_waitrecv event.  Signal mqi_waitsend event.
	(mq_close): Close mqi_waitsend and mqi_waitrecv events.
2010-10-06 20:20:01 +00:00
Corinna Vinschen 7c5ede22c5 * path.h (enum pathconv_arg): Remove PC_CHECK_EA. 2010-10-05 14:19:17 +00:00
Christopher Faylor f0b04035b1 * dcrt0.cc (dll_crt0_0): Move _main_tls initialization here.
(__dll_crt0): Only initialize _main_tls if it changes.
* fhandler_console.cc (fhandler_console::write): Fix debugging output.
2010-10-02 19:08:21 +00:00
Corinna Vinschen 1da77c2678 * fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Simplify.
Just call nfs_fetch_fattr3 if called via fstat.
	* nfs.cc (nfs_fetch_fattr3): New function to fetch NFS fattr3 info from
	file handle.
	* nfs.h (nfs_fetch_fattr3): Declare.
	* path.cc (symlink_info::check): Simplify NFS case.  Just call
	nfs_fetch_fattr3.
2010-10-02 19:03:44 +00:00
Corinna Vinschen ad2b2724a7 * fhandler_procsys.cc (fhandler_procsys::exists): Return virt_none
if path is invalid.
2010-10-02 08:44:08 +00:00
Christopher Faylor b66f254618 * autoload.cc (std_dll_init): Add a retry loop. 2010-10-01 21:53:11 +00:00
Corinna Vinschen 2d355410b7 * fhandler.cc: Drop including nfs.h.
* fhandler_disk_file.cc: Ditto.
	(fhandler_base::fstat_by_nfs_ea): Use fattr3 from path_conv member,
	unless called from fstat.
	* path.cc: Drop including nfs.h.
	(symlink_info::check): Rearrange definition of file info buffers.
	Fetch fattr3 info for files on NFS and store in conv_hdl for later
	use in fhandler_base::fstat_by_nfs_ea.  Use fattr3 file type to
	recognize symlink on NFS and try to fetch symlink target only for
	actual symlinks.
	* path.h: Include nfs.h.
	(class path_conv_handle): Change file info storage to union of
	FILE_NETWORK_OPEN_INFORMATION and fattr3 structures.
	(path_conv_handle::fnoi): Align to aforementioned change.
	(path_conv_handle::nfsattr): New method.
	(path_conv::nfsattr): New method.
2010-09-30 13:52:34 +00:00
Corinna Vinschen ab3cd88858 * path.cc (symlink_info::check): Remove erroneous assumption about
required permissions when reading NFS symlinks.
2010-09-30 10:42:34 +00:00
Christopher Faylor 1b0358455c * fhandler_tty.cc (fhandler_tty_slave::init): Revert to using tc->setpgid since
previous change broke some use cases.
2010-09-29 15:08:49 +00:00
Christopher Faylor f95f18c950 * fhandler_tty.cc (fhandler_tty_slave::init): Add debugging. Use tcsetpgrp to
potentially set pgid since it is smarter about deciding if a process is in the
background.
* include/sys/cygwin.h (PID_ORPHANED): Actually delete as planned.
(PID_NOTCYGWIN): Correctly define.
2010-09-29 03:57:24 +00:00
Corinna Vinschen 9d86e31826 * net.cc (getdomainname): Drop special case for NT4. 2010-09-28 16:18:57 +00:00
Corinna Vinschen 2a9b4b7aa0 Revert accidental previous login. 2010-09-28 14:49:31 +00:00
Corinna Vinschen 2f1f8815c0 * Makefile.in (DLL_IMPORTS): Remove libadvapi32.a.
* autoload.cc: Add all advapi32 entry points.
	* mount.cc (mount_info::init): Read user fstab only if we have a
	username.
	* passwd.cc (pwdgrp::read_passwd): Only use username if we have one.
	* shared.cc (user_info::initialize): Set cb last so as not to override
	planned behaviour in pwdgrp::read_passwd.
	* uinfo.cc (cygheap_user::init): Fetch Windows username from environment
	variable $USERNAME.  Don't set name in cygheap if variable is empty.
	(internal_getlogin): If we still have no username, try GetUserNameW.
2010-09-28 14:40:18 +00:00
Corinna Vinschen 91e0b943a0 * fhandler_tty.cc (fhandler_pty_master::setup): Always create master
thread.
2010-09-28 10:13:19 +00:00
Corinna Vinschen 41c91ad68d * syscalls.cc (gethostid): Use correct path to ProductId registry value. 2010-09-28 07:54:52 +00:00
Corinna Vinschen 3f1d4f8757 * mount.cc (fs_info::update): Remove erroneous NtClose on random handle
value.
2010-09-27 16:10:14 +00:00
Corinna Vinschen ebdc75d9b5 * uinfo.cc (cygheap_user::init): Call GetUserNameW and convert to
multibyte here so as not to rely on the current ANSI page.
2010-09-26 15:45:10 +00:00
Christopher Faylor 71ef21429a * dcrt0.cc (__main): Force signal synchronization. 2010-09-26 14:57:12 +00:00
Corinna Vinschen 6fe59500e5 * fhandler_socket.cc (fhandler_socket::bind): Drop has_exclusiveaddruse
condition.  Fix comment about availability.  Move remaining comment to
	the right spot.  Drop has_ip_helper_lib condition.
	* net.cc (cygwin_setsockopt): Drop has_disabled_user_tos_setting
	condition.  Fix comment.
	(get_2k_ifs): Fix comment.
	(get_nt_ifs): Remove.
	(getifaddrs): Drop call to get_nt_ifs.
	(get_ifconf): Ditto.
	* wincap.cc: Throughout, drop has_ip_helper_lib,
	has_disabled_user_tos_setting, and has_exclusiveaddruse settings from
	wincaps.
	(wincap_unknown): Remove.
	(wincap_nt4): Remove.
	(wincap_minimal): New macro, set to wincap_nt4sp4 for now.
	(wincapc::init): Drop test for pre-SP4 NT4.  Just imply at least NT SP4.
	Replace references to wincap_unknown with references to wincap_minimal.
	* wincap.h (struct wincaps): Drop has_ip_helper_lib,
	has_disabled_user_tos_setting, and has_exclusiveaddruse flags and
	methods.
2010-09-25 20:06:21 +00:00
Corinna Vinschen 92626febdd * autoload.cc: Throughout. order entry points alphabetically by DLL
and function name.  Make functions which are available on all supported
	systems non-optional.  Fix return value on entry points imported from
	secur32.dll.  Add comment.
	(std_dll_init): Call fesetenv unconditionally.
2010-09-25 19:57:34 +00:00
Christopher Faylor 8d07b1aa2b * autoload.cc (std_dll_init): Move dll_path closer to its use. Use dll_path in
fatal error.  Set ret values under lock control.
* lib/minires.c (res_nsend): Fix compilation errors owing to pointer
signedness.
2010-09-24 19:53:18 +00:00
Corinna Vinschen 7438a10a01 * fhandler.cc (fhandler_base::open): Handle query_write_dac flag.
* fhandler.h (enum query_state): Add query_write_dac flag.
	* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Open file
	with query_write_dac instead of query_write_control.
2010-09-24 16:22:53 +00:00
Corinna Vinschen 3498f76deb * errno.cc (errmap): Map ERROR_BAD_NET_RESP to ENOSYS.
* fhandler_disk_file.cc (fhandler_disk_file::facl): Handle ENOSYS and
	point to  the explanation.
	* ntdll.h (STATUS_NOT_IMPLEMENTED): Define.
	* path.cc (symlink_info::check): Handle the inability of NT4 to use
	FileNetworkOpenInformation on share root dirs in either direction.
	* path.h (slash_unc_prefix_p): Remove unused declaration.
	* security.cc (get_info_from_sd): Handle ENOSYS from get_file_sd.
	Explain when this happens.
2010-09-24 12:41:33 +00:00
Christopher Faylor b375557956 * autoload.cc (std_dll_init): Use correct format type when displaying dll name
in error output.
2010-09-23 20:18:16 +00:00
Pierre Humblet 5c22068f7f 2010-09-21 Pierre Humblet <Pierre.Humblet@ieee.org>
* libc/minires.c (res_nsend): Use the Windows resolver if appropriate.
        (dn_expand): Only set errno in case of error. Delete old comments.
        (dn_skipname): Fix typo in comment.
2010-09-21 21:41:31 +00:00
Corinna Vinschen b53c1929e5 * path.cc (cwdstuff::set): Replace constant 2 with sizeof(WCHAR) where
appropriate.
2010-09-21 16:41:17 +00:00
Corinna Vinschen 4c9d01fdad * mount.h (class fs_info): Add has_buggy_reopen flag and accessor
methods.
	* mount.cc (fs_info::update): Set has_buggy_reopen flag for NWFS.
	Add comment.
	* path.h (path_conv::get_object_attr) Make inline method.
	(path_conv::init_reopen_attr): New inline method.
	* path.cc (path_conv::get_object_attr): Remove.
	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Use
	path_conv::init_reopen_attr method to initialize OBJECT_ATTRIBUTE for
	reopening file.
	(fhandler_disk_file::fchmod): Ditto.
	(fhandler_base::utimens_fs): Ditto.
	(fhandler_disk_file::rewinddir): Ditto.
	* syscalls.cc (unlink_nt): Ditto.
2010-09-21 16:32:22 +00:00
Corinna Vinschen 7ba1698ed9 * fhandler.cc (fhandler_base::open): Always open NFS files with
FILE_READ_EA, even when opening with O_WRONLY to allow fstat.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Call
	FlushFileBuffers if file has been opened for writing.  Explain why.
	(fhandler_base::fstat_by_handle): Renew content of pc.fnoi if called
	via fstat.  Explain why.  Fix formatting.
	* path.cc (symlink_info::check): Try to open file the second time with
	FILE_READ_EA permissions since it's needed in later calls to
	fhandler_base::fstat_by_nfs_ea.
2010-09-21 16:07:20 +00:00
Christopher Faylor df4d2bea3d * include/sys/cygwin.h (PID_NOTCYGWIN): New enum.
* spawn.cc (spawn_guts): Set a flag when a process is not a cygwin process.
* fhandler_tty.cc (fhandler_tty_slave::init): Remove previous change.  Try a
different method to determine when we should become the process group owner.
* signal.cc (kill0): Remove archaic code which dealt with never-set flag.
2010-09-20 22:28:57 +00:00
Christopher Faylor 73b6b43ed3 * fhandler_tty.cc (fhandler_tty_slave::init): Add additional checks to
determine when a process should grab control of a tty's pgid.  Use
being_debugged() for consistency.
* debug.h (being_debugged): Remove vestige of win9x accommodation.
2010-09-20 20:25:50 +00:00
Christopher Faylor b64733135a * wincap.h (wincaps::has_buggy_thread_startup): Declare.
(wincapc::has_buggy_thread_startup): Ditto.
* wincap.cc::wincap_*): Accommodate has_buggy_thread_startup.
(wincapc::init): Explicitly turn off has_buggy_thread_startup if not WOW64.
* cygthread.h (cygthread::thread_handle): Declare/define new method.
* dcrt0.cc (_dll_crt0): Don't call __sinit here.
(dll_crt0_0): Don't call sigproc_init during initialization if
wincap.has_buggy_thread_startup().
(dll_crt0_1): Defer sigproc_init to here when
wincap.has_buggy_thread_startup().  Call __sinit after we've determined that
we're not forking.
(__main): Rework comments.  Add potential future reminder.
2010-09-19 20:18:36 +00:00
Corinna Vinschen 421ff3ff77 * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Fetch number
of links and inode number only if path has good inodes.
	(fhandler_base::fstat_by_name): Fetch inode number only if path has
	good inodes.
2010-09-15 11:26:10 +00:00
Corinna Vinschen 1df35772d6 * path.cc (symlink_info::check): Make sure AllocationSize and EndOfFile
are stored in the right order when fetching the info from the
	NtQueryDirectoryFile result.
2010-09-14 14:10:39 +00:00
Corinna Vinschen 27e79675f8 * fhandler_process.cc (get_mem_values): Simplify code. Fix
NtQueryVirtualMemory loop so it handles memory allocation gracefully.
	Always set errno to a useful value.
2010-09-13 13:02:19 +00:00
Corinna Vinschen c80480bfa0 * fhandler.h (class fhandler_base): Change inheritance of fstat_helper
and fstat_by_...  methods to private.
	(fhandler_base::fstat_helper): Drop all redundant arguments.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Drop call
	to fstat_by_nfs_ea here.  Drop fetching basic file information.
	Drop setting file attributes.  Accommodate change in fstat_helper call.
	(fhandler_base::fstat_by_name): Simplify.  Only fetch directory
	information to get the inode number.  Drop setting file attributes.
	Accommodate change in fstat_helper call.
	(fhandler_base::fstat_fs): Call fstat_by_nfs_ea if on NFS.
	(fhandler_base::fstat_helper): Drop all redundant arguments.  Use
	information already collected in the fhandler.  Move heading comment
	into code and drop dwFileAttributes comment.
	* mmap.cc (mmap64): Call fstat_fs rather than fstat_by_handle.
	* mount.cc (fs_info::update): Note that has_buggy_basic_info is unused.
	* path.cc (symlink_info::check_reparse_point): Add comment.
	(symlink_info::check): Fetch FileNetworkOpenInformation rather than
	FileBasicInformation throughout, except on NFS.  Explain why.  Store
	FILE_NETWORK_OPEN_INFORMATION in conv_hdl.  Remove
	FILE_ATTRIBUTE_DIRECTORY attribute in conv_hdl for reparse point
	symlinks.
	* path.h (class path_conv_handle): Add FILE_NETWORK_OPEN_INFORMATION
	member _fnoi.
	(path_conv_handle::fnoi): New accessor method for _fnoi.
	(path_conv::fnoi): New accessor method for cubv_hdl._fnoi.

	* fhandler_tty.cc (fhandler_tty_slave::init): Use tty::setpgid method.
2010-09-13 11:17:36 +00:00
Corinna Vinschen f7382efe27 * sec_acl.cc (acl_worker): Remove.
(acl32): Implement acl_worker functionality here.
	(lacl32): Just return -1 with errno set to ENOSYS.
	(lacl): Ditto.
	* include/cygwin/acl.h (lacl): Remove this call.
2010-09-12 19:43:55 +00:00
Christopher Faylor 11fef78748 * sigproc.cc (sig_dispatch_pending): Remove debugging statement.
(sigproc_init): Wrap a long line.
2010-09-12 19:13:09 +00:00
Christopher Faylor 6c6eb02b33 * cygthread.h (cygthread::cygthread): Reorganize slightly.
* dcrt0.cc (dll_crt0_0): Move sigproc initialization later to ensure everything
we need has been set up.
(dll_crt0_1): Streamline some logic slightly.
* sigproc.cc (no_signals_available): Add back dropped test for macro parameter.
* fhandler_console.cc (fhandler_console::write): Show a little bit of what's
being written to the console in debugging output.
2010-09-12 15:49:30 +00:00
Corinna Vinschen 18df393573 * syscalls.cc (start_transaction): Make inline function. Move up to be
more generally available.
	(stop_transaction): Ditto.
	(unlink_nt): Potentially start transaction when trying to delete file
	with DOS R/O attribute set.  If file is .lnk symlink, check for number
	of hardlinks.  Add "out" label and only return via "out".  Rearrange
	reversion of DOS R/O attribute and, on success, only revert R/O
	attribute if file is .lnk symlink with more than one hardlink.  Add
	length comment to explain why.
2010-09-12 11:41:56 +00:00
Corinna Vinschen 99544f92a0 * fhandler_disk_file.cc (fhandler_disk_file::rmdir): More thoroughly
check the existence condition on remote drives.  Enhance comment.
2010-09-11 10:58:42 +00:00
Dave Korn 0f81b5d4bc winsup/cygwin/ChangeLog:
* Makefile.in (DLL_OFILES): Add new fenv.o module.
	(fenv_CFLAGS): New flags definition for fenv.o compile.
	* autoload.cc (std_dll_init): Use fenv.h functions instead of direct
	manipulation of x87 FPU registers.
	* crt0.c (mainCRTStartup): Likewise.
	* cygwin.din (feclearexcept, fegetexceptflag, feraiseexcept,
	fesetexceptflag, fetestexcept, fegetround, fesetround, fegetenv,
	feholdexcept, fesetenv, feupdateenv, fegetprec, fesetprec,
	feenableexcept, fedisableexcept, fegetexcept, _feinitialise,
	_fe_dfl_env, _fe_nomask_env): Export new functions and data items.
	* fenv.cc: New file.
	* posix.sgml: Update status of newly-implemented APIs.
	* include/fenv.h: Likewise related header.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2010-09-11 06:53:28 +00:00
Corinna Vinschen f7dea7f233 * syscalls.cc (rename): Limit retry loop in case of sharing violation
to about a second.
2010-09-10 19:55:26 +00:00
Corinna Vinschen 396561aa0b * syscalls.cc (fstatat): Call stat_worker directly from here. 2010-09-10 18:51:44 +00:00
Corinna Vinschen 4e8f539f15 * flock.cc (allow_others_to_sync): Define MAX_PROCESS_SD_SIZE. Use
instead of ACL_DEFAULT_SIZE.
	* sec_acl.cc (setacl): Use TLS buffer to allow maximum ACL size.
	* security.h (ACL_DEFAULT_SIZE): Drop definition.
	(ACL_MAXIMUM_SIZE): Define.
	(SD_MAXIMUM_SIZE): Define.
	* security.cc (get_file_sd): Allocate security_decscriptor with size
	SD_MAXIMUM_SIZE.
	(alloc_sd): Use TLS buffer to allow maximum ACL size.
2010-09-10 14:53:44 +00:00
Corinna Vinschen f65c5a0a2b * mount.cc (class fs_info_cache): New class to cache filesystem
information.
	(fs_info::update): Check FileFsVolumeInformation against filesystem
	cache and use it, if filesystem is already available.  Add filesystem
	to cache, if not.  Only request FileFsObjectIdInformation if
	FILE_SUPPORTS_OBJECT_IDS is set in filesystem flags.
	* ntdll.h (struct _FILE_FS_VOLUME_INFORMATION): Add pragma pack so the
	structure size is matching the OS expectations.  Add __dummy member
	used in filesystem cache.
2010-09-10 10:04:28 +00:00
Corinna Vinschen 67a9307898 * security.cc (get_file_sd): Add bool parameter justcreated. Use
GetSecurityInfo only if justcreated is true, NtQuerySecurityObject
	otherwise.  Add comment to explain why.  Don't waste time to call
	NtQuerySecurityObject twice, just allocate big enough area.
	(get_file_attribute): Call get_file_sd with justcreated set to false.
	(set_file_attribute): Call get_file_sd with justcreated depending on
	S_JUSTCREATED pseudo file attribute.
	(check_file_access): Call get_file_sd with justcreated set to false.
	* sec_acl.cc (setacl): Ditto.
	(getacl): Ditto.
	* security.h: Convert many functions to regparm functions.
	(get_file_sd): Declare with extra bool parameter.
2010-09-10 09:32:13 +00:00
Corinna Vinschen 28e19bafa0 * fhandler_procsys.cc (fhandler_procsys::exists): Rearrange to handle
dangling symlinks correctly.  Fix comments.
	(fhandler_procsys::fill_filebuf): Remove useless comment.
2010-09-10 08:06:02 +00:00
Corinna Vinschen f99de2b3d2 * fhandler_procsys.cc (fhandler_procsys::open): Simplify by just
calling fhandler_base::open.
2010-09-08 09:10:21 +00:00
Christopher Faylor fa3ab15b1c fix two typos 2010-09-07 15:13:14 +00:00
Corinna Vinschen 43f65cdd7d * Makefile.in (DLL_OFILES): Add fhandler_procsys.o.
* devices.h (enum fh_devices): Add FH_PROCSYS.
	* devices.in (dev_procsys_storage): New device.
	* devices.cc: Regenerate.
	* dtable.cc (build_fh_pc): Add code to allocate fhandler_procsys.
	* fhandler.h (proc_len): Convert to size_t.
	(procsys): Declare.
	(procsys_len): Declare.
	(enum virtual_ftype_t): Move here from fhandler_virtual.h.
	Add members supported by fhandler_procsys.
	(fhandler_virtual::exists): Return virtual_ftype_t.  Change
	in all derived classes.
	(class fhandler_procsys): New class.
	(fhandler_union): Add fhandler_procnet and fhandler_procsys members.
	* fhandler_disk_file.cc (__DIR_mounts::check_missing_mount): Use
	ro_u_proc.
	(fhandler_base::fstat_by_handle): Don't copy attributes if file is an
	NT device.
	(fhandler_base::fstat_by_name): Ditto.
	* fhandler_netdrive.cc (fhandler_netdrive::exists): Return
	virtual_ftype_t.
	* fhandler_proc.cc (proc_tab): Sort alphabetically.  Use _VN macro
	to store length.
	(proc_len): Change to size_t.
	(proc_tab_cmp): New static function.
	(virt_tab_search): New function to search entry in virt_tab_t
	arrays.  Use throughout in /proc and sibling classes instead of
	loop.
	(fhandler_proc::exists): Return virtual_ftype_t.
	* fhandler_process.cc (process_tab): Sort alphabetically.  Use _VN
	macro to store length.
	(fhandler_process::exists): Return virtual_ftype_t.
	(fhandler_process::open): Simplify code.
	* fhandler_procnet.cc (procnet_tab): Sort alphabetically.  Use _VN
	macro to store length.
	(fhandler_procnet::exists): Return virtual_ftype_t.
	(fhandler_procnet::open): Simplify.
	* fhandler_procsys.cc: New file.
	* fhandler_registry.cc (fhandler_registry::exists): Return
	virtual_ftype_t.
	* fhandler_virtual.cc (fhandler_virtual::exists): Ditto.
	* fhandler_virtual.h (enum virtual_ftype_t): Move to fhandler.h.
	(virt_tab_t): Add name_len member.
	(_VN): New macro.
	(virt_tab_search): Declare.
	* mount.cc (mount_info::conv_to_win32_path): Fix comment.  Backslashify
	isprocsys_dev paths.
	* ntdll.h (STATUS_OBJECT_TYPE_MISMATCH): Define
	(STATUS_INSTANCE_NOT_AVAILABLE): Define.
	(STATUS_PIPE_NOT_AVAILABLE): Define.
	(STATUS_INVALID_PIPE_STATE): Define.
	(STATUS_PIPE_BUSY): Define.
	(SYMBOLIC_LINK_QUERY): Define.
	(NtOpenSymbolicLinkObject): Declare.
	(NtQuerySymbolicLinkObject): Declare.
	* path.cc (path_conv::check): Accommodate fact that exists method
	returns virtual_ftype_t now.  Add cases for new virtual_ftype_t
	types.
	(cygwin_conv_path): Add GLOBALROOT prefix to native device paths.
	Make sure to strip \\?\ prefix only for actual filesystem-based
	paths, not for all paths.
	* path.h (isproc_dev): Add FH_PROCSYS.
	(isprocsys_dev): Define.
2010-09-06 09:47:01 +00:00
Corinna Vinschen 0de488378f * mount.cc (mount_info::from_fstab_line): Reorder to make sure all
mounts from user fstab are user mounts.
	(mount): Make sure all mounts are user mounts, even those added via
	mount -a.
2010-09-04 08:44:59 +00:00
Christopher Faylor 6a7d80f2ae * sigoproc.cc (sigproc_init): Use American spelling in comment. 2010-09-02 05:34:02 +00:00
Christopher Faylor fc0e5071bc * dcrt0.cc (dll_crt0_0): Remove myself settings.
* fork.cc (fork): Set myself process_state
* pinfo.cc (pinfo_init): Ditto.
(pinfo::thisproc): Make sure any sendsig setting is correctly copied.
* pinfo.h: Update copyright.  Remove unused code.
2010-09-01 21:06:36 +00:00
Christopher Faylor b9874a0c14 * cygthread.cc (cygthread::create): Fix incorrect use of name rather than
__name.
* cygthread.h (cygthread::cygthread): Create versions which eliminate 'n'
parameter.
* dcrt0.cc (dll_crt0_1): Remove check for threadfunc_ix.  Remove obsolete
comments.  Set process_state to active here.
* fhandler_netdrive.cc (create_thread_and_wait): Use shortened cygthread
constructor.
* timer.cc (timer_tracker::settime): Ditto.
* window.cc (HWND): Ditto.
* fhandler_tty.cc: Use shortened cygthread constructor, where appropriate,
throughout.
* select.cc: Ditto.
* fork.cc (frok::child): Remove wait_for_sigthread.
(fork): Reformat if for slightly better clarity.
* init.cc (dll_finished_loading): New variable.
(dll_entry): Use dll_finished_loading to determine when we should call
merge_threadfunc.
* sigproc.cc (no_signals_available): Simplify by using my_readsig.
(wait_sig_inited): Delete.
(wait_sig): Define as void function.
(pending_signals): Accommodate change to wait_sig definition.
(wait_for_sigthread): Delete definition.
(sigproc_init): Initialize signal pipe here, before wait_sig thread is created.
Use void form of cygthread creation.
(init_sig_pipe): Delete.
(wait_sig): Return void rather than DWORD.  Assume previous initialization of
signal pipe.  Set my_sendsig to NULL when exiting.
* sigproc.h (wait_for_sigthread): Delete declaration.
2010-09-01 18:24:11 +00:00
Corinna Vinschen 20973ec948 * fhandler_netdrive.cc (fhandler_netdrive::readdir): Set d_type.
(fhandler_netdrive::seekdir): Fix test for readdir return value.
	* fhandler_registry.cc (fhandler_registry::seekdir): Ditto.
2010-09-01 10:30:52 +00:00
Corinna Vinschen 41073b47f5 * include/cygwin/version.h: Bump DLL minor version number to 8. 2010-09-01 07:16:49 +00:00
Corinna Vinschen 274116ea12 * path.cc (normalize_posix_path): Preserve //./ and //?/ prefixes.
(path_conv::check): Allow access to root directory of native NT disk
	devices.
2010-08-31 13:48:04 +00:00
Corinna Vinschen 8fd414ffc6 * include/cygwin/version.h: Bump DLL minor version number to 7. 2010-08-31 07:47:51 +00:00
Christopher Faylor 166f3822e8 * dcrt0.cc (dll_crt0_0): Move sigproc_init later, after cygheap initialization
since it relies on the cygheap existing (even if it shouldn't matter do to dll
initialization serialization).
2010-08-30 23:23:28 +00:00
Corinna Vinschen 45bc8c1f50 * posix.sgml (std-notes): Fix typos and incorrectnesses. 2010-08-30 14:16:01 +00:00
Corinna Vinschen 92596190c4 * autoload.cc (MsgWaitForMultipleObjectsEx): Define.
(MsgWaitForMultipleObjects): Remove.
	* select.cc (select_stuff::wait): Use MsgWaitForMultipleObjectsEx with
	QS_ALLPOSTMESSAGE and, if possible, MWMO_INPUTAVAILABLE flags.  Explain
	why.  Fix a potential crash due to a NULL pointer in WAIT_FAILED case.
	(peek_windows): Use filter pattern on NT4.  Explain why.
	* wincap.h (wincaps::has_mwmo_inputavailable): New element.
	* wincap.cc: Implement above element throughout.
2010-08-30 10:39:43 +00:00
Christopher Faylor 98edb049e4 add missing file 2010-08-30 02:09:30 +00:00
Christopher Faylor 92117cb21f * winlean.h: New file.
* automode.c: Use "winlean.h".
* binmode.c: Ditto.
* gmon.c: Ditto.
* textmode.c: Ditto.
* textreadmode.c: Ditto.
* winsup.h: Ditto.
* lib/cygwin_attach_dll.c: Ditto.
* lib/dll_main.cc: Ditto.
* profile.c: Ditto.
* crt0.c: Ditto.  Cleanup ancient cruft.  Add dummy calls to cygwin_premain*.
* include/sys/cygwin.h: Remove old stuff.  Move premain declarations nearer to
other cygwin-specific function declarations.
* globals.cc: Add comment.
2010-08-30 01:57:37 +00:00
Corinna Vinschen 893a8b78fc * autoload.cc (LoadDLLprime): Change dllname storage to string16.
(struct dll_info): Convert name to WCHAR.
	(std_dll_init): Load DLLs with full path to windows system directory.
	Add hint to Microsoft security advisory.
	* dcrt0.cc (init_windows_system_directory): New function.
	(dll_crt0_0): Call init_windows_system_directory first.
	* exceptions.cc (windows_system_directory): Move to globals.cc.
	(windows_system_directory_length): Ditto.
	(events_init): Drop code fetching windows_system_directory.
	* globals.cc (windows_system_directory): New global variable.
	(windows_system_directory_length): Ditto.
	* net.cc (load_ipv6_funcs): Use windows_system_directory rather than
	GetSystemDirectoryW.
	* netdb.cc (open_system_file): Ditto.  Simplify debug output.
2010-08-28 08:51:21 +00:00
Corinna Vinschen 1121c57f54 * external.cc (sync_wincwd): Remove.
(cygwin_internal): Drop CW_SYNC_WINCWD case.
	* globals.cc (ro_u_pipedir): New R/O unicode string.
	* ntdll.h (RtlSetCurrentDirectory_U): Declare.
	* path.cc (cwdstuff::set): Improve comments.  Drop setting Win32 CWD to
	\\?\PIPE\ on init.  Keep Win32 CWD in sync, if possible.  Set to
	\\?\PIPE\ otherwise.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Revert to 230.
	* include/sys/cygwin.h (cygwin_getinfo_types): Remove CW_SYNC_WINCWD.
2010-08-27 17:58:45 +00:00
Corinna Vinschen 1165007539 * fhandler_proc.cc (format_proc_partitions): Improve comment. 2010-08-27 09:08:32 +00:00
Corinna Vinschen 46059af75c * fhandler_proc.cc (format_proc_partitions): Simplify code and enable
partition layout printing for non-privileged users.
2010-08-26 10:59:13 +00:00
Corinna Vinschen 2f1832898f * mount.cc (fs_info::update): Fix comments. 2010-08-25 09:20:11 +00:00
Corinna Vinschen df70da7f6c * syscalls.cc (rename): Open file with FILE_READ_ATTRIBUTES. 2010-08-25 08:51:41 +00:00
Corinna Vinschen 48f6c6c664 * include/cygwin/version.h: Fix comment. 2010-08-24 15:25:46 +00:00
Corinna Vinschen 8ae578d6ae * external.cc (cygwin_internal): In CW_CVT_MNT_OPTS case, initialize
flags with *pflags to restore original behaviour.
2010-08-24 15:11:24 +00:00
Corinna Vinschen 43c394deb6 * Makefile.in (DLL_IMPORTS): Link against advapi32.a before kernel32.a. 2010-08-21 18:57:36 +00:00
Christopher Faylor ff7fca61df * cygthread.cc: Update copyright. 2010-08-20 15:28:28 +00:00
Corinna Vinschen a6fc3a61c2 * path.cc (path_conv::check): Close handle in conv_handle if we're
following a symlink.
2010-08-20 14:29:56 +00:00
Corinna Vinschen 74f50846a9 * endian.h (htobe16, htobe32, htobe64, be16toh, be32toh, be64toh,
htole16, htole32, htole64, le16toh, le32toh, le64toh): Define.
2010-08-20 12:18:47 +00:00
Corinna Vinschen a6c83569dc * fhandler_disk_file.cc (readdir_check_reparse_point): Rename from
is_volume_mountpoint.  Return valid d_type value for underlying
	reparse point type.
	(readdir_get_ino): Don't rely on the handle set in pc.check.  Open
	file here if pc.handle() is NULL.
	(fhandler_disk_file::readdir_helper): Try to set a correct d_type value
	more diligent.
	(fhandler_disk_file::readdir): Don't reset dirent_set_d_ino unless
	we're really sure it's due to an untrusted FS.  Simplify usage of
	FileAttributes, which is 0 if buf is NULL, anyway.  Set d_type
	correctly for faked "." and ".." entries.  Improve debug output.
	* path.cc (symlink_info::check): Don't keep handle to volume mount
	point open.  Explain why.
2010-08-20 11:18:58 +00:00
Corinna Vinschen dd442880af * fhandler_disk_file.cc (fhandler_disk_file::fstatvfs): Revert usage
of get_stat_handle () to get_handle ().  Add comment to explain why.
	* syscalls.cc (statvfs): Drop using PC_KEEP_HANDLE.
2010-08-20 08:52:25 +00:00
Corinna Vinschen e652eb9230 * external.cc (sync_wincwd): New function.
(cygwin_internal): Rename CW_SETCWD to CW_SYNC_WINCWD.  Call
	sync_wincwd from here.
	* include/sys/cygwin.h (cygwin_getinfo_types): Rename CW_SETCWD to
	CW_SYNC_WINCWD.
2010-08-19 10:14:31 +00:00
Christopher Faylor 590ad4793f * external.cc (CW_SETCWD): New option.
* include/cygwin/version.h: Bump api minor to 231.
* include/sys/cygwin.h (CW_SETCWD): Define.
2010-08-18 19:15:37 +00:00
Corinna Vinschen ce9898da68 * syscalls.cc (rename): Fix renaming file-based devices. 2010-08-18 15:21:35 +00:00
Corinna Vinschen 75a3b85877 * exceptions.cc (open_stackdumpfile): Don't try to open file if we
have no filesystem based CWD.  Add comment.
	* path.cc (cwdstuff::set): Set CWD handle to NULL if CWD is a virtual
	path.  Simplify matching comment.
2010-08-18 14:22:07 +00:00
Corinna Vinschen d15ed91c04 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Set st_rdev
to correct device number for fs_special devices.
2010-08-18 10:10:14 +00:00
Corinna Vinschen adb4e0f3de * include/cygwin/version.h: Bump DLL minor version number to 6. 2010-08-16 13:41:19 +00:00
Corinna Vinschen f5a51f9187 * pipe.cc (fhandler_pipe::open): Duplicate content of opened pipe
fhandler before calling dup method.
2010-08-14 11:16:09 +00:00
Corinna Vinschen 260b80740e * cygheap.h (class cwdstuff): Make drive_length private.
Add "error" member.
	(cwdstuff::get_error): New inline method.
	(cwdstuff::get_error_desc): Declare.
	(cwdstuff::set): Change first parameter to pointer to path_conv.
	* path.cc (chdir): Drop doit.  Align call to cwdstuff::set to
	new arguments.
	(cwdstuff::init): Only call cwdstuff::set if it's not already
	initialized.  Add comment.  Drop third parameter in call to
	cwdstuff::set.
	(cwdstuff::set): Partially rewrite.  Add lots of comments to explain
	everything.  Drop "doit" since it's not used anymore.  Always create
	new handle to CWD if not in a virtual path.  Drop PEB locking when
	reading PEB values in init phase.  Check for accessibility to set
	correct error code.  Drop Vista workaround.  Never write back into PEB.
	Set Win32 CWD to \\?\PIPE\ on init.  Simplify creation of win32 path.
	Set new error member to a meaningful value.
	(cwdstuff::get_error_desc): New method to generate error message
	from cwd error code.
	* spawn.cc (spawn_guts): Call cwdstuff::get_error_desc to create
	more meaningful error message when not being able to start native
	Win32 app due to CWD restrictions.  When starting native Win32 app,
	lock cwd and use in calls to CreateProcessW/CreateProcessAsUserW.
2010-08-13 11:51:54 +00:00
Corinna Vinschen a5fe426282 * mount.cc (struct opt): Add "bind" option.
(mount_info::from_fstab_line): Handle "bind" option.
	(fillout_mntent): Add "bind" option to mnt_opts.
	(mount): Handle "bind" option.
	* include/sys/mount.h (MOUNT_BIND): New mount flag.
2010-08-11 10:58:06 +00:00
Christopher Faylor 92514fd261 * sigproc.cc (init_sig_pipe): Add retry loop. 2010-08-10 16:44:37 +00:00
Christopher Faylor 514fdad34d * cygheap.h (cygheap_fdmanip): Delete fh and use fd index into cygheap->fdtab
throughout.
(cygheap_fdnew): Replace fh by using fd index into cygheap->fdtab throughout.
(cygheap_fdget): Ditto.  (cygheap_fdenum): Ditto.
2010-08-09 16:53:35 +00:00
Yaakov Selkowitz b150f5236b Implement POSIX.1-2004 Monotonic Clock.
* hires.h: Change hires_us to hires_ns, with nanosecond resolution.
(hires_ns::primed_ft): Remove.
(hires_ns::nsecs): New prototype.
(hires_ns::usecs): Rewrite in terms of nsecs.
(hires_ns::resolution): New prototype.
* times.cc: Change hires_us to hires_ns.
(ntod): Declare.
(systime): Remove.
(hires_ns::prime): Increase resolution to nanoseconds.
(hires_ns::nsecs): Rename usecs to nsecs to reflect increased resolution.
Remove justdelta argument.
(hires_ns::resolution): New function.
(clock_gettime): Accept CLOCK_MONOTONIC.
Use EINVAL instead of ENOSYS per POSIX.1-2004.
(clock_getres): Ditto.
(clock_setres): Use EINVAL instead of ENOSYS to conform with other
implementations.
* strace.cc (strace::microseconds): Adjust for hires_ns.
* sysconf.cc (sca): Set _SC_MONOTONIC_CLOCK to _POSIX_MONOTONIC_CLOCK.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2010-08-09 16:47:48 +00:00
Corinna Vinschen a52993d426 * fhandler_proc.cc: Add /proc/filesystems virtual file.
(format_proc_filesystems): New function.
	* mount.cc (fs_names): Move to global scope. Redefine as array
	of { "name", block_device? } structs.
	(fillout_mntent): Use name member of fs_names.
	* mount.h (fs_names): New prototype.
2010-08-09 08:18:30 +00:00
Corinna Vinschen 99006a85e2 * include/dlfcn.h (RTLD_LOCAL): Define. 2010-08-09 07:48:24 +00:00
Corinna Vinschen 5c9d7a42fc * include/sys/dirent.h (d_fileno): Define as d_ino. 2010-08-06 18:55:25 +00:00
Corinna Vinschen 06cc41a63a * path.cc (cygwin_conv_path): Rearrange test for "." in POSIX to
relative DOS path conversion.  Simplify fixing the path.
	In CCP_POSIX_TO_WIN_W conversion, always drop long path prefix if path
	fits into MAX_PATH.  Explain why.
2010-08-04 11:25:13 +00:00
Christopher Faylor 0b6fbd396c * exceptions.cc (_cygtls::interrupt_now): Revert to checking for "spinning"
when choosing to defer signal.
(_cygtls::call_signal_handler): Grab func when we have the lock.
* gendef: Update copyright.
(__sigbe): Simplify slightly.
(_sigdelayed): Grab a lock before manipulating stuff.
(_cygtls::pop): Properly return popped value.
(stabilize_sig_stack): Set incyg when we have the lock.
* sigproc.cc: Update copyright.
2010-08-01 19:10:52 +00:00
Christopher Faylor 4db1bd4040 * cygthread.h (LPVOID_THREAD_START_ROUTINE): Define.
(cygthread::create): Rename from cygthread::cygthread.
(cygthread::cygthread): Define new constructor which accepts
LPVOID_THREAD_START_ROUTINE as the first argument.  Call cygthread::create.
* cygthread.cc (cygthread::create): Rename from cygthread::cygthread.  Use
'arglen' rather than 'n' since 'n' is no longer supplied.
* fhandler_tty.cc (process_input): Define as void/noreturn.
(process_output): Ditto.
(process_ioctl): Ditto.
(fhandler_tty_master::init): Don't "zap_h" cygthreads which are noreturn.  It's
now implied.
2010-07-30 18:04:22 +00:00
Corinna Vinschen cb6bfcff1a * fhandler.cc (fhandler_base::raw_write): Remove STATUS_DISK_FULL
special handling.
2010-07-23 10:08:34 +00:00
Eric Blake 3083fa9447 Add mkostemp and mkostemps.
* mktemp.cc (_gettemp): Add flags argument.  All callers updated.
(mkostemp, mkostemps): New functions.
* cygwin.din (mkostemp, mkostemps): Export.
* posix.sgml: Document them.
* include/cygwin/version.h: Bump version.
2010-07-19 18:22:40 +00:00
Christopher Faylor bee6d43176 * autoload.cc (noload): Use "pushl" rather than "push". 2010-07-18 20:14:51 +00:00
Christopher Faylor 9134e80ac6 * exceptions.cc (_cygtls::interrupt_now): Avoid nonsensical tests which delay
an interrupt.
(setup_handler): Remove unneeded DEBUGGING handling.  Ensure that stack is
locked when we are about to do push/pop to it.  Fix debugging output.
2010-07-18 20:13:26 +00:00
Christopher Faylor 3a7c5515b2 * gendef: Throughout, remove lock from xchgl since it is implied.
(__ZN7_cygtls3popEv): Avoid potential (but probably nonexistent) race when
clearing element after pop.
2010-07-18 20:10:22 +00:00
Corinna Vinschen ac40a19527 * wincap.cc (wincap_7): Set needs_count_in_si_lpres2 to false. 2010-07-15 08:00:52 +00:00
Corinna Vinschen 975a85f42c * syscalls.cc (unlink_nt): Disable try_to_bin for netapp drives.
Explain why.
2010-07-07 07:53:22 +00:00
Corinna Vinschen c492992f13 Align seekdir and telldir API to POSIX definition.
* Makefile.in (NEW_FUNCTIONS): Remove seekdir and telldir mappings.
	* dir.cc (telldir): Move functionality from telldir64 here.  Use
	long, rather than _off_t.
	(telldir64): Just call telldir.  Only keep for backward compatibility.
	(seekdir): Move functionality from seekdir64 here.  Use long, rather
	than _off_t.
	(seekdir64): Just call seekdir.  Only keep for backward compatibility.
	* fhandler.h: Throughout, change prototypes of seekdir and telldir
	methods to use long, rather than _off64_t.
	* fhandler_disk_file.cc: Change aforementioned methods accordingly.
	* fhandler_netdrive.cc: Ditto.
	* fhandler_registry.cc: Ditto.
	* fhandler_virtual.cc: Ditto.
	* include/sys/dirent.h (struct __DIR): Change __d_position from
	_off_t to long to reflect API change.
	(telldir): Change prototype to use long, rather than off_t.
	(seekdir): Ditto.
2010-07-05 16:59:56 +00:00
Christopher Faylor 6259826eb4 * path.cc (path_conv::check): Move fs-specific settings to a point where we
know that we have filled out the filesystem information.
* path.h (path_conv::path_conv): Use consistent initialization for
constructors.
* include/sys/cygwin.h: Define CW_STRERROR.
* include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 228.
* include/external.h: Implement CW_STRERROR.
2010-07-04 17:12:27 +00:00
Corinna Vinschen 7ba0a42f55 * net.cc (cygwin_getsockopt): Make sure SO_PEERCRED is only handled
in level SOL_SOCKET.  Workaround a return value regression in Vista
	and later.  Add comment to explain.
2010-07-02 14:36:43 +00:00
Corinna Vinschen 601fbebdf5 * spawn.cc (spawn_guts): Reinstantiate a FIXME comment. 2010-06-29 10:37:23 +00:00
Corinna Vinschen e7daa3ed75 * exceptions.cc (dump_exception): Use %W instead of %s for printing
progname.
	* fork.cc (frok::parent): Fix typos in debug output.
	* spawn.cc (spawn_guts): Copy wide Win32 filename into _pinfo::progname,
	rather than native NT name.
2010-06-29 10:28:40 +00:00
Christopher Faylor 22d78f100f * fork.cc (frok::parent): Improve error message. 2010-06-28 18:32:12 +00:00
Corinna Vinschen 30bbc55ee2 * flock.cc (allow_others_to_sync): Use small stack buffer rather
than big temp buffer.  Fix typo in comment.
	(lf_setlock): Revert to using tmp_pathbuf.
	(lf_getlock): Ditto.
2010-06-22 14:53:05 +00:00
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