Commit Graph

3391 Commits

Author SHA1 Message Date
Christopher Faylor 472130e897 * fhandler_process.cc (format_process_stat): Use cygwin-derived start time even
on NT since it is the logical start time of the "process".
* pinfo.cc (set_myself): Don't set start time when it should have already been
set previously.
2006-02-11 04:53:14 +00:00
Christopher Faylor 7f8c7bff6f * times.cc (clock_getres): Use correct conversion from milliseconds to
seconds/nanoseconds.
(clock_setres): Use correct conversion to nanoseconds.
2006-02-11 00:06:50 +00:00
Christopher Faylor 9a08fd5a50 * external.cc (sync_winenv): Rename from "setup_winenv". Use same mechanism as
spawn to determine environment variables which should be converted back to
windows form.
(cygwin_internal): Reflect setup_winenv -> sync_winenv name change.
* include/sys/cygwin.h: Ditto.
2006-02-10 17:22:34 +00:00
Corinna Vinschen 30f1c8a675 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Only set
the dirent_get_d_ino flag on filesystems having useful File IDs.
	Add comment explaining why.
2006-02-09 14:42:48 +00:00
Corinna Vinschen 03a49a00ab * dtable.cc (handle_to_fn): Accomodate new argument order in call to
sys_wcstombs.
	* fhandler_disk_file.cc (fhandler_disk_file::readdir): Call sys_wcstombs
	instead of just wcstombs to accomodate OEM codepages.
	* miscfuncs.cc (sys_wcstombs): Split len argument in source and target
	length.  Always 0-terminate result in target string.
	* security.cc (lsa2wchar): Remove unused function.
	(lsa2str): Ditto.
	(get_lsa_srv_inf): Ditto.
	(get_logon_server): Accomodate new argument order in call to
	sys_wcstombs.
	(get_user_groups): Ditto.
	(get_user_local_groups): Ditto.
	(get_priv_list): Call sys_wcstombs directly instead of lsa2str.
	* uinfo.cc (cygheap_user::ontherange): Accomodate new argument order
	in call to sys_wcstombs.
	* winsup.h (sys_wcstombs): Change prototype to match new argument order.
2006-02-07 15:49:08 +00:00
Corinna Vinschen 3cb155a97f * init.cc (respawn_wow64_process): Exit with the exit code returned
by the respawned process.
2006-02-07 09:57:43 +00:00
Christopher Faylor 985d0e68c5 Always zero all elements of siginfo_t throughout.
* cygtls.h (_cygtls::thread_context): Declare new field.
(_cygtls::thread_id): Ditto.
(_cygtls::signal_exit): Move into this class.
(_cygtls::copy_context): Declare new function.
(_cygtls::signal_debugger): Ditto.
* cygtls.cc (_cygtls::init_thread): Fill out thread id field.
* exceptions.cc (exception): Change message when exception info is unknown.
Copy context to thread local storage.
(_cygtls::handle_exceptions): Avoid double test for fault_guarded.  Reflect
move of signal_exit to _cygtls class.
(sigpacket::process): Copy context to thread local storage.
(_cygtls::signal_exit): Move to _cygtls class.  Call signal_debugger to notify
debugger of exiting signal (WIP).  Call stackdump here (WIP).
(_cygtls::copy_context): Define new function.
(_cygtls::signal_debugger): Ditto.
* tlsoffsets.h: Regenerate.
* include/cygwin.h (_fpstate): New internal structure.
(ucontext): Declare new structure (WIP).
(__COPY_CONTEXT_SIZE): New define.
* exceptions.cc (_cygtls::interrupt_setup): Clear "threadkill" field when there
is no sigwaiting thread.
(setup_handler): Move event handling into interrupt_setup.
2006-02-06 18:24:11 +00:00
Corinna Vinschen 125ff9be63 * fhandler_socket.cc (fhandler_socket::connect): Fix formatting.
(fhandler_socket::wait): Handle SA_RESTART when signal arrives.
2006-02-06 17:50:23 +00:00
Corinna Vinschen 29b3c9cc3e * include/cygwin/socket.h (CMSG_FIRSTHDR): Avoid compiler warning. 2006-02-06 10:01:37 +00:00
Corinna Vinschen 6da41754a4 * include/features.h: Add comment to explain what's going to happen
here at one point.
	* include/sys/stdio.h: Guard getline and getdelim prototypes with
	_GNU_SOURCE to avoid collision with old-style declarations.
2006-02-05 20:30:24 +00:00
Corinna Vinschen fbae2bf864 * environ.cc (struct parse_thing): Add transparent_exe option.
* fhandler_disk_file.cc (fhandler_disk_file::link): Accomodate
	transparent_exe option.  Add .exe suffix for links to executable files,
	if transparent_exe is set.
	* fhandler_process.cc (fhandler_process::fill_filebuf): Remove .exe
	suffix if transparent_exe option is set.
	* path.cc (symlink_worker): Accomodate transparent_exe option.
	(realpath): Don't tack on .exe suffix if transparent_exe is set.
	* syscalls.cc (transparent_exe): New global variable.
	(unlink): Accomodate transparent_exe option.
	(open): Ditto.
	(link): Ditto.
	(rename): Ditto. Maybe add .exe suffix when renaming executable files.
	(pathconf): Accomodate transparent_exe option.
	* winsup.h: Declare transparent_exe.
2006-02-05 18:18:02 +00:00
Corinna Vinschen 0913522dbd * fhandler_disk_file.cc (fhandler_disk_file::readdir_9x): Remove
useless code.
2006-02-05 18:11:03 +00:00
Corinna Vinschen da3374d695 * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Remove label
"out".  Move test for NULL __handle ...
	(fhandler_disk_file::rewinddir_9x): ... here.
2006-02-05 11:17:03 +00:00
Corinna Vinschen a80fb27643 ... and the ChangeLog, never forget the ChangeLog... 2006-02-05 10:55:59 +00:00
Christopher Faylor c6e665bb95 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Don't close dir handle
when we hit EOF since rewwindir may reactivate it.
(fhandler_disk_file::readdir_9x): Eliminate superfluous temporary variable.
(fhandler_disk_file::closedir): Return EBADF when trying to close unopened DIR.
Reorganize slightly.  Return actual derived error value rather than always
returning 0.
2006-02-05 07:03:24 +00:00
Christopher Faylor 25bafd7b0e * dir.cc (rmdir): Reorganize check for trailing dot to return correct error
when directory does not exist.
2006-02-04 19:02:42 +00:00
Christopher Faylor 324ce34bd5 * dir.cc (mkdir): Reorganize check for trailing dot to return correct error
when directory exists.
* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Remove special test for
path ending in '.'.
2006-02-04 04:31:34 +00:00
Corinna Vinschen 1912201029 * path.cc (suffix_scan::lnk_match): Return true beginning with
SCAN_APPENDLNK.
	(suffix_scan::next): Rearrange code to make .lnk append order slightly
	more deterministic.
	* spawn.cc (exe_suffixes): Try no suffix before .exe suffix to align
	evaluation with stat_suffixes.
	(dll_suffixes): Ditto.
2006-02-03 21:33:09 +00:00
Christopher Faylor d6b2195f1c * cygwin/version.h: Mention CW_SETUP_WINENV in comment for API minor 153. 2006-02-02 23:16:26 +00:00
Corinna Vinschen c0b0336f36 * cygwin.din (updwtmpx): Export.
* syscalls.cc (updwtmpx): New function.
	* include/utmpx.h (updwtmpx): Declare.
	* include/cygwin/version.h: Bump API minor number to 153.
2006-02-02 22:46:37 +00:00
Christopher Faylor 6577c186c9 * external.cc (setup_winenv): New function.
(cygwin_internal): Implement CW_SETUP_WINENV.
* sys/cygwin.h (cygwin_getinfo_types): Define CW_SETUP_WINENV.
2006-02-02 19:55:45 +00:00
Corinna Vinschen bb6f800d18 * security.cc (is_group_member): Fix comment. 2006-02-02 11:35:52 +00:00
Corinna Vinschen 49e803c0b6 * security.cc (is_group_member): Use local group info type 1. Test
group for being a global group or a well-known SID before adding it
	to the group list.  Add comment.
2006-02-02 11:22:10 +00:00
Corinna Vinschen 0ca697dde1 * spawn.cc (dll_suffixes): Add .exe and "no suffix" to the list. 2006-02-01 08:44:15 +00:00
Corinna Vinschen 4b84e3dcea * dlfcn.cc (check_path_access): Call find_exec with FE_DLL option.
* path.h (enum fe_types): Add FE_DLL value.
	* spawn.cc (std_suffixes): Remove.
	(exe_suffixes): New suffix_info for executing files.
	(dll_suffixes): New suffix_info for searching shared libraries.
	(perhaps_suffix): Add opt argument.  Use dll_suffixes if FE_DLL
	option is given, exe_suffixes otherwise.
	(find_exec): Propagate opt argument to perhaps_suffix.  Drop suffix
	check when testing execute permission.
	(spawn_guts): Call perhaps_suffix with FE_NADA opt argument.
2006-01-31 21:49:39 +00:00
Christopher Faylor fd34affe5d * spawn.cc (av::fixup): Remove unused argument.
(spawn_guts): Remove capitalization in debugging.
2006-01-31 21:23:57 +00:00
Corinna Vinschen 0ad7b0eb02 * spawn.cc (find_exec): Only return files with execute permission set
if ntsec is on.  Don't check execute permission of Windows batch files.
	(av::fixup): Handle empty files gracefully.  Drop execute permission
	test here.
	* path.cc (suffix_scan::next): Don't skip any suffix on first run.
2006-01-31 21:09:43 +00:00
Corinna Vinschen 63a149a18f * path.cc (cwdstuff::set): Don't set win32 error, only POSIX errno. 2006-01-31 16:10:29 +00:00
Corinna Vinschen 735229ff4f * path.cc (cwdstuff::set): When SetCurrentDirectory returns
ERROR_INVALID_FUNCTION, bend it over to ERROR_FILE_NOT_FOUND.  Add
	comment to explain why.
2006-01-31 14:43:37 +00:00
Corinna Vinschen ca986c6bf8 * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Simplify
conditional.
2006-01-30 13:44:16 +00:00
Corinna Vinschen 5c25715276 * fhandler_disk_file.cc (d_cachepos): Rename from d_pos to distinct
clearly from __d_position.  Change throughout.
	(fhandler_disk_file::rewinddir): Reset readdir cache on NT.
2006-01-30 10:30:58 +00:00
Corinna Vinschen edde4d4daf * fhandler_disk_file.cc (readdir_get_ino): Don't follow symlinks. 2006-01-29 17:29:35 +00:00
Corinna Vinschen 5369605f4f * fhandler.h (class fhandler_socket): Add saw_reuseaddr status flag.
* fhandler_socket.cc (fhandler_socket::bind): Set socket to
	SO_EXCLUSIVEADDRUSE if application didn't explicitely set SO_REUSEADDR
	socket option, on systems supporting SO_EXCLUSIVEADDRUSE.
	* net.cc (cygwin_setsockopt): Set fhandler's saw_reuseaddr status flag
	if SO_REUSEADDR socket option has been successsfully set.
	* wincap.h (wincaps::has_exclusiveaddruse): New element.
	* wincap.cc: Implement above element throughout.
2006-01-29 12:23:44 +00:00
Corinna Vinschen b8670a4764 * fhandler_disk_file.cc (fhandler_disk_file::mkdir): In case or error,
check for existance explicitely and set errno to EEXIST.
2006-01-28 13:59:39 +00:00
Corinna Vinschen 7ab59dee94 * fhandler_disk_file.cc (DIR_NUM_ENTRIES): New define determining
minimum number of dir entries which fit into the readdir cache.
	(DIR_BUF_SIZE): Define globally as size of readdir cache.
	(struct __DIR_cache): New structure used for readdir caching on NT.
	(d_dirname): Accessor for struct __DIR_cache, use throughout.
	(d_pos): Ditto.
	(d_cache): Ditto.
	(fhandler_disk_file::opendir): Allocate __d_dirname to contain readdir
	cache on NT.
	(fhandler_disk_file::readdir): Use buf as pointer into readdir cache.
	Implement readdir caching.
2006-01-28 13:41:22 +00:00
Corinna Vinschen fa3ffdd01a * include/sys/dirent.h (struct dirent): Revert misguided attempt to
rename __d_unused1 to __d_fd.
2006-01-28 10:34:11 +00:00
Corinna Vinschen 9e5f45ed6f * autoload.cc (NtQueryDirectoryFile): Define.
* dir.cc (__opendir_with_d_ino): Just call opendir.
	(opendir): Remove CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO handling.
	(readdir_worker): Only try generating d_ino if it's 0.
	Utilize namehash of directories fhandler.  Call readdir_get_ino to
	generate d_ino for "..".
	(seekdir64): Keep dirent_set_d_ino flag.
	* fhandler.h (enum dirent_states): Add dirent_get_d_ino.
	(class fhandler_disk_file): Declare new private methods readdir_helper
	and readdir_9x.
	* fhandler_disk_file.cc (path_conv::hasgood_inode): New method to
	evaluate if a filesystem has reliable inode numbers.
	(fhandler_base::fstat_by_handle): Accomodate structure member name
	change from IndexNumber to FileId.
	(fhandler_base::fstat_helper): Call hasgood_inode here.
	(fhandler_disk_file::opendir): Call fhaccess only for real files.
	Don't append '*' to __d_dirname here, move to readdir_9x.  On NT,
	open directory handle here.  Set dirent_get_d_ino and dirent_set_d_ino
	flags according to wincap and filesystem.
	(fhandler_disk_file::readdir_helper): New method to implement readdir
	postprocessing only once.
	(readdir_get_ino_by_handle): New static function.
	(readdir_get_ino): New function to centralize inode number evaluation
	in case inode number hasn't been returned by NtQueryDirectoryFile.
	(fhandler_disk_file::readdir): Move old functionality to readdir_9x.
	Call readdir_9x when on 9x/Me.  Implement NT specific readdir here.
	(fhandler_disk_file::readdir_9x): Move 9x specific readdir here.
	(fhandler_disk_file::seekdir): Accomodate new NT readdir method.
	(fhandler_disk_file::closedir): Ditto.
	(fhandler_cygdrive::fstat): Set d_ino to namehash. Add comment.
	(fhandler_cygdrive::opendir): Call get_namehash to prepare later
	correct evaluation of d_ino.
	(fhandler_cygdrive::readdir): Replace recursion with loop. Evaluate
	drive's d_ino by calling readdir_get_ino.
	* fhandler_proc.cc (fhandler_proc::readdir): Set dirent_saw_dot and
	dirent_saw_dot_dot to avoid seeing . and .. entries twice.
	* fhandler_process.cc (fhandler_process::readdir): Ditto.
	* fhandler_registry.cc (fhandler_registry::readdir): Ditto.
	* ntdll.h (STATUS_INVALID_PARAMETER): New define.
	(STATUS_INVALID_LEVEL): New define.
	(struct _FILE_INTERNAL_INFORMATION): Rename member IndexNumber to
	FileId (as in Nebbitt).
	* path.h (path_conv::hasgood_inode): Now implemented in
	fhandler_disk_file.cc.
	* wincap.h (wincaps::has_fileid_dirinfo): New element.
	* wincap.cc: Implement above element throughout.
	* winsup.h (readdir_get_ino): Add declaration.
	* include/sys/dirent.h (struct dirent): Slightly rename structure
	members to accomodate changes.
	Remove __USE_EXPENSIVE_CYGWIN_D_INO handling and declaration of
	__opendir_with_d_ino.
2006-01-27 21:50:42 +00:00
Christopher Faylor e7a9c71d62 * spawn.cc (spawn_guts): Fix potential handle leak when failing exec. 2006-01-27 06:08:05 +00:00
Christopher Faylor e1bfb483ea * exceptions.cc (inside_kernel): Fix to return true if we can't get the name of
the DLL for the given memory block since we are not in kernel code.
2006-01-27 06:06:06 +00:00
Corinna Vinschen 50a7955aa6 * fhandler.cc (fhandler_base::open): Fix bug in argument order to
InitializeObjectAttributes call.
2006-01-26 16:58:53 +00:00
Christopher Faylor 4207eed323 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Fix test for
dirent_isroot to use the correct boolean operator.
2006-01-26 02:54:54 +00:00
Christopher Faylor 742e27bed8 * ntdll.h: (temporarily?) Add more functions for querying directory. 2006-01-25 05:57:20 +00:00
Christopher Faylor aac74926dd * dir.cc (readdir_worker): Turn off expensive inode calculation. 2006-01-24 19:03:20 +00:00
Corinna Vinschen 4aac2d2709 * fhandler_process.cc (fhandler_process::fill_filebuf): Disable
stripping the .exe suffix from the link target in PROCESS_EXE and
	PROCESS_EXENAME case.
	* path.cc (realpath): Tack on .exe suffix if necessary.
2006-01-24 17:40:55 +00:00
Corinna Vinschen 26d27a276f * fhandler_disk_file.cc (fhandler_base::fstat_helper): Try harder
to determine remote file systems with reliable inode numbers.  Add
	longish comment.
2006-01-24 12:32:33 +00:00
Corinna Vinschen 543c43d84d * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Reset
inheritance for duplicated socket.
2006-01-23 15:10:57 +00:00
Christopher Faylor d96d3ec910 . 2006-01-21 04:41:57 +00:00
Christopher Faylor 868fb2ff69 * include/cygwin/version.h: Bump API minor number to 151.
* dir.cc (__opendir_with_d_ino): New function.
(opendir): Set flag if we should be calculating inodes.
(readdir_worker): Calculate d_ino by calling stat if the user has asked for it.
(seekdir64): Maintain all persistent flag settings.
* fhandler.h (dirent_states): Add dirent_set_d_ino.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Reflect changes to
dirent structure.
* fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
* include/sys/dirent.h (struct dirent): Coalesce two similar structures.
Remove all threads of the apparently highly confusing references to inodes.
Add support for calculating a real inode if __USE_EXPENSIVE_CYGWIN_D_INO is
defined.
2006-01-21 02:24:17 +00:00
Christopher Faylor 90e1ee2b25 * include/sys/dirent.h: Add comments for people who are REALLY confused about
whether they should be using something called __invalid_d_ino or not.
2006-01-20 16:04:40 +00:00
Corinna Vinschen 1ef48340d5 * fhandler_socket.cc (fhandler_socket::prepare): Fix debug output.
(fhandler_socket::release): Add debug output for WSAEventSelect failure.
	(fhandler_socket::ioctl): Always cancel WSAEventSelect before switching
	to blocking mode.  Only set nonblocking flag if ioctlsocket call
	succeeded.  Only print new socket state if ioctlsocket call succeeded.
2006-01-20 10:22:38 +00:00