2003-12-07 Christopher Faylor Change use of BOOL, TRUE, FALSE to bool, true, false, as appropriate, throughout. 2003-12-07 Pierre Humblet * tty.cc (tty::common_init): Remove call to SetKernelObjectSecurity and edit some comments. 2003-12-07 Christopher Faylor * cygheap.h (init_cygheap::ctty): Add new element. * devices.in (device::parse): Remove special handling for /dev/tty. * devices.cc: Regenerate. * dtable.cc (build_fh_pc): Don't reset /dev/tty device. Let the device opener do that. * fhandler_termios.cc (tty_min::set_ctty): Redefine to _pinfo class. * fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Avoid setting noninherit flag for ctty. * tty.h: Move BOOLs to bools. (tty_min::set_ctty): Redeclare to _pinfo class. * pinfo.cc (_pinfo::set_ctty): Define new function based on tty_min::set_ctty. Change first argument from tty number to tty_min class. * pinfo.h (_pinfo::set_ctty): Declare. * fhandler_console.cc (fhandler_console::get_tty_stuff): Reflect move of set_ctty to _pinfo class. * fhandler_tty.cc (fhandler_tty_slave::open): Treat FH_TTY specially. Use saved cygheap value if it exists. Otherwise convert to real device and save on first time open. (fhandler_tty_common::dup): Potentially set controlling tty if duping a slave tty. * syscalls.cc (setsid): Close controlling tty in cygheap. * tty.cc: Change some BOOLs to bools. 2003-12-07 Pierre Humblet * syscalls.cc (locked_append): New. (updwtmp): Remove mutex code and call locked_append. (pututline): Ditto. 2003-12-06 Christopher Faylor * exceptions.cc (_threadinfo::remove): Avoid a linked list walk. 2003-12-06 Christopher Faylor * cygtls.h (_threadinfo::find_tls): New function. * exceptions.cc (_threadinfo::find_tls): Rename from find_tls. Use critical section to protect access to linked list. 2003-12-06 Christopher Faylor * exceptions.cc (_threadinfo::remove): Avoid returning without unlocking critical section in the (hopefully impossible) case of an unrecognized thread. 2003-12-06 Christopher Faylor * cygtls.h: Add more "don't parse this" guards. (_threadinfo::init_thread): Rename from 'init'. (_threadinfo::init): Declare new function. (_threadinfo::protect_linked_list): Declare new critical section. * dcrt0.cc (dll_crt0_1): Call init_thread to initialize thread stuff. (_dll_crt0): Call _threadinfo::init prior to invoking dll_crt0_1. * exceptions.cc (_threadinfo::init_thread): Rename from 'init'. (_threadinfo::init): Define new function. Protect linked list manipulation with new critical section. (_threadinfo::call): Reflect function name change. (_threadinfo::remove): Protect linked list manipulation with new critical section * gentls_offsets: Rework to allow multi-line "don't parse this" protection. * init.cc (dll_entry): Don't remove threads info stuff here since the remove function uses a critical section which can't be used during thread creation or destruction. * thread.cc (pthread::exit): Call _threadinfo remove function here. 2003-12-05 Christopher Faylor * cygthread.cc (cygthread::stub2): Remove myself from the list of threads monitored by signals since this thread will never call raise or sigwait. (cygthread::simplestub2): Ditto. Set ev here. (cygthread::cygthread): Don't set ev here for freerange thread. 2003-12-04 Christopher Faylor * path.cc (slash_unc_prefix_p): Allow '.' as a valid character after '\\' in a UNC path. 2003-12-04 Christopher Faylor * exceptions.cc (setup_handler): Remove ill-advised debugging output. 2003-12-04 Corinna Vinschen * include/cygwin/types.h (struct __fcntl64): Fix datatype of l_start. 2003-12-03 Corinna Vinschen Substitute 0x7fffffff and 0xffffffff by INT32_MAX and UINT32_MAX throughout, except in assembler code. 2003-12-03 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::lock): Use UINT32_MAX instead of 0xffffffff. Accomodate Win 9x bug in evaluating length of area to lock when given length is 0. 2003-12-03 Pierre Humblet * fhandler_disk_file.cc (fhandler_disk_file::lock): Interchange values of off_low and off_high. 2003-12-03 Corinna Vinschen * fcntl.cc (fcntl_worker): Remove static storage class. * flock.cc (flock): Use struct __flock64. Call fcntl_worker. Use Cygwin errno functions instead of accessing errno directly. * winsup.h: Declare fcntl_worker. 2003-12-03 Corinna Vinschen * fcntl.cc: Whitespace cleanup. 2003-12-03 Christopher Faylor * cygthread.cc (cygthread::stub): Properly establish _threadinfo environment. (cygthread::stub2): New function. (cygthread::simplestub): Ditto. (cygthread::simplestub2): New function. * cygthread.h (cygthread::stub2): Declare new function. (cygthread::simplestub2): Ditto. * cygtls.h (_threadinfo::call): Declare new function. (_threadinfo::call2): Ditto. * dcrt0.cc (dll_crt0_1): Accommodate new _threadinfo::init which doesn't return pointer to tls. (_dll_crt0): Remove obsolete DECLARE_TLS_STORAGE. (dll_crt0): Ditto. * exceptions.cc (_threadinfo::call): New function. (_threadinfo::call2): Ditto. (_threadinfo::init): Don't return pointer. * thread.cc (pthread::thread_init_wrapper): Properly establish _threadinfo environment. (pthread::thread_init_wrapper2): New function. * thread.h (pthread::thread_init_wrapper): Remove noreturn attribute (pthread::thread_init_wrapper2): Declare new function. * winbase.h: Remove obsolete code. 2003-12-02 Christopher Faylor * Makefile.in: Change the way that -f options are appended to CFLAGS, slightly. 2003-12-02 Christopher Faylor * fcntl.cc (_fcntl): Silence a compiler warning. 2003-12-02 Pierre Humblet * pinfo.cc (pinfo::init): Use shared_name to construct the mapname. 2003-12-01 Thomas Pfaff * thread.cc (pthread_rwlock::add_reader): Remove mx parameter for List_insert call. (pthread::prepare): Ensure race safeness when adding function pointers to atfork lists by using List_insert. * thread.h (List_insert): Use InterlockedCompareExchangePointer to ensure race safeness without using a mutex. (List_remove): Use InterlockedCompareExchangePointer to ensure race safeness with List_insert. (List::insert): Remove mx parameter for List_insert call. 2003-12-01 Corinna Vinschen * Makefile.in (OBSOLETE_FUNCTIONS): Add fcntl. (NEW_FUNCTIONS): Add fcntl64. * cygwin.din: Export fcntl64. Make fcntl being SIGFE. * fcntl.cc (fcntl_worker): New function. (fcntl64): New function. (_fcntl): Call fcntl_worker. Convert 32 bit flock structure into 64 bit flock structure and vice versa. * fhandler.cc (fhandler_base::lock): Change 2nd parameter to struct __flock64 *. * fhandler_disk_file.cc (fhandler_disk_file::lock): Ditto. Rework to be 64 bit aware. * fhandler.h: Accomodate above method argument changes. * include/cygwin/types.h: Add struct __flock32 and __flock64. Define struct flock according to setting of __CYGWIN_USE_BIG_TYPES__. * include/cygwin/version.h: Bump API minor number. 2003-12-01 Corinna Vinschen * cygheap.cc (cygheap_init): Set cygheap->shared_prefix. * cygheap.h (struct init_cygheap): Add shared_prefix. * shared.cc (shared_name): Use cygheap->shared_prefix. 2003-12-01 Pierre Humblet * shared.cc (shared_name): Take into account the SE_CREATE_GLOBAL_NAME privilege when building the name string. (open_shared): Remove the call to OpenFileMapping. (shared_info::initialize): Move cygheap initialization to ... (memory_init): ... here. Suppress now useless shared_h variable. (user_shared_initialize): Make tu a cygpsid. 2003-12-01 Dr. Volker Zell * include/tzfile.h: Remove duplicate definition of TM_SUNDAY. * localtime.cc: Point TZDIR to the /usr/share/zoneinfo directory used by the tzcode package. 2003-11-30 Corinna Vinschen * flock.cc: Renamed from flock.c. 2003-11-29 Christopher Faylor * pinfo.h: Remove global_sigs declaration. * siginfo.h: Move global_sigs declaration here. * Makefile.in: Remove duplicate compiler flag. 2003-11-29 Christopher Faylor * exceptions.cc (_threadinfo::pop): Zero *contents* of popped stack location rather than the actual stack pointer. 2003-11-29 Nicholas Wourms * Makefile.in: (DLL_OFILES): Add flock.o. * cygwin.din: Export flock. * flock.c: New file. * include/sys/file.h: Include sys/cdefs.h. Add function prototype for flock(). Add some comments from BSD's header for further clarity. (L_SET, L_CURR, L_INCR, L_XTND): Redefine as the macros SEEK_SET, SEEK_CUR, SEEK_CUR, & SEEK_END respectively. (LOCK_SH,LOCK_EX,LOCK_NB,LOCK_UN): New macros for flock(). * include/cygwin/version.h: Bump API minor number. 2003-11-28 Christopher Faylor * sigproc.cc (no_signals_available): Fix so that non-zero exit state is a true condition rather than errnoneously only checking other states when exist_state was zero. 2003-11-28 Christopher Faylor * pinfo.h (_pinfo::getthread2signal): Remove obsolete function. * cygtls.h (_threadinfo): Define tid more precisely. (_threadinfo::operator HANDLE): Define. * exceptions.cc (_threadinfo::interupt_now): Use _threadinfo HANDLE operator to derive thread handle. (setup_handler): Ditto. * sigproc.cc: Reorganize includes. 2003-11-28 Christopher Faylor * pinfo.h (_pinfo::getsig): Remove obsolete function, here and throughout. * exceptions.cc: Ditto. * fhandler_termios.cc: Ditto. * signal.cc: Ditto. * sigproc.cc: Ditto. * Makefile.in: Revert previous change which made a cygwin.din newer than a version.h a warning rather than an error. 2003-11-28 Christopher Faylor * cygwin.din: Re-add inexplicably missing semaphore/msg functions. 2003-11-28 Christopher Faylor * gendevices: Issue error when shilka is missing. 2003-11-28 Christopher Faylor * include/cygwin/signal.h: New file. 2003-11-28 Christopher Faylor Eliminate use of sigframe and sigthread throughout. * Makefile.in (DLL_OFILES): Add sigfe.o. Remove reliance on cygwin.def from cygwin0.dll dependency since dependence on sigfe.o implies that. Generate def file on the fly using 'gendef'. * configure.in: Don't auto-generate cygwin.def. * configure: Regenerate. * cygwin.din: Add SIGFE stuff where appropriate. * dcrt0.cc (dll_crt0_1): Initialize cygwin tls early in process startup. Set _main_tls to address of the main thread's cygwin tls. * debug.h: Remove now unneeded WFSO and WFMO declarations. * exceptions.cc (_last_thread): Define. (set_thread_state_for_signals): New function. (reset_thread_exception_for_signals): Ditto. (init_thread_for_signals): Ditto. (delete_thread_for_signals): Ditto. (capture_thread_for_signals): Ditto. (handle_exceptions): Set return address explicitly for exceptions prior to calling sig_send. (interrupt_on_return): Eliminate. (setup_handler): Add preliminary implementation for dealing with thread-specific signals by querying _main_tls. (signal_exit): Use cygthread::main_thread_id instead of mainthread.id. (call_signal_handler_now): For now, just handle the main thread. * fork.cc (vfork): Save and restore main _my_tls. * gendef: New file. Generates def file and sigfe.s file. * gentls_offsets: New file. Generates offsets for perl to use in sigfe.s. * how-signals-work.txt: Mention that info is obsolete. * init.cc (dll_entry): Initialize cygwin tls storage here. * miscfuncs.cc (low_priority_sleep): Make a C function for easier calling from asm. * perthread.h (vfork_save::tls): New element. * signal.cc (nanosleep): Replace previous use of sigframe.call_signal_handler_now with straight call to call_signal_handler_now. (abort): Ditto. * syscalls.cc (readv): Ditto. * termios.cc (tcsetattr): Ditto. * wait.cc (wait4): Ditto. * sigproc.cc (sig_dispatch_pending): Ditto. (sig_send): Ditto. * sigproc.h: Declare call_signal_handler_now. * thread.cc (pthread::thread_init_wrapper): Initialize cygwin tls. Remove obsolete and unworking signal stuff. * thread.h (verifyable_object::sigs): Eliminate. (verifyable_object::sigmask): Eliminate. (verifyable_object::sigtodo): Eliminate. (verifyable_object::exit): Make attribute noreturn. (verifyable_object::thread_init_wrapper): Ditto. (pthread_null::exit): Ditto. * winbase.h (__stackbase): Always define. * winsup.h (low_priority_sleep): Declare as a "C" function. * include/cygwin/version.h: Bump API version to reflect sigwait export. * include/sys/queue.h: Protect SLIST_ENTRY from previous declaration. * signal.cc (sigwait): Implement. * select.cc (fhandler_base::ready_for_read): Add debugging output. * devices.h: Define more device pointers via their storage. * devices.in: Don't parse things like /dev/inet/tcp, as they really have no meaning. * devices.cc: Regenerate. * gendevices: Set proper protection for output file. * cygtls.h: New file. * gendef: New file. * gentls_offsets: New file. * tlsoffsets.h: New file. Autogenerated. * config/i386/longjmp.c: Remove. File subsumed by gendef output. * config/i386/makefrag: Remove obsolete file. * fhandler.cc: Remove spurious access_worker declaration. * spawn.cc (spawnve): Make debugging output more accurate. * cygwin-gperf: Remove. * devices.cc: Remove. 2003-11-28 Christopher Faylor * speclib: Use correct EOF marker. Ensure that directory is actually deleted when running under Windows. 2003-11-27 Christopher Faylor * fhandler_disk_file.cc (fhandler_disk_file::readdir): Reorganize to avoid inappropriate .lnk extensions with munged filenames under managed mode. 2003-11-26 Corinna Vinschen * sec_helper.cc (set_process_privilege): Rename restore_priv to priv_luid. 2003-11-26 Pierre Humblet * sec_helper.cc (set_process_privilege): Call LookupPrivilegeValue before opening the token. 2003-11-26 Corinna Vinschen * dir.cc (mkdir): Use local security_descriptor. Call set_security_attribute appropriately. * external.cc (cygwin_internal): Ditto. * fhandler.cc (fhandler_base::open): Ditto. * fhandler_socket.cc (fhandler_socket::bind): Ditto. * path.cc (symlink_worker): Ditto. * sec_acl.cc (setacl): Ditto. Call read_sd appropriately. (getace): Ditto. * sec_helper.cc (security_descriptor::malloc): New method. (security_descriptor::realloc): New method. (security_descriptor::free): New method. * security.cc (read_sd): Get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. Drop unnecessary parameter check. Allocate the security_descriptor buffer according to size returned by a call to GetFileSecurity. Return buffer size on success. (write_sd): Get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. (get_nt_attribute): Use local security_descriptor. (get_nt_object_attribute): Ditto in case of type == SE_REGISTRY_KEY. Allocate security_descriptor buffer according to size returned by a call to RegGetKeySecurity. (alloc_sd): Make static. Get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. Drop unnecessary parameter check. (set_security_attribute): Get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. (set_nt_attribute): Use local security_descriptor. (check_file_access): Ditto. * security.h: Add class security_descriptor. (read_sd): Change declaration to get security_descriptor as parameter instead of PSECURITY_DESCRIPTOR and a size. (write_sd): Ditto. (set_security_attribute): Ditto. (alloc_sd): Remove declaration. * thread.cc (semaphore::semaphore): Use local security_descriptor. Call set_security_attribute appropriately. 2003-11-26 Corinna Vinschen * sec_acl.h (getace): Use FILE_*_BITS as permission mask. * security.cc (get_attribute_from_acl): Ditto. * security.h (FILE_READ_BITS): Define to match also GENERIC bits. (FILE_WRITE_BITS): Ditto. (FILE_EXEC_BITS): Ditto. 2003-11-25 Christopher Faylor * thread.cc: Minor whitespace cleanup. Remove some obsolete code. 2003-11-24 Christopher Faylor * dtable.cc (build_fh_name): Set error in dummy fhandler when one is noted during path_conv. * fhandler.h (fhandler_base::set_error): New method. 2003-11-24 Christopher Faylor * configure.in: Avoid using cygserver unless hosting on cygwin. 2003-11-23 Christopher Faylor * sigproc.cc (sig_send): Correct below checkin. Use thisframe.call_signal_handler. 2003-11-23 Christopher Faylor * sigproc.cc (proc_exists): A zombie process does not exist. (sig_send): Improve debugging output. Wait for pipe to be created before trying to send to it. Call call_signal_handler_now if sending a signal to myself. 2003-11-22 Christopher Faylor * dcrt0.cc (check_sanity_and_sync): Correct api major version check so that newer dlls will work with older apps but not vice versa. 2003-11-21 Christopher Faylor * sem.cc: Always include signal.h to handle SIGSYS raise when !USE_SERVER. * shm.cc: Ditto. 2003-11-21 Christopher Faylor * msg.cc: Always include signal.h to handle SIGSYS raise when !USE_SERVER. 2003-11-20 Christopher Faylor * configure.in: Make --use-server the default. Remove powerpc target. * configure: Regenerate. 2003-11-20 Corinna Vinschen * msg.cc (msgctl): Raise SIGSYS if call not available. (msgget): Ditto. (msgrcv): Ditto. (msgsnd): Ditto. * sem.cc (semctl): Ditto. (semget): Ditto. (semop): Ditto. * shm.cc (shmat): Ditto. (shmctl): Ditto. (shmget): Ditto. (shmdt): Ditto. 2003-11-19 Corinna Vinschen * cygserver.h (client_request::request_code_t): Add CYGSERVER_REQUEST_MSG and CYGSERVER_REQUEST_SEM. (admininstrator_group_sid): Add extern declaration. * cygserver_ipc.h: Rewrite. * cygserver_msg.h: New file. * cygserver_sem.h: New file. * cygserver_shm.h: More or less rewrite. * cygwin.din: Add msgctl, msgget, msgrcv, msgsnd, semctl, semget and semop. * msg.cc: Rewrite. * safe_memory.h: Remove. * sem.cc: Rewrite. * shm.cc: Rewrite. * include/cygwin/ipc.h: Use appropriate guard. (struct ipc_perm): Add seq. (IPCID_TO_IX): New define from BSD. (IPCID_TO_SEQ): Ditto. (IXSEQ_TO_IPCID): Ditto. (IPC_R): Ditto. (IPC_W): Ditto. (IPC_M): Ditto. * include/cygwin/msg.h: Use appropriate guard. #ifdef _KERNEL all stuff not explicitely defined by SUSv3. Use signed types in structs to match types used in BSD. (msgqnum_t): Define unsigned. (msglen_t): Ditto. (struct msqid_ds): Add msg_first and msg_last. (struct msginfo): Remove msgpool. Add msgssz and msgseg. * include/cygwin/sem.h: Use appropriate guard. #ifdef _KERNEL all stuff not explicitely defined by SUSv3. Use signed types in structs to match types used in BSD. (SEM_UNDO): Define appropriately. (struct semid_ds): Add sem_base. (struct seminfo): Add semmap and semusz. (SEM_A): New define from BSD. (SEM_R): Ditto. (SEM_ALLOC): Ditto. (union semun): Define. * include/cygwin/shm.h: Use appropriate guard. #ifdef _KERNEL all stuff not explicitely defined by SUSv3. Use signed types in structs to match types used in BSD. (SHMLBA): Define using cygwin_internal(CW_GET_SHMLBA) call. (struct shmid_ds): Add shm_internal. (struct shm_info): Rename shm_ids to used_ids as in BSD. Add define for shm_ids. * include/cygwin/sysproto.h: New file. * include/cygwin/version.h: Bump API minor number. * include/sys/ipc.h: New file. * include/sys/msg.h: New file. * include/sys/queue.h: New file from BSD. * include/sys/sem.h: New file. * include/sys/shm.h: New file. * include/sys/sysproto.h: New file. 2003-11-19 Corinna Vinschen * dtable.cc (build_fh_pc): Resurrect accidentally removed DEV_CYGDRIVE_MAJOR case. 2003-11-17 Brian Ford * fhandler.cc (fhandler_base::lseek): Include high order offset bits in return value. 2003-11-17 Corinna Vinschen * bsdlib.cc (getprogname): New function. (setprogname): New funtion. * cygwin.din: Export getprogname and setprogname. * include/cygwin/version.h: Bumb API version number. 2003-11-15 Christopher Faylor * include/limits.h: Revert unsanctioned changes below. * include/cygwin/config.h: Ditto. * include/sys/param.h: Ditto. 2003-11-14 Robert Collins Ron Parker * bsdlib.cc: Update throughout to use CYG_MAX_PATH rather than MAX_PATH. * cygheap.h: Ditto. * dcrt0.cc: Ditto. * delqueue.cc: Ditto. * dlfcn.cc: Ditto. * dll_init.cc: Ditto. * dll_init.h: Ditto. * dtable.cc: Ditto. * environ.cc: Ditto. * environ.h: Ditto. * exceptions.cc: Ditto. * external.cc: Ditto. * fhandler_disk_file.cc: Ditto. * fhandler_proc.cc: Ditto. * fhandler_process.cc: Ditto. * fhandler_raw.cc: Ditto. * fhandler_registry.cc: Ditto. * fhandler_socket.cc: Ditto. * fhandler_virtual.cc: Ditto. * miscfuncs.cc: Ditto. * mmap.cc: Ditto. * netdb.cc: Ditto. * path.cc: Ditto. * path.h: Ditto. * pinfo.cc: Ditto. * pinfo.h: Ditto. * pthread.cc: Ditto. * registry.cc: Ditto. * shared.cc: Ditto. * shared_info.h: Ditto. * smallprint.c: Ditto. * spawn.cc: Ditto. * strace.cc: Ditto. * syscalls.cc: Ditto. * thread.h: Ditto. * uinfo.cc: Ditto. * winsup.h: Ditto. * include/limits.h: Ditto. * include/cygwin/config.h: Ditto. * include/sys/param.h: Ditto. 2003-11-12 Brian Ford * dtable.cc (build_fh_pc): Use DEV_SERIAL_MAJOR to catch all serial ports. Remove redundant FH_CYGDRIVE case since it is handled by DEV_CYGDRIVE_MAJOR. 2003-11-11 Christopher Faylor Thomas Pfaff * thread.cc (pthread::exit): Cleanup on thread exit. (__reent_t::init_clib): Set thread local clib __cleanup var appropriately. 2003-11-10 Christopher Faylor * miscfuncs.cc (low_priority_sleep): Make a "C" function. * winsup.h (low_priority_sleep): Revert previous change to declaration. 2003-11-10 Corinna Vinschen * winsup.h (low_priority_sleep): Fix declaration to avoid linker warning. 2003-11-10 Thomas Pfaff * thread.cc (__reent_t::init_clib): Set thread local clib __sdidinit var appropriately. 2003-11-08 Corinna Vinschen * syscalls.cc (ftruncate64): Log length as long long. (logout): Erase ut_host. Don't write wtmp entry. Return 1 only if matching utmp entry has been found, 0 otherwise. 2003-11-08 Corinna Vinschen * external.cc (cygwin_internal): Add CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID handling. * include/cygwin/version.h: Bump API minor number. * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_UID_FROM_SID and CW_GET_GID_FROM_SID. 2003-11-07 Christopher Faylor * fhandler_disk_file.cc (fhandler_disk_file::opendir): Reorganize to handle freeing of memory on error condition. 2003-11-07 Christopher Faylor * cygthread.cc (cygthread::freerange): Set inuse count. Avoid setting ev from h as h would be NULL at this point. (cygthread::operator new): Issue debugging info when overflowing the thread pool. (cygthread::cygthread): Set ev from h here after h has been initialized. 2003-11-06 Corinna Vinschen * bsdlib.cc (_vwarnx): New function. (vwarn): Ditto. (vwarnx): Ditto. (warn): Ditto. (warnx): Ditto. (verr): Ditto. (verrx): Ditto. (err): Ditto. (errx): Ditto. * cygwin.din: Export above functions. * include/err.h: New file. * include/cygwin/version.h: Bump API minor number. 2003-11-06 Corinna Vinschen * syscalls.cc (getshmlba): New function. * external.cc (cygwin_internal): Add CW_GET_SHMLBA handling. * mmap.cc (mmap64): Call getshmlba to evaluate granularity. * winsup.h (getshmlba): Add declaration. * include/cygwin/version.h: Bump API minor number. * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_SHMLBA. 2003-11-06 Christopher Faylor * winsup.h: Declare access_worker. 2003-11-05 Corinna Vinschen * include/cygwin/types.h: Fix preprocessor guards for vm_offset_t and vm_size_t. Add typedef for vm_object_t. 2003-11-05 Christopher Faylor * fhandler_disk_file.cc (fhandler_disk_file::opendir): Detect attempt to open a directory which lacks read privileges. 2003-11-04 Corinna Vinschen * external.cc (cygwin_internal): Add CW_GET_POSIX_SECURITY_ATTRIBUTE handling. * include/cygwin/version.h: Bump API minor number. * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_POSIX_SECURITY_ATTRIBUTE. * exceptions.cc (init_global_security): Move from here... * sec_helper.cc (init_global_security): ...to here. 2003-11-04 Christopher Faylor * net.cc (dup_ent): Use IsBadStringPtr for alignment checks. Don't use a known bad pointer. 2003-11-03 Corinna Vinschen * net.cc (dup_ent): Move Win 95 misalignment recogition before trying to evaluate string length. 2003-10-31 Thomas Pfaff * thread.cc (pthread::thread_init_wrapper): Initialize exception handling. 2003-10-31 Thomas Pfaff Rename pthread::running to pthread::valid throughout. * thread.h: (pthread::suspend_all_except_self): New static method. (pthread::resume_all): Ditto. (pthread::suspend_except_self): New method. (pthread::resume): Ditto. * thread.cc (pthread::suspend_except_self): Implement. (pthread::resume): Ditto. 2003-10-29 Danny Smith * include/stdint.h: Prevent signed->unsigned conversion for 32 and 64 bit min value constants. 2003-10-28 Igor Pechtchanski * path.cc (dot_special_chars): New global variable. (special_name): Make files ending in "." special. (fnunmunge): Allow encoded ".". (mount_item::fnmunge): Handle trailing ".". 2003-10-28 Christopher Faylor * include/stdint.h: Duplicate below effort for rest of *64_*. 2003-10-28 Christopher Faylor * include/stdint.h: Correctly define INT64_MAX. 2003-10-27 Thomas Pfaff * thread.h (fast_mutex::init): Initialize lock_counter. 2003-10-27 Corinna Vinschen * Makefile.in (OBSOLETE_FUNCTION): Add tmpfile. (NEW_FUNCTIONS): Add _tmpfile64 -> tmpfile translation. * cygwin.din: Export _tmpfile64 * include/cygwin/version.h: Bump api minor number. 2003-10-27 Corinna Vinschen * cygwin.din: Add sem_close, sem_getvalue, sem_open and sem_timedwait. * pthread.cc (+mangle_sem_name): New function. (sem_open): Ditto. (sem_close: Ditto. (sem_timedwait): Ditto. (sem_getvalue): Ditto. * thread.cc (semaphore::semaphore): Rearrange member initialization. Use appropriate security attribute for process shared semaphores. (semaphore::semaphore): New constructor for named semaphores. (semaphore::~semaphore): Care for semaphore name. (semaphore::_post): Accomodate failing ReleaseSemaphore. Use value returned by ReleaseSemaphore vor currentvalue. (semaphore::_getvalue): New method. (semaphore::_timedwait): Ditto. (semaphore::_fixup_after_fork): Rearrange. Don't fail for process shared semaphores. (semaphore::open): New method. (semaphore::timedwait): Ditto. (semaphore::post): Fix return value. Set errno appropriately. (semaphore::getvalue): New method. * thread.h (class semaphore): Add prototypes for open, getvalue, timedwait, _getvalue, _timedwait. Add prototypes for new constructor. Add name member. * include/semaphore.h: Add prototypes for sem_open, sem_close, sem_timedwait and sem_getvalue. include/cygwin/version.h: Bump API minor number. 2003-10-27 Corinna Vinschen * miscfunc.cc (__check_invalid_read_ptr): New function. * winsup.h: Declare. 2003-10-26 Corinna Vinschen * security.h (cygpsid::debug_print): Avoid compiler warnings. 2003-10-25 Corinna Vinschen * path.cc (normalize_posix_path): Test runs of more than two dots for being a run of only dots. Let it pass if not. 2003-10-25 Brian Ford * fhandler.cc (fhandler_base::ioctl): Handle FIONBIO. 2003-10-24 Thomas Pfaff Rename native_mutex to fast_mutex throughout. Rename pthread_key::save_key_to_buffer to pthread_key::_fixup_before_fork throughout. Rename pthread_key::recreate_key_from_buffer to pthread_key::_fixup_after_fork throughout. * thread.cc (native_mutex::init): Remove. (native_mutex::lock): Ditto. (native_mutex::unlock): Ditto. (pthread::push_cleanup_handler): InterlockedExchangePointer is not needed here. (pthread_rwlock::pthread_rwlock): Initialize readers list mutex. (pthread_rwlock::add_reader): Add reader via List_insert. (pthread_rwlock::lookup_reader): Lock list while walking through. (pthread_cond::init): Locking the init mutex is now void. (pthread_rwlock::init): Ditto. (pthread_mutex::init): Ditto. * thread.h: Include security.h. (fast_mutex): New class. Replacement for native_mutex. (List_insert): New template function. (List_remove): Ditto. (List::List): Initialize synchronising mutex. (List::fixup_after_fork): New method. (List::insert): Add node via List_insert. (List::remove): Remove node via List_remove. (List::pop): Remove. (List::for_each): Lock list while walking through. (List::mx_init): New method. (pthread_mutex::fixup_after_fork): Fixup mutex list after fork. (pthread::fixup_after_fork): Ditto. (pthread_conds::fixup_after_fork): Ditto. (pthread_rwlock::fixup_after_fork): Ditto. (semaphore::fixup_after_fork): Ditto. (pthread_rwlock::readers_mx): New member. 2003-10-24 Brian Ford * fhandler.cc (fhandler_base::fcntl): Don't clobber O_APPEND when both O_NONBLOCK/O_NDELAY are set for F_SETFL. 2003-10-24 Corinna Vinschen * path.cc (win32_device_name): Fix comment. 2003-10-23 Christopher Faylor * fhandler_tty.cc (fhandler_tty_slave::ioctl): Properly set return value in FIONBIO case. 2003-10-23 Corinna Vinschen * fhandler_proc.cc (format_proc_partitions): Use new device code to get major and minor device numbers. Fix size evaluation. 2003-10-22 Corinna Vinschen * external.cc (cygwin_internal): Add CW_GET_ERRNO_FROM_WINERROR handling. * include/cygwin/version.h: Bump API minor number. * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_ERRNO_FROM_WINERROR. 2003-10-22 Corinna Vinschen * Makefile.in: Add $(LIBSERVER) rule. * cygserver.h: Moved from include/cygwin to here. * cygserver_ipc.h: Moved from ../cygserver to here. * cygserver_shm.h: Ditto. * cygwin.din: Add shmat, shmctl, shmdt and shmget. * fhandler_tty.cc (fhandler_tty_slave::open): Don't warn about handle dup'ing if not build with USE_SERVER. * shm.cc: Include cygerrno.h unconditionally. (shmat): Set errno to ENOSYS and return -1 if not build with USE_SERVER. (shmctl): Ditto. (shmdt): Ditto. (shmget): Ditto. * woutsup.h: Remove. * include/cygwin/cygserver_process.h: Moved to ../cygserver directory. * include/cygwin/cygserver_transport.h: Ditto. * include/cygwin/cygserver_transport_pipes.h: Ditto. * include/cygwin/cygserver_transport_sockets.h: Ditto. * include/cygwin/version.h: Bump API minor number. 2003-10-16 Pierre Humblet * syscalls.cc (seteuid32): Always construct a default DACL including the new sid, Admins and SYSTEM and copy it to the new thread token. * security.cc (create_token): Use a NULL default DACL in NtCreateToken. 2003-10-14 Micha Nelissen * dcrt0.cc: Remove local variable alternate_charset_active. * fhandler.h: Add variable alternate_charset_active, functions str_to_con, con_to_str to dev_console structure. * fhandler_console.cc (con_to_str): Move function into dev_console class. (str_to_con): Ditto. (fhandler_console::read): Call con_to_str on dev_state. (fhandler_console::write_normal): Call str_to_con on dev_state. (fhandler_console::char_command): Change active_charset_active assignment to be on dev_state. * winsup.h: Remove global external variable alternate_charset_active. 2003-10-13 Micha Nelissen * fhandler_console.cc (char_command): Add escape sequence for codepage ansi <-> oem switching for ncurses frame drawing capabilities. * dcrt0.cc: Add local variable alternate_charset_active. * winsup.h: Add global external variable alternate_charset_active. 2003-10-14 Corinna Vinschen * exceptions.cc (ctrl_c_handler): Don't send SIGHUP on CTRL_LOGOFF_EVENT to processes running in invisible Windows Stations. * window.cc (has_visible_window_station): New function. * winsup.h: Add declaration for has_visible_window_station. 2003-10-10 Christopher Faylor * fhandler_tty.cc (fhandler_tty_slave::open): Don't create a new window station if one already exists. 2003-10-10 Christopher Faylor * shared.cc (shared_info::initialize): Remove myself check since hMainProc initialization will allow user initialization to work. 2003-10-09 Yitzchak Scott-Thoennes * include/sys/mman.h (MAP_FAILED): Define as void *. 2003-10-08 Christopher Faylor * dcrt0.cc (hMainProc): Initialize to useful value for use when dll is dynamically loaded. * shared.cc (shared_info::initialize): Don't initialize user stuff if myself doesn't exist. 2003-10-08 Corinna Vinschen * syscalls.cc (unlink): Don't even try DELETE_ON_CLOSE technique on systems not supporting it. 2003-10-02 Christopher Faylor * dcrt0.cc (dll_crt0_1): Call newlib __sinit routine to ensure that stdio buffers are initialized to avoid thread initialization races. 2003-10-01 Christopher Faylor * path.cc (win32_device_name): Only fill out destination buffer when it's really a device. 2003-09-30 Christopher Faylor * Makefile.in: Add YA method for generating devices.cc. * child_info.h: YA update of another magic number. * gendevices: New file. * devices.in: New file. * devices.cc: Regenerate. * devices.shilka: Remove. * devices.h: Correctly define device pointers. (device): Remove now obsolete fields. (device::native): Renamed from device::fmt. * dtable.cc (build_fh_dev): Simplify in light of new unit parsing scheme. (build_fh_pc): Ditto. * path.cc (win32_device_name): Ditto. * fhandler.h (fhandler_base::get_native_name): Reflect renaming of fmt to native. * fhandler_tty.cc (fhandler_tty_mster::init): Initialize slave device prior to reporting unit. 2003-09-30 Corinna Vinschen * fhandler.cc (fhandler_base::fstat): Drop FH_FLOPPY case. 2003-09-30 Corinna Vinschen * fhandler.h (class fhandler_dev_raw): Add method fstat. * fhandler_raw.cc (fhandler_dev_raw::fstat): New method. 2003-09-30 Corinna Vinschen * devices.h (enum fh_devices): Remove DEV_RAWDRIVE_MAJOR and FH_RAWDRIVE. * devices.shilka (dev_rawdrive_storage): Remove. (unit_devices): Remove pointer to dev_rawdrive_storage. (uniq_devices): Remove rawdrive entry. * dtable.cc (build_fh_pc): Remove DEV_RAWDRIVE_MAJOR case. * path.cc (win32_device_name): ditto. 2003-09-29 Corinna Vinschen * syslog.cc (vsyslog): Print debug message if ReportEventA fails. 2003-09-28 Pierre Humblet * sigproc.cc (proc_subproc): Restrict permissions on ppid_handle. 2003-09-28 Christopher Faylor * devices.shilka (device::parse): Restore check for tty in unit handling, but without the previous typo. * devices.cc: Regenerate. * devices.h (DEV_CYGDRIVE_MAJOR): Change major number to one used by linux for "user-mode virtual block device". 2003-09-28 Corinna Vinschen * devices.h: Move a few device major numbers. Fix typo of FH_UDP. * device.shilka: Remove /dev/hd device entries, rename all device_hd* to device_sd*. (device::parse): Disallow units outside lower and upper bounds. * dtable.cc (build_fh_pc): Fix typo of FH_UDP. * path.cc (win32_device_name): Fix win32 name creation to match new device handling. 2003-09-27 Christopher Faylor * device.shilka (device::parse): Allow units on other than tty. 2003-09-27 Corinna Vinschen * wincap.cc (wincapc::init): Allow requesting server info for NT4 SP6. 2003-09-27 Christopher Faylor * path.cc (symlink_info::check): Use new introducer for mknod'ed files. (parse_device): Ditto. * syscalls.cc (mknod_worker): Ditto. 2003-09-27 Christopher Faylor * devices.shilka: Add /dev/sda disk devices. * devices.cc: Regenerate. 2003-09-27 Christopher Faylor * cygwin-shilka: Remove '#line directives' or suffer debugging oddities. Use -length option so that device prefixes are used. * devices.cc: Regenerate. * syscalls.cc (ttyname): Add debugging output. 2003-09-26 Vaclav Haisman * Makefile.in: Add libusr32.a to DLL_IMPORTS. * wincap.h (wincaps::is_server): New flag. (wincapc::version): Change type to OSVERSIONINFOEX. (wincapc::is_server): New function. * wincap.cc (wincap_unknown::is_server): New initializer. (wincap_95): Ditto. (wincap_95osr2): Ditto. (wincap_98): Ditto. (wincap_me): Ditto. (wincap_nt3): Ditto. (wincap_nt4): Ditto. (wincap_nt4sp4): Ditto. (wincap_2000): Ditto. (wincap_xp): Ditto. (wincapc::init): Adapt to OSVERSIONINFOEX. Add detection of NT server systems. * sched.cc: Include windows.h and registry.h. (sched_rr_get_interval): Re-implement for NT systems. 2003-09-26 Christopher Faylor * fhandler_tty.cc (fhandler_tty_slave::ioctl): Properly set ioctl_request event when window size changes. Store failing errno in ioctl_retval (needed?). 2003-09-26 Pavel Tsekov * fhandler_console.c (fhandler_console::read): Record the state of the SHIFT, CTRL and ALT keys at the time of the last keyboard input event. (fhandler_console::ioctl): Handle requests to retrieve the keyboard modifiers via the TIOCLINUX command. * fhandler_tty.c (fhandler_tty_slave::read): Ditto. * include/sys/termios.h (TIOCLINUX): New macro definition. 2003-09-26 Pierre Humblet * pinfo.cc (pinfo::init): Do not give FILE_MAP_WRITE access to Everybody. * exceptions.cc (sig_handle_tty_stop): Do not create pinfo parent with PID_MAP_WRITE. * fhandler_process.cc (fhandler_process::fill_filebuf): Ditto for pinfo p. * signal.cc (kill_worker): Ditto for pinfo dest. 2003-09-26 Pierre Humblet * pinfo.h (pinfo::set_acl): Declare. * pinfo.cc (pinfo_fixup_after_fork): Duplicate with no rights. (pinfo::set_acl): New. * spawn.cc (spawn_guts): Call myself.set_acl. 2003-09-26 Pierre Humblet * uinfo.cc (cygheap_user::init): Make sure the current user appears in the default DACL. Rearrange to decrease the indentation levels. Initialize the effec_cygsid directly. (internal_getlogin): Do not reinitialize myself->gid. Open the process token with the required access. * cygheap.h (class cygheap_user): Delete members pid and saved_psid. Create members effec_cygsid and saved_cygsid. (cygheap_user::set_sid): Define inline. (cygheap_user::set_saved_sid): Ditto. (cygheap_user::sid): Modify. (cygheap_user::saved_sid): Modify. * cygheap.cc (cygheap_user::set_sid): Delete. (cygheap_user::set_saved_sid): Ditto. * sec_helper.cc (sec_acl): Set the correct acl size. * autoload.cc (FindFirstFreeAce): Add. * security.h: Define ACL_DEFAULT_SIZE. 2003-09-26 Corinna Vinschen * mmap.cc (munmap): Use correct address and length parameters when calling fhandler's munmap. 2003-09-26 Corinna Vinschen * spawn.cc (spawn_guts): Set errno to E2BIG if command line is longer than CreateProcess allows (32K). 2003-09-25 Christopher Faylor * dtable.cc (build_fh_name): Return pointer to a 'nodevice' rather than a NULL pointer or suffer SEGVs with invalid paths. 2003-09-25 Christopher Faylor * fork.cc (fork_parent): Detect failed pinfo constructor. * spawn.cc (spawn_guts): Don't overwrite ENOMEM errno on failed pinfo constructor. 2003-09-25 Christopher Faylor * spawn.cc (spawnve): Remove vfork short circuit and let caller deal with error return. 2003-09-25 Pierre Humblet Christopher Faylor * spawn.cc (spawn_guts): Catch potential error from pinfo.remember. Change debug messages to make sense. Pass correct value to pinfo constructor. Ensure cleanup after errors. Always reimpersonate after errors. 2003-09-25 Christopher Faylor * spawn.cc (spawn_guts): Move system signal handling stuff after CreateProcess error check. 2003-09-25 Pierre Humblet * shared_info.h: Update CURR_USER_MAGIC, CURR_SHARED_MAGIC and SHARED_INFO_CB. (mount_info::cb): Delete. (mount_info::version): Delete. (shared_info::delqueue): Delete. * Makefile.in: Do magic for USER_MAGIC, class user_info, instead of for mount_info. 2003-09-24 Christopher Faylor * include/tzfile.h: Add some missing entries. 2003-09-24 Christopher Faylor * include/paths.h: Add some missing entries. 2003-09-24 Christopher Faylor * shared_info.h (CURR_MOUNT_MAGIC): Fix. * sigproc.cc (sigpacket): New structure. (sig_send): Fill out sigpacket structure to send to signal thread rather than racily sending separate packets. (wait_sig): Use sigpacket structure to receive info from signal sender. 2003-09-24 Pierre Humblet * shared_info.h (class user_info): New. (cygwin_user_h): New. (user_shared): New. (enum shared_locations): Replace SH_MOUNT_TABLE by SH_USER_SHARED; (mount_table): Change from variable to macro. * shared.cc: Use sizeof(user_info) in "offsets". (user_shared_initialize): Add "reinit" argument to indicate need to reinitialize the mapping. Replace "mount_table" by "user_shared" throughout. Call user_shared->mountinfo.init and user_shared->delqueue.init. (shared_info::initialize): Do not call delqueue.init. (memory_init): Add argument to user_shared_initialize. * child_info.h (child_info::mount_h): Delete. (child_info::user_h): New. * sigpproc.cc (init_child_info): Use user_h instead of mount_h. * dcrt0.cc (_dll_crt0): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::close): Use user_shared->delqueue instead of cygwin_shared->delqueue. * fhandler_virtual.cc (fhandler_virtual::close): Ditto. * syscalls.cc (close_all_files): Ditto. (unlink): Ditto. (seteuid32): Add argument to user_shared_initialize. 2003-09-24 Christopher Faylor * devices.cc: New file. * devices.gperf: New file. * devices.shilka: New file. * cygwin-gperf: New file. * cygwin-shilka: New file. * fhandler_fifo.cc: New file. * fhandler_nodevice.cc : New file. 2003-09-24 Christopher Faylor Reorganize headers so that path.h precedes fhandler.h throughout. Remove device argument and unit arguments from fhandler constructors throughout. Remove pc arguments to fhandler functions and use internal pc element instead, throughout. Use dev element in pc throughout. Use major/minor elements rather than units and device numbers previously in fhandler class. Use correct methods for fhandler file names rather than directly accessing file name variables, throughout. * Makefile.in (DLL_OFILES): Add devices.o, fhandler_fifo.o * dcrt0.cc (dll_crt0_1): Call device::init. * devices.h: Renumber devices based on more Linux-like major/minor numbers. Add more devices. Declare standard device storage. (device): Declare struct. * dir.cc (opendir): Use new 'build_fh_name' to construct a fhandler_* type. * dtable.cc (dtable::get_debugger_info): Ditto. (cygwin_attach_handle_to_fd): Ditto. (dtable::release): Remove special FH_SOCKET case in favor of generic "need_fixup_before" test. (dtable::init_std_file_from_handle): Use either build_fh_dev or build_fh_name to build standard fhandler. (dtable::build_fh_name): Renamed from dtable::build_fhandler_from_name. Move out of dtable class. Don't accept a path_conv argument. Just build it here and pass it to: (build_fh_pc): Renamed from dtable::build_fhandler. Move out of dtable class. Use intrinsic device type in path_conv to create new fhandler. (build_fh_dev): Renamed from dtable::build_fhandler. Move out of dtable class. Simplify arguments to just take new 'device' type and a name. Just return pointer to fhandler rather than trying to insert into dtable. (dtable::dup_worker): Accommodate above build_fh name changes. (dtable::find_fifo): New (currently broken) function. (handle_to_fn): Use strechr for efficiency. * dtable.h: Reflect above build_fh name changes and argument differences. (fhandler_base *&operator []): Return self rather than copy of self. * fhandler.cc (fhandler_base::operator =): Use pc element to set normalized path. (fhandler_base::set_name): Ditto. (fhandler_base::raw_read): Use method to access name. (fhandler_base::write): Correctly use get_output_handle rather than get_handle. (handler_base::device_access_denied): New function. (fhandler_base::open): Eliminate pc argument and use pc element of fhandler_base throughout. (fhandler_base::fstat): Detect if device is based in filesystem and use fstat_fs to calculate stat, if so. (fhandler_base::fhandler_base): Eliminate handling of file names and, instead, just free appropriate component from pc. (fhandler_base::opendir): Remove path_conv parameter. * fhandler.h: Remove all device flags. (fhandler_base::pc): New element. (fhandler_base::set_name): Change argument to path_conv. (fhandler_base::error): New function. (fhandler_base::exists): New function. (fhandler_base::pc_binmode): New function. (fhandler_base::dev): New function. (fhandler_base::open_fs): New function. (fhandler_base::fstat_fs): New function. (fhandler_base::fstat_by_name): New function. (fhandler_base::fstat_by_handle): New function. (fhandler_base::isfifo): New function. (fhandler_base::is_slow): New function. (fhandler_base::is_auto_device): New function. (fhandler_base::is_fs_special): New function. (fhandler_base::device_access_denied): New function. (fhandler_base::operator DWORD&): New operator. (fhandler_base::get_name): Return normalized path from pc. (fhandler_base::get_win32_name): Return windows path from pc. (fhandler_base::isdevice): Renamed from is_device. (fhandler_base::get_native_name): Return device format. (fhandler_fifo): New class. (fhandler_nodevice): New class. (select_stuff::device_specific): Remove array. (select_stuff::device_specific_pipe): New class element. (select_stuff::device_specific_socket): New class element. (select_stuff::device_specific_serial): New class element. (select_stuff::select_stuff): Initialize new elements. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Move to base class from fhandler_disk_file. (fhandler_base::fstat_by_name): Ditto. (fhandler_base::fstat_by_name): Ditto. (fhandler_disk_file::open): Move most functionality into fhandler_base::open_fs. (fhandler_base::open_fs): New function. (fhandler_disk_file::close): Move most functionality into fhandler_base::close_fs. (fhandler_base::close_fs): New function. * fhandler_mem.cc (fhandler_dev_mem::open): Use device name in debugging output. * fhandler_socket.cc (fhandler_socket::set_connect_secret): Copy standard urandom device into appropriate place. (fhandler_socket::accept): Reflect change in fdsock return value. * fhandler_tty.cc: See "throughouts" above. * net.cc: Accommodate fdsock change throughout. (fdsock): Return success or failure, accept fd argument and device argument. * path.cc (symlink_info::major): New element. (symlink_info::minor): New element. (symlink_info::parse_device): Declare new function. (fs_info::update): Accommodate changes in path_conv class. (path_conv::fillin): Ditto. (path_conv::return_and_clear_normalized_path): Eliminate. (path_conv::set_normalized_path): New function. (path_conv::path_conv): Set info in dev element. Use path_conv methods Check for FH_FS rather than FH_BAD to indicate when to fill in filesystem stuff. where appropriate rather than direct access. Use set_normalized_path to set normalized path. (windows_device_names): Eliminate. (get_dev): Ditto. (get_raw_device_number): Ditto. (get_device_number): Ditto. (win32_device_name): Call new device name parser to do most of the heavy lifting. (mount_info::conv_to_win32_path): Fill in dev field as appropriate. (symlink_worker): Handle new device files. (symlink_info::check): Ditto. (symlink_info::parse_device): Define new function. * path.h (executable_states): Move here from fhandler.h. (fs_info): Rename variables to *_storage and create methods for accessing same. (path_conv): Add dev element, remove devn and unit and adjust inline methods to accommodate. (set_normalized_path): Declare new function. * pinfo.cc (_pinfo::commune_recv): Add broken support for handling fifos. (_pinfo::commune_send): Ditto. * pipe.cc (fhandler_pipe::close): check for existence of handle before closing it. (handler_pipe::create): Rename from make_pipe. Change arguments to accept fhandler_pipe array. Accommodate fifos. (pipe): Rework to deal with fhandler_pipe::create changes. (_pipe): Ditto. * select.cc: Use individual device_specific types throughout rather than indexing with obsolete device number. (set_bits): Use is_socket call rather than checking device number. * shared_info.h (CURR_MOUNT_MAGIC): Update. (conv_to_win32_path): Reflect addition of device argument. * syscalls.cc (mknod_worker): New function. (open): Use build_fh_name to build fhandler. (chown_worker): Detect if this is an 'auto' device rather than an on-filesystem device and handle appropriately. (chmod_device): New function. (chmod): Detect if this is an 'auto' device rather than an on-filesystem device and handle appropriately. Use chmod_device to set mode of in-filesystem devices. (stat_worker): Eliminate path_conv argument. Call build_fh_name to construct fhandler. Use fh->error() rather than pc->error to detect errors in fhandler construction. (access_worker): New function pulled from access. Accommodate in-filesystem devices. (access): Use access_worker. (fpathconf): Detect if this is an 'auto' device rather than an on-filesystem device and handle appropriately. (mknod_worker): New function. (mknod32): New function. (chroot): Free normalized path -- assuming it was actually cmalloced. * tty.cc (create_tty_master): Tweak for new device class. (tty::common_init): Ditto. * winsup.h (stat_worker): Remove. (symlink_worker): Declare. * exceptions.cc (set_process_mask): Just call sig_dispatch_pending and don't worry about pending_signals since sig_dispatch_pending should always do the right thing now. (sig_handle): Reorganize SIGCONT handling to more closely conform to SUSv3. * pinfo.h: Move __SIG enum to sigproc.h. (PICOM_FIFO): New enum element. (_pinfo): Remove 'thread2signal' stuff throughout class. (_pinfo::commune_send): Make varargs. (_pinfo::sigtodo): Eliminate. (_pinfo::thread2signal): Ditto. * signal.cc (kill_worker): Eliminate call to setthread2signal. * sigproc.cc (local_sigtodo): Eliminate. (getlocal_sigtodo): Ditto. (sigelem): New class. (pending_signals): New class. (sigqueue): New variable, start of sigqueue linked list. (sigcatch_nonmain): Eliminate. (sigcatch_main): Eliminate. (sigcatch_nosync): Eliminate. (sigcomplete_nonmain): Eliminate. (pending_signals): Eliminate. (sig_clear): Call signal thread to clear pending signals, unless already in signal thread. (sigpending): Call signal thread to get pending signals. (sig_dispatch_pending): Eliminate use of pending_signals and just check sigqueue. (sigproc_terminate): Eliminate all of the obsolete semaphore stuff. Close signal pipe handle. (sig_send): Eliminate all of the obsolete semaphore stuff and use pipe to send signals. (getevent): Eliminate. (pending_signals::add): New function. (pending_signals::del): New function. (pending_signals::next): New function. (wait_sig): Eliminate all of the obsolete semaphore stuff. Use pipe to communicate and maintain a linked list of signals. * sigproc.h: Move __SIG defines here. Add __SIGPENDING. (sig_dispatch_pending): Remove "C" specifier. (sig_handle): Accept a mask argument. * thread.cc: Remove signal handling considerations throughout. 2003-09-22 Christopher Faylor * dcrt0.cc (do_exit): Eliminate "C" linkage. Call events_terminate early. (exit_states): Move out of source file into header file. * winsup.h: Move exit_states here. Remove "C" linkage from do_exit declaration. * debug.cc (lock_debug): Remove explicit (and incorrect) external for exit_state. * sigproc.cc (sig_dispatch_pending): Don't flush signals if exiting. 2003-09-20 Christopher Faylor * spawn.cc (pthread_cleanup): New struct. (do_cleanup): New function. (spawn_guts): Initialize struct for pthread_cleanup handling to ensure proper restoration of signals if/when thread is cancelled. Restore settings using pthread_cancel_pop. 2003-09-19 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 6. 2003-09-19 Christopher Faylor * thread.h (__reent_t::init_clib): Declare new function. * thread.cc (__reent_t::init_clib): Define new function. (pthread::thread_init_wrapper): Use __reent_t::init_clib to init local clib storage and set std{in,out,err} appropriately. 2003-09-19 Christopher Faylor * syscalls.cc (system): Strip signal considerations from here so that they are not inherited by a child process. * spawn.cc (spawn_guts): Handle system() signal stuff here. * winsup.h (_P_SYSTEM): Define. 2003-09-18 Corinna Vinschen * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Handle buf == NULL as flushing the buffer. (fhandler_tty_slave::read): Handle ptr == NULL as flushing the buffer. (fhandler_tty_slave::tcflush): Implement input queue flushing by calling read with NULL buffer. (fhandler_pty_master::tcflush): Ditto, calling process_slave_output. * termios.cc (tcflush): Check for legal `queue' value. Return EINVAL otherwise. 2003-09-16 Brian Ford * syscalls.cc (gethostid): Add lpFreeBytesAvailable argument to GetDiskFreeSpaceEx call since NT4 requires it. 2003-09-16 Christopher Faylor * fhandler_process.cc (fhandler_process::fill_filebuf): Open pinfo with PID_MAP_RW. * sigproc.cc (talktome): Ditto for winpids. 2003-09-16 Christopher Faylor * pinfo.h (winpids::pid_access): New element. (winpids::winpids): Rejigger to set pinfo_access. * pinfo.cc (winpids::add): Try to open shared memory region with supplied pinfo_access first, then default to readonly. * fhandler_termios.cc (tty_min::kill_pgrp): When getting list of pids to work with, suggest opening with PID_MAP_RW. * signal.cc (kill_pgrp): Ditto. * sigproc.cc (sig_send): Perform a write check on todo prior to attempting to increment it. Return EACCES if we can't write to it. 2003-09-16 Corinna Vinschen * cygheap.cc (cygheap_user::set_saved_sid): Rename from set_orig_sid. * cygheap.h (class cygheap_user): Rename orig_psid, orig_uid and orig_gid to saved_psid, saved_uid and saved_gid respectively. Rename methods orig_sid and set_orig_sid to saved_sid and set_saved_sid respectively. * sec_helper.cc (sec_acl): Accomodate above changes. * spawn.cc (spawn_guts): Ditto. * uinfo.cc (uinfo_init): Ditto. 2003-09-15 Christopher Faylor * getopt.c (opterr): Reinstate initialization. (optind): Ditto. (optopt): Ditto. * pinfo.cc: Include cygheap.h or suffer compile error. * shared.h: Reset magic number. 2003-09-15 Christopher Faylor * exceptions.cc (sig_handle_tty_stop): Fix boneheaded mistake by using correct check for parent state rather than inverted check. 2003-09-15 Pierre Humblet * security.h (__sec_user): Add "access2" argument. (sec_acl): Add "original" and "access2" arguments. (sec_user): Add "sid2" and "access2" argument. Remove dependence on allow_ntsec. (sec_user_nih): Ditto. * sec_helper.cc (__sec_user): Add "has_security" test. Call sec_acl with new arguments, letting it handle original_sid. (sec_acl): Add "original" and "access2" arguments. Handle original_sid depending on flag but avoiding duplicates. Use "access2" for sid2. * pinfo.cc (pinfo::init): Use security attributes created by sec_user when creating the mapping. * security.cc (create_token): Adjust arguments in call to sec_acl. Call sec_user instead of __sec_user. * syscall.cc (seteuid32): Adjust arguments in call to sec_acl. Remove now unnecessary test. Remove useless conversions to psid. * dcrt0.cc (dll_crt0_1): Call cygsid::init before pinfo_init. 2003-09-13 Christopher Faylor * Makefile.in: Make malloc_wrapper -fomit-frame-pointer. * cygwin.din: Remove extraneous mallinfo definition. * dcrt0.cc (quoted): Use strechr for efficiency. * fhandler.cc (fhandler_base::write): Correctly use get_output_handle rather than get_handle. (fhandler_base::lseek): Use method for accessing name in debug output. 2003-09-13 Christopher Faylor * fhandler_disk_file.cc (path_conv::ndisk_links): Fix potential off-by-one problem when first file in a directory is a directory. 2003-09-13 Pierre Humblet * include/sys/cygwin.h: Rename PID_UNUSED to PID_MAP_RW. * pinfo.cc (pinfo_init): Initialize myself->gid. (pinfo::init): Create the "access" variable, set it appropriately and use it to specify the requested access. * exceptions.cc (sig_handle_tty_stop): Add PID_MAP_RW in pinfo parent. * signal.cc (kill_worker): Ditto for pinfo dest. * syscalls.cc (setpgid): Ditto for pinfo p. 2003-09-13 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 5. 2003-09-12 Christopher Faylor * thread.cc (MTinterface::fixup_after_fork): Remove code which potentially overwrote _impure pointer with contents of thread which invoked fork since this eliminates important information like the pointer to the atexit queue. 2003-09-12 Christopher Faylor * fhandler_disk_file.cc (path_conv::ndisk_links): Fix problem where search characters overwrote the path instead of being tacked on the end. 2003-09-12 Christopher Faylor * dcrt0.cc (_dll_crt0): Accommodate breaking apart of early_stuff_init. * exceptions.cc (early_stuff_init): Delete. (init_console_handler): New function - top half of early_stuff_init. (init_global_security): New function - bottom half of early_stuff_init. (sig_handle): Avoid special hExeced test for SIGINT. Just terminate the captive process. (signal_exit): Add debugging output. * fhandler_tty.cc (fhandler_tty_slave::open): Don't allocate a console if one already seems to exist. Properly initialize ctrl-c handling if we do allocate a console. * winsup.h (early_stuff_init): Delete declaration. (init_console_handler): New declaration. (init_global_security): New declaration. 2003-09-11 Christopher Faylor * fhandler_disk_file.cc (path_conv::ndisk_links): Rename from num_entries. Accept an argument and calculate any extra links needed based on missing . and .. entries. (fhandler_disk_file::fstat_helper): Always call pc->ndisks_links() to calculate the number of links. * path.h (path_conv::ndisk_links): Declare. 2003-09-11 Christopher Faylor * path.cc (normalize_posix_path): Put check for '//' prefix back to denote a UNC path. (slash_unc_prefix_p): Remove vestige of old //c method for accessing drives. 2003-09-11 Christopher Faylor * dir.cc (rmdir): Add more samba workarounds. 2003-09-11 Corinna Vinschen * shared.cc (user_shared_initialize): Revert length attribute for name variable to be just UNLEN + 1. 2003-09-10 Pierre Humblet * shared_info.h (shared_info::initialize): Remove argument. * cygheap.h (cygheap_user::init): New declaration. * uinfo.cc (cygheap_user::init): New. (internal_getlogin): Move functionality to cygheap_user::init. Open the process token to update the group sid. * shared.cc (user_shared_initialize): Get the user information from cygheap->user. (shared_info::initialize): Remove argument. Call cygheap->user.init instead of cygheap->user.set_name. (memory_init): Do not get the user name and do not pass it to shared_info::initialize. * registry.cc (get_registry_hive_path): Make csid a cygpsid. (load_registry_hive): Ditto. 2003-09-10 Christopher Faylor * fhandler_disk_file.cc (num_entries): Take . and .. into account if they do not exist since cygwin simulates them. (fhandler_cygdrive::fstat): Ditto. (fhandler_cygdrive::readdir): Don't do any specific tests on __d_position when seeing if a drive exists. 2003-09-10 Corinna Vinschen * Makefile.in (DLL_OFILES): Add getopt.o and iruserok.o. * cygwin.din: Export __check_rhosts_file, __rcmd_errstr, optarg, opterr, optind, optopt, optreset, getopt, getopt_long, iruserok and ruserok. * getopt.c: Moved from lib to here. Define opt* variables as dllexport. * iruserok.c: Moved from lib to here. Rearrange function order. Prefer using 64/32 bit functions. * syscalls.cc (shell_fp): Define as struct __sFILE64. (getusershell): Use fopen64 instead of fopen. * winsup.h: Add declarations for seteuid32, fopen64, cygwin_gethostbyname and cygwin_inet_addr. * include/getopt.h: Declare opt* variables dllimport. * include/cygwin/version.h: Bump API minor number. 2003-09-10 Christopher Faylor * exceptions.cc (sig_handle_tty_stop): Check parent PID_NOCLDSTOP rather than erroneously checking *my own* sigtodo. 2003-09-10 Christopher Faylor * Makefile.in: Add some more -fomit-frame-pointer files. * path.cc (conv_path_list_buf_size): Free normalized_path or suffer memory leak. * syscalls.cc (chroot): Ditto. 2003-09-10 Corinna Vinschen * Makefile.in (DLL_OFILES): Add bsdlib.o. * autoload.cc (RegisterServiceProcess): Add. * bsdlib.cc: New file. (daemon): New function. (login_tty): Ditto. (openpty): Ditto. (forkpty): Ditto. * cygwin.din: Export daemon, forkpty, login_tty, logwtmp, updwtmp, openpty and revoke. * syscalls.cc (updwtmp): New function, writing to wtmp exclusively. (logwtmp): Ditto. (login): Call updwtmp instead of writing to wtmp by itself. (logout): Ditto. * tty.cc (revoke): New funtion. * include/paths.h: Define _PATH_DEVNULL. * include/pty.h: New header. * include/cygwin/version.h: Bump API minor number. * include/sys/utmp.h: Declare logwtmp with const arguments. Declare updwtmp. * lib/iruserok.c: New file. (ruserok): New function. (iruserok): Ditto. (__ivaliduser): Ditto. (__icheckhost): Ditto. 2003-09-10 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::fstat): Don't use PC_POSIX. 2003-09-09 Pierre Humblet * shared_info.h: Include security.h. (open_shared): Add psa argument. (user_shared_initialize): New declaration. * security.h: Add _SECURITY_H guard. (sec_user): Use sec_none in the no ntsec case. * spawn.cc (spawn_guts): Remove call to load_registry_hive. * syscalls (seteuid32): If warranted, call load_registry_hive, user_shared_initialize and RegCloseKey(HKEY_CURRENT_USER). * shared.cc (user_shared_initialize): New. (open_shared): Add and use psa argument. (memory_init): Move mount table initialization to user_shared_initialize. Call it. 2003-09-09 Corinna Vinschen * mmap.cc (mmap64): Change address types from caddr_t to void * according to SUSv3. (mmap): Ditto. (munmap): Ditto. (msync): Ditto. (mprotect): Ditto. Move to before the fhandler methods. * include/sys/mman.h: Change prototypes accordingly. 2003-09-08 Christopher Faylor * dcrt0.cc (dlL_crt0_1): Set __argc_safe after __argc is absolutely know to be set. * exceptions.cc (sig_handle_tty_stop): Don't reset sigCONT event since it is reset automatically. * fork.cc (fork): Remove obsolete usage of PID_SPLIT_HEAP. * include/sys/cygwin.h: Ditto. * sigproc.cc (sig_send): Use sigframe init method to set frame since it checks for previous ownership of the frame. * sigproc.h (sigframe::init): Accept an "is_exception" argument. 2003-09-08 Christopher Faylor * dir.cc (readdir): Reinstate setting of old ino field for legacy applications. * dirent.h (dirent): Rename unused field to __ino32. 2003-09-08 Christopher Faylor * passwd.cc (getpwnam_r): Initialize pw_comment field. 2003-09-08 Christopher Faylor * passwd.cc (getpwuid_r32): Initialize pw_comment field. 2003-09-08 Christopher Faylor * sigproc.cc (wait_sig_inited): Remove assertion since it is racy. 2003-09-08 Corinna Vinschen * cygwin.din: Export endusershell, getusershell and setusershell. * syscalls.cc (getusershell): New function. (setusershell): Ditto. (endusershell): Ditto. * include/cygwin/version.h: Bump API minor number. 2003-09-08 Nicholas Wourms * cygwin.din: Export argz_add argz_add_sep argz_append argz_count argz_create argz_create_sep argz_delete argz_extract argz_insert argz_next argz_replace argz_stringify envz_add envz_entry envz_get envz_merge envz_remove envz_strip * include/cygwin/version.h: Bump api minor number. 2003-09-07 Christopher Faylor Throughout, remove __d_u.__d_data fields from DIR structure. * include/sys/dirent.h (dirent): Remvoe old_d_ino. (DIR): Make __d_dirhash a 64 bit value. Remove __d_data and __d_u. Add __flags. * dir.cc (opendir_states): New enum. (opendir): Clear new DIR __flags field. (readdir): Fill in '.' and '..' entries if we hit EOF and we haven't seen them already. Nuke setting of old_d_ino. (rewinddir): Reset DIR __flags field. (seekdir64): Ditto. * fhandler_disk_file.cc (fhandler_cygdrive::fhandler_cygdrive): Remove special handling of "." and ".." since they are now handled automatically. 2003-09-07 Christopher Faylor * include/cygwin/in.h: Don't define ipv6 stuff unless we call for it specifically since it isn't really implemented yet. 2003-09-07 Christopher Faylor * cygheap.cc (_csbrk): More left coercion cleanup. * fhandler_tty.cc (fhandler_tty_slave::read): Ditto. (fhandler_tty_slave::write): Ditto. * fhandler_windows.cc (fhandler_windows::read): Ditto. * heap.cc (sbrk): Ditto. 2003-09-07 Pierre Humblet * signal.cc (nanosleep): Improve test for valid values. Round delay up to resolution. Fix test for negative remainder. Use timeGetTime through gtod. (sleep): Round up return value. 2003-09-07 Pierre Humblet Christopher Faylor * hires.h (HIRES_DELAY_MAX): Define. (hires_ms::minperiod): Declare static. (hires_ms::resolution): New. (hires_ms::dmsecs): New. (hires_ms::prime): Return UINT. (gtod): Declare. * times.cc (hires_ms::prime): Always calculate minperiod and set it to 1 in case of failure. Return minperiod. (hires_ms::resolution): Define. (hires_ms::~hires_ms): Delete. (hires_ms::usecs): Check minperiod to prime. (gtod) Define as global. 2003-09-06 Christopher Faylor Remove left coercion throughout. 2003-09-04 Pierre Humblet * hires.h (hires_ms::~hires_ms): Delete declaration. * times.cc (hires_ms::~hires_ms): Delete definition.. 2003-09-04 Christopher Faylor * dcrt0.cc (__argc_safe): New variable. (dll_crt0_1): Store argc in __argc_safe, which will theoretically remain untouched by the user. * fhandler_console.cc (fhandler_console::read): Silence some compiler warnings. * fhandler_raw.cc (fhandler_dev_raw::raw_read): Ditto. * pinfo.cc (_pinfo::commune_recv): Carefully bound argv scan and check for potentially bad pointers since user could have set argv cell to anythinw. * cygheap.h (CYGHEAPSIZE): Bump up size. 2003-09-04 Corinna Vinschen * sysconf.cc (sysconf): Return more accurate value for _SC_AVPHYS_PAGES. 2003-09-04 Corinna Vinschen * mmap.cc: Restructure. Add, remove and rewrite comments throughout for better readability. Change function names for better understanding. (MAP_SET): Accomodate name change from map_map_ to page_map_. (MAP_CLR): Ditto. (MAP_ISSET): Ditto. (mmap_record::page_map_): Rename from page_map_. (mmap_record::get_map): Remove. (mmap_record::alloc_page_map): Rename from alloc_map. Return bool indicating success of cygheap memory allocation. (mmap_record::free_page_map): Rename from free_map. (mmap_record::fixup_page_map): Rename from fixup_map. (mmap_record::find_unused_pages): Rename from find_empty. (mmap_record::map_pages): Rename from map_map. (mmap_record::unmap_pages): Rename from unmap_map. (class list): Make all class members private. (list::list): Remove. (list::~list): Remove. (list::get_fd): New attribute reader. (list::get_hash): Ditto. (list::get_record): Ditto. (list::add_record): Manage all allocation for mmap_records. Check for failed memory allocation and return NULL if so. (list::set): New function. (list::del_record): Rename from erase. Return true if last mmap_record has been deleted, false otherwise. Check for legal incoming index value. (list::erase): Remove erase/0. (list::search_record): Rename from match. (map::map): Remove. (map::~map): Remove. (map::add_list): Manage all allocation for lists. Check for failed memory allocation and return NULL if so. (map::get_list): New method. (map::del_list): Rename from erase. Check for legal incoming index value. (mmap64): Check for failed mmap_record memory allocation. Return with MAP_FAILED and errno set to ENOMEM if so. (munmap): Rearrange loop using new list and mmap_record accessor functions. Rename loop index variables for better understanding. Check if list can be deleted after last mmap_record in it has been deleted. (msync): Rearrange loop using new list and mmap_record accessor functions. Rename loop index variables for better understanding. (fixup_mmaps_after_fork): Ditto. 2003-09-03 Christopher Faylor * cxx.cc (new): Fix formatting. Just return result of ccalloc rather than calling memset explicitly. 2003-09-03 Christopher Faylor * exceptions.cc (set_process_mask): Set pending signals only when signals become unmasked. * sigproc.cc (pending_signals): Flip back to a global. (wait_sig): Don't set pending signals when there is an armed semaphore or signal is blocked. * shared.cc (shared_info::initialize): Add a username parameter for user-mode mounts. Reorganize to try to avoid startup race. (memory_init): Move some stuff into shared_info::initialize. * shared_info.h (shared_info::initialize): Change declaration. (CURR_SHARED_MAGIC): Update. 2003-09-01 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 4. 2003-09-01 Christopher Faylor * net.cc (dup_ent): Restore check for NULL input. 2003-08-31 Christopher Faylor * include/sys/cygwin.h: Don't define cygwin-specific things if !__CYGWIN__. 2003-08-31 Christopher Faylor * cygheap.cc (cygheap_init): Allocate space for sigaction array in cygheap. * cygheap.h (cygheap_types): Add HEAP_SIGS. * exceptions.cc (signal_fixup_after_exec): Remove from this file. * pinfo.h (pinfo::getsig): Just return global_sigs array. (pinfo::sigs): Delete. * sigproc.cc (signal_fixup_after_exec): Move it here. (global_sigs): New global array, moved from pinfo structure. (sigalloc): New function. Allocate global sigaction array here. (proc_subproc): Remove copysigs call. It's automatic now. * include/sys/cygwin.h (PID_NOCLDSTOP): New value. * signal.cc (sigaction): Set myself->PID_NODCLDSTOP when appropriate. * sigproc.h (sigalloc): Declare. * fnmatch.c (fnmatch): Use C90 parameters. (rangematch): Ditto. * fhandler.cc (fhandler_base::raw_read): Use right coercion to avoid a compiler warning. 2003-08-31 Christopher Faylor * net.cc (dup_ent): Make debugging output consistent. 2003-08-31 Christopher Faylor Use dup_ent rather than specific dup_*_ptr functions throughout. * (gen_ent): Delete. (dup_ent): Subsume gen_ent functionality. (dup_host_ptr): Delete. (dup_proto_ptr): Ditto. (dup_servent_ptr): Ditto. 2003-08-31 Christopher Faylor * net.cc (gen_ent): Invert sense of null check so that debug output makes sense. 2003-08-31 Christopher Faylor * net.cc (free_char_list): Delete. (dup_addr_list): Delete. (dup_char_list): Delete. (free_hostent_ptr): Delete. (free_protoent_ptr): Delete. (free_servent_ptr): Delete. (DWORD_round): New function. (strlen_round): New function. Returns strlen rounded up to word size. (dup_ent): New, generic function to duplicate a {host,proto,serv}ent structure. (gen_ent): New macro. Generates a generic dup_{host,proto,serv}ent_ptr function. (cygwin_getservbyname): Remove call to free_servent_ptr, pass servent_buf to dup_servent_ptr. (cygwin_getservbyport): Ditto. (cygwin_gethostbyname): Ditto for hostent. (cygwin_gethostbyaddr): Ditto. (cygwin_getprotobyname): Ditto for protoent. (cygwin_getprotobynumber): Ditto. 2003-08-31 Christopher Faylor * Makefile.in (MALLOC_OFILES): Always fill in with correct malloc object. * configure.in: Fill in MALLOC_OFILES with either debugging or regular malloc. * configure: Regenerate. * dlmalloc.c: Make various fruitless changes to attempt to get to work. * dlmalloc.h: Ditto. * malloc.cc (free): Check malloc pool when debugging. * path.cc (win32_device_name): Eliminate compiler warning. * sigproc.cc (sig_dispatch_pending): Remove use of was_pending. Let thisframe.call_signal_handler decide if handler should be called rather than using bogus was_pending check. * exceptions.cc (interrupt_setup): Remove accidentally checked in debugging code. 2003-08-30 Christopher Faylor * heap.cc (sbrk): Save rounded addess in user_heap_max. 2003-08-30 Christopher Faylor * sigproc.cc (sig_dispatch_pending): Remove explicit call to thisframe.call_signal_handler. 2003-08-30 Christopher Faylor Remove some cygserver files. 2003-08-28 Christopher Faylor * sigproc.h: Make some functions regparm. * sigproc.cc (checkstate): Make regparm. (getevent): Change parameters in declaration, rename from getsem, make regparm. (sig_send): Recognize that nosync is now an event. Remove some old cruft from previous interrupt anywhere signal handler. (getevent): Change parameters in definition, rename from getsem. Allocate event rather than semaphore. (wait_sig): Treat sigcatch_nosync as an event. 2003-08-28 Christopher Faylor * exceptions.cc (sigreturn): Fix problem where old return address was not properly restored for a nested signal. 2003-08-27 Christopher Faylor * autoload.cc (SwitchToThread): Declare as autoload function. * cygthread.h (cygthread::main_thread_id): Make public. * exceptions.cc (setup_handler): Remove unneeded priority stuff. Rename label to reflect what it does. Add debugging for idiotic Windows NT problem. Change debugging output to include signal number. * miscfuncs.cc (low_priority_sleep): If available, use SwitchToThread function to give time slice to other threads. * wincap.cc: Properly define have_switch_to_thread throughout. * wincap.h (wincap::switch_to_thread): New element. 2003-08-27 Christopher Faylor * syscalls.cc (mount): Don't check win32_path when doing cygdrive mount. 2003-08-27 Christopher Faylor * specdir: Correctly remove temporary directory prior to use. 2003-08-27 Christopher Faylor * sigproc.cc (wait_sig): Count number of iterations through 'more_signals' loop and issue a warning if DEBUGGING and excessive. (WFSO): When debugging and infinite timeout, loop. 2003-08-26 Corinna Vinschen * include/cygwin/stat.h: Allow definition of internal stat structures also when compiling newlib. 2003-08-25 Christopher Faylor Throughout, change USE_CYGSERVER to USE_SERVER. * Makefile.in (LIBSERVER): Define and use. * configure.in: Set LIBSERVER as appropriate. * configure: Regenerate. * acconfig.h: Regenerate. * environ.cc: Rename allow_daemon to allow_server. Only recognize when USE_SERVER is defined. 2003-08-23 Christopher Faylor * syscalls.cc (_remove_r): Define. 2003-08-22 Corinna Vinschen * cygheap.h (enum cygheap_types): Add HEAP_MMAP. (CYGHEAPSIZE): Add another 64K. * mmap.cc: Use cmalloc, ccalloc and crealloc with HEAP_MMAP type throughout. 2003-08-22 Christopher Faylor * cygheap.cc (user_heap_info::max): New field. * heap.cc (heap_init): Save pointer to end of heap reserved memory. (sbrk): Don't attempt to commit memory beyond end of heap reserved memory. Attempt to honor comment and reserve commitbytes if heapchunk fails. 2003-08-20 Pierre Humblet * exceptions.cc (sigreturn): Don't clobber ebp in recursive signal calls. 2003-08-22 Christopher Faylor * exceptions.cc (sig_handle): Change so that default signals indicate success. 2003-08-21 Christopher Faylor * sigproc.cc (wait_sig): Remove redundant test in do/while. 2003-08-21 Christopher Faylor * sigproc.cc (wait_sig): Avoid infinite loop. 2003-08-20 Christopher Faylor * speclib: Reenable removal of temp files. 2003-08-20 Christopher Faylor * miscfuncs.cc (low_priority_sleep): Sleep at same priority as main thread. * sigproc.cc (wait_sig): Keep looping if there are more signals to consider and we are flushing signals. (sig_send): Put nonsync signals in the correct bucket. 2003-08-20 Christopher Faylor * speclib: Fix created lib to avoid "File truncated" problems. 2003-08-20 Pierre Humblet * exceptions.cc (interrupt_setup): Set sigsave.sig last to avoid a race. 2003-08-20 Christopher Faylor * sigproc.cc (wait_sig): Ensure that myself->getsigtodo array is flushed on a __SIGFLUSH. 2003-08-20 Pierre Humblet Christopher Faylor * exceptions.cc (_sigreturn): Handle nested signals without growing the stack. 2003-08-19 Christopher Faylor * exceptions.cc (pending_signals): Remove unneeded declaration. * sigproc.cc (pending_signals): Make static. (wait_sig): Use defined values rather than integers for rc. Never scan both todo arrays as this could cause hangs if signals arrive from two different sources. Rename saw_pending_signals to saw_failed_interrupt. Exit loop when signal found. Enter low-priority sleep, if necessary, after finished signalling completion. Set pending_signals when blocked (from Pierre Humblet). 2003-08-19 Christopher Faylor * signal.cc (sigpending): Move. * sigproc.cc (sigpending): To here. (getlocal_sigtodo): Return process-local signal array. (sigpending): Accommodate new process-local signal array. (sig_send): Ditto. (sig_set_pending): Ditto. (wait_sig): Ditto. 2003-08-19 Christopher Faylor Throughout, eliminate argument to sig_dispatch_pending. * exceptions.cc (setup_handler): Move non-interruptible condition handling (back) to wait_sig. (set_process_mask): Don't worry about calling sig_dispatch_pending from sigthread since it is detected in the function anyway. (sig_handle): Eliminate thisproc arg. Don't call sig_dispatch_pending on SIGCONT since that should happen automatically. * sigproc.cc (sig_dispatch_pending): Eliminate justwake argument. Just return when called from sigthread. (wait_sig): Change some variables to bool. Change inner while to an if. Move uninterruptible signal handling here. (sigproc_terminate): Don't call sig_dispatch_pending. Just increment semaphore on exit. * speclib: Use slightly different (but still flawed) method for determining symbols to extract from libraries. 2003-08-18 Christopher Faylor * exceptions.cc (sigdelayed): Fix race where signal handler could get the wrong mask (as suggested by Pierre Humblet). 2003-08-18 Christopher Faylor * path.cc (mount): Add null/empty check for input parameters. (umount): Add null/empty check for input parameters. 2003-08-17 Pierre Humblet * grp.cc (read_group): Revert previous change. * uinfo.cc (pwdgrp::load): Always reset curr_lines. 2003-08-17 Corinna Vinschen * errno.cc (errmap): Map ERROR_INVALID_BLOCK_LENGTH to EIO. * fhandler_raw.cc (fhandler_dev_raw::raw_read): Set more accurate errnos instead of EACCES. (fhandler_dev_raw::raw_write): Ditto. 2003-08-17 Christopher Faylor * path.cc (special_name): Accommodate all special names with extensions. 2003-08-15 Corinna Vinschen * mmap.cc (mmap64): Avoid crash if file size is less than requested map length. 2003-08-13 Igor Pechtchanski * path.cc (special_name): Add checks for some specials followed by a "." and a FIXME comment. 2003-08-13 Corinna Vinschen * cygwin.din: Accommodate change from cygwin_lstat to lstat. * syscalls.cc: Add defines to avoid declaration issues when renaming cygwin_lstat back to lstat. (lstat): Reverted name change from cygwin_lstat. 2003-08-12 Corinna Vinschen * include/sys/param.h (NBBY): Define if not defined. 2003-08-12 Nicholas Wourms * include/sys/param.h (setbit): Add new bitmap related macro. (clrbit): Likewise. (isset): Likewise. (isclr): Likewise. (howmany): Add new counting/rounding macro. (rounddown): Likewise. (roundup): Likewise. (roundup2): Likewise. (powerof2): Likewise (MIN): Add macro for calculating min. (MAX): Add macro for calculating max. 2003-08-09 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 3. 2003-08-08 Gerrit P. Haase * include/stdint.h: Correctly define INT32_MIN. 2003-08-08 David Rothenberger * grp.cc (read_group): Set __group32.gr_mem pointer back to &null_ptr after free() is called. 2003-08-05 Christopher Faylor * Makefile.in: Rework to accommodate new speclib arguments. * speclib: Rework to extract everything from libcygwin.a rather than building things from existing object files. 2003-08-05 Pavel Tsekov * path.cc (cygdrive_getmntent): Do not skip over drives of type DRIVE_REMOVABLE. 2003-08-05 Christopher Faylor * fhandler.cc (fhandler_base::lseek): Be more paranoid when constructing offsets from 64 bit value. * syscalls.cc (logout): Avoid temp buffer memcpy since new scheme does not require it. (utmp_data): Rework as a macro which returns a pointer into a buffer. (getutent): Use new buffer allocation mechanism to grab a utmp buffer. (getutid): Ditto. (pututline): Ditto. 2003-08-05 Pavel Tsekov * fhandler_disk_file.cc (fhandler_cygdrive::readdir): Do not change 'errno' if end of directory condition is encountered as per SUSv2. * fhandler_proc.cc (fhandler_proc::readdir): Ditto. * fhandler_process (fhandler_process::readdir): Ditto. * fhandler_registry (fhandler_registry::readdir): Ditto. 2003-07-30 Christopher Faylor * dcrt0.cc (_dll_crt0): Move strace.microseconds initialization to after pthread initialization. (dll_crt0_1): i.e., here. 2003-07-28 Christopher Faylor * fhandler_base.cc (fhandler_base::readv): Rework to properly return number of bytes from read. 2003-07-28 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 2. 2003-07-26 Christopher Faylor * exceptions.cc (ctrl_c_handler): Send SIGHUP when events occur only if there is a tty associated with the process. Send SIGHUP on CTRL_LOGOFF_EVENT. * fhandler_tty.cc (fhandler_tty_slave::open): Adjust console open handle counter regardless of whether this is a pty or tty. (fhandler_tty_slave::open): Ditto. (fhandler_tty_slave::dup): Ditto. (fhandler_tty_common::set_close_on_exec): Ditto. (fhandler_tty_master::init_console): Decrement console open handle counter after init since it will now be handled by all tty open. * syscalls.cc (setsid): Rework debugging output slightly. 2003-07-25 Christopher Faylor * configure.in: Use 'install-sh -c'. * configure: Regenerate. 2003-07-25 Christopher Faylor * configure.in: Always use install-sh. * configure: Regenerate. 2003-07-25 Christopher Faylor * include/cygwin/socket.h: Conditionalize [AP]F_INET6 define. 2003-07-25 Christopher Faylor * Makefile.in (OBSOLETE_FUNCTION): Add fdopen. 2003-07-25 Christopher Faylor * cygwin.din: Export _fdopen64 * Makefile.in (NEW_FUNCTIONS): Add _fdopen64 -> fdopen translation. * include/cygwin/version.h: Bump api minor number. * ntdll.h: Remove (now) duplicate FILE_SYNCHRONOUS_IO_NONALERT definition. 2003-07-24 Christopher Faylor * environ.cc (check_case_init): Use strncasematch. * cygwin.din: Export __mempcpy. * cygwin/version.h: Bump api minor number. 2003-07-21 Pavel Tsekov * mmap.cc: Use proper format specifiers for _off64_t and size_t in format strings passed to syscall_printf () and debug_printf () throughout. 2003-07-18 Pierre Humblet * security.cc (verify_token): Fix white space and style. Use type bool instead of BOOL and char. Use alloca instead of malloc and free for my_grps. 2003-07-17 Corinna Vinschen * sysconf.cc (sysconf): Fix OPEN_MAX patch. Return page size on _SC_PAGESIZE again. 2003-07-14 Corinna Vinschen * cygheap.h (class cygheap_user): Use INVALID_HANDLE_VALUE as invalid value for tokens. * syscalls.cc (seteuid32): Ditto. Set new_token to process token if process token is suitable. * uinfo.cc (uinfo_init): Initialize tokens in cygheap user info to INVALID_HANDLE_VALUE. 2003-07-14 Pierre Humblet * cygheap.h (enum impersonation): Delete. (cygheap_user::impersonation_state): Delete. (cygheap_user::current_token): New. (cygheap_user::issetuid): Modify to use current_token. (cygheap_user::token): Ditto. (cygheap_user::deimpersonate): Ditto. (cygheap_user::reimpersonate): Ditto. (cygheap_user::has_impersonation_tokens): Ditto. (cygheap_user::close_impersonation_tokens): Ditto. * security.cc (cygwin_set_impersonation_token): Always set the token. (verify_token): Change type of gsid to cygpsid. (get_file_attribute): Use the effective ids. * syscalls.cc (seteuid32): Modify to use cygheap_user::current_token. * uinfo.cc (uinfo_init) Do not set cygheap->user.impersonation_state. 2003-07-12 Christopher Faylor * pinfo.cc (_pinfo::commune_send): Fix bounds test so that poll of communicating pid actually stops eventually. 2003-07-10 Christopher Faylor * path.cc (get_device_number): Remove special com? consideration. (special_chars): Make static. (special_introducers): New. (special_char): Allow specified valid_chars args. (fnunmunge): Handle aux-like filenames correctly. (special_name): Add con, conin$, conout$. (mount_item::fnmunge): Use __small_sprintf return value to calculate increments. 2003-07-09 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 1. 2003-07-09 Christopher Faylor * fhandler_proc.cc (format_proc_stat): Use correctly sized constants for filling in zeros on 98. 2003-07-09 Christopher Faylor * fhandler_proc.cc (fhandler_proc::fill_filebuf): Allocate more space for stat buffer. (format_proc_stat): Reorganize to accumulate and report on all cpus. 2003-07-09 Christopher Faylor * sysconf.cc (sysconf): Return processors online rather than bitmask for _SC_NPROCESSORS_ONLN. 2003-07-08 Christopher Faylor * cygheap.cc (creturn): Set appropriate errno when out of memory. (ccalloc): Only issue system_printf when debugging. * dtable.cc (dtable::extend): Only allocate 100 * the incremental growth size max. Set errno appropriately. (dtable::build_fhandler): Check for error from set_name. * fhandler.cc (fhandler_base::set_name): Set errno and return error on OOM. * fhandler.h (fhandler_base::set_name): Change to bool. * fhandler_process.cc (format_process_stat): Fix formatting. * resource.cc (getrlimit): Return greater of OPEN_MAX or fd table size. * sysconf.cc (sysconf): Ditto. 2003-07-07 Christopher Faylor * rmsym: Don't use ranlib. 2003-07-07 Christopher Faylor * newsym: Reenable removal of tmp directory. Just use ar to generate archive index. * Makefile.in: Don't send ranlib to newsym or rmsym. 2003-07-07 Christopher Faylor * newsym: Create objects that are closer to those created by dlltool so as not to confuse --export-all-symbols. * rmsym: Be a little more accepting of object filenames now that dlltool can create different format files. 2003-07-06 Christopher Faylor * newsym: Oops. Revert below change. 2003-07-06 Christopher Faylor * newsym: Use correct prefix for generating imports. * pinfo.cc (_pinfo::commune_send): Don't wait forever for a response from another process. 2003-07-06 Christopher Faylor * syscalls.cc (gethostid): Set thread affinity so that results are predictable. 2003-07-05 Corinna Vinschen * mmap.cc (list::match): Add parameters to return valid address and length back to munmap(). Evaluate intersection between given area and mapped area and return it, if any. (mmap64): On regular files, don't allow mappings beginning beyond EOF. Return with errno set to ENXIO instead. (munmap): Rewrite SUSv3 conformant. Check if given memory area is valid. Unmap all maps inside given memory area. Don't return error if no mapping has been unmapped. 2003-07-05 N Stephens * fhandler.h (fhandler_socket::get_connect_state): New method to return socket connection state. * fhandler_socket.cc (dup): Copy socket connect state to new file handle. * net.cc (cygwin_rcmd): Mark file handles of sockets returned by rcmd() as CONNECTED state. (cygwin_rexec): Similarly for rexec(). (socketpair): Mark both ends of a new socket pair as CONNECTED. 2003-07-04 Corinna Vinschen * mmap.cc (fhandler_disk_file::mmap): Fix address test. 2003-07-03 Christopher Faylor * path.cc (fillout_mntent): Change "posix" to "managed". 2003-07-02 Christopher Faylor * fhandler.h (FH_ENC): New enum. (fhandler_base::get_encoded): New function. (fhandler_base::set_encoded): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Set encoded flag in fhandler, as appropriate. (fhandler_disk_file::readdir): Unmunge filename as appropriate based on new encoding flag. * path.cc (normalize_posix_path): Don't punt on files with colons. (special_char): New function. (mount_item::fnmunge): Ditto. (fnunmunge): Ditto. (special_name): Ditto. (mount_item::build_win32): Avoid drive considerations when file is encoded. (mount_info::conv_to_win32_path): Handle encoded filenames. (mount_info::conv_to_posix_path): Ditto. (fillout_mntent): Add posix string when directory is encoded. * path.h (fnunmunge): Declare. (path_conv::is_encoded): Declare. 2003-07-03 Christopher Faylor * fhandler_tty.cc (fhandler_tty_slave::open): Conditionalize a little more of the cygserver stuff so that ttys actually work. 2003-07-03 Corinna Vinschen * mmap.cc (mmap64): Allow MAP_FIXED with pagesize granularity (4K). If a non-zero addr is given, align it to the next lower 64K boundary. (fhandler_disk_file::mmap): If a non-zero address is given, try mapping using the given address first. If it fails and flags is not MAP_FIXED, try again with NULL address. 2003-07-01 Christopher Faylor * thread.cc: Remove _MT_SAFE conditional. 2003-07-01 Christopher Faylor * configure.in: Fix --enable-server option. * configure: Regenerate. 2003-07-01 Christopher Faylor * Makefile.in: Remove cygserver stuff. * acconfig.h: Add USE_CYGSERVER define. * config.h.in: Regenerate. * configure.in: Add --enable-server setting. * configure: Regenerate. * fhandler_tty.cc (fhandler_tty_slave::open): Conditionalize compilation of cygserver stuff. * fork.cc (fork_child): Ditto. * shm.cc: Ditto. * tty.cc (tty::common_init): Ditto. * dcrt0.cc: Use bool rather than BOOL for CYGWIN environment variable definitions. * environ.cc: Ditto. * ntea.cc: Ditto. * security.cc: Ditto. * security.h: Ditto. * syscalls.cc (check_posix_perm): Remove externs that were already declared in a header. * winsup.h: Ditto. Declare _MT_SAFE here. Delete it someday since cygwin should always be _MT_SAFE. 2003-07-01 Christopher Faylor * thread.cc: Remove _MT_SAFE conditional. 2003-07-01 Christopher Faylor * configure.in: Fix --enable-server option. * configure: Regenerate. 2003-07-01 Christopher Faylor * Makefile.in: Remove cygserver stuff. * acconfig.h: Add USE_CYGSERVER define. * config.h.in: Regenerate. * configure.in: Add --enable-server setting. * configure: Regenerate. * fhandler_tty.cc (fhandler_tty_slave::open): Conditionalize compilation of cygserver stuff. * fork.cc (fork_child): Ditto. * shm.cc: Ditto. * tty.cc (tty::common_init): Ditto. * dcrt0.cc: Use bool rather than BOOL for CYGWIN environment variable definitions. * environ.cc: Ditto. * ntea.cc: Ditto. * security.cc: Ditto. * security.h: Ditto. * syscalls.cc (check_posix_perm): Remove externs that were already declared in a header. * winsup.h: Ditto. Declare _MT_SAFE here. Delete it someday since cygwin should always be _MT_SAFE. 2003-06-30 Pierre Humblet * cygheap.h (enum impersonation): New enum. (cygheap_user::token): Delete. (cygheap_user::impersonated): Delete. (cygheap_user::external_token): New member. (cygheap_user::internal_token): New member. (cygheap_user::impersonation_state): New member. (cygheap_user::issetuid): Modify. (cygheap_user::token): New method. (cygheap_user::deimpersonate): New method. (cygheap_user::reimpersonate): New method. (cygheap_user::has_impersonation_tokens): New method. (cygheap_user::close_impersonation_tokens): New method. * dtable.cc (dtable::vfork_child_dup): Use new cygheap_user methods. * fhandler_socket.cc (fhandler_socket::dup): Ditto. * fork.cc (fork_child): Ditto. (fork_parent): Ditto. * grp.cc (internal_getgroups): Ditto. * security.cc (verify_token): Ditto. (check_file_access): Ditto. (cygwin_set_impersonation_token): Detect conflicts. Set user.external_token. * spawn.cc (spawn_guts): Use new cygheap_user methods. * syscalls.cc (seteuid32): Rearrange to use the two tokens in cygheap_user. (setegid32): Use new cygheap_user methods. * uinfo.cc: (internal_getlogin): Ditto. 2003-06-25 Doru Carastan * Makefile.in: Use INSTALL_PROGRAM to install the cygwin DLL. 2003-06-24 Thomas Pfaff * thread.cc (MTinterface::fixup_after_fork): Fix thread list after fork. (pthread::threads): Instantiate. (pthread::pthread): Initialize running and suspendend. Initialize next with NULL. Add thread to thread list if it is not the null_pthread. (pthread::~pthread): Remove thread from thread list if it is not the null_pthread. (pthread::postcreate): Set running flag. (pthread::exit): Reset running flag. (pthread::cancel): Try to cancel thread only if still running. (pthread::_fixup_after_fork): Implement. (pthread::detach): Check if thread is still running before detach. * thread.h (pthread::running): New member. (pthread::next): Ditto. (pthread::fixup_after_fork): New static method. (pthread::threads): New static method. (pthread::_fixup_after_fork): New method. 2003-06-20 Christopher Faylor * pinfo.cc (_pinfo::commune_send): Don't attempt to communicate with a pure windows process. 2003-06-18 Pierre Humblet * autoload.cc (GetNetworkParams): Add. * net.cc (getdomainname): Call GetNetworkParams and read the DhcpDomain registry value if warranted. 2003-06-17 Christopher Faylor * path.cc (mount): Do more strict checking on posix path arguments. 2003-06-15 Christopher Faylor Throughout, remove "include " from files which already include cygerrno.h. 2003-06-15 Thomas Pfaff * include/cygwin/config.h (__DYNAMIC_REENT__): Define. * include/cygwin/version.h: Bump API minor version. * cygwin.din: Export __getreent * cygerrno.h: Include errno.h. Fix places where _impure_ptr is used directly to store the errno value. * debug.cc (__set_errno): Ditto. * errno.cc: Remove _RRENT_ONLY define to get errno.cc compiled. * signal.cc: Rename _reent_clib to _REENT throughout. * thread.h (reent_clib): Remove prototype. * thread.cc (reent_clib): Rename reent_clib to __getreent. Return _impure_ptr until MTinterface is initialized. (reent_winsup): Fix a possible SEGV when _r == NULL. Return NULL instead. * MTinterface::fixup_after_fork: Switch reent back to _impure_ptr to keep signal handling running when fork is called from a thread other than the mainthread. 2003-06-12 Thomas Pfaff * thread.cc (pthread_attr_init): Revert change from 2003-06-11 to return 0 if attribute is already initialized back to EBUSY. (pthread_condattr_init): Ditto. (pthread_rwlockattr_init): Ditto. (pthread_mutexattr_init): Ditto. 2003-06-12 Corinna Vinschen * exceptions.cc (ctrl_c_handler): Don't send a signal on CTRL_SHUTDOWN_EVENT. Add a comment to rationalize the patch. 2003-06-11 Thomas Pfaff * thread.cc (pthread_attr_init): Return 0 if attribute is already initialized. Fix return code if out of memory. (pthread_condattr_init): Ditto. (pthread_rwlockattr_init): Ditto. (pthread_mutexattr_init): Return 0 if attribute is already initialized. 2003-06-09 Pierre Humblet * spawn.cc (spawn_guts): Call CreateProcess while impersonated, when the real {u,g}ids and the groups are original. Move RevertToSelf and ImpersonateLoggedOnUser to the main line. * uinfo.cc (uinfo_init): Reorganize. If CreateProcess was called while impersonated, preserve the uids and gids and call ImpersonateLoggedOnUser. Preserve the uids and gids on Win9X. * exceptions.cc (error_start_init): Quote the pgm in the command. 2003-06-07 Christopher Faylor * poll.cc: Define FD_SETSIZE to ridiculously large number so that there will be no artificially small limits. 2003-06-07 Christopher Faylor * fhandler_tty.cc (fhandler_tty_slave::close): Free the console when last tty closes. 2003-06-07 Thomas Pfaff * fhandler_socket.cc (fhandler_socket::connect): Change error handling for nonblocking connects to return EALREADY when connect is called more than once for the same socket. 2003-06-06 Corinna Vinschen * cygwin.din: Add vsyslog. * fhandler.cc (fhandler_base::write): Only make file sparse if the seeked area is >= 128K. * syslog.cc (vsyslog): New function, overtaking functionality from syslog. (syslog): Just call vsyslog. * include/cygwin/version.h: Bump API minor. * include/sys/syslog.h: Add vsyslog declaration. 2003-06-05 Christopher Faylor * cygthread.cc (cygthread::terminate_thread): Change system_printf to debug_printf. 2003-06-04 Christopher Faylor * shared.cc (shared_info::heap_chunk_size): Be really defensive about making sure that heap_chunk is set. 2003-06-04 Christopher Faylor * path.cc (conv_path_list): Use correct value when calculating length to avoid a potential SEGV. 2003-06-03 Pierre Humblet * fhandler_disk_file.cc (fhandler_disk_file::fstat): Mark the pc as non-executable if the file cannot be opened for read. Retry query open only if errno is EACCES. Never change the mode, even if it is 000 when query open() fails. 2003-06-03 Christopher Faylor * configure.in: Allow any i?86 variant. * configure: Regenerate. 2003-06-03 Corinna Vinschen Thomas Pfaff * fhandler_socket.cc (connect_thread): Remove. (accept_thread): Remove. (fhandler_socket::connect): Remove all special blocking handling. (fhandler_socket::accept): Ditto. * net.cc (cygwin_connect): Make blocking sockets temporarily non-blocking and call cygwin_select on them to be interruptible. (cygwin_accept): Ditto. 2003-06-02 Christopher Faylor * spawn.cc (spawn_guts): Don't hang around if the parent doesn't exist. 2003-06-02 Christopher Faylor * cygthread.h (cygthread::terminate_thread): Mark private. * cygthread.cc (cygthread::terminate_thread): Deallocate free_range thread stuff. 2003-06-02 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::accept): Rename `signalled' to `interrupted' as used in fhandler_socket::connect. 2003-06-02 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::connect): Simplify previous patch. (fhandler_socket::accept): Ditto. 2003-06-02 Corinna Vinschen * fhandler_socket.cc: Include cygthread.h. (class sock_event): Remove. (thread_connect): New function. (thread_accept): Ditto. (fhandler_socket::connect): Use cygthread instead of socket event handling for blocking sockets. (fhandler_socket::accept): Ditto. 2003-06-02 Christopher Faylor * fhandler.cc (fhandler_base::write): Correct minor printf formatting style glitch. 2003-06-01 Pierre Humblet * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Assume an existing directory is a root if FindFirstFile fails. 2003-05-30 Christopher Faylor * path.cc (mount_info::conv_to_win32_path): gcc warning about chroot_ok was actually valid. Fix it. 2003-05-30 Christopher Faylor * cygheap.cc (init_cheap): Temporarily remove inline that newer gcc's have problems with. * path.cc (path_conv::check): Rework has_acls logic slightly. Uncouple exec tests away from filesystem tests. 2003-05-30 Corinna Vinschen * include/sys/param.h: Add DEV_BSIZE. 2003-05-29 Pierre Humblet Corinna Vinschen * fhandler_socket.cc (fhandler_socket::dup): Rearrange. Fix conditional. 2003-05-28 Christopher Faylor * mkvers.sh: Avoid "-dontuse" tags. * path.cc (path_conv::check): Set exec state based on known situations. * path.cc (mount_item::fnmunge): New function. (mount_item::build_win32): New function. (mount_info::conv_to_win32_path): Use build_win32 to build windows path. * path.h (mount_item::fnmunge): Declare new function. (mount_item::build_win32): Ditto. * sys/mount.h (MOUNT_ENC): Define. 2003-05-28 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::dup): If running impersonated, revert to original account before calling fixup_before_fork_exec and impersonate again afterwards. Change comment accordingly. Clean up error handling and debug output. 2003-05-27 Thomas Pfaff * fhandler_socket.cc (sock_event::~sock_event): New method. (sock_event::load): Change to void. Check if winsock2 is available. (socke_event::wait): Return 0 if interruptible mode is not available. (fhandler_socket::connect): Remove checks for winsock2 availability. (fhandler_socket::accept): Ditto. 2003-05-27 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::dup): First try duplicating using WSADuplicateSocket/WSASocket, if that fails, try DuplicateHandle. 2003-05-27 Bill C. Riemers * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Filter permissions through umask on FAT or if ntsec is off. 2003-05-26 Pierre Humblet * syscalls.cc (statfs): Call GetDiskFreeSpaceEx before GetDiskFreeSpace. 2003-05-26 Corinna Vinschen * fhandler.cc (is_at_eof): Fix conditional. Use INVALID_FILE_SIZE instead of numeric constant. 2003-05-26 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::connect): Guard calls to sock_event methods by a check for WinSock2 availability. (fhandler_socket::accept): Ditto. 2003-05-26 Corinna Vinschen * fhandler.h: Rename FH_W95LSBUG flag to FH_LSEEKED. (fhandler_base::set_did_lseek): Rename from set_check_win95_lseek_bug. (fhandler_base::get_did_lseek): Rename from get_check_win95_lseek_bug. (fhandler_base::set_fs_flags): New method. (fhandler_base::get_fs_flags): Ditto. * fhandler.cc (fhandler_base::write): Make 64 bit clean. Convert file to a "sparse" file when writing after a long lseek (>64K) beyond EOF. (fhandler_base::lseek): Call set_did_lseek() instead of set_check_win95_lseek_bug(). (fhandler_base::fhandler_base): Initialize fs_flags to 0. * fhandler_disk_file.cc (fhandler_disk_file::open): Don't create files as "sparse" unconditionally. Set fs_flags member. 2003-05-25 Pierre Humblet * autoload.cc (GetDiskFreeSpaceEx): Add. * syscalls.cc (statfs): Call full_path.root_dir() instead of rootdir(full_path). Use GetDiskFreeSpaceEx when available and report space available in addition to free space. * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Do not call FindFirstFile for disk root directories. 2003-05-24 Joe Buehler * fhandler_process.cc (format_process_stat): Use PagefileUsage instead of VirtualSize. (get_mem_values): Ditto. 2003-05-21 Corinna Vinschen * shared_info.h: Match shared_name declaration with below change. * shared.cc (shared_name): Use incoming char * parameter instead of local static buffer. (open_shared): Accommodate new calling convention for shared_name. * exceptions.cc (events_init): Ditto. * sigproc.cc (getsem): Ditto. * syscalls.cc (login): Ditto. (logout): Ditto. (pututline): Ditto. 2003-05-20 Corinna Vinschen * fhandler_socket.cc (secret_event_name): Return void. Use incoming char * parameter instead of local static buffer. (fhandler_socket::create_secret_event): Accommodate new calling convention for secret_event_name. (fhandler_socket::close_secret_event): Ditto. 2003-05-20 Corinna Vinschen * fhandler_socket.cc (SECRET_EVENT_NAME): Remove. (ENTROPY_SOURCE_NAME): Ditto. (secret_event_name): New static function. Create shared event name with "Global\" prefix on systems supporting terminal services. (fhandler_socket::set_connect_secret): Fix conditional. (fhandler_socket::create_secret_event): Create secret event using secret_event_name(). (fhandler_socket::close_secret_event): Ditto. * shared.cc (shared_name): Create shared object name with "Global\" prefix on systems supporting terminal services. * wincap.cc: Set has_terminal_services capability throughout. (wincap_2003): New global object representing Windows 2003 Server capabilities. (wincapc::init): Accommodate Windows 2003 Server. * wincap.h (struct wincaps): Add has_terminal_services capability. 2003-05-20 Charles Wilson * winsup/cygwin/include/cygwin/version.h: Bump API minor version. * winsup/cygwin/include/cygwin/types.h: Define key_t as long long. * winsup/cygwin/cygwin.din: Add ftok, _ftok. * winsup/cygwin/ipc.cc (ftok): Rework implementation. 2003-05-18 Joe Buehler * spawn.cc (spawn_guts): Show more of command line in strace output. 2003-05-15 Thomas Pfaff * thread.h (pthread::init_mainthread): Remove function parameter. (MTinterface::Init): Ditto. * thread.cc (MTinterface::Init): Remove function parameter. Always initialize reent_key. (pthread::init_mainthread): Remove function parameter. (MTinterface::fixup_after_fork): Fix pthread::init_mainthread call. * dcrt0.cc (dll_crt_0_1) Fix calls to MTinterface::Init and pthread::init_mainthread. Call pthread::init_mainthread only when not forked. 2003-05-15 Corinna Vinschen * fhandler_proc.cc (format_proc_meminfo): Make swap memory output Linux style values. 2003-05-13 Corinna Vinschen * include/cygwin/config.h: Define __USE_INTERNAL_STAT64 appropriately. 2003-05-12 Corinna Vinschen * Makefile.in (CYGWIN_START): Define as crt0.o. Add to TARGET_LIBS. * fhandler.h (fhandler_virtual::fstat): Remove useless declaration. * fhandler_virtual.cc: Remove _COMPILING_NEWLIB define. * ipc.cc (ftok): Use stat64. * syscalls.cc (_fstat64): Remove alias. (_fstat): Ditto. (_stat): Ditto. (_fstat64_r): New function. (_fstat_r): Ditto. (_stat64_r): Ditto. (stat_r): Ditto. * crt0.o: New file, moved from newlib. * include/sys/param.h: Ditto. * include/sys/utime.h: Ditto. * include/sys/utmp.h: Ditto. * include/sys/dirent.h: Ditto. Expose different struct dirent, dependening of the environment. 2003-05-11 Corinna Vinschen Replace ino_t by __ino64_t throughout. 2003-05-11 Corinna Vinschen * include/cygwin/types.h: Add key_t typedef. 2003-05-10 Christopher Faylor * dir.cc (readdir): Fill out new old_d_ino field. * fhandler.h (fhandler_base::namehash): Define as ino_t. (fhandler_base::get_namehash): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Accommodate new 64 bit st_ino. * fhandler_socket.cc (fhandler_socket::fstat): Ditto. * path.cc (hash_path_name): Return ino_t. * syscalls.cc (stat64_to_stat32): Convert 64 bit inode to 32 bit. * winsup.h (hash_path_name): Declare as returning ino_t. * include/cygwin/stat.h (__stat32): Use 32 bit st_ino. (__stat64): Use 64 bit st_ino. * include/cygwin/types.h (__ino64_t): Define. (__ino32_t): Ditto. (ino_t): Define appropriately. 2003-05-10 Corinna Vinschen * Makefile.in (NEW_FUNCTIONS): All 32/64 from 0.79 API get leading underscore. * cygwin.din: Ditto. * include/cygwin/version.h: Bump API minor number. 2003-05-09 Corinna Vinschen * include/cygwin/config.h: New file. 2003-05-09 Christopher Faylor * cygthread.cc (cygthread::detach): Prioritize waiting for I/O completion over waiting for signal delivery. 2003-05-06 Thomas Pfaff * signal.cc (nanosleep): Do not wait twice for signal arrival. 2003-05-03 Corinna Vinschen * include/cygwin/types.h: Fix erroneous definition of ino_t from 2003-04-28. 2003-05-03 Corinna Vinschen * syscalls.cc (chown_worker): Allow chown'ing of socket files. 2003-04-30 Thomas Pfaff * Makefile.in: Revert patch from 2003-04-17. 2003-04-28 Brian Ford * profil.h (PROFADDR): Prevent overflow when text segments are larger than 256k. * profil.c (profthr_func): Raise thread priority for more accurate sampling. 2003-04-26 Christopher Faylor * path.cc (hash_path_name): Use ino_t as type. 2003-04-26 Christopher Faylor * errno.cc (_sys_nerr): Fix compile error erroneously checked in on 2003-04-23. 2003-04-25 Corinna Vinschen * include/netinet/ip.h: Include netinet/in_systm.h and netinet/in.h to allow standalone usage (autoconf). 2003-04-23 Christopher Faylor * fork.cc: Change SLOW_PID_REUSE to NO_SLOW_PID_REUSE and invert ifdef sense throughout. 2003-04-22 Christopher Faylor * select.cc (fhandler_pipe::ready_for_read): Assure that get_guard is called for successful non-blocking pipe reads. 2003-04-22 Corinna Vinschen * include/inttypes.h: New file. * include/stdint.h: New file. * include/cygwin/in.h: Include stdint.h instead of sys/types.h. * include/cygwin/types.h: Include stdint.h. Remove typedefs for intN_t and uintN_t since these are defined in stdint.h now. 2003-04-21 Christopher Faylor * include/cygwin/version.h: Bump DLL major number to 1005. Change DLL minor number to 0. Bump API minor number. 2003-04-20 Corinna Vinschen * autoload.cc (CreateWindowStationA): Add. (SetProcessWindowStation): Add. 2003-04-19 Christopher Faylor * wincap.h (wincaps:pty_needs_alloc_console): New element. (wincapc:pty_needs_alloc_console): New function. * wincap.cc: Add pty_needs_alloc_console throughout. * fhandler_tty.cc (fhandler_tty_slave::open): Open an "invisible" console on first pty allocation. 2003-04-18 Christopher Faylor * fhandler_tty.cc (fhandler_tty_slave::open): Allocate a console whenever a pty is allocated. 2003-04-18 Christopher Faylor * Makefile.in: Use ${nostdlib} variable. 2003-04-18 Diego Biurrun * fhandler_proc.cc (format_proc_cpuinfo): Change /proc/cpuinfo "vendor id" string to "vendor_id" to conform with Linux systems. 2003-04-17 Christopher Faylor * syscalls.cc (setsid): Don't call FreeConsole if ctty is already < 0. 2003-04-17 Thomas Pfaff * Makefile.in: Add finline-functions optimization to CXXFLAGS. * autoload.cc (LoadDLLprime): Rename std_dll_init to _std_dll_init. (std_dll_init): Remove name mangling prototype. Add attributes used and noinline. (wsock_init): Ditto. Change wsock_init to _wsock_init in wsock32 and ws2_32 LoadDLLprime. * exceptions.cc (unused_sig_wrapper): Remove prototype. Add attributes used and noinline. * pwdgrp.h ((pwdgrp (passwd *&)): Remove inline code. (pwdgrp (__group32 *&)): Ditto. * grp.cc (pwdgrp (passwd *&)): Outline constructor. (pwdgrp (__group32 *&)): Ditto. 2003-04-17 Thomas Pfaff * thread.h (pthread::equal): New static method. * thread.cc: Rename pthread_equal to pthread::equal throughout. (pthread_equal): Use pthread::equal to compare threads ids. 2003-04-15 Christopher Faylor * termios.cc (setspeed): New function. (cfsetospeed): Use setspeed to set speed. (cfsetispeed): Use setspeed to set speed. 2003-04-15 Chris January * autoload.cc: Add load statement for UuidCreate, and UuidCreateSequential. * cpuid.h: New file. * cygwin.din: Export gethostid. * fhandler_proc.cc (cpuid): Move to cpuid.h. (can_set_flag): Move to cpuid.h. * syscalls.cc (gethostid): New function. * version.h: Bump api minor version number to 83. 2003-04-15 Thomas Pfaff * thread.h (pthread_rwlock::release): New method. * thread.cc (pthread_rwlock::unlock): Use release to signal waiting threads. (pthread_rwlock::rdlock_cleanup): Signal waiting threads after a cancelation. (pthread_rwlock::wrlock_cleanup): Ditto. 2003-04-13 Pierre Humblet * mkvers.sh: Prefix day with 0 in date only when day < 10. 2003-04-11 Pierre Humblet * security.cc (get_info_from_sd): New function. (get_nt_attribute): Only call read_sd and get_info_from_sd. Return void. (get_file_attribute): Move sd error handling to get_info_from_sd. and symlink handling to fhandler_disk_file::fstat_helper. (get_nt_object_attribute): Only call read_sd and get_info_from_sd. Return void. (get_object_attribute): Remove symlink handling and simply return -1 when ntsec is off. * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): For symlinks set the attribute, call get_file_attribute to get the ids and return. In the normal case call get_file_attribute with the addresses of the buffer ids and do not recheck if the file is a socket. 2003-04-10 Christopher Faylor * cygthread.cc (cygthread::stub): Initialize stack pointer earlier. (cygthread::simplestub): Initialize stack pointer. (cygthread::terminate_thread): Account for possibility that stack pointer has not been set. Issue warnings for unusual conditions. 2003-04-10 Corinna Vinschen * regex/regex.h: Define regoff_t as _off_t. * regex/regex2.h: Ditto. 2003-04-10 Corinna Vinschen * cygwin.din: Export wcscoll, wcswidth and wcwidth. * include/cygwin/version.h: Bump API minor number. 2003-04-10 Christopher Faylor * cygthread.h: Change 'avail' cygthread element to 'inuse' throughout. * cygthread.cc: Ditto. (cygthread::stub): Don't initialize already initialized events. (cygthread::freerange): Don't create thread here. (cygthread::cygthread): Create thread here. Die if thread not created. (cygthread::operator new): Simplify. Just grab a thread structure from the pool. Don't try to start the thread. (cygthread::terminate_thread): Don't close event handles. Just reuse them. Call MEM_RELEASE rather than MEM_DECOMMIT (from Joe uehler). 2003-04-08 Bob Cassels * fhandler_console.cc (fhandler_console::read) Handle certain key up events, to allow pasting accented characters and typing them using the "alt + numerics" sequences. 2003-04-07 Christopher Faylor * include/limits.h (IOV_MAX): Set to a number which is small enough to use in an array. 2003-04-04 Christopher Faylor * cygthread.h (cygthread::avail): Make LONG for easier use with Interlocked* functions. * cygthread.cc (cygthread::init): Eliminate unneeded muto. (cygthread::operator new): Don't lock. Instead change use of avail variable into tri-state: available (1), not available (-1), uninitialized (0). (cygthread::terminate_thread): Set avail to uninitialized. (cygthread::detach): Eliminate local 'avail'. Always set avail to 1 unless signalled. 2003-04-04 Christopher Faylor * cygthread.cc (cygthread::operator new): Be more defensive when messing with threads that are marked "unavailable". 2003-04-03 Christopher Faylor * fhandler_console.cc (CONVERT_LIMIT): Use a size for the 21st century. 2003-04-03 Corinna Vinschen * external.cc (check_ntsec): Return general ntsec state on NULL filename. Check wincap.is_security() additionally. 2003-04-02 Christopher Faylor * Makefile.in (EXTRA_OFILES): Remove debugging object. 2003-04-02 Jason Tishler Christopher Faylor * external.cc (check_ntsec): New function. (cygwin_internal): Add CW_CHECK_NTSEC handling to call check_ntsec() from applications. * include/cygwin/version.h: Bump API minor number. * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_CHECK_NTSEC. 2003-04-02 Christopher Faylor * cygthread.cc (cygthread::new): Add more defensive debugging. 2003-04-01 Pierre Humblet * fhandler.cc (fhandler_base::fstat): Set the uid and gid fields from the current effective ids. * fhandler_socket.cc (fhandler_socket::fstat): Keep the uid and gid set by fhandler_base::fstat. * security.cc (get_nt_attribute): Do not test wincap.has_security (). (get_nt_object_attribute): Ditto. (get_file_attribute): Add test for wincap.has_security (). (get_object_attribute): Ditto. 2003-04-01 Corinna Vinschen * dir.cc: Change __off32_t to _off_t and __off64_t to _off64_t throughout. * fhandler.cc: Ditto. * fhandler.h: Ditto. * fhandler_clipboard.cc: Ditto. * fhandler_disk_file.cc: Ditto. * fhandler_dsp.cc: Ditto. * fhandler_floppy.cc: Ditto. * fhandler_mem.cc: Ditto. * fhandler_proc.cc: Ditto. * fhandler_process.cc: Ditto. * fhandler_random.cc: Ditto. * fhandler_registry.cc: Ditto. * fhandler_tape.cc: Ditto. * fhandler_termios.cc: Ditto. * fhandler_virtual.cc: Ditto. * fhandler_zero.cc: Ditto. * mmap.cc: Ditto. * pipe.cc: Ditto. * syscalls.cc: Ditto. * winsup.h: Ditto. * include/cygwin/stat.h: Ditto. * include/cygwin/types.h: Ditto. Remove definition of __off32_t and __off64_t. 2003-03-31 Christopher Faylor * exceptions.cc (setup_handler): Make sure winapi lock is released when exiting loop. 2003-03-30 Christopher Faylor * include/cygwin/fs.h: Remove unneeded include. * include/cygwin/in.h: Include sys/types.h rather than cygwin/types.h. 2003-03-29 Corinna Vinschen * syscalls.cc (login): Fix comment. (logout): Ditto. 2003-03-29 Corinna Vinschen * syscalls.cc: Slightly cleanup all utmp functions. (login): Use mutex to secure against concurrent access to wtmp file. (logout): Rewrite using POSIX calls. (utmp_fd): Initialized to -1 now. Any value < 0 is treated as closed in subsequent functions. (utmp_readonly): New variable, indicating utmp file open for reading only. (internal_setutent): New function implementing setutent(). (setutent): Call internal_setutent now. (endutent): Reset utmp_readonly. (getutent): Return immediately if utmp file can't be opened. (getutid): Ditto. (getutline): Ditto. (pututline): Ditto. Use mutex to secure against concurrent access to utmp file. 2003-03-28 Christopher Faylor * Makefile.in: Remove EXE_LDFLAGS. Fix fhandler_CFLAGS typo. Recognize .s suffix. * configure.in: Remove EXE_LDFLAGS. * configure: Regenerate. 2003-03-28 Christopher Faylor * include/sys/cygwin.h: Declare cygwin_internal as unsigned long. * external.cc (cygwin_internal): Define as unsigned long. 2003-03-27 Christopher Faylor * include/sys/cygwin.h: Move cygwin_internal outside of WINVER conditional. 2003-03-27 Thomas Pfaff * thread.cc: Change 1==foo equations to foo==1 throughout. 2003-03-27 Thomas Pfaff * thread.h: Change class names, methods, members and local vars according to the GNU coding style. * thread.cc: Ditto. * dcrt0.cc (dll_crt0_1): Rename pthread::initMainThread call to pthread::init_mainthread. * pthread.cc (pthead_getsequence_np): Rename pthread::isGoodObject call to pthread::is_good_object. 2003-03-27 Joe Buehler * autoload.cc: Add RegGetKeySecurity(). * security.cc (get_nt_object_attribute): Use RegGetKeySecurity() for performance. 2003-03-25 Christopher Faylor Joe Buehler * fork.cc (fork_parent): Don't copy signals from parent to child here. * sigproc.cc (proc_subproc): Copy signals from parent to child pinfo here. 2003-03-23 Thomas Pfaff * thread.h (class List): Move inline code inside class declaration. (List::forEach): Change callback parameter to template class member function pointer. (pthread_keys::fixup_before_fork): Change to inline. Use List::forEach to fixup keys. (pthread_keys::fixup_after_fork): Ditto. (pthread_keys::runAllDestructors): Ditto. (pthread_key::saveAKey): Remove. (pthread_key::restoreAKey): Ditto. (pthread_key::destroyAKey): Ditto. (pthread_key::run_destructor): Rename to runDestructor. (pthread_mutex::fixup_after_fork): Change to inline. Use List::forEach to fixup mutexes after a fork. (pthread_mutex::FixupAfterFork): New method. (pthread_mutex::mutexes): New member. (pthread_cond::fixup_after_fork): Change to inline. Use List::forEach to fixup conds after a fork. (pthread_cond::FixupAfterFork): New method. (pthread_cond::conds): New member. (pthread_rwlock::fixup_after_fork): Change to inline. Use List::forEach to fixup rwlocks after a fork. (pthread_rwlock::FixupAfterFork): New method. (pthread_rwlock::rwlocks): New member. (semaphore::fixup_after_fork): Change to inline. Use List::forEach to fixup mutexes after a fork. (semaphore::FixupAfterFork): New method. (semaphore::semaphores): New member. (MTinterface::mutexs): Remove. (MTinterface::conds): Ditto. (MTinterface::rwlocks): Ditto. (MTinterface::semaphores): Ditto. (pthread_equal): Add extern "C". (pthread_mutex_lock): Ditto. * thread.cc (MTinterface::fixup_after_fork): Change fixup_after_fork calls for pthread objects. (semaphore::conds): Instantiate. (pthread_cond::pthread_cond): Use List::Insert rather than custom list code. (pthread_cond::~pthread_cond): Use List::Remove rather than custom list code. (pthread_cond::fixup_after_fork): Rename to FixupAfterFork. (pthread_rwlock::rwlocks): Instantiate. (pthread_rwlock::pthread_crwlock): Use List::Insert rather than custom list code. (pthread_rwlock::~pthread_rwlock): Use List::Remove rather than custom list code. (pthread_rwlock::fixup_after_fork): Rename to FixupAfterFork. (pthread_key::saveAKey): Remove. (pthread_key::fixup_before_fork): Ditto. (pthread_key::restoreAKey): Ditto. (pthread_key::fixup_after_fork): Ditto. (pthread_key::destroyAKey): Ditto. (pthread_key::runAllDestructors): Ditto. (pthread_key::run_destructor): Rename to runDestructor. (pthread_mutex::mutexes): Instantiate. (pthread_mutex::pthread_mutex): Use List::Insert rather than custom list code. (pthread_mutex::~pthread_mutex): Use List::Remove rather than custom list code. (pthread_mutex::fixup_after_fork): Rename to FixupAfterFork. (semaphore::conds): Instantiate. (semaphore::semaphore): Use List::Insert rather than custom list code. (semaphores::~semaphore): Use List::Remove rather than custom list code. (semaphore::fixup_after_fork): Rename to FixupAfterFork. 2003-03-22 Christopher Faylor * pipe.cc (fhandler_pipe::dup): Don't dup input_handle if it doesn't exist. 2003-03-22 Christopher Faylor * syscalls.cc (unlink): Be more defensive when SetFileAttributes is called. Fix typo in debugging output. 2003-03-21 Christopher Faylor * fork.cc: Conditionalize use of slow_pid_reuse throughout. It's not necessary for newer versions of bash. 2003-03-20 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::sendto): Restrict EPIPE and SIGPIPE handling to connection oriented sockets. Add comment. 2003-03-19 Christopher Faylor * sigproc.h (signal_fixup_after_exec): Eliminate argument in declaration. * exceptions.cc (signal_fixup_after_exec): Eliminate argument in definition. Don't reset signal handlers after spawm. Just treat like fork/exec. * dcrt0.cc (dll_crt0_1): Don't pass PROC_SPAWN argument to signal_fixup_after_exec. * syscalls.cc (unlink): Don't change attributes of file if not readonly/system. Ditto for resetting of arguments. 2003-03-19 Corinna Vinschen * glob.c: Eliminate __INSIDE_CYGWIN__ preprocessor conditionals throughout. 2003-03-19 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Fix wrong usage of S_IFDIR. * security.cc (get_attribute_from_acl): Ditto. (get_file_attribute): Fix wrong usage of S_IFLNK. (get_object_attribute): Ditto. (alloc_sd): Fix wrong usage of S_IFDIR. * syscalls.cc (chmod): Allow chmod'ing of socket files. 2003-03-19 Corinna Vinschen * include/cygwin/version.h (CYGWIN_VERSION_CHECK_FOR_USING_BIG_TYPES): Define. * glob.c (g_lstat): Use CYGWIN_VERSION_CHECK_FOR_USING_BIG_TYPES instead of numerical constants. (g_stat): Ditto. 2003-03-18 Thomas Pfaff * pthread.cc (pthread_attr_init): Remove (pthread_attr_destroy): Ditto. (pthread_attr_setdetachstate): Ditto. (pthread_attr_getdetachstate): Ditto. (pthread_attr_setstacksize): Ditto. (pthread_attr_getstacksize): Ditto. (pthread_attr_setinheritsched): Ditto. (pthread_attr_getinheritsched): Ditto. (pthread_attr_setschedparam): Ditto. (pthread_attr_getschedparam): Ditto. (pthread_attr_setschedpolicy): Ditto. (pthread_attr_getschedpolicy): Ditto. (pthread_attr_setscope): Ditto. (pthread_attr_getscope): Ditto. (pthread_attr_setstackaddr): Ditto. (pthread_attr_getstackaddr): Ditto. (pthread_key_create): Ditto. (pthread_key_delete): Ditto. (pthread_setspecific): Ditto. (pthread_getspecific): Ditto. (pthread_kill): Ditto. (pthread_sigmask): Ditto. (pthread_equal): Ditto. (pthread_mutex_lock): Ditto. (pthread_mutex_trylock): Ditto. (pthread_mutex_unlock): Ditto. (pthread_mutex_destroy): Ditto. (pthread_mutex_setprioceiling): Ditto. (pthread_mutex_getprioceiling): Ditto. (pthread_mutexattr_destroy): Ditto. (pthread_mutexattr_getprioceiling): Ditto. (pthread_mutexattr_getprotocol): Ditto. (pthread_mutexattr_getpshared): Ditto. (pthread_mutexattr_gettype): Ditto. (pthread_mutexattr_init): Ditto. (pthread_mutexattr_setprioceiling): Ditto. (pthread_mutexattr_setprotocol): Ditto. (pthread_mutexattr_setpshared): Ditto. (pthread_mutexattr_settype): Ditto. (pthread_cond_destroy): Ditto. (pthread_cond_signal): Ditto. (pthread_cond_broadcast): Ditto. (pthread_condattr_init): Ditto. (pthread_condattr_destroy): Ditto. (pthread_condattr_getpshared): Ditto. (pthread_condattr_setpshared): Ditto. (pthread_rwlock_destroy): Ditto. (pthread_rwlock_rdlock): Ditto. (pthread_rwlock_tryrdlock): Ditto. (pthread_rwlock_wrlock): Ditto. (pthread_rwlock_trywrlock): Ditto. (pthread_rwlock_unlock): Ditto. (pthread_rwlockattr_init): Ditto. (pthread_rwlockattr_getpshared): Ditto. (pthread_rwlockattr_setpshared): Ditto. (pthread_rwlockattr_destroy): Ditto. (pthread_getconcurrency): Ditto. (pthread_setconcurrency): Ditto. (pthread_getschedparam): Ditto. (pthread_setschedparam): Ditto. * thread.h (__pthread_attr_init): Remove prototype. (__pthread_attr_destroy): Ditto. (__pthread_attr_setdetachstate): Ditto. (__pthread_attr_getdetachstate): Ditto. (__pthread_attr_setstacksize): Ditto. (__pthread_attr_getstacksize): Ditto. (__pthread_attr_setinheritsched): Ditto. (__pthread_attr_getinheritsched): Ditto. (__pthread_attr_setschedparam): Ditto. (__pthread_attr_getschedparam): Ditto. (__pthread_attr_setschedpolicy): Ditto. (__pthread_attr_getschedpolicy): Ditto. (__pthread_attr_setscope): Ditto. (__pthread_attr_getscope): Ditto. (__pthread_attr_setstackaddr): Ditto. (__pthread_attr_getstackaddr): Ditto. (__pthread_key_create): Ditto. (__pthread_key_delete): Ditto. (__pthread_setspecific): Ditto. (__pthread_getspecific): Ditto. (__pthread_kill): Ditto. (__pthread_sigmask): Ditto. (__pthread_equal): Ditto. (__pthread_mutex_lock): Ditto. (__pthread_mutex_trylock): Ditto. (__pthread_mutex_unlock): Ditto. (__pthread_mutex_destroy): Ditto. (__pthread_mutex_setprioceiling): Ditto. (__pthread_mutex_getprioceiling): Ditto. (__pthread_mutexattr_destroy): Ditto. (__pthread_mutexattr_getprioceiling): Ditto. (__pthread_mutexattr_getprotocol): Ditto. (__pthread_mutexattr_getpshared): Ditto. (__pthread_mutexattr_gettype): Ditto. (__pthread_mutexattr_init): Ditto. (__pthread_mutexattr_setprioceiling): Ditto. (__pthread_mutexattr_setprotocol): Ditto. (__pthread_mutexattr_setpshared): Ditto. (__pthread_mutexattr_settype): Ditto. (__pthread_cond_destroy): Ditto. (__pthread_cond_signal): Ditto. (__pthread_cond_broadcast): Ditto. (__pthread_condattr_init): Ditto. (__pthread_condattr_destroy): Ditto. (__pthread_condattr_getpshared): Ditto. (__pthread_condattr_setpshared): Ditto. (__pthread_rwlock_destroy): Ditto. (__pthread_rwlock_rdlock): Ditto. (__pthread_rwlock_tryrdlock): Ditto. (__pthread_rwlock_wrlock): Ditto. (__pthread_rwlock_trywrlock): Ditto. (__pthread_rwlock_unlock): Ditto. (__pthread_rwlockattr_init): Ditto. (__pthread_rwlockattr_getpshared): Ditto. (__pthread_rwlockattr_setpshared): Ditto. (__pthread_rwlockattr_destroy): Ditto. (__pthread_getconcurrency): Ditto. (__pthread_setconcurrency): Ditto. (__pthread_getschedparam): Ditto. (__pthread_setschedparam): Ditto. * thread.cc: Rename __pthread_equal to pthread_equal throughout. Change pthread_self parameter appropriate. (__pthread_attr_init): Remove __ prefix. Change to extern "C". (__pthread_attr_destroy): Ditto. (__pthread_attr_setdetachstate): Ditto. (__pthread_attr_getdetachstate): Ditto. (__pthread_attr_setstacksize): Ditto. (__pthread_attr_getstacksize): Ditto. (__pthread_attr_setinheritsched): Ditto. (__pthread_attr_getinheritsched): Ditto. (__pthread_attr_setschedparam): Ditto. (__pthread_attr_getschedparam): Ditto. (__pthread_attr_setschedpolicy): Ditto. (__pthread_attr_getschedpolicy): Ditto. (__pthread_attr_setscope): Ditto. (__pthread_attr_getscope): Ditto. (__pthread_attr_setstackaddr): Ditto. (__pthread_attr_getstackaddr): Ditto. (__pthread_key_create): Ditto. (__pthread_key_delete): Ditto. (__pthread_setspecific): Ditto. (__pthread_getspecific): Ditto. (__pthread_kill): Ditto. (__pthread_sigmask): Ditto. (__pthread_equal): Ditto. (__pthread_mutex_lock): Ditto. (__pthread_mutex_trylock): Ditto. (__pthread_mutex_unlock): Ditto. (__pthread_mutex_destroy): Ditto. (__pthread_mutex_setprioceiling): Ditto. (__pthread_mutex_getprioceiling): Ditto. (__pthread_mutexattr_destroy): Ditto. (__pthread_mutexattr_getprioceiling): Ditto. (__pthread_mutexattr_getprotocol): Ditto. (__pthread_mutexattr_getpshared): Ditto. (__pthread_mutexattr_gettype): Ditto. (__pthread_mutexattr_init): Ditto. (__pthread_mutexattr_setprioceiling): Ditto. (__pthread_mutexattr_setprotocol): Ditto. (__pthread_mutexattr_setpshared): Ditto. (__pthread_mutexattr_settype): Ditto. (__pthread_cond_destroy): Ditto. (__pthread_cond_signal): Ditto. (__pthread_cond_broadcast): Ditto. (__pthread_condattr_init): Ditto. (__pthread_condattr_destroy): Ditto. (__pthread_condattr_getpshared): Ditto. (__pthread_condattr_setpshared): Ditto. (__pthread_rwlock_destroy): Ditto. (__pthread_rwlock_rdlock): Ditto. (__pthread_rwlock_tryrdlock): Ditto. (__pthread_rwlock_wrlock): Ditto. (__pthread_rwlock_trywrlock): Ditto. (__pthread_rwlock_unlock): Ditto. (__pthread_rwlockattr_init): Ditto. (__pthread_rwlockattr_getpshared): Ditto. (__pthread_rwlockattr_setpshared): Ditto. (__pthread_rwlockattr_destroy): Ditto. (__pthread_getconcurrency): Ditto. (__pthread_setconcurrency): Ditto. (__pthread_getschedparam): Ditto. (__pthread_setschedparam): Ditto. 2003-03-18 Thomas Pfaff * cygwin.din: Add pthread_rwlock_destroy, pthread_rwlock_init, pthread_rwlock_rdlock, pthread_rwlock_tryrdlock, pthread_rwlock_wrlock, pthread_rwlock_trywrlock, pthread_rwlock_unlock, pthread_rwlockattr_init, pthread_rwlockattr_getpshared, pthread_rwlockattr_setpshared, and pthread_rwlockattr_destroy. * include/cygwin/version.h: Bump API minor number. * include/pthread.h (PTHREAD_RWLOCK_INITIALIZER): Define a reasonable value. Add prototypes for pthread_rwlock_destroy, pthread_rwlock_init, pthread_rwlock_rdlock, pthread_rwlock_tryrdlock, pthread_rwlock_wrlock, pthread_rwlock_trywrlock, pthread_rwlock_unlock, pthread_rwlockattr_init, pthread_rwlockattr_getpshared, pthread_rwlockattr_setpshared, and pthread_rwlockattr_destroy. * thread.h (PTHREAD_ONCE_MAGIC): Remove superflous semicolon. (PTHREAD_RWLOCK_MAGIC): New define. (PTHREAD_RWLOCKATTR_MAGIC): Ditto. (pthread_rwlockattr): New class. (pthread_rwlock): Ditto. (MTinterface::rwlocks): New member. (MTinterface::MTinterface): Initialize rwlocks. Add prototypes for __pthread_rwlock_destroy, __pthread_rwlock_wrlock, __pthread_rwlock_trywrlock, __pthread_rwlock_unlock, __pthread_rwlockattr_init, __pthread_rwlockattr_getpshared, __pthread_rwlockattr_setpshared, and __pthread_rwlockattr_destroy. * thread.cc (MTinterface::Init): Initialize rwlock internal mutex. (MTinterface::fixup_after_fork): Fixup rwlocks after fork. (pthread_rwlockattr::isGoodObject): Implement. (pthread_rwlockattr::pthread_rwlockattr): Ditto. (pthread_rwlockattr::~pthread_rwlockattr): Ditto. (pthread_rwlock::initMutex): Ditto. (pthread_rwlock::pthread_rwlock): Ditto. (pthread_rwlock::~pthread_rwlock): Ditto. (pthread_rwlock::RdLock): Ditto. (pthread_rwlock::TryRdLock): Ditto. (pthread_rwlock::WrLock): Ditto. (pthread_rwlock::TryWrLock): Ditto. (pthread_rwlock::UnLock): Ditto. (pthread_rwlock::addReader): Ditto. (pthread_rwlock::removeReader): Ditto. (pthread_rwlock::lookupReader): Ditto. (pthread_rwlock::RdLockCleanup): Ditto. (pthread_rwlock::WrLockCleanup): Ditto. (pthread_rwlock::fixup_after_fork): Ditto. (pthread_rwlock::isGoodObject): Ditto. (pthread_rwlock::isGoodInitializer): Ditto. (pthread_rwlock::isGoodInitializerOrObject): Ditto. (pthread_rwlock::isGoodInitializerOrBadObject): Ditto. (__pthread_rwlock_destroy): Ditto. (pthread_rwlock::init): Ditto. (__pthread_rwlock_rdlock): Ditto. (__pthread_rwlock_tryrdlock): Ditto. (__pthread_rwlock_wrlock): Ditto. (__pthread_rwlock_trywrlock): Ditto. 2003-03-18 Thomas Pfaff * thread.h (pthread_cond::ExitingWait): Remove. (pthread_cond::mutex): Ditto. (pthread_cond::cond_access): Ditto. (pthread_cond::win32_obj_id): Ditto. (pthread_cond::TimedWait): Ditto. (pthread_cond::BroadCast): Ditto. (pthread_cond::Signal): Ditto. (pthread_cond::waiting): Change type to unsigned long. (pthread_cond::pending): New member. (pthread_cond::semWait): Ditto. (pthread_cond::mtxIn): Ditto. (pthread_cond::mtxOut): Ditto. (pthread_cond::mtxCond): Ditto. (pthread_cond::UnBlock): New method. (pthread_cond::Wait): Ditto. * thread.cc: Update list of cancellation points. (pthread_cond::pthread_cond): Rewrite. (pthread_cond::~pthread_cond): Ditto. (pthread_cond::TimedWait): Remove. (pthread_cond::BroadCast): Ditto. (pthread_cond::Signal): Ditto. (pthread_cond::UnBlock): Implement. (pthread_cond::Wait): Ditto. (pthread_cond::fixup_after_fork): Rewrite. (pthread_mutex::fixup_after_fork): Remove DETECT_BAD_APP conditional. (__pthread_cond_broadcast): Just return 0 if the condition is not initialized. Call pthread_cond::UnBlock to release blocked threads. (__pthread_cond_signal): Ditto. (__pthread_cond__dowait): Rewrite. (pthread_cond_timedwait): Add pthread_testcancel call. Fix waitlength calculation. (pthread_cond_wait): Add pthread_testcancel call. 2003-03-18 Thomas Pfaff * include/pthread.h (PTHREAD_MUTEX_NORMAL): New define. * thread.cc: Remove errno.h include. (pthread::precreate): Change internal mutex type to normal. (pthread_mutex::canBeUnlocked): Implement. (pthread_mutex::pthread_mutex): Initialize lock_counter with 0. (pthread_mutex::Lock): Rename to _Lock. Add self parameter. Change lock_counter logic. Update SetOwner call. (pthread_mutex::TryLock): Rename to _TryLock. Add self parameter. Change lock_counter logic. Update SetOwner call. (pthread_mutex::UnLock): Rename to _UnLock. Add self parameter. Change lock_counter logic. (pthread_mutex::Destroy): Rename to _Destroy. Update TryLock call. (pthread_mutex::SetOwner): Move to thread.h as inline. (pthread_mutex::LockRecursive): Ditto. (pthread_mutex::fixup_after_fork): Change lock_counter logic. (__pthread_mutexattr_settype): Add PTHREAD_MUTEX_NORMAL to valid types check. * thread.h: Include errno.h and limits.h. (MUTEX_LOCK_COUNTER_INITIAL): Remove. (MUTEX_OWNER_ANONYMOUS): New define. (pthread_mutex::canBeUnlocked): New static method. (pthread_mutex::lock_counter): Change type to unsigned long. (pthread_mutex::GetPthreadSelf): New method. (pthread_mutex::Lock): Call _Lock with pthread_self pointer. (pthread_mutex::TryLock): Call _TryLock with pthread_self pointer. (pthread_mutex::UnLock): Call _UnLock with pthread_self pointer. (pthread_mutex::Destroy): Call _Destroy with pthread_self pointer. (pthread_mutex::SetOwner): Moved from thread.cc as inline. (pthread_mutex::LockRecursive): Ditto. (pthread_mutex::_Lock): New method. (pthread_mutex::_TryLock): New method. (pthread_mutex::_UnLock): New method. (pthread_mutex::_Destroy): New method. 2003-03-18 Christopher January * fhandler_proc.cc (format_proc_cpuinfo): Use IsProcessorFeaturePresent only on Windows NT. Read CPU Mhz value only on NT. Revert previous change so cpuid instruction is called even on non-NT systems. 2003-03-17 Corinna Vinschen * glob.c (g_lstat): Change API minor test to match API minor number change in previous patch. (g_stat): Ditto. 2003-03-17 Christopher Faylor * include/cygwin/version.h: Reorganize last two api versions so that btowc and trunc exports show up before previous bump since there has been no exported version of the DLL with the 64 bit changes yet but 1.3.22 will have the btowc and trunc. 2003-03-17 Christopher Faylor * cygwin.din: Export btowc, trunc. * include/cygwin/version.h: Reflect new exports. * syscalls.cc (_stat): Rename to stat to avoid newlib wrapper. * syscalls.cc (_fstat): Ditto. 2003-03-16 Christopher Faylor * fhandler_console.cc (fhandler_console::close): Correct check for current tty. Add debugging output when console is freed. (set_console_state_for_spawn): Add debugging output. * fhandler_tty.cc (fhandler_tty_slave::open): Don't decrement console open flag when vforking. * sigproc.cc (sigproc_terminate): Fix debugging output. * spawn.cc (handle): Eliminate second argument. (spawn_guts): Reflect elimination of argument change to handle. * syscalls.cc (setsid): Add debugging output when console is freed. 2003-03-14 Christopher Faylor * syscalls.cc (rename): Revert assumption that DELETE_ON_CLOSE works on Win9x. 2003-03-13 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 23. 2003-03-13 Corinna Vinschen * autoload.cc (IsProcessorFeaturePresent): Add. * fhandler_proc.cc (format_proc_cpuinfo): Add case for 9x systems. 2003-03-13 Corinna Vinschen * fhandler_proc.cc (format_proc_cpuinfo): Fix vendor id in cpuid case. 2003-03-13 Corinna Vinschen * net.cc (cygwin_rcmd): Use correct file descriptor in call to fdsock. (cygwin_rexec): Ditto. 2003-03-13 Christopher Faylor * fhandler_tty.cc (fhandler_tty_slave::close): Fix typo in debug output. * syscalls.cc (rename): Assume that DELETE_ON_CLOSE works on Win9x. 2003-03-11 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::dup): Don't call fhandler_base::dup() but call DuplicateHandle directly instead to have control over socket inheritence. 2003-03-11 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::dup): On NT systems avoid using WinSock2 socket duplication methods. Add comment. 2003-03-11 Pierre Humblet * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Set io_handle to INVALID_SOCKET in case of failure. (fhandler_socket::dup): Return 0 if the io_handle is valid. 2003-03-10 Corinna Vinschen * sec_acl.cc (setacl): Don't handle DELETE flag specially. * security.cc (alloc_sd): Ditto. 2003-03-09 Corinna Vinschen * winver.rc: Change Copyright hint to include 2003. 2003-03-09 Corinna Vinschen Switch to 32/64 datatypes: * Makefile.in (OBSOLETE_FUNCTIONS): Add open acl aclcheck aclfrommode aclfrompbits aclfromtext aclsort acltomode acltopbits acltotext chown facl fchown fgetpos fopen freopen fseeko fsetpos fstat ftello ftruncate getegid geteuid getgid getgrent getgrgid getgrnam getgroups getpwuid getpwuid_r getuid initgroups lchown lseek lstat mknod mmap seekdir setegid seteuid setgid setgroups setregid setreuid setuid stat telldir truncate. (NEW_FUNCTIONS): Add _open64 acl32 aclcheck32 aclfrommode32 aclfrompbits32 aclfromtext32 aclsort32 acltomode32 acltopbits32 acltotext32 chown32 facl32 fchown32 fgetpos64 fopen64 freopen64 fseeko64 fsetpos64 fstat64 ftello64 ftruncate64 getegid32 geteuid32 getgid32 getgrent32 getgrgid32 getgrnam32 getgroups32 getpwuid32 getpwuid_r32 getuid32 initgroups32 lchown32 lseek64 lstat64 mknod32 mmap64 seekdir64 setegid32 seteuid32 setgid32 setgroups32 setregid32 setreuid32 setuid32 stat64 telldir64 truncate64 to substitute the above. * cygserver_shm.h (class client_request_shm): Change uid_t and gid_t members to __uid32_t and __gid32_t. * cygwin.din: Add symbols acl32 aclcheck32 aclfrommode32 aclfrompbits32 aclfromtext32 aclsort32 acltomode32 acltopbits32 acltotext32 facl32 fgetpos64 fopen64 freopen64 fseeko64 fsetpos64 _fstat64 ftello64 _lseek64 mknod32 _open64. * glob.c: Include perprocess.h. (globtilde): Call getpwuid32 and getuid32 instead of getpwuid and getuid. (g_lstat): Check for applications API version to call the appropriate typed gl_lstat function. (g_stat): Ditto for gl_stat. * shm.cc (client_request_shm::client_request_shm): Call geteuid32 and getegid32 instead of geteuid and getegid throughout. * syscalls.cc (_open64): New alias for open. (_lseek64): New alias for lseek64. (_fstat64): New alias for fseek64. (mknod32): New function. (mknod): Calls mknod32 now. * winsup.h: Make function declarations for getuid32, geteuid32, and getpwuid32 accessible for plain C sources. Add declarations for getegid32 and getpwnam. * include/cygwin/version.h: Bum API minor number to 78. * include/sys/cygwin.h: Guard C++ specific members of struct per_process against inclusion in plain C sources. * include/sys/mman.h (mman): Add guard to avoid type clash when compiling Cygwin. 2003-03-09 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 22. 2003-03-09 Christopher Faylor Do some minor reformatting of 'extern "C"' use throughout. 2003-03-06 Christopher January * autoload.cc (GetSystemTimes): Define new autoload function. * fhandler_proc.cc (proc_listing): Add cpuinfo and partitions entries. (fhandler_proc::fill_filebuf): Add PROC_CPUINFO and PROC_PARTITIONS cases. (format_proc_uptime): Use GetSystemTimes if available. (read_value): New macro. (print): New macro. (cpuid): New function. (can_set_flag): New function. (format_proc_cpuinfo): New function. (format_proc_partitions): New function. 2003-03-09 Christopher Faylor * syscalls.cc (unlink): Attempt to be more clever about setting attributes of file. Only open file in query mode to avoid having to mess with security stuff for reading. 2003-03-09 Corinna Vinschen * rmsym: Fix regular expression. 2003-03-09 Christopher Faylor * Makefile.in: Change from using new-* to cygwin0 for temporary targets. 2003-03-09 Corinna Vinschen * include/cygwin/socket.h: Set SOMAXCONN to Winsock2 value. 2003-03-08 Christopher Faylor * syscalls.cc (unlink): Always attempt to use FILE_FLAG_CLOSE_ON_DELETE to delete files since this allows us to preserve the protection of hard linked files. (link): Generate full path for potentially recalculated .lnk target. 2003-03-08 Christopher Faylor Revert below changes regarding _pinfo::cmdline. 2003-03-08 Corinna Vinschen * external.cc (cygwin_internal): Change n to __off64_t to match change of _pinfo::cmdline. * fhandler.h (class fhandler_virtual): Change filesize member to __off64_t. * fhandler_proc.cc (format_proc_meminfo): Change to return __off64_t. (format_proc_stat): Ditto. (format_proc_uptime): Ditto. * fhandler_process.cc (format_process_stat): Ditto. (format_process_status): Ditto. (format_process_statm): Ditto. * pinfo.cc (_pinfo::cmdline): Expect __off64_t parameter. * pinfo.h (class _pinfo): Change declaration of cmdline accordingly. 2003-03-07 Christopher Faylor * path.h (PATH_LNK): New enum val. (path_conv::is_lnk_symlink): New function. True if path represents .lnk style symlink. * path.cc (check_shortcut): Set PATH_LNK in pflags when appropriate. (symlink_info::check): Ditto. Remove PATH_LNK from pflags initially. * syscalls.cc (unlink): Always remove readonly attribute from a symlink regardless of type. (link): (from Corinna Vinschen) Allow links to symlinks. Reset attributes on a symlink after successful link creation. (chmod): Use is_lnk_symlink where appropriate. (rename): Ditto. 2003-03-07 Pierre Humblet * tty.cc (create_tty_master): Call GetComputerName instead of cygwin_gethostname. Set ut_id. * syscalls.cc (login): Call endutent. (setutent): Do not seek after a fresh open. 2003-03-07 Corinna Vinschen * syscalls.cc (seteuid32): Fix formatting. 2003-03-04 Thomas Pfaff * thread.cc (MTinterface::fixup_after_fork): Initialize mainthread prior to pthread objects. 2003-03-04 Jason Tishler * fhandler_socket.cc (fhandler_socket::dup): Initialize type. 2003-03-03 Christopher Faylor * fhandler.h (fhandler_tty_slave::close): Declare new function. (fhandler_tty_slave::dup): Declare new function. (fhandler_tty_slave::fixup_after_function): Declare new function. * fhandler_tty.cc (fhandler_tty_slave_open): Only increment fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::close): Define new function. Decrement fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::dup): Define new function. Increment fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::fixup_after_fork): Define new function. Increment fhandler_console::open_fhs when associated with a pty. 2003-03-03 Christopher Faylor * fhandler_tty.cc (fhandler_pty_slave::open): Grudgingly increment fhandler_console::open_fhs here. (fhandler_pty_slave::close): Ditto for close. 2003-03-02 Christopher Faylor * lib/getopt.c: Refresh from NetBSD sources. 2003-03-02 Christopher Faylor * fhandler_console.cc (fhandler_console::close): Don't decrement in use counter if in vfork fixup stage. 2003-03-02 Christopher Faylor * lib/getopt.c: Nuke use of unneeded BSDisms. 2003-03-02 Christopher Faylor * dll_init.cc (dll_list::load_after_fork): Don't revert to LoadLibrary if LoadLibraryEx fails. * dtable.cc (dtable::dec_console_fds): Eliminate. (dtable::release): Don't treat console specially. (dtable::build_fhandler): Ditto. * dtable.h (console_fds): Eliminate. (dtable::dec_console_fds): Eliminate. (dtable::inc_console_fds): Eliminate. * fhandler.h (fhandler_console::open_fhs): New static element. * fhandler_console.cc (fhandler_console::open): Increment open_fs. (fhandler_console::close): Call FreeConsole if no more open consoles and ctty is not associated with the console. * syscalls.cc (setsid): Simplify check for when to call FreeConsole. (check_pty_fds): Eliminate definition. * winsup.h (check_pty_fds): Eliminate declaration. 2003-03-02 Christopher Faylor * dll_init.cc (dll_list::load_after_fork): Fix typo where result of LoadLibrary was ignored. 2003-03-01 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::bind): Open and write socket file using Win32 calls. 2003-03-01 Corinna Vinschen * fhandler_socket.cc (get_inet_addr): Open and read socket file using Win32 calls. 2003-02-28 Christopher Faylor * cygwin.din: Wrap atexit and exit with cygwin, thread-safe functions. * dcrt0.cc (cygwin_atexit): New function. (cygwin_exit): Ditto. 2003-02-28 Pierre Humblet * syscalls.cc (fstat64): Pass get_name () to pc. (access): Pass fn to stat_worker. 2003-03-27 Corinna Vinschen * fhandler_socket.cc (class sock_event): New class managing Winsock events for interruptible socket calls. (fhandler_socket::connect): Move support for interruptible call to class sock_event. Use class object instead. (fhandler_socket::accept): Ditto. Remove useless casts. 2003-03-27 Thomas Pfaff * fhandler_socket.cc (fhandler_socket::connect): Add support for an interruptable connect. 2003-02-27 Pierre Humblet * uinfo.cc (internal_getlogin): Only update user.groups.pgsid if the call to set the primary group succeeds. 2003-02-27 Christopher Faylor * cygthread::detach: Improve error message. 2003-02-26 Pierre Humblet * sec_helper.cc (get_sids_info): debug_print owner_sid and group_sid. 2003-02-25 Corinna Vinschen * mmap.cc (mmap64): Fix returned address by taking the granularity into account. 2003-02-23 Pierre Humblet * syslog.cc (syslog): Do not unlock the file before closing it and remove debug_printf about stream errors. 2003-02-22 Christopher Faylor * cygmalloc.h: Remove MORECORE_CANNOT_TRIM. It's not true. # cygwin.din: Export mallinfo. # malloc_wrapper.cc (mallinfo): New function. 2003-02-22 Pierre Humblet * syslog.cc (syslog): Do not print the Windows pid. Print the Cygwin pid as an unsigned decimal. On Win95 print a timestamp and attempt to lock the file up to four times in 3 ms. 2003-02-21 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::fhandler_socket): Fix compiler warning. (fhandler_socket::fstat): Simplify. Set st_uid/st_gid to effective uid/gid of current process in case of open sockets. 2003-02-21 Corinna Vinschen * dtable.cc (dtable::build_fhandler_from_name): Set some fhandler data on sockets to evaluate AF_LOCAL sockets correctly. (dtable::build_fhandler): Set unit number on sockets. * fhandler.h (fhandler_socket): Add unit number. (fhandler_socket::get_unit): New method. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Set unit number. (fhandler_socket::fstat): Reorganize to return more Linux-like values. * net.cc: include ctype.h. (fdsock): Set unit number when building fhandler. * path.cc (path_conv::check): Set device type to FH_SOCKET if file is a AF_UNIX socket. (get_devn): Evaluate unit for virtual socket devices. (win32_device_name): Set windows path for sockets to unix_path with just backslashes to keep the different names. * syscalls.cc (fstat64): Don't override st_ino, st_dev and st_rdev for sockets. (stat_worker): Ditto. 2003-02-21 Pierre Humblet * autoload.cc (AccessCheck): Add. (DuplicateToken): Add. * security.h (check_file_access): Declare. * syscalls.cc (access): Convert path to Windows, check existence and readonly attribute. Call check_file_access instead of acl_access. * security.cc (check_file_access): Create. * sec_acl (acl_access): Delete. 2003-02-19 Christopher Faylor * fhandler.cc (fhandler_base::open): Move some filesystem specific stuff. (fhandler_disk_file::open): Accept some filesystem specific stuff. * sigproc.cc (wait_for_sigthread): Become slightly more thread safe. (sig_send): Don't assume that signal thread is ready. 2003-02-20 Corinna Vinschen * wincap.h (wincap): Remove unnecessary definition of supports_sparse_files. * wincap.cc: Ditto. 2003-02-20 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::opendir): Check descriptor created by cygheap_fdnew constructor. * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto. * fhandler_socket.cc (fhandler_socket::accept): Ditto and move creation of file descriptor behind blocking OS call. * net.cc (cygwin_socket): Ditto. (cygwin_rcmd): Ditto. (cygwin_rresvport): Ditto. (cygwin_rexec): Ditto. (socketpair): Ditto. 2003-02-20 Corinna Vinschen * autoload.cc (GetCompressedFileSize): Add. * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Compute st_blocks value from GetCompressedFileSize() if available. 2003-02-18 Vaclav Haisman * wincap.h (wincaps::supports_sparse_files): New flag. (wincapc::supports_sparse_files): New method. * wincap.cc (wincap_unknown): Define value for the new flag. (wincap_95): Ditto. (wincap_95osr2): Ditto. (wincap_98): Ditto. (wincap_98se): Ditto. (wincap_me): Ditto. (wincap_nt3): Ditto. (wincap_nt4): Ditto. (wincap_nt4sp4): Ditto. (wincap_2000): Ditto. (wincap_xp): Ditto. * path.h (path_conv::fs_flags): New method. * fhandler_disk_file.cc: Include winioctl.h for DeviceIoControl. (fhandler_disk_file::open): Set newly created and truncated files as sparse on platforms that support it. 2003-02-17 Pierre Humblet * grp.cc (internal_getgroups): Handle properly tokens with no groups. Fix bug introduced on 2003-02-04. 2003-02-16 Christopher Faylor * cygwin.din: Export all appropriate newlib libm functions. Sort. * include/cygwin/version.h: Bump API minor number. 2003-02-15 Christopher Faylor * cygwin.din: Export all appropriate newlib libc functions. * include/cygwin/version.h: Bump API minor number. 2003-02-14 Jason Tishler * mmap.cc (mprotect): Add missing break. 2003-02-13 Christopher Faylor * exceptions.cc (try_to_debug): Don't reset priority when returning from non-waitloop call. 2003-02-13 Vaclav Haisman Christopher Faylor * fhandler_console.cc (fhandler_console::write_normal): Use MessageBeep for bell sound. * autoload.cc (MessageBeep): Add. 2003-02-13 Christopher Faylor * include/cygwin/types.h: Use correct ifdef guard for u_ definitions. 2003-02-13 Christopher Faylor * environ.cc (environ_init): Use strechr. 2003-02-13 Christopher Faylor * include/cygwin/in.h (sockaddr_in): Fix typo. 2003-02-12 Christopher Faylor * path.h (path_conv): Reorganize slightly. 2003-02-12 Christopher Faylor * fhandler_tty.cc (process_input): Add sanity check to ensure that console typeahead is cleared on signal. 2003-02-12 Christopher Faylor * spawn.cc (linebuf::~linebuf): Resurrect commented out (for debugging?) code. 2003-02-10 Ralf Habacker * include/cygwin/in.h (in_attr_t): Define new type. * include/arpa/inet.h (inet_addr): Change return type to in_addr_t. (inet_lnaof): Ditto. (inet_netof): Ditto. (inet_network): Ditto. 2003-02-10 Christopher Faylor * include/cygwin/types.h: Move many *_t typedefs here. Protect them with ifdefs. * fhandler_disk_file.cc (fhandler_disk_file::fstat): Change ntsec_atts to mode_t. * security.cc (get_attribute_from_acl): Accept mode_t attribute. (get_nt_attribute): Ditto. (get_file_attribute): Ditto. (get_nt_object_attribute): Ditto. (get_object_attribute): Ditto. * security.h: Reflect above changes. * syscalls.cc (chown_worker): Change attrib to mode_t. 2003-02-08 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number to 21. 2003-02-07 Christopher Faylor * malloc.cc (DEFAULT_MMAP_THRESHOLD): Bump down to 16MB thanks to below changes. 2003-02-07 Corinna Vinschen * mmap.cc (mmap_record::alloc_map): De-inline. Add offset and length parameter. Only protect pages actually unused currently. Do job of map_map() when initializing a map. (mmap_record::map_map): Reduce functionality for the reuse case of private anonymous mapping. (mmap_record::fixup_map): Format change. (list::add_record): Add offset and length parameter to call mmap_record::alloc_map() correctly. (mmap64): Rename `l' variable to `map_list'. Accommodate above changes. (munmap): Rename `l' variable to `map_list'. (msync): Ditto. (fhandler_disk_file::mmap): Streamline code. (mprotect): Ditto. (fixup_mmaps_after_fork): Rename `l' variable to `map_list'. 2003-02-07 Vaclav Haisman Christopher Faylor * exceptions.cc (try_to_debug): Set priority of current thread rather than the main thread. Make busy waiting loop less busy. Restore priority when function returns. 2003-02-07 Christopher Faylor * malloc.cc (DEFAULT_MMAP_THRESHOLD): Set high to avoid mmaps. 2003-02-07 Christopher Faylor * pipe.cc (fhandler_pipe::close): Avoid extraneous this->. 2003-02-06 Christopher Faylor * heap.cc (heap_init): Remove debugging code. 2003-02-06 Pierre Humblet * security.h: Introduce names UNKNOWN_UID and UNKNOWN_GID and delete declaration of is_grp_member. * uinfo.cc (internal_getlogin): Use UNKNOWN_GID. * passwd.cc (pwdgrp::read_passwd): Use UNKNOWN_UID. * grp.cc (pwdgrp::read_group): Change group name to provide better feedback. (getgrgid): Use gid16togid32. * sec_helper.cc (is_grp_member): Delete. 2003-02-05 Christopher Faylor * path.cc: Change 'to_posix_p' to 'to_posix' throughout. (conv_path_list_buf_size): Accommodate relative paths. 2003-02-05 Christopher Faylor * path.cc (etc::dir_changed): Fix debug printf. 2003-02-05 Corinna Vinschen * sec_acl.cc (setacl): Move all permission settings to beginning of loop. Set default rights to same values as in alloc_sd(). Set DELETE for owner and default owner only if S_IWOTH is given. 2003-02-05 Pierre Humblet * sec_acl.cc: Change all __aclent16_t to __aclent32_t except in wrapper function definitions. Replace call to the aclXYZ functions by calls aclXYZ32. (searchace): Change type of third argument to __uid32_t and use ILLEGAL_UID instead of -1; (setacl): Remove some initializations. Only give STANDARD_RIGHTS_WRITE for S_IWOTH. Replace -1 by ILLEGAL_UID. (getacl): Change type of owner_sid, group_sid and ace_sid to cygpsid. In last else clause, suppress second call to ace_sid.get_id and use TRUE in first call. Replace EqualSid by ==. (acl_access): Call internal_getgroups in USER and GROUP cases. (acecmp: Define static. (acl32): Create from 16 bit type. (facl32): Ditto. (lacl32): Ditto. (aclcheck32): Ditto. (aclsort32): Ditto. (acltomode32): Ditto. (aclfrommode32): Ditto. (acltopbits32): Ditto. (aclfrompbits32): Ditto. (acltotext32): Ditto. (aclfromtext32): Ditto, and use strechr. (acl16to32): Create. (acl): Make it a wrapper function. (facl): Ditto. (lacl): Ditto. (aclcheck): Ditto. (aclsort): Ditto. (acltomode): Ditto. (aclfrommode): Ditto. (acltopbits): Ditto. (aclfrompbits): Ditto. (acltotext): Ditto. (aclfromtext): Ditto. * security.cc (write_sd): Call set_process_privilege and check ownership. (alloc_sd): Remove call to set_process_privilege and the owner check. 2003-02-05 Christopher Faylor * include/sys/cygwin.h: Use C-style comments. 2003-02-05 Pierre Humblet * sec_helper.cc (get_sids_info): New function. * security.cc (extract_nt_dom_user): Simplify with strechr. (get_user_groups): Initialize glen to MAX_SID_LEN. (get_user_local_groups): Ditto. (get_attribute_from_acl): Define ace_sid as cygpsid. (get_nt_attribute): Define owner_sid and group_sid as cygpsid. Call get_sids_info instead of cygsid.get_{u,g}id and is_grp_member. (get_nt_object_attribute): Ditto. (alloc_sd): Define ace_sid as cygpsid. 2003-02-04 Thomas Pfaff * syscalls.cc (struct system_cleanup_args): New struct. (system_cleanup): New function. (system): Use pthread_cleanup_push and _pop to save and restore signal handlers and sigprocmask. 2003-02-04 Corinna Vinschen * path.cc (symlink): Create security attributes so that only the user can modify the symlink. * security.cc (set_security_attribute): Remove symlink special handling. 2003-02-04 Pierre Humblet * grp.cc (internal_getgroups): Do not return without closing the process handle. 2003-02-04 Pierre Humblet * security.h (class cygpsid): New class. (class cygsid): Use cygpsid as base. Remove members psid, get_id, get_uid, get_gid, string, debug_printf and the == and != operators. (cygsidlist::clear_supp): Only do work if setgroups has been called. * sec_helper.cc: Define sid_auth NO_COPY. (cygpsid::operator==): New operator. (cygpsid::get_id): New function. (cygpsid::string): New function. (cygsid::string): Delete. (cygsid::get_id): Delete. * pwdgrp.h: Change arguments of internal_getpwsid, internal_getgrsid and internal_getgroups to cygpsid. * passwd.cc (internal_getpwsid): Change argument from cygsid to cygpsid. * grp.cc (internal_getgrsid): Ditto. (internal_getgroups): Ditto. 2003-02-03 Christopher Faylor Eliminate most unneeded this-> pointers throughout. 2003-02-03 Pierre Humblet * security.h: Add third argument to set_process_privilege. * autoload.cc: Add OpenThreadToken. * sec_helper.cc (set_process_privilege): Add and use use_thread argument. * security.cc (alloc_sd): Modify call to set_process_privilege. Remember the result in each process. If failed and file owner is not the user, fail. 2003-02-03 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::recvfrom): Return buffer length and don't set errno in case of WSAEMSGSIZE error. (fhandler_socket::recvmsg): Ditto. 2003-02-01 Christopher Faylor * grp.cc (getgrent32): Only refresh group entries when at beginning. (internal_getgrsid): Only refresh if uninitialized. (internal_getgrent): Ditto. * passwd.cc (getpwent): Only refresh passwd entries when at beginning. (pwdgrp::read_passwd): linebuf *cannot* be NO_COPY. (internal_getpwsid): Only refresh if uninitialized. (getpass): No need to refresh passwd data here. * pwdgrp.h (refresh): Eliminate default. 2003-01-31 Christopher Faylor * dlfcn.cc (dlerror): Only report load errors once per error. 2003-01-31 Christopher Faylor * fhandler_serial.cc (fhandler_serial::open): Avoid extraneous setting of res. * termios.cc (tcsetattr): Correctly record errno after tcsetattr call. 2003-01-31 Troy Curtiss * fhandler_serial.cc (fhandler_serial::tcsetattr): Add error-checking so that if any Win32 SetComm*() calls fail, errno gets set to EINVAL and tcsetattr() returns -1. Catch invalid bitrates, mostly. If baud rate setting is B0, just drop DTR and leave Win32 DCB bitrate as-is since 0 is not a valid Win32 setting. (fhandler_serial::tcgetattr): If DTR is low, populate the bitrate as B0, otherwise get it from the DCB. 2003-01-31 Christopher Faylor * passwd.cc (pwdgrp::read_passwd): linebuf *must* be static (from Pierre Humblet). * pwdgrp.h (pwdgrp::refresh): Avoid calling read function if we already have lock since that means we are in the process of reading the file. 2003-01-31 Jason Tishler * shared.cc (shared_info::heap_chunk_size): Use correct variable when reading HKLM. 2003-01-30 Christopher Faylor * fhandler_registry.cc (fhandler_registry::exists): Fix off-by-one error when inspecting path. 2003-01-29 Christopher Faylor * lib/getopt.c: Allow environment variable control of POSIXLY_INCORRECT behavior. 2003-01-28 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::accept): On successful execution set connection state of returned socket to CONNECTED. 2003-01-27 Christopher Faylor * passwd.cc (pwdgrp::parse_passwd): Be more unforgiving about non-numeric fields. 2003-01-26 Christopher Faylor * uinfo.cc (pwdgrp::next_num): Remove check for NULL since it is no longer a valid return from next_str. (pwdgrp::add_line): Duh. Revert to use strchr. 2003-01-26 Christopher Faylor * string.h (strechr): New function. * uinfo.cc (pwdgrp::next_str): Search only for input char in string. Return EOS on failure. Don't check for NULL since it shouldn't be possible. (pwdgrp::add_line): Revert to replacing '\n' in input line with '\0'. (pwdgrp::next_num): Pass explicit separator character to next_str. * grp.cc (pwdgrp::parse_group): Ditto. * passwd.cc (pwdgrp::parse_passwd): Ditto. Revamp test for garbage input. * pwdgrp.h (pwdgrp::next_str): Don't use default parameter. 2003-01-26 Christopher Faylor * uinfo.cc (pwdgrp::load): Regularize strace output. Add warning for CreateFile failure. 2003-01-26 Christopher Faylor * passwd.cc (pwdgrp::parse_passwd): Eliminate use of memset. The structure should always be completely filled out. * grp.cc (pwdgrp::parse_group): Ditto. 2003-01-26 Christopher Faylor * grp.cc (pwdgrp::parse_group): Fix off-by-one problem in allocating gr_mem. 2003-01-26 Christopher Faylor * include/sys/strace.h (paranoid_printf): Define as not being part of "all" output. 2003-01-25 Christopher Faylor * pwdgrp.h (pwdgrp::next_num): Rename from next_int. Returns true/false if parse operation succeeded. (pwdgrp::reparse): Remove. (pwdgrp::raw_ptr): New function. Returns pointer in line. (pwdgrp::next_num): New functions for parsing other than unsigned long. * grp.cc (pwdgrp::parse_group): Reinstate previous parsing behavior. Don't fill in fields with NULL and assign empty gr_mem to known pointer rather than doing a pointless calloc. Streamline gr_mem parsing. Don't increment curr_lines here. * passwd.cc (pwdgrp::parse_passwd): Use new behavior of next_num. Don't increment curr_lines here. * uinfo.cc (pwdgrp::next_str): Keep returning EOL if out of data. (pwdgrp::reparse): Remove. (pwdgrp::next_num): Rename from next_int. Return bool indicating success of parse, argument returns value parsed. (pwdgrp::add_line): Increment curr_lines here on successful parse. (pwdgrp::load): (from Pierre Humblet) Don't return status. Just report it here. 2003-01-25 Christopher Faylor * pwdgrp.cc (pwdgrp::reparse): Declare. * uinfo.cc (pwdgrp::reparse): Define. * grp.cc (pwdgrp::parse_group): Use reparse. 2003-01-25 Pierre Humblet * syscalls.cc (seteuid32): On Win95 get the pw entry. If it exists update the euid and call cygheap->user.set_name. Remove special handling of ILLEGAL_UID. (setgid32): Add a debug_printf. On Win95, always set the egid. Remove special handling of ILLEGAL_GID. Do not compare gid and gr_gid. * child_info.h (class cygheap_exec_info): Remove uid. * spawn.cc (spawn_guts): Do not set ciresrv.moreinfo->uid. * dcrto.cc (dll_crt0_1): Always call uinfo_init. * uinfo.cc (uinfo_init): Reorganize and close handle if needed. (cygheap_user::ontherange): Do not call internal_getpwnam if pw is NULL. 2003-01-24 Christopher Faylor * fhandler_console.cc (fhandler_console::send_winch_maybe): Reset scroll region if size changes. 2003-01-24 Pierre Humblet Jason Tishler * cygwin.din: Export setreuid32, setreuid, setregid32, setregid. * syscalls.cc (setreuid32): New function. (setreuid): Ditto. (setregid32): Ditto. (setregid): Ditto. * include/cygwin/version.h: Bump API minor number. 2003-01-23 Christopher Faylor * pwdrp.h (pwdgrp::refresh): Lock entire test prior to reading. 2003-01-23 Christopher Faylor * grp.cc (pwdgrp::parse_group): Eliminate arg and use class member instead. Use next_str and next_int to parse arguments. * passwd.cc (pwdgrp::parse_passwd): Ditto. (grab_string): Eliminate. (grab_int): Ditto. * pwdgrp.h (pwdgrp::parse): Eliminate input arg. (pwdgrp::parse_passwd): Reflect above change. (pwdgrp::parse_group): Reflect above change. (pwdgrp::next_str): New function. (pwdgrp::next_int): Ditto. (pwdgrp::gets): Eliminate. * uinfo.cc (pwdgrp::next_str): New function. (pwdgrp::next_int): Ditto. (pwdgrp::add_line): Subsume gets. (pwdgrp::gets): Eliminate. (pwdgrp::load): Just call add_line to parse input buffer. 2003-01-22 Thomas Pfaff * include/pthread.h (PTHREAD_MUTEX_RECURSIVE): Revert changes from 2003-01-09 mutex patch. (PTHREAD_MUTEX_ERRORCHECK): Ditto. 2003-01-22 Corinna Vinschen * cygrun.c: Move from here to ../testsuite. * Makefile.in: Remove cygrun.exe dependencies. 2003-01-21 Jason Tishler * cygwin.din: Export nanosleep(). * signal.cc (nanosleep): New function. (sleep): Move old functionality to nanosleep(). Call nanosleep(). (usleep): Remove old functionality. Call nanosleep(). * include/cygwin/version.h: Bump API minor number. 2003-01-21 Christopher Faylor * grp.cc: Call gr.refresh() rather than doing isunitialized tests throughout. (gr): Use constructor (sigh). (pwdgrp::parse_group): Rename from parse_grp. (pwdgrp::read_group): Rename from read_etc_group. Just call gr.load with a single argument. * passwd.cc: Call pr.refresh() rather than doing isunitialized tests throughout. (pr): Use constructor (sigh). (pwdgrp::parse_passwd): Rename from "parse_pwd". (pwdgrp::read_passwd): Rename from read_etc_passwd. Just call pr.load with a single argument. * pwdgrp.h (pwdgrp_state): Eliminate. (pwdgrp): Reflect above renamings. (pwdgrp::etc_ix): Rename from pwd_ix. (pwdgrp::read): New element. (pwdgrp::lock): New element. (pwdgrp::refresh): New function. (pwdgrp::load): Eliminate variations which take buffer arguments. (pwdgrp::pwdgrp): New constructors. Initialize mutex here. * uinfo.cc (pwdgrp::load): Accommodate pwd_ix -> etc_ix renaming. (pwdgrp::load): Set initialized state to true rather than setting state to loaded. 2003-01-21 Christopher Faylor * include/cygwin/version.h: Bump DLL minor number. 2003-01-21 Pierre Humblet * path.h (etc::change_possible): Revert the type to bool. (etc::set_last_modified): Remove obsolete function. * path.cc (etc::change_possible): Revert type to bool. (etc::test_file_change): Do not test for negative values of change_possible and do not set it to -res. (etc::dir_changed): When the handle is NULL, call memset instead of test_file_changed. When the handle is invalid, return true. Detect filename change in /etc. (etc::file_changed): Remove unneeded check for !fn[n]. * uinfo.cc (pwdgrp::load): Eliminate spurious setting of fh to NULL. * pwdgrp.h (pwdgrp::operator =): Eliminate. 2003-01-19 Christopher Faylor * pwdgrp.h (etc): Move to path.h. (pwdgrp::max_lines): New field. (pwdgrp::curr_lines): New field. (pwdgrp::pwdgrp_buf): Ditto. (pwdgrp_buf_elem_size): Ditto. (pwdgrp_parse): Ditto. (pwdgrp::gets): Just declare here. (pwdgrp::load): Ditto. Just take one argument. (pwdgrp::load): Define overloaded function accepting passwd buf. (pwdgrp::load): Define overloaded function accepting group buf. * grp.cc: Use pwdgrp elements rather than standalone static variables throughout. (curr_lines): Eliminate. (max_lines): Ditto. (add_grp_line): Ditto. (parse_grp): Define as returning boolean. Accept void * arg and line count. Coerce first argument into __group32 buf reference. Increment curr_line as appropriate. (read_etc_group): Pass pwdgrp buffer to gr.load. * passwd.cc: Use pwdgrp elements rather than standalone static variables throughout. (curr_lines): Eliminate. (max_lines): Ditto. (add_grp_line): Ditto. (parse_passwd): Define as returning boolean. Accept void * arg and line count. Coerce first argument into passwd buf reference. Increment curr_line as appropriate. (read_etc_group): Pass pwdgrp buffer to pr.load. * path.cc (etc::fn): Extend buffer size to allow index by 1 rather than zero. (etc::last_modified): Ditto. (etc::change_possible): Ditto. Renamed from sawchange. Change to signed char since elements are now tri-state. (etc::init): Assume "handle" is 1 based rather than 0. (etc::test_file_change): New function. Sets change_possible based on file date comparison. (etc::dir_changed): Check file states immediately after changed_h is initialized to avoid a race. (etc::file_changed): Use test_file_change to detect if file needs to be updated. * path.h (etc): Move class here from pwdgrp.h. * uinfo.cc: Move etc:: functions to path.cc. Move pwdgrp functions here. (pwdgrp::gets): Eliminate buf checks. Just check eptr and set lptr. (pwdgrp::add_line): New function. (pwdgrp::load): Call generic add_line function which will call correct parser. 2003-01-17 Christopher Faylor * cygheap.cc: Change most 'int's to 'unsigned's. (_cmalloc): Only check for size of malloced region when calculating bucket. Add overhead when performing the sbrk. Previous change broke _crealloc. 2003-01-17 Christopher Faylor * dcrt0.cc (initialize_env): Use colon for CYGWIN_DEBUG separator. * grp.cc: Change most statics to NO_COPY throughout. * passwd.cc: Ditto. 2003-01-17 Christopher Faylor * pwdgrp.h: Change some BOOLs to bools. (pwdgrp::pwdgrp): Remove unneeded constructor. * passwd.cc: Change BOOL to bool throughout. 2003-01-17 Corinna Vinschen * cygwin.din: Add strerror_r. * include/cygwin/version.h: Bump API minor number. 2003-01-17 Christopher Faylor * uinfo.cc (etc::dir_changed): Don't print a warning if can't open /etc, unless debugging. 2003-01-17 Pierre Humblet * grp.cc (read_etc_group): On NT, add a line for gid = -1. Change name "unknown" to "mkgroup". (internal_getgrgid): Do not return default in nontsec case. (internal_getgroups): Add argument srchsid and look for it in groups if not NULL. * passwd.cc (read_etc_passwd): On NT, add a line for uid = -1. Use same default uid for Win95 and NT. Call cygheap_user::ontherange to initialize HOME. 2003-01-16 Christopher Faylor * cygheap.cc (init_cygheap::etc_changed): Move to uinfo.cc. * cygheap.h (init_cygheap::etc_changed_h): Remove. (init_cygheap::etc_changed): Ditto. * grp.cc (group_state): Remove. Use gr instead throughout. (gr): Define as class pwdgrp. (read_etc_group): Remove gr definition. Remove calls to set_last_modified and close. Pass add_grp to gr.load to load file. * passwd.cc (passwd_state): Remove. Use pr instead, throughout. (pr): Define as class pwdgrp. (read_etc_passwd): Remove pr definition. Remove calls to set_last_modified and close. Pass add_pwd_line to pr.load to load file. * pwdgrp.h (etc): New helper class for pwdgrp. (pwdgrp): Combine pwdgrp_check and pwdgrp_read into one class. Remove file_w32 and last_modified fields. (pwdgrp::set_last_modified): Remove. (pwdgrp::isinitializing): Remove FindFirstFile stuff. Move to etc::file_changed. (pwdgrp::load): Rename from 'open'. Call etc::init to initialize etc scanning. Close file handle after reading buffer into memory. Parse buffer by calling second argument. (pwdgrp::gets): Reorganize slightly to rely on eptr starting at beginning of buffer. (pwdgrp::close): Remove. * uinfo.cc (etc::dir_changed): New function. (etc::init): Ditto. (etc::file_changed): Ditto. (etc::set_last_modified): Ditto. 2003-01-16 Jason Tishler * mmap.cc (fixup_mmaps_after_fork): Add ERROR_NOACCESS to the list of ReadProcessMemory() error codes that trigger a retry with temporary PAGE_READONLY access. Note that this can occur on NT 4.0. 2003-01-15 Christopher Faylor * path.cc (normalize_posix_path): Convert win32 path separators to slashes when full path is specified. 2003-01-15 Pierre Humblet * cmalloc.cc (_cmalloc): Fix memory leak. 2003-01-15 Corinna Vinschen * autoload.cc: Fix copyright date. * fhandler_dsp.cc: Ditto. * mmap.cc: Ditto. * net.cc: Ditto. * ntdll.h: Ditto. * signal.cc: Ditto. * syscalls.cc: Ditto. * uname.cc: Ditto. * wait.cc: Ditto. 2003-01-14 Corinna Vinschen * mmap.cc (fixup_mmaps_after_fork): Copy protection to child process. Change ambiguous debug output. 2003-01-14 Corinna Vinschen * mmap.cc (mmap_record::access): Change argument type to caddr_t for strictness. (mprotect): Protect against calling VirtualProtect() for shared pages on 9x/Me. (fixup_mmaps_after_fork): If ReadProcessMemory() fails, try to change protection of parent page to PAGE_READONLY, then try again. Revert protection afterwards. 2003-01-14 Thomas Pfaff * syscalls.cc (system): Add pthread_testcancel call. * thread.cc: Update list of cancellation points. 2003-01-14 Thomas Pfaff * wait.cc: Include thread.h (wait4): Add pthread_testcancel call. Wait for child process and cancellation event. * thread.cc: Update list of cancellation points. 2003-01-14 Thomas Pfaff * signal.cc (sleep): Add pthread_testcancel call. Wait for signal and cancellation event. (usleep): Ditto. 2003-01-14 Thomas Pfaff * exceptions.cc (handle_sigsuspend): Add pthread_testcancel call. Wait for signal and cancellation event. * thread.cc: Update list of cancellation points. 2003-01-14 David Huang * fhandler_dsp.cc (fhandler_dsp::ioctl): Add limited support for SNDCTL_DSP_GETFMTS. 2003-01-12 Christopher Faylor * ntdll.h: Fix typo. 2003-01-12 Corinna Vinschen * uname.cc (uname): Use cygwin_gethostname() to retrieve hostname. 2003-01-12 Pierre Humblet * sec_acl.cc (search_ace): Use id == -1, instead of < 0, as wildcard. (setacl): Start the search for a matching default at the next entry. Invalidate the type of merged entries instead of clearing it. Use well_known_creator for default owner and owning group and do not try to merge non-default and default entries in these cases. (getacl): Recognize well_known_creator for default owner and group. (acl_worker): Improve errno settings and streamline the nontsec case. * security.cc (write_sd): Remove the call to set_process_privilege. (alloc_sd): If the owner changes, call set_process_privilege and return immediately on failure. Change inheritance rules: on new directories add inherit only allow ACEs for creator_owner, creator_group and everyone. Preserve all inheritances through chmod and chown calls. Introduce isownergroup to implement the uid == gid case, to keep the inheritance code simple. Do not initialize owner_sid and group_sid and stop using the variable psd. 2003-01-10 Christopher Faylor * net.cc: Use gethostname define from winsock2.h. 2003-01-10 Christopher Faylor * path.cc: Unrevert below reversion except for mount_info::conv_to_posix_path part. 2003-01-10 Corinna Vinschen * path.cc: Revert patch from 2003-01-09 to normalize a windows path rather than converting to posix. 2003-01-10 Corinna Vinschen * autoload.cc (gethostname): Make call optional, return 1 if function can't get loaded. * net.cc (cygwin_gethostname): Call GetComputerName if return value of gethostname is non-zero. 2003-01-10 Charles Wilson * cygwin.din: Add asprintf and vasprintf, as well as the reentrant versions and underscore variants. * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR. 2003-01-10 Corinna Vinschen * net.cc (cygwin_gethostname): Fix call to wsock function gethostname. 2003-01-09 Christopher Faylor * cygthread.cc (cygthread::cygthread): Be more noisy about odd condition. * miscfuncs.cc (low_priority_sleep): Sleep in regular priority if that's what we're currently running at. 2003-01-09 Thomas Pfaff * include/semaphore.h: Modify typedef for sem_t. * include/cygwin/types.h: Modify typedefs for pthread_t, pthread_mutex_t, pthread_key_t, pthread_attr_t, pthread_mutexattr_t, pthread_condattr_t, pthread_cond_t, pthread_rwlock_t and pthread_rwlockattr_t. 2003-01-09 Thomas Pfaff * thread.h (WAIT_CANCELED): New define. (pthread::cancelable_wait): New static method. * thread.cc (pthread::cancelable_wait): Implement. (semaphore::Wait): Wait on semaphore and thread cancellation. (pthread::join): Wait on joined thread and thread cancellation. (semaphore::wait): Add testcancel to check for thread cancellation even if the semaphore is available. 2003-01-09 Thomas Pfaff * include/pthread.h: Add define for errorchecking mutexes. Change default mutex type. * thread.cc (pthread_cond::TimedWait): Update mutex unlock calls. (pthread_mutex::pthread_mutex): New implement. (pthread_mutex::~pthread_mutex): Ditto. (pthread_mutex::Lock): Ditto. (pthread_mutex::TryLock): Ditto. (pthread_mutex::UnLock): Ditto. (pthread_mutex::Destroy): Implement new method. (pthread_mutex::SetOwner): Ditto. (pthread_mutex::LockRecursive): Ditto. (pthread_mutex::fixup_after_fork): Restore locking state after fork. (__pthread_mutex_lock): Return pthread_mutex::Lock errorcode. (__pthread_mutex_trylock): Return pthread_mutex::TryLock errorcode. (__pthread_mutex_unlock): Return pthread_mutex::UnLock errorcode. (__pthread_mutex_destroy): Call pthread_mutex::Destroy to destroy mutex. (__pthread_mutexattr_settype): Allow errorchecking and recursive types. * thread.h (MUTEX_LOCK_COUNTER_INITIAL): New define. (pthread_mutex::criticalsection): Remove. (pthread_mutex::lock_counter): New member. (pthread_mutex::recursion_counter): Ditto. (pthread_mutex::owner): Ditto. (pthread_mutex::type): Ditto. (pthread_mutex::Destroy): New method. (pthread_mutex::SetOwner): Ditto. (pthread_mutex::LockRecursive): Ditto. 2003-01-09 Thomas Pfaff * pthread.cc (pthread_cond_init): Use new pthread_cond::init. * thread.cc: Some white spaces cleanups. Change __pthread_cond_init to pthread_cond::init throughout. (nativeMutex): Move class methods outside pthread_mutex. (MTinterface::Init): Initialize pthread_cond init lock. (pthread_cond::condInitializationLock): Instantiate. (pthread_cond::initMutex): New Method. (pthread_cond::isGoodInitializerOrBadObject): Ditto. * thread.h: Some white spaces cleanups. (nativeMutex): Move class declaration outside pthread_mutex. (pthread_cond::condInitializationLock): New static member. (pthread_cond::initMutex): New Method. (pthread_cond::isGoodInitializerOrBadObject): Ditto. (__pthread_cond_init): Remove prototype. 2003-01-09 Corinna Vinschen * fhandler_disk_file.cc (num_entries): Return 2 as link count if directory unreadable. 2003-01-09 Corinna Vinschen * security.cc (get_nt_attribute): Always return -1 when read_sd() fails. (get_file_attribute): Set permissions to 0 and owner/group to -1 if security descriptor is unreadable. 2003-01-09 Christopher Faylor Use isdirsep rather than SLASH_P throughout. * path.cc (iscygdrive): Disallow /cygdrive\x. (normalize_posix_path): "Normalize" a windows path, if detected, rather than converting to posix. 2003-01-06 Troy Curtiss * fhandler_serial.cc (fhandler_serial::tcsetattr): Add support and capability checking for B230400 bitrate. (fhandler_serial::tcgetattr): Add support for B230400 bitrate. * include/sys/termios.h: Add B230400 definition for Posix support of 230.4Kbps. 2003-01-05 Christopher Faylor * pinfo.cc (_pinfo::commune_send): Use myself->lock rather than just lock when leaving. 2003-01-03 Christopher Faylor * dtable.h (dtable::in_vfork_cleanup): New function. True if vfork cleanup needed. * dtable.cc (dtable::vfork_parent_restore): Remove assertion. * pipe.cc (fhandler_pipe::close): Don't close read_state during fork_fixup since it wasn't inherited. 2003-01-01 Christopher Faylor * passwd.cc (getpwuid_r32): Revert previous change. 2003-01-01 Christopher Faylor * sysconf.cc (sysconf): Return arbitrary values for _SC_GETGR_R_SIZE_MAX, _SC_LOGIN_NAME_MAX, _SC_GETPW_R_SIZE_MAX. * passwd.cc (getpwuid_r32): Add uid/gid fields to size check calculation.