[project @ 2003-09-12 12:29:43 by simonmar]
authorsimonmar <unknown>
Fri, 12 Sep 2003 12:29:44 +0000 (12:29 +0000)
committersimonmar <unknown>
Fri, 12 Sep 2003 12:29:44 +0000 (12:29 +0000)
Move setChildStopFlag and queryChildStopFlag to System.Posix.Signals.

System/Posix/Signals.hsc
include/HsBase.h

index fdc8cde..bcd0eca 100644 (file)
@@ -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)
index 5251dc8..019f491 100644 (file)
@@ -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
    -------------------------------------------------------------------------- */