summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.h
Commit message (Collapse)AuthorAgeFilesLines
* * autoload.cc (LoadDLLinitfunc): Remove debugging statement.Christopher Faylor2001-01-171-2/+10
| | | | | | | | | | | | | | | | | | * exceptions.cc (sig_handle_tty_stop): Move setting of PID_STOPPED to earlier in interrupt. ((interrupt_setup): i.e., here. (sig_handle): Don't queue multiple SIGSTOPS. * fhandler.h (bg_check_types): Enumerate return value of bg_check for clarity. * signal.cc (kill_pgrp): Minor cleanup. * fhandler_termios.cc (fhandler_termios::bg_check): Use enumerated type for function return. Don't raise signal if a signal is already queued. * fhandler_console.cc (fhandler_console::read): Use enumerated return type for bg_check. * select.cc: Ditto, throughout. * read.cc: Ditto, throughout. * termios.cc: Ditto, throughout. (_read): YA interrupt detect simplification. * wait.cc (wait4): Ditto.
* * fhandler.h (fhandler_base): New method `fixup_mmap_after_fork'.Corinna Vinschen2001-01-111-0/+6
| | | | | | | | | | | | | | | | | (fhandler_disk_file: Ditto. (fhandler_dev_mem): Ditto. * fhandler_mem.cc (fhandler_dev_mem::open): Set OBJ_INHERIT attribute for device\physicalmemory handle. (fhandler_dev_mem::mmap): Ditto. * fhandler_mem.cc (fhandler_dev_mem::fixup_mmap_after_fork): New method. * mmap.cc (mmap_record): Add private `fdesc_' member. Change constructor accordingly. (get_fd): New method. (mmap): Use new mmap_record constructor. (fhandler_base::fixup_mmap_after_fork): New method. (fhandler_disk_file::fixup_mmap_after_fork): Ditto. (fixup_mmaps_after_fork): Call `fixup_mmap_after_fork' of appropriate fhandler class.
* * fhandler.h (fhandler_console): Add additional argument to char_commandChristopher Faylor2000-12-151-1/+1
| | | | | | | | method. * fhandler_console.cc (fhandler_console::read): Revert previously misapplied patch. (fhandler_console::char_command): Add a second argument. (fhandler_console::write): Recognize when a '?' is found after a <esc>[.
* * path.cc (get_device_number): Allow /dev/ttySn to designate a com port.Christopher Faylor2000-11-131-2/+0
|
* * fhandler.h (fhandler_dev_raw): Add method `fixup_after_exec'.Corinna Vinschen2000-10-311-0/+1
|
* * fhandler.h (fhandler_dev_raw): Add definition for methodCorinna Vinschen2000-10-311-0/+2
| | | | | | | | | | | | | | | `fixup_after_fork'. * fhandler_raw.cc (fhandler_dev_raw::fhandler_dev_raw): Add `set_need_fixup_after_fork' call. (fhandler_dev_raw::~fhandler_dev_raw): Revert to user space allocation. (fhandler_dev_raw::open): Ditto. (fhandler_dev_raw::dup): Ditto. Reset buffer pointer. (fhandler_dev_raw::fixup_after_fork): New function. * fhandler_tape.cc (fhandler_dev_tape::open): Revert to user space memory allocation. (fhandler_dev_tape::ioctl): Ditto. Change behaviour on MTSETBLK when new size is 1.
* Whitespace cleanup.Christopher Faylor2000-10-281-1/+1
| | | | | | * configure.in: Eliminate subdir stuff. * configure: Regenerate. * include/getopt.h (option): Make name field 'const'.
* * fhandler_socket.cc: New file.Corinna Vinschen2000-10-271-1/+1
| | | | | | | * Makefile.in: Add fhandler_socket.o to dependencies. * fhandler.h: Change comment. * net.cc Move all fhandler_socket methods to fhandler_socket.cc. * winsup.h: Add declaration for `ws2_32_handle'.
* * dtable.cc (dtable::release): Check for socket. ChangeCorinna Vinschen2000-10-261-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cnt_need_fixup_before accordingly. (dtable::dup2): Ditto. (dtable::fixup_before_fork): New method. (dtable::fixup_before_exec): Ditto. * dtable.h (class dtable): Add member `cnt_need_fixup_before'. Add definition for methods `dec_need_fixup_before', `inc_need_fixup_before', `need_fixup_before', `fixup_before_exec' and `fixup_before_fork'. * fhandler.h (class fhandler_base): Slight rearrangements. Add definitions for methods `fixup_before_fork_exec'. (class fhandler_socket): Eliminate superfluous constructor. Add member `prot_info_ptr'. Add destructor. Add definitions for methods `dup', `fixup_before_fork_exec', `fixup_after_fork' and `fixup_after_exec'. * fork.cc (fork_parent): Care for file types which need a fixup before fork. Start child in suspended state then. * net.cc: New global variable `ws2_32_handle' and `wsadata'. (fdsock): Check for Winsock version. Call `set_socket_inheritance' only if Winsock version < 2.0. Care for `need_fixup' count in fdtab. (cygwin_socket): Eliminate call to `set_socket_inheritance'. (cygwin_accept): Ditto. (cygwin_rcmd): Ditto. (cygwin_rresvport): Ditto. (cygwin_rexec): Ditto. (socketpair): Ditto. (fhandler_socket::fhandler_socket): Set `need_fork_fixup'. Allocate space for the WSAPROTOCOL_INFOA struct used in fixup. (fhandler_socket::~fhandler_socket): New destructor. (fhandler_socket::fixup_before_fork_exec): New method. (fhandler_socket::fixup_after_fork): Ditto. (fhandler_socket::dup): Ditto. (wsock_init): New static function. (LoadDLLinitfunc (wsock32)): Rearranged. (LoadDLLinitfunc (ws2_32)): New function. (dummy_autoload): Add autoload statemants for `WSADuplicateSocketA' and `WSASocketA'. * spawn.cc (spawn_guts): Care for file types which need a fixup before exec. Start child in suspended state then.
* * fcntl.cc (_fcntl): Rearrange as wrapper function. Move allCorinna Vinschen2000-10-231-0/+2
| | | | | | | | functionality except F_DUPFD to fhandler classes. * fhandler.cc (fhandler_base::fcntl): New method. * net.cc (fhandler_socket::fcntl): Ditto. * fhandler.h (class fhandler_base): Add method prototype for fcntl(). (class fhandler_socket): Ditto.
* * fhandler.h (fhandler_console): Remove tcsetpgrp.Christopher Faylor2000-10-211-2/+0
| | | | | | | | | | | | * fhandler_console.cc (fhandler_console::tcsetpgrp): Eliminate. * fork.cc (fork_parent): Avoid returning same pid twice in a row regardless of OS. * pinfo.cc (pinfo::init): Rename create argument to flags and treat it as such. * signal.cc (set_sigcatchers): New function. (signal): Use set_sigcatchers to increment or decrement sigcatcher tracker. (sigaction): Ditto. Add debugging output. * spawn.cc (spawn_guts): Always quote first argv[0] argument when it's a COMSPEC shell.
* * fhandler_clipboard.cc: new fileDJ Delorie2000-10-171-1/+18
| | | | | | | | | | | * Makefile.in: include fhandler_clipboard.o in DLL_OFILES list. * fhandler.h: add FH_CLIPBOARD to the devices enum. (fhandler_dev_clipboard): new * path.cc (windows_device_names): add "\\dev\\clipboard" (get_device_number): check for "clipboard" * dcrt0.cc: declare a few more functions from winuser.h * dtable.cc (dtable::build_fhandler): check for FH_CLIPBOARD in switch().
* * errno.cc (seterrno_from_win_error): Fix debugging output.Christopher Faylor2000-10-121-2/+2
| | | | | | | | | | | | | | * fhandler.cc (fhandler_base::fstat): Move to inline method in fhandler.h. (fhandler_base::set_io_handle): Ditto. * fhandler.h (fhandler_base): Make some methods inline. * fhandler_console.cc (fhandler_console::write_normal): Make buffer larger. * sigproc.h (sigframe::sigframe): Actually use set ebp parameter correctly. * spawn.cc (spawn_guts): Set dwProcessId when exec'ing. Just exit immediately after reparenting. * syscalls.cc: Sprinkle sigframe stuff throughout. * wait.cc (wait4): Set signal frame here. * dcrt0.cc (__api_fatal): Don't rely on small_printf to display errors. Always display problems to the console, if possible.
* * fhandler.h (fhandler_dev_mem): Erase member `init_phase' andCorinna Vinschen2000-10-091-3/+0
| | | | | | | | | | | | | | member function `init'. * fhandler_mem.cc: Add typedefs for NT internal data types `SYSTEM_INFORMATION_CLASS' and `SYSTEM_BASIC_INFORMATION'. Add prototype for `NtQuerySystemInformation' function. (fhandler_dev_mem::fhandler_dev_mem): Takes over initialization task from `init'. Use `NtQuerySystemInformation' function to evaluate the size of physical memory instead of interval search. (fhandler_dev_mem::init): Eliminated. (fhandler_dev_mem::open): Don't call `init'. (fhandler_dev_mem::read): Eliminate check for `init_phase'. (dummy_autoload): Add load statement for `NtQuerySystemInformation'.
* * fhandler.h (fhandler_base): Remove obsolete _rpos and _rsize elements.Christopher Faylor2000-10-071-3/+0
| | | | | | | | | | | * fhandler.cc (fhandler_base::open): Ditto. * fhandler.cc (fhandler_base::fhandler_base): Ditto. (fhandler_base::read): Ditto. Add more debugging output. Don't issue a \r when \r\n detected. * pipe.cc (make_pipe): Streamline slightly. Make debug output more interesting. * strace.cc (strace::vsprintf): Use __progname where appropriate to distinguish strace output when exec'ing.
* * fhandler.h (fhandler_dev_mem): Add methods mmap, munmap and msync.Corinna Vinschen2000-10-071-6/+10
| | | | | | | | | | | | | | | Add `unit' member. * fhandler_mem.cc (fhandler_dev_mem): Initialize `unit' as well. (init): Care for differences between /dev/mem, /dev/kmem (not implemented yet) and /dev/port. (open): Change debug message to reflect the device. (mmap): New function. (munmap): Ditto. (msync): Ditto. (fstat): Use unit when setting st_dev in stat structure. * mmap.cc (mmap): Handle MAP_ANONYMOUS flag. Change error handling slightly. * path.cc (get_device_number): Handle /dev/port.
* =====================================Corinna Vinschen2000-10-051-0/+10
| | | | | | | | | | | | | | | | | These changes require rebuilding all. ===================================== * fhandler.h: Add mmap(), munmap() and msync() to fhandler_base and fhandler_disk_file. * mmem.cc (mmap): Eliminated device dependent implementation details. These are moved to the appropriate fhandler class. (munmap): Ditto. (msync): Ditto. (fhandler_base::mmap): New method. (fhandler_base::munmap): Ditto. (fhandler_base::msync): Ditto. (fhandler_disk_file::mmap): Ditto. (fhandler_disk_file::munmap): Ditto. (fhandler_disk_file::msync): Ditto.
* * fhandler.h (fhandler_dev_mem): Add method `init'. Add membersCorinna Vinschen2000-10-041-0/+4
| | | | | | | | | | | | | | `mem_size' and `init_phase'. * fhandler_mem.cc (init): New function to figure out the size of the physical memory. (open): Add checking for illegal flags. Change usage of access mode. (write): Add intended functionality. (read): Add parameter checking. Eliminate page size constant. Use getpagesize() instead. Don't touch errno and don't create debug output while init() is running. (lseek): Add bounds checking. Fix SEEK_END. (fstat): Eliminate page size constant. Use getpagesize() instead. (dup): Add intended functionality.
* * Makefile.in: Add fhandler_mem.o to the dependencies.Corinna Vinschen2000-10-011-1/+24
| | | | | | | | * dtable.cc (dtable::build_fhandler): Add case for FH_MEM. * fhandler.h: Add FH_MEM device type. Add class fhandler_dev_mem. * fhandler_mem.cc: New file. Implementation of class fhandler_dev_mem. * path.cc: Add /dev/mem to windows_device_names. (get_device_number): Add FH_MEM type.
* * dcrt0.cc (quoted): Fix problem where ' quoted strings were skipped.Christopher Faylor2000-09-261-1/+0
| | | | | | | | | * fhandler.h (fhandler_socket::~fhandler_socket): Delete declaration. * net.cc: Remove unnecessary "number_of_sockets" usage. (fhandler_socket::fhandler_socket): Ditto. (fhandler_socket::~fhandler_socket): Delete definition. * spawn.cc (spawn_guts): Force first argument passed to CreateProcess as a command line to be windows style.
* Break out more header info into separate files. Use appropriate header filesChristopher Faylor2000-09-081-0/+1
| | | | | | | | | | | | throughout. * shared.h: Remove. * cygwin_version.h: New file. * delqueue.h: New file. * environ.h: New file. * host_dependent.h: New file. * perprocess.h: New file. * registry.h: New file. * security.h: New file.
* Split out tty and shared_info stuff into their own headers and use throughout.Christopher Faylor2000-09-071-6/+4
| | | | | | | | | | | | | | | | | Include sys/termios.h for files which need it. * tty.h: New file. * shared_info.h: New file. * fhandler.h: Move inline methods that rely on tty stuff to fhandler_console.cc. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Set output_done_event immediately after reading data to speed up tty output processing. (process_output): Set write_error to errno or zero. (fhandler_tty_slave::write): Check previous write error prior to writing to slave end of pipe. This allows tty output to be slightly less synchronous. * fhandler_console.cc (fhandler_console::tcsetpgrp): Moved here from fhandler.h. (fhandler_console::set_input_state): Ditto.
* * exceptions.cc (signal_exit): Reset all mutos owned by the main thread.Christopher Faylor2000-09-071-2/+8
| | | | | | | | | | | | | | | | | | | * fhandler.h: Define *_output_mutex macros for serializing tty output. (fhandler_termios): Remove restart_output_event. Define dummy output mutex methods. (fhandler_pty_master): Remove unneeded fixup_after_fork method. * fhandler_termios.cc (fhandler_termios::line_edit): Acquire output_mutex when CTRL-S is hit. Release it on CTRL-Q. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Remove inappropriate OutputStopped test here. Just use the output mutex. (fhandler_pty_master::fhandler_pty_master): Remove obsolete reference to restart_output_event. (fhandler_tty_common::close): Ditto. (fhandler_pty_master::set_close_on_exec): Ditto. (fhandler_pty_master::fixup_after_fork): Delete. * tty.cc (tty::common_init): Ditto. * sync.cc (muto::reset): New method. * sync.h: Declare above method.
* * Makefile.in: Add cygheap.o.Christopher Faylor2000-09-031-18/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * child_info.h: Add specific exec class. * cygheap.h: New file. Contains declarations for cygwin heap. * cygheap.cc: New file. Implements cygwin heap functions. * dcrt0.cc (quoted): Simplify due to new method for passing arguments between cygwin programs. (alloc_stack_hard_way): Attempt to handle overlapped stack. (dll_crt0_1): Move child_info processing here. Accomodate new method for passing arguments between cygwin programs. Initialize cygwin heap. Establish __argc and __argv variables. (_dll_crt0): Move most of child_info processing to dll_crt0_1. (cygwin_dll_init): Remove duplication. * dtable.cc (dtable::extend): Allocate dtable using cygwin heap. (dtable::build_fhandler): Ditto for fhandler type being constructed. (dtable::dup_worker): Free new fhandler from cygwin heap on error. (dtable::select_*): Don't assume that this == fdtab. (dtable::linearize_fd_array): Delete. (dtable::delinearize_fd_array): Delete. (dtable::fixup_after_exec): New file. (dtable::vfork_child_dup): Use cygwin heap. (dtable::vfork_parent_restore): Ditto. * dtable.h: Remove obsolete methods. Add new method. * environ.cc (posify): Eliminate already_posix parameter and logic. (envsize): New function. (_addenv): Use envsize. (environ_init): Accept an argument pointing to an existing environment list. If supplied, allocate space for this in the the program's heap. * fhandler.cc (fhandler_base::operator =): Move here from fhandler.h. Use cygwin heap to allocate filenames. (fhandler_base::set_name): Allocate/free names from cygwin heap. (fhandler_base::linearize): Delete. (fhandler_base::de_linearize): Delete. (fhandler_base::operator delete): Free from cygwin heap. (fhandler_base::~fhandler_base): Ditto. * fhandler.h: Accomodate elimination of *linearize and other changes above. * fhandler_console.cc (fhandler_console::fixup_after_exec): Rename from de_linearize. * heap.h: New file. * fhandler_tty.cc (fhandler_tty_slave::fhandler_tty_slave): Use cygwin heap for name. fhandler_tty::fixup_after_exec): Rename from de_linearize. * fork.cc (fork): Call cygheap_fixup_in_child. * heap.cc: Use declarations in heap.h. * malloc.cc: Sprinkle assertions throughout to catch attempts to free/realloc something from the cygwin heap. * path.cc: Throughout, eliminate use of per-thread cache for cwd. Use cwd_* functions rather than cwd_* variables to access cwd_win32 and cwd_posix. (cwd_win32): New function. (cwd_posix): New function. (cwd_hash): New function. (cwd_fixup_after_exec): New function. * path.h: Accomodate path.cc changes. * pinfo.cc (pinfo_init): Accept a pointer to an environment table. Pass this to environ_init. Eliminate old 'title' tests. * pinfo.h: Accomodate above change in argument. * spawn.cc (struct av): New method for building argv list. (av::unshift): New method. (spawn_guts): Allocate everything that the child process needs in the cygwin heap and pass a pointer to this to the child. Build argv list using new method. Eliminate delinearize stuff. * thread.h: Eliminate _cwd_win32 and _cwd_posix buffers. * winsup.h: Eliminate obsolete functions. Add envsize() declaration.
* * include/cygwin/cygwin_dll.h: Update for modern compilers.Christopher Faylor2000-07-291-0/+1
| | | | | | | * lib/cygwin_crt0.c: Inexplicably need to define alloca for newer compilers. * fhandler.h (fhandler_console): Add new method. * fhandler.cc (fhandler_console::set_cursor_maybe): New method. (fhandler_console::read): Set cursor if it has moved to make it visible.
* * fhandler.h (class fhandler_dev_random): Add members for managingCorinna Vinschen2000-07-241-0/+5
| | | | | | | pseudo randomness. * fhandler_random.cc: Rearrange. Use pseudo random number generator as entropy source if system entropy isn't available and if device is used as /dev/urandom. Allow initializing device by calling write().
* * fhandler.h: Add comment.Corinna Vinschen2000-07-231-0/+3
|
* * fhandler.h (class fhandler_dev_raw): Add private member `varblkop'Corinna Vinschen2000-07-231-0/+1
| | | | | | | | | | | | | to be set when variable blocksize mode is on. * fhandler_raw.cc: Eliminate `\n' from trace output. (clear): Set `varblkop' to 0. (dup): Copy varblkop as well. (writebuf): Care for variable blocksize. (open): Ditto. (raw_read): Ditto. (raw_write): Ditto. * fhandler_tape.cc (open): Ditto. (ioctl): Ditto. Some cleanups.
* * cygwin.din: Export _getmode and getmode to allow querying of binary state ofChristopher Faylor2000-07-091-0/+3
| | | | | | | | | | | | | | | an fd. * external.cc (cygwin_internal): Add handling of perfile_table setting. * fhandler.cc (perfile_table): New global. (fhandler_base::get_default_fmode): New method to return a file's default mode based on its name. (fhandler_base::open): Use get_default_mode method to determine a file's mode. Record file mode in file flags. * fhandler.h (fhandler_base): Declare get_default_fmode * syscalls.cc (getmode): New function. * sys/cygwin.h (__cygwin_perfile): New structure. (cygwin_getinfo_types): Move outside of WINVER conditional. (per_process): Move inside of WINVER conditional.
* * fhandler.h (set_name): Don't use 'unix' as name since this is defined by gccChristopher Faylor2000-06-181-1/+2
| | | | | now. * fhandler.cc (set_name): Ditto.
* * Makefile.in (DLL_OFILES): Sort.Christopher Faylor2000-05-121-2/+0
| | | | | * fhandler_tty.cc (fhandler_tty_slave::send_ioctl_request): Eliminate. (fhandler_tty_slave::ioctl): Rewrite to avoid races.
* * Makefile.in: Add dependencies for fhandler_random.oCorinna Vinschen2000-05-031-1/+20
| | | | | | | | | | | | | | * fhandler.h: Add device type FH_RANDOM. Add class fhandler_dev_random. * fhandler_random.cc: New file. Implementation of fhandler_dev_random. * hinfo.cc (build_fhandler): Add case for FH_RANDOM. * path.cc: Add device names for random devices to windows_device_names. (get_device_number): Add if branch for random devices. (win32_device_name): Add device name generation for random devices. winsup.h: Include <wincrypt.h>.
* * fhandler.h (fhandler_base::hclose): New virtual method.Christopher Faylor2000-04-201-2/+3
| | | | | | | (fhandler_base::set_inheritance): Make this a method so that we can use the appropriate close methods. * fhandler.cc (fhandler_base::set_inheritance): Ditto. * path.cc (normalize_posix_path): Eliminate /. trailing path component.
* * fhandler.h (select_stuff): Eliminate use of 'total'.Christopher Faylor2000-04-031-3/+1
| | | | | | * select.cc (cygwin_select): Ditto. (select_stuff::wait): Use maximum size for w4 rather than calculating what will fit.
* Simplify constructors and initializers for select_record.Christopher Faylor2000-03-301-6/+6
|
* * fhandler.h (select_record): Explicitly zero elements of this class.Christopher Faylor2000-03-301-1/+12
| | | | | (select_stuff): Ditto. * select.cc (cygwin_select): Eliminate memset zero of sel.
* Pipe changes throughout suggested by Eric Fifer <EFifer@sanwaint.com>Christopher Faylor2000-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | * debug.cc (threadname_init): Pass name of lock as arg 2 of new_muto. * malloc.cc (malloc_init): Ditto. * sigproc.cc (sigproc_init): Ditto. * exceptions.cc (events_init): Ditto. (call_handler): Eliminate special case for hExeced. Report locked thread in debugging output. * fhandler.cc (fhandker_pipe::fhandler_pipe): Propagate device type to base class. * fhandler.h (fhandler_pipe): Ditto. * hinfo.cc (hinfo::build_fhandler): Pass specific type of pipe to constructor. * spawn.cc (spawn_guts): Eliminate dependency on signal when waiting for subprocess. * strace.cc: Remove obsolete #ifdef. * sync.cc (muto::muto): Save the name of the muto. (muto:~muto): Also release the muto. * sync.h: Add a muto name field. * select.cc (peek_pipe): Avoid doing a PeekNamedPipe on the write end of a pipe.
* * fhandler.cc (fhandler_base::get_readahead_into_buffer): New function.Christopher Faylor2000-03-121-2/+4
| | | | | | | | | | | | | * fhandler.h: Declare new function. Add extra argument to process_slave_output. * fhandler_console.cc (fhandler_console::read): Move read ahead code to new function. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Move common code here. (fhandler_tty_slave::read): Understand readahead. (fhandler_pty_master::read): Move code to process_slave_output. * select.cc (peek_pipe): Avoid performing certain checks when non-read and on inappropriate fh types.
* Respond to a multitude of g++ warnings.Christopher Faylor2000-02-211-8/+8
|
* import winsup-2000-02-17 snapshotChristopher Faylor2000-02-171-0/+804