2003-03-19 Christopher Faylor * dtable.cc (cygwin_attach_handle_to_fd): Eliminate unused variable. 2003-03-09 Christopher Faylor * Makefile.in: Explicitly call perl to run cygwin-gperf. * path.cc: Move some device stuff. * cygwin-gperf: Define some device stuff. * devices.h: Declare some device stuff. 2003-03-02 Christopher Faylor * Makefile.in (devicess.cc): Make generation dependent on cygwin-gperf. * cygheap.h (cygheap_fdmanip): Add fhandler_socket cast. * cygwin-gperf: Autogenerate references to network devices. * devices.h: Create separate device types for all network types. Export references to global network device storage. * dtable.cc (dtable::release): Use generic determination to control when need_fixup_before needs to be decremented. (dtable::init_std_file_from_handle): Replace use of 'socket_dev' with 'tcp_dev'. (build_fh_pc): Adapt to new socket types. Don't increment fixup_before here. * fhandler.h (fhandler_base::need_fixup_before): Declare/define. (fhandler_socket::need_fixup_before): Ditto. * fhandler_socket.cc (fhandler_socket::accept): Accommodate new fdsock definition. * net.cc: Throughout, change use of fdsock to return true/false for success/failure and take cygheap_fdmanip type and device * select.cc (set_bits): Use 'is_socket ()' test rather than specificially testing device type. 2003-02-24 Christopher Faylor * device.gperf: Remove nonsensical devices. * cygwin-gperf: Special case some devices. 2003-02-23 Christopher Faylor * cygwin-gperf: Fix typo in FH_FS static storage. * devices.gperf (device::parse): Default to fs "device" when nothing else is found. * fhandler.cc (fhandler_base::device_access_denied): Use access_worker rather than access to avoid reparsing pc. * fhandler_nodevice.cc (fhandler_nodevice::open): Set errno to ENXIO rather than ENODEV. * path.cc (path_conv::check): Default to FH_FS rather than FH_BAD. (mount_info::conv_to_win32_path): Ditto. (win32_device_name): Don't do device handling if FH_FS. * path.h (path_conv::get_devn): Just return raw device number. * syscalls.cc (access_worker): New function, split from access(). Correctly deal with special devices in light of recent ntsec changes. (access): Use access_worker. 2003-02-23 Christopher Faylor * fhandler.cc (fhandler_base::set_name): Explicitly set posix name. (fhandler_base::dup): Ditto. 2003-02-14 Christopher Faylor * path.h (path_conv::set_normalized_path): Declare. (path_conv::normalized_path_size): Declare. (path_conv::return_and_clear_normalized_path): Delete declaration. * path.cc (path_conv::set_normalized_path): Define. Puts normalized path in path buf if there is room. (path_conv::check): Call set_normalized_path. (path_conv::return_and_clear_normalized_path): Delete definition. * dtable.cc (build_fh_dev): Ditto. * fhandler.cc (fhandler_base::operator =): Ditto. (fhandler_base::~fhandler_base): Only free normalized_path when appropriate. 2003-02-13 Christopher Faylor Reorganize includes throughout so that path.h comes before fhandler.h. Eliminate path_conv arguments from fhandler functions which take them, throughout. Use get_name() and get_win32_name() consistently throughout for fhandler objects. Use build_fh_* functions throughout, where appropriate. * fhandler.h (fhandler_base): Store path_conv struct here. Remove dev. * dtable.h (dtable::build_fhandler_*): Remove. (build_fh_dev): New. (build_fh_pc): New. (build_fh_name): New. * dtable.cc (build_fh_dev): New. (build_fh_pc): New. (build_fh_name): New. * fhandler.h (fhandler_base::set_name): Change argument. * fhandler.cc (fhandler_base::set_name): Just accept a path_conv argument. (executable_states): Move. * path.h (executable_state): Accept. * syscalls.cc (stat_worker): Make static. * winsup.h (stat_worker): Remove definition. 2003-01-28 Corinna Vinschen * devices.gperf: Remove obsolete win32 device names. 2003-01-25 Christopher Faylor * Makefile.in (DLL_OFILES): Add fhandler_nodevice.o. * devices.gperf (device::parse): Just set devn to input if device not found -- nonexistent device will be caught later. * dtable.cc (dtable::build_fhandler): Build fhandler_nodevice type when unknown device. * fhandler.h (fhandler_nodevice): New class. (fhandler_union): Add fhandler_nodevice. * path.cc (path_conv::check): Always set device stuff if major/minor are specified. 2003-01-04 Christopher Faylor * pinfo.cc (_pinfo::commune_send): Use myself->lock rather than just lock when leaving. 2003-01-04 Christopher Faylor Replace is_fs_device with is_fs_special throughout. * Makefile.in (DLL_OFILES): Add fhandler_fifo.o. * devices.h (fh_devices): Renumber some minor numbers to fit in 8 bits. * dtable.cc (dtable::build_fhandler): Handle FH_FIFO. Set errno to ENODEV if device not found. * dtable::find_fifo: Define new function. * dtable.h (dtable::find_fifo): Declare new function. * fhandler.cc (fhandler_base::device_access_denied): Fix O_RDONLY test. (fhandler_base::write): Use output file handle for writing. (fhandler_base::fstat): Use is_fs_special rather than is_fs_device. * fhandler.h (fhandler_base::is_fs_special): Rename from is_fs_device. (fhandler_pipe): Make private elements protected so that fhandler_fifo can use them too. (fhandler_pipe::create): New function derived from make_pipe. (fhandler_fifo): Add more needed elements. (fhandler_pty_master::slave): Add to track slave device. (fhandler_pty_master::get_unit): Define. * fhandler_tty.cc (fhandler_tty_master::init): Register slave device. (fhandler_pty_master::open): Ditto. (symlink_info::parse_device): Handle fifo specially. * pinfo.cc (_pinfo::commune_recv): Initial fifo implementation. (_pinfo::commune_send): Ditto. * pinfo.h (picom): Add PICOM_FIFO. * pipe.cc (fhandler_pipe::close): Close input handle here specifically. (fhandler_pipe::create): Rename from make_pipe. Create fhandlers rather than fds. (pipe): Use fhandler_pipe::create to create pipe. (_pipe): Ditto. * syscalls.cc (mknod): Accommodate fifos. 2003-01-04 Christopher Faylor * fhandler_tty.cc (fhandler_tty_slave::get_unit): Fix test for tty unit number based on whether this is just a /dev/tty or a /dev/ttyN. 2003-01-02 Christopher Faylor * dtable.h (dtable::in_vfork_cleanup): New function. True if vfork cleanup needed. * dtable.cc (dtable::vfork_parent_restore): Remove assertion. * pipe.cc (fhandler_pipe::close): Don't close read_state during fork_fixup since it wasn't inherited. 2003-01-01 Christopher Faylor * devices.h (_devtype_t): Eliminate. (_mode_t): New typedef. (device::mode): Replace type. * fhandler.h (fhandler_base::device_access_denied): Declare new function. * fhandler.cc (fhandler_base::device_access_denied): Define new function. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Just copy mode directly from dev.mode to st_mode if it is a disk device. * path.cc (path_conv::check): Set device mode from sym mode. (symlink_worker): Let "exists" check happen when file is attempted to be opened, or not, in the case of creating a device. (symlink_info::parse_device): Change device type argument to device mode argument. (mknod_worker): New function. (chmod_device): Ditto. (chmod): Use chmod_device to set protection if it is an fs device. (mknod): Use mknod_worker to actually create the device. Don't take any special action with the protection since it is now implicit. 2003-01-01 Christopher Faylor * passwd.cc (getpwuid_r32): Revert previous change. 2003-01-01 Christopher Faylor * sysconf.cc (sysconf): Return arbitrary values for _SC_GETGR_R_SIZE_MAX, _SC_LOGIN_NAME_MAX, _SC_GETPW_R_SIZE_MAX. * passwd.cc (getpwuid_r32): Add uid/gid fields to size check calculation. * exceptions.cc (events_init): Display name of mutex on failure. * windows.cc (setitimer): Return ENOSYS on invalid argument. 2002-12-28 Christopher Faylor * cygwin-gperf: New file. * Makefile.in: Use cygwin-gperf script to build devices.cc. * configure.in: Remove some comments. * configure: Regenerate. * devices.gperf: Remove max unit determination from FH_TTY. Add /dev/kmem. Add /dev/fifo. Add /dev/rawdrive. Remove specific "const device *" declarations since they are now autogenerated. (device::parse): Treat FH_TTY specially. Move logic for determining real tty device to separate function. (device::init): Reduce to nothing. (device::parse): New function taking different arguments. (device::parse): Ditto. (device::tty_to_real_device): New function. * devices.h (struct device): Define above new functions. (device::dev_on_fs): New element. (device::setfs): New function. (device::isfs): Ditto. * dtable.cc (dtable::build_fhandler): Treat FH_TTY specially. * fhandler.cc (fhandler_base::set_name): Make special determination for non-disk-resident devices. * fhandler.h (fhandler_base::isdevice): Renamed from 'is_device'. (fhandler_disk_file::isdevice): Ditto. (fhandler_base::is_auto_device): New function. (fhandler_base::is_fs_device): New function. (fhandler_tty_slave::get_unit): Declare. (fhandler_disk_file::readdir): Take special .lnk consideration for devices as well as symlinks. * fhandler_tty.cc: Use get_unit () rather than dev.minor throughout. (fhandler_tty_slave::get_unit): Define new function. * path.cc (symlink_info::major): New element. (symlink_info::major): Ditto. (symlink_info::devtype): Ditto. (path_conv::check): Handle devices detected by symlink_info::check. (win32_device_name): Eliminate special FH_TTY handling. (symlink): Move bulk of procesing to symlink_worker. (symlink_worker): New function. Handles devices. (symlink_info::parse_device): Parse info from potential device file into symlink_info elements. (symlink_info::check): If contents of .lnk file begin with a ':' then treat the file as a device file. * path.h (isdevice): Renamed from is_device. (is_auto_device): New function. (is_fs_device): Ditto. * syscalls.cc (chown_worker): Allow setting of ownership for on-disk devices. (chmod): Ditto. (mknod): Implement. * winsup.h (symlink_worker): Declare. 2002-12-28 Christopher Faylor Eliminate device number argument from fhandler constructors throughout. 2002-12-28 Christopher Faylor Eliminate unit argument and special unit fields from fhandler classes and constructors throughout. * fhandler_mem.cc (fhandler_dev_mem::fhandler_dev_mem): Make decisions based on specific device type rather than unit number. * fhandler_random.cc (fhandler_dev_random::write): Ditto. (fhandler_dev_random::read): Ditto. * fhandler_socket.cc (fhandler_socket::set_connect_secret): Set device type to "urandom" after construction of entropy_source. * path.cc (windows_devices_names): Remove. 2002-12-27 Christopher Faylor * Makefile.in: Add devices.gperf. * devices.h: New file. * devices.gperf: Ditto. 2002-12-27 Christopher Faylor Introduce device class to cygwin throughout. Rename FH_DISK to FH_FS throughout. * dcrt0.cc (dll_crt0_1): Initialize device globals via device::init. * dtable.cc (dtable::init_std_file_from_handle): Use device numbers rather than names when they are known. Should speed up process startup slightly. (dtable::build_fhandler_from_name): Pass path_conv device to build_fhandler. (dtable::build_fhandler): Accept device argument rather than separate device/unit arguments. (dtable::build_fhandler): Ditto. Separate switch statement by devices which take units and those which don't. Build unix/win32 names from device if required. (dtable::dup_worker): Reflect changes to build_fhandler arguments. * dtable.h (dtable::build_fhandler): Ditto. * fhandler.cc (fhandler_base::set_name): Eliminate unit argument. Use get_unit to derive unit. * fhandler.h: Separate FH device defines into devices.h include. Define is_slow as appropriate for each fhandler_class. (fhandler_base::dev): New element. (fhandler_base::fhandler_base): Eliminate unit argument. (fhandler_base::get_device): Return device number. (fhandler_base::get_major): Return device major number. (fhandler_base::get_minor): Return device minor number. (fhandler_base::get_unit): Ditto. (fhandler_base::get_native_name): Return device format field. (fhandler_fifo): New class. (select_stuff::device_specific): Remove array. (select_stuff::device_specific_pipe): New class element. (select_stuff::device_specific_socket): New class element. (select_stuff::device_specific_serial): New class element. (select_stuff::select_stuff): Initialize new elements. * fhandler_disk_file.cc (fhandler_cygdrive::fhandler_cygdrive): Remove unit initialization. * fhandler_tty.cc (fhandler_tty_master::init_console): Use "console_dev" global to initialize captive console used by tty master. * mmap.cc (mmap_record::devtype_): Remove. (mmap_record::dev): New. (mmap_record::mmap_record): Use dev. (mmap_record::get_device): Implement via dev. * net.cc (fdsock): Use socket_dev global to initialize socket fhandler. * path.cc (path_conv::check): Accommodate new path_conv::dev element. (get_devn): Eliminate. (get_raw_device_number): Ditto. (get_device_number): Ditto. (win32_device_name): Accept dev argument. Use it. Use device::parse to derive potential device name. (mount_info::conv_to_win32_path): Accept dev argument. Use it. * path.h (path_conv::devn): Eliminate. (path_conv::unit): Ditto. (path_conv::dev): Declare. (path_conv::path_conv): Don't initialize deleted members. (path_conv::is_device): Implement via dev element. (path_conv::get_devn): Ditto. (path_conv::get_unitn): Ditto. * pipe.cc (make_pipe): Use pipe[rw]_dev in fhandler construction. * select.cc: Use new device_specific_* select class elements * shared_info.h (CURR_MOUNT_MAGIC): Update. (mount_info::conv_to_win32_path): Reflect new arguments. * syscalls.cc (fstat64): Just use get_device() without interpretation for st_dev element. (stat_worker): Ditto. * tty.cc (create_tty_master): Use ttym_dev in fhandler constructor. (tty::common_init): Check for tty major device number rather than FH_TTYM.