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
2016-04-05Revert "Refactor to avoid nonnull checks on "this" pointer."Corinna Vinschen
This reverts commit 0008bdea02b690ab19ffe997499cb9a96ee5a66d. This patch introduced a regression. Calling FOO=$(...) in zsh hangs indefinitely and has to be killed forcefully. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-04-04Refactor to avoid nonnull checks on "this" pointer.Peter Foley
G++ 6.0 asserts that the "this" pointer is non-null for member functions. Refactor methods that check if "this" is non-null to resolve this. winsup/cygwin/ChangeLog: external.cc (cygwin_internal): Check for a null pinfo before calling cmdline. fhandler_dsp.cc (Audio::blockSize): Make static. fhandler_dsp.cc (Audio_in): add default_buf_info. fhandler_dsp.cc (Audio_out): Ditto. fhandler_dsp.cc (Audio_out::buf_info): Refactor method to call default_buf_info if dev_ is null. fhandler_dsp.cc (Audio_in::buf_info): Ditto. fhandler_dsp.cc (fhandler_dev_dsp::_ioctl): Call Audio_out::default_buf_info if audio_out_ is null. fhandler_dsp.cc (fhandler_dev_dsp::_ioctl): Call Audio_in::default_buf_info if audio_in_ is null. fhandler_process.cc (format_process_fd): Check if pinfo is null. fhandler_process.cc (format_process_root): Ditto. fhandler_process.cc (format_process_cwd): Ditto. fhandler_process.cc (format_process_cmdline): Ditto. signal.cc (tty_min::kill_pgrp): Ditto. signal.cc (_pinfo::kill0): Ditto. sigproc.cc (pid_exists): Ditto. sigproc.cc (remove_proc): Ditto. times.cc (clock_gettime): Ditto. times.cc (clock_getcpuclockid): Ditto. path.cc (cwdstuff::override_win32_cwd): Check if old_cwd is null. path.cc (fcwd_access_t::Free): Factor null check of "this" out to caller(s). pinfo.cc (_pinfo::exists): Ditto. pinfo.cc (_pinfo::fd): Ditto. pinfo.cc (_pinfo::fds): Ditto. pinfo.cc (_pinfo::root): Ditto. pinfo.cc (_pinfo::cwd): Ditto. pinfo.cc (_pinfo::cmdline): Ditto. signal.cc (_pinfo::kill): Ditto. pinfo.cc (_pinfo::commune_request): remove non-null check on "this", as this method is only called from pinfo.cc after null checks pinfo.cc (_pinfo::pipe_fhandler): remove non-null check on "this", as this method is only called from pipe.cc (fhandler_pipe::open) after a null check. Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2015-11-05Fix iterating over pending signals if a signal doesn't have to be clearedCorinna Vinschen
* sigproc.cc (pending_signals::clear): Yet another fix to fix the fix. Actually iterate over the list of pending signals even if there's a signal which doesn't have to be cleared. Other than that, revert loop to it's former self as a while loop. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-03Fix potential endless loop in pending_signals::clearCorinna Vinschen
* sigproc.cc (pending_signals::clear): Fix previous fix resulting in yet another endless loop. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-02Fix incorrect implementation to clear per-thread pending signalsCorinna Vinschen
* sigproc.cc (class pending_signals): Drop sigproc_init friendship. (pending_signals::clear): Fix implementation to avoid subsequent endless loop in wait_sig. Improve comment. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-10-23Clear pending signals targeting exiting threadnewlib-snapshot-20151023Corinna Vinschen
* cygtls.cc (_cygtls::remove): Call remove_pending_sigs. * cygtls.h (_cygtls::remove_pending_sigs): Declare. * sigproc.cc (pending_signals::clear): Define new method taking a _cygtls pointer argument. Drop pending signals for that thread. (_cygtls::remove_pending_sigs): Call pending_signals::clear for this thread. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-24Sigproc.cc: Fix copyright.newlib-snapshot-20150824Corinna Vinschen
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-08-24Fix hang stracing forking processes but not following childCorinna Vinschen
* ntdll.h (PROCESSINFOCLASS): Define ProcessDebugFlags. * sigproc.cc (child_info::child_info): Only propagate _CI_STRACED to child if strace is actually tracing child processes. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2014-11-28 * cygheap.cc (init_cygheap::init_tls_list): Accommodate threadlistCorinna Vinschen
having a new type threadlist_t *. Convert commented out code into an #if 0. Create thread mutex. Explain why. (init_cygheap::remove_tls): Drop timeout value. Always wait infinitely for tls_sentry. Return mutex HANDLE of just deleted threadlist entry. (init_cygheap::find_tls): New implementation taking tls pointer as search parameter. Return threadlist_t *. (init_cygheap::find_tls): Return threadlist_t *. Define ix as auto variable. Drop exception handling since crash must be made impossible due to correct synchronization. Return with locked mutex. * cygheap.h (struct threadlist_t): Define. (struct init_cygheap): Convert threadlist to threadlist_t type. (init_cygheap::remove_tls): Align declaration to above change. (init_cygheap::find_tls): Ditto. (init_cygheap::unlock_tls): Define. * cygtls.cc (_cygtls::remove): Unlock and close mutex when finishing. * exceptions.cc (sigpacket::process): Lock _cygtls area of thread before accessing it. * fhandler_termios.cc (fhandler_termios::bg_check): Ditto. * sigproc.cc (sig_send): Ditto. * thread.cc (pthread::exit): Ditto. Add comment. (pthread::cancel): Ditto.
2014-11-22 * init.cc (dll_entry): Revert previous patch. This requires anotherCorinna Vinschen
solution. * miscfuncs.cc (thread_wrapper): Ditto. * sigproc.cc (exit_thread): Disable sending a signal for synchronization with process exit. Explain why. Keep code in for later inspection, should the problem show up again. (sig_send): Use "tls", rather than "tid" as name for _cygtls arg.
2014-07-16* sigproc.cc (sigproc_init): Set aside more buffer space for signal pipes.Christopher Faylor
(sig_send): Retry WriteFiles which fail when there is no error but packbytes have not been sent.
2014-07-15* sigproc.cc (send_sig): Don't report an error if WriteFile succeeds.Christopher Faylor
2014-07-14* sigproc.cc (send_sig): Fix bad format in diagnostic output.Christopher Faylor
2014-03-17* sigproc.h (no_thread_exit_protect): New class.Christopher Faylor
* sigproc.cc (thread_exit): Use no_thread_exit_protect to determine if we need to coordinate ThreadExit/ExitProcess. * fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Use no_thread_exit_protect to kludge around waiting for waveOutClose as it waits for a thread that never exits. (fhandler_dev_dsp::Audio_in::stop): Ditto for waveInClose. * fhandler.h (fhandler_dev_dsp::base): New method. (fhandler_dev_dsp::_read): Ditto. (fhandler_dev_dsp::_write): Ditto. (fhandler_dev_dsp::_ioctl): Ditto. (fhandler_dev_dsp::_fixup_after_fork): Ditto. (fhandler_dev_dsp::_fixup_after_exec): Ditto. * fhandler_dsp.cc (fhandler_dev_dsp::read): Call real function via base() pointer. (fhandler_dev_dsp::write): Ditto. (fhandler_dev_dsp::ioctl): Ditto. (fhandler_dev_dsp::fixup_after_fork): Ditto. (fhandler_dev_dsp::fixup_after_exec): Ditto. (fhandler_dev_dsp::_read): Rename by adding an leading underscore. (fhandler_dev_dsp::_write): Ditto. (fhandler_dev_dsp::_ioctl): Ditto. (fhandler_dev_dsp::_fixup_after_fork): Ditto. (fhandler_dev_dsp::_fixup_after_exec): Ditto.
2014-03-09* sigproc.cc (_cygtls::remove_wq): Reset thread_ev inside of lock. Set to NULLChristopher Faylor
when done.
2014-02-09* sigproc.cc (sig_send): Don't bother with an error message if we are exiting.Christopher Faylor
2013-12-18* external.cc (fillout_pinfo): Remove nonsensical loop.Christopher Faylor
* fork.cc (frok::parent): When initializing pinfo for child new PID_NEW flag + actual defined constant rather than raw number. Don't set start_time here. * pinfo.cc (pinfo::thisproc): Use PID_NEW when initializing pinfo. Avoid checking h for NULL multiple times. Don't set start_time here. (pinfo_init): Aways set ppid last. Tweak strace output. (pinfo::init): Handle new PID_NEW flag. Wait for shared memory to contain useful information. Set start_time if PID_NEW. (_onreturn:h): Define as HANDLE rather than HANDLE *. (_onreturn::~onreturn): Accommodate h definition change. (_onreturn::no_close_handle): Rename from no_close_p_handle. Take a pinfo arg and set hProcess to h before zeroing. (winpids::add): Don't open a handle to our own process. Change logic associated with when a handle gets closed. Accommodate no_close_handle changes. (winpids::enum_processes): Simplify process enumeration loop. (winpids::set): Eliminate ill-considered malloc locking. * sigproc.cc (proc_subproc): Always set ppid last.
2013-12-18* sigproc.cc (sig_send): Set PIPE_NOWAIT for pipes which are not us.Christopher Faylor
2013-12-10* globals.cc (hntdll): Define/declare.Christopher Faylor
* exceptions.cc (inside_kernel): Don't call GetModuleFileName if we know we're in ntdll. * sigproc.cc (wait_sig): Initialize hntdll.
2013-08-30* sigproc.cc (pending_signals::add): Properly maintain linked list.Christopher Faylor
(wait_sig): Use already calculated 'next' element when signal is blocked.
2013-06-07* DevNotes: Add entry cgf-000023.Christopher Faylor
* sigproc.cc (exit_thread): Remove now-unneeded sleep code.
2013-06-03 * sigproc.cc (exit_thread): Allow to exit the thread while runningCorinna Vinschen
global dtors. Explain why.
2013-05-16* sigproc.cc (sig_hold): Delete.Christopher Faylor
(sigheld): Delete. (sig_send): Eliminate special-case __SIGHOLD handling. (wait_sig): Just flag when signals are on hold and add them to the queue rather than stalling the wait_sig loop. Clear the flag when __SIGNOHOLD is specified.
2013-04-23 * Merge in cygwin-64bit-branch.Corinna Vinschen
2013-04-09* cygtls.h (_cygtls::reset_signal_arrived): Actually reset the signal_arrivedChristopher Faylor
event. (_cygtls::handle_SIGCONT): Declare ew function. * cygwait.cc (is_cw_sig_handle): Delete. (is_cw_sig_cont): New convenience define. (cygwait): Clear signal if is_cw_sig_cont and we got a SIGCONT. * cygwait.h (cw_wait_mask): Add cw_sig_cont. * exceptions.cc (sig_handle_tty_stop): Tighten "incyg" region. Use cw_sig_cont param for cygwait. Don't zero signal here outside of lock. (sigpacket::setup_handler): Don't check for in_forkee since we will now never get here in that state. (_cygtls::handle_SIGCONT): Define new function. (sigpacket::process): Call handle_SIGCONT early to deal with SIGCONT. Nuke continue_now handling. Allow SIGKILL to kill a suspended process. Delete a couple of now-unneeded labels. (_cygtls::call_signal_handler): Reorganize setting of incyg within lock. * sigproc.cc (pending_signals): Simplify. (pending_signals::clear): New method. (_cygtls::remove_wq): Reorganize to always close wq.thread_ev if it exists to avoid handle leaks. (sig_clear): Simplify by just calling sigq.clear(). (sig_dispatch_pending): Always call sigq.pending even in signal thread to force another loop in wait_sig. (sig_send): Remove a "goto out" just before out: label. (pending_signals::add): Simplify. (pending_signals::del): Delete. (pending_signals::next): Delete. (wait_sig): Define variable q to be the start of the signal queue. Just iterate through sigq queue, deleting processed or zeroed signals. Only set clearwait when the current signal is SIGCHLD. * sigproc.h: Add a comment about an unused enum.
2013-03-31* child_info.h (cygheap_exec_info::sigmask): Declare new field.Christopher Faylor
* cygheap.cc (init_cygheap::find_tls): Rename threadlist_ix -> ix. Only take one pass through thread list, looking for eligible threads to signal. Set a new param indicating that function has found a sigwait* mask. * cygheap.h (init_cygheap::find_tls): Reflect new parameter. * dcrt0.cc (parent_sigmask): New variable. (child_info_spawn::handle_spawn): Save parent's signal mask here. (dll_crt0_1): Restore parent's signal mask to tls sigmask as appropriate. Call sig_dispatch_pending to flush signal queue when we can finally do something with signals. * exceptions.cc (sigpacket::process): Avoid attempting to handle signals if we haven't finished initializing. Rely on the fact that find_tls will do mask checking and don't do it again. Delete ill-named 'dummy' variable. * sigproc.cc (cygheap_exec_info::alloc): Save calling thread's signal mask in new sigmask field. (wait_sig): Try to debug when WFSO fails and DEBUGGING is defined. * thread.cc (pthread::set_tls_self_pointer): Make this a true automatic method rather than inexplicably relying on a thread parameter. (pthread::thread_init_wrapper): Accommodate set_tls_self_pointer change to non-static. Initialize sigmask before setting tid or suffer signal races. * ehread.h (pthread::set_tls_self_pointer): Make non-static, delete parameter.
2013-03-29* sigproc.cc (wait_sig): Avoid uninitialized use of nb when retrying.Christopher Faylor
Consolidate two error messages into one.
2013-03-29* sigproc.cc (pending_signals::retry): Declare new element.Christopher Faylor
(pending_signals::pending): Force an additional loop through wait_sig by setting retry whenever this function is called. (sig_send): Reorganize to wait for SIGHOLD at bottom. Always add signal to pending queue and work on whole queue rather than just the one signal. Loop when sigq.retry is set. Fix long-broken check for SIGCHLD after queued signals.
2013-01-21Throughout, change __attribute__ ((regparm (N))) to just __regN. Throughout,Christopher Faylor
(mainly in fhandler*) start fixing gcc 4.7.2 mismatch between regparm definitions and declarations. * gendef: Define some functions to take @ declaration to accommodate _regN defines which use __stdcall. * gentls_offsets: Define __regN macros as empty. * autoload.cc (wsock_init): Remove unneeded regparm attribute. * winsup.h (__reg1): Define. (__reg2): Define. (__reg3): Define. * advapi32.cc (DuplicateTokenEx): Coerce some initializers to avoid warnings from gcc 4.7.2. * exceptions.cc (status_info): Declare struct to use NTSTATUS. (cygwin_exception::dump_exception): Coerce e->ExceptionCode to NTSTATUS. * fhandler_clipboard.cc (cygnativeformat): Redefine as UINT to avoid gcc 4.7.2 warnings. (fhandler_dev_clipboard::read): Ditto.
2013-01-20* sigproc.cc (sig_dispatch_pending): Add correct regparm attributes to matchChristopher Faylor
declaration. (pid_exists): Ditto. (proc_subproc): Ditto. (sig_clear): Ditto. (sig_send): Ditto. (checkstate): Ditto.
2013-01-19* exceptions.cc (ctrl_c_handler): Remove special-case handler forChristopher Faylor
"cygwin_finished_initializing". * sigproc.cc (exit_thread): Undefine ExitThread earlier to avoid recursion on error return.
2013-01-17* sigproc.cc (no_signals_available): Finally remove this macro entirely.Christopher Faylor
(exit_thread): Ensure process lock is released on error exit. (sig_send): Simplify "its_me" test. Remove no_signals_available tests.
2013-01-14* exceptions.cc (signal_exit): Move captive process termintation...Christopher Faylor
(_cygtls::interrupt_setup): ...into here. (sigpacket::process): Simplify setting of handler when have_execed. (_cygtls::interrupt_setup): Don't call proc_subproc when we've execed. * globals.cc (exit_states): Delete unneeded ES_EXEC_EXIT. * pinfo.cc (pinfo::exit): Change debugging output. Call proc_terminate rather than the now-obsolete sigproc_terminate. Don't set exit_state to ES_EXEC_EXIT. Set exit_state to ES_FINAL later. * sigproc.cc (sigproc_terminate): Delete function. (wait_sig): Don't call proc_subproc if have_execed. * sigproc.h (sigproc_terminate): Delete declaration. * sync.h (lock_process::lock_process): Don't set exit_state to ES_PROCESS_LOCKED. (lock_process::operator LONG): Define.
2013-01-04* globals.cc (exit_states): Renumber so that ES_EXIT_STARTING is first, asChristopher Faylor
intended. * sigproc.cc (wait_sig): Only stop accepting signals after exit_state > ES_EXIT_STARTING.
2013-01-03* sigproc.cc (exit_thread): Set thread signal mask so that no signals are sentChristopher Faylor
to an exiting thread.
2013-01-03* sigproc.cc (no_signals_available): Remove exit_state test since signals areChristopher Faylor
available in a limited fashion when exiting. (sig_dispatch_pending): Ditto. (sig_send): Ditto. (exit_thread): Rearrange to avoid an unnecessary DuplicateProcess when exiting. (wait_sig): Allow special signals when exiting.
2013-01-02* cygtls.h (_cygtls::signal_exit): Delete from class.Christopher Faylor
* exception.h (cygwin_exception): New class. (cygwin_exception::dumpstack): Declare new function. (cygwin_exception::context): Ditto. (cygwin_exception::dump_exception): Ditto. * exceptions.cc (cygwin_exception::dump_exception): Move into cygwin_exception class. Accommodate new variable names. (cygwin_exception::dumpstack): Ditto stackdump -> dumpstack. (exception::handle): Move andreas processing earlier. Defer signal processing decisions to the signal thread where they belong. Pass exception information to sig_send via new siginfo_t si_cyg field. (ctrl_c_handler): Wait for SIGHUP signal to be processed since it could cause a process exit and we don't want races with thread exit lock. (signal_exit): Move back here from sigproc.cc. Modify arguments and remove from sigpacket class. Decide when to dump core based on signal type. (sigpacket::process): Handle exiting signals in context of threads rather than in the signal thread. Signal debugger on non-Windows signals. Remove setup_signal_exit call. * sigproc.cc (no_signals_available): Remove argument. (signal_exit_code): Delete. (close_my_readsig): Ditto. (_cygtls::signal_exit): Move to exceptions.cc. (sigproc_terminate): Don't attempt to terminate signal thread. (setup_signal_exit): Delete. (exit_thread): Use new si_cyg entry in siginfo_t. (sig_send): Just use empty initializer for si. Accommodate change in no_signals_available argument. (wait_sig): Remove attempt to "go asynchronous" on process exit. Delete __SIGEXIT handling. Don't ever exit. * sigproc.h: Remove __SIGEXIT from signal enum. Renumber. * include/cygwin/signal.h (siginfo_t): Add si_cyg entry.
2012-12-31* sigproc.cc (wait_sig): Remove spurious extern.Christopher Faylor
2012-12-28* DevNotes: Add entry cgf-000019.Christopher Faylor
* dcrt0.cc (do_exit): Just set exit_state to ES_EVENTS_TERMINATE and nuke call to events_terminate which just set a superfluous flag. * sigproc.cc (signal_exit_code): New variable. (setup_signal_exit): Define new function. (_cygtls::signal_exit): Remove accommodations for closing the signal pipe handle. (exit_thread): Just sleep if we're exiting. (wait_sig): If signal_exit_code is set, just handle bookkeeping signals and exit ReadFile loop if there is nothing more to process. Call signal_exit at end if signal_exit_code is non-zero. * sigproc.h (setup_signal_exit): Declare new function. * exceptions.cc (sigpacket::process): Use setup_signal_exit to control exiting due to a signal. (exception::handle): Ditto. Query exit_state rather than defunct exit_already to determine if we are exiting. * globals.cc (ES_SIGNAL_EXIT): New enum. * sync.h (lock_process::release): New function for explicitly unlocking muto. (lock_process::~lock_process): Use release method.
2012-12-22* sigproc.cc (exit_thread): undef ExitThread or suffer recursion. Attempt toChristopher Faylor
lock process prior to calling sig_send.
2012-12-22Revert the reversion and go with implementation described in cgf-000017, withChristopher Faylor
some modifications. * init.cc (dll_entry): Revert previous change. * miscfuncs.cc: Include sigproc.h for exit_thread declaration. * winsup.h (ExitThread): Define as 'exit_thread' to ensure no accidental use. * sigproc.cc (exit_thread): New function. (wait_sig): Handle __SIGTHREADEXIT case. Don't just block rather than returning from this function. * sigproc.h (__SIGTHREADEXIT): New enum. (exit_thread): Declare. * sync.cc (muto::release): Accept a tls command-line argument. * sync.h (muto::release): Accept a tls command-line parameter. Default to &_my_tls. * cygerrno.h (__set_errno): Define as extern so that no function code is ever emitted. * cygserver_ipc.h (cygserver_ipc.h): Ditto. * miscfuncs.h (transform_chars): Ditto. * path.h (has_attribute): Ditto. * security.h (privilege_luid): Ditto. * winsup.h (flush_file_buffers): Ditto.
2012-12-21* DevNotes: Add entry cgf-000018.Christopher Faylor
* init.cc (dll_entry): Grab process lock before exiting to ensure that thread doesn't exit before parent if parent is exiting. * _cygtls.cc (_cygtls::call2): Revert previous 2012-12-21 change. * miscfuncs.cc (thread_wrapper): Ditto. * thread.cc (pthread::exit): Ditto. * sigproc.cc (exit_thread): Ditto. (wait_sig): Ditto. * sync.cc (muto::release): Ditto. * sync.h (muto::release): Ditto. * sigproc.h (__SIGTHREADEXIT): Delete enum. (exit_thread): Delete declaration.
2012-12-21* DevNotes: Add entry cgf-000017.Christopher Faylor
* _cygtls.cc (_cygtls::call2): Use new exit_thread function in place of ExitThread. * miscfuncs.cc (thread_wrapper): Ditto. * thread.cc (pthread::exit): Ditto. (pthread_mutex::unlock): Set tid to NULL rather than 0. (pthread_spinlock::unlock): Ditto. * pinfo.cc (commune_process): Actually call lock_process constructor. * sigproc.cc (exit_thread): New function. (wait_sig): Handle __SIGTHREADEXIT case. Don't just block rather than returning from this function. * sigproc.h (__SIGTHREADEXIT): New enum. (exit_thread): Declare. * sync.cc (muto::release): Accept a tls command-line argument. * sync.h (muto::release): Accept a tls command-line parameter. Default to &_my_tls.
2012-12-11* sigproc.h (sig_send): Accept tid as argument #3. Default to NULL.Christopher Faylor
* sigproc.cc (sig_send): Ditto. Pass tid to other sig_send. (sigpending): Send current thread as arg #3.
2012-12-07* sigproc.h (sigpacket): Remove parameter names from declarations.Christopher Faylor
(sigpacket::sigtls): Rename from 'tls'. * exceptions.cc (sigpacket::process): Define local tls variable and assign that to sigtls if appropriate. Clarify debugging output. * sigproc.cc (sig_send): Accommodate tls -> sigtls rename. (pending_signals::add): Ditto. (wait_sig): Ditto.
2012-12-05 * child_info.h (class child_info_spawn): Drop unused member lock.Corinna Vinschen
(CURR_CHILD_INFO_MAGIC): Update. * sigproc.cc (child_info_spawn::child_info_spawn): Drop setting lock.
2012-11-08 * sigproc.cc (proc_subproc): Delete unused variable child.Corinna Vinschen
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-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.