X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fposix%2FSignals.c;h=a902b809a5650c7c232ba5c3bf0a6954c66675b1;hb=10ba2ab9fb729215f5e30654527a5d882a3a01f7;hp=8645f1b826c10b5e122e5ab7426f20de308cf8be;hpb=bb7674b77f65ce48d8c89ad2a19c6a9f66f61d56;p=ghc-hetmet.git diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 8645f1b..a902b80 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -17,6 +17,7 @@ #include "RtsUtils.h" #include "RtsFlags.h" #include "Prelude.h" +#include "ThrIOManager.h" #ifdef alpha_HOST_ARCH # if defined(linux_HOST_OS) @@ -40,7 +41,7 @@ * to POSIX.1 to control whether or not to include SA_NOCLDSTOP when * installing a SIGCHLD handler. */ -StgInt nocldstop = 0; +HsInt nocldstop = 0; /* ----------------------------------------------------------------------------- * The table of signal handlers @@ -163,22 +164,6 @@ StgPtr *next_pending_handler = pending_handler_buf; #endif /* THREADED_RTS */ /* ----------------------------------------------------------------------------- - * SIGCONT handler - * - * It seems that shells tend to put stdin back into blocking mode - * following a suspend/resume of the process. Here we arrange to put - * it back into non-blocking mode. We don't do anything to - * stdout/stderr because these handles don't get put into non-blocking - * mode at all - see the comments on stdout/stderr in PrelHandle.hsc. - * -------------------------------------------------------------------------- */ - -static void -cont_handler(int sig STG_UNUSED) -{ - setNonBlockingFd(0); -} - -/* ----------------------------------------------------------------------------- * Low-level signal handler * * Places the requested handler on a stack of pending handlers to be @@ -248,11 +233,6 @@ generic_handler(int sig) sigaddset(&signals, sig); sigprocmask(SIG_UNBLOCK, &signals, NULL); - // *always* do the SIGCONT handler, even if the user overrides it. - if (sig == SIGCONT) { - cont_handler(sig); - } - context_switch = 1; } @@ -506,21 +486,13 @@ initDefaultHandlers() sigemptyset(&action.sa_mask); action.sa_flags = 0; if (sigaction(SIGINT, &action, &oact) != 0) { - errorBelch("warning: failed to install SIGINT handler"); + sysErrorBelch("warning: failed to install SIGINT handler"); } #if defined(HAVE_SIGINTERRUPT) siginterrupt(SIGINT, 1); // isn't this the default? --SDM #endif - // install the SIGCONT handler - action.sa_handler = cont_handler; - sigemptyset(&action.sa_mask); - action.sa_flags = 0; - if (sigaction(SIGCONT, &action, &oact) != 0) { - errorBelch("warning: failed to install SIGCONT handler"); - } - // install the SIGFPE handler // In addition to handling SIGINT, also handle SIGFPE by ignoring it. @@ -536,7 +508,7 @@ initDefaultHandlers() sigemptyset(&action.sa_mask); action.sa_flags = 0; if (sigaction(SIGFPE, &action, &oact) != 0) { - errorBelch("warning: failed to install SIGFPE handler"); + sysErrorBelch("warning: failed to install SIGFPE handler"); } #endif @@ -545,4 +517,11 @@ initDefaultHandlers() #endif } +void +freeSignalHandlers(void) { + if (signal_handlers != NULL) { + stgFree(signal_handlers); + } +} + #endif /* RTS_USER_SIGNALS */