summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/exceptions.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-01-17 14:57:09 +0000
committerChristopher Faylor <me@cgf.cx>2001-01-17 14:57:09 +0000
commita7cde2b98a658522f552a7ac7ae0a9ef07981e0a (patch)
tree09134d68cc17eab1ebd6c4d81363c189f70ddf7c /winsup/cygwin/exceptions.cc
parentcb503978ab5119740bc5e796344db6a5d0e6bcb5 (diff)
downloadcygnal-a7cde2b98a658522f552a7ac7ae0a9ef07981e0a.tar.gz
cygnal-a7cde2b98a658522f552a7ac7ae0a9ef07981e0a.tar.bz2
cygnal-a7cde2b98a658522f552a7ac7ae0a9ef07981e0a.zip
* autoload.cc (LoadDLLinitfunc): Remove debugging statement.
* 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.
Diffstat (limited to 'winsup/cygwin/exceptions.cc')
-rw-r--r--winsup/cygwin/exceptions.cc54
1 files changed, 30 insertions, 24 deletions
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index fd7de95fb..9a51f49f1 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -585,6 +585,27 @@ handle_sigsuspend (sigset_t tempmask)
extern DWORD exec_exit; // Possible exit value for exec
extern int pending_signals;
+extern "C" {
+static void
+sig_handle_tty_stop (int sig)
+{
+ myself->stopsig = sig;
+ /* See if we have a living parent. If so, send it a special signal.
+ * It will figure out exactly which pid has stopped by scanning
+ * its list of subprocesses.
+ */
+ if (my_parent_is_alive ())
+ {
+ pinfo parent (myself->ppid);
+ sig_send (parent, __SIGCHILDSTOPPED);
+ }
+ sigproc_printf ("process %d stopped by signal %d, myself->ppid_handle %p",
+ myself->pid, sig, myself->ppid_handle);
+ SuspendThread (hMainThread);
+ return;
+}
+}
+
int
interruptible (DWORD pc, int testvalid = 0)
{
@@ -639,6 +660,11 @@ interrupt_setup (int sig, void *handler, DWORD retaddr, DWORD *retaddr_on_stack,
sigsave.func = (void (*)(int)) handler;
sigsave.sig = sig;
sigsave.saved_errno = -1; // Flag: no errno to save
+ if (handler == sig_handle_tty_stop)
+ {
+ myself->stopsig = 0;
+ myself->process_state |= PID_STOPPED;
+ }
}
static bool interrupt_now (CONTEXT *, int, void *, struct sigaction&) __attribute__((regparm(3)));
@@ -890,29 +916,6 @@ set_process_mask (sigset_t newmask)
return;
}
-extern "C" {
-static void
-sig_handle_tty_stop (int sig)
-{
- myself->stopsig = sig;
- myself->process_state |= PID_STOPPED;
- /* See if we have a living parent. If so, send it a special signal.
- * It will figure out exactly which pid has stopped by scanning
- * its list of subprocesses.
- */
- if (my_parent_is_alive ())
- {
- pinfo parent (myself->ppid);
- sig_send (parent, __SIGCHILDSTOPPED);
- }
- sigproc_printf ("process %d stopped by signal %d, myself->ppid_handle %p",
- myself->pid, sig, myself->ppid_handle);
- /* There is a small race here with the above two mutexes */
- SuspendThread (hMainThread);
- return;
-}
-}
-
int __stdcall
sig_handle (int sig)
{
@@ -988,12 +991,15 @@ sig_handle (int sig)
goto dosig;
stop:
+ /* Eat multiple attempts to STOP */
+ if (ISSTATE (myself, PID_STOPPED))
+ goto done;
handler = (void *) sig_handle_tty_stop;
thissig = myself->getsig (SIGSTOP);
dosig:
/* Dispatch to the appropriate function. */
- sigproc_printf ("signal %d, about to call %p", sig, thissig.sa_handler);
+ sigproc_printf ("signal %d, about to call %p", sig, handler);
rc = call_handler (sig, handler, thissig);
done: