* DevNotes: Add entry cgf-000022.
* cygtls.h (_cygtls::func): Define as a sa_sigaction style function. * exceptions.cc (sig_handle_tty_stop): Ditto. (_cygtls::interrupt_setup): Fix coercion to accommodate 'func' change. (ctrl_c_handler): Use tty kill_pgrp to send a signal. (sigpacket::process): Don't process sigflush here. (_cygtls::call_signal_handler): Reorganize to avoid a race. Always call sa_sigaction style function. * fhandler_termios.cc (is_flush_sig): Define new function. (tty_min::kill_pgrp): Handle tty flush when signal detected. (fhandler_termios::bg_check): Be slightly more paranoid about checking for valid tty. (fhandler_termios::sigflush): Don't flush unless tty owner. * fhandler_tty.cc (fhandler_pty_slave::ioctl): Use tty kill_pgrp to send signal. (fhandler_pty_master::ioctl): Ditto. * signal.cc (killsys): Delete definition. * sigproc.h (killsys): Delete declaration. * include/cygwin/signal.h (siginfo_t): Simplify union/struct nesting slightly. Implement mechanism to allow cygwin data passing.
This commit is contained in:
@ -688,7 +688,7 @@ extern DWORD exec_exit; // Possible exit value for exec
|
||||
|
||||
extern "C" {
|
||||
static void
|
||||
sig_handle_tty_stop (int sig)
|
||||
sig_handle_tty_stop (int sig, siginfo_t *, void *)
|
||||
{
|
||||
_my_tls.incyg = 1;
|
||||
/* Silently ignore attempts to suspend if there is no accommodating
|
||||
@ -748,7 +748,7 @@ _cygtls::interrupt_setup (siginfo_t& si, void *handler, struct sigaction& siga)
|
||||
push ((__stack_t) sigdelayed);
|
||||
deltamask = siga.sa_mask & ~SIG_NONMASKABLE;
|
||||
sa_flags = siga.sa_flags;
|
||||
func = (void (*) (int)) handler;
|
||||
func = (void (*) (int, siginfo_t *, void *)) handler;
|
||||
if (siga.sa_flags & SA_RESETHAND)
|
||||
siga.sa_handler = SIG_DFL;
|
||||
saved_errno = -1; // Flag: no errno to save
|
||||
@ -956,7 +956,7 @@ ctrl_c_handler (DWORD type)
|
||||
&& t->ti.c_cc[VINTR] == 3 && t->ti.c_cc[VQUIT] == 3)
|
||||
sig = SIGQUIT;
|
||||
t->last_ctrl_c = GetTickCount ();
|
||||
killsys (-myself->pid, sig);
|
||||
t->kill_pgrp (sig);
|
||||
t->last_ctrl_c = GetTickCount ();
|
||||
return TRUE;
|
||||
}
|
||||
@ -1145,19 +1145,6 @@ sigpacket::process ()
|
||||
sig_clear (SIGTTOU);
|
||||
}
|
||||
|
||||
switch (si.si_signo)
|
||||
{
|
||||
case SIGINT:
|
||||
case SIGQUIT:
|
||||
case SIGSTOP:
|
||||
case SIGTSTP:
|
||||
if (cygheap->ctty)
|
||||
cygheap->ctty->sigflush ();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
int rc = 1;
|
||||
|
||||
sigproc_printf ("signal %d processing", si.si_signo);
|
||||
@ -1301,28 +1288,23 @@ _cygtls::call_signal_handler ()
|
||||
|
||||
debug_only_printf ("dealing with signal %d", sig);
|
||||
this_sa_flags = sa_flags;
|
||||
|
||||
/* Save information locally on stack to pass to handler. */
|
||||
int thissig = sig;
|
||||
void (*thisfunc) (int) = func;
|
||||
siginfo_t thissi = infodata;
|
||||
void (*thisfunc) (int, siginfo_t *, void *) = func;
|
||||
|
||||
sigset_t this_oldmask = set_process_mask_delta ();
|
||||
int this_errno = saved_errno;
|
||||
sig = 0;
|
||||
sig = 0; /* Flag that we can accept another signal */
|
||||
reset_signal_arrived ();
|
||||
unlock (); // make sure synchronized
|
||||
if (!(this_sa_flags & SA_SIGINFO))
|
||||
{
|
||||
incyg = false;
|
||||
thisfunc (thissig);
|
||||
}
|
||||
else
|
||||
{
|
||||
siginfo_t thissi = infodata;
|
||||
void (*sigact) (int, siginfo_t *, void *) = (void (*) (int, siginfo_t *, void *)) thisfunc;
|
||||
/* no ucontext_t information provided yet */
|
||||
incyg = false;
|
||||
sigact (thissig, &thissi, NULL);
|
||||
}
|
||||
unlock (); /* unlock signal stack */
|
||||
|
||||
incyg = false;
|
||||
/* no ucontext_t information provided yet, so third arg is NULL */
|
||||
thisfunc (thissig, &thissi, NULL);
|
||||
incyg = true;
|
||||
|
||||
set_signal_mask (_my_tls.sigmask, this_oldmask);
|
||||
if (this_errno >= 0)
|
||||
set_errno (this_errno);
|
||||
|
Reference in New Issue
Block a user