Commit Graph

5356 Commits

Author SHA1 Message Date
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