Thu Dec 31 16:50:32 1998 DJ Delorie * mmap.cc: replaced all references to libstdc++ templates with inline classes to remove build dependency on libstdc++ Thu Dec 31 00:02:40 1998 Geoffrey Noer * sysdef/uuid.def: remove useless stub. * sysdef/oldnames.def: ditto. * sysdef/largeint.def: ditto. * sysdef/rpcndr.def: ditto. Wed Dec 30 20:33:09 1998 Geoffrey Noer * utils/cygcheck.cc: clean up misc. warnings relating to signed vs. unsigned, char * vs. const char *, etc... Wed Dec 30 21:41:25 1998 Christopher Faylor * dcrt0.cc (do_exit): Remove previous dwProcessId change as it presumes too much knowledge about signalling in the wrong place in the code. * sigproc.cc (sigproc_terminate): Move the dwProcessId assignment here but only do it when it is necessary or programs will die abnormally. * fhandler.h: Add raw_write method to fhandler_serial. * fhandler_serial.cc (raw_write): New method. Accommodates overlapped I/O that now must be used with serial. * utils/kill.cc (main): Allow `0' signal. Just checks for existence of process. Wed Dec 30 00:01:18 1998 Geoffrey Noer * include/cygwin/version.h: bump API_MINOR to 8 to mark recently exported _ctype_, _sys_errlist, _sys_nerr. Briefly describe all API_MINOR changes to date. Wed Dec 30 01:31:34 1998 Christopher Faylor * dcrt0.cc (do_exit): Set myself->dwProcessId so that some exit routines will not falsely believe that this process has been execed. * select.cc (peek_serial): Remove debugging statements. * sigproc.cc (sigproc_terminate): Detect state where myself->dwProcessId == 0 as indicative of not being an exec stub. Tue Dec 29 21:13:33 1998 Christopher Faylor * dcrt0.cc (alloc_stack_hard_way): Fix a couple of thinkos in calculating size of the new stack. Just use the size passed from the parent. (dll_crt0_1): Set up new frame pointers here, if appropriate. * fork.cc (fork): Move frame pointer setup into dll_crt0_1. Tue Dec 29 12:57:38 1998 Geoffrey Noer * utils/mkpasswd.c: Include wchar.h. * utils/mkgroup.c: Ditto. Tue Dec 29 12:53:23 1998 Geoffrey Noer * Makefile.in: remove dep for libcerr.o Mon Dec 28 22:02:15 1998 Christopher Faylor * fhandler.h: Make fhandler_serial io_status public since select needs it. Add 'saw_error' field to select_record so that select can detect error conditions. * fhandler_serial.cc (fhandler_serial::raw_read): Detect "operation aborted" error and retry. This seems to indicate an attempt to retry an overlapped operation. * select.cc (select_stuff::wait): Honor saw_error field when appropriate. (peek_serial): Rewrite to operate similarly to fhandler_serial::raw_read. * include/sys/termios.h: CBAUD mask was still not right. Mon Dec 28 09:09:27 1998 Christopher Faylor * libcerr.cc: Make obsolete. Move into errno.cc * libctype.c: Make obsolete. Use newlib table. * Makefile.in: Remove obsolete entries from LIBCOS. Define __INSIDE_CYGWIN__ explicitly for .c -> .o compilation. * cygwin.din: New exports: _ctype_, _sys_errlist, _sys_nerr. * errno.cc: Move _sys_errlist and _sys_nerr here. * dlfcn.cc: Reorganize includes to put ctype.h after winsup.h so that __INSIDE_CYGWIN__ will be defined for use in ctype.h. * fhandler_console.cc: Ditto. * fhandler_tty.cc: Ditto. * path.cc: Ditto. * spawn.cc: Ditto. Sat Dec 26 00:20:48 1998 Christopher Faylor patch from Corinna Vinschen : * include/Windows32/CommonFunction.h: Added proto for NetUserChangePassword(). Thu Dec 24 16:15:40 1998 Christopher Faylor * dcrt0.cc (dll_crt0_1): Add more debugging output. * ioctl.cc (ioctl): Can't use TC[GS]ET ioctls for pty master as it conflicts with TIOCPKT. * passwd.cc (passwd): Bypass tc[gs]etattr call in favor of appropriate method or conversion confusion will result due to attempts to appropriately convert to old-style termios structures in tc[gs]etattr. * strace.cc (strace_vsprintf): Define t explicitly. * termios.cc (tcsetattr): Reorganize to allow meaningful debugging output. (tcgetattr): Ditto. Wed Dec 23 15:02:11 1998 Christopher Faylor * winsup.h: Reorganize include order to allow thread-safe build. Wed Dec 23 11:45:33 1998 DJ Delorie * strace.cc (strace_microseconds): new function; returns elapsed time in microseconds, using performance counters if available. (strace_vsprintf): print timestamps and deltas as microseconds, not seconds. Wed Dec 23 11:35:02 1998 DJ Delorie * times.cc (__to_clock_t): Change return value to unsigned long long to prevent overflow. Tue Dec 22 19:37:55 1998 Christopher Faylor * fhandler.h: Reflect fhandler_*::init argument reordering. Add dup and init methods to fhandler_serial. * fhandler.cc (fhandler_base::init): Reorder arguments to mirror open(). * fhandler_console.cc (fhandler_console::init): Ditto. Initialize using fhandler_base rather than fhandler_serial as console is now being slowly uncouple from fhandler_serial. * fhandler_serial.cc (fhandler_serial::fhandler_serial): Set size of data structure or suffer strange behavior on exec(). (raw_read): Add debugging output. (fhandler_serial::init): New method. (fhandler_serial::open): Detect call from init method and avoid calling fhandler_base::open. Don't worry about non-blocking reads since they are now handled correctly by _read(). (fhandler_serial::tcsetattr): Honor ICANON in a kludgey sort of way. (fhandler_serial::tcgetattr): Ditto. (fhandler_serial::dup): New method. Ensures duplication of all elements of fhandler_serial class. * fhandler_tty.cc (fhandler_tty_master::init): Reflect init argument reordering. (fhandler_tty_slave::init): Ditto. * hinfo.cc (hinfo::init_std_file_from_handle): Remove unnecessary argument. (hinfo_init): Reflect change to init_std_file_from_handle. (cygwin_attach_handle_to_fd): Use more appropriate types for arguments. (hinfo::build_fhandler): Add some slop to allocated buffer just for paranoia's sake. (hinfo::dup2): Avoid dereferencing a NULL pointer when oldfd==newfd. * pipe.cc (make_pipe): Reflect init argument change. * shared.h: Another immigrant from winsup.h * winsup.h: Reflect change to init_std_file_from_handle. Relocate a declaration to shared.h so that it can be used in fhandler.h. * include/sys/cygwin.h: Reflect change to cygwin_attach_handle_to_fd. Mon Dec 21 16:22:48 1998 Christopher Faylor * fhandler.cc (fhandler_base::open): Detect serial device as a special case requiring an overlapped open. * fhandler.h (fhandler_serial): Add several methods. Add new 'fixup after fork required' field. * fhandler_serial.cc (raw_read): Rewrite to come closer to handling VMIN VTIME parameters and to allow EINTR. (fhandler_serial::open): Initialize overlapped event here. Make error messages more explicit. (fhandler_serial::close): Close status event. (fhandler_serial::tcsetattr): Store vtime_ as milliseconds. Attempt to handle VMIN > 0, VTIME == 0 better. (fhandler_serial::fixup_after_fork): Initialize a new event handle after a fork. (fhandler_serial::de_linearize): Ditto. * hinfo.cc (hinfo::fixup_after_fork): Call fork fixer upper if close_on_exec of need_fork_fixup set. Sun Dec 20 16:05:25 1998 Geoffrey Noer * include/shellapi.h: replace with stub that includes windows.h like similar headers already do. * scandir.cc (scandir): add parens around assignment used as truth value. Sat Dec 19 00:42:44 1998 Christopher Faylor * thread.cc: Fix copyright info. * thread.h: Ditto. * libcmain.cc: gcc is now more picky about requiring a type for main(), so add one. * include/pthread.h: Add attribution for net contributor. Fri Dec 18 19:21:30 1998 Geoffrey Noer * pthread.cc: fix copyright header. * shared.h: ditto. Fri Dec 18 19:21:30 1998 Geoffrey Noer patch from Corinna Vinschen : * cygwin.din: export scandir and alphasort. * Makefile.in: add scandir.o to deps * scandir.cc: New file with scandir and alphasort implementations. * include/cygwin/version.h: bump API_MINOR to 7. Fri Dec 18 16:44:07 1998 Geoffrey Noer * include/pthread.h: clean up, remove C++-style comments, remove pthread_getsequence_np proto. Fri Dec 18 15:26:33 1998 Christopher Faylor Throughout, prepend cygwin_ to functions that are exported as cygwin_* which previously needed to be aliased. * path.cc (cygwin_conv_to_win32_path): Resolve symbolic links. Return success or failure value. (cygwin_conv_to_full_win32_path): Ditto. (cygwin_conv_to_posix_path): Return success or failure value. (cygwin_win32_to_posix_path_list): Ditto. (cygwin_posix_to_win32_path_list): Ditto. * shared.h: New include file that incorporates parts of winsup.h, fhandler_tty.h, path.h, and delqueue.h. * Makefile.in: Remove old include files. * cygwin.din: cygwin_* aliases are no longer required. * libccrt0.cc: Store api_minor in per_process structure. * select.cc: Change meaning of second argument to ready_for_read to indicate whether read_ahead should be ignored. * fhandler.h: Reflect change in second argument to ready_for_read. * syscalls.cc (_read): Ditto. * termios.cc: Throughout, detect attempt to use old style termios structure and convert as appropriate. * ioctl.cc (ioctl): Detect use of ioctl requiring termios field and call appropriate tc[gs]et* function to handle it. * fhandler_console.cc (fhandler_console::ioctl): Remove TC* calls that are now handled in main ioctl. * fhandler_tty.cc (fhandler_tty_slave::ioctl): Ditto. * include/cygwin/version.h: Added TERMIOS defines. Bump API_MINOR to 6. * include/sys/cygwin.h: Reflect change in return value for some cygwin_conv_* calls. * include/sys/termios.h: Reformat slightly. Add conversion macros for dealing with old style termios structure. * include/pthread.h: add Fri Dec 18 15:03:33 1998 Christopher Faylor * Makefile.in: Cleanup pthread usage. Fri Dec 18 14:35:59 1998 Christopher Faylor * Makefile.in: Remove obsolete header dependency for thread-safe build. Fri Dec 18 14:16:04 1998 Christopher Faylor * exceptions.cc (sig_handle): Avoid suspending top-level processes. * trace.cc: Remove unneeded include. Thu Dec 17 19:19:53 1998 Geoffrey Noer * cygwin.din: remove pthread_getsequence_np, _reent_clib Thu Dec 17 16:48:15 1998 Geoffrey Noer * include/cygwin/version.h: correct two typos in comments Thu Dec 17 19:11:31 1998 Christopher Faylor patch from Corinna Vinschen : * include/Windows32/Defines.h: Add values for using Windows function `DeviceIoControl()'. Thu Dec 17 18:00:34 1998 Christopher Faylor * dcrt0.cc (dll_crt0_1): exception_list is not a struct. * debug.cc (thread_stub): Ditto. Thu Dec 17 08:24:37 1998 Christopher Faylor * cygwin.din: Remove leading underscores from pthread functions. * include/cygwin/version.h: Bump DLL major version to 21, DLL minor version to 0, and API_MINOR to 5. Wed Dec 16 22:54:16 1998 Christopher Faylor Merge in thread-safe branch changes. Wed Dec 16 22:54:16 1998 Christopher Faylor * pthread.cc: Include winsup.h. Wed Dec 16 22:54:16 1998 Christopher Faylor * thread.cc: Reformat. * pthread.cc: New file. * cygwin.din: Add pthread interface functions Wed Dec 16 22:54:16 1998 Christopher Faylor * configure.in: Add some --enable options. * configure: Regenerate. * Makefile.in: Reorganize CFLAGS to recognize new --enable options. Wed Dec 16 22:54:16 1998 Christopher Faylor * fork.cc (stack_base): Store slightly different information in child_info_fork structure for later use in alloc_stack_hard_way. (fork): Set frame pointer information if stack has been reallocated. * dcrt0.cc (alloc_stack_hard_way): Reflect change in child_info_fork structure. (dll_crt0_1): Make thread initializers "static" and NO_COPY or death of the main thread causes death of other threads. * winsup.h (child_info_fork): Change structure. Wed Dec 16 22:54:16 1998 Christopher Faylor * thread.h: Remove extraneous declaration. * include/sys/strace.h: Make a new thread_printf function for use by new thread-safe code. * thread.cc: Use thread_printf throughout. Wed Dec 16 22:54:16 1998 Christopher Faylor patch from Marco Fuykschot (marco@ddi.nl) * Throughout sources add locking control for preliminary thread-safe cygwin operation. Wed Dec 16 22:54:16 1998 Christopher Faylor * dcrt0.cc (getprogname): Should be a static. (alloc_stack): Extend to allow forking from another thread. (alloc_stack_hard_way): New function used by alloc_stack. (dll_crt0_1); Don't pass parameters since stack may be "funny". Use statics instead. Move fork/spawn checking into dll_crt0. (dll_crt0): Do fork spawn checking here. alloc_stack() will call dll_crt0_1 if forked from a non-main thread. * fork.cc (stack_base): New function determines base (and other values) of this thread's stack. (fork): Use new PROC_FORK1 method for forking. Provides more data to forkee. Use stack_base to set stack values. * winsup.h (child_info_fork): Changes for PROC_FORK1. Wed Dec 16 16:15:29 1998 Geoffrey Noer * include/shellapi.h: fix typo in DragQueryPoint proto. Mon Dec 14 12:37:43 1998 Geoffrey Noer * net.cc: minor respacing (get_ifconf): new local function, combines get_winnt_ifconf and get_win95_ifconf. (get_win95_ifconf): delete (get_winnt_ifconf): delete (fhandler_socket::ioctl): adjust ifconf calls in light of above, check returned value for safety. * include/cygwin/version.h: bump CYGWIN_VERSION_API_MINOR to 4 in honor of newly supported socket ioctls. patch from Corinna Vinschen : * include/asm/socket.h: Added defines for ioctl() calls SIOCGIFADDR, SIOCGIFBRDADDR and SIOCGIFNETMASK. * net.cc (get_winnt_ifconf): Check the registry entries instead of just calling get_win95_ifconf(). Added what argument to support the new ioctl() calls. (get_win95_ifconf): Check the Windows 9x registry entries as described by Tim Newsham. (fhandler_socket::ioctl): Support the ioctl() commands SIOCGIFADDR, SIOCGIFBRDADDR and SIOCGIFNETMASK. (get_if_flags): Check for a down interface. Wed Dec 9 18:11:31 1998 Geoffrey Noer * fhandler.cc (fhandler_disk_file::open): check for shell scripts regardless of Win32 OS type. Sun Dec 6 19:38:11 1998 Christopher Faylor patch from Corinna Vinschen : * fhandler_console.cc (fhandler_console::tcgetattr): Fix typo. ISIG should be ored with c_lflag. Tue Dec 1 16:28:56 1998 Geoffrey Noer * include/utmp.h: delete, moved to newlib/libc/sys/cygwin/sys. Thu Dec 3 15:41:51 1998 Geoffrey Noer Released 20.1 update. Thu Dec 3 22:24:18 1998 Christopher Faylor * exceptions.cc (set_process_mask): Add `sync' parameter to control whether signals should be synched on exit. (handle_sigsuspend): Provide second argument to set_process_mask - don't sync. (call_handler): Ditto for asm handler. * signal.cc (sigprocmask): Ensure that signals are synchronized by calling set_process_mask with sync == 1. * sigproc.cc (__release_signal_mutex): Third argument is not strictly a BOOL, so change it. * sigproc.h: Reflect above parameter changes. Thu Dec 3 15:30:44 1998 Christopher Faylor * select.cc (peek_console): Work around NT bug that caused strange behavior with ReadFile after this function was invoked. Tue Dec 1 14:43:35 1998 Christopher Faylor * sigproc.cc (sigproc_init): Set maintid and signal_mutex early to avoid races in wait_sig initialization. (__get_signal_mutex): Improve debug output. (__release_signal_mutex): Ditto. * spawn.cc (spawn_guts): Allocate more space for string when building up from #! and absolute path is not known. Otherwise weird stuff like infinite recursion or unknown file errors occur. Tue Dec 1 08:34:18 1998 Christopher Faylor * mkvers.sh: Accommodate lack of timezone in date output so that year shows up correctly. Mon Nov 30 14:30:51 1998 Jeff Johnston * times.cc (times): Altered function so that on non-Windows-NT systems it does not use the GetProcessTimes() API which is not supported. Mon Nov 30 00:38:54 1998 Christopher Faylor * dcrt0.cc: Fix incorrect use of struct on exception_list typedef. * debug.cc (thread_stub): Ditto. * dll_init.cc: Ditto. * include/Windows32/Structures.h: Correct typo where typedef SYSTEM_POWER_STATUS was being used as a struct. Sun Nov 29 22:03:17 1998 Christopher Faylor patch from Corinna Vinschen : * fhandler_console.cc (fhandler_console::ioctl): Added ioctl commands TCGETA, TCSETA, TCSETAW, TCSETAF. Fri Nov 27 22:30:58 1998 Christopher Faylor * fhandler.h: Set aside NOEINTR bit. When this is set cygwin will not allow the read on this device to be interrupted by a signal. * pipe (_pipe): Set NOEINTR bit for read end of pipes created using this method. The vague rationale for this is that these pipes are supposed to be more like Windows pipes than UNIX pipes. * syscalls.cc (_pipe): Honor NOEINTR flag. * getopt.c: Clean up some gcc warnings. * libcerr.c: Ditto. Fri Nov 27 21:56:03 1998 Christopher Faylor * exceptions.cc (SIG_NONMASKABLE): Update for new signal mask method. (handle_sigsuspend): Release of signal mutex must be synchronous -- the signal must be delivered before the function returns. Otherwise, there will be races in the caller code. * sigproc.cc (sigproc_terminate): Minor cleanup. Thu Nov 26 20:26:17 1998 Christopher Faylor * exceptions.cc (call_handler): Attempt to work around potential race when setting signal_arrived. This particularly affects sigsuspend. (handle_sigsuspend): Reset signal_arrived prior to grabbing the mutex. This should reduce the probability of a race. * sigproc.cc (sig_send): Don't reset signal_arrived in the SIGSUSPEND case since this could introduce a race. Thu Nov 26 12:19:16 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * select.cc (MAKEready): Don't wait for signal prior to testing for read. That introduces an unnecessary delay. Wed Nov 25 23:03:47 1998 Christopher Faylor * winsup.h: Make `isdirsep' an alias for SLASH_P. Implement isabspath convenience macro. Change sigprotect to a macro since it appears to be impossible to send __FILE__ type macros to a constructor. Change use of sig_protect throughout. * dcrt0.cc (dll_crt0_1): Use new path macro. * dlfcn.cc (get_full_path_of_dll): Ditto. * path.cc (path_conv::path_conv): Ditto. (normalize_posix_path): Ditto. (slashify): Ditto. (backslashify): Ditto. * syscalls.cc (num_entries): Ditto. * lock.cc: Redefine lock methods to pass debug info to {get,release}_signal_mutex. * environ.cc (environ_init): Correct strncmp test for TERM=, otherwise it's impossible to set TERM. * exceptions.cc: Eliminate lock_cs and unlock_cs macros. Use {get,release}_signal_mutex throughout. (signal_init): Don't initialize signal_mutex here. (set_process_mask): Remove vestiges of old mutex code. (handle_sigsuspend): Ditto. (call_handler): Move signal_arrived SetEvent back here. It was being triggered too often before. Detect when the signal thread is exiting. (sig_handle): Remove inappropriate SetEvent(signal_arrived). (events_terminate): Move close of signal_mutex elsewhere. * glob.cc: Increase "MAXPATHLEN" size for arguments that are not necessarily pathnames. * pinfo.cc (lpfu): Lower timeout for reporting possible problem with INFINITE wait. * sigproc.cc (wake_wait_subproc): Make this a macro with no arguments so that its use in the code is a little clearer. (proc_terminate): Eliminate signal blocking here since this should already be handled by the caller. (sigproc_init): It makes sense to initialize signal_mutex here, so do so. (__allow_sig_dispatch): Rename. Take debugging arguments. Pass arguments on to release_signal_mutex. (__block_sig_dispatch): Rename. Take debugging arguments. Pass arguments on to get_signal_mutex. Detect signal thread exiting confition. (__get_signal_mutex): Take debugging arguments. Maintain a stack of nested mutex calls for later display in __release_signal_mutex. Detect signal thread exit condition. Don't bother with locking if signal thread is executing or if just an exec stub. (__release_signal_mutex): Don't bother with locking if signal thread is executing or if just an exec stub. * sigproc.h: Reflect renamed functions above. Provide wrappers to pass in diagnostic information. * spawn.cc (spawn_guts): More fixes to deal with nested #! and to properly report posix argv[0] when invoked as a script. Wed Nov 25 12:41:12 1998 Christopher Faylor * Makefile.in: Reinstate libwinspool.a/winspool.drv creation. Tue Nov 24 18:48:56 1998 Geoffrey Noer * Makefile.in: add CFLAGS_COMMON and CFLAGS_CONFIG to CFLAGS and CXXFLAGS in FLAGS_TO_PASS. * include/sys/select.h: new file with select proto. Avoid potential conflict with Winsock inclusion by Cygwin internals. * include/sys/socket.h: remove select proto. * winsup.h: define __INSIDE_CYGWIN__. Include windows.h after Unix include files. * include/mywinsock.h: delete file * include/Windows32/Sockets.h: add ndef __INSIDE_CYGWIN__s around portions that conflict with Unix definitions. This yields what used to be mywinsock.h which is a blend of Unix sockets and Winsock needed by Cygwin internals. * exceptions.cc: define Win32_Winsock to include Windows32/Sockets.h. No longer define __INSIDE_CYGWIN__. * hinfo.cc: ditto * net.cc: ditto * select.cc: ditto * include/exceptions.h: change wrapper define to _EXCEPTIONS_H. * include/sys/resource.h: move includes outside __cplusplus check. * include/sys/wait.h: ditto. Sun Nov 22 23:33:19 1998 Geoffrey Noer * sigproc.cc (__release_signal_mutex): revert Nov 3d change. Sun Nov 22 17:04:44 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * regexp/Makefile.in: Add additional bits necessary to allow correct installation of include file. Fri Nov 20 17:04:48 1998 Christopher Faylor * Makefile.in: Set "Warn about writable strings" option in CFLAGS. * fhandler_tty.h: Fix for writable strings detection. * grp.cc (add_grp_line): Ditto. * mkvers.sh: Ditto. * path.h: Ditto. * registry.cc: (reg_key::reg_key): Ditto. * smallprint.c (__small_vsprintf): Ditto. * tty.cc (tty::get_event): Ditto. * winsup.h: Give up on read_ready_thread. Move sig_protect here since it needs to use information set up after the sigproc.h include. * dcrt0.cc: Ditto. * debug.cc (WFSO): New function. Used to ensure that function shows up on stack trace. (WFMO): Ditto. * debug.h: Define the above. * exceptions.cc (ctrl_c_handler): Record last signal for signal handler. * select.cc (MAKEready): New macro for constructing fhandler_*::ready_for_read function. (fhandler_*::ready_for_read): Use macro to construct this method throughout. * sigproc.cc (sig_send): Work around race on process termination where the event being waited for may disappear. (sigproc_terminate): #ifdef code here that attempted to deal with the above condition in sig_send. * sigproc.h: Move sig_protect to winsup.h. * spawn.cc (perhaps_suffix): Don't return pointer into an automatic variable. (find_exec): Always point known_suffix to something. * syscalls.cc (read_handler): Refine debug output. (read_ready_thread): Delete. (_read): Eliminate use of read_ready_thread. Call ready_for_read directly as appropriate. Thu Nov 19 15:26:40 1998 Geoffrey Noer * Makefile.in: remove -Wunused since that's already in -Wall * dlfcn.cc (check_path_access): rename winenv arg to mywinenv * path.cc (symlink): change save_errno var to saved_errno * spawn.cc (find_exec): rename winenv arg to mywinenv (spawn_guts): rename sigprotect handle to starting_here * winsup.h: remove trailing comma from process_state flags enum * utils/aclocal.m4: regenerate * utils/configure: regenerate Thu Nov 19 11:16:38 1998 Christopher Faylor * Makefile.in: Use correct libpthread.a target when thread-safe is enabled. Thu Nov 19 10:49:27 1998 Christopher Faylor * path.cc (path_conv): Correct error reporting. Wed Nov 18 20:07:50 1998 Geoffrey Noer * utils/Makefile.in: remove termcap file install rule Wed Nov 18 18:14:18 1998 Geoffrey Noer More minor cleanup: * environ.cc (winenv): don't define len twice. * fork.cc (sync_with_parent): should NOT use rc since this is a macro and that could have interfered with rc in the calling function. Renamed to psync_rc. * fhandler_serial.cc (fhandler_serial::open): change access to myaccess since it shadows global decl. * hinfo.cc: ditto throughout * path.cc: ditto throughout (path_conv::path_conv): change error to err. Wed Nov 18 16:17:58 1998 Geoffrey Noer * profil.c: include stdio.h (print_prof): comment out unused func (profile_ctl): should return an int Wed Nov 18 16:17:58 1998 Geoffrey Noer * utils/ps.cc: include sys/cygwin.h, make pname buf MAXPATH in size. patch from Corinna Vinschen : * utils/ps.cc (main): converting windows paths to posix paths in output. Wed Nov 18 15:34:46 1998 Geoffrey Noer * include/wchar.h: include stddef.h. Wed Nov 18 17:39:15 1998 Christopher Faylor * environ.cc (environ_init): Fix incorrect TERM= detection. Tue Nov 17 17:28:09 1998 Geoffrey Noer * gcrt0.c: include stdlib.h, add proto for monstartup. Tue Nov 17 16:47:42 1998 Geoffrey Noer * include/wchar.h: add protos for wcslen and wcscmp. * syscalls.cc: minor reformat. Tue Nov 17 15:38:45 1998 Christopher Faylor * fhandler.cc (fhandler_base::fhandler_base): Default non-disk devices to binary mode. * fhandler.h: Reformat slightly. Tue Nov 17 11:19:23 1998 Christopher Faylor * external.cc (fillout_pinfo): Copy progname using strcpy to save on time. * path.h: Add new enums for more fine-grained control of path_conv. * dir.cc (opendir): Use enum argument to path_conv. (mkdir): Ditto. (rmdir): Ditto. * dlfcn.cc (get_full_path_of_dll): Ditto. * fhandler.h: Add new set_readahead_valid to set actual readahead. * fhandler.cc (raw_read): Remove extraneous variable. (fhandler_base::read): Rework to allow readahead when not text mode. (fhandler_disk_file::fstat): get_symlink_p() only returns true/false now. (fhandler_disk_file::fhandler_disk_file): Use enum argument to path_conv. (fhandler_disk_file::open): Ditto. * spawn.cc (perhaps_suffix): Ditto. * syscalls.cc (_unlink): Ditto. (_link): Ditto. (stat_worker): Ditto. (_rename): Ditto. * fhandler_serial.cc (fhandler_serial::open): Always reset timeouts. * path.cc (path_conv::path_conv): Honor new enum arguments. Specifically, use SYMLINK_CONTENTS for readlink interface. (readlink): Use SYMLINK_CONTENTS argument to path_conv. * select.cc: Rework serial support which has apparently never worked. Mon Nov 16 16:15:20 1998 Geoffrey Noer * Makefile.in: FLAGS_TO_PASS should pass CFLAGS and CXXFLAGS not ALL_CFLAGS and ALL_CXXFLAGS. Rework handling of CFLAGS variables to remove duplication and make it possible to build mingw directory. Mon Nov 16 09:40:21 1998 Christopher Faylor * syscalls.cc (_open): Use new macro to check for NULL or empty pathname and return appropriate error. * path.cc (check_null_empty_path*): Move macro to path.h. * path.h: Move macros here. Sun Nov 15 20:23:10 1998 Geoffrey Noer * include/cygwin/version.h: bump API_MINOR to 3 to mark addition of dll_noncygwin_dllcrt0 to exports list. Sun Nov 15 23:05:21 1998 Christopher Faylor * path.cc (check_null_empty_path): New macro. (check_null_empty_path_errno): Ditto. (path_conv::path_conv): Check for NULL and empty path names here and set appropriate error. (conv_to_win32_path): Ditto. (conv_to_full_win32_path): Ditto. (conv_to_posix_path): Ditto. (conv_to_full_posix_path): Ditto. (mount_info::conv_wo_win32_path): Back out previous change. (mount_info::conv_to_posix_path): Ditto. Sun Nov 15 19:29:19 1998 Geoffrey Noer * include/limits.h: define CHILD_MAX to be 63. * sysconf.cc (sysconf): return CHILD_MAX when asked for instead of _POSIX_CHILD_MAX. Sun Nov 15 18:25:22 1998 Geoffrey Noer patch from Mumit Khan : * path.cc (mount_info::conv_to_posix_path): Handle NULL and empty pathnames. (mount_info::conv_to_win32_path): Likewise. Sun Nov 15 18:09:06 1998 Geoffrey Noer * cygwin.din: export dll_noncygwin_dllcrt0. * {libccrt0.cc, winsup.h}: minor reformat. Sat Nov 14 22:14:51 1998 Christopher Faylor * environ.cc (environ_init): Use sizeof for string lengths rather than hard-coded values. patch from Mumit Khan : * dll_init.cc (dll_foreign_dllcrt0): Rename to dll_noncygwin_dllcrt0. * winsup.h: Ditto. * include/cygwin/cygwin_dll.h: Ditto. Sat Nov 14 14:09:33 1998 Christopher Faylor * hinfo.cc (hinfo::de_linearize_fd_array): Reset first fd for open to zero after an exec. Sat Nov 14 01:29:23 1998 Christopher Faylor * fork.cc (fork): No need for intermediate jmp_buf variable. patch from Mumit Khan : * libccrt0.cc (cygwin_attach_foreign_dll): New function. * dll_init.cc (dll_foreign_dllcrt0): New function to initialize DLLs loaded by non-cygwin apps. (dll_dllcrt0_1): Initialize process table entry. (dll_dllcrt0): Revert last change to do partial initialization. * winsup.h (dll_foreign_dllcrt0): Prototype. * include/cygwin/cygwin_dll.h (_cygwin_foreign_dll_entry): New entry point that does partial initialization for non-cygwin apps. Fri Nov 13 16:17:28 1998 Geoffrey Noer Assorted -Wall cleanup: * utils/mount.cc (show_mounts): remove unused var i. * utils/cygcheck.cc (dll_info): comment out unused var ofs. (dump_sysinfo): return a void, not an int. Comment out unused var len in two places. Add parens around assignment used as truth value. * utils/kill.cc (main): remove unused var i * utils/mkpasswd: include and . (enum_users): remove unused var rc. (enum_local_groups): ditto. * utils/ps.cc (main): Add parens around assignments used as truth values. * utils/mkgroup.c: include and . (enum_groups): return void, not int. Remove unused var rc. * gmon.c: include and . (_mcleanup): remove unused vars buf and profdir. Fri Nov 13 16:17:28 1998 Geoffrey Noer patch from Corinna Vinschen : * include/sys/sysmacros.h: new file, define major, minor, makedev Fri Nov 13 17:03:52 1998 Christopher Faylor * dcrt0.cc: Reflect a variable name change. * fhandler.h: *::ready_for read takes an additional argument. * fhandler_console.cc (get_non_ascii_key): New function derived from fhandler_console::read1. (fhandler_console::read1): Use new function. * select.cc (*::ready_for_read): Add new "nonblocking" argument. (peek_console): Be more diligent in detecting when a usable character has been entered or false positives will be returned. (fhandler_tty_common::ready_for_read): Detect attempt to perform a "background" read. * syscalls.cc (read_handler): Remove code for dealing with slow devices. Just deal with non-blocking here. (read_ready_thread): Renamed function. Rewritten to only detect when an fd has data ready to be read. Actual reads happen in the main thread. (_read): Rely on read_handler to read data for everything. Use the read_ready_thread to indicate when data is ready to be read. Gut the read_thread_info class since it no longer needs to return much information. * winsup.h: Reflect above changes to read_thread_info. Rename to read_ready_thread_info. Fri Nov 13 15:09:26 1998 Christopher Faylor patch from Corinna Vinschen and Ron Parker : * path.cc (mount_info::conv_to_win32_path): Refined recognition of UNC devices. Fri Nov 13 12:37:00 1998 Christopher Faylor * Makefile.in: Fix a typo. Fri Nov 13 10:59:43 1998 DJ Delorie * Makefile.in: "make" uses new "ld -shared" by default internally. Fri Nov 13 00:58:38 1998 Christopher Faylor * spawn.cc (find_exec): Make sure that return value is correct in all cases. Document. * fhandler.h (fhandler_tty_common): Give unit number to constructor. * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Give unit number to descriptor. Create correct UNIX path name for tty so that ttyname() will work correctly. * select.cc (fhandler_tty_common::ready_for_read): Don't worry about read_for_read since the tty read routines are already interruptible. * syscalls.cc (_read): Reset read thread events on signal. patch from Mumit Khan : * dlfcn.cc (ctype.h): Include. (check_access): Document. (check_path_access): Document. (get_full_path_to_dll): Rework to handle general filenames and symlinks. Thu Nov 12 17:01:52 1998 DJ Delorie * Makefile.in (shared): "make shared" uses the new "ld -shared" * cygwin.din: add LIBRARY and BASE tags for "ld -shared" Wed Nov 11 17:16:17 1998 Christopher Faylor * configure.in: Add --enable options for various cygwin defines including preliminary thread-safe defines. * configure: Regenerate * Makefile.in: Honor new --enable options. * glob.h: Move BSD defines to sys/cdefs.h. * include/sys/cdefs.h: Move __P definition here. Wed Nov 11 14:00:45 1998 DJ Delorie * cygwin.din (getpwnam): remove duplicates Tue Nov 10 18:27:09 1998 Geoffrey Noer * utils/aclocal.m4: regenerate with aclocal * utils/configure.in: don't call AM_CYGWIN32 * utils/configure: regenerate Tue Nov 10 15:56:03 1998 Geoffrey Noer patch from Gary V. Vaughan : * dlfcn.cc (dlopen): return an introspective handle to the current module if name arg is NULL. The Single UNIX Specification, Version 2 has this as a requirement. Mon Nov 9 16:29:27 1998 Geoffrey Noer * errno.cc (strerror): all errnos in newlib/libc/include/sys/errno.h are now listed here. Mon Nov 9 16:29:27 1998 Geoffrey Noer * include/cygwin/version.h: up DLL version, bump API_MINOR to 2 to mark following change. patch from Mumit Khan : * cygwin.din: add exports for some of the newlib bessel functions (j1, jn, y1, yn). Mon Nov 9 15:10:06 1998 Geoffrey Noer * syscalls.cc (_link): rewrite FIXME. Mon Nov 9 14:51:03 1998 Geoffrey Noer * errno.cc (strerror): add string for EDEADLOCK. patch from Corinna Vinschen : * errno.cc (errmap[]): add END_OF_MEDIA and additional Win32 error codes. Sun Nov 8 21:28:01 1998 Christopher Faylor * fhandler.h: fhandler_pipe cannot be is_slow under Windows9[58]. There is no way to check for EOF on a pipe without performing a read on that system. * syscalls.cc (read_handler): Don't check for ready_for_read unless this is a "slow" device. * winsup.h: Reorganize to accomdate fhandler.h requirement for os_type. Sat Nov 7 23:27:05 1998 Christopher Faylor * fhandler.h (fhandler_console): Add a new function declaration. * fhandler_console.cc (fhandler_console::read1): New function renamed from console_read to allow use of class fields. Detect readahead situation when doing line buffering and buffer does not contain \n. (fhandler_console::read): Reflect function name change. * select.cc (cygwin_select): Changes for better handling of < 1000 usec timeouts. (select_stuff::wait): Perform a poll on timeout to set any fd's that may have become active. (peek_pipe): More debugging. Honor write_ready if set. (peek_console): Can't always use WaitForSingleObject. Detect readahead conditions set in fhandler_console::read1. Honor write_ready if set. (peek_windows): Honor write_ready if set. * times.cc (__to_clock_t): Return clock_t value. (times): Add some debugging printfs. Fri Nov 6 20:15:20 1998 Christopher Faylor patch from Corinna Vinschen : * spawn.cc (spawn_guts): find_exec() argument mismatch resulted in inability to run !# scripts which did not begin with '/'. Tue Nov 3 16:12:59 1998 Christopher Faylor * exceptions.cc (handle_exceptions): Don't wait for signal completion. (ctrl_c_handler): Ditto. * fhandler.h (fhandler_*): Declare new ready_for_read functions. * select.cc: Reorganize all methods into a peek_*, a poll_*, and a fhandler_*::ready_for_read. This is to allow the _read function to query the state of an fd without starting a thread. * signal.cc (kill_worker): If sending a signal from a non-main thread don't wait for completion. * sigproc.h (myself_nowait_nonmain): New define for use by sig_send. * sigproc.cc (sig_send): Honor myself_nowait_nonmain. Don't wait if not in main thread. (__release_signal_mutex): Revert to calling ReleaseMutex only once or mutex is released prematurely. * syscalls.cc (read_handler): Use new ready_for_read method to determine if an fd has data for reading. This function optionally blocks until there is data to read. (read_helper): Add debugging statement. (_read): Move signal_arrived reset to before sig_protect to avoid a race. Force read_handler thread to longjmp back to read_handler function on signal. Tue Nov 3 12:18:31 1998 DJ Delorie * utils/cygcheck.cc (dump_sysinfo): Note when not finding a program (like cpp) on the path is a good thing. Tue Nov 3 01:26:08 1998 Geoffrey Noer patch from Kazuhiro Fujieda : * environ.cc (environ_init): correct size arg to parse_options Mon Nov 2 21:40:32 1998 Christopher Faylor * regexp/regexp.c (regatom): Respond to compiler warning. Mon Nov 2 21:36:48 1998 Christopher Faylor * exceptions.cc (handle_exceptions): cygwin should not print exception information if the exception is trapped via signal(). Also use consistent timings for lock_cs() throughout. Mon Nov 2 16:46:28 1998 Geoffrey Noer * Makefile.in: For now, also include newlib/libc/sys/cygwin. Eventually will stop including newlib/libc/sys/cygwin32. Mon Nov 2 19:38:30 1998 Christopher Faylor patch from Corinna Vinschen : * syscall.cc (gethostname): function deleted * net.cc (gethostname): new function 'gethostname' which first calls wsock32::gethostname and only if it fails, calls GetComputerNameA. Wed Oct 28 17:57:53 1998 Geoffrey Noer * include/cygwin/version.h: up DLL version to 20.0 in honor of new Net release. Wed Oct 28 17:57:53 1998 Geoffrey Noer patch from Mumit Khan : * dll_init.cc (doGlobalCTORS): Fix invocation order. (doGlobalDTORS): Likewise. Wed Oct 28 17:57:53 1998 Geoffrey Noer * Makefile.in: add include/exceptions.h to dll_init.cc deps. patch from Mumit Khan : * dll_init.cc (exceptions.h): Include. (dll_dllcrt0_1): New function to initialize Cygwin DLL guts properly when a non-Cygwin app uses the Cygwin DLL. (dll_dllcrt0): Call dll_dllcrt0_1 when user_data is NULL. Tue Oct 27 17:35:00 1998 Geoffrey Noer * syslog.cc: drop "32" from CYGWIN32_LOG_NAME Tue Oct 27 16:09:09 1998 DJ Delorie * utils/cygcheck.cc (usage): cygwhich->cygcheck Mon Oct 26 17:47:10 1998 Geoffrey Noer * Makefile.in: fix deps for dll_entry.o and dll_main.o, add dep for glob.o. patch from Mumit Khan : * dll_entry.cc: New file for user DLL entry point. * dll_main.cc: New file for user DLL main. * Makefile.in (LIBCOS): Add dll_entry.o and dll_main.o. Mon Oct 26 13:47:10 1998 Geoffrey Noer * Makefile.in: add back install of include/net which was removed by accident. Mon Oct 26 15:25:22 1998 Christopher Faylor * strace.cc (get_strace_mutex): Don't reset last windows error. (strace_printf): Preserve last windows error. Mon Oct 26 11:01:46 1998 Christopher Faylor * uname.cc (uname): Remove slash from system name. Mon Oct 26 02:11:44 1998 Geoffrey Noer * include/asm/byteorder.h: add missing __cplusplus wrapper. Mon Oct 26 00:46:33 1998 Christopher Faylor * uname.cc (uname): Remove space from the system name. Sun Oct 25 23:47:56 1998 Christopher Faylor * fhandler_console.cc (console_read): Several typos caused flaky behavior when \r or \n detected under ENABLE_LINE_INPUT. Also ignore first \n detected under ENABLE_LINE_INPUT if it isn't preceded by a \r. This avoids problems when switching from "raw" mode into "cooked mode. Sun Oct 25 12:28:21 1998 Geoffrey Noer * cygwin.din: remove unnecessary __cygwin32_stack_trace and __cygwin_stack_trace exports. Sat Oct 24 21:18:46 1998 Christopher Faylor patch from Corinna Vinschen : * path.cc (symlink): Standard protection for symlink should be 0777. * syscalls.cc (num_entries): Calculated links for directory entry should only include directories. Sat Oct 24 20:51:08 1998 Christopher Faylor * mkvers.sh: Modify check for CVS/Tag to work around ash bug. * sigproc.cc (wait_sig): Fix detection of non-blockable signals. Fri Oct 23 18:24:43 1998 Geoffrey Noer * environ.cc: CYGWIN32 environment variable is now called CYGWIN * window.cc: lose "32" in Cygwin32WndClass * syslog.cc: lose "32" in WIN95_EVENT_LOG_PATH and CYGWIN32_LOG_NAME. Fri Oct 23 16:32:59 1998 Geoffrey Noer * utils/cygcheck.cc: reformat, add copyright notice Fri Oct 23 18:15:28 1998 DJ Delorie * utils/cygcheck.cc: new file * utils/Makefile.in: build cygcheck.exe Fri Oct 23 16:48:41 1998 Christopher Faylor * exceptions.cc (signals_init): Add error to api_fatal. (events_init): Ditto. Collapse printfs into one. (winsock_init): Ditto. * net.cc (winsock_init): Remove "Cygwin" from error message. Fri Oct 23 13:48:10 1998 Geoffrey Noer * Makefile.in: install include/cygwin headers, losing the "32". * include/cygwin32: remove Fri Oct 23 14:36:31 1998 Christopher Faylor * environ.cc (environ_init): Avoid reallocating environ array. * exec.cc: Increase number of arguments to 1024 throughout. * fhandler.cc (fhandler_disk_file::open): Revert to checking a file for '#!' to find out if it is executable but add extra check for NTEA which, if set, eliminates the need for the read. * sigproc.cc (sigproc_terminate): Close hwait_sig and set it to NULL prior to closing other handles since this flags some routines that the process is going down. Fri Oct 23 00:31:27 1998 Geoffrey Noer * utils/*: remove "32"s from cygwin32_foo function calls Fri Oct 23 00:24:27 1998 Geoffrey Noer * include/cygwin/version.h: increment CYGWIN_VERSION_DLL_MINOR and CYGWIN_VERSION_API_MINOR since I'm changing the API in a meaningful but backwards-compatible fashion. * exceptions.cc: strip "32" from cygwin32_exception_handler debug printfs * net.cc: strip "32" from all net functions * select.cc, syscalls.cc, winsup.h: lose "32" from cygwin32_select * cygwin.din: adjust for these changes (no backwards compatability issues here). * cygwin.din: rename all cygwin32_foo functions, aliasing as cygwin_foo for backwards compat. for now but intend to lose them at a later date. * include/sys/cygwin.h: copy all cygwin32_ protos and make them usable without the "32". We will remove the cygwin32_ ones at a later date. * external.cc, external.h: lose "32" from cygwin32_internal * shared.cc, winsup.h: lose "32" in cygwin32_getshared * path.cc, path.h: lose "32" in cygwin32_foo comments * dll_init.cc: lose "32" in cygwin32_detach_dll * hinfo.cc: lose "32" in cygwin32_attach_handle_to_fd * libccrt0.cc: lose "32" in refs to cygwin32_attach_dll * pinfo.cc: lose "32" in cygwin32_winpid_to_pid * include/cygwin32: remove all files except cygwin32_dll.h which some people may already be including. Aim to remove this remaining file at a later date. * include/cygwin: move all include/cygwin32 files here. * cygwin/cygwin_dll.h: change protos to reflect loss of "32"s * include/net/if.h, include/netinet/in.h, include/netinet/ip.h, include/netinet/ip_icmp.h, include/asm/socket.h: include/sys/socket.h: include the headers in include/cygwin * Makefile.in, winsup.h: fix references to include/cygwin32/version.h * libcctype.c, smallprint.c, test.c: lose "32" in Cygwin32 refs in comments * include/dlfcn.h, include/exceptions.h, include/mapi.h, include/winsock.h, include/mywinsock.h: ditto * config/*: ditto * profil.c: ditto, and respace Thu Oct 22 22:52:40 1998 Geoffrey Noer * net.cc, exceptions.cc, hinfo.cc, select.cc, include/mywinsock.h: rename __INSIDE_CYGWIN32__ to __INSIDE_CYGWIN__ Thu Oct 22 17:39:06 1998 Geoffrey Noer First round of Cygwin32 -> Cygwin renaming. In all files, rename Cygwin32 to Cygwin in comments. * CYGWIN32_LICENSE: delete and * CYGWIN_LICENSE: add it back under this name Thu Oct 22 20:10:24 1998 Christopher Faylor * exceptions.cc: Eliminate cs mutex. Just use signal_mutex throughout. Rename sig_dispatch_mutex to signal_mutex throughout. (lock_cs): Rewrite to be a front-end for get_signal_mutex. (unlock_cs): Rewrite to be a front-end for release_signal_mutex. (set_process_mask): Synchronize signals after resetting mask. * sigproc.cc (release_signal_mutex): Report on success or failure of signal_mutex release. * include/Windows32/Defines.h (FILE_FLAG_WRITE_THROUGH): Make unsigned to avoid a compiler warning. Thu Oct 22 14:23:49 1998 Geoffrey Noer * utils/Makefile.in: disable building cygwin.exe. Thu Oct 22 14:16:10 1998 Christopher Faylor * exceptions.cc (sig_handle): Minimize life of cs lock during handling of signals to reduce the potential for a race. Thu Oct 22 10:23:19 1998 Christopher Faylor * include/sys/strace.h: Minor addition from threadsafe-branch. Thu Oct 22 09:03:18 1998 Christopher Faylor * debug.cc (close_handle): Error condition needs a return value. * environ.cc (parse_thing): char pointers should all be constant. (add): Ditto. * heap.cc (heap_init): Provide a little more information in fatal printf. Use api_fatal to print errors. * sigproc.cc (sigproc_terminate): Move code executed on thread termination here from wait_sig since this function may actually be executing in the signal thread. * strace.cc (strace_open): Argument should be const. (strace_init): Ditto. * winsup.h: Ditto. * include/cygwin32/version.h: Note that original shared memory version was 0 for 98r2. Wed Oct 21 08:41:39 1998 Christopher Faylor * dcrt0.cc (__api_fatal): Remove "cygwin" identifier. * fhandler.cc (fhandler_disk_file::open): Set symlink flag appropriately for previous change. * shared.cc (shared_name): Initialize static buffer to (hopefully) force it into NO_COPY segment. * mkvers.sh: Reorganize, add cvs tag detection, and output cygwin "info" defines. Tue Oct 20 18:42:50 1998 Geoffrey Noer * include/cygwin32/version.h: rewrite versioning comments, updating for new scheme but keeping historical information. Mon Oct 19 23:45:24 1998 Geoffrey Noer * include/windows.h: remove Objective-C BOOL ifdef, now taken care of within the include/Windows32 header files. * fhandler_console.cc: fix KeyEvent references in light of changes to the KeyEvent struct in the Windows32 headers. Update include/Windows32 header files. Changes from Mumit Khan , Corinna Vinschen , and me. * include/Windows32/CommonFunctions.h: new file, contents from Functions.h. * include/Windows32/*.h: Misc updates. Mon Oct 19 20:26:15 1998 Christopher Faylor * debug.cc: Throughout, avoid calling *_printf while lock is active. Previous lock count was not thread-safe. * fhandler_console.cc (console_read): Avoid sending a \r to caller if ENABLE_LINE_INPUT. (fhandler_console::read): Rely on console_read to handle \r\n conversion. Mon Oct 19 12:10:09 1998 Christopher Faylor * mkvers.sh: Use more portable constructs to allow running this with /bin/sh, bash, and ksh. Mon Oct 19 11:19:58 1998 Christopher Faylor * path.cc (mount_info::from_registry): Missed "b15.0" part for writing mount information back to registry. (mount_info::init): Remove obsolete stuff. Mon Oct 19 10:42:17 1998 Christopher Faylor * Makefile.in: Avoid newer GNU make construction when building version.cc. Mon Oct 19 00:09:06 1998 Geoffrey Noer * Makefile.in: invoke mkvers.sh with $(SHELL) Sun Oct 18 15:19:17 1998 Christopher Faylor * fhandler.cc (set_name): Accept unit argument for generating win32_name. (fhandler_base::fhandler_base): Ditto. (fhandler_dev_floppy::fhandler_dev_floppy): Ditto. (fhandler_dev_tape::fhandler_dev_tape): Ditto. (fstat): Set symlink bit only if symlink_p is positive. * fhandler.h: Reflect unit argument changes. * fhandler_serial.cc (fhandler_serial::fhandler_serial): Accept unit argument for generating win32_name. * hinfo.cc (hinfo::build_fhandler): Pass unit argument to constructor where apropriate. * path.cc (path_conv::path_conv): Set symlink_p to a positive value if !nofollow, negative otherwise. (windows_device_names): Can't default to \dev\comx. \dev part doesn't work. (get_device_number): Accept just "comN" for backwards compatibility. Sat Oct 17 01:58:15 1998 Christopher Faylor * dcrt0.cc (globify): Fix problem with argument corruption due to use of pointer freed by realloc. Sat Oct 17 00:10:53 1998 Christopher Faylor Change NOT_OPEN_FD to dtable.not_open throughout. * Makefile.in: Change .dll name to cygwin1.dll. Increment the '1' when there are API/shared memory changes. Make version.cc file every time .dll is linked. Remove datestamp stuff. * mkvers.sh: New file. Creates version.cc. * cygwin.din: Export setdtablesize. * dcrt0.cc: Remove obsolete version variables. (build_argv): Use issep() macro rather than isspace since isspace includes whitespace that the shell does not consider a command separator. (check_sanity_and_sync): Use new cygwin version defines and structures for compatibility checking. (dll_crt0_1): Ditto. (__api_fatal): Renamed from api_fatal. Now always called from macro which tacks program name to beginning of fmt. Increase size of buffer. * environ.cc (regopt): Use new reg_key class constructor functionality. * net.cc (getdomainname): Ditto. * path.cc (read_mounts): Ditto. (mount_info::from_registry): Ditto. (mount_info::to_registry): Ditto. (hash_path_name): No need for this to be a "C" function. * external.cc (cygwin32_internal): Export version info strings. * external.h: Add CW_GETVERSIONINFO. * fhandler.cc (fhandler_base::write): Eliminate use of MIN macro. * init.cc (set_dllname): Obsolete function. Handled in version.cc. (dll_entry): Remove reference to set_dllname. * libccrt0.cc (this_proc): Renamed from cygwin_statu. (cygwin_crt0_common): Record api version in this_proc. * mmap.cc (recreate_mmaps_after_fork): No need for this to be a "C" function. * syscalls.cc (close_all_files): Ditto. * pinfo.cc (lock_pinfo_for_update): Eliminate a compiler warning. * registry.cc: Eliminate reg_session class. Augment reg_key to handle functionality of reg_session. * registry.h: Ditto. * shared.cc (shared_name): No need for this to be a "C" function. Use new cygwin version structure. (shared_info::initialize): Use new reg_key class constructor functionality. * smallprint.c (__small_vsprintf): Accept %P as a format specifier. Signifies the program name. * spawn.cc (spawn_guts): Quote *all* of the stuff the dcrt0.c considers special. * tty.cc (tty::inuse_event_exists): Remove debugging printf. It results in too much output to strace log. * uinfo.cc: Add a needed include. * uname.cc (uname): Use new cygwin version structure to fill in utsname fields. * winsup.h: Regroup into sections. Add new version structure. * include/utmp.h: Move login/logout function declarations here. * include/cygwin32/version.h: Define new CYGWIN version/info stuff here. Fri Oct 16 00:13:35 1998 Geoffrey Noer * Makefile.in: enable building mingw subdir by default Thu Oct 15 12:01:08 1998 Christopher Faylor * spawn.cc (spawn_guts): Set all security attributes for CreateProcess so that sexec will work properly. Thu Oct 15 08:49:12 1998 Christopher Faylor * hinfo.cc (hinfo::dup2): Avoid a null pointer dereference in a debugging printf. Wed Oct 14 18:06:51 1998 Geoffrey Noer patch from Corinna Vinschen : * fhandler_console.cc (fhandler_console::dup): reset default_color since the console fhandler forgets its default colorizing when it's `dup'ed. (fhandler_console::fhandler_console): remove unnecessary erasing in constructor of fhandler_console. Mon Oct 12 22:20:59 1998 Christopher Faylor * fcntl.cc (fcntl): According to the "Single UNIX Specification", F_DUPFD should *not* close its argument. Revert to previous behavior. * hinfo.cc (dup2): Guard against closing target fd too early. * pinfo.cc: Always initialize myself to a dummy value so that myself != NULL checks are avoided. * include/sys/strace.h (strace): Remove NULL check for myself. * dcrt0.cc (api_fatal): Ditto. * exceptions.cc (handle_exceptions): Ditto. * signal.cc (sigprocmask): Ditto. (_raise): Ditto. * strace.cc (get_strace_mutex): Ditto. Mon Oct 12 15:19:47 1998 DJ Delorie * utils/ps.cc (main): use const char *pname Fri Oct 9 12:32:23 1998 Christopher Faylor * syscalls.cc (getw): Simplify. Thu Oct 8 23:09:34 1998 Geoffrey Noer * times.cc: add missing syscall_printfs to time functions, slight reformatting. Thu Oct 8 21:56:37 1998 DJ Delorie * hinfo.cc (cygwin32_attach_handle_to_fd): allow to pass -1 for dup() simulation; return allocated fd. * pinfo.cc (lock_pinfo_for_update): if the mutex is broken, fail instead of looping. If you do loop, don't use 100% CPU. Thu Oct 8 18:33:02 1998 Christopher Faylor * dcrt0.cc: Add another per-thread object for strace. (quoted): Fix misconception of method used to quote quotes. (globify): Optionally output arguments. (build_argv): Ditto. (dll_crt0_1): Fix typo in line reassignment. * debug.cc (class locker): Avoid calling lock multiple times. * exceptions.cc (call_handler): Set strace recursion flag to zero when invoking a signal handler. * fcntl.cc (_fcntl): F_DUPFD should close its argument. * fork.cc (fork): Move determination of parent process to a safer place. * sigproc.cc (get_sig_dispatch_mutex): Rename. Use macro interface to provide the name of the caller for strace output. (release_sig_dispatch_mutex): Ditto. * sigproc.h: Define *_dispatch_mutex wrappers. * strace.cc (strace_printf): Use new per-thread object to guard against recursion. * winsup.h: Define per_thread_strace_protect. Redo per_thread base class for a little more clarity. Wed Oct 7 22:30:43 1998 Geoffrey Noer * fhandler_tty.h: up NTTYs from 16 to 128 Wed Oct 7 09:15:55 1998 Christopher Faylor * fhandler_console.cc (console_read): Distinguish between 0 byte return from CTRL-C and EOF condition. Tue Oct 6 22:31:44 1998 Christopher Faylor * dcrt0.cc (build_argv): Rewrite. Now: 1) allocates argv on the fly, 2) inserts '@' files as they are found, 3) uses sh-style quoting using either " or ' which may be embedded in an argument. (insert_file): Don't scan command line. Accept already parsed arguments from build_argv. (quoted): New function for parsing quoted strings. (globify): Don't scan argv list. Accept element from build_argv which will be tacked to end of argv as it is being built. Extend quoting options to allow tilde, braces, and quotes. (dcrt0_dll_1): Simplify argv processing. Just call build_argv, which handles everything. Tue Oct 6 11:04:43 1998 Christopher Faylor Change Create[A-Z]* calls throughout to use sec_none_nih to avoid subprocesses accidentally inheriting handles. * grp.cc: Hold group structures in group_buf rather than an image of the /etc/group file. (parse_grp): New function to parse a group line into a struct group. (add_grp_line): Use parse_grp to add line from /etc/group into internal cache. (read_etc_group): Avoid redundant feof call. Set up default group. (getgrgid): Just return appropriate entry from group_buf rather than reparsing internal representation. (getgrnam): Ditto. (getgrent): Ditto. * hinfo.cc (hinfo::select_*): Set errno value when attempt is made to use an unopened fd. * passwd.cc: Hold passwd structures in passwd_buf rather than an image of the /etc/passwd file. (parse_pw): New function to parse a passwd line into a struct passwd. (add_pw_line): Use parse_pw to add line from /etc/passwd into internal cache. (read_etc_passwd): Avoid redundant feof call. (search_for): Just scan passwd_buf for matching entries. (getpwent): Just return appropriate entry from passwd_buf rather than reparsing internal representation. Mon Oct 5 18:06:31 1998 Geoffrey Noer patch from Corinna Vinschen : * sysdef/kernel32.def: add missing GetDiskFreeSpaceEx lines Sat Oct 3 23:52:23 1998 Christopher Faylor * dcrt0.cc (si): Initialize so that NO_COPY will work. * debug.cc (class locker): Fix previous change. Critical sections are still required, so protect them if operating in main thread to avoid signal problems. Make any previously static use of locker global since that appears to be the only foolproof way of marking the variable NO_COPY. Rename these variables to something that is not likely to be collided with. * exceptions.cc (call_handler): Signal arrival of a dispatched signal here and wait a long time for the mutex before giving up. Should increase performance slightly. * sigproc.cc (maintid): New external symbol. * sigproc.cc (maintid): Make this global since it is used in other places now. (sig_dispatch_pending): Don't wait for wait_sig to complete if there are no pending signals. Avoids a race and should be faster. (wait_sig): Don't set signal_arrived event here. Do it in call_handler. * strace.cc (strace_printf): Remove previous recursion check since it is not signal safe. * syscalls.cc (_read): Remove duplicate CreateEvent typo. Fri Oct 2 09:54:42 1998 DJ Delorie * strace.cc (strace_printf): protect against recursion Thu Oct 1 17:08:47 1998 Geoffrey Noer * utils/ps.cc (main): add more detailed usage printfs Thu Oct 1 11:05:16 1998 Christopher Faylor * Makefile.in: Fix typo in debug.o dependency. * debug.cc (class locker): Give up on using critical sections since they are not safe to use in the main thread due to signals. Wed Sep 30 22:34:42 1998 Christopher Faylor * fork.cc (fork): Close parent's parent_alive handle if there is one or suffer a handle leak. * syscalls.cc (_read): Make all events no access and non-inheritable or suffer potential handle leak. * windows.cc (gethwnd): Ditto. Wed Sep 30 17:22:29 1998 Geoffrey Noer * include/io.h: add missing setmode proto Tue Sep 29 23:33:11 1998 Christopher Faylor * fhandler_tty.cc (fhandler_pty_master::close): Make sure both sides of both pipes associated with a tty master are closed or suffer handle leaks. Tue Sep 29 16:55:00 1998 Geoffrey Noer * path.cc (mount_info::init): remove default mounts for raw devices. * utils/mount.cc (reset_mounts): ditto (main, usage): new -f flag disables warning messages about missing mount point directories. Two new flags, disabled for now: -c will create missing mount point directory, -g will select adding the mount point to the global registry location. * include/sys/mount.h: add MOUNT_GLOBAL define, for future use. Tue Sep 29 14:20:30 1998 Christopher Faylor * exceptions.cc (exception): Use %p to denote some hex values. * winsup.h (read_info): Add jmp_buf to structure. Required for syscalls.cc change below. Mon Sep 28 19:36:41 1998 Syd Polk * include/{tchar.h, direct.h}: Added so that tcl8.1a2 can be compiled with cygwin. Mon Sep 28 19:36:41 1998 Christopher Faylor * syscalls.cc (thread_reset): Yet another method for handling interruptible reads. (_read): Use thread_reset to reset reads after a signal. Sun Sep 27 21:11:46 1998 Christopher Faylor * cygwin.din: New alias for __cygwin32_stack_trace. * debug.cc (find_handle): Avoid leaving function without unlocking. (newh): Ditto. * exceptions.cc (__cygwin32_stack_trace): Rename to just `stack'. Shortens stack trace output. (exception): Use %p to distinguish register values. * fhandler_console.cc (fhandler_console::init): Remove debugging sig_protect. * init.cc (dll_entry): Move definition to avoid a compiler warning. * path.cc (mount_info::conv_to_win32_path): Detect case of root directory when setting win32 relative path. (mount): Remove obsolete label. * syscalls.cc (thread_sync): New function for exiting the read helper thread. (_read): Use new method for exiting the read helper thread. Sun Sep 27 11:25:06 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * delqueue.cc (delqueue_list::process_queue): Clear queue entry if file cannot be deleted for a reason other than sharing violation. Fri Sep 25 08:52:50 1998 Christopher Faylor * debug.cc: locker variables should all be static. * syscalls.cc (_read): Call ForceCloseHandle on thread handle since it is protected. Thu Sep 24 18:59:25 1998 Geoffrey Noer * path.cc (mount): don't verify that path is an existing directory. Instead * utils/mount.cc: verify that path is an existing directory and print warning if it's not. Still do the mount. Thu Sep 24 11:45:04 1998 Christopher Faylor * debug.cc: locker class variables must be NO_COPY since they contain data that should not be precisely duplicated after a fork. This hopefully fixes a "SIGSEGV" problem. * select.cc (peek_pipe): Pipes apparently should set both "read" and "exception" flags on EOF. Wed Sep 23 18:26:31 1998 DJ Delorie * doc/doctool.c (main): typo checking for --help Wed Sep 23 17:46:06 1998 Christopher Faylor * path.cc (symlink_check_one): Try much harder to ensure that CloseHandle is called on the file which was opened to check for a symlink. Avoid obsolete check for NULL buf. Wed Sep 23 17:11:50 1998 Christopher Faylor * syscalls.cc (_read): Close thread handle or suffer a leak. * dir.cc (opendir): Simplify logic. (readdir): Ditto. Close handle explicitly when hit end of files. (rewinddir): Close directory handle or suffer leak. (closedir): Simplify logic. Wed Sep 23 14:42:12 1998 Christopher Faylor patch from DJ Delorie : * path.cc (symlink_check_one): Don't re-define res or symlinks will be undetectable. Wed Sep 23 12:02:39 1998 Christopher Faylor * Change calls to api_fatal throughout to avoid need for \n (see below). Adapt some *_printf()/ExitProcess combinations to use api_fatal. * winsup.h (SIGTOMASK): Generate signal mask correctly for programs linked with newer cygwins. * dcrt0.cc (check_sanity_and_check): Set subtract constant for signal mask calculation based on whether binary was linked with "older" or "newer" cygwin. (do_global_ctors): Accept a second argument indicating whether the ctors should always be run. Necessary in forked processes for cygwin constructors which may do more than just allocate memory. (checkout): Remove obsolete function. (dll_crt0_1): Remove obsolete function call. Call do_global_ctors with second argument TRUE. (api_fatal): Change to a print-style function, allowing arguments. Always emit a "\n" after a message. (__main): Do not force running of constructors in forked processes. * exceptions.cc (call_handler): Simplify arguments passed to this function. Eliminate potential race by setting signal masks here. (sig_handle): Just calculate current sigaction pointer once. Change call_handler arguments. * fhandler_console.cc (fhandler_console::write_normal): Output unknown characters to screen. (fhandler_console::write): Make signal protection synchronous. * fork.cc (fork): Reorganize slightly to eliminate a compiler warning. * init.cc (dll_entry): Temporarily remove freeing of waitq_storage on thread detach until a more robust scheme is developed. * signal.cc (signal): Make signal protection synchronous. (sigaction): Ditto. * sigproc.cc (get_sig_dispatch_mutex): More debug info. (release_sig_dispatch_mutex): Work around potential bug in windows with double allocation of a mutex when WaitForSingleObject is interrupted. Save errno here only if about to call sig_send where it may be changed. (wait_sig): Remove unnecessary sig_sign stuff. Add some debugging output. * termios.cc (tcflow): Signal protection. (tcgetattr): Ditto. (tcsetattr): Make signal protection synchronous. * winsup.h: Add new extern for SIGTOMASK macro. Use it in SIGTOMASK macro. Move errno stuff to end so that it can benefit from previous declarations. * configure.in: Move AC_CANONICAL_SYSTEM up a little to avoid having configure generate some code (like the check for host type) twice. * configure: Regenerate. Wed Sep 23 11:49:55 1998 Christopher Faylor * path.cc (symlink_check_one): Fix handle leak resulting from open of file to check for symlink magic. Suggested by Corinna Vinschen . Wed Sep 23 08:33:26 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * fhandler_tty.cc (process_ioctl): Use console handle for ioctl operations. Tue Sep 22 23:58:20 1998 Geoffrey Noer based on patch from sos@prospect.com.ru (Sergey Okhapkin): * utils/ps.cc (main): rewrite ps to give it more options, including a, e, f, l, and u. Tue Sep 22 15:18:41 1998 Geoffrey Noer * path.cc (umount): remove initial system_printf (mount): stat path, verify that it's an existing directory, otherwise fail. (strncasematch, strcasematch): return 0 instead of FALSE * utils/mount.cc (reset_mounts): reset / to System drive, not C: as was done in the old days. Mon Sep 21 18:18:18 1998 Geoffrey Noer * path.cc (mount, umount, setmntent, getmntent, endmntent): make extern "C" Mon Sep 21 20:37:16 1998 DJ Delorie * doc/configure.in: don't try to find cc until we can correctly configure it for a native cc in a cross build. Mon Sep 21 17:17:14 1998 Geoffrey Noer * fhandler.cc (fhandler_disk_file::check_execable_p): don't check for .shc since that's non-standard. Check for .exe first. Mon Sep 21 14:57:50 1998 Geoffrey Noer * doc/Makefile.in: reference -db2html in case docbook tools aren't installed. Mon Sep 21 14:43:40 1998 Geoffrey Noer patch from DJ Delorie : * doc/doctool.c (scan_file): correct off by one error in malloc Mon Sep 21 14:28:38 1998 Christopher Faylor * fhandler.h (select_record): Clear memory in constructor. Mon Sep 21 08:49:22 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * select.h: Use unsigned int to hold count in fd_set structure or suffer alignment problems. (WINSOCK_FD_ZERO): Back out previous change as it is no longer needed due to the above. Sat Sep 19 22:58:18 1998 Christopher Faylor * fhandler_console.cc (console_read): Keep looping in ENABLE_LINE_INPUT mode when no characters are read. This apparently means that a CTRL-C has been hit. * select.cc (select_record::operator new): Remove. (setlect_stuff::~select_stuff): Use delete to remove record. (pipe_cleanup): Remove unneeded statement. (poll_socket): Add debugging statement. (start_thread_socket): Add debugging statements. * fhandler.h: Remove new operator from select_record. * select.h: Make WINSOCK_FD_ZERO more aggressive. * sigproc.cc (allow_sig_dispatch): Use new errno saving method. * syscalls.cc (_read): Reorganize stack freeing code to avoid overhead when it's not needed and to actually decommit stack memory. Sat Sep 19 19:16:32 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * select.cc (socket_cleanup): Avoid using a pointer after it has been deleted. Fri Sep 18 13:57:37 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * Makefile.in: Really remove extra slash in INCLUDES. Previous change didn't work. pipe.cc (make_pipe): set close-on-exec flag for non-inheritable pipes. Thu Sep 17 15:26:14 1998 Christopher Faylor * doc/Makefile.in: Add dummy install target. Thu Sep 17 12:30:49 1998 Christopher Faylor * winsup.h (per_thread*): New classes for storing and manipulating per_thread information. (threadstuff): New array of per_thread objects which are manipulated after a fork. (read_helper_thread_info): read() thread local storage. (waitq_storage): wait() thread local storage. * debug.cc (class locker): New class for generic locking of debug table manipulation. Use this throughout for locking access to thread/debug tables. (debug_init): Remove in favor of automatic constructor. * debug.h: Ditto. * fork.cc (fork): Iterate through threadstuff looking for thread information to clear out. Should solve some problems for Windows 95/98. * init.cc (dll_entry): Remove thread storage initialization. Use per_thread class for DLL_THREAD_DETEACH. * sigproc.cc: Use system_printf rather than alert_printf throughout since system_printf now has the same functionality. (sigproc_init): Use method to initialize per-thread storage. * sigproc.h: Remove waitq_storage declaration. * syscalls.cc (_read): Use per_thread class to manipulate per-thread information. * wait.cc (wait4): Ditto. Wed Sep 16 12:58:49 1998 Christopher Faylor * syscalls.c (_read): Lower timeout for signal detection after EOF on device. Should fix recent configure performance problems. * Makefile.in: Extend clean target into regexp directory. Wed Sep 16 11:44:14 1998 Christopher Faylor * fhandler.cc (fhandler_base::set_name): Honor no_free_names(). (fhandler_base::linearize): Remove unneeded check for NULL get_win32_name(). (fhandler_disk_file::fhandler_disk_file): Set path names to a standard constant. They should eventually be filled out by fhandler_disk_file::open. (fhandler_disk_file::open): Detect if win32_path_name_ is a dummy path. Fill it out from real_path, if so. * hinfo.cc (hinfo::init_std_file_from_handle): Improve debugging statement. (hinfo::linearize_fd_array): Remove unneeded check for NULL get*_name (). * path.cc (path_conv::path_conv): Correct problem with symlinks found at places like E:\. Wed Sep 16 02:25:33 1998 Geoffrey Noer patch from sos@prospect.com.ru (Sergey Okhapkin): * fhandler.cc (fhandler_disk_file::open): fix typo. Tue Sep 15 23:52:44 1998 Christopher Faylor * winsup.h: Remove side effects from SLASH_P. Tue Sep 15 18:36:08 1998 Ben Elliston * sysdef/kernel32.def: Add definition for the Win32 API function `TryEnterCriticalSection'. Tue Sep 15 12:26:48 1998 Christopher Faylor * Makefile.in: Remove extra slash in INCLUDES. * hinfo.cc (hinfo::dup2): Always clear close-on-exec flag for duplicated handle (problem and fix determined by Sergey Okhapkin, sos@prospect.com.ru). * fhandler.cc (fhandler_base::set_name): Avoid use of empty path names. (fhandler_base::raw_read): Show error code on failure. (fhandler_base::linearize): Avoid copying NULL names. (fhandler_base::open): Use NULL detection in small_printf. (fhandler_base::dup): Move set_close_on_exec_flag to dup2 so it is caught in all cases. (fhandler_disk_file::fhandler_disk_file): Set "no free names" flag. (fhandler_disk_file::open): Clear "no free names" flag since names have been allocated to the fhandler structure at this point. * fhandler.h (set_no_free_names): Newconditional "no free names" function. * hinfo.cc (hinfo::dup2): Clear close on exec here. (hinfo::linearize_fd_array): Avoid copying NULL names. * path.cc (normalize_posix_path): Avoid copying trailing slash if root. (nofinalslash): Rename variable. * path.h: Add flag for future use. * regexp/regerror.c: Avoid including RCS strings in product. * regexp/regsub.c: Ditto. patch from sos@prospect.com.ru (Sergey Okhapkin): * select.cc (thread_pipe): Sleep for 10ms on every iteration. (start_thread_pipe): Set the handle in the select structure so that it will be properly identified in select_stuff::wait. Tue Sep 15 12:28:30 1998 DJ Delorie * added documentation and doctool.c Tue Sep 15 08:37:26 1998 Christopher Faylor * Makefile.in: Fix LIBGCC definition for native builds. Remove CFCOMMON in favor of configure solution. * configure.in: Default CXXFLAGS to be == CFLAGS. * configure: regenerate. Sun Sep 13 19:52:04 1998 Geoffrey Noer * Makefile.in: include ../libio when building Sun Sep 13 19:30:58 1998 Geoffrey Noer * include/cygwin32/version.h: bump version minor now that we've merged in all that new code... Sun Sep 13 21:34:33 1998 Christopher Faylor * dcrt0.cc (do_global_ctors): Reverse call order of constructors thanks to insight from Mumit Khan (hkan@xraylith.wisc.edu). (do_global_dtors): Reflect above change: invoke destructors in the proper order. * smallprint.c (__small_vsprintf): Gracefully detect a null pointer for '%s' format. * syscalls.cc (_read): Set correct flags to retrieve stack information or suffer sporadic failures due to uninitialized flag. * regexp/regexp.c: Comment out RCS string. This provides no useful information in the .dll. Thu Sep 10 21:09:51 1998 Christopher Faylor Merge in experimental-980602 branch changes. Thu Sep 10 21:09:51 1998 Christopher Faylor * path.cc (symlink_check_one): known_suffix needs to be determined here in some cases, so deal with it here. (path_conv::path_conv): More effort needed to propagate the known_suffix back to caller in every case. (has_suffix): Return suffix found. (readlink): Avoid two passes through symlink_check_one. * spawn.cc (find_exec): Propagate known_suffix from perhaps_suffix back to caller, if appropriate. (spawn_guts): Use suffix returned from find_exec to determine if file should be scanned as a script when a #! file is found. Avoids a duplicate call to perhaps_suffix. Thu Sep 10 21:09:51 1998 Christopher Faylor * path.h (suffix_info): New struct for dealing with standard suffix (.exe, .bat, etc.) information. (path_conv): Constructor now takes a suffix_info argument. (std_suffixes) Standard array of suffixes to consider "special". * path.cc (path_conv): Constructor now takes a suffix_info argument. Record any known suffix in path_conv known_suffix field. (has_suffix): New function for determining if a path already has a known suffix. (next_suffix): New function for returning the next suffix from a list of suffixes. (symlink_check_one): Take an optional suffix_info argument for suffixes to consider or tack on. * spawn.cc (std_suffixes): Standard list of executable suffixes. (perhaps_suffix): Pass std_suffixes to path_conv. Use new known_suffix field in path_conv to determine if a suffix has been detected. Thu Sep 10 21:09:51 1998 Christopher Faylor Substitute new str{,n}casematch for strcasecmp throughout. This implementation is faster since it only tests equality. Change fhandler*::open throughout to return true/false since the pointer returned was never used for anything. * Use strcasestr throughout for case insensitive matches for filenames. * Makefile.in: Use GNU make construct for determining gcc lib. * dcrt0.cc (check_sanity_and_sync): Make error message more explicit. * debug.h: Better defines for dummy functions when !DEBUGGING. * fhandler.cc (fhandler_base::fstat): Don't bother zeroing buf here since it is always done in the caller. (fhandler_base::~fhandler_base): Recognize cases where *_path_name_ should not be freed. (fhandler_disk_file::open): Split into two functions. First function performs a path_conv and does testing on same. This calls new fhandler_disk_file::open with path_conv data. New function is called by stat_worker to avoid extra path tests and mallocs. Also, fix long standing off-by-one typo looking for #! magic. Also, reapply test for != WinNT when checking files for magic. Otherwise there is a tremendous slowdown in file opening, especially for stat(). * fhandler.h: Add support for setting/detecting when *_path_name should not be freed. Add new fhandler_disk_file::open declaration. * hinfo.cc (digits): Remove obsolete function. (hinfo::build_fhandler): Add default name for FH_DISK. * path.cc (path_prefix_p_): Don't check beyond len1 for leading slash. Responsible for reported performance problems? (path_conv::path_conv): Ensure that fileattr is filled out correctly in all cases. Return immediately when a file is detected in !follow_mode. (nofinalslash): Simplify. (strncasematch): New function similar to strncasecmp except that it only checks for =/!= and benchmarks faster than same. (strcasematch): Ditto, re. strcasecmp. (strcasestr): New function which does a case-insensitive strstr. Needed for filename matching. * smallprint.c (__small_vsprintf): Fix off-by-one in %.ns processing. * spawn.cc (exe_exts): Make global for eventual use by other modules. * syscalls.cc (_fstat): Zero buf prior to use. (stat_worker): Rename from _stat_worker. Reorganize to minimize mallocs and path name conversions. Should now perform only one path conversion and 0 malloc/frees. * winsup.h: Declare new functions. Thu Sep 10 21:09:51 1998 Christopher Faylor Clean up error messages throughout using new strace_printf options. * smallprint.c (__small_vsprintf): Add %E option for printing error code. Understand %.n syntax. * strace.cc (strace_vsprintf): Common routine for formatting strace output. Default to always ending with \n unless string ends with \b. (strace_write): Common routine for writing to strace output. (strace_printf): Use above two routines. (system_printf): Ditto. * path.cc (path_conv): Scan path to be converted from right to left for efficiency. Implement extension searching which is passed from spawn to symlink_check_one to minimize overhead. (symlink_check_one): Check extensions for existence for use with spawn. (readlink): Accommodate changes to symlink_check_one. * spawn.cc (perhaps_suffix): Use new extension checking capabilities of path_conv. (find_exec_1): Delete. (find_exec): Generalize to allow searching on any PATH like environment variable. * dllfcn.cc (check_path_access): Use find_exec to find a path. This also ensures that paths are in Windows format which was not the case before. * environ.cc (conv_envvars): Add LD_LIBRARY_PATH. * fork.cc (fork): Clean up dll loading slightly. * Makefile.in: Turn on compiler warnings. * winsup.h (save_errno): New class for saving errno from being clobbered. * include/sys/strace.h: Make system_printf a macro similar to strace_printf_wrapper. Thu Sep 10 21:09:51 1998 Christopher Faylor * sigproc.cc (sig_send): Attempt to work around Windows strangeness when thread interrupted while waiting for completion event. Thu Sep 10 21:09:51 1998 Christopher Faylor * dcrt0.cc: Remove debugging function DELETEME (). * fhandler.cc (fhandler_base::fstat): Respond to compiler warning. * signal.cc (sleep): Reset signal_arrived event before using it or we could wake up immediately. (usleep): Ditto. (pause): Ditto. * spawn.cc (spawn_guts): Ditto. Respond to compiler warning. * sigproc.cc (sig_send): More debugging info. (sig_dispatch_mutex): Only ping wait_sig when needed. Thu Sep 10 21:09:51 1998 Christopher Faylor * select.cc (socket_cleanup): Close thread handle or suffer handle leak. Thu Sep 10 21:09:51 1998 Christopher Faylor * select.cc (verify_true): New function. (fhandler_socket::select_*): Use verify_true for verification function to avoid multiple calls to socket select. Thu Sep 10 21:09:51 1998 Christopher Faylor * select.cc (select_stuff::wait): Scan entire list of fds when WFMO wakes up. (set_bits): Add some strace debugging output. (thread_socket): Ditto. (verify_ok): Return result of set_bits rather than always 1. (start_thread_socket): Set the handle in the select structure so that it will be properly identified in select_stuff::wait. (fhandler_windows::select_read): Verification routine should be `poll_windows'. Thu Sep 10 21:09:51 1998 Christopher Faylor * sigproc.cc: Change some sigproc_printfs to only occur when #ifdef DEBUGGING. * spawn.cc (perhaps_suffix): Search for (PROG is the pathname to the executable file) PROG.exe, PROG.com, PROG.bat, PROG.cmd, and PROG and return extension found or NULL if no matching file. (spawn_guts): If the file name of the executable ends in either .exe, .com, .bat, or .cmd we assume that it is not a script file and therefore do not open the file to determine if it is. Fix "wait_failed" error when exec() called and non-cygwin parent. Thu Sep 10 21:09:51 1998 Christopher Faylor * dir.cc (rmdir): Set correct errno when non-empty directory and Windows9x. * pipe.cc (pipe): Use binary mode by default for pipes. * syscalls.cc (_read): Wait for terminated thread to exit before clearing its stack memory. Thu Sep 10 21:09:51 1998 Christopher Faylor * hinfo.cc (hinfo::fixup_after_fork): Start initial fd search to zero forked processes so that a close(0)/dup(fd) will work. Thu Sep 10 21:09:51 1998 Christopher Faylor * fhandler_windows::set_close_on_exec: Deal with possible NULL handle. (fhandler_windows::fixup_after_fork): Ditto. * select.cc (select_stuff:wait): Handle return from MsgWaitForMultipleObjects correctly for windows case. * sigproc.cc (sig_send): Reset completion event for main thread. * syscalls.cc (_read): Better handling of stack free condition. Thu Sep 10 21:09:51 1998 Christopher Faylor * exceptions.cc (call_handler): Exit earlier if just running in an exec'ed stub since the stub may own the sig_dispatch mutex, but we still want to exit. * select.cc (select_stuff::wait): Fix check for window activity from MsgWaitForMultipleObjects. Handle infinite wait correctly. (poll_windows): Add debugging output. * spawn.cc (spawn_guts): Protect against signals interrupting at an inopportune moment. Thu Sep 10 21:09:51 1998 Christopher Faylor * select.cc (select_stuff:test_and_set): Take appropriate action when a select record uses a window_handle. (fhandler_windows::select_read): Set handle and windows_handle appropriately. (fhandler_windows::select_write): Ditto. (fhandler_windows::select_except): Ditto. Thu Sep 10 21:09:51 1998 Christopher Faylor * select.cc (cygwin32_select): Need to reset signal_arrived before testing it or suffer loop. Thu Sep 10 21:09:51 1998 Christopher Faylor * fork.cc (resume_child): Give up on SuspendThread synchronization and use subproc_ready/forker_finished events. (sync_with_parent): Ditto. * sigproc.cc (wait_sig): Make sigcomplete_main manual reset to allow handling of nested interrupts. (wait_sig): Fix stupid typo on exit that would cause a loop to run for a long time. Are exits faster now? Thu Sep 10 21:09:51 1998 Christopher Faylor * exceptions.cc (unlock_cs): Leave decision to release sig_dispatch_mutex to the caller. (set_process_mask): Call release_sig_dispatch_mutex explicitly if needed. (handle_sigsuspend): unlock_cs no longer takes an argument. (call_handler): Try to acquire the strace mutex prior to suspending the main thread to ensure that the mutex is always released. (sig_handle): Call release_sig_dispatch_mutex explicitly. * fhandler_console.cc (fhandler_console::write): Protect against signals while writing. * signal.cc (signal): Protect against signal dispatch. (sigaction): Ditto. * sigproc.cc (sig_dispatch_pending): Return status no longer needed. (sig_send): Assume pending_signals if sending signal to self. (allow_sig_dispatch): Accept synchronize argument to control whether to wait for wait_sig to do its thing. (release_sig_dispatch_mutex): Just awaken wait_sig loop and wait for acknowledgement if waitfor is TRUE. (wait_sig): Don't ever zero pending_signals to avoid a possible race. Set pending_signals for blocked signals, too. * sigproc.h: Add __SIGFLUSH signal. (class sig_protect): Allow destructor to wait for signal dispatch, or not given constructor argument. * strace.cc (get_strace_mutex): Renamed from waitfor_strace_mutex. (release_strace_mutex): External function for use by call_handler. This replaces raw calls to ReleaseMutex throughout. * syscalls.cc (_read): Use sig_protect to protect against signals. Other cosmetic cleanups. (_close): Protect function with sig_protect. * termios.cc (tcsetattr): Protect function with sig_protect. Thu Sep 10 21:09:51 1998 DJ Delorie * syscalls.cc (_read): typo in matching printf format to args. * fhandler.cc (write): Switch to the Microsoft/DJGPP way of writing out text files: pass \r but prepend \r to \n. (read): Don't collapse multiple \r's. * delqueue.cc: rewritten for speed. Don't check *every* entry in the list if we know the list is empty, plus check for duplicates. * delqueue.h: ditto. * path.cc (path_conv): If a path component is missing, short- circuit the symlink check. Thu Sep 10 21:09:51 1998 Christopher Faylor * fhandler.h: Reorder fhandler status field so that device is in lower bits. This allows gcc to optimize access to the device. * hinfo.cc: Inline not_open(). * winsup.h: Inline hinfo::not_open(). Make hinfo::[] operator a simple array reference. * strace.cc: Change strace() to a macro. * include/sys/strace.h: Ditto. * syscalls.cc (read_handler): New function. Called directly from _read for "non-slow" devices or via read_handler for slow devices. (_read): Use read_handler for reading. (read_helper): Ditto. Thu Sep 10 21:09:51 1998 Christopher Faylor * dcrt0.cc (do_exit): Don't ignore signals if reparenting. Besides being a race, this screws up the process which is actually executing. * fork.cc (fork): Don't create a new process group when forking or subprocesses won't respond to CTRL-C. * syscalls.cc (_read): Ensure correct setting of EINTR errno. Thu Sep 10 21:09:51 1998 Christopher Faylor * fork.cc (sync_with_child): Consider it a success if the child has set the subproc_ready signal regardless of whether it has exited or not. * init.cc (dll_entry): Set read_helper_thread_info stuff to 0 on dll initialization. Windows 95 seems to keep garbage here, despite documentation to the contrary. * syscalls.cc (_read): Report on errors to create read_helper events. Thu Sep 10 21:09:51 1998 Christopher Faylor * dcrt0.cc (compute_argc): Limit debug_printf string argument size or suffer a buffer overrun. (do_exit): Add debugging statement. * exceptions.cc (call_handler): Remove extraneous sigproc_printf. Consolidate signal_arrived event with sig_was_dispatched. (events_terminate): Consolidate signal_arrived event with sig_was_dispatched. * fhandler.h: Rename a field to something more mnemonic. * fhandler_tty.cc: Throughout: Only set up fhandler_tty_master when actually using ttys. Change tty_master `f' field to `console'. * tty.cc: Ditto. * fork.cc (sync_with_child): Add more information to "child died" error. * hinfo.cc (hinfo::build_fhandler): Call tty master constructor when appropriate. * select.cc (select_stuff::wait): Consolidate signal_arrived event with sig_was_dispatched. * sigproc.h: Ditto. * syscalls.cc (_read): Ditto. * winsup.h: Ditto. * sigproc.cc: Ditto, throughout. (block_sig_dispatch): Don't reset signal_arrived. Causes races. * spawn.cc (spawn_guts): Limit debug_printf string argument size or suffer a buffer overrun. * include/sys/strace.h: Implement strace_minimal for very minimal output which, hopefully, will not affect the behavior of traced programs as much. Thu Sep 10 21:09:51 1998 Geoffrey Noer * Makefile.in: build libwinspool.a with the dll name winspool.drv Thu Sep 10 21:09:51 1998 Christopher Faylor * dcrt0.cc (build_argv): Remove verbose debug_printf. (dll_crt0_1): Use shared data handle passed in from parent process when appropriate. Remove extraneous debug_printf. * environ.cc (getwinenv): New function. Returns (possibly cached) native version of an environment variable. (win_env::add_cache): Add cached version of posix and win env variables to local table. (posify): Modify for use with native caching. (setenv): Convert special environment variables to native here, when they are set. (struct parse_thing): Simplify struct. (struct parse_things): Extend table to accommodate "envcache" setting. (parse_options): Add "envcache" option to control whether special environment variables are cached. Simplify handling of remembered parameters. (winenv): Modify for use with getwinenv. * exceptions.cc (unlock_cs): release_sig_dispatch takes an argument now. (set_process_mask): unlock_cs now wakens wait_sig when appropriate. (handle_sigsuspend): Reorganize to take advantage of new behavior of release_sig_dispatch_mutex and hopefully avoid a race. (handle_sig): Avoid waking wait_sig if we couldn't get the dispatch mutex. * exec.cc (strccpy): Change to modify second argument to point to position where "parse" stopped so that it doesn't have to be recalculated by the caller. (sexecvpe): Use find_exec () to find program to run. If you've got a function for this, you might as well use it. * fhandler_tty.cc (fhandler_pty_master::process_input_to_slave): Report on signal being sent in termios_printf. Use kill_pgrp interface. * fork.cc (fork_copy): Just copy everything at once rather than in individual pieces. (fork): Potentially move up sbrk() when DEBUGGING so that parent and child heaps are in sync. Pass cygwin_shared_h to child. * path.cc (path_conv::path_conv): Make sure that a file is not a symlink when returning immediately. * sigproc.cc (sig_dispatch_pending): Return TRUE if signals were pending. (sigproc_init): Move sig_was_dispatched initialization here so that it will always be available to other functions which rely on it. Otherwise these functions would have to wait for wait_sig to complete its initialization. (sig_send): Rework SIGSUSPEND handling. (release_sig_dispatch_mutex): Wait for signal to be dispatched after releasing mutex if argument is TRUE. (wait_sig): Remove sig_was_dispatched initialization from here. * sigproc.h: release_sig_dispatch takes an argument. * spawn.cc (perhaps_suffix): Take an optional argument indicating whether the path has already been converted to win32. (find_exec_1): Use getwinenv to get windows version of PATH. Use windows version of individual directories to avoid posix lookups. (spawn_guts): Call strace_dump here to cause strace output to be slightly more synced when using strace caching. (spawnvpe): Use find_exec () to find program to run. If you've got a function for this, you might as well use it. * syscalls.cc (_read): Only block signals for "slow" devices. * winsup.h: Changes needed for previous checkin and getwinenv. Thu Sep 10 21:09:51 1998 DJ Delorie * path.cc (path_conv): bug fix when path ends in slash Thu Sep 10 21:09:51 1998 Christopher Faylor * fhandler.cc (fhandler_base::set_name): Use fhandler method for determining native name. Avoid path_conv when possible. (fhandler_disk_file::get_native): New function, returns windows name of disk file. * fhandler.h: Add get_native() method to fhandler_* classes. * fhandler_serial.cc (fhandler_serial::get_native): Return windows name of serial port. * fhandler_tty.cc (fhandler_tty_master::init): Use consistent name for tty master. * fork.cc (fork_copy): Experimental change to avoid loop. * grp.cc (add_grp_line): Use realloc to extend group buffer. * hinfo.cc (hinfo::release): fd object should be deleted, not freed or suffer a memory leak. (init_std_file_from_handle): Reset first_fd_for_open to signal that std* locations have been opened. Avoids use of these locations prior to full dtable setup. * passwd.cc (add_pwd_line): Use realloc to extend passwd buffer. * path.cc (path_conv::path_conv): Avoid checking for symlinks on network shares. Check for existence of file prior to taking it apart for symlink checking (this needs more work). (windows_device_names): Make global. (get_device_number): Detect tty master. * sigproc.cc (wait_sig): Maintain a flag which indicates when signals are queued due to the wait_sig's inability to get a sig_dispatch mutex. (sig_dispatch_pending): Don't wake up the wait_sig thread if unless there are signals queued (see above) or force argument. (allow_sig_dispatch): Only wait for signal dispatch if something is queued. * sigproc.h: allow_sig_dispatch takes a (defaulted) argument now. * syscalls.cc (_open): Use default hinfo::find_unused_handle call. * net.cc: Ditto, throughout. * pipe.cc: Ditto. Thu Sep 10 21:09:51 1998 Christopher Faylor * dcrt0.cc (do_exit): Ignore user initiated signals here. * fhandler.cc (fhandler_disk_file::open): Detect error condition on fhandler_base::open. * fhandler_console.cc (undo_input): Respond to compiler warnings. * grp.cc (getgrgid): Ditto. * times.cc (_tzname): Ditto. * fhandler_tty.cc (fhandler_Tty_slave::open): Cosmetic changes. * fork.cc: Clean up debugging output. * pinfo.cc (pinfo_init): Set pgid and sid to different values initially. Let user program set sid appropriately if it is to be the owner of a tty. * sigproc.cc (allow_sig_dispatch): Try harder to detect when we should wait for a signal dispatch. * strace.cc (strace_open): Revert to previous mutex behavior. * include/sys/strace.h: Ditto. * syscalls.cc (_open): Detect error from fhandler open. Thu Sep 10 21:09:51 1998 Christopher Faylor Global changes: Store win32 name in fhandler structure to avoid multiple translations. Support close_on_exec at the Win32 level for all but sockets. Respond to gcc warnings. Use single fstat() call for devices. *::set_close_on_exec modified. * dir.cc (opendir): Use win32 name in stat to speed things up a little. * debug.cc: New file. Provides routines for extra debugging when -DDEBUGGING is specified. * debug.h: New file. Definitions for debug.cc. * exceptions.cc (signals_init): Break out signal initialization from exceptions. (dump_status): Add thread name to stack dump output. (handle_exceptions): Renamed. (set_process_mask): Don't ever mask non-maskable signals. (ctrl_c_handler): Preliminary change to allow propagation of cygwin signals back to gdb. (sig_handle): Call do_exit directly from signal thread rather than attempting to redirect the main thread. * fhandler.cc (set_name): Store win32 name in fhandler structure. (*::open) name field is extraneous now. Use get_win32_name () to retrieve stored win32 name. (fhandler_base::fstat): Default to performing fstat on a device. (fhandler_disk_file::fstat): Renamed from fhandler_base::fstat. Operate only on disk files. (fhandler_base::set_close_on_exec_flag): New function sets flag without touching the handle. (fhandler_base::~fhandler_base): Free unix/win32 path names. (fhandler_disk_file::close): Only call delqueue.process_queue from this function since disk files are the only things that can be unlinked, currently. (fhandler_dev_null::open): Delete. (set_inheritence): New function. Set handle inheritence. (fhandler_*::fork_fixup): New functions. Inherit fhandler data after a fork. fhandler.h: *::set_output_handle - new method. Setup methods for use by select(). fork.cc (fork): Call fixup_after_fork in child to inherit handles marked as non-inheritable on CreateProcess. hinfo.cc (hinfo::build_fhandler): Use new function to detect devices. (dup_for_exec): Delete obsolete function. (hinfo::dup2): Remove extraneous tests. (hinfo::select_*): Interfaces into select(). (hinfo::release): Free fd in dtable. (hinfo::fixup_after_fork): New function. Inherit close-on-exec handles from parent after fork. path.cc (mount_info::posix_path_p): Make inline. (path_conv::path_conv): Short circuit when path resolves to a device. (digits): Move here from hinfo.cc. (windows_device_names): Win32 names for Cygwin devices. (get_device_number): New function. Return devie number given device name. (win32_device_name): New function. Decode a windows device name and an optional "unit". (mount_info::conv_to_win32_path): Short circuit when path resolves to a device. * path.h: add device and unit fields to path_conv class. * select.cc: Rewrite for more structure, more OO. * sigproc.cc: (get_sig_dispatch_mutex): New function. (release_sig_dispatch_mutex): New function. * sigproc.h: sig_protect class. Automatic protection from signals when used. * syscalls.cc (stat_dev): New function. (stat_worker): Short-circuit when a cygwin device is detected. * utils/ps.cc: Don't lock_pinfo when -f. Compress format to fit more on a line. Thu Sep 10 21:09:51 1998 Christopher Faylor * dcrt0.cc (dll_crt0_1): Register name for main thread. * exceptions.cc (dump_status): Add thread name to diagnostic output. (__cygwin32_exception_handler): Rename to handle_exceptions. Avoid creating a .core file. * exec.cc (sexecve): Reflect spawn_guts argument change. * fhandler_tty.cc (fhandler_tty_master::init): Use makethread to create a new thread. * select.cc: Create pipe/socket threads each time select is called. Use thread termination as indication of fd readiness. * sigproc.cc (sigproc_init): Use makethread to create a new thread. (wait_sig): Simplify default signal call slightly. * spawn.cc (spawn_guts): Accept child pinfo pointer rather than pid. Reorganize so that common initialization is handled once. * strace.cc: Set strace_mutex to NULL initially to catch CreateMutex errors. * window.cc (gethwnd): Use makethread to create a new thread. Thu Sep 10 21:09:51 1998 Christopher Faylor * Makefile.in: Add debug.o target. * cygwin.din: Separate pipe from _pipe. * dcrt0.cc (alloc_stack): New, more precise method for allocating stack space after a fork. (dll_crt0_1): Use new child_proc_info class to retrieve information from possible parent process. Remove #ifdef erroneously checked in. Remove extraneous syscall_printf. * exceptions.cc (signals_init): New function. * fhandler.cc (fhandler_make_pipe): Move to pipe.cc. * fhandler.h (fhandler_base): New = operator preserves unix_path_name_. * fhandler_tty.cc: Strip some tty functions from here into tty.cc. * fork.cc: Remove obsolete ifdefs. Reorganize, streamline with new fork. * hinfo.cc: Speed up build_fhandler. * libccrt0.cc: Remove obsolete ifdefs. * pinfo.cc (pinfo_init): Simplified by new fork/spawn info passing method. * pipe.cc (make_pipe): Moved from fhandler.cc. Handles MS-style _pipe. (pipe): Use new arguments to make_pipe. (_pipe): New MS-compatible function. * shared.cc: cygwin_shared_h make global so that it can be inherited via new fork/spawn info passing method. (open_shared_file_map): Detect if shared info is already set up from fork/spawn. * sigproc.cc (sigproc_init): Initialize signals with signals_init here. Use new fork/spawn info passing method. * spawn.cc (spawn_guts): Pass information in a structure to spawned process. Identify structure type with a "magic number". * strace.cc (strace_printf): Only print program full path spec once to save space and clutter. Preserve any windows error. * syscalls.cc (_open): Detect and avoid error return from build_fhandler. * tty.cc: Accept some non-fhandler functions formerly found in fhandler_tty.cc * winsup.h (pinfo): Remove some fields obsoleted by new fork/spawn info passing method. (child_info*): New classes for passing information to forked/spawned process. Thu Sep 10 21:09:51 1998 Christopher Faylor * Makefile.in: Add debug.o target. * console.cc (fhandler_console::char_command): Fix failed merge. * dcrt0.cc (alloc_stack): New, more precise method for allocating stack space after a fork. (dll_crt0_1): Use new child_proc_info class to retrieve information from possible parent process. Remove #ifdef erroneously checked in. Remove extraneous syscall_printf. Thu Sep 10 21:09:51 1998 Christopher Faylor Global changes: Replace pinfo hmap entry with "dtable" reference. Replace cygwin_shared .t field with '.tty' and allow indexing via tty into this array. Make fhandler_ constructors set the size of the structure into any created class. Change fhandler settings into a bit mask. Use methods to access. Record device type in fhandler class. Remove old linearize/de_linearize code in favor of newer method uses more bullet-proof method for determing device type of inherited files. Protect various important handles from closing when operating under -DDEBUGGING. * dcrt0.cc (do_global_ctors): Renamed, made static and reused for calling from dll_crt0_1 to initialize cygwin.dll constructors. (do_global_dtors): Renamed. (dll_crt0_1): mark noreturn. Use new do_global_ctors function. Call debug_init to initialize features turned on by -DDEBUGGING. Call dtable_init to initialize dtable, hinfo_init to initialize standard fds. (dll_crt0): Mark noreturn. Move constructor calls to dll_crt0_1. (__main): Use new do_global_ctors (). Remove OLDWAY and _PPC_ conditionals. * environ.cc (environ_init): Use appropriate strace printf. * exceptions.cc (set_process_mask): Don't ever mask out unmaskable signals. * init.cc (dll_entry): Initialize storage for read_helper. * pinfo.cc (init_from_exec): Delete obsolete function. * sigproc.cc (sig_send): Implement myself_nowait to allow sending a signal to myself without waiting for synchronization. (wait_sig): Change method for determining whether signal should be examined slightly. * strace.cc (strace_printf): Add ability to report on thread from which message originated. (threadname): New function * syscalls.cc (read_helper): New function. Invoked in separate thread from _read. (_read): Use a separate thread for reads that can be interrupted with a TerminateThread(). Allows EINTR. (setdtablesize): Use new method for extending the size. Callable from anywhere. (getdtablesize): Use new method for getting the current dtable size. * tty.cc: Remove use count in favor of a method which checks tty availability via an event. Some code cleanup. (tty::inuse): New function for determining if a tty is in use by any process. (tty_list::terminate): Use new method for determining if a tty is in use. Should avoid hangs waiting for non-existent processes to free up a tty. (tty::common_init): Common initialization for tty/pty master. (fhandler_tty_master::init): New function. (do_output): Use new method for determining if a tty is in use. (fhandler_pty_master::open): Use comon initialization code. (fhandler_pty_master::ptsname): static buffer is ok now. * tty.h: Reflect inuse changes and tty.cc cleanup. * winsup.h: Include debug.h for use when -DDEBUGGING. Remove stuff previously here which was conditionally compiled with -DDEBUGGING. (hinfo_vec): Rename to hinfo. Maintain argv style list of pointers to open fds. Add methods to deal with above changes. (pinfo): Removals due to above changes. (shared_info): Rename t to tty. Add common defines to extern "C" section. Wed Sep 9 22:24:50 1998 Christopher Faylor * path.cc (path_prefix_p_): Rewrite to avoid false match against root when remote path or \\x style disk device. * include/sys/strace.h: Implement new macro for use by malloc_printf which does not default to "on" if STRACE=1. This avoids massive strace logs. Tue Sep 8 11:31:42 1998 Christopher Faylor * dcrt0.cc (dll_crt0_1): Remove ill-advised ifdef NEEDOEM. Thu Sep 3 17:54:18 1998 Christopher Faylor * Makefile.in: Speed up dll links. * path.cc (chdir): Fix previous change. Mon Aug 31 12:23:33 1998 Christopher Faylor * path.cc (chdir): Protect free from potential signal race. Fri Aug 28 15:59:27 1998 Geoffrey Noer * dlfcn.h: delete, move it * include/dlfcn.h: here Thu Aug 27 14:20:38 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * path.cc (path_conv::path_conv): remove trailing backslash from full win32 name, otherwise the last component of the path isn't checked for symlink. Wed Aug 26 14:15:22 1998 Christopher Faylor * fhandler.h (fhandler_base): Make set_name() public and implement clear_name() to accommodate dup2. * hinfo.cc (dup2): Previous change exposed problem with dup2. Same unix_path_name_ ptr was being used in two separate fds. Fix this. Wed Aug 26 12:10:27 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * malloc.cc: Use malloc_printf throughout. * path.cc (getcwd_inner): Allocate buffer with realloc to avoid a memory leak. * syscalls.cc (_close): delete unix_path_name_ explicitly since destructor is never called. * include/sys/strace.h: Add strace_malloc stuff. Mon Aug 24 15:45:59 1998 Geoffrey Noer * include/sys/ioctl.h: variable names in protos should start with two leading underscores. * include/sys/mman.h: ditto. * include/sys/mount.h: ditto. * include/sys/resource.h: ditto. * include/sys/smallprint.h: ditto. * include/sys/socket.h: ditto. * include/sys/strace.h: ditto. * include/sys/vfs.h: ditto. * include/sys/wait.h: ditto. * include/mntent.h: ditto. Tue Aug 18 17:00:20 1998 Geoffrey Noer patch from Trevor Yann (TYann@vet.com.au): * uname.cc (uname): report processor type for win98 Tue Aug 18 16:09:13 1998 Christopher Faylor * fork.cc (cygwin_fork_helper1): Start initial fd search to zero forked processes so that a close(0)/dup(fd) will work. Mon Aug 17 16:58:09 1998 Christopher Faylor * winsup.h (hinfo): Remember initial fd to start searching for new fds. This avoid assigning std/in/out/err to files opened early in initialization. (hinfo_vec::find_unused_handle): New default way to search for a new handle. Avoids using std/in/out/err until the proper time in the initialization. * fhandler.cc (fhandler_make_pipe): Use default method for finding unused handle. * net.cc: Ditto throughout. * pipe.cc (dup): Ditto. * syscalls.cc (_open): Ditto. * hinfo.cc (hinfo_vec::init_std_file): Set initial fd for open search to include std/in/out/err. patch from sos@prospect.com.ru (Sergey Okhapkin): * spawn.cc (perhaps_suffix): Use translated win32 path when determining if a .exe extension should be added or suffer adding a .exe extension twice. Mon Aug 10 15:08:49 1998 Geoffrey Noer * include/cygwin32/version.h: up minor version number Mon Aug 10 07:04:13 1998 DJ Delorie * delqueue.cc: rewritten for speed. Don't check *every* entry in the list if we know the list is empty, plus check for duplicates. * delqueue.h: ditto. Sat Aug 8 14:03:52 1998 Eric Bachalo * spawn.cc (perhaps_suffix): If report_failure_p is non-zero this function will search for (PROG is the pathname to the executable file) PROG.exe, PROG, PROG.com, PROG.bat, and PROG.cmd and return either the full path name if found or NULL if not. (spawn_guts): If the file name of the executable end in either .exe, .com, .bat, or .cmd we assume that it is not a script file and therefore do not open the file to determine if it is. Thu Aug 6 22:25:38 1998 Christopher Faylor * path.cc (path_conv): If a path component is missing, short- circuit the symlink check. Bug fix for case where path ends in a slash. (path_conv::path_conv): Make sure that a file is not a symlink when returning immediately. Avoid checking for symlinks on network shares. Check for existence of file prior to taking it apart for symlink checking (this needs more work). Sun Aug 2 19:17:59 1998 Christopher Faylor * select.cc (cleanup_pipe_thread): Cleanup thread handle or suffer handle leak. (cleanup_socket_thread): Ditto. * sigproc.cc (proc_subproc): Make wait thread manual reset to solve problem with nested waits not waiting correctly. * fhandler_tty (fhandler_tty_slave::open): Don't create the output mutex, just open it. If it can't be opened, its an error. Wed Jul 29 12:08:19 1998 Eric Bachalo * include/Windows32/Defines.h: Added Virtual-Key Code defines for the Win95 keys - VK_LWIN, VK_RWIN, and VK_APPS. Tue Jul 21 14:47:59 1998 DJ Delorie * path.cc (path_prefix_p): optimize calls by comparing first characters inline. (path_conv): optimize by not checking both foo and foo/ for symbolic links. Tue Jul 21 14:39:03 1998 Christopher Faylor * pinfo.cc (pinfo_init): Set myself->sid to 1 so that a program started up outside of cygwin will not trump other opens of ttys. Fixes problem with pgid change below. Tue Jul 21 12:59:21 1998 Christopher Faylor * path.cc (chdir): Force chdir to disk device to go to the root directory. Tue Jul 21 09:32:23 1998 Christopher Faylor * pinfo.cc (pinfo_init): 0 is a very bad value for a default pgid. Fri Jul 16 15:09:50 1998 Stan Cox * (gcrt0.c, gmon.c, profil.c, mcount.c, gmon.h, profil.h, config/i386/profile.h): New files for gprof cygwin support. Some code contributed by Tim Newsham for Secure Networks, Inc. * Makefile.in (LIBGMON_A, GMON_START, GMON_OFILES): New for gprof. Mon Jul 13 19:29:00 1998 Eric Bachalo * dcrt0.cc (insert_files): Now both -@file and @file work as command line file insertion options. * fhandler_serial.cc (fhandler_serial::open): Enabled RTS Control Line by default to make full handshaking cables work for the D10V board. (CDB.fRtsControl) (fhandler_serial::tcsetattr): same as above Wed Jul 8 15:53:35 1998 Christopher Faylor * dcrt0.cc (dll_crt0_1): Avoid redundant strace_printf. Wed Jul 8 15:05:10 1998 DJ Delorie * fhandler.cc (fhandler_base::lseek): Note lseek so that next write() can check for the Win95 "gap" bug. (fhandler_base::write): If Win95 and lseek past eof followed by write, use WriteFile to force the "gap" to be filled with zeros rather than left to the "undefined" data Win32 specifies. (fhandler_base::fhandler_base): initialize check_win95_lseek_bug_. * fhandler.h (class fhandler_base): Add check_win95_lseek_bug_ for bug: when seek past EOF and write, win95 fills with random data (security hole). Thu Jul 2 10:45:15 1998 Christopher Faylor * environ.cc (winenv): Be more paranoid when restoring special win32 environment variables beginning with '='. Thu Jul 2 09:19:32 1998 Christopher Faylor * environ.cc: Previous change was not rigorous enough. Track environment variables to convert in a structure which records the correct function for converting the environment variable from/to POSIX format. (isspecial): New function. (parse_options): Use template to initialize parse array. (posify): Use new conversion function. (winenv): Ditto. Also restore special win32 environment variables beginning with '='. * path.cc (conv_path_list): Source argument should be const. (win32_to_posix_path_list): Ditto. (posix_to_win32_path_list): Ditto. * path.h: Reflect changes to path.cc. Tue Jun 30 14:00:32 1998 Christopher Faylor * environ.cc (winenv): Avoid converting environment variables to windows style if they begin with something like a 'C:'. Sun Jun 28 20:59:16 1998 Christopher Faylor * include/Windows32/Structures.h (MINMAXINFO): Add a missing *LP... Thu Jun 25 10:45:38 1998 Christopher Faylor * signal.cc (sigpending): Stop from always reporting pending signals when no signals are actually pending. Tue Jun 23 15:38:45 1998 Christopher Faylor * Makefile.in: Add a new target. * cygwin.din: Add cygwin32_internal interface. * dcrt0.cc (dll_crt0_1): Don't call main if no main set. Allows initialization from a .dll. * utils/ps.cc: Use new internal/external interface to cygwin to provide an unchanging interface to some cygwin internals. * external.h: Preliminary stab at an interface to cygwin32 for getting at the "naughty bits". * external.cc: External interfaces to some cygwin internal stuff. patch from sos@prospect.com.ru (Sergey Okhapkin): * exceptions.cc (sig_handle): When abnormally terminating, close_all_files in signal thread context to prevent socket hangs. Thu Jun 18 15:17:06 1998 Christopher Faylor * pinfo.cc (pinfo_list::allocate_pid): Wrap pids at SHRT_MAX or ash complains. patch from sos@prospect.com.ru (Sergey Okhapkin): * window.cc (WndProc): Always kill timer before starting up a new one or eventually suffer a timer proliferation. Mon Jun 15 09:40:30 1998 Christopher Faylor * exceptions.cc: Cosmetic change. patch from sos@prospect.com.ru (Sergey Okhapkin): * syscalls.cc (system): Ignore SIGINT, SIGQUIT and SIGCHLD while in a system() call. Thu Jun 11 18:37:02 1998 Geoffrey Noer * include/sys/syslog.h: add missing LOG_LOCALn bits Tue Jun 9 22:29:26 1998 Christopher Faylor * dll_init.cc (DllNameIterator::operator const char* ()): Add a missing \n to a *_printf. * fhandler_tty.cc (fhandler_tty_slave::dup): Ditto. (fhandler_tty_slave::ioctl): Ditto. * errno.cc (errmap): Add an unrepresented windows error. Simplify table. Tue Jun 9 17:21:44 1998 Christopher Faylor * errno.cc (errmap): Make sure that errmap array is terminated with a NULL or suffer a SIGSEGV. Tue Jun 9 10:30:02 1998 Christopher Faylor Change `sprintf' to `__small_sprintf' throughout cygwin. * cygwin.din: Don't export exception handler. * exceptions.cc (__cygwin32_exception_handler): Rename to handle_exceptions. Make static. Redo core file generation slightly so that __small_sprintf can be used. (call_handler): Remove use of `rethere' in asm code. Don't probe stack as this is potentially dangerous unless done meticulously. * select.cc (select): Redo to create thread whenever needed for pipe/socket. Thread termination denotes fd readiness. Mon Jun 8 14:31:11 1998 Christopher Faylor * hinfo.cc (set_std_handle): New function to set windows "standard" handles from cygwin handles. (hinfo_vec::dup2): Set windows standard handle if appropriate. * syscalls.cc (_open): Set windows standard handle if appropriate. Sun Jun 7 16:34:00 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * fhandler_console.cc (fhandler_console::scroll_screen): Add a workaround for Win95 ScrollConsoleScreenBuffer bug which allowed scrolling to work correctly in both directions. (fhandler_console::char_command): Simulate underscore with cyan instead of magenta like on a real linux console. Sat Jun 6 00:01:18 1998 Christopher Faylor * dcrt0.cc: Remove obsolete PPC and OLDWAY defines. * exceptions.cc: Remove obsolete PPC defines. Fri Jun 5 22:18:01 1998 Christopher Faylor * utils/Makefile.in: install should build products if necessary. Fri Jun 5 17:47:11 1998 Geoffrey Noer * errno.cc (seterrno): shouldn't & against 0xff since there are error codes above 255. Fri Jun 5 14:35:36 1998 Christopher Faylor * exceptions.cc (ctrl_c_handler): Ignore CTRL_LOGOFF_EVENT or everybody gets signalled when a user logs off. Allow program to clean up when receiving a CTRL_CLOSE_EVENT or CTRL_SHUTDOWN_EVENT. * spawn.cc (_spawnve): Delete hmap.vec from created child since it just gets overwritten in the child anyway. * pinfo.cc (lpfu): u -> user_data. Thu Jun 4 22:45:12 1998 Geoffrey Noer * mmap.cc (mprotect): 3rd arg to VirtualProtect call should be new_prot, not prot. Also, fix check for PROT_NONE (==, not &). Wed Jun 3 16:37:43 1998 Geoffrey Noer * exceptions.cc: Fix typo in comment (ctrl_c_handler): Add comments, return FALSE on CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT events. Otherwise, we handle the console event ourselves, send a SIGINT, and return TRUE. Wed Jun 3 14:36:08 1998 Geoffrey Noer patch from sos@prospect.com.ru (Sergey Okhapkin): * path.cc (conv_to_win32_path, conv_to_full_win32_path): resolve symlinks before converting. Wed Jun 3 02:11:23 1998 Geoffrey Noer * exceptions.cc (ctrl_c_handler): return zero when a CTRL_LOGOFF_EVENT occurs. Wed Jun 3 01:01:17 1998 Geoffrey Noer Reorganize fhandler-related file layout. * Makefile.in: Remove console.o, add fhandler_console.o. Add fhandler_serial.o. Remove tty.o, add fhandler_tty.o. * fhandler_console.cc: Was console.cc. * console.cc: Delete. * fhandler_serial.cc: Was code in fhandler.cc. * fhandler.cc: Delete fhandler_serial routines. * fhandler.h: Fix comments describing fhandler file layout. * fhandler_tty.cc: Was code in tty.cc. * tty.h: Delete. * fhandler_tty.h: Was tty.h. * tty.cc: Delete code moved to fhandler_tty.cc. * winsup.h: Include fhandler_tty.h instead of tty.h. Tue Jun 2 23:34:42 1998 Geoffrey Noer Don't need processor-specific sysdef directories: * sysdef/powerpc: remove all files * sysdef/i386: move all files to top of sysdef directory * configure.in: stop setting processor-specific sysdef variable * configure: regenerate * Makefile.in: build .a files from top-level sysdef files. Tue Jun 2 16:52:18 1998 Geoffrey Noer patch from lhall@rfk.com (Larry Hall): * console.cc (fhandler_console::fhandler_console): call fillin_info() to check if console attributes have already been set. If so, set the default foreground color to be the default for the console, otherwise set it to white. (fhandler_console::char_command): use the default color to set fg, bg, and bold for all cases. Mon Jun 1 14:05:01 1998 Christopher Faylor * dir.cc (writable_directory): Avoid a malloc. (opendir): Convert to fully qualified path spec. Use inode from stat as hash instead of recalculating. (readdir): Try hard to generate the same inode for filenames as inodes returned from stat(). Handle '.' and '..' inodes differently than normal files. Note that '..' will still fail in certain pathological conditions. * fhandler.cc (fstat): Preserve errno around path conversion. * path.cc (path_conf::path_conv): Add an extra argument signifying whether caller wants a fully qualified Windows spec. (get_current_directory_name): New function. Retrieves current directory name into internal buffer. (getcwd_inner): Reorganize. Use get_current_directory_name() to retrieve a (possibly cached) directory name. (hash_path_name): Move function here from syscalls.cc. Rewrite to deal (simplistically) with non-absolute path specs. Use get_current_directory_name to absolutize path. * path.h: Reflect additional argument for path_conv. * select.cc (cygwin32_select): Remove newline from select_printf(). * syscalls.cc (hash_path_name): Move to path.cc. (stat_worker): Always use full path spec so that inodes are calculated correctly. * uinfo.cc (getlogin): Make extern "C". * include/sys/resource.h: Put extern "C" around this file. Mon Jun 1 13:16:03 1998 Christopher Faylor * console.cc: Comment out small_printfs which issue errors on things like invalid escape sequences. This is very much unlike a normal terminal, or even like linux which console.cc purports to emulate. (console_read): Renamed from FakeReadConsole. Streamline slightly. (fhandler_console::read): Ditto. Fri May 29 22:41:18 1998 Geoffrey Noer * hinfo.cc: Include unistd.h, not fcntl.h. Fri May 29 21:38:10 1998 Christopher Faylor * path.cc (mount_info::binary_win32_path_p): Don't allow the root mount to replace a //drive or //host specification. Fri May 29 08:20:28 1998 Geoffrey Noer * winsup.h: Remove exports section in favor of external include files. Fix some comments. * {console.cc, fcntl.cc, pipe.cc}: Include unistd.h. * dcrt0.cc (__main): Make extern "C". * strace.cc: Include time.h. * wait.cc (_wait): Make extern "C". * version.h: Bump minor version to 3 in honor of /dev/windows support. Fri May 29 03:11:28 1998 Geoffrey Noer patch from sos@prospect.com.ru (Sergey Okhapkin): * Makefile.in: Add fhandler_windows.o target * fhandler.h: Include . fhandler_windows: new fhandler class that handles access to Windows message queue. (fhandler_base::is_windows): new virtual member function * fhandler_windows.cc: New file, fhandler_windows class implementation. * hinfo.cc (hinfo_vec::build_fhandler): build fhandler_windows class for "/dev/windows". Include . * select.cc: New fd_windows_map class (fd_windows_map::convert_to_unix_fdset): New, check for Windows messages in a queue. (cygwin32_select): check for windows fd is passed to select call, increase size of harray by one to support windows pseudo-handle, do MsgWaitForMultipleObjects if windows fd passed to select call. Thu May 28 18:22:24 1998 Ian Lance Taylor * utils/cygpath.cc: New file. * utils/Makefile.in (PROGS): Add cygpath$(EXEEXT). (cygpath$(EXEEXT)): Ne target. * include/sys/cygwin.h: Declare more path conversion functions. Thu May 28 15:56:26 1998 Geoffrey Noer * include/sys/ioctl.h: need to include * syscalls.h: remove ioctl proto Wed May 27 01:34:06 1998 Geoffrey Noer * cygwin.din: add sethostent/endhostent exports * net.cc (sethostent, endhostent): new stubs Fri May 22 17:31:50 1998 Geoffrey Noer * include/cygwin32/in.h: correct typo in IPPORT_WHOIS define Fri May 22 17:00:48 1998 Geoffrey Noer * include/sys/ioctl.h: add ioctl proto Wed May 20 18:52:31 1998 Geoffrey Noer * include/sys/param.h: delete, file overlaps with newlib's. Move it to newlib/libc/sys/cygwin32/sys where such files are supposed to go. Wed May 20 18:20:35 1998 Geoffrey Noer * select.cc (auto_del_fd_set_map::auto_del_fd_set_map): correct C++ problem -- can't use parens in call to new. Wed May 20 17:03:25 1998 Geoffrey Noer based on patch from newsham@lava.net (Tim Newsham): * select.cc: FIXMEs added/adjusted (select_sleep): new static select helper function (cleanup_sockthread): ditto (cleanup_pipethread): ditto (cygwin32_select): remove degenerate goto in favor of calling select_sleep, call cleanup_sockthread and cleanup_pipethread instead of previously duplicated code. Wed May 20 02:21:37 1998 Geoffrey Noer patch from Christopher Faylor * fhandler.cc (fhandler_serial::raw_read): When vmin_ == 0, vtime_ > 0, don't force only one char at a time to be read. (fhandler_serial::tcsetattr): set to.ReadIntervalTimeout and to.ReadTotalTimeoutMultiplier appropriately so reads will time out properly when vmin_ == 0, vtime_ > 0. Tue May 19 09:05:46 1998 Christopher Faylor * init.cc (set_dllname): Use consistent "cygwin32" name for dll if the name of the dll is actually cygwin. This will allow better interoperability between dlls which have been renamed, i.e., cygwindevo.dll -> cygwin98r1.dll. Mon May 18 22:39:35 1998 Christopher Faylor * winsup.h: Remove sig* undefs since this is now done in newlib. Define SIGTOMASK define for use by signal mask operations. * exceptions.cc (__cygwin32_exception_handler): Use SIGTOMASK. (sig_handle): Ditto * signal.cc (sigpending): Ditto. (sigaddset): Use SIGTOMASK. Disallow signal 0. (sigdelset): Ditto. (sigismember): Ditto. * strace.cc (strace_printf): It is possible for strace_mutex to be an invalid handle. Open the mutex if so. Call ReleaseMutex until exhausted since a signal may have interrupted an strace_printf. (strace_dump): Call ReleaseMutex until exhausted. * tty.cc (do_output): Remove strace printf to avoid filling up strace output. (fhandler_tty_slave::read): Use SIGTOMASK. Mon May 18 09:11:38 1998 Christopher Faylor * dcrt0.cc (dll_crt0_1): Clear errno before calling main. Thu May 14 00:37:01 1998 Geoffrey Noer * dcrt0.cc: add comments, reformatting Wed May 13 17:47:23 1998 Geoffrey Noer patch from sos@prospect.com.ru (Sergey Okhapkin): * times.cc (to_time_t): prevent stat from returning incorrect file modification time (one second less) on fat partitions due to round-up error. Wed May 13 16:03:07 1998 Geoffrey Noer * select.cc: add comments, FIXMEs, respace, delete old sockets-only case that was previously commented out. (cygwin32_select): in case where handles and sockets are set, don't check that always_ready_used is zero (that case is covered before). * syscalls.cc: delete unused file_queue struct. Tue May 12 18:36:25 1998 Geoffrey Noer * syscalls.cc (get_os_type): add FIXME Tue May 5 14:02:12 1998 Christopher Faylor Throughout Cygwin replace use of "sa" SECURITY_ATTRIBUTE variables with appropriate global variables. * shared.cc (shared_init): Initialize global security attribute variables for use in various places around cygwin. * fork.cc (fork_init): Remove. Functionality replaced by above. * dcrt0.cc (dll_crt0_1): Remove obsolete fork_init() call. Sat May 2 17:40:51 1998 Christopher Faylor patch from sos@prospect.com.ru (Sergey Okhapkin): * tty.cc (create_tty_master): Fill in ut_host utmp field with local host name instead of "local" to avoid "who" command timeouts. Fri May 1 22:38:20 1998 Christopher Faylor * environ.cc: Add a global to control com port reset behavior. (parse_options): Recognize "reset_com" as a CYGWIN32 option. * fhandler.cc (fhandler_serial::raw_read): Handle vmin and vtime more like UNIX. (fhandler_serial::open): Revive code to reset com port on open. Only reset the port if reset_com global is not set and if this function is being called explicitly by open. (fhandler_serial::tcsetattr): Make CRTSCTS flow control more like UNIX -- it should turn on hardware handshaking in both directions. Handle vmin and vtime in a manner more consistent with UNIX. (fhandler_serial::tcgetattr): Reflect CRTSCTS changes above when reporting this state. * include/sys/termios.h: Move CRTSCTS and CRTSXOFF (sic) into 16 bits or they will never be capable of being set. Thu Apr 30 15:05:45 1998 Christopher Faylor * console.cc (fhandler_console::init): If resetting stdin, make sure to reset the ConsoleCtrlHandler. * exceptions.cc (set_console_handler): New function broken out of init_exceptions(). Sets the function responsible for handling CTRL-C. (init_exceptions): Snipped out set_console_handler. Thu Apr 30 14:11:30 1998 Christopher Faylor * include/sys/cygwin.h: Remove cygnus-specific declaration. * winsup.h: Move cygnus-specific cygwin32_attach_handle_to_fd declaration here. This function may eventually be replaced by an osf_* function. Tue Apr 28 17:07:46 1998 Geoffrey Noer * passwd.cc (parse, getpass): remove unneeded uses of NO_COPY * grp.cc (getgrgid, getgrnam): ditto Tue Apr 28 16:18:03 1998 Geoffrey Noer * version.h: bump minor version to 2 * errno.cc: add FIXME Wed Apr 22 15:43:56 1998 Geoffrey Noer * syscalls.cc (cygname): delete * shared.cc (shared_name): new, was cygname * strace.cc, exceptions.cc, sigproc.cc, shared.cc: fix cygname references in light of above Wed Apr 22 14:12:09 1998 Christopher Faylor * select.cc (fd_set_map::remove_pair_by_handle): minor optimization * strace.cc (strace_printf): change format for consistency patch from sos@prospect.com.ru (Sergey Okhapkin): * dcrt0.cc (dll_crt0): Call global constructors explicitly * tty.cc (create_tty_master): Remove code which attempted to invoke tty constructor Tue Apr 21 16:18:27 1998 Christopher Faylor * environ.cc (ucenv): inline (posify): Ditto (environ_init): remove obsolete function use * path.cc (symlink_check_one): Set errno here where appropriate. (readlink): Rely on errno set by symlink_check_one rather than defaulting to EINVAL. Should fix problems with RCS. Tue Apr 21 15:36:41 1998 Christopher Faylor * Implement a NOSTRACE preprocessor define to allow building Cygwin32 without any STRACE code. * configure.in: Add entries for architecture specific programs to allow easier cross-compile builds * configure: Ditto * Makefile.in: Ditto * console.cc (fhandler_console::char_command): Fix two problems with cursor position report: 1) it reported position relative to beginning of buffer rather than beginning of screen, 2) it reported y, x in reversed order * dcrt0.cc: Remove NO_COPY from variables that don't need it. Remove variables obsoleted by NO_COPY. (dll_crt0_1): strace settings are now inherited. Don't try to initialize strace early. Remove initialization of variables which are now handled automatically by NO_COPY. Set error mode for Cygwin32 to fail on critical errors rather than popping up a dialog box. * spawn.cc (spawn_guts): Always use default error mode when spawning a new process. Move error message to more generally useful location. Terminate signal handling in a cygwin parent process or two processes will be handling signals. (_spawnve): Inherit strace stuff * exceptions.cc (events_init): Provide more information on "Catastrophic failure". Change error message wording slightly. * fork.cc: Remove obsolete structure (cygwin_fork_helper1): Remove use of obsolete structure. Inherit strace settings in child processes. * sigproc.cc (sigproc_init): Set wait_sig priority immediately after thread creation. * smallprint.c: Remove unneeded include * strace.cc: Reorganize to handle NOSTRACE (strace_open): Use strace entries in pinfo structure which are now inherited (strace_dump): ditto (strace_init): preprocessor define STRACE_HHMMSS causes strace output to use alternate log file format. (strace_printf): ditto * syscalls.cc (access): Remove SetErrorMode in favor of global cygwin32 setting in dll_crt0_1. * fhandler.cc: Handle NOSTRACE * tty.cc: Ditto * window.cc: Ditto * include/sys/strace.h: Ditto * winsup.h: Move strace_file handle from per_process to pinfo so that it can be inherited. Remove obsolete pinfo entry. Tue Apr 21 14:30:52 1998 Christopher Faylor * hinfo.cc (cygwin32_attach_handle_to_fd): New function * include/sys/cygwin.h: Ditto. * cygwin.din: Export new cygwin-specific function Tue Apr 21 02:32:08 1998 Geoffrey Noer * syscalls.cc: comment out file_queue struct that doesn't seem to be used for anything anymore. Don't need to include stdarg.h or sys/socket.h. Include utmp.h. Minor respacing. Move all functions from misc.cc here. (_read): change strace debug printf function name to _read (logout): rename success to res * misc.cc: delete file * Makefile.in: adjust for above change Tue Apr 21 01:45:05 1998 Geoffrey Noer * dir.cc: new file for directory-related functions, was dirsearch.cc. (mkdir, rmdir, writable_directory): move here from syscalls.cc, writable_directory no longer static * dirsearch.cc: delete file * winsup.h: add proto for writable_directory. * errno.cc: new file for errno-related functions, move errmap struct here from syscalls.cc (seterrno): move from syscalls.cc (strerror): move from strerror.cc * strerror.cc: delete file * syscalls.cc: delete everything moved to any of the above files * Makefile.in: adjustments for above Thu Apr 17 16:43:23 1998 Geoffrey Noer * termios.cc: add comments, add extern "C" in front of exported calls, move debugging local functions to end of file * winsup.h: remove fork_terminate proto for function that is no longer with us. Add strccpy proto. * spawn.cc (_spawnve): make static (strccpy): remove in favor of identical function in exec.cc * exec.cc (strccpy): no longer static patch from newsham@lava.net (Tim Newsham): * select.cc (cygwin32_select): fix off by one error, stop using memcpy to copy memory over itself Thu Apr 16 16:23:00 1998 Geoffrey Noer * net.cc: respace, put all fhandler_socket functions together (getsockopt): fix case statement bug resulting in faulty strace output (setsockopt): ditto * shared.cc: throughout, rename global h to cygwin_shared_h * strerror.cc: make error global a local variable * fhandler.h: add comments, add virtual function always_read_ready to fhandler_serial which should return zero to allow non-blocking serial I/O. * Makefile.in: select.cc should depend on select.h Wed Apr 15 16:14:01 1998 Geoffrey Noer * select.h: new file, containing macros used by select.cc. * select.cc: remove them from here, include select.h Wed Apr 15 15:23:55 1998 Geoffrey Noer * ntea.cc (NTReadEARaw): mark as static, don't check allow_ntea since this is only accessed by functions that have already checked it. Tue Apr 14 14:07:54 1998 Geoffrey Noer * cygwin.din: export truncate call Mon Apr 13 23:15:13 1998 Geoffrey Noer Throughout Cygwin32, rename *u for per_process data *user_data. Likewise, rename *s for shared memory data *cygwin_shared. Respace where necessary. * registry.cc: minor respace * registry.h: ditto * net.cc: ditto * fhandler.cc (fhandler_base::read): don't redeclare int len * syslog.cc: add FIXME, reformatting, remove extern "C" around whole file, add before exported functions (syslog): rename second cp char pointer cp2 (setlogmask): comment out unused function Mon Apr 13 17:55:43 1998 Geoffrey Noer * environ.cc (parse_options): add "ntea" setting to CYGWIN32 env variable. Setting determines whether NTEA is used or not. * ntea.cc: Add allow_ntea global which is inited to FALSE. Now instead of immediately returning FALSE, make all functions check allow_ntea variable and use or not use NTEA based on its value. * ps.cc (main): widen Win32_pid field by one to better handle Win 95 pids. patch from sos@prospect.com.ru (Sergey Okhapkin): * shared.cc (shared_info::initialize): increase default heap_chunk_size to 128 mb to get around the problem that Cygwin32 still can't cope with a split heap properly. Wed Apr 8 18:04:07 1998 Geoffrey Noer * net.cc (cygwin32_bind, cygwin32_getsockname, cygwin32_listen, cygwin32_shutdown): if should check sock, not s. Wed Apr 8 15:00:46 1998 Geoffrey Noer Eliminate warnings revealed by -Wshadow -Wall: * console.cc (FakeReadFile): fix aggregate with partly bracketed initializer (add missing brackets). * tty.cc (fhandler_tty_slave::close): remove unused variable tty (fhandler_tty_slave::dup): ditto (fhandler_tty_slave::send_ioctl_request): ditto Wed Apr 8 03:04:11 1998 Geoffrey Noer Eliminate warnings revealed by -Wshadow -Wall: * console.cc (FakeReadFile): change variable name index to modifier_index. (fhandler_console::read): remove second definition of flags * dcrt0.cc (build_argv): rename s to start, e to end (insert_files): reformat, add parens around assign used as truth value, make i a DWORD, remove dup def of i. * dlfcn.cc (set_dl_error): rename s to str (checkAccess): rename to check_access (checkPathAccess): rename to check_path_access (getFullPathOfDll): rename to get_full_path_of_dll, don't redeclare len * dll_init.cc (DllList::detachDll): rename index to dll_index * fork.cc (cygwin_fork_helper1): rename index to dll_index, reformat slightly, rename res in dll load section to loadres, don't redeclare rc two additional times (dump_jmp_buf): rename s to sbuf * grp.cc (initgroups): rename group arg to grp * hinfo.cc (digits): rename s to str (hinfo_vec::build_fhandler): rename first buf variable to buf_info, the second to buff. (hinfo_vec::linearize_fd_array): cast sizeof return to int, declare i in for loop (hinfo_vec::de_linearize_fd_array): declare i in for loop * misc.cc (nice): rename pri to priority, index to curr (cygname): rename s to str (login): rename tty to currtty (logout) put missing parens around arg to sizeof calls * net.cc (DuplicateSocket): rename function to duplicate_socket, rename s arg to sock (fhandler_socket::fhandler_socket): rename s arg to sock (socketpair): rename sin to sock_in (cygwin32_rexec): rename passwd arg to password * passwd.cc (parse): rename stat array to tmpbuf * resource.cc (fill_rusage): rename creation to creation_time, exit to exit_time, kernel to kernel_time, user to user_time (getrusage): rename rusage arg to rusage_in * sigproc.cc (proc_terminate): move i declaration outside of loop, get rid of extra declaration (getsem): rename s to str (proc_strace): declare i at top of function, remove extra two declarations of it later * smallprint.c: include ctype.h for isalnum proto (__small_vsprintf): put parens around assign used as truth value * spawn.cc (spawn_guts): rename both s variables to str, remove redeclarations of i * strace.cc (mark): rename s arg to str * syscalls.cc (chown): remove unused vars group, passwd (access): rename s to st (ctermid): rename s to str * termios.cc (cfsetospeed, cfsetispeed): rename s to speed * times.cc (times): rename creation to creation_time, exit to exit_time, kernel to kernel_time, user to user_time (time_t_to_filetime, timeval_to_filetime): rename time to time_in * tty.cc (create_tty_master): rename utmp variable our_utmp (fhandler_tty_master::init): rename ttynum arg ttynum_in Tue Apr 7 17:18:05 1998 Geoffrey Noer * syscalls.cc (seterrno): add FIXME * path.cc (symlink_check_one): change comment wording patch from Tom Tromey (tromey@cygnus.com) * syscalls.cc (access): Call SetErrorMode to turn off critical errors dialog. patch from Mikey (jeffdb@netzone.com): * fhandler.cc (fhandler_disk_file::open): under Win95, set S_IXOTH|S_IXGRP|S_IXGRP if the first two bytes of a file contain a '#!'. (fhandler_disk_file::check_execable_p): consider shell scripts execable Mon Apr 6 20:55:06 1998 Geoffrey Noer * include/sys/cygwin.h: add protos for cygwin32 path conversion functions. Wed Apr 1 16:12:58 1998 Geoffrey Noer * {fhandler.cc, fhandler.h, hinfo.cc, console.cc}: Rename fhandler_tty class to fhandler_serial Tue Mar 31 16:27:36 1998 Geoffrey Noer * ntea.cc: temporarily disable reading/writing NTEA information due to the large penalty incurred on NT fat partitions. Fri Mar 27 13:35:30 1998 Geoffrey Noer * environ.cc (parse_options): change struct to union to avoid references to uninitialized fields. Thu Mar 26 19:03:00 1998 Eric Bachalo * dcrt0.cc (insert_files): added this function to replace -@file in the command line with the contents of the file (dll_crt0_1): calls insert_files before building argv Wed Mar 25 15:25:26 1998 Geoffrey Noer And more: * {fhandler.cc, fhandler.h, tty.cc, net.cc, console.cc}: make ioctl calls' cmd arg unsigned, ditto for access arg of init calls. * console.cc (fhandler_console::fillin_info): add parens around assignment used as truth value. (FakeReadFile): make copied_chars a size_t (fhandler_console::read): make i in loop unsigned * environ.cc (setenv): make l_value unsigned, add parens around assignments used as truth values. * exceptions.cc (call_handler): supposed to return an int and wasn't at the end of control flow. Now returns 1 there. * fhandler.h (~fhandler_base): destructor should be marked virtual * misc.cc (login): add parens around assignment used as truth value. * net.cc: cast INVALID_SOCKET to int in comparisons (fhandler_socket::ioctl): remove int cast to FIONBIO since cmd is now unsigned (get_win95_ifconf): add cast to signed vs unsigned int comparison. * ntea.cc (NTReadEA): add cast to signed vs unsigned int comparison. * path.cc (getcwd_inner): make len a size_t * pinfo.cc (cygwin32_winpid_to_pid): add comment * select.cc (cygwin32_select): make wait_ret an int * signal.cc (kill_worker): add parens around assignments used as truth values. * sigproc.cc (wait_sig): make rc a DWORD (sig_send): add parens around assignment used as truth value. * strace.cc: make inqueue global a static DWORD * tty.cc (do_output): add cast to signed vs unsigned int comparison. (fhandler_pty_master::open): remove unused handle nh Tue Mar 24 18:03:59 1998 Geoffrey Noer More spring cleaning: * net.cc: move LOAD macro definition out of winsock_init, correction to make it valid ANSI C++. * grp.cc (read_etc_group): pass default line directly to add_grp_line call Mon Mar 23 19:21:00 1998 Geoffrey Noer patch from cgf@bbc.com (Christopher Faylor): * spawn.cc (spawn_guts): Don't call close_all_files if a cygwin process has been spawned. Otherwise, we close tty handles twice. Fri Mar 20 23:01:24 1998 Geoffrey Noer * pinfo.cc (pinfo_list::init): Initialize next_pid to PBASE. (pinfo_list::operator []): Now index is given by pid mod size(). (pinfo_list::allocate_pid): Allow more pid numbers than spaces in the process table. Pids now can range from PBASE (1000) to INT_MAX. At that point they wrap to 1000 again. For speed, use modular arithmetic to map pids into table. * winsup.h: move PBASE to pinfo.cc, rename next_pid_index to next_pid * utils/ps.cc (main): reorg of what's printed where, listing pid first. Thu Mar 19 15:05:07 1998 Geoffrey Noer * winsup.h: Change section name in NO_COPY definition. We were using a .data$nocopy section to avoid copying certain data on fork. The linker used to include this between __data_start__ and __data_end__, but that broke building the cygwin32 dll. The fix is to rename the section ".data_cygwin_nocopy" and explictly include it after __data_end__. Wed Mar 18 15:03:51 1998 Geoffrey Noer * tty.h: fix ttyslot proto; it returns an int * glob.h: fix glob proto; it returns an int Mon Mar 16 16:16:40 1998 Geoffrey Noer * Makefile.in: stop installing the dll in the lib directory as well as the bindir. * environ.cc (parse_options): don't need to call malloc Mon Mar 16 11:56:23 1998 Geoffrey Noer patch from cgf@bbc.com (Christopher Faylor): * tty.cc (fhandler_tty_slave::dup): Don't set flags to 0. Flags have already been set in wrapper. * net.cc: Rename `s' variable which shadows global `s'. * termios.cc: ditto * time.cc: ditto Tue Mar 10 15:54:04 1998 Geoffrey Noer * version.h: up CYGWIN_DLL_VERSION_MINOR Tue Mar 10 15:41:29 1998 Geoffrey Noer patch from cgf@bbc.com (Christopher Faylor): * spawn.cc (spawn_guts): Make argument handling after `#! pgm' handle spaces similarly to UNIX. Close "linearized" file handles when a non-cygwin32 binary is executed or suffer hangs on exit. Reorganize lpReserved2 buffer to avoid conflicts with Microsoft usage which resulted in incorrect stdin/stdout operation with programs compiled using MSVC. * pinfo.cc (pinfo_init): Accommodate change to lpReserved2 organization. Mon Mar 9 19:27:17 1998 Geoffrey Noer * syscalls.cc (_open): modify to take a variable number of arguments to match newlib's fcntl.h. * environ.cc (parse_options): rewrite struct known to conform to ANSI standards. Can't statically initialize, so do so dynamically at the beginning of the function instead. patch from jeffdb@netzone.com (Mikey): * dcrt0.cc (build_argv, compute_argc): need to escape quotes Sat Feb 28 16:41:54 1998 Geoffrey Noer patch from sos@prospect.com.ru (Sergey Okhapkin): * fhandler.cc (fhandler_base::init): call set_flags based on access arg. * net.cc: include fcntl.h (fhandler_socket::fhandler_socket): made sockets O_RDWR Thu Feb 26 23:41:54 1998 Geoffrey Noer Beta 19 release made. Sun Feb 22 23:46:31 1998 Geoffrey Noer patch from sos@prospect.com.ru (Sergey Okhapkin): * Makefile.in: Do not link cygwinb19.dll with libwsock32.a * exceptions.cc: add proto for i_WSACleanup. (sig_handle): call *i_WSACleanup if winsock was inited. * hinfo.cc: add proto for i_getpeername. (hinfo_vec::build_fhandler): call *i_getpeername if winsock was inited * net.cc: wsock32, i_wsockimports - new globals. Throughout file, call winsock functions via indirect pointers. (winsock_init): dynamically load wsock32.dll and resolve addresses of exports. (cygwin32_rcmd, cygwin32_rexec, cygwin32_rresvport): resolve addresses of exports. * select.cc: add protos for i___WSAFDIsSet, i_WSAGetLastError, i_select, i_socket, i_closesocket. WINSOCK_FD_ISSET changed to use indirect pointer. Direct winsock calls changed to indirect. (cygwin32_select): initialize winsock before calling select in degenerate case. * winsup.h: remove protos for ScreenRows, ScreenCols, ScreenGetCursor, ScreenSetCursor. Sun Feb 22 17:44:55 1998 Geoffrey Noer * environ.cc (parse_options): comment out -- no longer compiles with egcs. Will rewrite/enable later. Sun Feb 22 13:49:10 1998 Geoffrey Noer * syscalls.h: remove protos for _open, _read, _write since they are in newlib headers that are already included * syscalls.cc (_read): return int, not ssize_t (_write): ditto Sat Feb 21 14:21:17 1998 Geoffrey Noer * Makefile.in: rename dll to cygwindevo.dll Sat Feb 21 01:33:56 1998 Geoffrey Noer * cygwin.din: remove dup definition of endpwent Thu Feb 19 14:20:21 1998 Geoffrey Noer * include/cygwin32/cygwin_dll.h: Correct protection wrapper Tue Feb 17 20:21:24 1998 Geoffrey Noer * include/Windows32/Structures.h: tagBITMAPFILEHEADER should be packed. Tue Feb 17 19:34:41 1998 Geoffrey Noer patch from cgf@bbc.com (Christopher Faylor): * cygwin.din: export sigpause * signal.cc (sigpause): New "compatibility interface" to sigsuspend function. Used currently by inetutils. Tue Feb 17 11:43:27 1998 Ian Lance Taylor * tty.h (class tty): Add slave_opened field. * tty.cc (fhandler_tty_master::init): Initialize slave_opened. (do_output): Only return with EOF if the slave has been opened. (fhandler_tty_slave::open): Set slave_opened. (fhandler_pty_master::open): Initialize slave_opened. * tty.cc (fhandler_pty_master::read): Change type of n to DWORD. If there are no characters to read, and the descriptor is in nonblocking mode, just return EGAIN. Mon Feb 16 15:11:25 1998 Ian Lance Taylor * tty.h (class tty): Remove handle_pid and slave_handles fields. (class tty_list): Add getcount method. * tty.cc (tty::init): Initialize input_handle and output_handle. (tty_list::free_tty): If we just freed the last reference to this tty, close input_handle and output_handle. (fhandler_tty_master::init): Don't initialize handle_pid and slave_handles. (do_output): Instead of just calling ReadFile, loop using PeekNamedPipe and check whether the tty has been closed. Return 0 on EOF and -1 on error. (process_output): Only print debugging error message if error occurs in do_output. (fhandler_tty_slave::open): Always duplicate handles from master. Never close handles in source. Don't change slave_handles. (fhandler_tty_slave::close): Don't change slave_handles, and don't close tty handles. (fhandler_tty_slave::linearize): Call attach_tty. (fhandler_tty_slave::de_linearize): Don't call attach_tty. (fhandler_tty_slave::dup): Don't increment slave handles. (fhandler_pty_master::open): Don't initialize handle_pid and slave_handles. (fhandler_pty_master::close): Don't check slave_handles, and don't close tty handles. (fhandler_pty_master::read): Handle EOF return value from do_output. (fhandler_pty_master::linearize): Call attach_tty. (fhandler_pty_master::de_linearize): Don't call attach_tty. * fork.cc (cygwin_fork_helper1): Copy strace_mask from parent to child. Thu Feb 12 20:33:57 1998 Geoffrey Noer patch from cgf@bbc.com (Christopher Faylor): * utils/cygwin.cc: Modify -s option to use new strace_mask entry in pinfo. Prepare for future ability to specify an strace file. Thu Feb 12 11:57:26 1998 Geoffrey Noer * grp.cc (read_etc_group): add a default /etc/group in memory if /etc/group isn't found (getgrnam): return NULL if requested group isn't found instead of returning a default group Wed Feb 11 15:59:10 1998 Geoffrey Noer patch from sos@prospect.com.ru (Sergey Okhapkin): * strace.cc (strace_open): do not close u->strace_file if it points to stderr. * malloc.cc (malloc_init): do not check for application's malloc in a forkee, this breaks memory coherency in a forkee and forker. use_internal_malloc flag now copies on fork. Tue Feb 10 18:11:30 1998 Geoffrey Noer patch from cgf@bbc.com (Christopher Faylor) Throughout sources, mark statics and globals as NO_COPY where appropriate. * fork.cc (cygwin_fork_helper1): Remove #if 0 around fork_copy of cygwin data/bss. Remove __malloc_copy since it is no longer necessary. Tue Feb 10 15:30:19 1998 Geoffrey Noer patch from cgf@bbc.com (Christopher Faylor) * console.cc (fhandler_console::write): Implement xterm style escape sequences for setting title in the console title bar. * fhandler.h: Define constants for console title escape sequence. Tue Feb 10 14:16:17 1998 Geoffrey Noer * include/a.out.h: remove junk chars introduced by mailer when this header was sent to us patch from sos@prospect.com.ru (Sergey Okhapkin): * libccrt0.cc: rename cygwin_attach_dll to cygwin32_attach_dll patch from cgf@bbc.com (Christopher Faylor): * environ.cc: fix off by one problem Mon Feb 9 14:56:00 1998 Geoffrey Noer * Makefile.in: add registry.h to environ.o deps Mon Feb 9 14:42:24 1998 Ian Lance Taylor * Makefile.in (DLL_OFILES): Rename dllinit.o to dll_init.o. * tty.cc (fhandler_tty_slave::close): Don't close the tty handles if the slave and the master are the same process. * path.cc (read_mounts): Change key parameter to reference, to avoiding running the destructor. Mon Feb 9 13:53:50 1998 Geoffrey Noer patch from cgf@bbc.com (Christopher Faylor): Moves all environment manipulation into environ.cc. Switches to CYGWIN32 for settings: set CYGWIN32=[no]title [no]strip_title [no]binmode [no]glob strace=mask:cache,file [no]tty (set STRACE=whatever is still honored). Propagates tty settings to all subprocesses regardless of unsetting of environment variable. Moves strace mask into pinfo structure for easier future manipulation by external program. Moves strace_file into the vacated position for automatic use in forked processes. Propagates old title to execed processes so that they can correctly restore the correct title when they exit. * console.cc: Use PID_USETTY setting in process_state so that tty state can be easily inherited. (set_console_title): New function to set console title. * syscalls.cc: Use PID_USETTY setting in process_state so that tty state can be easily inherited. * tty.cc: Ditto. * hinfo.cc: Ditto. (hinfo_vec::de_linearize_fd_array): Return last location in buffer for further potential processing. * dcrt0.cc: Add global variables for control of glob and title, set by environ_init. Mark some variables as NO_COPY. Remove routines and variables for dealing with environment. (dll_crt0_1): Move environment initialization into separate function. Honor 'noglob' CYGWIN32 setting. * environ.cc (environ_init): New function to initialize the environ table. Also scans for CYGWIN32 environment variable, setting appropriate values. (ucenv): New function. Upper cases an environment variable. (parse_options): New function. Parse CYGWIN_* environment variable. (posify): New function. Convert a Windows env path spec to cygwin. (env_sort): New function. Sort an environ block. (winenv): New function. Returns a windows style environment block. * fhandler.cc (fhandler_base::read): Reflect change to location of strace_mask. * fork.cc (cygwin_fork_helper1): Remove save/restore of some settings since this is automatic now with new dll data copy. Save PID_USETTY setting in child process_state. * strace.h: Cosmetic change. * pinfo.cc (pinfo_init): Call environ_init here since it may affect further processing in this function. Use old console title from "parent" process if execed process. Reflect change to location of strace_mask. * spawn.cc (spawn_guts): Remove environment manipulation code. Use new winenv function call instead. Save old title in block of memory copied to newly execed process if title is being displayed. * strace.cc: Changes to reflect new location for strace_mask and strace_file. These are now automatically inherited on fork. * winsup.h: Move strace_mask into pinfo to allow possible manipulation by other processes. Put u->strace_file in uptr structure so that it will be automatically duplicated on fork, removing the necessity of initializing strace in a forked process. Add functions/variables associated with environment manipulation and console title setting. Mon Feb 9 03:06:56 1998 Geoffrey Noer Extensive reformatting in new files from next patch. Rename dllinit.h file to dll_init.h and likewise for dll_init.cc. Rename cygwin_detach_dll to cygwin32_detach_dll throughout. Similarly, rename cygwin_attach_dll and _cygwin_dll_entry. And rename sanityAndSyncCheck to check_sanity_and_sync. Also: * dll_init.h: don't include winsup.h * dll_init.cc: include winsup.h here instead * dlfcn.cc: include winsup.h, don't include windows.h * cygwin.din: rename cygwin_detach_dll to cygwin32_detach_dll. patch from giac@dalim.de (Philippe Giacinti): Copy data areas of cygwin-compiled dlls on fork(), implement dlopen/dlsym/dlclose/dlerror calls. * Makefile.in: add dlfcn.o and dllinit.o to DLL_OFILES, add dllinit.h dependencies * cygwin.din: dll_dllcrt0, cygwin_detach_dll, dlopen, dlclose, dlsym, dlerror, dlfork -- new exports. * dcrt0.cc: include dllinit.h, mark u pointer as NO_COPY. (sanityAndSyncCheck): new, code moved from dll_crt0_1. Initialize all linked dlls before calling main(). * dlfcn.cc: new file. * dllinit.cc: new file. * dllinit.h: new file. * exceptions.cc: mark some variables with NO_COPY. * fork.cc: include dllinit.h; declare cygwin.dll data/bss start/end. (cygwin_fork_helper1): copy data/bss of cygwin.dll itself to child process (the code is disabled now); copy data areas of linked/loaded dlls (if any); free loaded dll list on cleanup. * include/cygwin32/cygwin_dll.h: new file. * include/dlfcn.h: new file. * libccrt0.cc (cygwin_crt0_common): new, code derived from cygwin_crt0, MainFunc parameter added. (cygwin_crt0): call cygwin_crt0_common. (cygwin_attach_dll): new. * shared.cc: mark some data as NO_COPY * strace.cc: mark some data as NO_COPY * winsup.h: add dll_dllcrt0 proto, NO_COPY macro. Sun Feb 8 17:51:26 1998 Geoffrey Noer * getopt.c: new. Import Berkeley getopt code modified for use in Cygnus' kerberos implementation (including the writing of getopt_long by Chris Provenzano (proven@cygnus.com)) then modified a bit more to get it working in Cygwin32. Although we were going to remove getopt, it appears that too many programs would need fixing to remove it completely. Whether getopt should be included in Cygwin32 should be decided at a later time. * include/getopt.h: new. Import Berkeley getopt.h. * Makefile.in: add getopt.o to LIBCOS * utils/Makefile.in: remove include of ../../include since getopt.h is now in winsup/include, also revert recent change of addition of GETOPT_OBJS. Fri Feb 6 16:28:19 1998 Geoffrey Noer * cygwin.din: remove set_new_handler and cygwin_set_attributes exports * version.h: up major version number * Makefile.in: rename dll to cygwinb19.dll * syscalls.cc (cygwin_set_attributes): axe Thu Feb 5 18:28:37 1998 Geoffrey Noer * include/Windows32/Functions.h: add protos for DdeCmpStringHandles and DdeCreateDataHandle * Makefile.in: stop including ../libiberty/getopt* since we aren't exporting or using them * utils/Makefile.in: add new variable for libiberty getopt objs which is linked in for cygwin.exe Thu Feb 5 17:59:12 1998 Geoffrey Noer syscalls.cc: move ppc dll_entry asm code to... dcrt0.cc: ...here Import new globbing code from NetBSD 1.3 * glob: delete subdirectory * glob.c: new file * glob.h: new file * Makefile.in: remove glob from submakes, remove glob/libglob.a from DLL_IMPORTS, fix dcrt0 glob.h dependency * configure.in: don't configure glob subdirectory * configure: regenerate * dcrt0.cc: include glob.h, not glob/glob.h. (globify): don't call glob with GLOB_NOESCAPE which isn't a valid flag with this glob Wed Feb 4 16:14:13 1998 Geoffrey Noer patch from sos@prospect.com.ru (Sergey Okhapkin): Allow system administrator to enter into the HKLM registry tree a predefined mount table inherittable by all cygwin users. The predefined mounts are non-mandatory so the user's mount table has a higher priority than the default one. Cygwin reads HKLM tree in read-only mode. * path.cc (read_mounts): new, code derived from mount_info::from_registry(). (mount_info::from_registry): call read_mounts from user's table, then from system-wide mount table. * registry.cc (reg_session::reg_session): key and access arguments added. (reg_key::init): access argument added. (reg_key::reg_key): access argument added. * registry.h (class reg_key): init prototype changed, default argument of reg_key added. (class reg_session): default arguments of constructor added. Wed Feb 4 15:38:59 1998 Geoffrey Noer * include/a.out.h: new coff header file Wed Feb 4 01:55:18 1998 Geoffrey Noer * uinfo.cc: define DEFAULT_UID/GID here * winsup.h: removed DEFAULT_UID/GID defs and unused set_console_title proto. Did some major reorganizing, and a little reformatting, commenting. Tue Feb 3 23:59:23 1998 Geoffrey Noer patch from cgf@bbc.com (Chris Faylor): Replace u->self and this_procinfo () with new `myself' pointer wherever appropriate. Also replace get_pid() calls with a simple ->pid reference. Mon Feb 2 12:34:49 1998 Geoffrey Noer patch from sos@prospect.com.ru (Sergey Okhapkin): * console.cc (FakeReadFile): limit bytes to read to 30000 due to Win NT 4.0 SP3 bug. Kill foreground process group with SIGWINCH on console buffer size change if tty support enabled. * include/sys/termios.h: define more constants. * tty.cc (fhandler_pty_master::ioctl): kill foreground process group with SIGWINCH on window resizing. Mon Feb 2 12:14:49 1998 Geoffrey Noer patch from cgf@bbc.com (Chris Faylor): * dcrt0.cc (dll_crt0_1): Initialize u->self here, early in a forked process so the correct pid is used in strace output and so signals do not end up being erroneously sent to the parent. * exceptions.cc: Make a global variable static. Some minor optimizations. (call_handler): Make sure that the signal mask is restored when sig_dispatch mutex is unavailable. Reorder asm statements to prevent clobbering of flags register by preceding ors or risk random inexplicable behavior when returning from a signal handler. * fork.cc (cygwin_fork_helper1): Put setjmp restore in child's pinfo. Have the child figure out its pid earlier in the initialization process. Don't print a "child failed" error if the child failed during initialization due to a CTRL-C. This is still not quite right (see comment). * sigproc.cc (sig_send): Remove unlock/lock_pinfo or suffer consistent hangs in zsh. Make {allow,block}_sig_dispatch globally available. (wait_sig): Fix problem where blocked signals would still be processed if queued. Add debugging SIGNOQUEUE conditional to turn off signal queueing, making cygwin more like traditional UNIX. * sigproc.h: Add {allow,block}_sig_dispatch functions. Mon Jan 26 17:33:57 1998 Geoffrey Noer * path.cc (mount_info::init): don't hardcode C: as the default slash mount. Instead, use the drive letter that the OS is loaded on. Mon Jan 26 13:33:57 1998 Geoffrey Noer patch from cgf@bbc.com (Chris Faylor): * fork.cc (cygwin_fork_helper): Move setting PID_INITIALIZING process_state here to avoid erroneously setting it permanently via proc_register(). * pinfo.cc (pinfo_init): Delay notifying "parent" when execing until this process is ready to receive signals or risk a race condition if exec parent calls sigproc_terminate prior to the child exec. * sigproc.cc (proc_subproc): Don't set PID_INITIALIZING here. It is too late in the process creation. (sig_send): Reset sigsuspend mutex prior to use to avoid a race. (wait_sig): Create sigsuspend mutex as an auto reset to attempt to avoid a race condition. Notify parent that this process is ready if we were execed (code moved from pinfo_init). Change PulseEvents to SetEvents to avoid races * spawn.cc (spawn_guts): Move setting PID_INITIALIZING process_state here to help avoid race. Fri Jan 23 12:31:37 1998 Ian Lance Taylor * malloc.cc (malloc_critical_section): New static variable. (malloc_init): New function. (__malloc_lock, __malloc_unlock): New functions. * winsup.h (malloc_init): Declare. * heap.cc (heap_init): Call malloc_init. Thu Jan 22 18:46:40 1998 Ian Lance Taylor * tty.h (class tty): Change slave_handles to int. * tty.cc (fhandler_tty_slave::open): Check for invalid tty handles. If this is the first slave, set slave_handles to 2; otherwise, increment slave_handles. (fhandler_tty_slave::close): Only close the tty handles if the slave_handles field drops to 1. (fhandler_tty_slave::write): Add a debugging message if WriteFile fails. (fhandler_tty_slave::dup): Set ttynum of new fhandler. Increment slave_handles if appropriate. (fhandler_pty_master::close): Only close the tty handles if the tty is no longer allocated. * tty.h (class tty): Add handle_pid and slave_handles fields. * tty.cc (attach_tty): Call connect_tty even if use_tty is not set. (detach_tty): Don't check use_tty. (fhandler_tty_master::init): Initialize handle_pid and slave_handles of tty. (do_input): Treat \r as end of line character. (do_output): Only set output_done_event if it is not NULL. (fhandler_tty_slave::open): Don't worry if we can't open output_done_event. Check slave_handles field of tty to decide from where to duplicate the handles. Call detach_tty on error. If we are now the owner of the slave handles, mark the tty appropriately. (fhandler_tty_slave::close): Only close output_done_event if it is not NULL. Check for errors from CloseHandle. Close the tty handles if we own them. (fhandler_tty_slave::write): Only wait for output_done_event if it is not NULL. (fhandler_tty_slave::read): If nobody owns the tty, return EOF. (fhandler_tty_slave::dup): Attach the tty. Don't duplicate output_done_event if it is NULL. Detach the tty on error. (fhandler_pty_master::open): Initialize handle_pid and slave_handles of tty. Don't create output_done_event. (fhandler_pty_master::close): Only close output_done_event if it is not NULL. Check for errors from CloseHandle. Only close the tty handles if we own them. (fhandler_pty_master::read): Only set output_done_event if it is not NULL. * hinfo.cc (de_linearize_fd_array): Don't set use_tty just because we find a tty to delinearize. Wed Jan 21 21:58:27 1998 Geoffrey Noer patch from cgf@bbc.com (Chris Faylor): * sigproc.cc: Changes in wait_sig/sig_send semaphore/event signaling to attempt to eliminate races. Tue Jan 20 16:11:05 1998 Geoffrey Noer Remove last remnants of the mixed case handling support. * path.cc (path_conv::path_conv): remove mixed_p init (mount_info::from_registry): don't check for fmixed (mount_info::to_registry): ditto (mount_item::getmntent): when setting ret.mnt_opts, only consider text vs binary flag (mount_item::init): remove init of mixed * path.h: remove mixed_p, mixed from path_conv class. Remove unmixedcaseify proto. * include/sys/mount.h: comment out MOUNT_MIXED define, protect header against multiple inclusion A little header file cleanup. Mostly to protect headers against multiple inclusion. Some aren't strictly speaking necessary but... * include/sys/cygwin.h: protect header against multiple inclusion * include/sys/smallprint.h: ditto, also add cplusplus wrapper * include/sys/strace.h: comment last endif * include/cygwin32/in.h: change _LINUX_IN_H protect defines to _CYGWIN32_IN_H * include/arpa/inet.h: protect header against multiple inclusion * include/asm/types.h: ditto * include/net/if.h: ditto * include/netinet/ip.h: ditto * include/netinet/ip_icmp.h: ditto * include/netinet/in.h: ditto, remove commented out real header file * include/fcntl.h: protect header against multiple inclusion * include/memory.h: ditto * include/mntent.h: ditto * include/strings.h: ditto * include/syslog.h: ditto * include/termio.h: ditto Tue Jan 20 12:51:59 1998 Ian Lance Taylor * strace.cc (strace_stderr): New static variable. (strace_init): Set strace_stderr. (system_printf): If not strace_stderr, use debug_printf to put the message in a trace file. * fhandler.h (fhandler_pty_master): Add neednl_ field. * tty.h (RESTART_OUTPUT_EVENT): Change to be different from IOCTL_DONE_EVENT. * tty.cc (fhandler_tty_master::init): Initialize neednl_. (do_output): Handle a length of one by using neednl_ to record an expansion of \n to \r\n which doesn't fit. Never expand \r to \r\n. Correct order of \r\n. (fhandler_tty_slave::open): Improve error handling. Use DUPLICATE_CLOSE_SOURCE to close the pipes in the master process. (fhandler_tty_slave::dup): Duplicate the handles, rather than calling fhandler_tty_slave::open. (fhandler_pty_master::open): Initialize neednl_. (fhandler_pty_master::read): Return EOF for ERROR_BROKEN_PIPE, rather than error. Set errno correctly. * hinfo.cc (digits): New static function. (build_fhandler): Always accept /dev/ptmx and /dev/ttyDDD, even if use_tty is not set. use_tty now only controls the interpretation of /dev/tty. Mon Jan 19 14:49:45 1998 Geoffrey Noer * sigproc.cc (sig_send): lock_pinfo_for_update during this function Fri Jan 16 18:09:59 1998 Geoffrey Noer * sigproc.cc (sigproc_init): if we can't create a signal thread or can't create sync_proc_subproc mutex, fail with an api_fatal call rather than just returning Fri Jan 16 18:08:49 1998 Geoffrey Noer patch from cgf@bbc.com (Chris Faylor): Changed signal handling to use one semaphore and one shared memory array which is manipulated via Interlocked*() functions. * exceptions.cc (lock_cs): Comment. Report on error. (unlock_cs): Add debugging statement. (sig_dispatch_pending): Remove obsolete function. (set_process_mask): Adapt to new signal method. (call_handler): Clear wait()ing threads here while main thread is suspended to avoid timing screwups. Avoid calling the handler if can't get dispatch mutex (code moved from sig_handle). Return status of acquiring the sig_dispatch mutex. (sighandle): Adapt to new signal method. Reorganize to *always* honor sig_dispatch mutex or suffer deadlock on fatal signals when someone else has the mutex and we're attempting to cleanup. (events_init): Reflect change in cygname() arguments. * fork.cc (stack_dummy): New function. Returns address of argument to determine bounds for eventual stack copy. (cygwin_fork_helper1): Call subproc_init to start up subproc thread if it is not alreay started. Ensure that signals are blocked while forked process is initializing. Change method of calculation for lower stack bounds to slightly more foolproof method. Preserve some global settings in forked process. * misc.cc (cygname): Remove an unused argument. * pinfo.cc (pinfo_list::allocate_pid): Add a useful debugging statement. * shared.cc (open_shared_file_map): Reflect change in cygname() arguments. * signal.cc (kill_pgrp): Avoid killing dead processes. Don't kill processes in my pgrp if not also in my ctty. (sigaction): Adapt to new signal method. (sigpending): Adapt to new signal method. * sigproc.cc: Many changes to adapt to new signal method. Also delay waits for thread initialization until the thread needs to be contacted. * sigproc.h: Ditto. * spawn.cc (spawn_guts): Fix potential off-by-one error(?) in transcribing the argument list and add paranoid code to detect future overruns. Change priority to highest so that waiting process will clear out quickly. (_spawnve): Call subproc_init() to start up subproc thread if is not already started. * strace.cc (strace_printf): Increase size of internal buffer so that long argument lists printed from spawn_guts do not overrun it so easily. * wait.cc (wait4): Set status flag to -1 prior to exit. This will cause previous wait that was interrupted by a signal which dispatched to another wait to return the correct error value. * winsup.h (pinfo): Add _sigtodo array for new signal method. Remove obsolete field. Reflect change in cygname arguments. Thu Jan 15 13:07:07 1998 Ian Lance Taylor * syscalls.cc (mkdir): Don't permit the directory to be created if the parent directory is not writable. * syscalls.cc (fchmod): Call chmod with the path name, rather than just returning zero. * syscalls.cc (writable_directory): New static function. (_unlink): Don't permit the file to be removed if the directory is not writable. (rename): Don't permit the rename if either the source or destination directory is not writable. * syscalls.cc (chown): Set username and groupname lengths to UNLEN + 1, rather than 100. If getpwuid fails, try to look up the real user name to see if it is the same. Don't report an error if there is no security mapping. Wed Jan 14 15:34:20 1998 Ian Lance Taylor * syscalls.cc (setegid): New function which just returns ENOSYS. (chroot): Likewise. * cygwin.din: Export setegid, _setegid, chroot, and _chroot. * syscalls.cc (setmode): Rename from _setmode. Change to return the old mode. Remove old setmode function. * cygwin.din: Make _setmode an alias for setmode. Wed Jan 14 14:46:00 1998 Geoffrey Noer * Makefile.in: don't strip cygwin.dll by default * winsup.h: minor reformatting, removed/reworded some comments Mon Jan 12 13:53:03 1998 Geoffrey Noer patch from cgf@bbc.com (Chris Faylor): Speed up cygwin pid calculation by staying in the range 1000 through (1000 + PSIZE - 1). * pinfo.cc (pinfo_list::init): Change to reflect new pid calculation method. (pinfo_list::operator []): Ditto. (pinfo_list::allocate_pid): Ditto. * winsup.h (pinfo): Move pid and ppid into non-zeroed region since they are always set by allocate_pid. (pinfo_list): Change pid_base to next_pid_index to reflect new pid calculation method. (PBASE): New constant for new pid calcuation method. Sat Jan 10 12:06:38 1998 Geoffrey Noer * syscalls.cc (process_deletion_queue): remove wrapper function (close_all_files): call s->delqueue.process_queue instead of going through wrapper. * fhandler.cc (fhandler_base::close): call s->delqueue.process_queue instead of using above wrapper. * winsup.h: remove process_deletion_queue proto * delqueue.h: up MAX_DELQUEUES_PENDING to 100 for now. Rename v to dqueue for clarity. * delqueue.cc: v renamed to dqueue throughout. Add FIXME describing why this whole delqueue system needs rewriting. Fri Jan 9 13:18:44 1998 Geoffrey Noer Remove some historical baggage: * syscalls.cc (cygwin_set_attributes): remove commented-out code, add FIXME since this function should go away next time an incompatible change to cygwin.din is made. Stop including include/sys/cygwin.h. * include/sys/cygwin.h: remove cygwin_set_attributes proto. Remove CYGWIN_FMODE_ALL_BINARY define. * hinfo (hinfo_vec::init_std_file_from_handle): remove old commented-out code * path.cc (unmixedcaseify): delete commented-out function (mixedcaseify): ditto * strerror.cc (strerror): delete commented-out code section Tue Jan 6 18:51:40 1998 Geoffrey Noer patch from cgf@bbc.com (Chris Faylor): Conform to POSIX method for sending SIGHUP to stopped processes. * dcrt0.cc (do_exit): Use new kill_pgrp function to kill orphaned children on group leader exit iff the children are stopped (per POSIX). * signal.cc (kill_worker): Negative signal now means to send a SIGCONT after the signal, to wake up the target process. (_kill): Break out pgrp handling into separate function. (kill_pgrp): New function pulled from _kill to send signals to processes in a given pgrp. Tue Jan 6 14:37:43 1998 Geoffrey Noer patch from cgf@bbc.com (Chris Faylor): * fhandler.cc (fhandler_base::open): include FILE_FLAG_BACKUP_SEMANTICS in file_attributes when file is a directory. Allows opening of directory as a file. Allows use of handle to perform some operations on both directories and files. (fhandler_base::fstat): Loop when attempting to get volume serial number. Works around an apparent Windows NT 3.51 bug. * times.cc (utimes): use FILE_FLAG_BACKUP_SEMANTICS flag to allow accessing directory times (may only work under NT; until now it didn't work under either OS). * winsup.h: Add O_DIROPEN constant. Mon Jan 5 19:18:01 1998 Geoffrey Noer * Makefile.in: make winsup.h depend on winsup.h in accordance with below patch from cgf@bbc.com (Chris Faylor): * {*.cc, *.h}: Remove include files already present in winsup.h. Change empty function parameter lists to (void) where appropriate. * fork.cc: Clean up include files. Minor change to CreateProcess parameter list. * signal.cc: Remove ifdef'ed stuff. * smallprint.c: Add a necessary include file. * winsup.h: Add a common include file. Add a function declaration for kill_pgrp. Mon Jan 5 18:30:37 1998 Geoffrey Noer Fix spoofing of directory inodes. * syscalls.cc (hash_path_name): instead of initializing the hash to zero, take the value of the initial hash as a new argument. (_stat_worker): fix up hash_path_name reference in light of above * dirsearch.cc (opendir): initialize dir->__d_dirhash to the hash of the full directory name so readdir can make use of it. (readdir): compute d_ino by combining the directory hash calculated by opendir with the hash of the filename. * fhandler.cc: fix up hash_path_name reference in light of above * winsup.h: remove unnecessary protos for getkey, kbhit. Adjust hash_path_name proto.