aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/fhandler.h
AgeCommit message (Collapse)AuthorFilesLines
2004-02-09* debug.h (console_printf): Define for non-debugging condition.Christopher Faylor1-1/+1
* cygtls.h (_threadinfo::lock): Remove wait argument. (_threadinfo::interrupt_setup): Remove retaddr argument. * exceptions.cc (_threadinfo::interrupt_setup): Ditto. (_threadinfo::interrupt_now): Accommodate change to interrupt_setup argument. (setup_handler): Ditto. Always lock sig stack prior to determining interrupt method. * gendef (_sigfe): Correct thinko regarding cmpxchg. (_sigbe): Ditto. (_threadinfo::lock): Ditto. (_threadinfo::pop): Eliminate left-over stack unlock. * sigproc.cc (proc_subproc): Chnage debugging output to printed warning.
2004-02-02* fhandler.h (*::fixup_after_exec): Eliminate unused handle argument.Christopher Faylor1-9/+9
* fhandler.h (dtable::fixup_after_exec): Eliminate unused handle argument. * dcrt0.cc (dll_crt0_1): Reflect elimination of unused handle argument to fixup_after_exec. * dtable.cc (dtable::fixup_after_exec): Ditto. * fhandler_console.cc (fhandler_console::fixup_after_exec): Ditto. * fhandler_dsp.cc (fhandler_dsp::fixup_after_exec): Ditto. * fhandler_raw.cc (fhandler_raw::fixup_after_exec): Ditto. * fhandler_socket.cc (fhandler_socket::fixup_after_exec): Ditto. * fhandler_virtual.cc (fhandler_virtual::fixup_after_exec): Ditto. * pipe.cc (fhandler_pipe::fixup_after_exec): Ditto. * spawn.cc (spawn_guts): Do not set ciresrv.parent. * child_info.h (child_info_spawn::~child_info_spawn): Do not close parent. Update CURR_CHILD_INFO_MAGIC. * dcrt0.cc (dll_crt0_0): Do not close spawn_info->parent. Pass NULL to cygheap->fdtab.fixup_after_exec().
2004-02-02Throughout, change name from set_inheritance to set_no_inheritance to betterChristopher Faylor1-1/+1
reflect input arguments of this function. * cygheap.h (CYGHEAPSIZE): Increase size of cygheap to something closer to the 21st century.
2004-01-24* fhandler.h (fhandler_base::fhaccess): Return int for compatibility withChristopher Faylor1-1/+1
access. * fhandler.cc (fhandler_base::fhaccess): Return int. Use consistent variable name for exit value. Exit at bottom, printing debugging information, like other cygwin functions.
2004-01-24* cygheap.cc (init_cygheap::close_ctty): Protect YA vforkism.Christopher Faylor1-7/+6
* fhandler.h (fhandler_base::has_acls): Make pass through for path_conv method. (fhandler_base::isremote): Ditto. (fhandler_base::is_fs_special): Ditto. (fhandler_base::has_attribute): Ditto. Define new function. (fhandler_base::fhaccess): Declare new function based on access_worker. (fhandler_base::set_has_acls): Eliminate obsolete function. (fhandler_base::set_isremote): Ditto. * fhandler.cc (fhandler_base::fhaccess): Move from syscalls.cc and into fhandler_base class. Use fhandler methods to access data rather than path_conv stuff. (fhandler_base::device_access_denied): Use fhaccess method. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Ditto. (fhandler_base::open_fs): Remove calls to obsolete functions. * fhandler_virtual.cc (fhandler_virtual::open): Ditto. * winsup.h (access_worker): Remove obsolete access_worker declaration. *syscalls.cc (access_worker): Move function to fhandler.cc. (access): Use fhaccess method. * pinfo.cc (_pinfo::set_ctty): Clarify debugging output. * sigproc.cc (sig_dispatch_pending): Ditto. * syscalls.cc (setsid): Perform minor rearrangement.
2003-12-30Move open_fhs from fhandler.h to cygheap.h for easier tracking. AccommodateChristopher Faylor1-3/+1
this change throughout. * dtable.cc (dtable::add_archetype): Use correct count when iterating through *active* archetypes. * dtable.cc (dtable::fixup_after_exec): Close handle if close_on_exec and archetype exists since archetype currently does not set windows close-on-exec flag (FIXME). * fhandler_tty.cc (fhandler_tty_slave::open): Change debugging output slightly. (fhandler_tty_slave::close): Ditto. (fhandler_tty_slave::fixup_after_fork): Just report on inherited use counts since since archetype currently does not set windows close-on-exec flag (FIXME). * pinfo.cc (_pinfo::set_ctty): Change debugging output slightly. * cygheap.cc (cygheap_init): Remove open_fhs accommodation and use count reporting. * perthread.h (vfork_save::fhctty): New element. * perthread.h (vfork_save::open_fhs): New element. * fork.cc (vfork): Muck around with ctty and open_fhs stuff, both of which are now saved in the vfork_save structure.
2003-12-27* fhandler.h (fhandler_tty_slave::archetype): Make public.Christopher Faylor1-1/+7
(report_tty_counts): New macro. Use throughout for reporting tty use counts. * dtable.cc (dtable::vfork_child_dup): Add debugging output for usecount increment. Increment open_fhs if appropriate. (dtable::vfork_parent_restore): "Close" artificially bumped ctty. (dtable::vfork_child_fixup): Close ctty since it was bumped prior to vfork. Save open_fhs around close since the closing of these handles has no effect on the console. * fhandler_tty.cc (fhandler_tty_slave::open): Reorganize calls to allow for easier tracking of usecount modification. (fhandler_tty_slave::open): Ditto.
2003-12-27* fhandler.h (fhandler_tty_master::fixup_after_fork): Remove declaration.Christopher Faylor1-3/+1
(fhandler_tty_master::fixup_after_exec): Ditto. * fhandler_tty.cc (fhandler_tty_master::init): Fix so that children do not inherit master tty handles. (fhandler_tty_master::fixup_after_fork): Remove, since it was never used. (fhandler_tty_master::fixup_after_exec): Ditto. * pinfo.cc (_pinfo::set_ctty): Increment open_fhs when ctty is set. * cygheap.cc (cygheap_init): Ditto. * syscalls.cc (setsid): *Always* call close on opened ctty since the archetype is associated with the ctty and it counts as an opened handle. * tty.cc (tty::common_init): Don't protect input/output mutex since it confuses subsequent fork/execs when CYGWIN=tty.
2003-12-16* exceptions.cc (set_signal_mask): Report on input argument rather thanChristopher Faylor1-0/+1
getsigmask. * fhandler.h (fhandler_base): Make friends with close_all_files. * pinfo.cc (_pinfo::set_ctty): Add more debugging. * sigproc.cc (proc_can_be_signalled): Detect state when signal handler thread is gone in target process as an EPERM situation. Set errno to ESRCH if process doesn't exist. (sigproc_terminate): Set sendsig to illegal value when closed. (sig_send): Rely on proc_can_be_signalled setting the proper errno. * syscalls.cc (close_all_files): Detect when all ttys are closed prior to calling close_all_files. The ctty needs to be closed explicitly in this case.
2003-12-11* cygheap.h (cygheap_types): Add HEAP_ARCHETYPES.Christopher Faylor1-1/+5
(init_cheap::ctty): Change to pointer. * dtable.h (dtable::find_archetype): Declare new function. (dtable::add_archetype): Declare new function. (dtable::delete_archetype): Declare new function. (dtable::narchetypes): Declare. (dtable::farchetypes): Declare. (dtable::initial_archetype_size): Declare. (dtable::dtable): Initialize new fields. (dtable::initial_archetype_size): Declare. * dtable.cc (dtable::find_archetype): Define new function. (dtable::add_archetype): Define new function. (dtable::delete_archetype): Define new function. (dtable::initial_archetype_size): Define. * fhandler.h (fhandler_base::archetype): Declare. (fhandler_base::usecount): Declare. * fhandler.cc (fhandler_base::fhandler_base): Initialize new fields. * fhandler_console.cc (fhandler_console::get_tty_stuff): Pass NULL to third argument of set_ctty. * fhandler_tty.cc (fhandler_tty_slave::open): Accommodate new archetype method to create only one instance of a tty. (fhandler_tty_slave::close): Don't close handles unless archetype usecount is zero. When that happens, close archetype too. (fhandler_tty_slave::dup): Just copy archetype. Set use count appropriately. Set ctty, if appropriate. (fhandler_tty_common::dup): Remove slave considerations. (fhandler_tty_common::set_close_on_exec): Remove cygheap->ctty considerations. * pinfo.cc (_pinfo::set_ctty): Accommodate new archetype methods. * pinfo.h (_pinfo::set_ctty): Make third argument explicit. * syscalls.cc (close_all_files): Decrement controlling tty use count before closing all handles to allow controlling tty to be closed. Remove previous controlling tty considerations.
2003-12-10* fhandler_tty.cc (fhandler_tty_common::dup): Just copy cygheap->ctty to childChristopher Faylor1-1/+1
if duping the current ctty. (fhandler_tty_common::close): Move debugging statement earlier in function. (fhandler_tty_slave::close): Return success when closing ctty. * syscalls.cc (close_all_files): Avoid calling fhandler_tty_slave close method so that open_fhs will not be decremented when closing cygheap ctty. (setsid): Ditto. * dcrt0.cc (do_exit): Reorganize to avoid leaving a critical section active after vfork. * fhandler.h (fhandler_tty_slave::get_unit): Remove regparm parameter since it can't work in a virtualized function.
2003-12-08* fhandler.h (fhandler_tty_slave::ttyname): Use name from pc since it isChristopher Faylor1-0/+1
guaranteed to be accurate. * fhandler_tty.cc (fhandler_tty_slave::open): Increment open_fhs appropriate when copying ctty. (fhandler_tty_slave::close): Remove special case handling for exit_state. Use ctty < 0 check instead. (fhandler_tty_common::close): Set io_handle to NULL after closing. * syscalls.cc (close_all_files): Specifically close cygheap->ctty, if appropriate.
2003-12-07Change use of BOOL, TRUE, FALSE to bool, true, false, as appropriate,Christopher Faylor1-13/+13
throughout. * tty.cc (tty::common_init): Remove call to SetKernelObjectSecurity and edit some comments. * cygheap.h (init_cygheap::ctty): Add new element. * devices.in (device::parse): Remove special handling for /dev/tty. * devices.cc: Regenerate. * dtable.cc (build_fh_pc): Don't reset /dev/tty device. Let the device opener do that. * fhandler_termios.cc (tty_min::set_ctty): Redefine to _pinfo class. * fhandler_tty.cc (fhandler_tty_common::set_close_on_exec): Avoid setting noninherit flag for ctty. * tty.h: Move BOOLs to bools. (tty_min::set_ctty): Redeclare to _pinfo class. * pinfo.cc (_pinfo::set_ctty): Define new function based on tty_min::set_ctty. Change first argument from tty number to tty_min class. * pinfo.h (_pinfo::set_ctty): Declare. * fhandler_console.cc (fhandler_console::get_tty_stuff): Reflect move of set_ctty to _pinfo class. * fhandler_tty.cc (fhandler_tty_slave::open): Treat FH_TTY specially. Use saved cygheap value if it exists. Otherwise convert to real device and save on first time open. (fhandler_tty_common::dup): Potentially set controlling tty if duping a slave tty. * syscalls.cc (setsid): Close controlling tty in cygheap. * tty.cc: Change some BOOLs to bools.
2003-12-03 Substitute 0x7fffffff and 0xffffffff by INT32_MAX and UINT32_MAXCorinna Vinschen1-1/+1
throughout, except in assembler code.
2003-12-01 * Makefile.in (OBSOLETE_FUNCTIONS): Add fcntl.Corinna Vinschen1-2/+2
(NEW_FUNCTIONS): Add fcntl64. * cygwin.din: Export fcntl64. Make fcntl being SIGFE. * fcntl.cc (fcntl_worker): New function. (fcntl64): New function. (_fcntl): Call fcntl_worker. Convert 32 bit flock structure into 64 bit flock structure and vice versa. * fhandler.cc (fhandler_base::lock): Change 2nd parameter to struct __flock64 *. * fhandler_disk_file.cc (fhandler_disk_file::lock): Ditto. Rework to be 64 bit aware. * fhandler.h: Accomodate above method argument changes. * include/cygwin/types.h: Add struct __flock32 and __flock64. Define struct flock according to setting of __CYGWIN_USE_BIG_TYPES__. * include/cygwin/version.h: Bump API minor number.
2003-11-25* dtable.cc (build_fh_name): Set error in dummy fhandler when one is notedChristopher Faylor1-0/+1
during path_conv. * fhandler.h (fhandler_base::set_error): New method.
2003-10-16 * dcrt0.cc: Remove local variable alternate_charset_active.Corinna Vinschen1-0/+5
* fhandler.h: Add variable alternate_charset_active, functions str_to_con, con_to_str to dev_console structure. * fhandler_console.cc (con_to_str): Move function into dev_console class. (str_to_con): Ditto. (fhandler_console::read): Call con_to_str on dev_state. (fhandler_console::write_normal): Call str_to_con on dev_state. (fhandler_console::char_command): Change active_charset_active assignment to be on dev_state. * winsup.h: Remove global external variable alternate_charset_active.
2003-10-01* Makefile.in: Add YA method for generating devices.cc.Christopher Faylor1-1/+1
* child_info.h: YA update of another magic number. * gendevices: New file. * devices.in: New file. * devices.cc: Regenerate. * devices.shilka: Remove. * devices.h: Correctly define device pointers. (device): Remove now obsolete fields. (device::native): Renamed from device::fmt. * dtable.cc (build_fh_dev): Simplify in light of new unit parsing scheme. (build_fh_pc): Ditto. * path.cc (win32_device_name): Ditto. * fhandler.h (fhandler_base::get_native_name): Reflect renaming of fmt to native. * fhandler_tty.cc (fhandler_tty_mster::init): Initialize slave device prior to reporting unit.
2003-09-30 * fhandler.h (class fhandler_dev_raw): Add method fstat.Corinna Vinschen1-0/+2
* fhandler_raw.cc (fhandler_dev_raw::fstat): New method. Add missing ChangeLog for previous patch.
2003-09-27* cygwin-shilka: Remove '#line directives' or suffer debugging oddities. UseChristopher Faylor1-1/+1
-length option so that device prefixes are used. * devices.cc: Regenerate. * syscalls.cc (ttyname): Add debugging output.
2003-09-25* devices.cc: New file.Christopher Faylor1-154/+154
* devices.gperf: New file. * devices.shilka: New file. * cygwin-gperf: New file. * cygwin-shilka: New file. * fhandler_fifo.cc: New file. * fhandler_nodevice.cc : New file. Reorganize headers so that path.h precedes fhandler.h throughout. Remove device argument and unit arguments from fhandler constructors throughout. Remove pc arguments to fhandler functions and use internal pc element instead, throughout. Use dev element in pc throughout. Use major/minor elements rather than units and device numbers previously in fhandler class. Use correct methods for fhandler file names rather than directly accessing file name variables, throughout. * Makefile.in (DLL_OFILES): Add devices.o, fhandler_fifo.o * dcrt0.cc (dll_crt0_1): Call device::init. * devices.h: Renumber devices based on more Linux-like major/minor numbers. Add more devices. Declare standard device storage. (device): Declare struct. * dir.cc (opendir): Use new 'build_fh_name' to construct a fhandler_* type. * dtable.cc (dtable::get_debugger_info): Ditto. (cygwin_attach_handle_to_fd): Ditto. (dtable::release): Remove special FH_SOCKET case in favor of generic "need_fixup_before" test. (dtable::init_std_file_from_handle): Use either build_fh_dev or build_fh_name to build standard fhandler. (dtable::build_fh_name): Renamed from dtable::build_fhandler_from_name. Move out of dtable class. Don't accept a path_conv argument. Just build it here and pass it to: (build_fh_pc): Renamed from dtable::build_fhandler. Move out of dtable class. Use intrinsic device type in path_conv to create new fhandler. (build_fh_dev): Renamed from dtable::build_fhandler. Move out of dtable class. Simplify arguments to just take new 'device' type and a name. Just return pointer to fhandler rather than trying to insert into dtable. (dtable::dup_worker): Accommodate above build_fh name changes. (dtable::find_fifo): New (currently broken) function. (handle_to_fn): Use strechr for efficiency. * dtable.h: Reflect above build_fh name changes and argument differences. (fhandler_base *&operator []): Return self rather than copy of self. * fhandler.cc (fhandler_base::operator =): Use pc element to set normalized path. (fhandler_base::set_name): Ditto. (fhandler_base::raw_read): Use method to access name. (fhandler_base::write): Correctly use get_output_handle rather than get_handle. (handler_base::device_access_denied): New function. (fhandler_base::open): Eliminate pc argument and use pc element of fhandler_base throughout. (fhandler_base::fstat): Detect if device is based in filesystem and use fstat_fs to calculate stat, if so. (fhandler_base::fhandler_base): Eliminate handling of file names and, instead, just free appropriate component from pc. (fhandler_base::opendir): Remove path_conv parameter. * fhandler.h: Remove all device flags. (fhandler_base::pc): New element. (fhandler_base::set_name): Change argument to path_conv. (fhandler_base::error): New function. (fhandler_base::exists): New function. (fhandler_base::pc_binmode): New function. (fhandler_base::dev): New function. (fhandler_base::open_fs): New function. (fhandler_base::fstat_fs): New function. (fhandler_base::fstat_by_name): New function. (fhandler_base::fstat_by_handle): New function. (fhandler_base::isfifo): New function. (fhandler_base::is_slow): New function. (fhandler_base::is_auto_device): New function. (fhandler_base::is_fs_special): New function. (fhandler_base::device_access_denied): New function. (fhandler_base::operator DWORD&): New operator. (fhandler_base::get_name): Return normalized path from pc. (fhandler_base::get_win32_name): Return windows path from pc. (fhandler_base::isdevice): Renamed from is_device. (fhandler_base::get_native_name): Return device format. (fhandler_fifo): New class. (fhandler_nodevice): New class. (select_stuff::device_specific): Remove array. (select_stuff::device_specific_pipe): New class element. (select_stuff::device_specific_socket): New class element. (select_stuff::device_specific_serial): New class element. (select_stuff::select_stuff): Initialize new elements. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Move to base class from fhandler_disk_file. (fhandler_base::fstat_by_name): Ditto. (fhandler_base::fstat_by_name): Ditto. (fhandler_disk_file::open): Move most functionality into fhandler_base::open_fs. (fhandler_base::open_fs): New function. (fhandler_disk_file::close): Move most functionality into fhandler_base::close_fs. (fhandler_base::close_fs): New function. * fhandler_mem.cc (fhandler_dev_mem::open): Use device name in debugging output. * fhandler_socket.cc (fhandler_socket::set_connect_secret): Copy standard urandom device into appropriate place. (fhandler_socket::accept): Reflect change in fdsock return value. * fhandler_tty.cc: See "throughouts" above. * net.cc: Accommodate fdsock change throughout. (fdsock): Return success or failure, accept fd argument and device argument. * path.cc (symlink_info::major): New element. (symlink_info::minor): New element. (symlink_info::parse_device): Declare new function. (fs_info::update): Accommodate changes in path_conv class. (path_conv::fillin): Ditto. (path_conv::return_and_clear_normalized_path): Eliminate. (path_conv::set_normalized_path): New function. (path_conv::path_conv): Set info in dev element. Use path_conv methods Check for FH_FS rather than FH_BAD to indicate when to fill in filesystem stuff. where appropriate rather than direct access. Use set_normalized_path to set normalized path. (windows_device_names): Eliminate. (get_dev): Ditto. (get_raw_device_number): Ditto. (get_device_number): Ditto. (win32_device_name): Call new device name parser to do most of the heavy lifting. (mount_info::conv_to_win32_path): Fill in dev field as appropriate. (symlink_worker): Handle new device files. (symlink_info::check): Ditto. (symlink_info::parse_device): Define new function. * path.h (executable_states): Move here from fhandler.h. (fs_info): Rename variables to *_storage and create methods for accessing same. (path_conv): Add dev element, remove devn and unit and adjust inline methods to accommodate. (set_normalized_path): Declare new function. * pinfo.cc (_pinfo::commune_recv): Add broken support for handling fifos. (_pinfo::commune_send): Ditto. * pipe.cc (fhandler_pipe::close): check for existence of handle before closing it. (handler_pipe::create): Rename from make_pipe. Change arguments to accept fhandler_pipe array. Accommodate fifos. (pipe): Rework to deal with fhandler_pipe::create changes. (_pipe): Ditto. * select.cc: Use individual device_specific types throughout rather than indexing with obsolete device number. (set_bits): Use is_socket call rather than checking device number. * shared_info.h (CURR_MOUNT_MAGIC): Update. (conv_to_win32_path): Reflect addition of device argument. * syscalls.cc (mknod_worker): New function. (open): Use build_fh_name to build fhandler. (chown_worker): Detect if this is an 'auto' device rather than an on-filesystem device and handle appropriately. (chmod_device): New function. (chmod): Detect if this is an 'auto' device rather than an on-filesystem device and handle appropriately. Use chmod_device to set mode of in-filesystem devices. (stat_worker): Eliminate path_conv argument. Call build_fh_name to construct fhandler. Use fh->error() rather than pc->error to detect errors in fhandler construction. (access_worker): New function pulled from access. Accommodate in-filesystem devices. (access): Use access_worker. (fpathconf): Detect if this is an 'auto' device rather than an on-filesystem device and handle appropriately. (mknod_worker): New function. (mknod32): New function. (chroot): Free normalized path -- assuming it was actually cmalloced. * tty.cc (create_tty_master): Tweak for new device class. (tty::common_init): Ditto. * winsup.h (stat_worker): Remove. (symlink_worker): Declare. * exceptions.cc (set_process_mask): Just call sig_dispatch_pending and don't worry about pending_signals since sig_dispatch_pending should always do the right thing now. (sig_handle): Reorganize SIGCONT handling to more closely conform to SUSv3. * pinfo.h: Move __SIG enum to sigproc.h. (PICOM_FIFO): New enum element. (_pinfo): Remove 'thread2signal' stuff throughout class. (_pinfo::commune_send): Make varargs. (_pinfo::sigtodo): Eliminate. (_pinfo::thread2signal): Ditto. * signal.cc (kill_worker): Eliminate call to setthread2signal. * sigproc.cc (local_sigtodo): Eliminate. (getlocal_sigtodo): Ditto. (sigelem): New class. (pending_signals): New class. (sigqueue): New variable, start of sigqueue linked list. (sigcatch_nonmain): Eliminate. (sigcatch_main): Eliminate. (sigcatch_nosync): Eliminate. (sigcomplete_nonmain): Eliminate. (pending_signals): Eliminate. (sig_clear): Call signal thread to clear pending signals, unless already in signal thread. (sigpending): Call signal thread to get pending signals. (sig_dispatch_pending): Eliminate use of pending_signals and just check sigqueue. (sigproc_terminate): Eliminate all of the obsolete semaphore stuff. Close signal pipe handle. (sig_send): Eliminate all of the obsolete semaphore stuff and use pipe to send signals. (getevent): Eliminate. (pending_signals::add): New function. (pending_signals::del): New function. (pending_signals::next): New function. (wait_sig): Eliminate all of the obsolete semaphore stuff. Use pipe to communicate and maintain a linked list of signals. * sigproc.h: Move __SIG defines here. Add __SIGPENDING. (sig_dispatch_pending): Remove "C" specifier. (sig_handle): Accept a mask argument. * thread.cc: Remove signal handling considerations throughout.
2003-07-09* cygheap.cc (creturn): Set appropriate errno when out of memory.Christopher Faylor1-1/+1
(ccalloc): Only issue system_printf when debugging. * dtable.cc (dtable::extend): Only allocate 100 * the incremental growth size max. Set errno appropriately. (dtable::build_fhandler): Check for error from set_name. * fhandler.cc (fhandler_base::set_name): Set errno and return error on OOM. * fhandler.h (fhandler_base::set_name): Change to bool. * fhandler_process.cc (format_process_stat): Fix formatting. * resource.cc (getrlimit): Return greater of OPEN_MAX or fd table size. * sysconf.cc (sysconf): Ditto.
2003-07-05 * fhandler.h (fhandler_socket::get_connect_state): New method toCorinna Vinschen1-0/+1
return socket connection state. * fhandler_socket.cc (dup): Copy socket connect state to new file handle. * net.cc (cygwin_rcmd): Mark file handles of sockets returned by rcmd() as CONNECTED state. (cygwin_rexec): Similarly for rexec(). (socketpair): Mark both ends of a new socket pair as CONNECTED.
2003-07-04* fhandler.h (FH_ENC): New enum.Christopher Faylor1-2/+4
(fhandler_base::get_encoded): New function. (fhandler_base::set_encoded): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Set encoded flag in fhandler, as appropriate. (fhandler_disk_file::readdir): Unmunge filename as appropriate based on new encoding flag. * path.cc (normalize_posix_path): Don't punt on files with colons. (special_char): New function. (mount_item::fnmunge): Ditto. (fnunmunge): Ditto. (special_name): Ditto. (mount_item::build_win32): Avoid drive considerations when file is encoded. (mount_info::conv_to_win32_path): Handle encoded filenames. (mount_info::conv_to_posix_path): Ditto. (fillout_mntent): Add posix string when directory is encoded. * path.h (fnunmunge): Declare. (path_conv::is_encoded): Declare.
2003-05-26 * fhandler.h: Rename FH_W95LSBUG flag to FH_LSEEKED.Corinna Vinschen1-4/+10
(fhandler_base::set_did_lseek): Rename from set_check_win95_lseek_bug. (fhandler_base::get_did_lseek): Rename from get_check_win95_lseek_bug. (fhandler_base::set_fs_flags): New method. (fhandler_base::get_fs_flags): Ditto. * fhandler.cc (fhandler_base::write): Make 64 bit clean. Convert file to a "sparse" file when writing after a long lseek (>64K) beyond EOF. (fhandler_base::lseek): Call set_did_lseek() instead of set_check_win95_lseek_bug(). (fhandler_base::fhandler_base): Initialize fs_flags to 0. * fhandler_disk_file.cc (fhandler_disk_file::open): Don't create files as "sparse" unconditionally. Set fs_flags member.
2003-05-12 * Makefile.in (CYGWIN_START): Define as crt0.o. Add to TARGET_LIBS.Corinna Vinschen1-1/+0
* fhandler.h (fhandler_virtual::fstat): Remove useless declaration. * fhandler_virtual.cc: Remove _COMPILING_NEWLIB define. * ipc.cc (ftok): Use stat64. * syscalls.cc (_fstat64): Remove alias. (_fstat): Ditto. (_stat): Ditto. (_fstat64_r): New function. (_fstat_r): Ditto. (_stat64_r): Ditto. (stat_r): Ditto. * crt0.o: New file, moved from newlib. * include/sys/param.h: Ditto. * include/sys/utime.h: Ditto. * include/sys/utmp.h: Ditto. * include/sys/dirent.h: Ditto. Expose different struct dirent, dependening of the environment.
2003-05-11 Replace ino_t by __ino64_t throughout.Corinna Vinschen1-2/+2
2003-05-11* dir.cc (readdir): Fill out new old_d_ino field.Christopher Faylor1-2/+2
* fhandler.h (fhandler_base::namehash): Define as ino_t. (fhandler_base::get_namehash): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Accommodate new 64 bit st_ino. * fhandler_socket.cc (fhandler_socket::fstat): Ditto. * path.cc (hash_path_name): Return ino_t. * syscalls.cc (stat64_to_stat32): Convert 64 bit inode to 32 bit. * winsup.h (hash_path_name): Declare as returning ino_t. * include/cygwin/stat.h (__stat32): Use 32 bit st_ino. (__stat64): Use 64 bit st_ino. * include/cygwin/types.h (__ino64_t): Define. (__ino32_t): Ditto. (ino_t): Define appropriately.
2003-04-01 * dir.cc: Change __off32_t to _off_t and __off64_t to _off64_tCorinna Vinschen1-33/+33
throughout. * fhandler.cc: Ditto. * fhandler.h: Ditto. * fhandler_clipboard.cc: Ditto. * fhandler_disk_file.cc: Ditto. * fhandler_dsp.cc: Ditto. * fhandler_floppy.cc: Ditto. * fhandler_mem.cc: Ditto. * fhandler_proc.cc: Ditto. * fhandler_process.cc: Ditto. * fhandler_random.cc: Ditto. * fhandler_registry.cc: Ditto. * fhandler_tape.cc: Ditto. * fhandler_termios.cc: Ditto. * fhandler_virtual.cc: Ditto. * fhandler_zero.cc: Ditto. * mmap.cc: Ditto. * pipe.cc: Ditto. * syscalls.cc: Ditto. * winsup.h: Ditto. * include/cygwin/stat.h: Ditto. * include/cygwin/types.h: Ditto. Remove definition of __off32_t and __off64_t.
2003-03-08 * external.cc (cygwin_internal): Change n to __off64_t to match changeCorinna Vinschen1-1/+2
of _pinfo::cmdline. * fhandler.h (class fhandler_virtual): Change filesize member to __off64_t. * fhandler_proc.cc (format_proc_meminfo): Change to return __off64_t. (format_proc_stat): Ditto. (format_proc_uptime): Ditto. * fhandler_process.cc (format_process_stat): Ditto. (format_process_status): Ditto. (format_process_statm): Ditto. * pinfo.cc (_pinfo::cmdline): Expect __off64_t parameter. * pinfo.h (class _pinfo): Change declaration of cmdline accordingly.
2003-03-04* fhandler.h (fhandler_tty_slave::close): Declare new function.Christopher Faylor1-0/+3
(fhandler_tty_slave::dup): Declare new function. (fhandler_tty_slave::fixup_after_function): Declare new function. * fhandler_tty.cc (fhandler_tty_slave_open): Only increment fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::close): Define new function. Decrement fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::dup): Define new function. Increment fhandler_console::open_fhs when associated with a pty. (fhandler_tty_slave::fixup_after_fork): Define new function. Increment fhandler_console::open_fhs when associated with a pty.
2003-03-02* dll_init.cc (dll_list::load_after_fork): Don't revert to LoadLibrary ifChristopher Faylor1-0/+1
LoadLibraryEx fails. * dtable.cc (dtable::dec_console_fds): Eliminate. (dtable::release): Don't treat console specially. (dtable::build_fhandler): Ditto. * dtable.h (console_fds): Eliminate. (dtable::dec_console_fds): Eliminate. (dtable::inc_console_fds): Eliminate. * fhandler.h (fhandler_console::open_fhs): New static element. * fhandler_console.cc (fhandler_console::open): Increment open_fs. (fhandler_console::close): Call FreeConsole if no more open consoles and ctty is not associated with the console. * syscalls.cc (setsid): Simplify check for when to call FreeConsole. (check_pty_fds): Eliminate definition. * winsup.h (check_pty_fds): Eliminate declaration.
2003-02-21 * dtable.cc (dtable::build_fhandler_from_name): Set some fhandlerCorinna Vinschen1-1/+3
data on sockets to evaluate AF_LOCAL sockets correctly. (dtable::build_fhandler): Set unit number on sockets. * fhandler.h (fhandler_socket): Add unit number. (fhandler_socket::get_unit): New method. * fhandler_socket.cc (fhandler_socket::fhandler_socket): Set unit number. (fhandler_socket::fstat): Reorganize to return more Linux-like values. * net.cc: include ctype.h. (fdsock): Set unit number when building fhandler. * path.cc (path_conv::check): Set device type to FH_SOCKET if file is a AF_UNIX socket. (get_devn): Evaluate unit for virtual socket devices. (win32_device_name): Set windows path for sockets to unix_path with just backslashes to keep the different names. * syscalls.cc (fstat64): Don't override st_ino, st_dev and st_rdev for sockets. (stat_worker): Ditto. From Pierre Humblet: * autoload.cc (AccessCheck): Add. (DuplicateToken): Add. * security.h (check_file_access): Declare. * syscalls.cc (access): Convert path to Windows, check existence and readonly attribute. Call check_file_access instead of acl_access. * security.cc (check_file_access): Create. * sec_acl (acl_access): Delete.
2003-01-10 Split ChangeLog, create ChangeLog-2002.Corinna Vinschen1-1/+1
Fix copyright dates.
2002-12-27* fhandler.h (fhandler_tty_master::set_winsize): Declare new function.Christopher Faylor1-0/+1
* fhandler_console.cc (fhandler_console::send_winch_maybe): If appropriate, call tty master function to handle screen size change. * fhandler_tty.cc (fhandler_tty_master::set_winsize): New function. (fhandler_tty_master::init): Call set_winsize to set initial screen size.
2002-12-27* fhandler.h (fhandler_termios::line_edit): Replace third argument withChristopher Faylor1-1/+1
passed-in termios struct. * fhandler_console.cc (fhandler_console::read): Prior to loop, make a copy of current termios for passing to line_edit prior so that all characters are processed consistently. * fhandler_tty.cc (fhandler_pty_master::write): Ditto. (process_input): Make a copy of curent termios prior to read for use in subsequent line_edit. * fhandler_termios.cc (fhandler_termios::line_edit): Replace third parameter with passed-in termios struct and use it throughout rather than the data from the current fhandler_termios class.
2002-12-21* fhandler.h (line_edit_status): Reorganize so that tests for error conditionChristopher Faylor1-3/+3
can be < or >. * fhandler_tty.cc (fhandler_pty_master::write): Don't return after sending a signal. * fhandler_termios.cc (fhandler_termios::line_edit): Trivial change to use built-in bool types.
2002-12-20* fhandler.h (line_edit_status): Add a new element.Christopher Faylor1-1/+2
* fhandler_termios.cc (fhandler_termios::line_edit): After accept_input, handle both potential error condition and pipe full conditions. * fhandler_tty.cc (fhandler_pty_master::accept_input): Return -1 on error. (fhandler_pty_master::write): Handle pipe full condition.
2002-12-14Throughout, change fhandler_*::read and fhandler_*::raw_read to void functionsChristopher Faylor1-15/+17
whose second arguments are both the lenght and the return value. * fhandler.cc (fhandler_base::read): Rework slightly to use second argument as input/output. Tweak CRLF stuff. (fhandler_base::readv): Accommodate fhandler_*::read changes. * cygthread.h (cygthread::detach): Declare as taking optional handle argument. (cygthread::detach): When given a handle argument, wait for the handle to be signalled before waiting for thread to detach. Return true when signal detected.
2002-12-11* cygthread.h (cygthread::stack_ptr): New element.Christopher Faylor1-1/+2
(cygthread::detach): Accept a "wait_for_signal" argument. (cygthread::terminate_thread): New function. * cygthread.cc (cygthread::stub): Set stack pointer argument. (cygthread::terminate_thread): New function. Forcibly terminate thread. (cygthread::detach): Optionally wait for signals and kill thread when signal arrives. * exceptions.cc (signal_exit): Set signal_arrived prior to exiting to wake up anything blocking on signals. * fhandler.h (fhandler_base::set_r_no_interrupt): Change to accept bool argument. (fhandler_pipe::ready_for_read): Declare. * pipe.cc (pipeargs): New structure. (read_pipe): New thread stub wrapper for normal pipe read. (fhandler_pipe::read): Modify to call reader in a cygthread, terminating on signal, as appropriate. * select.cc (fhandler_pipe::ready_for_read): Define new function.
2002-12-05* fhandler.h (fhandler_termios::line_edit): Change return from an int to anChristopher Faylor1-1/+9
enum to allow the function to return an error. * fhandler_console.cc (fhandler_console::read): Update the line_edit call to use the new enum. * fhandler_termios.cc (fhandler_termios::line_edit): Change return from an int to an enum to allow the function to return an error. Put put_readahead call before doecho for future patch. * fhandler_tty.cc (fhandler_pty_master::write): Change to call line_edit one character at a time, and stop if an error occurs.
2002-11-09* fhandler.h (class fhandler_pipe): New ioctl() method.Christopher Faylor1-0/+1
* pipe.cc (fhandler_pipe::ioctl): New.
2002-11-05* fhandler_serial.cc (fhandler_serial::raw_read): Use correct type forChristopher Faylor1-1/+1
minchars. (fhandler_serial::ioctl): Set errno if the ClearCommError fails. (fhandler_serial::tcsetattr): Use correct value for vmin_. (fhandler_serial::tcgetattr): Ditto.
2002-10-30* external.cc (cygwin_internal): Implement CW_CMDLINE.Christopher Faylor1-0/+1
* pinfo.h (SIGCOMMUNE): New signal type. (commune_result): New structure for commune functions. (picom): New enum for commune functions. (_pinfo::hello_pid): New. Pid who's communicating with me. (_pinfo::tothem): New. Handle of communicating pipe. (_pinfo::fromthem): Ditto. (_pinfo::commune_recv): Declare. (_pinfo::commune_send): Declare. (_pinfo::alive): Declare. (_pinfo::cmdline): Declare. (_pinfo::lock): Declare. * pinfo.cc (set_myself): Initialize new _pinfo lock. (_pinfo::alive): Define. Determines if process still exists. (_pinfo::commune_recv): Define. Receive info from another cooperating process. (_pinfo::commune_send): Define. Send info to another cooperating process. (_pinfo::cmdline): Define. Determine command line of a given process. * include/sys/cygwin.h (CW_CMDLINE): Define. *sigproc.cc (talktome): Communicate with any processes who want to talk to me. (wait_sig): Honor __SIGCOMMUNE. * fhandler.cc (fhandler_virtual::fixup_after_exec): Declare. * fhandler_proc.cc: Use malloc/free/realloc throughout rather than cmalloc since buffers don't need to be propagated to subprocesses. * fhandler_registry.cc: Ditto. * fhandler_virtual.cc: Ditto. (fhandler_virtual::fixup_after_exec): Define. * fhandler_process.cc: Ditto for malloc/free/realloc. (process_listin): Add "cmdline". (fhandler_process::fill_filebuf): Implement PROCESS_CMDLINE. * miscfuncs.cc (isalpha_array): New array populated with xor values for alpha characters to switch from one case to another. * string.h (cygwin_strcasematch): New asm implementation of case match. * string.h (cygwin_nstrcasematch): New asm implementation of counted case match.
2002-10-09* cygthread.cc (cygthread::stub): Don't create an event for "cygself" threads.Christopher Faylor1-2/+0
Assume that they exit via an ExitThread call. * cygthread.h (cygthread::SetThreadPriority): New function. (cygthread::zap_h): New function. * dcrt0.cc (do_exit): Move cygthread::terminate earlier and establish exit_state guard. * fhandler.h (fhandler_tty_master::output_thread): Delete. * fhandler_tty.cc (fhandler_tty_master::init): Set priority for threads via method. Zap handles when done. Don't treat process_output specially. (process_output): Call ExitThread directly. (fhandler_tty_master::fixup_after_fork): Don't worry about output_thread. (fhandler_tty_master::fixup_after_exec): Ditto. * sigproc.cc (proc_terminate): Don't detach from hwait_subproc. Just let it exit. (sigproc_init): Close thread handle after initialization. (wait_sig): Use GetCurrentThread() as SetThreadPriority call rather than *event* handle. Call ExitThread directly on termination. (wait_subproc): Call ExitThread directly on termination. * tty.cc (tty_list::terminate): Don't attempt t detach from output_thread.
2002-10-09* cygheap.cc (dup_now): Make fatal error a little more informative.Christopher Faylor1-25/+26
(cygheap_setup_for_child): Detect when default size of shared region is less than the current size and allocate that much. (_cbrk): Just return NULL on inability to allocate. (_cmalloc): Ditto. * cygheap.h (CYGHEAPSIZE): Change size to reflect newer, tinier fhandler sizes. * spawn.cc (av::error): New element, reflects potential errno from cmalloc. (av::~av): Don't free NULL pointers. (av::replace0_maybe): Detect out-of-memory conditions. (av::dup_maybe): Ditto. (av::dup_all): Ditto. (av::unshift): Ditto. (spawn_guts): Set errno and return if argv creation ran into problems. * fhandler.h (fhandler_union): Change member names to something safer. * fhandler_console.cc (fhandler_console::get_tty_stuff): Always set fhandler_console::dev_state regardless of whether shared region is initialized. * cygthread.cc (cygthread::runner): Use ExitThread rather than return (planning for future).
2002-10-08* fhandler.h (dev_console): New class.Christopher Faylor1-13/+20
(fhandler_console::dev_state): New class element. (fhandler_console::mouse_aware): Use dev_state element. (fhandler_console::get_tty_stuff): Declare new function. * fhandler_console.cc: Use dev_state fhandler_console element, throughout. (fhandler_console::get_tty_stuff): Move to fhandler_console class. Incorporate dev_console information. Move constructor stuff here.
2002-09-19* cygthread.cc (cygthread::initialized): Avoid copying on fork or some threadsChristopher Faylor1-1/+0
may not end up in the pool. (cygthread::new): Avoid race when checking for initialized. Add debugging code. * fhandler.cc (fhandler_base::raw_read): Add case for ERROR_INVALID_HANDLE due to Win95 directories. (fhandler_base::open): Handle errors due to Win95 directories. (fhandler_base::close): Add get_nohandle () test. (fhandler_base::set_close_on_exec): Ditto. (fhandler_base::fork_fixup): Ditto. (fhandler_base::lock): Change error code to Posix EINVAL. (fhandler_base::dup): If get_nohandle (), set new value to INVALID_HANDLE_VALUE instead of NULL. * fhandler_disk_file.cc (fhandler_disk_file::fstat): Call fstat_by_name if get_nohandle (). Remove extraneous element from strpbrk. (fhandler_disk_file::open): Remove test for Win95 directory. * fhandler_random.cc (fhandler_dev_random::open): Add set_nohandle (). * fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto. * fhandler_zero.cc (fhandler_dev_zero::open): Ditto. (fhandler_dev_zero::close): Delete. * fhandler.h (class fhandler_dev_zero): Ditto.
2002-09-04 * fhandler.h (fhandler_socket::read): Remove method.Corinna Vinschen1-4/+4
(fhandler_socket::write): Ditto. (fhandler_socket::readv): New method. (fhandler_socket::writev): Ditto. (fhandler_socket::recvmsg): Add new optional argument. (fhandler_socket::sendmsg): Ditto. * fhandler.cc (fhandler_socket::read): Remove method. (fhandler_socket::write): Ditto. (fhandler_socket::readv): New method. (fhandler_socket::writev): Ditto. (fhandler_socket::recvmsg): Use win32's scatter/gather IO where possible. (fhandler_socket::sendmsg): Ditto. * net.cc (cygwin_recvmsg): Check the msghdr's iovec fields. (cygwin_sendmsg): Ditto. Add omitted sigframe.
2002-08-31(inspired by a patch from Egor Duda)Christopher Faylor1-2/+0
* select.cc (fhandler_tty_slave::ready_for_read): Remove. * fhandler.h (fhandler_tty_slave::ready_for_read): Remove declaration. * fhandler_tty.cc (fhandler_tty_slave::read): Don't do anything special with vtime when vmin == 0. * autoload.cc (GetConsoleWindow): Correct parameter count.