From ae50b8a53c3ab98b5112769e410440ab3e318994 Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 12 Sep 2003 12:29:44 +0000 Subject: [PATCH] [project @ 2003-09-12 12:29:43 by simonmar] Move setChildStopFlag and queryChildStopFlag to System.Posix.Signals. --- System/Posix/Signals.hsc | 24 ++++++++++++++++++++++++ include/HsBase.h | 5 ++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/System/Posix/Signals.hsc b/System/Posix/Signals.hsc index fdc8cde..bcd0eca 100644 --- a/System/Posix/Signals.hsc +++ b/System/Posix/Signals.hsc @@ -75,6 +75,9 @@ module System.Posix.Signals ( -- * Waiting for signals getPendingSignals, awaitSignal, + -- * The @NOCLDSTOP@ flag + setStoppedChildFlag, queryStoppedChildFlag, + -- MISSING FUNCTIONALITY: -- sigaction(), (inc. the sigaction structure + flags etc.) -- the siginfo structure @@ -313,6 +316,27 @@ foreign import ccall unsafe "alarm" c_alarm :: CUInt -> IO CUInt -- ----------------------------------------------------------------------------- +-- The NOCLDSTOP flag + +foreign import ccall "&nocldstop" nocldstop :: Ptr Int + +-- | Tells the system whether or not to set the @SA_NOCLDSTOP@ flag when +-- installing new signal handlers. +setStoppedChildFlag :: Bool -> IO Bool +setStoppedChildFlag b = do + rc <- peek nocldstop + poke nocldstop x + return (rc == (0::Int)) + where + x = case b of {True -> 0; False -> 1} + +-- | Queries the current state of the stopped child flag. +queryStoppedChildFlag :: IO Bool +queryStoppedChildFlag = do + rc <- peek nocldstop + return (rc == (0::Int)) + +-- ----------------------------------------------------------------------------- -- Manipulating signal sets newtype SignalSet = SignalSet (ForeignPtr CSigset) diff --git a/include/HsBase.h b/include/HsBase.h index 5251dc8..019f491 100644 --- a/include/HsBase.h +++ b/include/HsBase.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: HsBase.h,v 1.25 2003/09/02 16:07:11 ross Exp $ + * $Id: HsBase.h,v 1.26 2003/09/12 12:29:44 simonmar Exp $ * * (c) The University of Glasgow 2001-2002 * @@ -129,6 +129,9 @@ int inputReady(int fd, int msecs, int isSock); /* in writeError.c */ void writeErrString__(HsAddr msg_hdr, HsAddr msg, HsInt len); +/* in Signals.c */ +extern HsInt nocldstop; + /* ----------------------------------------------------------------------------- 64-bit operations, defined in longlong.c -------------------------------------------------------------------------- */ -- 1.7.10.4