Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-11-08* fhandler_termios.cc (fhandler_termios::line_edit): Don't do special characterChristopher Faylor
handling when stopped by CTRL-S. * fhandler_tty.cc (bytes_available): Add arguments to debug_only_printf call. * sigproc.cc (proc_subproc): Simplify some if logic.
2012-10-15* fhandler_tty.cc (fhandler_pty_slave::write): Fix potential exit from loopChristopher Faylor
with write mutex held. Delete redundant mutex release. Clear tty error once we've grabbed it.
2012-10-15* fhandler_tty.cc (fhandler_pty_slave::write): DWORD -> BOOL.Christopher Faylor
2012-10-12* fhandler_termios.cc (fhandler_termios::line_edit): Don't manipulateChristopher Faylor
output_mutex on CTRL-S/CTRL-Q to avoid a deadlock. * fhandler_tty.cc (fhandler_pty_slave::write): Loop when output_stopped is detected before acquiring output_mutex. Acquire output_mutex in the loop for each write. * tty.h: Remove some obsolete defines. (tty_min::output_stopped): Make 'bool'.
2012-08-17whitespace cleanupChristopher Faylor
2012-08-15Rename cancelable_wait -> cygwait throughout.Christopher Faylor
* DevNotes: Add entry cgf-000015. * cygwait.h (cygwait): Don't allow an optional PLARGE_INTERGER argument.
2012-07-30* cygwait.cc (cancelable_wait): Add some debugging-only output.Christopher Faylor
* exceptions.cc (sig_handle_tty_stop): Make sure that incyg is cleared when exiting if we have no parent process. Only wait for signal_arrived. (sigpacket::process): Make continue_now a bool. Delay sending signal_arrived until the end. Make code more defensive to avoid calling signal handler when stopped. Only set signal_arrived when stopped. * sigproc.cc (sig_hold): Rename from sigCONT. Make static. (sig_send): Accommodate sigCONT -> sig_hold rename. (wait_sig): Ditto. * sigproc.h (sigCONT): Delete declaration. * fhandler_console.cc (fhandler_console::write): Use new '%0c' facility to print characters. Change to paranoid to avoid excessive strace output. * fhandler_tty.cc (fhandler_pty_master::accept_input): Make frequent strace printf "paranoid" to help cut down on strace output size. * signal.cc (sigsuspend): Add standard syscall strace output. (sigpause): Ditto. (pause): Ditto. * cygtls.h (_cygtls::reset_signal_arrived): New function.
2012-07-22* DevNotes: Add entry cgf-000013.Christopher Faylor
* cygserver_ipc.h (ipc_set_proc_info): Use _cygtls::ipc_set_proc_info to set per-thread signal arrived value. * cygthread.cc (cygthread::detach): Use per-thread signal_arrived via set_thread_waiting. * fork.cc (_cygtls::fixup_after_fork): Clear signal_arrived. (_cygtls::remove): Close any signal_arrived handle when thread exists. (_cygtls::find_tls): Remove unneeded function. * cygtls.h: Update copyright. (class _cygtls): Reorganize to help avoid rebuilding newlib when structure changes. (_cygtls::event): Delete. (_cygtls::threadkill): Ditto. (_cygtls::signal_waiting): Declare new bool. (_cygtls::find_tls): Delete declaration. (_cygtls::set_threadkill): Ditto. (_cygtls::reset_threadkill): Ditto. (_cygtls::set_signal_arrived): Declare new function. (class set_thread_waiting): Declare new class. * cygwait.cc (cw_nowait_storage): Define. (cygwait): Set per-thread signal_arrived via set_thread_waiting. Don't special-case _main_tls. * cygwait.h (cw_nowait): Define. (cw_infinite): Ditto. (cygwait): Redefine pathological wait-only case. * dcrt0.cc (dll_crt0_0): Remove call to now-defunct events_init(). (dll_crt0_1): Remove call to now-defunct create_signal_arrived(). * exceptions.cc: Reflect set_signal_mask() argument reordering throughout. Remove signal mask synchronization throughout. (events_init): Delete definition. (mask_sync): Delete now-unneeded mask synchronization. (set_signal_mask): Reverse order of arguments to "standard" to, from layout. Rename "newmask" argument to "setmask". Remove debugging. (sig_handle_tty_stop): Use cancelable_wait rather than WFMO. (_cygtls::interrupt_setup): Don't treat "threadkill" events specially. Conditionally set signal_arrived depending on whether the thread has created it or not. (sigpacket::process): Reorganize to reflect thread-specific sending of signals which is more in line with the way it was actually supposed to work. * fhandler_socket.cc (get_inet_addr): Use cancelable_wait rather than IsEventSignalled to avoid potential race. (fhandler_socket::wait_for_events): Set signal_arrived event using set_thread_waiting(). (fhandler_socket::close): Use cygwait for the case of just waiting 10 ms for a signal. * fhandler_tape.cc (fhandler_dev_tape::_lock): Use cancelable_wait rather than WFMO. Redo switch/case tests accordingly. * fhandler_termios.cc (fhandler_termios::bg_check): Use cygwait for case of just waiting 0 ms for a potential signal. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Use cancelable_wait rather than WFSO. * fhandler_windows.cc (fhandler_windows::read): Set per-thread signal_arrived via set_thread_waiting(). * flock.cc (lf_setlock): Ditto. * select.cc (pselect): Ditto. Set per-thread signal_arrived using set_thread_waiting(). * gendef: Don't special case handling of _cygtls::sig for threads. * gentls_offsets: Use #pragma once in tlsoffsets.h. * ntdll.h: Use #pragma once. * poll.cc: Reflect set_signal_mask() argument reordering. * posix_ipc.cc (ipc_mutex_lock): Use cancelable_wait rather than WFMO. (ipc_cond_timedwait): Set perl-thread signal arrived using set_thread_waiting(). * security.h: Use #pragma once. * signal.cc (abort): Reflect set_signal_mask() argument reordering. (clock_nanosleep): Ditto. Change call to cancelable_wait to properly specify handling of cancel and interrupt. (sigwaitinfo): Remove handling of per-thread event in favor of per-thread signal_arrived. Use cancelable_wait rather than WFSO. * sigproc.cc (signal_arrived): Delete definition. (create_signal_arrived): Ditto. * sigproc.h (signal_arrived): Delete declaration. (set_signal_mask): Avoid defining as a "C" function. Don't conditionally declare. (create_signal_arrived): Delete declaration. * syscalls.cc (rename): Use cygwait() rather than WFSO. * thread.h (fast_mutex::lock): Use cw_infinite rather than LARGE_NULL. * wait.cc (wait4): Ditto. * thread.cc (pthread_mutex::lock): Ditto. (pthread::join): Ditto. (semaphore::_wait): Ditto. (pthread_kill): Remove set_threadkill() accommodation. * tlsoffsets.h: Regenerate.
2012-07-06 * fhandler_registry.cc (RegOpenUserClassesRoot): Only define whenCorinna Vinschen
building against w32api headers. (RegOpenCurrentUser): Ditto. * fhandler_tty.cc (GetNamedPipeClientProcessId): Ditto. * ntdll.h (enum _PROCESSINFOCLASS): Add ProcessImageFileName. (RtlInitAnsiString): Declare. (RtlUnicodeStringToAnsiSize): Declare. * sched.cc (GetForegroundWindow): Ditto. * sec_helper.cc (SECURITY_NT_NON_UNIQUE): Define as SECURITY_NT_NON_UNIQUE_RID when building against w32api headers. (cygsid::get_sid): Use SECURITY_NT_NON_UNIQUE rather than SECURITY_NT_NON_UNIQUE_RID. (__sec_user): Use PISECURITY_DESCRIPTOR rather than PSECURITY_DESCRIPTOR to allow valid pointer arithmetic. (_recycler_sd): Ditto. (_everyone_sd): Ditto.
2012-07-04* fhandler_tty.cc (fhandler_pty_slave::read): Remove duplicate assignment toChristopher Faylor
bytes_in_pipe found by Clang.
2012-06-19Revert errneous checkin.Christopher Faylor
Check in actual change associated with ChangeLog.
2012-06-19* cygwait.cc (cancelable_wait): Mimic old cygwait behavior more closely wrtChristopher Faylor
handling of call_signal_handler. * cygwait.h (WAIT_CANCELED): Move here and redefine. (WAIT_SIGNALED): Ditto. * thread.h (WAIT_CANCELED): Delete. (WAIT_SIGNALED): Ditto.
2012-06-18Add '#include "cygwait.h"' throughout, where appropriate.Christopher Faylor
* DevNotes: Add entry cgf-000012. * Makefile.in (DLL_OFILES): Add cygwait.o. * sigproc.h: Remove cygwait definitions. * cygwait.h: New file. Define/declare Cygwin waitfor functions. * cygwait.cc: Ditto. * exceptions.cc: Include cygwait.h. (handle_sigsuspend): Accommodate change in cancelable_wait arguments. (sigpacket::process): Display thread tls in debugging output. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use symbolic names for signal and cancel return. * fhandler_console.cc (fhandler_console::read): Ditto. (fhandler_dev_dsp::Audio_out::waitforspace): Ditto. fhandler_dev_dsp::Audio_in::waitfordata): Ditto. * fhandler_fifo.cc (fhandler_fifo::wait): Ditto. * fhandler_serial.cc (fhandler_serial::raw_read): Ditto. * fhandler_tty.cc (fhandler_pty_slave::read): Ditto. * select.cc (cygwin_select): Ditto. * wait.cc (wait4): Ditto. * thread.cc (cancelable_wait): Move definition to cygwait.h. (pthread_cond::wait): Accommodate change in cancelable_wait arguments. (pthread_mutex::lock): Ditto. (pthread_spinlock::lock): Ditto. (pthread::join): Ditto. (pthread::thread_init_wrapper): Display tls in debugging output. (semaphore::_timedwait): Ditto. * thread.h (cw_sig_wait): Move to cygwait.h. (cw_cancel_action): Delete. (cancelable_wait): Move declaration to cygwait.h.
2012-05-16* DevNotes: Add entry cgf-000008.Christopher Faylor
* fhandler_tty.cc (bytes_available): Simplify by returning the number of bytes available in the message unless that is zero.
2012-05-04* DevNotes: Add entry cgf-000002.Christopher Faylor
* fhandler_tty.cc (bytes_available): Revert to previous Oct-2011 behavior where a dummy buffer is used to determine how many bytes will be read. (fhandler_pty_master::ioctl): Correct coercion in assignment.
2012-04-05* fhandler.h (fhandler_pty_common::bytes_available): Declare new function.Christopher Faylor
(fhandler_pty_master::flush_to_slave): Ditto. * fhandler_tty.cc (bytes_available): Define new function. (fhandler_pty_common::bytes_available): Ditto. (handler_pty_master::flush_to_slave): Ditto. (fhandler_pty_master::process_slave_output): Call flush_to_slave () here. Use bytes_available () rather than PeekNamedPipe. Cleanup sloppy logic. (fhandler_pty_slave::read): Use bytes_available () rather than PeekNamedPipe. (fhandler_pty_slave::ioctl): Ditto. (fhandler_pty_master::ioctl): Ditto. (fhandler_pty_master::cleanup): Remove ancient #if 0. * select.cc (peek_pipe): Call flush_to_slave whenever we're checking for a pty master.
2012-03-08 * Throughout, replace usage of w32api's min with MIN from sys/param.h.Corinna Vinschen
2012-03-04* fhandler_console.cc (fhandler_console::dup): Only set ctty when we haven'tChristopher Faylor
specifically called setsid. * fhandler_tty.cc (fhandler_pty_slave::dup): Ditto. Also add comment documenting research into rxvt problem. * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Don't check specifically for myself->ctty == -1. Test for > 0 as that is the correct test. (fhandler_termios::sigflush): Ditto.
2012-02-14 * cygheap.cc (init_cygheap::init_installation_root): Convert functionCorinna Vinschen
init_installation_root into a cygheap method. * cygheap.h (struct init_cygheap): Move installation_root, installation_key, and installation_key_buf from shared .cygwin_dll_common DLL section to cygheap. Declare new method init_installation_root. * dtable.cc (handle_to_fn): Accommodate the move of installation strings to the cygheap. * external.cc (cygwin_internal): Ditto. * fhandler_console.cc (fhandler_console::open_shared_console): Ditto. * fhandler_mailslot.cc (fhandler_mailslot::get_object_attr): Ditto. * fhandler_tty.cc: Ditto, throughout. * mount.cc (mount_info::init): Ditto. * pipe.cc (fhandler_pipe::create): Ditto. * shared.cc: Ditto, throughout. (installation_root): Remove. (installation_key): Move to cygheap. (installation_key_buf): Ditto. (installation_root_inited): Remove. (SPIN_WAIT): Remove. (init_installation_root): Move to cygheap. (memory_init): Call cygheap->init_installation_root right after cygheap->user.init. Drop call of init_installation_root function. * shared_info.h (init_installation_root): Drop declaration. (installation_root): Ditto. (installation_key): Ditto. * uinfo.cc (pwdgrp::load): Accommodate the move of installation strings to the cygheap.
2012-02-07* cygheap.cc (init_cygheap::manage_console_count): Delete.Christopher Faylor
* cygheap.h (init_cygheap::manage_console_count): Ditto. (init_cygheap::console_count): Ditto. * fhandler.h (fhandler_console::has_a): Ditto. (fhandler_console::free_console): Declare new function. * fhandler_console.cc (fhandler_console::free_console): Define new function. (fhandler_console::open_setup): Delete call to manage_console_count. (fhandler_console::close): Ditto. Replace with call to free_console(). * fhandler_tty.cc (fhandler_pty_slave::open): Delete call to manage_console_count. (fhandler_pty_slave::cleanup): Ditto. (fhandler_pty_slave::close): Call fhandler_console::free_console() if this is our controlling tty. * pinfo.cc (_pinfo::set_ctty): Skip function if tty in question == our ctty. Delete call to manage_console_count. * syscalls.cc (close_all_files): Avoid locking and avoid setting errno when iterating over fds.
2011-12-18Clean up whitespace.Christopher Faylor
2011-12-13* cygthread.h (cygthread::name): Very minor formatting tweak.Christopher Faylor
* exceptions.cc (_cygtls::call_signal_handler): Add paranoid debugging output. * sigproc.h (cygwait): Call signal handler when signal is detected and loop as appropriate. * fhandler.h (fhandler_base_overlapped::wait_return): Remove overlapped_signal. * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Remove restartable signal accommodations in light of cygwait improvements. (fhandler_base_overlapped::raw_read): Remove now-obsolete signal loop behavior. (fhandler_base_overlapped::raw_write): Ditto. * fhandler_console.cc (fhandler_console::read): Ditto. * fhandler_serial.cc (fhandler_serial::raw_read): Ditto. (fhandler_serial::raw_write): Ditto. * fhandler_tty.cc (fhandler_pty_slave::read): Ditto. * ioctl.cc (ioctl): Add standard syscall introducer and leaver debug output.
2011-12-09Rename cygWFMO to cygwait throughout and use the magic of polymorphism to "waitChristopher Faylor
for stuff". * fhandler.cc (fhandler_base_overlapped::wait_overlapped): Use simplified arg form of cygwait. * fhandler_console.cc (fhandler_console::read): Ditto. * fhandler_audio.cc (fhandler_dev_dsp::Audio_out::waitforspac): Ditto. (fhandler_dev_dsp::Audio_in::waitfordata): Ditto. * fhandler_fifo.cc (fhandler_fifo::wait): Ditto. * fhandler_serial.cc (fhandler_serial::raw_read): Ditto. (fhandler_serial::raw_write): Ditto. * select.cc (cygwin_select): Ditto. * sigproc.h (cygwait): Rename from cygWFMO. Define two argument and single argument forms of this function. * fhandler_tty.cc (fhandler_pty_slave::open): Use method to query if tty is open. (fhandler_pty_slave::read): Send SIGHUP when master is detected as closed. (fhandler_pty_common::close): Close input_available_event in callers since master may need to signal it first. (fhandler_pty_master::close): Lie and set input_available_event when closing, then close input_available_event. (fhandler_pty_slave::close): Close input_available_event explicitly here. * tty.h (tty::is_master_closed): Declare new method.
2011-12-04* sigproc.cc (cygWFMO): Don't assume that cancellable event is alwaysChristopher Faylor
available. * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::waitforspace): Use cygWFMO instead of WaitForMultipleObjects. (fhandler_dev_dsp::Audio_in::waitfordata): Ditto. * fhandler_fifo.cc (fhandler_fifo::wait): Ditto. * fhandler_serial.cc (fhandler_serial::raw_read): Ditto. (fhandler_serial::raw_write): Ditto. * fhandler_tty.cc (fhandler_pty_slave::read): Ditto. * select.cc (cygwin_select): Ditto for degenerate case.
2011-12-04Throughout, remove extra space after function name from debugging output.Christopher Faylor
Throughout, change syscalls to report on return values using new %R format option. * smallprint.cc (__small_vsprintf): Add parsing for %R to report on return values and possible errno from syscalls. * errno.cc (errmap): Add PRIVILEGE_NOT_HELD. * fhandler_tty.cc (fhandler_pty_master::setup): When creating a thread use shorter name to reduce debuggging output. * select.cc (start_thread_pipe): Ditto. (start_thread_serial): Ditto. (start_thread_socket): Ditto. (start_thread_mailslot): Ditto. * sigproc.cc (talktome): Ditto.
2011-11-23* fhandler.h (fhandler_pipe::create): Rename from the misnamedChristopher Faylor
"create_selectable". Change return to DWORD. (fhandler_pty_common::pipesize): New constant. * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Reflect create_selectable name change. * miscfuncs.cc (CreatePipeOverlapped): Ditto. * pipe.cc (fhandler_pipe::create): Ditto. (fhandler_pipe::create): Rename from the misnamed "create_selectable". Return DWORD. Only set pipe size to default when it is passed in as zero. * fhandler_tty.cc (fhandler_pty_master::setup): Ditto. Use fhandler_pty_common::pipesize rather than a raw constant. * tty.cc (tty::not_allocated): Ditto. * sigproc.cc (sigproc_init): Use create_selectable to create the signal pipe to get a more appropriate message based pipe.
2011-11-14Throughout use "have_execed" macro rather than "hExeced" global handle.Christopher Faylor
Throughout rename _PROC_* to _CH_*. * child_info.h: Include "pinfo.h". (child_info_types): Rename _PROC_* -> _CH_* to avoid confusion with similarly named constants. (_PROC_*): Delete unneeded aliases. (PROC_*): Ditto. (CURR_CHILD_INFO_MAGIC): Ditto. (cchildren): Define using "pinfo_minimal". (child_info::set_saw_ctrl_c): Move to (child_info_spawn::set_saw_ctrl_c): Here. (child_info_spawn::lock): New field. (child_info_spawn::hExeced): Ditto. (child_info_spawn::ev): Ditto. (child_info_spawn::~child_info_spawn): Move to sigproc.cc. (child_info_spawn::child_info_spawn): Ditto. (child_info_spawn::cleanup): Declare new function. (child_info_spawn::set_saw_ctrl_c): Move to this class. Set flag only when execed and return true when we have set the flag. (child_info_spawn::child_info_spawn::signal_myself_exited): New function. (child_info_spawn::wait_for_myself): Ditto. (child_info_spawn::has_execed_cygwin): Ditto. (child_info_spawn::has_execed): Ditto. Replaces "hExeced" test. (child_info_spawn::operator HANDLE&): New operator. (child_info_spawn::worker): Define old "spawn_guts" as class member. (ch_spawn): Declare. (have_execed): Define. (have_execed_cygwin): Ditto. * cygheap.h: Update comment. * dcrt0.cc (get_cygwin_startup_info): Use _CH_* enums. (child_info_spawn::handle_spawn): Ditto. (dll_crt0_0): Ditto. (multiple_cygwin_problem): Ditto. * exceptions.cc (chExeced): Delete obsolete declaration. (ctrl_c_handler): Reference set_saw_ctrl_c via new ch_spawn global. * globals.cc (hExeced): Delete. * pinfo.cc (pinfo::thisproc): Refer to cygheap as ::cygheap for consistency in handle naming when -DDEBUGGING. (pinfo::init): Accommodate case where myself.h is known but h0 is passed in. (pinfo::pinfo): New constructor for setting up a pinfo passed in by previous exec'or. (pinfo::proc_waiter): Don't handle subprocess if we're in the process of exiting due to an exec of a cygwin process. Don't close rd_proc_pipe here. Close it when we actually are finished with the process. Use new ch_spawn.signal_myself_exited function to let exec stub know that subprocess has exited. (pinfo::wait): Clarify debugging output. (pinfo::release): Use "close_h" to close all handles to avoid races. (winpids::add): Assume that elements of the array do not need to be zeroed and are properly initialized or suffer problems on pinfo::release. Don't close hProcess since release does that now. * pinfo.h: Update comment. (pinfo_minimal): Move some elements from pinfo here so that child_info_spawn can use them. (pinfo): Inherit from pinfo_minimal. (pinfo::pinfo): Modify to accommodate new pinfo_minimal. (pinfo::allow_remove): New function. * sigproc.cc (proc_subproc): Use boolean values for true/false. Implement PROC_EXEC_CLEANUP. (proc_terminate): Set ppid = 1 since the procs list will only be iterated when the process has not execed. Don't do any cleanup here since it is now handled in pinfo::release. (sigproc_init): Initialize sync_proc_subproc earlier. (child_info::child_info): Assume that all important fields are properly initialized and avoid memset(). (child_info_spawn::child_info_spawn): Specifically test for execing and then set up appropriate fields in the struct. (child_info_spawn::cleanup): Define new function. (child_info_spawn::record_children): Specifically test for being execed here. Fill in pinfo_minimal part of children array. (child_info_spawn::reattach_children): Use constructor to duplicate information for previous exec'or. Add more debugging output. (remove_proc): Force deletion of thread when exiting due to exec. Rely on pinfo::cleanup in release. * sigproc.h (PROC_EXEC_CLEANUP): New enum. (PROC_DETACHED_CHILD): Delete. * spawn.cc (chExeced): Delete. (child_info_spawn::worker): Rename from spawn_guts. Use elements of child_info_spawn throughout rather than ch.whatever. Use ::cygheap to refer to global rather than element of child_info. Use wait_for_myself() rather than waitpid(). Call child_info_spawn::cleanup on function return. (spawnve): Reflect movement of spawn_guts functionality into child_info_spawn::worker. * syscalls.cc (popen): Ditto. * winsup.h (spawn_guts): Delete declaration.
2011-11-08* fhandler.h (__ptsname): New macro.Christopher Faylor
* dtable.cc (decode_tty): Use __ptsname to generate the slave pty name. * fhandler_tty.cc (fhandler_pty_master::ptsname_r): Ditto. * bsdlib.cc: Add needed includes for openpty() changes. (openpty): Use __ptsname to generate the slave pty name. Close slave fd when aslave == NULL.
2011-11-08* cygwin.din (ptsname_r): Export.Christopher Faylor
* fhandler.cc (fhandler_base::ptsname_r): Define. * fhandler.h (fhandler_base::ptsname): Delete. (fhandler_base::ptsname_r): Declare. (fhandler_pty_master::ptsname_r): Declare. * fhandler_tty.cc (fhandler_pty_master::ptsname): Delete. (fhandler_pty_master::ptsname_r): New reentrant function derived from previous ptsname. * syscalls.cc (ptsname_r): Implement new function with functionality similar to Linux. (ptsname): Use ptsname_r () to fill out buf. * include/cygwin/stdlib.h (ptsname_r): Declare. * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 255 to reflect export of ptsname_r. * pinfo.cc (pinfo::wait): Return bool rather than int. * pinfo.h (info::wait): Ditto. (pinfo::reattach): Define !defined(_SIGPROC_H) case for consistency. * sigproc.cc (child_info_spawn::reattach_children): Use correct dwProcessId rather than pid when duplicating handle.
2011-10-30* fhandler.h (fhandler_pipe::create_selectable): Remove optional argument, takeChristopher Faylor
an options argument for CreateNamedPipe/CreateFile. Change handle arguments to expect pointers. (fhandler_fifo::fifo_state): Delete. (fhandler_fifo::dummy_client): Ditto. (fhandler_fifo::open_nonserver): Ditto. (fhandler_fifo::wait_state): Ditto. (fhandler_fifo::raw_write): Ditto. (fhandler_fifo::read_ready): New field. (fhandler_fifo::write_ready): Ditto. (fhandler_fifo::wait): Modify argument. (fhandler_fifo::fifo_name): Add a new argument. (fhandler_fifo::fixup_after_fork): New function. * fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Remove initialization of expunged elements. Initialize new handles to NULL. (fhandler_fifo::open_nonserver): Delete. (fnevent): New macro for creating a named event. (fnpipe): New macro for creating a unique named pipe name. (create_pipe): New macro for simplification of named pipe creation. (fhandler_fifo::fifo_name): Use new argument when creating a shared name. (fhandler_fifo::open): Rewrite. Use events to synchronize. (pure_debug_printf): New macro, active only when DEBUGGING. (fhandler_fifo::wait): Rewrite to wait for new fifo events which are supplied as a parameter. (fhandler_fifo::raw_read): Rewrite to use handle mechanism to detect client-side disconnect. (fhandler_fifo::raw_write): Delete. (fhandler_fifo::close): Remove accommodations for expunged fields. Close event handles. (fhandler_fifo::dup): Remove accommodations for expunged fields. Duplicate event handles. (fhandler_fifo::fixup_after_fork): New function. Perform fixups on event handles. (fhandler_fifo::set_close_on_exec): Remove accommodations for expunged fields. Set inheritance for new handle fields. * miscfuncs.cc (CreatePipeOverlapped): Accommodate changes in fhandler_pipe::create_selectable. * tty.cc (tty::not_allocated): Ditto. * pipe.cc (fhandler_pipe::create): Ditto. (fhandler_pipe::create_selectable): Accept an extra open_mode argument. Pass arguments by reference and allow opening one end of the pipe at a time. * sys/strace.h (debug_only_printf): Define new macro which calls debug_printf only when DEBUGGING is defined.
2011-10-23* fhandler_tty.cc (fhandler_pty_slave::read): Use consistent way for testingChristopher Faylor
ReadFile return. * pipe.cc (fhandler_pipe::create_selectable): Open the write side of the pipe in message-mode to force writing as "chunks". Explain why.
2011-10-20Throughout change TTY_* to PTY_*, tty_* to pty_*, and ttym_* to ptmx_*.Christopher Faylor
* devices.cc: Regenerate. * dtable.cc: (fh_alloc): Preserve /dev/tty name when that's what we opened. (build_fh_pc): Preserve any existing name. * fhandler.cc (fhandler_base::open_with_arch): Ditto. * fhandler_tty.cc (fhandler_pty_master::fhandler_pty_master): Force the name to /dev/ptmx while preserving other pty master device information. * path.h (cfree_maybe): New macro. (path_conv::operator =): Free any allocated strings in target. (path_conv::free_strings): Delete unused function. * sigproc.cc (proc_terminate): Remove previous accommodation for execed processes since it didn't have the desired effect. Change comment to a FIXME. * spawn.cc (chExeced): Mark NO_COPY. (exe_suffixes): Ditto.
2011-10-16* cygerrno.h (__set_errno): Modify debugging output to make searching straceChristopher Faylor
logs easier. Throughout, change /dev/tty* to /dev/pty*. Throughout, add flags argument to fhandler_*::dup methods. * devices.in: Rename (temporarily?) /dev/ttyN to /dev/ptyN. Add /dev/ptymN devices for pty masters. * devices.cc: Regenerate. * devices.h (MAX_CONSOLES): Set to max number supported by devices.in. (fh_devices::FH_PTMX): Rename from FH_PTYM. (device::operator int): Return by reference. * dtable.cc (fh_alloc): Take pc as an argument rather than just the device. This makes debugging easier since more information is available. Actually implement handling for already-allocated pty master devices. Make different decisions when generating fhandler for not-opened devices. Add kludge to deal with opening /dev/tty. (cnew_no_ctor): New macro. (build_fh_pc): Make debugging output more verbose. Use new clone() fhandler interface to duplicate archetypes. Reset last term opened. (dtable::dup_worker): Use Use new clone() fhandler interface to duplicate archetypes. Pass flags to child dup handler. (dtable::dup3): Set O_NOCTTY flag if newfd is not stdin/stdout/stderr. * fhandler.cc (fhandler_base::reset): Rename from operator =() and reduce functionality and sense of copy direction. (fhandler_base::open_with_arch): Use published interface to query io_handle(). Use new copyto() fhandler method to copy from/to found archetype. * fhandler.h: Throughout, delete size(), add copyout, clone, and fhandler_* (void *) methods. (fhandler_base::reset): Rename from operator =(). (fhandler_termios::is_dev_tty): Delete. (fhandler_termios): change "protected" region to "private". (fhandler_termios::is_dev_tty): Delete. (fhandler_termios): Rearrange protected/public. (fhandler_termios::fhandler_termios): Remember last fhandler_termios "opened". (fhandler_termios::~fhandler_termios): Forget last fhandler_termios opened. (ioctl): Rename from ioctl_termios. Take a void * argument. Reflect argument change in pinfo::set_ctty. (fhandler_console::dup): Declare new function. Set ctty here if appropriate. (fhandler_pty_master::from_master): Privatize. (fhandler_pty_master::to_master): Ditto. (fhandler_pty_master::dwProcessId): Ditto. (fhandler_pty_master::fhandler_pty_master): Add an `int' argument. (fhandler_pty_master::open_setup): Declare new function. (fhandler_pty_master::~fhandler_pty_master): Declare new method. (fhandler_nodevice): Remove commented out function declaration. * fhandler_console.cc: Use get_ttyp() instead of tc() throughout. (fhandler_console::dup): Define new function to set controlling ctty on dup, as appropriate. (fhandler_console::ioctl): Reflect ioctl_termios name change. (fhandler_console::setup): Rename from get_tty_stuff. (fhandler_console::open_setup): Reflect argument change in pinfo::set_ctty. (fhandler_console::fhandler_console): Set _tc here. * fhandler_termios.cc (handler_termios::ioctl): Rename. Take a void * arg like other ioctl functions. * fhandler_tty.cc (fhandler_pty_slave::dup): Call myself->set_ctty to potentially reset the controlling terminal. (fhandler_pty_slave::ioctl): Reflect name/arg change for ioctl_termios. (fhandler_pty_slave::fhandler_pty_slave): Take a "unit" argument. Call setup() here so that we will know the unit number of this fhandler as soon as possible. Set the unit as appropriate. (handler_pty_master::open): Move most stuff to constructor and open_setup. (handler_pty_slave::open_setup): Reflect argument change in pinfo::set_ctty. (handler_pty_master::open_setup): Define new function. (fhandler_pty_master::cleanup): Clear handles as a flag that the destructor does not have to do "close" operations. (fhandler_pty_master::close): Ditto. (fhandler_pty_master::~fhandler_pty_master): Define new method. (fhandler_pty_master::ioctl): Reflect name/arg change for ioctl_termios. (fhandler_pty_master::setup): Allocate tty here. Rely on handles being returned from allocated test rather than opening them here. Avoid setting _need_nl here since it is already zeroed in the constructor. Set up device information with DEV_TTYM_MAJOR. * path.h (path_conv &operator =): Take a const argument. (path_conv::dup): Ditto. (pathconv_arg::PC_OPEN): New enum. (pathconv_arg::PC_CTTY): Ditto. (path_types::PATH_CTTY): Ditto. (path_types::PATH_OPEN): Ditto. (path_conv::isopen): New method. (path_conv::isctty_capable): Ditto. * path.cc (path_conv::check): Set PATH_OPEN and PATH_CTTY as appropriate. * pipe.cc (fhandler_pipe::open): Use copyto to copy pipe handle. * syscall.cc (open): Reinstate fd > 2 check to disallow resetting ctty on non-std* handles. * tty.cc (tty_list::allocate): Pass out handles for allocated tty. use `not_allocated' to find unallocated ttys. Avoid keeping the lock since the allocation of the tty should be sufficient to prevent multiple access. (tty::not_allocated): Clarify comment. Rename. Return handles when an unused tty is found. Simply test for existing tty. (tty::exists): Rewrite to use `not_allocated'. * tty.h (NTTYS): Reset down to actual number supported by devices.in. (tty::not_allocated): Declare new function. (tty_list::allocate): Pass out read/write tty handles. Zero them when not found. * fhandler_proc.cc: Reflect name change from FH_PTYM -> FH_PTMX. * pinfo.h (pinfo::set_ctty): Reduce/reorder arguments passed in. * pinfo.cc (pinfo::set_ctty): Ditto. Just use tc() built into the passed-in fhandler_termios pointer. Return true if ctty is assigned. * syscalls.cc (open): Call build_fh_pc with PC_OPEN flag. Set PC_CTTY if appropriate. (stat_worker): Remove is_dev_tty () stuff.
2011-10-12* cygwin.din: Remove some _tc* exports. Add tcgetsid().Christopher Faylor
* dtable.cc (fh_alloc): Revert ill-advised setting of major/minor. Use new is_dev_tty to remember that this device was opened as /dev/tty. * fhandler.cc (fhandler_base::fstat): Remove leftover debugging statement. (fhandler_base::tcgetsid): New function. * fhandler.h ((fhandler_base::tcgetsid): Declare new function. (fhandler_base::is_dev_tty): Ditto. (fhandler_termios::opened_as_dev_tty): Declare new field. (fhandler_termios::is_dev_tty): Declare new function. (fhandler_termios::tcgetsid): Ditto. (fhandler_pty_common::use_archetype): Move here from subclass. (fhandler_pty_slave::use_archetype): Move up. (fhandler_pty_master::use_archetype): Ditto. * fhandler_console.cc (fhandler_console::ioctl): Rename second argument from `buf' to `arg' for consistency. Call ioctl_termios for common fhandler_termios ioctl handling. * fhandler_tty.cc (fhandler_pty_slave::ioctl): Call ioctl_termios for common fhandler_termios ioctl handling. (fhandler_pty_master::ioctl): Ditto. * fhandler_termios.cc (fhandler_termios::tcgetsid): Implement new function. (fhandler_termios::ioctl_termios): Ditto. Implements TIOCSCTTY handling. * syscalls.cc (stat_worker): Set /dev/tty device info when appropriate. * termios.cc (tcgetpgrp): Avoid extraneous "isatty" check. (tcgetsid): Implement new function. * include/cygwin/version.h: Bump CYGWIN_VERSION_API_MINOR to 253. * include/sys/termios.h (TIOCSCTTY): Define.
2011-10-10* fhandler_tty.cc (fhandler_pty_slave::open): Clarify debugging output.Christopher Faylor
(fhandler_pty_slave::open): Change ENOENT to ENXIO when can't open a tty.
2011-07-25 * fhandler_console.cc (fhandler_console::ioctl): Fetch console eventsCorinna Vinschen
using PeekConsoleInput and return only key down events in buf. * fhandler_tty.cc (fhandler_pty_slave::ioctl): Always return EINVAL if PeekNamedPipe fails. (fhandler_pty_master::ioctl): Ditto.
2011-07-22 * fhandler_tty.cc (fhandler_pty_slave::ioctl): Drop FIONBIO case.Corinna Vinschen
Handle FIONREAD. (fhandler_pty_master::ioctl): Ditto. Call fhandler_base::ioctl to decode default condition. * fhandler_console.cc (fhandler_console::ioctl): Handle FIONREAD.
2011-07-22Corinna Vinschen <corinna@vinschen.de>Christopher Faylor
* fhandler.cc: Add #include for asm/socket.h for dealing with FIONREAD. (fhandler_base::ioctl): Special-case errno for FIONREAD. * fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Rename parameter for consistency. Call fhandler_base::ioctl to decode default condition. * fhandler_serial.cc (fhandler_serial::ioctl): Ditto. * fhandler_tty.cc (fhandler_pty_slave::ioctl): Call fhandler_base::ioctl to decode default condition. * fhandler_windows.cc (fhandler_windows::ioctl): Ditto.
2011-07-11* fhandler_tty.cc (fhandler_pty_slave::ioctl): Remove erroneous support forChristopher Faylor
TIOCLINUX for pty. Get rid of unneeded EINVAL handling in wake of tty removal. Remove now-unneeded variable.
2011-07-04* fhandler.cc (fhandler_base::open_with_arch): Call close_on_exec last to avoidChristopher Faylor
setting close_on_exec for archetype. * fhandler_tty.cc (fhandler_pty_master::setup): Protect {from,to}_pty handles. Use consistent naming in debug output. Use inheritable handles and... (fhandler_pty_master::fixup_after_fork): ...avoid duplicating handles here. (fhandler_pty_slave::open): Don't set close_on_exec flag here.
2011-06-22 * fhandler_tty.cc (fhandler_pty_master::setup): Create pty pipesCorinna Vinschen
non-inheritable.
2011-06-22 * fhandler_tty.cc (fhandler_pty_master::setup): Fix crash in debugCorinna Vinschen
output.
2011-06-15* cygheap.h (init_cygheap::ctty_on_hold): Remove conditionalized variable.Christopher Faylor
* dcrt0.cc (do_exit): Remove code which handled CYGWIN=tty style ttys. * devices.in: Remove "/dev/ttym". * dtable.cc: Rename tty to pty where appropriate throughout. (dtable::stdio_init): Use new t->is_console rather than using now-deleted hwnd element in tty structure. (dtable::init_std_file_from_handle): Remove code which handled CYGWIN=tty style ttys. (fh_alloc): Ditto. * fhandler.h: Rename tty to pty where appropriate. (fhandler_pty_common): Delete output_done_event, ioctl_request_event, ioctl_done_event. (fhandler_pty_master::setup): Delete argument. (fhandler_tty_master): Delete. (fhandler_union): Delete __tty_master. * fhandler_console.cc (use_tty): Delete. (fhandler_console::get_tty_stuff): Set is_console to true rather than calling sethwnd. (fhandler_console::send_winch_maybe): Remove CYGWIN=tty considerations. (fhandler_console::input_tcsetattr): Ditto. * fhandler_termios.cc (fhandler_termios::tcsetpgrp): Use new t->is_console rather than using now-deleted hwnd element in tty structure. * fhandler_tty.cc: Rename tty to pty where appropriate throughout. (tty_master): Delete. (process_input): Ditto. (process_output): Ditto. (process_ioctl): Ditto. (fhandler_tty_master::*): Ditto. (fhandler_pty_master::process_slave_output): Remove CYGWIN=tty considerations. (fhandler_pty_slave::open): Ditto for *_done_event. (fhandler_pty_slave::write): Ditto. (fhandler_pty_slave::ioctl): Ditto. (fhandler_pty_slave::fch_open_handles): Ditto. (fhandler_pty_slave::fch_set_sd): Ditto. (fhandler_pty_slave::fch_close_handles): Ditto. (fhandler_pty_common::close): Ditto. (fhandler_pty_master::setup): Ditto. Remove now-unneeded ispty parameter. (fhandler_pty_master::open): Reflect argument removal for tty::allocate. * select.cc: Rename tty to pty where appropriate throughout. * sigproc.cc (proc_subproc): Remove CYGWIN=tty considerations. * tty.cc (ttyslot): Accommodate CYGWIN=tty removal. (tty_list::init_session): Ditto. (tty_list::attach): Ditto. (tty::create_master): Delete. (tty_list::terminate): Ditto. (tty_list::allocate): Delete "with_console" parameter. Remove CYGWIN=tty considerations. (tty::init): Set is_console = false. Use 'false' for was_opened since it is a boolean. * tty.h (*_{DONE,REQUEST}_EVENT): Delete. (tty_min::is_console): Declare new field which replaces hwnd. (tty_min::gethwnd): Delete. (tty_min::sethwnd): Ditto. (tty_list::allocate): Delete parameter. (tty_list::terminate): Delete declaration. * include/sys/cygwin.h (PID_USETTY): Redefine to PID_UNUSED1 and change comment to reflect its availability.
2011-06-14* fhandler_tty_slave.cc (fhandler_tty_slave::fhandler_tty_slave): RevertChristopher Faylor
previous change since unit 0 is perfectly valid.
2011-06-13Rename FH_BAD to FH_NADA throughout.Christopher Faylor
* devices.h (FH_ERROR): New value. (iscons_dev): Extend to detect all the console device types. * devices.in: Set aside storage for FH_ERROR. * dtable.cc (dtable::init_std_file_from_handle): Use iscons_dev to detect when device is a console. (fh_alloc): Pass device to console constructor. (build_fh_pc): Short circuit when we detect that the constructor saw an error. * fhandler.h (fhandler_console::fhandler_console): Accept fh_devices parameter. (get_tty_stuff): Change to void. * fhandler_console (fhandler_console::set_unit): Set device to FH_ERROR on attempt to access anything other than the current console. (fhandler_console::get_tty_stuff): Change to void return. (fhandler_console::open): Return EPERM on FH_ERROR device type. (fhandler_console::fhandler_console): Set the device type appropriately before calling get_tty_stuff and rely on that function to reset it if necessary.
2011-06-06whitespace eliminationChristopher Faylor
2011-06-04* fhandler.cc (fhandler_base_overlapped::wait_overlapped): Only raise SIGPIPEChristopher Faylor
when writing. * fhandler.h: Include "tty.h". (fhandler_termios::_tc): Rename from tc. (fhandler_termios::tc): New method. (fhandler_termios::tcinit): Remove an argument. (fhandler_termios::get_ttyp): Use method to retrieve value. (fhandler_console::console_state): Move here. (fhandler_console::dev_state): Delete. (fhandler_console::shared_console_info): Define. (fhandler_console::open_shared_console): Move this function under fhandler_console umbrella. (fhandler_console::tc): Define. Return static value. (fhandler_console::focus_aware): Accommodate deletion of dev_state. (fhandler_console): Add tty_list::get_cttyp as a friend. * fhandler_console.cc (dev_state): Redefine as a pointer within shared_console_info and change dev-> to dev. throughout. (fhandler_console::shared_console_info): Move into fhandler_console. (fhandler_console::open_shared_console): Move into fhandler_console change argument to simple bool. (enum_windows): Accommodate changes to console_state and open_shared_console. (console_unit::console_unit): Ditto. (fhandler_console::get_tty_stuff): Accommodate change to dev_state. (tty_list::get_cttyp): Accommodate change to handler_console::shared_console_info. (fhandler_console::read): Accommodate change from tc to tc (). (fhandler_console::set_input_state): Ditto. (fhandler_console::open): Accommodate tcinit argument change and change from tc to tc(). (fhandler_console::input_tcsetattr): Accomodate change from tc to tc(). (fhandler_console::input_tcsetattr): Ditto. (fhandler_console::write_normal): Ditto. (fhandler_console::init): Ditto. (fhandler_console::igncr_enabled): Ditto. * fhandler_termios.cc (fhandler_termios::tcinit): Remove first argument. Expect tc() to have been set up first. Use tc() rather than tc. (fhandler_termios::tcsetpgrp): Accomodate change from tc to tc(). (fhandler_termios::tcgetpgrp): Ditto. (fhandler_termios::bg_check): Ditto. (fhandler_termios::line_edit: Ditto. (fhandler_tty_master::set_winsize): Ditto. (fhandler_tty_slave::open): Ditto. (fhandler_tty_slave::init): Ditto. (fhandler_pty_master::write): Ditto. (fhandler_pty_master::setup): Ditto. Accommodate change in arguments to tcinit. (fhandler_tty_slave::fch_open_handles): Set _tc directly. (tty_min::is_orphaned_process_group): Don't assume that parent pid exists. * pinfo.cc (_pinfo::set_ctty): Reset myself->{pgid,sid} here if we were started by a non-Cygwin process but the tty exists. * shared_info.h (console_state): Delete from here. * tty.h: Make multiple inclusion safe.
2011-05-28* autoload.cc: Call _api_fatal in asm.Christopher Faylor
* child_info.h: Redefine CURR_CHILD_INFO_MAGIC. (child_info_fork::abort): Rename from handle_failure. Change arguments. * cygtls.h (_local_storage::ttybuf): New field. * dcrt0.cc (vapi_fatal): Split api_fatal. Add "in forked process" to message when appropriate. (api_fatal): Use vapi_fatal. * devices.h: Make multiple inclusion safe. (fh_devices): Add FH_CONS* stuff. Reorder slightly. (device): Eliminate anonymous union. Add more ways to access minor/major. (device::setunit): Accommodate no-longer-anonymous union. (device::is_fs): Ditto. (device::is_fs_special): Ditto. (device::major): New function. (device::minor): Ditto. (device::is_device): New function. (device::not_device): Ditto. (device::operator int): New operator. (device::operator fh_devices): Ditto. (device::operator bool): Ditto. (device::operator DWORD): Ditto. (device::operator =): Ditto. (isproc_dev): New function. (isprocsys_dev): Ditto. (iscons_dev): Ditto. (istty_slave_dev): Ditto. * devices.in: Add new "/dev/cons*" strings. Accommodate no-longer-anonymous union throughout. (BRACK): Use more precise method for initialization. * devices.cc: Regenerate. * dtable.cc (dtable::stdio_init): Use get_cttyp instead of get_tty. (dtable::find_archetype): Use new DWORD operator in device to test archetypes. (dtable::init_std_file_from_handle): Use different method to initialize 'dev'. Adapt to different ctty handling and accommodate /dev/cons*. (fh_alloc): Accommodate no-longer-anonymous union. Adapt to new /dev/cons*. (build_fh_pc): Make debugging output more useful. * exceptions.cc (ctrl_c_handler): Use get_cttyp instead of get_tty. * external.cc (fillout_pinfo): Accommodate new cons* stuff. * fhandler.cc (fhandler_base::read): Eliminate is_slow() test. * fhandler.h (fhandler_base::*): Adapt to changes in device.h. (fhandler_*::is_slow): Delete. ( fhandler_proc::get_proc_fhandler): Return fh_devices type. * fhandler_console.cc (open_shared_console): New function. (console_unit): New class. (console_unit::console_unit): New constructor. (enum_windows): New function. Declare as friend to console_unit. (fhandler_console::set_unit): New function. (fhandler_console::get_tty_stuff): Call set_unit to set the unit number and determine if initialization is needed. Eliminate flags parameter. (tty_list::get_cttyp): Rename (sorta) from get_tty. Return pointer to correct tty_min. (fhandler_console::open): Adapt to elimination of argument to get_tty_stuff. (fhandler_console::output_tcsetattr): Properly detect error condition. (fhandler_console::fixup_after_fork_exec): Adapt to get_tty_stuff() setting tc automatically. * fhandler_proc.cc: Use FH_BAD rather than 0 throughout where using fh_devices enum. (fhandler_proc::get_proc_fhandler): Return fh_devices. Adapt to devices.h changes. * fhandler_process.cc: Adapt to devices.h changes. Use FH_BAD rather than 0 throughout where using fh_devices enum. * fhandler_procnet.cc: Ditto. * fhandler_procsys.cc: Ditto. * fhandler_procsysvipc.cc: Ditto. * fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Ditto. * fhandler_termios.cc (handler_termios::bg_check): Use tc->ttyname() rather than assuming that we can construct a tty. * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Just return get_minor() of dev. (fhandler_pty_master::process_slave_output): Add slightly more debugging info. (fhandler_tty_slave::fhandler_tty_slave): Change name from ntty to unit. (fhandler_pty_master::open): Ditto. (fhandler_tty_slave::ioctl): Adapt to change which causes ctty to represent a complete device. (fhandler_tty_master::init_console): Add debugging for failure path. (fhandler_pty_master::setup): Use get_unit() to retrieve unit number rather than relying on raw ntty. (fhandler_pty_master::setup): Ditto. * fhandler_virtual.h (virt_tab_t): Redefine fhandler as fh_devices. * fork.cc: Remove obsolete vfork stuff. (frok::child): Don't assume that a ctty == 0 is valid. * mount.cc (mount_info::conv_to_win32_path): Adapt to device struct changes. (mount_info::conv_to_win32_path): Ditto. * path.cc (path_conv::check): Retrive major/minor numbers via a method rather than accessing them directly from device. Rely on dev operators to set/retrieve device information as required by device struct change. * path.h (isproc_dev): Move to devices.h. (isprocsys_dev): Ditto. (isvirtual_dev): Ditto. (path_conv:{isdevice,isfifo,isspecial,iscygdrive,issocket,get_devn,get_unitn}): Use device methods to access/manipulate devices. * pinfo.cc (pinfo::exit): Don't assume that ctty == 0 is valid. Use iscons_dev to determine if a device is a console. (_pinfo::_ctty): Use device::parse to generate tty/cons name. (_pinfo::set_ctty): Don't assume that ctty == 0 is valid. Remove redundant info from debugging. * shared.cc (offsets): Remove console offset. * shared_info.h (shared_locations): Ditto. * syscalls.cc (umask): Use device methods to manipulate device information. (ctermid): Use device::parse to generate term device name. * tlsoffsets.h: Regenerate. * tty.cc (ttyslot): Return minor number of ctty since ctty now represents a full device. (tty::create_master): Set ctty to a complete device. (tty_list::attach): Rework to detect new /dev/cons* stuff. (tty_list::terminate): Adapt to changes to ctty. (tty_list::init): Adapt to change to setntty - pass in device major number. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Define new function. * tty.h (tty_min::ntty): Redefine as fh_devices. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Declare new function. (tty::getntty): Declare as const. (tty_list::operator []): Assure that only minor part of argument is used. * dll_init.cc (dll_list::alloc): Detect mismatch of data segments early issuing an explicit error message if necessary. * heap.cc (heap_init): Adapt to changes from fork->handle_failure to fork->abort. * pinfo.h (EXITCODE_FORK_FAILED): New enum. (from Ryan Johnson) * sigproc.cc (child_info_fork::abort): Rename from handle_failure. Change arguments to allow passing in a printf-like message. * winsup.h (api_fatal): Delete macro definition. (api_fatal): Redefine from __api_fatal. (vapi_fatal): Declare new function. * include/sys/strace.h (strace_vprintf): Define new macro. * ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemHandleInformation.
2011-05-06* fhandler.h (fhandler_dev_dsp): Cosmetic change.Christopher Faylor
* fhandler_tty.cc (fhandler_pty_master::process_slave_output): Put back Sleep(10) for tty_master case. * sigproc.cc (stopped_or_terminated): Don't consider a pid which has been reaped to be terminated.
2011-05-06* cygheap.cc (cygheap::close_ctty): Close ctty via close_with_arch().Christopher Faylor
* debug.cc (close_handle): Call debugger on failure. * devices.in (device::tty_to_real_device): Delete. * devices.h (device::tty_to_real_device): Ditto. * devices.cc: Regenerate. * dtable.cc: Delete old ifdef'ed vfork code. (dtable::release): Don't handle archetype here. (dtable::init_std_file_from_handle): Consolidate console tests. Generate major/minor for tty ASAP. Fix incorrect setting of DEV_TTYS* for serial. (fh_alloc): New function derived from build_fh_pc. Pass current tty when building tty. (build_pc_pc): Use fh_alloc to create. Set name from fh->dev if appropriate. Generate an archetype or point to one here. (dtable::dup_worker): Deal with archetypes. Rely on = operator copying whole class rather than just fhandler_base. (dtable::fixup_after_exec): Call close_with_arch to handle closing of fhandlers with archetypes. * fhandler.cc (fhandler_base::operator =): Call memcpy with fhandler's size() rather than sizeof fhandler_base. (fhandler_base::open_with_arch): New function. Handles opening of fhandler's with archetypes, dealing with usecounts, etc. (fhandler_base::close_with_arch): Ditto for close. * fhandler.h: Many changes for archetypes. (fhandler_base::set_name): Set both normalized path and regular path. (fhandler_base::open_with_arch): New function. (fhandler_base::open_setup): Ditto. (fhandler_base::use_archetype): Ditto. (fhandler_base::_archetype_usecount): Ditto. (fhandler_*::size): Ditto. (fhandler_dev_tape::open): Remove virtual decoration. (fhandler_console::use_archetype): New function. Return true. (fhandler_console::open_setup): New function. (fhandler_console::dup): Delete. (fhandler_tty_slave::fhandler_tty_slave): Redeclare to take an argument. (fhandler_tty_slave::use_archetype): New function. Return true. (fhandler_tty_slave::cleanup): New function. (fhandler_pty_master::use_archetype): New function. Return true. (fhandler_pty_master::cleanup): New function. (fhandler_pty_master::is_tty_master): New function. Return false. (fhandler_tty_master::is_tty_master): New function. Return true. (fhandler_dev_dsp::fhandler_dev_dsp): New function. Return true. (report_tty_counts): Only report on archetype's usecount if there is one. * fhandler_console.cc (fhandler_console::get_tty_stuff): Remove handling of setsid, set_ctty, set_flags, and manage_console_count. (fhandler_console::open_setup): New function. Implement functionality removed from get_tty_stuff. (fhandler_console::dup): Delete. (fhandler_console::output_tcsetattr): Set errno on error. (fhandler_console::fhandler_console): Set device early. (fhandler_console::init): Use open_with_arch to open console handles. (fhandler_console::fixup_after_fork_exec): Nuke most of the stuff for dealing with console handles. * fhandler_dsp.cc (fhandler_dev_dsp::open): Remove archetype handling. (fhandler_dev_dsp::write): Ditto. (fhandler_dev_dsp::read): Ditto. (fhandler_dev_dsp::close): Ditto. (fhandler_dev_dsp::dup): Ditto. (fhandler_dev_dsp::ioctl): Ditto. (fhandler_dev_dsp::fixup_after_fork): Ditto. (fhandler_dev_dsp::fixup_after_exec): Ditto. * fhandler_tty.cc (fhandler_tty_common::__acquire_output_mutex): Add a little more debugging. (fhandler_tty_common::__release_output_mutex): Ditto. (fhandler_pty_master::process_slave_output): Ditto. Don't do signal handling or pthread_cancel handling in the tty master thread. (process_output): Minor reorg. (fhandler_tty_slave::fhandler_tty_slave): Set device based on new ntty argument. (fhandler_tty_slave::open): Remove archetype handling. Move some processing into open_setup(). (fhandler_tty_slave::open_setup): New function. (fhandler_tty_slave::cleanup): New function. (fhandler_tty_slave::close): Remove archetype handling. Move some processing into cleanup(). (fhandler_tty_slave::init): Rename argument from f to h. Open device using open_with_arch(). Remove archetype handling. (fhandler_pty_master::dup): Ditto. (fhandler_pty_master::open): Ditto. (fhandler_pty_master::close): Ditto. Move some handling to cleanup(). (fhandler_pty_master::cleanup): New function. (fhandler_tty_master::init_console): Give unique name to captive console fhandler. * pinfo.cc (_pinfo::set_ctty): Rename argument from arch to fh. Eliminate archetype assumption. * syscalls.cc (close_all_files): Use close_with_arch for closing. (open): Use open_with_arch() rather than open(). (close): Use close_with_arch() rather than close().