2006-03-14 Christopher Faylor * child_info.h (child_info_fork::fork_retry): Declare new function. * dcrt0.cc (child_info_fork::fork_retry): Define new function. * fork.cc (frok::parent): Move retry decision into child_info_fork::fork_retry and honor what it tells us to do. * sigproc.cc (sig_send): Unhold signals on __SIGEXIT. 2006-03-14 Christopher Faylor * fork.cc (frok::parent): Improve error message. 2006-03-14 Christopher Faylor * dcrt0.cc (main_environ): Initialize to &__cygwin_environment. (dll_crt0_1): Move resourcelocks, thread interface, pinfo_init, and uinfo_init... (dll_crt0_0): ...to here. (_dll_crt0): Call update_envptrs here after setting main_environ. * environ.cc (environ_init): Eliminate initted variable. Don't call update_envptrs here. * sigproc.cc (wait_sig): Use my_sendsig when calling CreatePipe to avoid a dereference. 2006-03-13 Christopher Faylor * child_info.h (child_info_fork::handle_failure): Declare new function. (child_info_fork::retry): New field. * dcrt0.cc (__api_fatal_exit_val): Define. (child_info_fork::handle_failure): Define new function. (__api_fatal): Exit using __api_fatal_exit_val value. * environ.cc (set_fork_retry): Set fork_retry based on CYGWIN environment variable. (parse_thing): Add "fork_retry" setting. * fork.cc (fork_retry): Define. (frok::parent): Reorganize to allow retry of failed child creation if child signalled that it was ok to do so. * heap.cc (heap_init): Signal parent via handle_failure when VirtualAlloc fails. * pinfo.h (EXITCODE_RETRY): Declare. * sigproc.cc (child_info::sync): Properly exit with failure condition if called for fork and didn't see subproc_ready. * spawn.cc (spawn_guts): Use windows pid as first argument. * winsup.h: Remove obsolete NEW_MACRO_VARARGS define. (__api_fatal_exit_val): Declare. (set_api_fatal_return): Define. (in_dllentry): Declare. * exceptions.cc (inside_kernel): Remove unneeded in_dllentry declaration. 2006-03-13 Christopher Faylor * dcrt0.cc (dll_crt0_0): Reorganize so that sigproc_init is called a little later. Add a comment. * fork.cc (resume_child): Make void. (frok::parent): Only zero pi when necessary. Explicitly zero si. Set this_errno when child_copy fails. Accommodate change to resume_child. * sigproc.cc (sigalloc): Move global_sigs initialization here. (sigproc_init): Move global_sigs. (sig_send): Just check for flush signals once. * wincap.h: Define supports_setconsolectrlhandler_null throughout. * wincap.cc: Ditto. 2006-03-13 Corinna Vinschen * autoload.cc (LoadDLLfuncNt): New define to wrap NT native functions. Use for NT native functions throughout. * dtable.cc (handle_to_fn): Treat return value of NtQueryObject as NTSTATUS value. 2006-03-12 Christopher Faylor * cygtls.cc (_cygtls::remove): Reset initialized flag right away if we were previously initialized. * cygtls.h (_cygtls::initialized): Move nearer to the end to catch situation when Windows 98 mysteriously changes parts of _my_tls when thread is detaching. * gendef (__sigfe_maybe): Simplify slightly. * tlsoffsets.h: Regenerate. 2006-03-12 Christopher Faylor * cygtls.h (CYGTLS_INITIALIZED): Change to a little more unlikely value. (CYGTLSMAGIC): Delete. * dcrt0.cc (dll_crt0_0): Call sigproc_init during init startup. (_dll_crt0): Don't worry about sync_startup. Just wait for sigthread here. * dll_init.cc (cygwin_detach_dll): Only pick up tls version of retaddr if we have a valid tls. * fork.cc (frok::child): Remove sigproc_init initialization since it happens much earlier now. * gendef: Recognize SIGFE_MAYBE. (fefunc): Generate calls to _sigfe_maybe, if appropriate. (_sigfe_maybe): New function. * init.cc (search_for): Always initialize search_for, even on fork. (calibration_thread): Delete. (calibration_id): Delete. (prime_threads): Delete. (munge_threadfunc): Remove calibration_thread special case. Avoid calling thread function if we haven't yet hit the "search_for" thread. (dll_entry): Remove prime_threads call. Only call munge_threadfunc when hwait_sig is active. Ditto. for _my_tls.remove (); * sigproc.cc (hwait_sig): Make global. (sigproc_init): Don't bother with sync_startup. (sig_send): Treat flush as a no-op when signals are held. (wait_sig): Cause signals to be held after fork. 2006-03-09 Corinna Vinschen * syscalls.cc (rename): Move existance check for oldpath further up to the start of the function. Avoid another case of a name collision if oldpath is a shortcut and a file or directory newpath already exists. 2006-03-09 Corinna Vinschen * autoload.cc (NtClose): Define. (NtOpenDirectoryObject): Define. (NtQueryDirectoryObject): Define. * fhandler_proc.cc: Include ctype.h and wchar.h. (format_proc_partitions): Revamp loop over existing harddisks by scanning the NT native \Device object directory and looking for Harddisk entries. * ntdll.h: Rearrange system call declarations alphabetically. (DIRECTORY_QUERY): Define. (struct _DIRECTORY_BASIC_INFORMATION): Define. (NtOpenDirectoryObject): Declare. (NtQueryDirectoryObject): Declare. 2006-03-08 Christopher Faylor * cygtls.h (_cygtls::retaddr): New method. * dll_init.cc (cygwin_detach_dll): Use new tls method to find return address since this function is now signal guarded. (update_envptrs): Remove unneeded braces. * syscalls.cc (statvfs): Coerce full_path to avoid a gcc warning. 2006-03-08 Corinna Vinschen * syscalls.cc (statvfs): Simplify path name expression. 2006-03-08 Corinna Vinschen * syscalls.cc: Include winioctl.h. (statvfs): Request correct volume size using DeviceIoControl if quotas are enforced on the file system. 2006-03-03 Corinna Vinschen * dir.cc (opendir): Fix indentation. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Move storing fhandler in file descriptor table to some point very late in function to avoid double free'ing. Add comment to explain what happens. Add label free_mounts and don't forget to delete __DIR_mounts structure if NtOpenFile fails. 2006-03-02 Corinna Vinschen * syscalls.cc (chroot): Disallow chroot into special directories. Return EPERM instead. 2006-03-02 Corinna Vinschen * fhandler_disk_file.cc (__DIR_mounts::check_missing_mount): Check cygdrive string length for those who have cygdrive mapped to "/". 2006-03-01 Corinna Vinschen * sec_helper.cc (set_cygwin_privileges): Request SE_BACKUP_NAME privileges. 2006-03-01 Corinna Vinschen * fhandler_proc.cc (fhandler_proc::fstat): Always return fixed link count of 1 for /proc directory instead of incorrect PROC_LINK_COUNT. 2006-03-01 Corinna Vinschen * fhandler.h (enum dirent_states): Remove dirent_saw_cygdrive, dirent_saw_dev and dirent_saw_proc. (fhandler_cygdrive::open): Declare. (fhandler_cygdrive::close): Declare. * fhandler_disk_file.cc (class __DIR_mounts): Move to beginning of file. (__DIR_mounts::check_mount): New parameter to indicate if inode number is needed in calling function or not. Add /proc and /cygdrive handling. (__DIR_mounts::check_missing_mount): Ditto. (path_conv::ndisk_links): Use __DIR_mounts class to create correct hardlink count for directories with mount points in them. (fhandler_disk_file::readdir_helper): Remove /dev, /proc and /cygdrive handling. (fhandler_cygdrive::open): New method. (fhandler_cygdrive::close): New method. (fhandler_cygdrive::fstat): Always return fixed inode number 2 and fixed link count of 1. Drop call to set_drives. (fhandler_cygdrive::opendir): Drop call to get_namehash. (fhandler_cygdrive::readdir): Handle "." entry to return fixed inode number 2. 2006-03-01 Christopher Faylor * cygwin.din: Fix some erroneous SIGFE/NOSIGFE settings. 2006-03-01 Christopher Faylor * cygthread.cc (cygthread::callfunc): Revert below change. Make ev a manual reset event again. so that it will be reset by WaitFor*Object as appropriate. (cygthread::stub): Ditto. (cygthread::terminate_thread): Reset ev if it was found to have been set. 2006-03-01 Christopher Faylor * analyze_sigfe: New script. * dllfixdbg: Add copyright. * gendef: Ditto. * gendevices: Ditto. * gentls_offsets: Ditto. 2006-03-01 Christopher Faylor * cygthread.cc (cygthread::callfunc): Create ev as an auto-reset event so that it will be reset by WaitFor*Object as appropriate. (cygthread::stub): Ditto. (cygthread::terminate_thread): Remove forced setting of thread termination. 2006-03-01 Corinna Vinschen * include/sys/dirent.h (struct __DIR): Rename __d_unused to __d_internal. * fhandler_disk_file.cc (struct __DIR_cache): Remove useless "typedef". (d_dirname): Remove useless "struct". (d_cachepos): Ditto. (d_cache): Ditto. (class __DIR_mounts): New class, implementing mount point tracking for readdir. (d_mounts): New macro for easy access to __DIR_mounts structure. (fhandler_disk_file::opendir): Allocate __DIR_mounts structure and let __d_internal element of dir point to it. (fhandler_disk_file::readdir_helper): Add mount points in the current directory, which don't have a real directory backing them. Don't generate an inode number for /dev. Add comment, why. (fhandler_disk_file::readdir): Move filling fname to an earlier point. Check if current entry is a mount point and evaluate correct inode number for it. (fhandler_disk_file::readdir_9x): Ditto. (fhandler_disk_file::rewinddir): Set all mount points in this directory to "not found" so that they are listed again after calling rewinddir(). (fhandler_disk_file::closedir): Deallocate __DIR_mounts structure. * path.cc (mount_info::get_mounts_here): New method to evaluate a list of mount points in a given parent directory. * shared_info.h (class mount_info): Declare get_mounts_here. 2006-02-28 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::opendir): Use iscygdrive instead of isspecial. * path.h (path_conv::iscygdrive): New method. 2006-02-28 Christopher Faylor * exceptions.cc (_cygtls::interrupt_now): Remove "inside cygwin" check since some cygwin functions are meant to be interrupted. 2006-02-28 Corinna Vinschen * cygwin.din: Export __isinff, __isinfd, __isnanf, __isnand. * include/cygwin/version.h: Bump API minor number to 155. 2006-02-28 Corinna Vinschen * dir.cc (readdir_worker): Use slash as path separator when evaluating namehash for paths below /proc. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Use expensive inode number evaluation on share names. 2006-02-27 Christopher Faylor * fhandler_disk_file.cc (fhandler_disk_file::opendir): Only set d_cachepos under NT or suffer memory corruption. (fhandler_disk_file::readdir_helper): Avoid else with a return. Just calculate extension location once when doing symlink checks. (fhandler_disk_file::readdir): Make debug output more useful. (fhandler_disk_file::readdir_9x): Ditto. Eliminate redundant variable. 2006-02-27 Christopher Faylor * include/sys/termios.h (cfsetispeed): Just define as a function rather than resorting to a macro. (cfsetospeed): Ditto. 2006-02-27 Christopher Faylor * sigproc.cc: Fix a comment. 2006-02-27 Christopher Faylor * cygthread.cc (cygthread::release): Add a comment. 2006-02-27 Corinna Vinschen * fhandler_netdrive.cc (fhandler_netdrive::fstat): Create unambiguous inode number. (fhandler_netdrive::readdir): Ditto. 2006-02-24 Christopher Faylor * sigproc.cc (sigheld): Define new variable. (sig_dispatch_pending): Don't check sigq since that's racy. (sig_send): Set sigheld flag if __SIGHOLD is specified, reset it if __SIGNOHOLD is specified. Ignore flush signals if we're holding signals. 2006-02-23 Christopher Faylor * cygwin.din (_exit): Use signal front end. (exit): Ditto. 2006-02-23 Christopher Faylor * winsup.h (cygwin_hmodule): Declare. * exceptions.cc (inside_kernel): Reverse return values to reflect function name. Return true if we're in cygwin1.dll or if we're executing in dll_entry. (_cygtls::interrupt_now): Reflect reversal of inside_kernel return value. * hookapi.cc (cygwin_hmodule): Remove declaration. * init.cc (dll_entry): Use in_dllentry global to record that we are executing in dllentry. 2006-02-22 Corinna Vinschen * exceptions.cc (_cygtls::interrupt_now): Reorder conditional to call inside_kernel only if this isn't locked. 2006-02-22 Corinna Vinschen * fhandler.cc (fhandler_base::open): Add FILE_READ_ATTRIBUTES to access flags in case of query_read_control case, add FILE_READ_DATA in case of query_stat_control. 2006-02-20 Christopher Faylor * spawn.cc (av::fixup): Check for .bat and friends specifically now since these extensions are no longer automatically detected. 2006-02-19 Christopher Faylor * exceptions.cc (stackdump): Avoid dumping more than once. 2006-02-19 Christopher Faylor * fhandler_disk_file.cc (fhandler_disk_file::opendir): Use NtOpenFile to open the directory. (fhandler_disk_file::readdir): Use NT_SUCCESS to determine if status represents success. 2006-02-19 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::opendir): Drop generating path_conv for root. 2006-02-18 Corinna Vinschen * fhandler_disk_file.cc (FS_IS_SAMBA): Move out of path_conv::hasgood_inode. (path_conv::is_samba): New method. (fhandler_base::fstat_by_handle): Don't even try to use FileIdBothDirectoryInformation on Samba. * path.h (class path_conv): Declare is_samba method. 2006-02-17 Christopher Faylor * path.cc (conv_path_list): Eat empty paths when converting to POSIX. (cygwin_conv_to_win32_path): Deal with Cygwin's necessity of adding a '/' to the end of a path ending in '.'. 2006-02-16 Corinna Vinschen * cygwin.din: Export sigignore and sigset. * exceptions.cc (sigset): New function. (sigignore): New function. * include/cygwin/signal.h (SIG_HOLD): Define. (sigignore): Declare. (sigset): Declare. * include/cygwin/version.h: Bump API minor number to 154. 2006-02-13 Igor Peshansky * include/mntent.h: Add missing #include. 2006-02-13 Igor Peshansky * gentls_offsets: Fix typo in error message. 2006-02-10 Christopher Faylor * 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-10 Brian Ford * times.cc (clock_getres): Use correct conversion from milliseconds to seconds/nanoseconds. (clock_setres): Use correct conversion to nanoseconds. 2006-02-10 Christopher Faylor * 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-09 Corinna Vinschen * 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-07 Corinna Vinschen * dtable.cc (handle_to_fn): Accommodate new argument order in call to sys_wcstombs. * fhandler_disk_file.cc (fhandler_disk_file::readdir): Call sys_wcstombs instead of just wcstombs to accommodate 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): Accommodate 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): Accommodate new argument order in call to sys_wcstombs. * winsup.h (sys_wcstombs): Change prototype to match new argument order. 2006-02-07 Corinna Vinschen * init.cc (respawn_wow64_process): Exit with the exit code returned by the respawned process. 2006-02-06 Christopher Faylor 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 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::connect): Fix formatting. (fhandler_socket::wait): Handle SA_RESTART when signal arrives. 2006-02-06 Corinna Vinschen * include/cygwin/socket.h (CMSG_FIRSTHDR): Avoid compiler warning. 2006-02-05 Corinna Vinschen * 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 Corinna Vinschen * environ.cc (struct parse_thing): Add transparent_exe option. * fhandler_disk_file.cc (fhandler_disk_file::link): Accommodate 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): Accommodate transparent_exe option. (realpath): Don't tack on .exe suffix if transparent_exe is set. * syscalls.cc (transparent_exe): New global variable. (unlink): Accommodate transparent_exe option. (open): Ditto. (link): Ditto. (rename): Ditto. Maybe add .exe suffix when renaming executable files. (pathconf): Accommodate transparent_exe option. * winsup.h: Declare transparent_exe. 2006-02-05 Christopher Faylor Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::readdir_9x): Remove useless code. 2006-02-05 Corinna Vinschen * 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 Corinna Vinschen * dir.cc (rewinddir): Keep dirent_get_d_ino and dirent_set_d_ino flags. 2006-02-05 Christopher Faylor * 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-04 Christopher Faylor * dir.cc (rmdir): Reorganize check for trailing dot to return correct error when directory does not exist. 2006-02-03 Christopher Faylor * 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-03 Corinna Vinschen * 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-02 Christopher Faylor * cygwin/version.h: Mention CW_SETUP_WINENV in comment for API minor 153. 2006-02-02 Corinna Vinschen * 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 Christopher Faylor * 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 Corinna Vinschen * security.cc (is_group_member): Fix comment. 2006-02-02 Corinna Vinschen * 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-01 Corinna Vinschen * autoload.cc (GetTcpTable): Define. * fhandler_socket.cc (address_in_use): New function to check if sockaddr_in address is already in use. (fhandler_socket::bind): Check if address is alreay in use in case of SO_REUSEADDR, to circumvent WinSock non-standard behaviour. 2006-02-01 Corinna Vinschen * spawn.cc (dll_suffixes): Add .exe and "no suffix" to the list. 2006-01-31 Corinna Vinschen * 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 Christopher Faylor * spawn.cc (av::fixup): Remove unused argument. (spawn_guts): Remove capitalization in debugging. 2006-01-31 Corinna Vinschen * 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 Corinna Vinschen * path.cc (cwdstuff::set): Don't set win32 error, only POSIX errno. 2006-01-31 Corinna Vinschen * 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 Corinna Vinschen * dir.cc (readdir_worker): Add comment about writing old 32 bit d_ino. * include/cygwin/version.h: Bump API minor number to 152. (CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO): Remove. 2006-01-30 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::rewinddir): Simplify conditional. 2006-01-30 Corinna Vinschen * 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-29 Corinna Vinschen * fhandler_disk_file.cc (readdir_get_ino): Don't follow symlinks. 2006-01-29 Corinna Vinschen * 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-28 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::mkdir): In case or error, check for existance explicitely and set errno to EEXIST. 2006-01-28 Corinna Vinschen * 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 Corinna Vinschen * include/sys/dirent.h (struct dirent): Revert misguided attempt to rename __d_unused1 to __d_fd. 2006-01-27 Corinna Vinschen * 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): Accommodate 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): Accommodate 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 accommodate changes. Remove __USE_EXPENSIVE_CYGWIN_D_INO handling and declaration of __opendir_with_d_ino. 2006-01-27 Christopher Faylor * spawn.cc (spawn_guts): Fix potential handle leak when failing exec. 2006-01-27 Christopher Faylor * 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-26 Corinna Vinschen * fhandler.cc (fhandler_base::open): Fix bug in argument order to InitializeObjectAttributes call. 2006-01-25 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::readdir): Fix test for dirent_isroot to use the correct boolean operator. 2006-01-25 Christopher Faylor * ntdll.h: (temporarily?) Add more functions for querying directory. 2006-01-24 Christopher Faylor * dir.cc (readdir_worker): Turn off expensive inode calculation. 2006-01-24 Corinna Vinschen * 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 Corinna Vinschen * fhandler_disk_file.cc (fhandler_base::fstat_helper): Try harder to determine remote file systems with reliable inode numbers. Add longish comment. 2006-01-23 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Reset inheritance for duplicated socket. 2006-01-20 Christopher Faylor * 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 shreds 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-20 Christopher Faylor * 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 Corinna Vinschen * 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-19 Christopher Faylor * fhandler_disk_file.cc (fhandler_disk_file::opendir): Check posix path for root rather than windows path. 2006-01-19 Christopher Faylor * dir.cc (readdir_worker): Fill in invalid fields with -1. Accommodate name change from __ino32 to __invalid_ino32. * include/sys/dirent.h (__invalid_ino32): Rename from __ino32. Don't define unused d_type macros. 2006-01-18 Christopher Faylor * heap.cc (heap_init): Remove Sleep. 2006-01-18 Corinna Vinschen * net.cc (rresvport): Remove extern declaration. 2006-01-18 Corinna Vinschen * autoload.cc (rresvport): Remove. * net.cc (last_used_rrecvport): New global shared variable. (cygwin_rresvport): Implement rresvport without using rresvport from wsock32. 2006-01-18 Corinna Vinschen * include/cygwin/socket.h (struct sockaddr_storage): Fix typo in ss_family member name. 2006-01-16 Christopher Faylor * include/cygwin/version.h: Bump DLL minor version number to 20. 2006-01-13 Corinna Vinschen * uname.cc (uname): Concatenate a "-WOW64" to utsname's sysname member to see when running under WOW64. 2006-01-13 Corinna Vinschen * net.cc (cygwin_setsockopt): Ignore errors when setting IP_TOS on Windows 2000 and above. Clarify the comment about IP_TOS and move to the place where the magic happens. (get_ifconf): Remove unused code. * wincap.h (wincaps::has_disabled_user_tos_setting): New element. * wincap.cc: Implement above element throughout. 2006-01-12 Christopher Faylor * fhandler_console.cc (set_console_state_for_spawn): Fix to recognize ttys >= 0. 2006-01-12 Christopher Faylor * fhandler.h (set_console_state_for_spawn): Whackamole the argument back to a bool. * spawn.cc (spawn_guts): Ditto, i.e., once again call set_console_state_for_spawn with an indication of whether we're about to start a cygwin process. * fhandler_console.cc (set_console_state_for_spawn): Don't set the console state if we know we're starting a cygwin process or if we're using a "real" tty. 2006-01-10 Corinna Vinschen * dcrt0.cc (dll_crt0_0): Remove call to wincap.init. * init.cc (dll_entry): Rename is_wow64_proc to wow64_test_stack_marker. Call wincap.init here before doing anything else. Use wincap.is_wow64 to determine if we're running in a WOW64 emulator. * mmap.cc (MapViewNT): Don't use AT_ROUND_TO_PAGE in WOW64, it's apparently not supported. (mmap64): Don't create mappings beyond EOF, which would need to use AT_ROUND_TO_PAGE, on WOW64. * wincap.cc (wincap): Throw into the .cygwin_dll_common section. (wincapc::init): Determine if running in WOW64 and set wow_64 flag. * wincap.h (class wincapc): Add wow64 member. (wincapc::is_wow64): New method. 2006-01-10 Christopher Faylor * fhandler_proc.cc (format_proc_cpuinfo): Avoid leading whitespace in model name. 2006-01-09 Christopher Faylor * spawn.cc (spawn_guts): Reorganize slightly so that 16 bit check is done prior to check for command.com/cmd.com. Don't bother setting CREATE_SUSPENDED flag for a MS-DOS process since it doesn't work anyway. Avoid calling remember() when the child process has already exited. (av::fixup): Explicitly set cygexec flag to false on a 16 bit process. 2006-01-09 Corinna Vinschen * include/getopt.h (getopt_long_only): Declare. 2006-01-09 Eric Blake * cygwin.din: Export getsubopt. * include/cygwin/version.h: Bump API minor version. 2006-01-08 Christopher Faylor * fhandler_tty.cc (fhandler_tty_slave::dup): Don't assign a controlling terminal to a process when duped. Linux doesn't do this, so we won't either. 2006-01-08 Christopher Faylor * environ.cc (spenvs[]): windir -> WINDIR. 2006-01-07 Christopher Faylor * fhandler_console.cc (fhandler_console::need_invisible): Remove duplicate test. 2006-01-07 Christopher Faylor * fhandler.h (set_console_state_for_spawn): Eliminate argument from declaration. * fhandler.cc (set_console_state_for_spawn): Eliminate argument from definition. Always check for invisible console. (fhandler_console::need_invisible): Don't do anything if the windows station is already not visible. * spawn.cc (spawn_guts): Accommodate change of argument to set_console_state_for_spawn. 2006-01-05 Christopher Faylor * sigproc.cc (no_signals_available): Use existence of signal thread handle to figure out if we can actually send signals rather than relying on my_sendsig. (hwait_sig): Make static. (sigproc_init): Don't set my_sendsig to anything special. Use new global static hwait_sig. (wait_sig): Set hwait_sig to NULL when we are exiting. 2006-01-05 Christopher Faylor * include/getopt.h: Accommodate recent unfortunate newlib changes. 2006-01-05 Christopher Faylor * cygtls.cc (_cygtls::remove): Don't output debugging info if this isn't a cygwin thread. * sigproc.cc (sigproc_init): Move clearing of sync_startup here to lessen the likelihood of trying to deal with non-cygwin threads in dll_entry. * fhandler_console: Fix set_console_state_for_spawn comment. 2006-01-05 Igor Peshansky * spawn.cc (spawn_guts): Invert the argument to set_console_state_for_spawn. 2006-01-04 Christopher Faylor * fhandler_console.cc (fhandler_console::need_invisible): Only try to open "CygwinInvisible" windows station if opening of default station fails. Use CloseWindowStation to close window station handle. 2006-01-04 Christopher Faylor * fhandler_console.cc (fhandler_console::need_invisible): Open up the security of the newly created windows station. 2006-01-04 Eric Blake * path.cc (dot_special_chars): Add ", <, >, and |. 2006-01-03 Christopher Faylor * fhandler_console.cc (beep): Use MB_OK which is documented as using the default bell rather than -1 which seems to behave differently on different versions of Windows. 2006-01-03 Christopher Faylor * fhandler_process.cc (fhandler_process::readdir): Add missing argument to syscall_printf. * fhandler_console.cc (fhandler_console::need_invisible): Use made-up name for windows station rather than asking Windows to create one for us. * spawn.cc (spawn_guts): Don't mess with console if we're detaching. 2006-01-03 Christopher Faylor * dir.cc (readdir_worker): Minor code cleanup. * fhandler_console.cc (beep): Use a more Windows-generic wav file if the beep is missing. Use a more foolproof way to find out whether we should be recreating the missing key. * registry.h (reg_key::_disposition): New field. (reg_key::created): New function. * registry.cc (reg_key::reg_key): Set _disposition to zero by default. (reg_key::build_key): Fill in _disposition field. 2006-01-03 Eric Blake * dir.cc (readdir_worker): Ensure that saw_dot* flags are updated when not handling inodes. 2006-01-02 Christopher Faylor * fhandler_console.cc (beep): New function. Restores missing "Default Beep", if necessary. (fhandler_console::write_normal): Use beep(). 2006-01-02 Christopher Faylor * dcrt0.cc (_dll_crt0): Remove more leftover debugging stuff. (cygwin_dll_init): Remove unneeded initializations. Call _dll_crt0 rather than dll_crt0_1. 2006-01-02 Corinna Vinschen * syslog.cc: Include sys/un.h instead of sys/socket.h. (syslogd_inited): Convert to enum type noting the exact result of trying to connect to syslog daemon. Use this way throughout. (connect_syslogd): New static function taking over the task to connect to syslog socket. Use correct struct sockaddr_un instead of struct sockaddr. (try_connect_syslogd): Call connect_syslogd. If write fails on connection oriented socket, try to reconnect to syslog socket and try to write again. 2006-01-01 Christopher Faylor * pinfo.cc (pinfo::exit): Swap signal and normal exit value when not started from a cygwin process - just like the good-old-days of B20. 2006-01-01 Christopher Faylor * strace.cc (strace::write_childpid): Remove debugging output. 2006-01-01 Christopher Faylor * cygtls.cc (_cygtls::remove): Remove left over debugging cruft which caused this function to always return prematurely. 2006-01-01 Christopher Faylor * exceptions.cc (sigpacket::process): Pass actual reference to signal's sigaction structure to setup_handler. 2006-01-01 Christopher Faylor * exceptions.cc (_cygtls::interrupt_setup): Implement SA_RESETHAND. * include/cygwin/signal.h: Define SA_ONESHOT and SA_NOMASK. * dcrt0.cc (get_cygwin_startup_info): Remove commented out code. 2006-01-01 Corinna Vinschen * syslog.cc (vklog): Never log kernel messages using the vsyslog interface.