2007-12-30 Dave Korn * cygwin.din (_f_llrint, _f_llrintf, _f_llrintl, _f_lrint, _f_lrintf, _f_lrintl, _f_rint, _f_rintf, _f_rintl): Export fast *rint* functions. (lrint, lrintf, rint, rintf): Redirect exports to alias _f_ versions. (llrint, llrintf, llrintl, lrintl, rintl): Add exports aliasing _f_* versions likewise. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. 2007-12-22 Corinna Vinschen * fhandler.h (class fhandler_dev_random): Add dummy_offset member. * fhandler_random.cc (fhandler_dev_random::lseek): Fake seeking capability as on Linux. 2007-12-20 Eric Blake * libc/memmem.cc (memmem): Fix bug when searching for empty string. 2007-12-19 Corinna Vinschen * cygwin.din: Export wcpcpy, wcpncpy. * include/cygwin/version.h: Bump API minor number. 2007-12-16 Christopher Faylor * dtable.cc (POSIX_NAMED_PIPE): New define. (POSIX_NAMED_PIPE_LEN): Ditto. (dtable::add_archetype): Use crealloc_abort. (dtable::init_std_file_from_handle): Specifically detect pipe stdin/stdout. Pass name to build_fh_dev so that proper name is recorded. Use binmode of fh if it is set before using get_default_mode. Set proper read/write access when calling init(). (handle_to_fn): Handle pipes. * fhandler.cc (fhandler_base::wait_overlapped): Add some debugging. * fhandler.h (fhandler_base::set_name): Default to just setting the path_conv name. (fhandler_pipe::init): Declare. * pipe.cc (struct pipesync): New struct. (getov_result): New function. Blocks and retrieves the result of an overlay I/O operation. (pipe_handler): New function. (pipesync::pipesync): New function. Initializer for pipesync struct. (handler_pipe::init): Define. Detects attempts to set up a "native" pipe fhandler and creates a thread which accepts input from or output to the non-cygwin pipe, creating a cygwin pipe wrapper around the non-cygwin pipe. (fhandler_pipe::create): Add pipe-specific flags to call to init(). * exceptions.cc (ctrl_c_handler): Lock process while we determine what to do. 2007-12-14 Corinna Vinschen * include/cygwin/socket.h: Include sys/uio.h instead of cygwin/uio.h. * include/cygwin/uio.h: Remove. 2007-12-14 Corinna Vinschen * dtable.cc (dtable::set_file_pointers_for_exec): Reenable. Fix comment. * spawn.cc (spawn_guts): Call cygheap->fdtab.set_file_pointers_for_exec only for non-Cygwin processes. 2007-12-13 Craig MacGregor Corinna Vinschen * poll.cc (poll): Return count of fds with events instead of total event count. 2007-12-13 Corinna Vinschen * string.h: Guard cygwin internal string function definitions with __INSIDE_CYGWIN__. 2007-12-12 Corinna Vinschen * dcrt0.cc: Include string.h. (initial_env): Use small_printf's %P specifier. * dll_init.cc (dll_list::alloc): Use PATH_MAX instead of CYG_MAX_PATH for path name buffer size. * dll_init.h (struct dll): Ditto. * environ.cc: Include string.h. (win_env::add_cache): Use temporary local buffer for path conversion. (posify): Ditto. * exceptions.cc (try_to_debug): Use CreateProcessW to allow long path names. * miscfuncs.cc: Drop unused implementations of strcasematch and strncasematch. (ch_case_eq): Drop. (strcasestr): Drop. (cygwin_wcscasecmp): New function. (cygwin_wcsncasecmp): New function. (cygwin_strcasecmp): New function. (cygwin_strncasecmp): New function. (cygwin_wcslwr): New function. (cygwin_wcsupr): New function. (cygwin_strlwr): New function. (cygwin_strupr): New function. * ntdll.h (RtlDowncaseUnicodeString): Declare. (RtlUpcaseUnicodeString): Declare. (RtlInt64ToHexUnicodeString): Fix typo in comment. * string.h: Disable not NLS aware implementations of strcasematch and strncasematch. (cygwin_strcasecmp): Declare. (strcasecmp): Define as cygwin_strcasecmp. (cygwin_strncasecmp): Declare. (strncasecmp): Define as cygwin_strncasecmp. (strcasematch):Define using cygwin_strcasecmp. (strncasematch):Define using cygwin_strncasecmp. (cygwin_strlwr): Declare. (strlwr): Define as cygwin_strlwr. (cygwin_strupr): Declare. (strupr): Define as cygwin_strupr. * wchar.h: New file. * wincap.cc (wincapc::init): Use "NT" as fix OS string. * winsup.h (strcasematch): Drop declaration. (strncasematch): Ditto. (strcasestr): Ditto. 2007-12-11 Corinna Vinschen * fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix R/O bit handling on filesystems without ACL support. 2007-12-11 Corinna Vinschen * localtime.cc (tzset): Guard by a muto for thread safety. 2007-12-11 Dave Korn * cygheap.cc (_csbrk): Don't request zero bytes from VirtualAlloc, as windows treats that as an invalid parameter and returns an error. 2007-12-11 Corinna Vinschen * localtime.cc (tzset): Call tzsetwall only if it hasn't been called before. 2007-12-07 Corinna Vinschen * include/sys/cygwin.h: Include limits.h. 2007-12-06 Corinna Vinschen * dcrt0.cc (initial_env): Use PATH_MAX instead of CYG_MAX_PATH for path name buffer size. (dll_crt0_1): Allocate new_argv0 with PATH_MAX size. * exceptions.cc (debugger_command): Set size to 2 * PATH_MAX + 20; (error_start_init): Use PATH_MAX instead of CYG_MAX_PATH for path name buffer size. * external.cc (fillout_pinfo): Always fill out ep.progname 0-terminated. Fill out ep.progname_long. * fhandler_process.cc (fhandler_process::fill_filebuf): Allocate buffer for executable filename with PATH_MAX size. * pinfo.cc: Throughout use PATH_MAX instead of CYG_MAX_PATH. * pinfo.h (class _pinfo): Set progname size to PATH_MAX. * smallprint.cc: Include limits.h. Use PATH_MAX instead of CYG_MAX_PATH for path name buffer size. * strace.cc (strace::vsprntf): Ditto. * include/sys/cygwin.h (EXTERNAL_PINFO_VERSION_32_LP): Define. (EXTERNAL_PINFO_VERSION): Set to EXTERNAL_PINFO_VERSION_32_LP. (struct external_pinfo): Add progname_long member. * include/sys/dirent.h: Correctly include limits.h instead of sys/limits.h. 2007-12-05 Corinna Vinschen * fhandler_tty.cc (fhandler_tty_slave::open): Use MAX_PATH instead of CYG_MAX_PATH for event name buffer size. (fhandler_pty_master::setup): Use MAX_PATH instead of CYG_MAX_PATH for mutex name buffer size. * netdb.cc: Drop old comment. (open_system_file): Set path buffer size to MAX_PATH instead of CYG_MAX_PATH. Drop conversion to posix path. Open file using win32 path. 2007-12-05 Corinna Vinschen * fhandler_registry.cc: Use NAME_MAX + 1 instead of CYG_MAX_PATH throughout for subkey name buffer size. * fhandler_socket.cc (search_wsa_event_slot): Use MAX_PATH instead of CYG_MAX_PATH for mutex name buffer size. (fhandler_socket::init_events): Ditto. * fhandler_virtual.cc (fhandler_virtual::opendir): Check path length against PATH_MAX instead of against CYG_MAX_PATH. * registry.cc (get_registry_hive_path): Use PATH_MAX instead of CYG_MAX_PATH for registry value path buffer size. * shared.cc (open_shared): Use MAX_PATH instead of CYG_MAX_PATH for shared memory name buffer size. * thread.cc (semaphore::semaphore): Use MAX_PATH instead of CYG_MAX_PATH for semaphore name buffer size. * uinfo.cc (cygheap_user::env_userprofile): Use PATH_MAX instead of CYG_MAX_PATH for temporary path name buffer size. * winf.h (LINE_BUF_CHUNK): Define as MAX_PATH * 2. * include/sys/dirent.h: Include sys/limits.h. Define name buffer sizes using NAME_MAX. 2007-12-04 Corinna Vinschen * fhandler_fifo.cc (fhandler_fifo::open): Use MAX_NAME for pipe name buffer size. (fhandler_fifo::fstatvfs): Use same technique as in fhandler_socket. * fhandler_proc.cc (format_proc_partitions): Use NAME_MAX+1 for device name buffer size. Use MAX_PATH for device path buffer size. 2007-12-03 Corinna Vinschen * autoload.cc (GetModuleFileNameExW): Replace definition of GetModuleFileNameExA. * fhandler_process.cc (format_process_maps): Change modname type to WCHAR. Set buffer sizes to PATH_MAX. Call GetModuleFileNameExW instead of GetModuleFileNameExA. Call mount_info::conv_to_posix_path instead of cygwin_conv_to_full_posix_path. Set posix_modname to modname if that call fails. (format_process_stat): Set cmd buffer size to NAME_MAX + 1. Simplify setting cmd to process name. (format_process_status): Ditto. * path.cc (mount_info::conv_to_posix_path): Call sys_wcstombs correctly. 2007-12-03 Corinna Vinschen * include/cygwin/time.h: Remove redundant #endif. 2007-12-01 Corinna Vinschen * include/cygwin/time.h (daylight): Declare as extern symbol referring _daylight variable. (timezone): Only define if __timezonefunc__ is undefined. 2007-12-01 Corinna Vinschen Brian Dessent * Makefile.in (OBSOLETE_FUNCTIONS): Add timezone. * include/cygwin/time.h: Drop conditional timezone definitions. (timezone): Declare as extern symbol referring _timezone variable. 2007-11-28 Corinna Vinschen * fhandler_tape.cc (mtinfo::initialize): Use MAX_PATH instead of CYG_MAX_PATH. * fhandler_tty.cc (fhandler_pty_master::ptsname): Set buffer size to TTY_NAME_MAX. * syscalls.cc (ttyname): Eliminate the `+ 1' from the name buffer size since TTY_NAME_MAX already counts the trailing NUL. * libc/bsdlib.cc (openpty): Set pts buffer size to TTY_NAME_MAX. 2007-11-28 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::recv_internal): Add MSG_WAITALL handling. Use explicit flag values instead of MSG_WINMASK. (fhandler_socket::send_internal): Use explicit flag values instead of MSG_WINMASK. * include/cygwin/socket.h (MSG_WINMASK): Remove definition. (MSG_WAITALL): Define. 2007-11-27 Corinna Vinschen * posix_ipc.cc (ipc_names): Rename max_len to prefix_len. Store the prefix len in it. (check_path): Take length parameter. Use this length insetad of calling strlen. Allow PATH_MAX length paths. (ipc_mutex_init): Use MAX_PATH instead of CYG_MAX_PATH. (ipc_cond_init): Ditto. (shm_open): Allocate local name buffer not bigger than necessary. Call check_path with additional length argument. (shm_unlink): Ditto. (mq_open): Ditto. (mq_unlink): Ditto. (sem_open): Ditto. (sem_unlink): Ditto. 2007-11-27 Corinna Vinschen Drop old SetResourceLock stuff in favor of mutos. * dcrt0.cc (_reslock): Remove. (__cygwin_user_data): Accommodate removal of resourcelocks member. (dll_crt0_0): Don't initialize resourcelocks. * exceptions.cc (_cygtls::signal_exit): Drop resourcelocks handling. * mmap.cc (mmap_guard): New muto. (LIST_LOCK): Define. (LIST_UNLOCK): Define. (mmap_list::search_record): Remove. (mmap_list::try_map): Include code for anonymous case from mmap_list::search_record. (mmap_is_attached_or_noreserve): Access bookkeeping lists in a thread safe way. (mmap64): Replace SetResourceLock/ReleaseResourceLock by LIST_LOCK/LIST_UNLOCK. Lock at the latest possible point. (munmap): Replace SetResourceLock/ReleaseResourceLock by LIST_LOCK/LIST_UNLOCK. (msync): Ditto. (mprotect): Ditto. * thread.cc (ResourceLocks::Lock): Remove. (SetResourceLock): Remove. (ReleaseResourceLock): Remove. (ResourceLocks::Init): Remove. (ResourceLocks::Delete): Remove. * thread.h (SetResourceLock): Drop declaration. (ReleaseResourceLock): Ditto. (class ResourceLocks): Drop definition. * include/sys/cygwin.h (class ResourceLocks): Drop forward declaration. (struct per_process): Replace resourcelocks with additional unused2 element. (per_process_overwrite): Accommodate above change. 2007-11-27 Corinna Vinschen * mmap.cc: Convert usage of dynamically growing cmalloced arrays to cmalloced linked lists throughout. (class mmap_record): Add LIST_ENTRY element. (mmap_record::match): New method, taking over match algorithm from list::search_record. (class mmap_list): Rename from class list. Add LIST_ENTRY. Convert recs to a LIST_HEAD. Drop nrecs and maxrecs members. (mmap_list::get_record): Drop entirely. (mmap_list::free_recs): Drop entirely. (mmap_list::del_record): Take mmap_record to delete as parameter. (mmap_list::search_record): Convert to mmap_record::match. (class mmap_areas): Rename from class map. Convert lists to LIST_HEAD. (mmap_areas::get_list): Drop entirely. (mmap_areas::del_list): Take mmap_list to delete as parameter. (mprotect): Fix indentation. 2007-11-26 Christopher Faylor Change many cygheap allocation routines to their *_abort analogs. * cygheap.cc (cmalloc_abort): New function. (crealloc_abort): Ditto. (ccalloc_abort): Ditto. 2007-11-23 Christopher Faylor * cygheap.cc (_crealloc): Avoid memcpy when _cmalloc returns NULL. 2007-11-08 Christopher Faylor * dllfixdbg: Eliminate extra objcopy step. 2007-11-07 Pedro Alves * dllfixdbg: Pass --only-keep-debug to objcopy, instead of selecting the sections manually. 2007-11-06 Corinna Vinschen * thread.cc (pthread_key_create): Drop check for incoming valid object. 2007-11-06 Corinna Vinschen * shm.cc: Include sync.h (struct shm_shmid_list): Add ref_count member. (struct shm_attached_list): Remove hdl and size members. Add a parent member pointing to referenced shm_shmid_list entry. (shm_guard): New muto. (SLIST_LOCK): Define. (SLIST_UNLOCK): Define. (fixup_shms_after_fork): Use hdl and size members of parent shm_shmid_list entry. (shmat): Access sequential bookkeeping lists in a thread safe way. Accommodate change in list element layout. Align comments. (shmctl): Ditto. (shmdt): Ditto. (shmget): Ditto. 2007-11-05 Corinna Vinschen * shm.cc (shmctl): On IPC_RMID don't unmap views and don't close handle if the map is still referenced to emulate Linux and BSD behaviour. 2007-11-05 Corinna Vinschen * shm.cc (shmctl): On IPC_RMID also unmap all views on shared mem as well as connected shm_attached_list entry. 2007-10-31 Corinna Vinschen * net.cc (load_ipv6_funcs): Use MAX_PATH instead of CYG_MAX_PATH. (cygwin_getaddrinfo): Simplify formatting. (cygwin_getnameinfo): Ditto. 2007-10-31 Corinna Vinschen * external.cc (get_cygdrive_info): Make inline. (get_cygdrive_prefixes): Remove. (cygwin_internal): Call get_cygdrive_info with NULL flag parameters instead of get_cygdrive_prefixes. * path.cc (mount_info::get_cygdrive_info): Allow NULL flag parameters. 2007-10-30 Corinna Vinschen * fhandler_disk_file.cc (fhandler_base::fstat_helper): Don't remove write bits for directories with R/O attribute. (fhandler_base::fhaccess): Don't shortcircuit R/O attribute with W_OK scenarios for directories. 2007-10-22 Corinna Vinschen * cygheap.h (struct cwdstuff): Drop hash member. Drop get_hash, get_initial, and fixup_after_exec declarations. Convert win32 to UNICODE_STRING. (cwdstuff::get_drive): Convert win32 path in current codepage. (cwdstuff::set): Take native NT path. * ntdll.h (struct _TEB): Typedef. * path.cc (mount_info::conv_to_posix_path): Add variant taking wide char DOS paths. (symlink_info::posixify): Simplify concatenating cwd and relative path. (hash_path_name): Drop special relative path handling. (chdir): Drop special "drive only" handling. Call cwdstuff::set with native path. (cwdstuff::get_hash): Remove. (windows_system_directory): Remove. (_upp): Remove. (get_user_proc_parms): Make inline. Get PEB pointer by calling NtCurrentTeb. (cwdstuff::init): Simplify. (cwdstuff::set): Rework to handle incoming native NT path. Workaround a Vista problem with CWD handle in the user process parameter block. (cwdstuff::get): Simplify locking. Accommodate type change of win32. * shared_info.h (mount_info): Add declaration for new conv_to_posix_path method. * strfuncs.cc (sys_wcstombs): Return correct length of created multi-byte string. 2007-10-19 Corinna Vinschen * fhandler_disk_file.cc (__DIR_mounts::eval_ino): Make fname big enough to allow multibyte chars. 2007-10-18 Corinna Vinschen * fhandler.cc (fhandler_base::open): Open native symlinks with FILE_OPEN_REPARSE_POINT flag. Fix typo in comment. 2007-10-18 Corinna Vinschen * include/sys/param.h (MAXPATHLEN): Define as PATH_MAX. 2007-10-14 Corinna Vinschen * fhandler.cc (is_at_eof): Rewrite using NT functions. (off_current): New static variable. (off_append): Ditto. (fhandler_base::raw_write): Use NtWriteFile. Accommodate O_APPEND here. (fhandler_base::write): Drop O_APPEND hack. Use NT functions. (fhandler_base::lseek): Rewrite using NT functions. * fhandler_disk_file.cc (fhandler_disk_file::fstatvfs): Add space in debug output. (fhandler_disk_file::ftruncate): Ditto. * ntdll.h (STATUS_DISK_FULL): Define. (FILE_USE_FILE_POINTER_POSITION): Define. (FILE_WRITE_TO_END_OF_FILE): Define. 2007-10-13 Corinna Vinschen * ntdll.h (STATUS_END_OF_FILE): Define. * path.cc (symlink_info::check_shortcut): Use NT function to get file size. Reintroduce checking file size before reading it. Eliminiate close_it label. (symlink_info::check_sysfile): Check for EOF condition. 2007-10-11 Corinna Vinschen * path.cc (basename): Return pointer into the path argument itself. Shrink buf to 4 bytes. Use buf only for border cases. (dirname): Ditto. 2007-10-10 Corinna Vinschen * path.cc (struct symlink_info): Change size of contents member to be able to keep SYMLINK_MAX sized strings. (symlink_worker): Rework for long path names. When writing windows shortcuts, store pathname additionally "hidden" after the actual shortcut data to workaround size limitations of the description field. (symlink_info::check_shortcut): Drop file name parameter. Drop max file size check. Use NT functions. Use appended full path if available, description otherwise. Check symlink string length for not exceeding SYMLINK_MAX. Don't close file here. (symlink_info::check_sysfile): Drop file name parameter. Use NT functions. Check symlink string length for not exceeding SYMLINK_MAX. Don't close file here. (symlink_info::check_reparse_point): Drop file name parameter. Drop useless length checks. Allow SYMLINK_MAX length symlink strings. Don't close file here. (symlink_info::posixify): Allow SYMLINK_MAX length symlink strings. (symlink_info::check): Turn around checking for symlink file attributes. Use NT functions. Close symlink file here. * include/limits.h (PATH_MAX): Define as 32760. Change comment. (SYMLINK_MAX): Define as PATH_MAX - 1. 2007-10-10 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::bind): Open file for deletion, too. Don't write to file and especially don't close handle if file couldn't be created. Set delete disposition if writing failed, instead of calling unlink_nt. 2007-09-27 Corinna Vinschen * ntdll.h (struct _FILE_COMPRESSION_INFORMATION): Align with definition in w32api / MSDN. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Accommodate change to struct _FILE_COMPRESSION_INFORMATION. 2007-09-26 Corinna Vinschen * termios.cc (setspeed): Support new baud rates introduced 2007-02-05. 2007-09-20 Corinna Vinschen * ntdll.h (STATUS_OBJECT_NAME_INVALID): Define. 2007-09-18 Corinna Vinschen * mmap.cc (fh_disk_file): Delete as global static variable and... (mmap64): ...define as local pointer to make mmap thread-safe. Accommodate throughout. Only initialize fh_disk_file after file could be opened with GENERIC_EXECUTE access. Call fstat_by_handle instead of fstat to avoid overhead. 2007-09-18 Corinna Vinschen * security.cc (set_file_sd): Open file with FILE_OPEN_FOR_BACKUP_INTENT too. 2007-09-17 Corinna Vinschen * path.cc (symlink_info::check): Check for STATUS_OBJECT_NAME_INVALID. Add comment. 2007-09-17 Corinna Vinschen * fhandler.cc (fhandler_base::open): Partly revert change from 2007-08-24: Call has_acls to avoid permission problems getting a handle to a file on a remote share. Add comment. 2007-09-08 Brian Dessent * include/cygwin/config.h: Conditionalize inline __getreent() definition on _COMPILING_NEWLIB. 2007-09-06 Brian Dessent * include/cygwin/config.h (__getreent): Define inline version. 2007-09-06 Brian Dessent * include/sys/stdio.h (_flockfile): Don't try to lock a FILE that has the __SSTR flag set. (_ftrylockfile): Likewise. (_funlockfile): Likewise. 2007-08-24 Corinna Vinschen * syscalls.cc (open): Don't follow symlinks if O_EXCL is given. 2007-08-23 Corinna Vinschen * ntdll.h (STATUS_NO_SUCH_FILE): Define. * path.cc (get_nt_native_path): Reset upath.Length to 0 on each invocation. (symlink_info::check): Use NT native functions. 2007-08-21 Corinna Vinschen * uinfo.cc (pwdgrp::load): Use NT native functions. 2007-08-21 Corinna Vinschen * fhandler_disk_file.cc (fhandler_base::fstat_helper): Rewrite checking for executable file magic using a thread safe method and re-enable this code. 2007-08-21 Corinna Vinschen * syscalls.cc (unlink_nt): Drop one local FILE_BASIC_INFORMATION struct. 2007-08-21 Corinna Vinschen * ntdll.h (NtNotifyChangeDirectoryFile): Declare. (NtQueryAttributesFile): Move to maintain alphabetical order of declarations. Add comment to note that timestamp information returned by NtQueryAttributesFile is unreliable. * path.h (etc::changed_h): Move here. (etc::fn): Change type to OBJECT_ATTRIBUTES. (etc::last_modified): Change type to LARGE_INTEGER. (etc::init): Take PUNICODE_STRING as second argument. * path.cc: Accomodate above changes. (etc::test_file_change): Use NT native functions. (etc::dir_changed): Ditto. * uinfo.cc (pwdgrp::load): Call etc::init with NT native path. 2007-08-21 Corinna Vinschen * fhandler_disk_file.cc: Change debugging output througout to print the NT status consistently. Use UNICODE path information if available. 2007-08-20 Corinna Vinschen * hookapi.cc (ld_preload): Call LoadLibraryW. * path.h (path_conv::get_wide_win32_path_len): Define. 2007-08-20 Corinna Vinschen * fhandler.cc (rootdir): Delete. * winsup.h (rootdir): Drop declaration. 2007-08-19 Corinna Vinschen * path.cc (fillout_mntent): Append backslash to drive-only paths before calling fs_info::update. * path.h (fs_info::clear): Simplify. (fs_info::fs_info): Add constructor. 2007-08-17 Corinna Vinschen * spawn.cc (spawn_guts): Fix typo in comment. 2007-08-17 Corinna Vinschen * autoload.cc (CloseDesktop): Define. (CreateDesktopA): Define. (SetThreadDesktop): Define. * spawn.cc (spawn_guts): When starting a process under another user account, don't open up permissions on current window station and desktop. Instead, if not in interactive session, create a new per-user window station plus default desktop and use that for the child process. 2007-08-16 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Handle S_IFSOCK mode bit by setting the SYSTEM attribute. * fhandler_socket.cc (fhandler_socket::fchmod): Add S_IFSOCK mode bit when calling fhandler_disk_file::fchmod. Don't set attributes here. 2007-08-16 Corinna Vinschen * path.h (path_conv::operator char *): Delete. (path_conv::operator const char *): Delete. * dlfcn.cc: Throughout, replace path_conv::operator char * and path_conv::operator const char * by call to path_conv::get_win32 for easier transition to UNICODE_PATHs. * fhandler_socket.cc: Ditto. * hookapi.cc: Ditto. * path.cc: Ditto. * spawn.cc: Ditto. * syscalls.cc: Ditto. * uinfo.cc: Ditto. 2007-08-16 Corinna Vinschen * dir.cc (readdir_worker): Convert w32name to PUNICODE_STRING. * sec_acl.cc (getacl): Convert debug output to print native NT path. * security.cc (set_file_attribute): Ditto. * syscalls.cc (try_to_bin): Ditto and fix buggy debug statement. 2007-08-16 Corinna Vinschen * ntdll.h (RtlAcquirePebLock): Declare. (RtlReleasePebLock): Declare. * path.cc (cwdstuff::set): Change PEB only while it's locked. 2007-08-16 Corinna Vinschen * fhandler.h (fhandler_base::get_namehash): Use NT native path. * fhandler_disk_file.cc (readdir_get_ino): Ditto in call to hash_path_name. 2007-08-16 Corinna Vinschen * ntdll.h (RtlCreateUnicodeStringFromAsciiz): Fix declaration. (RtlUpcaseUnicodeChar): Declare. * path.cc (hash_path_name): Split into three functions, taking the path as char *, PWCSTR, or PUNICODE_STRING. Move implementation into PUNICODE_STRING-based function. Drop old drive-relative path consideration. * winsup.h (iswdirsep): Like isdirsep but for WCHARs. (isabspath_u): Like isabspath, for PUNICODE_STRINGs. (iswabspath): Like isabspath, for PWCHARs. (hash_path_name): Add new declarations. 2007-08-15 Corinna Vinschen * path.cc (get_nt_native_path): Allow to convert special paths which have no native NT path representation for simplified debug output. * syscalls.cc: Convert debug output to print native NT path. (unlink): Drop redundant debug output. 2007-08-15 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::link): Drop superfluous test for trailing dot. * path.h (path_conv::operator []): Remove. 2007-08-15 Corinna Vinschen * fhandler_socket.cc (get_inet_addr): Use NT native functions for accessing the file representing the local socket. (fhandler_socket::bind): Ditto. * ntdll.h: Declare NtReadFile. 2007-08-14 Corinna Vinschen * path.cc (symlink_info::check): In case of ERROR_SHARING_VIOLATION and ERROR_ACCESS_DENIED, try to get file attributes by using directory functions. 2007-08-14 Corinna Vinschen * path.cc (fs_info::update): Correctly handle the volume root directory. 2007-08-14 Corinna Vinschen * fhandler.h (fhandler_base::pc): Make public. * fhandler_disk_file.cc (fhandler_disk_file::link): Drop extern declaration of stat_suffixes. Use NT native path in debug output. (fhandler_base::utimes_fs): Simplify closeit case. Use close_fs to close newly opened file handle. (fhandler_base::open_fs): Use NT native path in debug output. * path.cc: Throughout drop extern declaration of stat_suffixes. * path.h (stat_suffixes): Declare. * sec_acl.cc (acl_worker): Drop extern declaration of stat_suffixes. * times.cc (utimes_worker): Take path_conv as parameter instead of single-byte pathnam, drop nofollow argument, accommodate throughout. Compare UNICODE paths when enumerating file descriptors. Fix formatting. Use NT native path in debug output. 2007-08-13 Corinna Vinschen * mmap.cc: Call NtClose instead of CloseHandle throughout. (CreateMapping): Drop unused last argument. Accommodate throughout. (mmap64): Re-open file with execute permissions using NtOpenFile. 2007-08-13 Corinna Vinschen * fhandler.h (fhandler_base::close_fs): Reintroduce (as inline function) for clearness. * fhandler_disk_file.cc (fhandler_base::fstat_fs): Revert previous change. (fhandler_base::open_fs): Ditto. * fhandler_socket.cc (fhandler_socket::close): Ditto. 2007-08-13 Corinna Vinschen * Makefile.in (DLL_OFILES): Remove delqueue.o. * delqueue.cc: Delete. * fhandler.h (fhandler_base::close_fs): Drop declaration. (fhandler_disk_file::close): Drop declaration. * fhandler_disk_file.cc (fhandler_base::fstat_fs): Call close instead of close_fs. (fhandler_base::fstat_helper): Use open FH_UNIX handle in call to get_file_attribute. (fhandler_base::open_fs): Call close instead of get_file_attribute. (fhandler_disk_file::close): Remove. (fhandler_base::close_fs): Remove. * fhandler_socket.cc (fhandler_socket::close): Just call fhandler_base::close for FH_UNIX sockets. * shared.cc (user_shared_initialize): Drop call to user_shared->delqueue.init. * shared_info.h (CURR_USER_MAGIC): Change according to below change. (MAX_DELQUEUES_PENDING): Remove. (class delqueue_list): Remove. (class user_info): Remove delqueue. * syscalls.cc (close_all_files): Drop call to user_shared->delqueue.process_queue. (unlink): Drop delqueue handling. 2007-08-13 Corinna Vinschen * devices.in (dev_storage): Use native NT device name for kmsg mailslot. * devices.cc: Regenerate. * fhandler.cc (fhandler_base::operator =): Use path_conv assignment operator. (fhandler_base::set_name): Ditto. (fhandler_base::open): Use NT native path in debug output. * fhandler_mailslot.cc: Convert to NT native function calls. * ntdll.h (struct _FILE_MAILSLOT_SET_INFORMATION): Define. (NtCreateMailslotFile): Declare. * path.cc (path_conv::set_normalized_path): Don't set wide_path to NULL. (path_conv::set_name): Remove unused function. * path.h (path_conv::set_name): Drop declaration. (path_conv::operator =): Define. 2007-08-12 Corinna Vinschen * fhandler.cc (fhandler_base::open): Remove HIDDEN_DOT_FILES code. * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto. * path.cc (symlink_worker): Ditto. 2007-08-12 Corinna Vinschen * syscalls.cc (getw): Remove redundant implementation. (putw): Ditto. (wcscmp): Ditto. (wcslen): Ditto. (memccpy): Ditto. 2007-08-12 Corinna Vinschen * ntdll.h: Add descriptive comments to special Rtl functions. (STATUS_OBJECT_PATH_NOT_FOUND): Define. (STATUS_BUFFER_OVERFLOW): Define. (FILE_SUPERSEDED): Define. (FILE_OPENED): Define. (FILE_CREATED): Define. (FILE_OVERWRITTEN): Define. (FILE_EXISTS): Define. (FILE_DOES_NOT_EXIST): Define. (PIO_APC_ROUTINE): Typedef. (NtFsControlFile): Fix parameter types to use PIO_APC_ROUTINE. (NtWriteFile): Declare. (RtlInt64ToHexUnicodeString): Declare. * strfuncs.cc: Include ntdll.h. (RtlInt64ToHexUnicodeString): New function. * syscalls.cc (try_to_bin): Rewrite using native NT functions. Only try to create recycle bin after unsuccessfully trying to move file. Also try to create special files in recycle bin so that Windows Explorer isn't unnecessarily stampeded. 2007-08-10 Corinna Vinschen * path.cc (fillout_mntent): Fix calculation of unicode buffer size. 2007-08-10 Corinna Vinschen * syscalls.cc (rename): Check oldpath and newpath for trailing dir separators, require them to be existing directories if so. Check for a request to change only the case of the filename. Check paths for case insensitve equality only once. Handle renaming a directory to another, existing directory by unlinking the destination directory first. If newpath points to an existing file with R/O attribute set, try to unset R/O attribute first. Augment hardlink test by not checking directories. If renaming fails with STATUS_ACCESS_DENIED, try to unlink existing destination filename and try renaming again. Drop useless test for non-empty directory. Always close fh at the end of the function. 2007-08-09 Ernie Coskrey * gendef (sigbe): Reset "incyg" while the stack lock is active to avoid a potential race. 2007-08-09 Corinna Vinschen * syscalls.cc (rename): Close oldpath file handle immediately after trying to rename it. Use nfh handle when checking for non-empty newpath directory. Only change status if check_dir_not_empty really returns STATUS_DIRECTORY_NOT_EMPTY. 2007-08-02 Corinna Vinschen * fhandler_disk_file.cc (readdir_get_ino): Accommodate native symlinks. * syscalls.cc (rename): Ditto. 2007-08-02 Christopher Faylor * lib/Makefile: Add missed file to accommodate below changes. 2007-08-02 Christopher Faylor * lib/cygwin_attach_dll.c: Fix compiler warning. * lib/cygwin_crt0.c: Ditto. 2007-08-02 Christopher Faylor * dcrt0.cc (codepage_type): Remove definition. * strfuncs.cc: Move it here. New file with bits of miscfuncs.cc. * miscfuncs.cc: Remove wide character stuff. 2007-08-02 Corinna Vinschen * syscalls.cc (rename): Move and add text to comment about testing oldpath and newpath referring to the same file. Test if oldpath has more than one hardlink before opening oldpath (idea by Eric Blake). Reorder test so that file id is tested before volume serial number. 2007-08-02 Corinna Vinschen * path.h (struct fs_info): Drop root_len and name_hash members. (fsinfo::length): Remove. (path_conv::rootdir): Remove. * syscalls.cc (try_to_bin): Use rootdir function instead of path_conv::rootdir method. 2007-08-02 Corinna Vinschen * fhandler_disk_file.cc (path_conv::ndisk_links): Fix typo in call to NtClose. 2007-08-01 Corinna Vinschen * syscalls.cc (rename): Check if oldpath and newpath refer to the same file. If so, return successfully and perform no other action, as per SUSv3. 2007-08-01 Corinna Vinschen * ntdll.h (STATUS_ACCESS_DENIED): Define. * syscalls.cc (check_dir_not_empty): New static function. (unlink_nt): Move code checking for non-empty dir to check_dir_not_empty and call check_dir_not_empty instead. (rename): Add fault handler. Check oldpath and newpath for trailing . and .. path components and return EINVAL if so. Check oldpath for being on a vrtual file system. If renaming a dir fails with STATUS_ACCESS_DENIED, check if the target dir is non-empty and return ENOTEMPTY if so. 2007-08-01 Corinna Vinschen * localtime.cc (tzsetwall): Don't set TZ. 2007-08-01 Corinna Vinschen * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Drop usage of path_conv::volser(). (fhandler_base::fstat_by_name): Ditto. * ntdll.h (STATUS_NO_MEDIA_IN_DEVICE): Define. (STATUS_OBJECT_NAME_NOT_FOUND): Define. (FILE_REMOVABLE_MEDIA, FILE_READ_ONLY_DEVICE, FILE_FLOPPY_DISKETTE) (FILE_WRITE_ONCE_MEDIA, FILE_REMOTE_DEVICE, FILE_DEVICE_IS_MOUNTED) (FILE_VIRTUAL_VOLUME, FILE_AUTOGENERATED_DEVICE_NAME) FILE_DEVICE_SECURE_OPEN): Define Device Characteristics. (struct _FILE_FS_DEVICE_INFORMATION): Define. * path.cc (MAX_FS_INFO_CNT): Remove. (fsinfo): Remove. (fsinfo_cnt): Remove. (fs_info::update): Rewrite using native NT functions. Drop fs_info cashing since it's incorrect. (path_conv::fillin): Use NtQueryInformationFile. Drop setting serial number. (path_conv::check): Accommodate new fs_info::update parameters. (fillout_mntent): Ditto. * path.h (fs_info): Drop serial, has_ea and drive_type status flags. (fs_info::update): Declare with new parameters. (path_conf::drive_type): Remove. (path_conf::fs_has_ea): Remove. (path_conf::volser): Remove. 2007-08-01 Corinna Vinschen * fhandler.cc (check_posix_perms): Remove. (fhandler_base::fpathconf): Return value of pc.has_acls () instead of calling check_posix_perms. 2007-08-01 Corinna Vinschen * syscalls.cc (rename): Use unchanged path_conv in condition. 2007-08-01 Corinna Vinschen * smallprint.cc (__small_vsprintf): Add format specifier 'W' for PWCHAR arguments. Move wide char handling after char handling. 2007-07-31 Corinna Vinschen * ntdll.h (RtlFreeAnsiString): Declare. * ntdll.h (RtlFreeOemString): Declare. * ntdll.h (RtlUnicodeStringToAnsiString): Declare. * ntdll.h (RtlUnicodeStringToOemString): Declare. * smallprint.cc: Renamed from smallprint.c. Drop unnecessary forward declarations. (__small_vsprintf): Add format specifiers 'C' for WCHAR arguments and 'S' for PUNICODE_STRING arguments. 2007-07-31 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::link): Revert to checking for binary in case of .exe files. * ntdll.h (RtlPrefixUnicodeString): Declare. * path.cc (path_conv::is_binary): New method. * path.h (path_conv::is_binary): Declare. * syscalls.cc (rename_append_suffix): New static helper function for rename. (rename): Rewrite. New suffix tests. Use native NT functions. 2007-07-30 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::facl): If file can't be opened for reading the ACLs, fall back to faking them. * sec_acl.cc (acl_worker): Handle non-existing files. * security.cc (get_file_attribute): Return ILLEGAL_UID/ILLEGAL_GID as owner/group for non-readable ACLs on file systems supporting them. 2007-07-30 Corinna Vinschen * syscalls.cc (stat_worker): Don't call build_fh_pc with invalid pc. 2007-07-29 Christopher Faylor * fhandler.cc (fhandler_base::wait_overlapped): Handle read EOF better and issue a SIGPIPE when we get ERROR_NO_DATA. 2007-07-29 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Don't allow FileAttributes set to 0 when calling NtSetInformationFile since it has a special meaning. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::link): Only set attributes after copying files. Use SetFileAttributesW. * syscalls.cc (unlink_nt): Only care for actual FILE_ATTRIBUTE_READONLY. Don't allow FileAttributes set to 0 when calling NtSetInformationFile. After marking for deletion, restore R/O attribute on files to accommodate hardlinks. 2007-07-29 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::link): Use FILE_ANY_ACCESS. (fhandler_base::utimes_fs): Fix white space. (fhandler_disk_file::lock): Remove 9x blurb from comment. (fhandler_disk_file::mkdir): Use NtCreateFile/NtClose instead of CreateDirectoryA. (fhandler_disk_file::rmdir): Accommodate changes to unlink_nt. Simplify post-delete SMB-related tests. Use NtQueryAttributesFile instead of GetFileAttributes. * ntdll.h (STATUS_DIRECTORY_NOT_EMPTY): Define. (NtQueryAttributesFile): Declare. * syscalls.cc (unlink_nt): Return NTSTATUS. Drop setattrs parameter. Never use FILE_DELETE_ON_CLOSE, always use NtSetInformationFile(FileDispositionInformation) instead. Check for R/O attributes and open file with FILE_WRITE_ATTRIBUTES access if any of them are set. Remove R/O attributes before marking for delete if necessary. Revert them afterwards if necessary. (unlink): Accommodate changes to unlink_nt. 2007-07-29 Corinna Vinschen * fhandler_disk_file.cc: Use get_handle throughout. (fhandler_disk_file::fchmod): Always try to open file with required access rights. Use NtSetInformationFile instead of SetFileAttributes. (fhandler_disk_file::facl): Use NtSetInformationFile instead of SetFileAttributes. (fhandler_base::utimes_fs): Change lastaccess and lastwrite to LARGE_INTEGER. Drop 9x directory case. Use NtSetInformationFile instead of SetFileAttributes. Drop temporarily changing R/O attribute since NtSetInformationFile(FileBasicInformation) also works on R/O files. * ntdll.h (STATUS_NOT_SUPPORTED): Define. 2007-07-29 Christopher Faylor * cygtls.h (_cygtls::inside_kernel): Move function declaration into _cygtls class. * exceptions.cc (_cygtls::inside_kernel): Move function definition into _cygtls class. * fhandler.cc (fhandler_base::wait_overlapped): Make return tri-state to detect when there is a EINTR situation. Add a pointer to a length parameter. Move GetOverlappedResult into this function. (fhandler_base::read_overlapped): Accommodate above changes and loop if we receive a restartable signal. (fhandler_base::write_overlapped): Ditto. * fhandler.h (fhandler_base::wait_overlapped): Reflect above changes. * fhandler_fifo.cc (fhandler_fifo::wait): Ditto. 2007-07-28 Corinna Vinschen * ntdll.h (RtlEqualUnicodePathPrefix): Rename from RtlEqualPathPrefix. (RtlEqualUnicodePathSuffix): Rename from RtlEqualPathSuffix. * fhandler_disk_file.cc (fhandler_disk_file::link): Accommodate above change. 2007-07-28 Corinna Vinschen * ntdll.h (RtlInitCountedUnicodeString): Swap order of string and length parameters to be the same as for RtlInitEmptyUnicodeString. (RtlEqualPathPrefix): New inline function. (RtlEqualPathSuffix): New inline function. * fhandler_disk_file.cc: Accommodate parameter order change of RtlInitEmptyUnicodeString throughout. (fhandler_disk_file::link): Do path checking in unicode. Call CopyFileW instead of CopyFileA. 2007-07-27 Corinna Vinschen * autoload.cc (CreateHardLinkA): Remove. * fhandler_disk_file.cc (fhandler_disk_file::link): Drop GetBinaryType test. Just check exe suffix instead. Tune creating new file name. Implement creating hard link using native NT functions which works on all platforms. * ntdll.h (STATUS_INVALID_DEVICE_REQUEST): Define. (struct _FILE_LINK_INFORMATION): Define. 2007-07-27 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::ftruncate): Use NtQueryInformationFile instead of GetFileSize, NtFsControlFile instead of DeviceIoControl. 2007-07-27 Corinna Vinschen * fhandler_disk_file.cc (fhandler_base::fstat_by_name): Use RtlSplitUnicodePath. (fhandler_disk_file::fstat): Rename oret to opened. Open file using NT functions right here. Try to open parent dir instead of root directory to avoid call to rootdir. Use NtFsControlFile. * ntdll.h (RtlSplitUnicodePath): Define. 2007-07-27 Corinna Vinschen * fhandler_disk_file.cc (is_volume_mountpoint): New static inline function. (path_conv::ndisk_links): Call is_volume_mountpoint. (fhandler_disk_file::readdir_helper): Ditto. 2007-07-27 Corinna Vinschen * fhandler.h (enum query_state): Drop redundant query_stat_control. * fhandler.cc (fhandler_base::open): Ditto. Add READ_CONTROL to access and FILE_OPEN_FOR_BACKUP_INTENT to create_options when opening for writing. Always set security attributes to avoid calling has_acls. * fhandler_disk_file.cc (fhandler_base::fstat_fs): Don't try to open file twice. 2007-07-26 Corinna Vinschen * dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration. 2007-07-25 Corinna Vinschen * autoload.cc (CreateToolhelp32Snapshot): Remove. 2007-07-25 Corinna Vinschen * autoload.cc (Process32First): Remove. (Process32Next): Remove. 2007-07-25 Corinna Vinschen * autoload.cc (NetWkstaUserGetInfo): Remove. (CharToOemBuffA): Remove. (KillTimer): Remove. (OemToCharBuffA): Remove. (SetTimer): Remove. 2007-07-20 Corinna Vinschen * Makefile.in (DLL_OFILES): Add sec_auth.o. * fhandler.cc (fhandler_base::fhaccess): Accommodate interface changes of access control functions throughout. * fhandler_disk_file.cc: Ditto. * fhandler_registry.cc: Ditto. * sec_acl.cc: Drop unnecessary includes. (setacl): Take path_conv instead of file name as parameter. Accommodate interface changes of access control functions. (getacl): Ditto. * sec_auth.cc: New file, taking over all authentication related functions from security.cc. * sec_helper.cc: Drop unnecessary includes. * security.cc: Ditto. Move all authentication related functions to sec_auth.cc. (ALL_SECURITY_INFORMATION): New define. Use throughout. (set_file_sd): New function, replacing read_sd and the file related part of get_nt_object_security. (get_reg_sd): Rename from get_reg_security. Drop type parameter. (get_reg_attribute): New function, replacing the registry related part of get_nt_object_security. (get_file_attribute): Take path_conv instead of file name as parameter. Use new get_file_sd call. (set_file_attribute): Ditto plus new set_file_sd. Drop unnecessary implementation without uid/gid parameters. (check_file_access): Take path_conv instead of file name as parameter. Use new get_file_sd call. (check_registry_access): Use new get_reg_sd call. * security.h: Accommodate above interface changes. 2007-07-19 Corinna Vinschen * security.cc (set_nt_attribute): Remove. (set_file_attribute): Do it yourself instead of calling set_nt_attribute. 2007-07-19 Corinna Vinschen * fhandler_disk_file.cc (fhandler_base::fstat_by_name): Use NtQueryFullAttributesFile instead of FindFirstFile. (fhandler_base::fstat_fs): Drop check for exec_state. Drop check for invalid characters. * ntdll.h (struct _FILE_NETWORK_OPEN_INFORMATION): Define. (NtQueryFullAttributesFile): Declare. 2007-07-19 Corinna Vinschen * fhandler.cc (fhandler_base::open): Drop local wpath and upath variables. Call pc.get_object_attr to create object attributes. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto. * syscalls.cc (unlink_nt): Ditto. * path.cc (path_conv::set_normalized_path): Set wide_path to NULL. (path_conv::get_nt_native_path): Drop parameter. Create path in wide_path/uni_path members. (path_conv::get_object_attr): New method to create object attributes. (path_conv::get_wide_win32_path): New method to create Win32 wide path. (path_conv::check): Initialize wide_path to NULL. (path_conv::~path_conv): cfree wide_path. * path.h (class path_conv): New members wide_path and uni_path. Add declarations of get_object_attr and get_wide_win32_path. (path_conv::path_conv): Initialize wide_path to NULL. (path_conv::get_nt_native_path): Drop parameter. 2007-07-19 Corinna Vinschen * sec_helper.cc: Remove unused code. 2007-07-19 Corinna Vinschen * autoload.cc (SetSecurityDescriptorControl): Drop. * security.cc (alloc_sd): Set security descriptor control flag without calling SetSecurityDescriptorControl function. * wincap.h (wincapc::has_dacl_protect): Rename from has_security_descriptor_control. * wincap.cc: Ditto throughout. 2007-07-19 Corinna Vinschen * autoload.cc (SetUserObjectSecurity): Drop. * pinfo.cc (pinfo::set_acl): Use NtSetSecurityObject instead of SetKernelObjectSecurity. * spawn.cc (spawn_guts): Use NtSetSecurityObject instead of SetUserObjectSecurity. * uinfo.cc (cygheap_user::init): Ditto. 2007-07-19 Corinna Vinschen * cygheap.h (init_cygheap::luid): Remove. * mmap.cc (mlock): Accommodate parameter change in call to push_thread_privilege. (munlock): Ditto. * ntdll.h (STATUS_NOT_ALL_ASSIGNED): Define. (NtAdjustPrivilegesToken): Declare. * sec_helper.cc (cygpriv): Reorder to match numerical privilege order. (privilege_luid): Take job of privilege_luid_by_name, using new cygpriv. (privilege_luid_by_name): Remove. (privilege_name): Accommodate new cygpriv array. (set_privilege): Call NtAdjustPrivilegesToken to avoid using advapi32. Accommodate changes to privilege_name. (set_cygwin_privileges): Simplify. Don't try to set SE_CREATE_GLOBAL_PRIVILEGE on systems not supporting it. * security.cc (sys_privs): Reorder to match numerical privilege order. Use real privilege values as defined in security.h. (get_system_priv_list): Drop unused grp_list argument. Create list of privileges according to new wincapc::max_sys_priv value. (get_priv_list): Call privilege_luid instead of privilege_luid_by_name. Make priv a local value instead of a pointer. (create_token): Accommodate parameter change in call to push_self_privilege. (lsaauth): Ditto. (check_access): Use privilege values directly instead of calling privilege_luid. * security.h: Define real privilege values. (cygpriv_idx): Remove. (privilege_luid): Change declaration. (privilege_luid_by_name): Drop declaration. (set_privilege): Change declaration. (set_process_privilege): Drop definition. (_push_thread_privilege): Accomodate new set_privilege parameters. * wincap.h (wincapc::max_sys_priv): New element. * wincap.cc: Implement above element throughout. (wincap_2000sp4): New wincaps structure. (wincap_xpsp1): Ditto. (wincap_xpsp2): Ditto. (wincapc::init): Use new wincaps. (wincapc::max_sys_priv): New element. 2007-07-19 Corinna Vinschen * dcrt0.cc (dll_crt0_0): Call set_cygwin_privileges here, after initializing hProcToken. * sec_helper.cc (init_global_security): Don't call set_cygwin_privileges here. 2007-07-18 Corinna Vinschen * cygheap.h (shared_prefix): De-const. (shared_prefix_buf): Add static buffer for shared prefix to avoid additional allocation. * cygheap.cc (cygheap_init): Set cygheap->shared_prefix to cygheap->shared_prefix_buf and strcpy. 2007-07-17 Corinna Vinschen * fhandler.cc (fhandler_base::fhaccess): Add check for R/O file system. * security.cc (check_registry_access): Set errno to EROFS when checking for W_OK. 2007-07-17 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::opendir): Move setting cfd->nohandle where it won't crash. 2007-07-16 Corinna Vinschen * cygheap.h (cygheap_user::curr_imp_token): Rename from current_token. Accommodate change throughout Cygwin. (cygheap_user::imp_token): Rename from token. Accommodate change throughout Cygwin. (rcygheap_user::eimpersonate): Use primary token for impersonation. * grp.cc (internal_getgroups): Use primary impersonation token when impersonated. * security.h (_push_thread_privilege): Use primary impersonation token when impersonated. 2007-07-14 Christopher Faylor * init.cc (in_dllentry): Delete. (dll_entry): Remove assignment to deleted variable. * winsup.h (in_dllentry): Delete declaration. * exceptions.cc (inside_kernel): Use another method to see if we are in dll_entry phase. 2007-07-13 Christopher Faylor * init.cc (in_dllentry): Make NO_COPY to avoid spurious false positives. 2007-07-09 Christopher Faylor * debug.cc (close_handle): Change debug output format slightly. * dlfcn.cc (dlclose): Don't close handle returned from GetModuleHandle(NULL). * fhandler.h (fhandler_pipe::create): Remove obsolete argument. (fhandler_pipe::create): Ditto. * fhandler.cc (fhandler_pipe::create): Ditto. (fhandler_pipe::create): Ditto. 2007-07-09 Christopher Faylor * strsig.cc (__signals): New macro. (sys_sigabbrev): New array of signal strings, patterned after linux. (siglist): Use __signals. * include/cygwin/signal.h (sys_sigabbrev): Define. * include/cygwin/version.h: Bump API minor version to 177. 2007-07-09 Corinna Vinschen * dir.cc (closedir): Revert change from 2007-06-29. * fhandler.h (dirent_valid_fd): Drop. * fhandler_disk_file.cc (fhandler_disk_file::opendir): If opening a real dir, use the underlying fhandler to keep track of the directory handle. In fdopendir case use original io_handle from fhandler. Use fhandler's io_handle in subsequent directory functions throughout. Create handle non-inheritable and set close-on-exec flag. (readdir_get_ino): Drop dirent_isroot case. (fhandler_disk_file::readdir): Handle dirent_isroot case here. (fhandler_disk_file::rewinddir): Revert change from 2007-07-05. Use NtClose instead of CloseHandle. * fhandler_virtual.cc (fhandler_virtual::opendir): Drop adding dirent_valid_fd flag. Set close-on-exec flag. 2007-07-08 Christopher Faylor * Makefile.in (DLL_OFILES): Add newly-imported random.o. Eliminate reliance on libiberty. * random.cc: Import from FreeBSD. Modify for Cygwin environment. * include/cygwin/stdlib.h (random): Reflect change in return value to be more linux/freebsd-like. (srandom): Ditto. 2007-07-07 Christopher Faylor * fhandler.h (fhandler_base::write): Remove __stdcall decoration. (fhandler_pipe::write): Ditto. (fhandler_fifo::write): Ditto. 2007-07-07 Christopher Faylor Preliminary change to make pipes interruptible and fifos reliable. * dtable.cc (dtable::find_fifo): Eliminate definition. * dtable.h (dtable::find_fifo): Ditto for declaration. * fhandler.cc (fhandler_base::raw_read): Remove pipe-specific stuff. (fhandler_base::fhandler_base): Ditto. (fhandler_base::close): Handle overlapped I/O structure if appropriate. (fhandler_base::dup): Ditto. (fhandler_base::fork_fixup): Ditto. (fhandler_base::setup_overlapped): Define new function. (fhandler_base::destroy_overlapped): Ditto. (fhandler_base::wait_overlapped): Ditto. (fhandler_base::read_overlapped): Ditto. (fhandler_base::write_overlapped): Ditto. * fhandler.h (fhandler_base::get_overlapped): Declare new function. (fhandler_base::setup_overlapped): Ditto. (fhandler_base::destroy_overlapped): Ditto. (fhandler_base::wait_overlapped): Ditto. (fhandler_base::read_overlapped): Ditto. (fhandler_base::write_overlapped): Ditto. (fhandler_base::get_guard): Eliminate. (fhandler_pipe::*): Rework to eliminate most Win9x related cruft, removing many variables and defining a new overlapped capability. (fhandler_fifo::*): Ditto. (fifo_state): Declare new enum. * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Remove old Win9x stuff. Initialize overlapped handle to NULL. (fhandler_fifo::set_use): Eliminate. (fhandler_fifo::open_nonserver): Define. (fhandler_fifo::open): Rework to use named pipes and overlapped I/O. (fhandler_fifo::wait): Define new function to wait for named pipe connection. (fhandler_fifo::read): Rework to use wait() and new overlapped I/O functionality. (fhandler_fifo::write): Ditto. (fhandler_fifo::dup): Eliminate. * pinfo.cc (commune_process): Remove fifo handling. (_pinfo::commune_request): Ditto. * pinfo.h (picom): Ditto. * pipe.cc (fhandler_pipe::fhandler_pipe): Remove Win9x stuff. Initialize overlapped handle to NULL. (fhandler_pipe::open): Eliminate Win9x stuff. (fhandler_pipe::set_close_on_exec): Eliminate. (read_pipe): Eliminate. (fhandler_pipe::close): Ditto. (fhandler_pipe::fixup_after_exec): Ditto. (fhandler_pipe::fixup_in_child): Ditto. (fhandler_pipe::read): Rework to use overlapped I/O. (fhandler_pipe::write): New function using overlapped I/O. (fhandler_pipe::dup): Rework to eliminate Win9x stuff. (fhandler_pipe::create_selectable): Rework to eliminate Win9x and use overlapped I/O. * select.cc (peek_pipe): Rework to eliminate Win9x stuff and use overlapped I/O. (fhandler_base::ready_for_read): Ditto. 2007-07-07 Christopher Faylor * path.cc (symlink_info::check_shortcut): Handle device "symlinks" specially - don't posixify them. 2007-07-07 Christopher Faylor * fhandler_disk_file.cc: White space. * fhandler_proc.cc: Ditto. * fhandler_virtual.cc: Ditto. 2007-07-07 Christopher Faylor * fork.cc: White space. * net.cc: Ditto. * posix_ipc.cc: Ditto. 2007-07-06 Corinna Vinschen * times.cc (gettimeofday): Align definition to POSIX. 2007-07-06 Corinna Vinschen * cygwin.din: Export wcstol, wcstoll, wcstoul, wcstoull, wcsxfrm. * include/cygwin/version.h: Bump API minor number. 2007-07-05 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::opendir): Add missing OBJ_INHERIT flag when creating OBJECT_ATTRIBUTES. (fhandler_disk_file::rewinddir): Ditto. 2007-07-04 Corinna Vinschen * times.cc: Define __timezonefunc__ before including time.h to protect definition of timezone function. 2007-07-04 Corinna Vinschen * include/cygwin/time.h: Switch to timezone variable by default. Add comment. 2007-06-29 Corinna Vinschen * cygwin.din: Export fdopendir. * dir.cc (opendir): Call fhandler's opendir with fd set to -1. (fdopendir): New function. (seekdir64): Use dirent_info_mask. (rewinddir): Ditto. (closedir): Only release underlying file descriptor if it has been reserved by opendir itself. * fhandler.cc (fhandler_base::opendir): Accommodate new parameter. * fhandler.h (dirent_states): Add dirent_valid_fd and dirent_info_mask. (fhander_XXX::opendir): Add file descriptor parameter. Use regparms. (fhandler_procnet::opendir): Drop declaration. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto. If called from fdopendir, use existing handle to re-open directory with valid flags. Rename fd to cfd. Use only if no valid incoming fd. (fhandler_cygdrive::opendir): Accommodate new parameter. * fhandler_process.cc (fhandler_process::opendir): Ditto. * fhandler_procnet.cc (fhandler_procnet::opendir): Drop definition. * fhandler_virtual.cc (fhandler_virtual::opendir): Accommodate new parameter. Only create new file descriptor entry if called from opendir. Remove duplicated setting of dir->__flags. * posix.sgml: Add fdopendir to list of implemented Solaris functions. * include/cygwin/version.h: Bump API minor number. * include/sys/dirent.h: Declare fdopendir. 2007-06-28 Brian Dessent * include/cygwin/version.h: Fix comment typo. 2007-06-28 Corinna Vinschen * cygwin.din: Export stpcpy, stpncpy. * posix.sgml: Add stpcpy and stpncpy to list of implemented GNU extensions. * include/cygwin/version.h: Bump API minor number. 2007-06-27 Corinna Vinschen * shared_info.h (SHARED_INFO_CB): Accommodate change to shared_info. (CURR_SHARED_MAGIC): Ditto. (class shared_info): Add heap_slop_inited member. * shared.cc (shared_info::heap_slop_size): Use heap_slop_inited to track initializing heap_slop since 0 is a valid value for heap_slop. Drop useless < 0 consideration. 2007-06-27 Eric Blake * assert.cc (__assert_func): New function, to match newlib header change. * cygwin.din: Export __assert_func. * include/cygwin/version.h: Bump API minor number. 2007-06-21 Corinna Vinschen * autoload.cc (WSAIoctl): Remove. * cygwin.din: Export freeifaddrs, getifaddrs. * fhandler_socket.cc (fhandler_socket::ioctl): Drop SOCKET parameter from get_ifconf. * net.cc: Include ifaddrs.h. (in_are_prefix_equal): Match addresses in network byte order. (ip_addr_prefix): Convert address into host byte order before testing with IN_LOOPBACK. (struct ifall): Define. (get_xp_ifs): Replace get_xp_ifconf. Return struct ifall array. (get_2k_ifs): Ditto, replace get_2k_ifconf. (get_nt_ifs): Ditto, replace get_nt_ifconf. (getifaddrs): New function. (freeifaddrs): New function. (get_ifconf): Call matching get_XX_ifs function and create ifc content from here. Drop lo fake since it's now in get_nt_ifs. * posix.sgml: Add freeifaddrs and getifaddrs to list of implemented BSD functions. * wincap.h (wincapc::has_broken_if_oper_status): New element. * wincap.cc: Implement above element throughout. * include/ifaddrs.h: New file. * include/cygwin/version.h: Bump API minor number. 2007-06-20 Eric Blake * cygwin.din: Export exp10, exp10f, pow10, pow10f, strcasestr, funopen, fopencookie. * include/cygwin/version.h: Bump API minor number. * posix.sgml: Minor improvements. 2007-06-20 Corinna Vinschen * include/cygwin/if.h (IFF_POINTOPOINT): Fix typo. 2007-06-16 Christopher Faylor * include/search.h: Reinstate node_t definition. 2007-06-16 Christopher Faylor * include/sys/cdefs.h: Remove in favor of newlib version. 2007-06-14 Corinna Vinschen * autoload.cc (GetIpForwardTable): Define. * fhandler_socket.cc (fhandler_socket::ioctl): Handle SIOCGIFDSTADDR. * net.cc (get_routedst): New static function to get destination address of point-to-point interfaces. (get_xp_ifconf): Handle SIOCGIFDSTADDR. (get_2k_ifconf): Ditto. (get_nt_ifconf): Ditto. (get_ifconf): Ditto. * include/asm/socket.h (SIOCGIFDSTADDR): Define. * include/cygwin/if.h (struct ifreq): Add ifru_dstaddr member. (ifr_dstaddr): Define. * include/cygwin/in.h: Cast ipv4 addresses correctly to in_addr_t in definitions. 2007-06-12 Christopher Faylor * signal.cc (usleep): Use useconds_t for the type as per POSIX. 2007-06-12 Corinna Vinschen * Makefile.in (DLL_OFILES): Add xsique.o. * cygwin.din (confstr): Make NOSIGFE. (insque): Export. (remque): Export. * lsearch.cc: Remove superfluous _SEARCH_PRIVATE define. * posix.sgml: Move insque to defined SUSv3 interfaces. Remove comment for remque. * include/search.h: Remove _SEARCH_PRIVATE guarded definitions. Add struct qelem definition. Add insque and remque declarations. * include/cygwin/version.h: Bump API minor number. * include/sys/queue.h: Remove insque/remque definitions so as not to collide with SUSv3 compatible declaration in search.h. * libc/xsique.cc: New file implementing insque and remque. 2007-06-12 Corinna Vinschen * fhandler.cc (fhandler_base::fstat): Set pipe permission bits more correctly. 2007-06-11 Corinna Vinschen * cygwin.din (confstr): Export. * posix.sgml (confstr): Move to list of implemented SUSv3 functions. * sysconf.cc (confstr): Implement. * include/cygwin/version.h: Bump API minor number. 2007-06-05 Corinna Vinschen * ansi.sgml: Delete. * misc-std.sgml: Delete. * posix.sgml: Rework entirely. 2007-05-29 Corinna Vinschen * dtable.cc (dtable::set_file_pointers_for_exec): Call SetFilePointer correctly for 64 bit file access. Comment out functionality. * fhandler.cc (fhandler_base::open): Don't set append_mode. (fhandler_base::write): Check for O_APPEND instead of append_mode. Call SetFilePointer correctly for 64 bit file access. Handle errors from SetFilePointer. * fhandler.h (class fhandler_base): Drop append_mode status flag. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Handle seeking correctly for 64 bit file access. 2007-05-22 Corinna Vinschen * path.cc (cwdstuff::set): Revert useless acquire check. 2007-05-22 Corinna Vinschen * path.cc (cwdstuff::set): Avoid double aquiring of cwd_lock. Open directory with inheriting enabled. 2007-05-21 Christian Franke * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Don't invalidate devbuf if new position is within buffered range. 2007-05-21 Eric Blake * include/search.h (hsearch_r): Provide declaration. 2007-05-21 Christian Franke Corinna Vinschen * fhandler_floppy.cc (fhandler_dev_floppy::lseek): Set buf size to sector size. Simplify non-sector aligned case. Handle errors from raw_read. 2007-05-15 Corinna Vinschen * fhandler_socket.cc (adjust_socket_file_mode): New inline function. (fhandler_socket::fchmod): Squeeze mode through adjust_socket_file_mode before using it. (fhandler_socket::bind): Ditto. 2007-03-19 Ryan C. Gordon * path.cc (fs_info::update): Set and use is_cdrom. * path.cc (fillout_mntent): Set ret.mnt_type to something more Linux-like, based on data from fs_info. Move "system" and "user" strings from mnt_type to mnt_opts. * path.h (struct fs_info): Add is_cdrom field. * path.h (fs_info::clear): Initialize is_cdrom. * path.h (struct fs_info): Add IMPLEMENT_STATUS_FLAG(bool,is_cdrom). * path.h (class path_conv): Add fs_is_cdrom method. Add missing fs_is_netapp method. 2007-05-14 Eric Blake * cygwin.din (asnprintf, dprint, _Exit, vasnprintf, vdprintf): Export. * include/cygwin/version.h: Bump API minor number. 2007-04-18 Brian Dessent * cygwin.sc: Remove duplicated .debug_macinfo section. * dllfixdbg: Also copy DWARF-2 sections into .dbg file. 2007-04-06 Eric Blake * include/stdint.h (WINT_MIN): Fix sign. 2007-04-04 Eric Blake * include/stdint.h (WINT_MIN, WINT_MAX): Fix definition. 2007-03-30 Christopher Faylor * external.cc (cygwin_internal): Implement CW_SET_DOS_FILE_WARNING. * include/sys/cygwin.h: Define CW_SET_DOS_FILE_WARNING. 2007-03-29 Corinna Vinschen * cygheap.cc (cygheap_init): Fix formatting. Remove comment. Set shared_prefix depending only on terminal service capability. * dcrt0.cc (dll_crt0_1): Don't call set_cygwin_privileges here. * fhandler_fifo.cc (fhandler_fifo::open): Create the mutex as global object. * posix_ipc.cc (ipc_mutex_init): Use cygheap->shared_prefix. (ipc_cond_init): Ditto. * sec_helper.cc (privilege_name): Make static. Use LookupPrivilegeName directly to be independent of the state of cygheap. (set_privilege): Take a LUID as parameter instead of an index value. Only print debug output in case of failure. (set_cygwin_privileges): Add comment. Use LookupPrivilegeValue to get privilege LUIDs. (init_global_security): Call set_cygwin_privileges here. * security.h (privilege_name): Drop declaration. (set_privilege): Declare according to above change. (set_process_privilege): Call privilege_luid to get LUID. (_push_thread_privilege): Ditto. * shared.cc (open_shared): Add comment. On systems supporting the SeCreateGlobalPrivilege, try to create/open global shared memory first. Fall back to local shared memory if that fails. * thread.cc (semaphore::semaphore): Use cygheap->shared_prefix. * wincap.h (wincapc::has_create_global_privilege): New element. * wincap.cc: Implement above element throughout. 2007-03-28 Christopher Faylor * spawn.cc (spawn_guts): Start pure-windows processes in a suspended state to avoid potential DuplicateHandle problems. 2007-03-13 Eric Blake * include/cygwin/stat.h (S_TYPEISMQ, S_TYPEISSEM, S_TYPEISSHM): Avoid compiler warnings. 2007-03-07 Christopher Faylor * signal.cc (handle_sigprocmask): Remove extraneous sig_dispatch_pending. 2007-03-07 Corinna Vinschen * fhandler_proc.cc: Fix formatting. Drop setting errno when creating proc file content. (format_proc_uptime): Simplify. (format_proc_cpuinfo): Align more closely to output of Linux 2.6 kernel. Evaluate more data, especially for AMD CPUs. 2007-03-06 Corinna Vinschen * fhandler.h (fhandler_base::fstat_helper): Add creation time parameter. * glob.cc (stat32_to_stat64): Set st_birthtim to st_mtim. 2007-03-06 Corinna Vinschen * include/cygwin/stat.h (S_TYPEISMQ): Define. (S_TYPEISSEM): Dttio. (S_TYPEISSHM): Ditto. 2007-03-06 Corinna Vinschen * fhandler_mailslot.cc (fhandler_mailslot::fstat): Set new stat member st_birthtim to useful value. * fhandler_process.cc (fhandler_process::fstat): Ditto. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Take additional parameter for creation time. Fill st_birthtim with it. Accomodate additional creation time parameter throughout. * fhandler_raw.cc (fhandler_dev_raw::fstat): Set new stat member st_birthtim to useful value. * fhandler.cc (fhandler_base::fstat): Ditto. * fhandler_registry.cc (fhandler_registry::fstat): Ditto. * include/cygwin/version.h: Bump API minor number. * include/cygwin/stat.h (struct __stat64): Replace st_spare4 with timestruc_t st_birthtim. (struct stat): Ditto if __CYGWIN_USE_BIG_TYPES__ is defined. (st_birthtime): Define if __CYGWIN_USE_BIG_TYPES__ is defined. 2007-03-02 Corinna Vinschen * ntdll.h (struct _FILE_NAMES_INFORMATION): Define. * syscalls.cc (unlink_nt): Check shared directory for being empty before trying to move and mark for deletion. 2007-03-02 Corinna Vinschen * security.cc (get_file_attribute): Avoid compiler warning. 2007-03-01 Christopher Faylor * fork.cc (fork): Reset child to true after fork since it may have been reset by fork memory copies. 2007-03-01 Christopher Faylor * Makefile (DLL_OFILES): Remove ntea.o * environ.cc (set_ntea): Delete. (parse_thing): Delete "ntea" setting. * fhandler.cc (fhandler_base::open): Remove allow_ntea considerations. (check_posix_perm): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Ditto. (fhandler_base::open_fs): Ditto. (fhandler_disk_file::mkdir): Ditto. * path.cc (symlink_worker): Ditto. * security.cc (get_file_attribute): Ditto. (set_file_attribute): Ditto. * security.h: Remove allow_ntea declaration. 2007-02-27 Corinna Vinschen * path.cc (close_user_proc_parms_cwd_handle): Remove. (cwdstuff::init): Don't call close_user_proc_parms_cwd_handle. Call set to set cwd with all-sharing handle. (cwdstuff::set): Fix comment. Don't close cwd handle. Set in user parameter block instead and close old cwd handle. * syscalls.cc (rename): Call unlink_nt instead of RemoveDirectory or DeleteFile to allow deleting shared files/directories. 2007-02-27 Corinna Vinschen * fhandler.cc(fhandler_base::open): Open with READ_CONTROL only in case of query_open flag set to query_read_control. Add case for new query_read_attributes flag. (fhandler_base::fstatvfs): New method. * fhandler.h (enum query_state): Add query_read_attributes flag. (class fhandler_base): Declare new virtual fstatvfs method. (class fhandler_socket): Ditto. (class fhandler_pipe): Ditto. (class fhandler_fifo): Ditto. (class fhandler_disk_file): Ditto. (class fhandler_virtual): Ditto. * fhandler_disk_file.cc (fhandler_base::fstat_fs): Open with query_read_attributes instead of query_read_control. (fhandler_disk_file::fstatvfs): New method. (fhandler_disk_file::facl): Open with query_read_attributes instead of query_read_control. * fhandler_fifo.cc (fhandler_fifo::fstatvfs): New method. * fhandler_socket.cc (fhandler_socket::fstatvfs): New method. (fhandler_socket::fchmod): Return with EBADF in the default case. (fhandler_socket::fchown): Ditto. (fhandler_socket::facl): Ditto. * fhandler_virtual.cc (fhandler_virtual::fstatvfs): Ditto. * ntdll.h (struct _FILE_FS_ATTRIBUTE_INFORMATION): Define. (struct _FILE_FS_FULL_SIZE_INFORMATION): Define. * pipe.cc (fhandler_pipe::fstatvfs): New method. * syscalls.cc (fstatvfs): Just call the fhandler's fstatvfs. (statvfs): Ditto. (fstatfs): Call fstatvfs. (statfs): Drop EFAULT handling. 2007-02-26 Corinna Vinschen * fhandler.cc (fhandler_base::fstat): Set all file times to arbitrary fixed value. 2007-02-26 Corinna Vinschen * fhandler_registry.cc (registry_listing): Drop name of HKEY_DYN_DATA. (registry_keys): Drop HKEY_DYN_DATA. * net.cc: Fix comment. * syslog.cc: Ditto. 2007-02-26 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Drop comment. * mmap.cc (gen_access): Remove. (mmap_record::gen_access): Remove. (mmap64): Don't mention 9x any longer. * syscalls.cc (statvfs): Drop status code consideration for 9x. * libc/minires-os-if.c (get_registry_dns_items): Don't mention 9x any longer. (get_registry_dns): Drop getting registry key on 9x. Drop is9x variable. 2007-02-23 Corinna Vinschen Throughout remove all usage of wincap.has_security. * environ.cc (environ_init): Drop setting allow_ntsec here. * grp.cc (initgroups32): Drop usage of label "out". * security.cc (allow_ntsec): Set to true by default. * syscalls.cc (seteuid32): Remove label success_9x. * wincap.cc: Remove has_security throughout. * wincap.h: Ditto. 2007-02-23 Corinna Vinschen * fhandler.h (class fhandler_pipe): Remove members writepipe_exists, orig_pid and id. Make hit_eof inline. * fhandler_fifo.cc (fhandler_fifo::open): Drop handling of writepipe_exists, orig_pid and id. * pipe.cc: Ditto throughout. (pipecount): Remove. (pipeid_fmt): Remove. (fhandler_pipe::hit_eof): Simplify. Move to fhandler.h. (fhandler_pipe::dup): Drop leave label. (fhandler_pipe::create): Drop has_unreliable_pipes case. * wincap.cc: Remove has_unreliable_pipes throughout. * wincap.h: Ditto. 2007-02-23 Corinna Vinschen * devices.in: Change native device name to native NT device name for /dev/null, /dev/comX and /dev/ttySx. * devices.cc: Regenerate. * fhandler.cc (fhandler_base::open_9x): Remove. (fhandler_base::open): Don't test for DOS device name, don't call open_9x. (fhandler_dev_null::open): Remove. * fhandler.h (class fhandler_base): Drop open_9x declaration. (class fhandler_dev_null): Drop open declaration. 2007-02-23 Corinna Vinschen * fhandler_console.cc (fhandler_console::need_invisible): Drop pty_needs_alloc_console check. * spawn.cc (spawn_guts): Ditto. (av::fixup): Remove setting iscui. * syscalls.cc (rename): Drop has_move_file_ex checks. Remove 9x specific code. * wincap.cc: Remove has_move_file_ex and pty_needs_alloc_console throughout. * wincap.h: Ditto. 2007-02-23 Corinna Vinschen * exceptions.cc (dummy_ctrl_c_handler): Remove. (init_console_handler): Drop has_null_console_handler_routine checks. * fhandler_raw.cc (fhandler_dev_raw::open): Drop has_raw_devices check. * fhandler_serial.cc (fhandler_serial::open): Drop .supports_reading_modem_output_lines check. * miscfuncs.cc (low_priority_sleep): Drop has_switch_to_thread check. * shared.cc (open_shared): Drop needs_memory_protection checks. * spawn.cc (spawn_guts): Drop start_proc_suspended check. * uname.cc (uname): Drop has_valid_processorlevel check. * wincap.cc: Remove has_raw_devices, has_valid_processorlevel, supports_reading_modem_output_lines, needs_memory_protection, has_switch_to_thread, start_proc_suspended and has_null_console_handler_routine throughout. * wincap.h: Ditto. 2007-02-23 Corinna Vinschen * fhandler.cc (fhandler_base::lseek): Drop 9x considerations. * fhandler_disk_file.cc (fhandler_disk_file::lock): Ditto. * wincap.cc: Remove lock_file_highword and has_64bit_file_access throughout. * wincap.h: Ditto. 2007-02-22 Corinna Vinschen * cygheap.h (struct cwdstuff): Remove sync member and keep_in_sync accessors. * external.cc (cygwin_internal): Drop call to cygheap->cwd.keep_in_sync. * fhandler_disk_file.cc (fhandler_disk_file::link): Always presume ability to create hard links. * path.cc (cwdstuff::init): Drop 9x considerations. (cwdstuff::keep_in_sync): Remove. (cwdstuff::set): Take NT for granted. * pinfo.h (cygwin_pid): Just return pid. * wincap.cc: Remove has_hard_links, can_open_directories, has_negative_pids, has_named_pipes, has_try_enter_critical_section, cant_debug_dll_entry and detect_win16_exe throughout. * wincap.h: Ditto. 2007-02-22 Corinna Vinschen * fhandler_console.cc (fhandler_console::read): Drop 9x specific handling of AltGr key. * mmap.cc: Take NT for granted throughout. * wincap.cc: Remove map_view_of_file_ex_sucks, altgr_is_ctrl_alt, has_working_copy_on_write, share_mmaps_only_by_name, virtual_protect_works_on_shared_pages, has_mmap_alignment_bug and has_working_virtual_lock throughout. * wincap.h: Ditto. 2007-02-22 Corinna Vinschen * fhandler.cc (fhandler_base::set_no_inheritance): Always use SetHandleInformation. * fhandler_disk_file.cc (fhandler_disk_file::lock): Always use UnlockFileEx/LockFileEx functions. * net.cc (fdsock): Don't bother to duplicate socket for inheritance. * sysconf.cc (get_nproc_values): Take NT for granted. (get_avphys): Ditto. * syslog.cc (WIN95_EVENT_LOG_PATH): Remove define. (get_win95_event_log_path): Remove. (vsyslog): Fix formatting. Take NT for granted. * wincap.cc: Remove has_lock_file_ex, has_signal_object_and_wait, has_eventlog, has_set_handle_information, has_set_handle_information_on_console_handles and supports_smp throughout. * wincap.h: Ditto. 2007-02-22 Corinna Vinschen * dir.cc (rmdir): Move existance check in front of has_dot_last_component check. Simplify setting errno in latter case. 2007-02-22 Corinna Vinschen * fhandler.cc (fhandler_base::write): Remove wincap.has_lseek_bug case. Simplify seek beyond EOF case. * times.cc (times): Remove wincap.has_get_process_times case. * wincap.cc: Remove has_delete_on_close, has_page_guard, has_get_process_times and has_lseek_bug throughout. * wincap.h: Ditto. 2007-02-22 Corinna Vinschen Throughout remove all usage of wincap.access_denied_on_delete. * dir.cc (rmdir): Add existance check to be errno-compatible with Linux. * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Drop test for non-existent dir on 9x share. * syscalls.cc (unlink): Add comment. * wincap.cc: Remove access_denied_on_delete flag throughout. * wincap.h: Ditto. 2007-02-22 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::closedir): Fix bug introduced by switching to NtClose. 2007-02-22 Christopher Faylor * dcrt0.cc (child_info_fork::alloc_stack_hard_way): Change sense of guard test. Increase size of stack reserved and increase size before the current stack pointer. Use pointers when doing arithmetic. (dll_crt0_1): Initialize exception handler when we notice we're the child of a fork from non-main thread. * fork.cc (frok::parent): Make argument volatile. (frok::child): Ditto. (lock_signals): New class. (lock_pthread): Ditto. (hold_everhthing): Ditto. (frok::parent): Move atforkprepare and atforkparent to lock_pthread class. (fork): Make ischild boolean. Use hold_everything variable within limited scope to set various mutexes in such a way as to avoid deadlocks. * thread.h (pthread_mutex::tid): New variable, active when debugging for tracking thread id of owner. (pthread_mutex::set_owner): Set tid when debugging. * thread.cc (pthread_mutex::pthread_mutex): Clear tid. (pthread_mutex::_unlock): Ditto when unlocking. (pthread_mutex::fixup_after_fork): Set tid to special value after forking since owner is unknown. 2007-02-22 Corinna Vinschen Throughout replace all usage of wincap.shared with the constant FILE_SHARE_VALID_FLAGS. * fhandler.cc (fhandler_base::open_9x): Drop local variable shared. * wincap.cc: Remove shared member throughout. * wincap.h: Ditto. 2007-02-22 Corinna Vinschen * Makefile.in (DLL_IMPORTS): Add libntdll.a. * autoload.cc: Remove all symbols from advapi32.dll, kernel32.dll and ntdll.dll available on all platforms since NT4. Throughout remove all usage of wincap.is_winnt. * dcrt0.cc (dll_crt0_0): Remove call to mmap_init. * fhandler.h (class fhandler_base): Remove has_changed flag. (fhandler_disk_file::touch_ctime): Remove declaration. (fhandler_disk_file::readdir_9x): Ditto. (fhandler_disk_file::touch_ctime): Remove. (fhandler_disk_file::readdir_9x): Remove. (fhandler_disk_file::closedir): Call NtClose instead of CloseHandle. * mmap.cc: Throughout call CreateMapping and MapView directly. (VirtualProt9x): Remove. (VirtualProtNT): Remove. (VirtualProtEx9x): Remove. (VirtualProtExNT): Remove. (VirtualProtect): Remove define. (VirtualProtectEx): Remove define. (CreateMapping9x): Remove. (CreateMappingNT): Rename to CreateMapping. (MapView9x): Remove. (MapViewNT): Rename to MapView. (struct mmap_func_t): Remove definition. (mmap_funcs_9x): Remove. (mmap_funcs_nt): Remove. (mmap_func): Remove. (mmap_init): Remove. * net.cc (getdomainname): Drop comment. Use NT4 registry key only. (get_95_ifconf): Remove. * pinfo.cc (winpids::enumNT): Rename to winpids::enum_processes. (winpids::enum9x): Remove. (winpids::set): Just call enum_processes directly. (winpids::enum_init): Ditto. * pinfo.h (class winpids): Drop enum_processes pointer. Rename enumNT to enum_processes. Drop enum9x declaration. Drop initialization of enum_processes throughout. * registry.cc (get_registry_hive_path): Just create NT key. (load_registry_hive): Only load NT specific file. * syscalls.cc (unlink_9x): Remove. (unlink): Just call unlink_nt. * wincap.cc: Remove is_winnt flag throughout. * wincap.h: Ditto. * winsup.h: Remove mmap_init declaration. 2007-02-21 Corinna Vinschen * wincap.cc (wincap_unknown): Change settings for unknown to reflect the capabilities of NT4. (wincap_95): Remove. (wincap_95osr2): Remove. (wincap_98): Remove. (wincap_98se): Remove. (wincap_me): Remove. (wincap_nt3): Remove. (wincapc::init): Temporarily bail out on any 9x system. 2007-02-20 Corinna Vinschen * cygwin.din (sem_unlink): Export. * posix_ipc.cc: Include thread.h and semaphore.h. Remove TODO comment. (ipc_names): Add max_len member. Set to maximum length of the path before tacking on the prefix path. Set prefix path for named semaphors to /dev/shm, as on Linux. (enum ipc_type_t): Change sem to semaphore to avoid name conflicts. (check_path): Detect empty paths. Use ipc_names's max_len member. Use __small_sprintf to create full object path name. Special case semaphores. (ipc_cond_init): Drop superfluous strcpy. (class ipc_flock): New class to simplify file locking in subsequent code. (struct mq_hdr): Raise size of mqh_uname to allow adding a unique LUID to the name. (mq_open): Fix formatting. Create unique synchronization object names using AllocateLocallyUniqueId. (struct sem_finfo): New structure defining named semaphore file content. (sem_open): Move here. Rework implementation to allow kernel persistent implementation of POSIX named semaphores. (_sem_close): Implement sem_close. (sem_close): Move here. Just call _sem_close with do_close parameter set to true. (sem_unlink): New function. * pthread.cc (mangle_sem_name): Remove. (sem_open): Move to posix_ipc.cc. (sem_close): Ditto. * syscalls.cc (close_all_files): Call semaphore::terminate here. * thread.cc: Fix formatting. Rearrange semaphore functions so that they are close together. (semaphore::semaphore): Rework to play nicely with new named semaphore implementation. (semaphore::_terminate): Call _sem_close if semaphore is a named semaphore. (semaphore::destroy): Don't destroy named semaphores. Return EINVAL instead. (semaphore::close): Only destroy named semaphores. Return EINVAL otherwise. (semaphore::open): Rework to play nicely with new named semaphore implementation. Loop through existing semaphores to be able to return same sem_t pointer as a former call on the same named semaphore. (semaphore::getinternal): New function called from _sem_close. * thread.h (class List): Make mx and head public. (class semaphore): Fix formatting. Align method declarations with implementation in thread.cc. Add members used for named semaphores. (semaphore::terminate): New static method. * include/semaphore.h: Redefine SEM_FAILED. Fix formatting. (sem_unlink): Add declaration. * include/cygwin/version.h: Bump API minor number. 2007-02-20 Christopher Faylor * exceptions.cc (_cygtls::signal_exit): Only call myself.exit when when exit_state indicates that we've visited do_exit. * sync.h (lock_process::lock_process): Use renamed exit_state - ES_PROCESS_LOCKED. * winsup.h: Rename ES_MUTO_SET to ES_PROCESS_LOCKED. 2007-02-20 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::bind): Remove printing wrong errno in debug output. 2007-02-19 Christopher Faylor Remove extraneous whitespace. * pinfo.cc (commune_process): Use default argument to lock_process. * sigproc.cc: Update copyright. * select.cc: Ditto. 2007-02-15 Corinna Vinschen * posix_ipc.cc (mq_open): Avoid compiler warning. Initialize mqhdr before using it in file exists case. * include/mqueue.h (mqd_t): Make non-pointer type. 2007-02-15 Corinna Vinschen * posix_ipc.cc (ipc_mutex_init): Create global object name. (ipc_cond_init): Ditto. (struct mq_hdr): Add mqh_uname member to store synchronization object name. (mq_open): Create unique synchronization object name and store in mq_hdr->mqh_uname. Use this name in calls to ipc_mutex_init and ipc_cond_init. 2007-02-14 Corinna Vinschen * Makefile.in (DLL_OFILES): Add posix_ipc.o. * cygwin.din (mq_close): Export. (mq_getattr): Export. (mq_notify): Export. (mq_open): Export. (mq_receive): Export. (mq_send): Export. (mq_setattr): Export. (mq_timedreceive): Export. (mq_timedsend): Export. (mq_unlink): Export. * posix_ipc.cc: New file implementing the above functions. Move shm_open and shm_unlink from syscalls.cc here. * sysconf.cc (sca): Set value of _SC_MQ_OPEN_MAX to MQ_OPEN_MAX, _SC_MQ_PRIO_MAX to MQ_PRIO_MAX, _SC_MESSAGE_PASSING to _POSIX_MESSAGE_PASSING. * include/limits.h (MQ_OPEN_MAX): Define. (MQ_PRIO_MAX): Define. * include/mqueue.h: New file. * include/cygwin/version.h: Bump API minor number. 2007-02-13 Corinna Vinschen * include/cygwin/stdlib.h (valloc): Declare. (memalign): Declare. 2007-02-09 Pierre A. Humblet * libc/minires-os-if.c (write_record): Handle DNS_TYPE_SRV and some obsolete types. 2007-02-08 Corinna Vinschen * syscalls.cc (check_shm): New static function to do path checking common to shm_open and shm_unlink. Check for /dev/shm existance. (shm_open): Call check_shm. (shm_unlink): Ditto. 2007-02-08 Corinna Vinschen * cygwin.din (shm_open): Export. (shm_unlink): Export. * syscalls.cc (shm_open): New function. (shm_unlink): New function. * sysconf.cc (sca): Set value of _SC_SHARED_MEMORY_OBJECTS to _POSIX_SHARED_MEMORY_OBJECTS. * include/cygwin/version.h: Bump API minor number. * include/sys/mman.h (shm_open): Add prototype. (shm_unlink): Ditto. 2007-02-08 Christopher Faylor Corinna Vinschen * cygmalloc.h (__set_ENOMEM): Declare. (MALLOC_FAILURE_ACTION): Call __set_ENOMEM. * malloc_wrapper.cc (malloc) Remove setting errno here. (realloc): Ditto. (calloc): Ditto. (memalign): Ditto. (valloc): Ditto. (posix_memalign): Save and restore errno. 2007-02-07 Corinna Vinschen * cygmalloc.h (MALLOC_FAILURE_ACTION): Move to correct #if branch. 2007-02-07 Corinna Vinschen * cygmalloc.h (MALLOC_FAILURE_ACTION): Define empty. * cygwin.din (posix_madvise): Export. (posix_memalign): Export. * fhandler.cc (fhandler_base::fpathconf): Return useful values in _PC_VDISABLE, _PC_SYNC_IO and _PC_SYMLINK_MAX cases. * malloc_wrapper.cc (malloc): Set errno here since it's not set in dlmalloc.c anymore. (realloc): Ditto. (calloc): Ditto. (memalign): Ditto. (valloc): Ditto. (posix_memalign): New function. * mmap.cc (posix_madvise): New function. * sysconf.cc (get_open_max): New function. (get_page_size): Ditto. (get_nproc_values): Ditto. (get_avphys): Ditto. (sc_type): New type. (sca): New array to map _SC_xxx options to sysconf return values. (sysconf): Reimplement using sca array. * include/limits.h: Add all missing values as defined by SUSv3. * include/pthread.h (PTHREAD_DESTRUCTOR_ITERATIONS): Move definition to sys/limits.h. (PTHREAD_KEYS_MAX): Ditto. * include/semaphore.h (SEM_VALUE_MAX): Ditto. * include/cygwin/stdlib.h (posix_memalign): Declare. * include/cygwin/version.h: Bump API minor number. * include/sys/mman.h: Add posix_madvise flags. (posix_madvise): Declare. * include/sys/termios.h (_POSIX_VDISABLE): Move definition to sys/limits.h. 2007-02-05 Corinna Vinschen * fhandler_serial.cc (fhandler_serial::tcsetattr): Add support for baud rates up to 3000000 baud. Add missing 128K and 256K cases. (fhandler_serial::tcgetattr): Ditto. * include/sys/termios.h: Add baud rate definitions from B460800 up to B3000000. 2007-02-02 Corinna Vinschen * syscalls.cc (unlink_nt): Add missing assignment in case NtClose fails. 2007-02-01 Corinna Vinschen * net.cc (ga_dup): New function, taken from ga_clone with v4-in-v6 mapping addition. (ga_clone): Just call ga_dup from here. (ga_duplist): New function to duplicate list of struct addrinfo. (ga_echeck): Don't check ai_flags, it already happened in cygwin_getaddrinfo. (cygwin_freeaddrinfo): Always call ipv4_freeaddrinfo. (cygwin_getaddrinfo): Use new wincap.supports_all_posix_ai_flags flag rather than wincap.has_gaa_on_link_prefix. Always duplicate WinSock's addrinfo list to a self-allocated list. Handle AI_V4MAPPED for pre-Vista platforms supporting getaddrinfo. * wincap.h (wincapc::supports_all_posix_ai_flags): New element. * wincap.cc: Implement above element throughout. * include/netdb.h: Note how AI_ADDRCONFIG is not supported pre-Vista. Remove superfluous comment. 2007-02-01 Corinna Vinschen * include/cygwin/socket.h: Add IPv6 socket options. 2007-01-31 Corinna Vinschen * net.cc (cygwin_getaddrinfo): Fix thinko in AI_ADDRCONFIG handling. 2007-01-31 Corinna Vinschen * net.cc (cygwin_getaddrinfo): Check ai_flags for valid values. Handle AI_NUMERICSERV. Handle AI_ADDRCONFIG behaviour on Vista. * include/netdb.h (AI_NUMERICSERV): Add missing flag. 2007-01-30 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::closedir): Add dir name to debug output. * syscalls.cc (try_to_bin): Enable code to move file to user specific recycler dir to eliminate Vista problem. (unlink_nt): Add comment that rename after opening for delete on close only fails on XP. 2007-01-30 Corinna Vinschen * sigproc.cc (child_info::child_info): Set msv_count to non-zero value only on systems requiring it. 2007-01-28 Corinna Vinschen * include/ftw.h: Include sys/cdefs.h. 2007-01-26 Corinna Vinschen * fhandler_disk_file.cc (fhandler_disk_file::rmdir): Implement rmdir on NT by calling unlink_nt. Check for directory here. * syscalls.cc (try_to_bin): Fix buggy debug_printf statement. (unlink_nt): Make non-static. Don't use delete-on-close semantics on directories. Explain why. 2007-01-24 Corinna Vinschen * net.cc (if_nametoindex): This time, really free IP_ADAPTER_ADDRESSES memory. (if_indextoname): Ditto. 2007-01-24 Corinna Vinschen * security.h (pop_thread_privilege): Revert to previous state, not to token used for impersonation. 2007-01-24 Corinna Vinschen * cygheap.h (cygheap_user::deimpersonate): Always RevertToSelf. 2007-01-23 Corinna Vinschen * net.cc (gai_errmap): Add EAI_OVERFLOW entry. Fix formatting. (cygwin_gai_strerror): Drop using EAI_MAX. (w32_to_gai_err): Ditto. * include/netdb.h: Define EAI_OVERFLOW. Remove EAI_MAX. 2007-01-23 Corinna Vinschen * include/netdb.h: Add AI_xxx flags available since Vista. 2007-01-23 Corinna Vinschen * net.cc (if_nametoindex): Free IP_ADAPTER_ADDRESSES memory. (if_indextoname): Ditto. (if_nameindex): Ditto. Remove duplicate indexed entries in result. 2007-01-21 Corinna Vinschen * autoload.cc (WSAIoctl): Define. (SendARP): Define. * cygwin.din: Export if_freenameindex, if_indextoname, if_nameindex and if_nametoindex. * fhandler_procnet.cc: Drop including wchar.h. Drop definitions of GAA_FLAG_INCLUDE_ALL_INTERFACES, IP_ADAPTER_UNICAST_ADDRESS_VISTA. (fhandler_procnet::exists): Check for has_gaa_prefixes. Call get_adapters_addresses here. (fhandler_procnet::readdir): Ditto. (prefix): Move to net.cc. (fhandler_procnet::fill_filebuf): Call get_adapters_addresses here. Simplify allocation. Use AdapterName rather than FriendlyName as interface name. Use IfIndex if available, Ipv6IfIndex otherwise. (in6_are_prefix_equal): Move to net.cc. * fhandler_socket.cc: Define old SIOCGxxx values. (CONV_OLD_TO_NEW_SIO): Convert old SIOCGxxx value to new one. (struct __old_ifreq): Define old struct ifreq. (fhandler_socket::ioctl): Handle old SIOCGxxx values. Handle new SIOCGIFFRNDLYNAM command. Simplify copying ifreq data to user space. Call get_ifconf with additional SOCKET parameter. * net.cc (IP_ADAPTER_UNICAST_ADDRESS_LH): Define. (IP_ADAPTER_ADDRESSES_LH): Define. (SIO_GET_INTERFACE_LIST): Define. (sockaddr_in6_old): Define. (sockaddr_gen): Define. (INTERFACE_INFO): Define. (IN_LOOPBACK): Define. (in_are_prefix_equal): New static function. (ip_addr_prefix): New function, replaces prefix function, add AF_INET handling. (GAA_FLAG_INCLUDE_ALL_INTERFACES): Define. (get_adapters_addresses): New function. (WS_IFF_xxx): Define Winsock interface flag values. (convert_ifr_flags): New function to convert Winsock interface flag values to Cygwin interface flag values. (get_xp_ifconf): New get_ifconf implementation for XP SP1 and above. (get_2k_ifconf): Fix interface index. Fix formatting. (get_nt_ifconf): Fix formatting. (get_95_ifconf): Ditto. (get_ifconf): Take additional SOCKET parameter. Call get_xp_ifconf on XP SP1 and above. (if_nametoindex): New function. (if_indextoname): New function. (if_nameindex): New function. (if_freenameindex): New function. (in6_are_prefix_equal): Moved here from fhandler_procnet.cc. * wincap.cc (wincap_xp): Define has_gaa_prefixes as true by default. (wincapc::init): Assume has_osversioninfoex by default. Call GetVersionEx with OSVERSIONINFOEX first. Call with OSVERSIONINFO only if that fails. Simplify NT4 case and try to avoid strcmp. Check XP Service Pack using version.wServicePackMajor to avoid strcmp. * include/asm/socket.h (SIOCGIFFRNDLYNAM): Define. * include/cygwin/if.h: Fix formatting. (IFF_POINTTOPOINT): Define. (IFF_NOARP): Define. (IFF_LOWER_UP): Define. (IFF_DORMANT): Define. (struct if_nameindex): Define. (IFRF_FRIENDLYNAMESIZ): Define. (struct ifreq_frndlyname): Define. (IFNAMSIZ): Redefine as 44. (IF_NAMESIZE): Define. (struct ifreq): Redefine ifru_flags as int. Define ifru_data. Pad size to sizeof sockaddr_in6 for further extensions. (ifr_data): Define. (ifr_frndlyname): Define. (if_nametoindex): Declare. (if_indextoname): Declare. (if_nameindex): Declare. (if_freenameindex): Declare. * include/cygwin/version.h: Bump API minor number. (CYGWIN_VERSION_CHECK_FOR_OLD_IFREQ): Define check for old vs. new ifreq structure. 2007-01-18 Corinna Vinschen * spawn.cc (spawn_guts): Don't set cwd for non-Cygwin child processes on NT to allow starting them in virtual directories. 2007-01-18 Corinna Vinschen * mmap.cc (list::hash): Fix type to __ino64_t. (list::get_hash): Ditto. (list::set): Add struct stat parameter. Use that instead of calling fstat. (map::get_list_by_fd): Ditto. (map::add_list): Ditto. (mmap_is_attached_or_noreserve): Call get_list_by_fd appropriately. (mmap_worker): Add pameters for map list and file stat information. Propagate to called functions. (mmap64): Use fstat on files early. Replace call to GetFileSize. Call get_list_by_fd and mmap_worker appropriately. 2007-01-18 Corinna Vinschen * fhandler_procnet.cc: Drop declaration of htonl and ntohs. Include asm/byteorder.h instead. 2007-01-18 Corinna Vinschen * include/cygwin/in6.h: Drop inclusion of asm/byteorder.h. * fhandler_procnet.cc: Declare htonl and ntohs here. 2007-01-17 Corinna Vinschen * Makefile.in (DLL_OFILES): Add fhandler_procnet.o. * autoload.cc (GetAdaptersAddresses): Define. * devices.h (FH_PROCNET): Define new device. * devices.in (dev_procnet_storage): Add "/proc/net" entry. * devices.cc: Regenerate. * dir.cc (readdir_worker): Use isproc_dev macro. * dtable.cc (build_fh_pc): Add FH_PROCNET. * fhandler.h (class fhandler_procnet): New class. * fhandler_proc.cc: Add "net" subdirectory handling. * fhandler_procnet.cc: New file handling "/proc/net" directory. * path.cc (isvirtual_dev): Move to path.h. * path.h (isproc_dev): New macro to identify /proc files by device. (isvirtual_dev): Moved here. Define using isproc_dev. * syscalls.cc (unlink): Use isproc_dev macro. * wincap.h (wincapc::has_gaa_prefixes): New element. (wincapc::has_gaa_on_link_prefix): New element. * wincap.cc: Implement above elements throughout. (wincapc::init): Check XP for service pack and set has_gaa_prefixes appropriately. * include/cygwin/in6.h: Include asm/byteorder.h. 2007-01-17 Corinna Vinschen * include/asm/socket.h (SIOGIFINDEX): Define. 2007-01-17 Corinna Vinschen * mmap.cc (MapView9x): Note possible uselessness of retrying. (MapViewNT): Ditto. (mmap64): Fix pre-reservation to work for non NULL, non MAP_FIXED. 2007-01-16 Corinna Vinschen * autoload.cc (RtlAnsiStringToUnicodeString): Define. (RtlOemStringToUnicodeString): Define. * ntdll.h (struct _RTL_USER_PROCESS_PARAMETERS): Define. (struct _PEB): Redefine with a bit of content. (RtlAnsiStringToUnicodeString): Declare. (RtlOemStringToUnicodeString): Declare. * path.cc: Include ntdll.h. (_upp): New global variable pointing to user process parameter block. (get_user_proc_parms): New static function to retrieve user process parameter block. (close_user_proc_parms_cwd_handle): New function to close handle to current working directory in user process parameter block. (cwdstuff::init): Drop redundant declaration of dynamically_loaded. Set current dir only on 9x. Call close_user_proc_parms_cwd_handle on NT instead. (cwdstuff::keep_in_sync): Only on 9x. (cwdstuff::set): Keep behaviour on 9x. On NT write cwd path into user process parameter block and set cwd handle to NULL. Fix comments to reflect new behaviour. 2007-01-16 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::ioctl): Handle SIOCGIFINDEX. * net.cc (get_2k_ifconf): Ditto. (get_nt_ifconf): Fake SIOCGIFINDEX. (get_95_ifconf): Ditto. (get_ifconf): Handle SIOCGIFINDEX. Fake it for loopback on systems not supporting IP Helper Lib. * include/asm/socket.h (SIOCGIFINDEX): Define. * include/cygwin/if.h (struct ifreq): Add member for interface index. (ifr_ifindex): Define. 2007-01-16 Corinna Vinschen * include/cygwin/in6.h (struct ipv6_mreq): Change type of interface member to uint32_t. (struct in6_pktinfo): Ditto. 2007-01-16 Corinna Vinschen * include/cygwin/in.h (struct ip_mreq_source): Define. (struct ip_msfilter): Define. (IP_MSFILTER_SIZE): Define. (struct in_pktinfo): Define. (struct group_req): Define. (struct group_source_req): Define. (struct group_filter): Define. (GROUP_FILTER_SIZE): Define. (INADDR_ALLRTRS_GROUP): Define. * include/cygwin/socket.h: Define protocol agnostic multicast options. 2007-01-15 Corinna Vinschen * CYGWIN_LICENSE: Fix web pages and contact information. 2007-01-15 Corinna Vinschen * ntdll.h: Adjust status definitions. 2007-01-15 Corinna Vinschen * cygheap.cc (cygheap_init): Add TODO comment. 2007-01-15 Corinna Vinschen * ntdll.h (STATUS_SHARING_VIOLATION): Define. 2007-01-13 Corinna Vinschen * syscalls.cc (unlink_nt): Don't move files to recycle bin which are not in use. 2007-01-13 Christopher Faylor * glob.cc: Update copyright notice with latest from FreeBSD. (glob0): Use correct type for c variable to propagate previously detected protection. 2007-01-12 Corinna Vinschen * cygheap.cc (_csbrk): Fix off-by-one error. * cygwin.sc: Give .cygheap a minimum size of 512K. 2007-01-12 Christopher Faylor * external.cc (sync_winenv): Use cur_environ () rather than __cygwin_environ. 2007-01-12 Corinna Vinschen * fork.cc (child_copy): Add missing Windows PID in debug output. 2007-01-12 Corinna Vinschen * syscalls.cc: Update copyright. 2007-01-10 Corinna Vinschen * mmap.cc (mmap64): Pre-Reserve space for the whole mapping to get a useful, valid address before the actual mappings take place. Fix typo in comment. 2007-01-10 Corinna Vinschen * syscalls.cc (sync): Use b_drive for B: drive (Thanks to Howard Chu). 2007-01-09 Corinna Vinschen * syscalls.cc (getpagesize): Change condition for clarity. (getsystempagesize): Ditto. 2007-01-09 Corinna Vinschen * mmap.cc: Do bookkeeping in 4K pages, rather than in 64K chunks. 2007-01-07 Corinna Vinschen * security.h (setacl): Add parameter for writability flag. * sec_acl.cc (setacl): Ditto. Set to true if any ACE with write permissions is created. * fhandler_disk_file.cc (fhandler_disk_file::facl): Reset FILE_ATTRIBUTE_READONLY if ACL contains an ACE with write permissions. 2007-01-05 Corinna Vinschen * include/strings.h: Don't include string.h. Only declare functions according to SUSv3. 2007-01-04 Corinna Vinschen (get_ifconf): Set MTU for loopback to more correct value. 2007-01-04 Corinna Vinschen * fhandler_socket.cc (fhandler_socket::ioctl): Don't fake results for SIOCGIFFLAGS here. Call get_ifconf instead. * net.cc (get_2k_ifconf): Clean up code to generate interface name. Handle SIOCGIFFLAGS here. (get_nt_ifconf): Fake SIOCGIFFLAGS here. (get_95_ifconf): Ditto. (get_ifconf): Don't fake loopback on systems with IP Helper Lib. Set MTU for loopback to a more "modern" value. 2007-01-04 Brian Ford Corinna Vinschen * fhandler.h (PREFERRED_IO_BLKSIZE): Define as 64K. * fhandler.cc (fhandler_base::fstat): Set st_blksize to PREFERRED_IO_BLKSIZE. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Ditto. * fhandler_mailslot.cc (fhandler_mailslot::fstat): Ditto. * fhandler_raw.cc (fhandler_dev_raw::fstat): Ditto. 2007-01-01 Christopher Faylor * spawn.cc (spawn_guts): Don't expect synchronization from a non-cygwin _P_NOWAIT process.