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
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2013-01-31 09:26:47 +0400
committerChristopher Faylor <me@cgf.cx>2013-01-31 09:26:47 +0400
commit118e51be1d041b2fb7d77bba17bfd8eebb7e9307 (patch)
treed041b7559f91cd93d3c6fd5761fb05bcb73de74d /winsup/cygwin/fhandler_termios.cc
parent3371f4c71497ebd24c148a80f5b5ace19f630c37 (diff)
* 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.
Diffstat (limited to 'winsup/cygwin/fhandler_termios.cc')
-rw-r--r--winsup/cygwin/fhandler_termios.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
index bd75ee804..1383d5e37 100644
--- a/winsup/cygwin/fhandler_termios.cc
+++ b/winsup/cygwin/fhandler_termios.cc
@@ -114,14 +114,23 @@ fhandler_pty_master::tcgetpgrp ()
return tc ()->pgid;
}
+static inline bool
+is_flush_sig (int sig)
+{
+ return sig == SIGINT || sig == SIGQUIT || sig == SIGTSTP;
+}
+
void
tty_min::kill_pgrp (int sig)
{
bool killself = false;
+ if (is_flush_sig (sig) && cygheap->ctty)
+ cygheap->ctty->sigflush ();
winpids pids ((DWORD) PID_MAP_RW);
siginfo_t si = {0};
si.si_signo = sig;
si.si_code = SI_KERNEL;
+
for (unsigned i = 0; i < pids.npids; i++)
{
_pinfo *p = pids[i];
@@ -163,7 +172,7 @@ tty_min::is_orphaned_process_group (int pgid)
bg_check_types
fhandler_termios::bg_check (int sig)
{
- if (!myself->pgid || tc ()->getpgid () == myself->pgid ||
+ if (!myself->pgid || !tc () || tc ()->getpgid () == myself->pgid ||
myself->ctty != tc ()->ntty ||
((sig == SIGTTOU) && !(tc ()->ti.c_lflag & TOSTOP)))
return bg_ok;
@@ -396,8 +405,9 @@ fhandler_termios::sigflush ()
/* FIXME: Checking get_ttyp() for NULL is not right since it should not
be NULL while this is alive. However, we can conceivably close a
ctty while exiting and that will zero this. */
- if ((!have_execed || have_execed_cygwin) && get_ttyp ()
- && !(get_ttyp ()->ti.c_lflag & NOFLSH))
+ if ((!have_execed || have_execed_cygwin) && tc ()
+ && (tc ()->getpgid () == myself->pgid)
+ && !(tc ()->ti.c_lflag & NOFLSH))
tcflush (TCIFLUSH);
}