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'. Accomodate 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.