aboutsummaryrefslogtreecommitdiffhomepage
path: root/System/Posix
diff options
context:
space:
mode:
authorGravatar Herbert Valerio Riedel <hvr@gnu.org>2013-11-08 12:48:54 +0100
committerGravatar Herbert Valerio Riedel <hvr@gnu.org>2013-11-08 12:48:54 +0100
commit17192d89e642c463a1987fa3cc5cca2eb546bec7 (patch)
treedb7ef799f54aff99f41c19cea05f0c45618b32e8 /System/Posix
parent897d66ad9d77d17dae1b5ac94af792e671a76c13 (diff)
Add `forkProcessWithUnmask` function
This seemed to be an obvious addition while working on #8433. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Diffstat (limited to 'System/Posix')
-rw-r--r--System/Posix/Process/ByteString.hsc1
-rw-r--r--System/Posix/Process/Common.hsc10
2 files changed, 10 insertions, 1 deletions
diff --git a/System/Posix/Process/ByteString.hsc b/System/Posix/Process/ByteString.hsc
index 30f40cd..4c6840a 100644
--- a/System/Posix/Process/ByteString.hsc
+++ b/System/Posix/Process/ByteString.hsc
@@ -22,6 +22,7 @@ module System.Posix.Process.ByteString (
-- ** Forking and executing
#ifdef __GLASGOW_HASKELL__
forkProcess,
+ forkProcessWithUnmask,
#endif
executeFile,
diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc
index 1b504df..b760caa 100644
--- a/System/Posix/Process/Common.hsc
+++ b/System/Posix/Process/Common.hsc
@@ -1,4 +1,4 @@
-{-# LANGUAGE InterruptibleFFI #-}
+{-# LANGUAGE InterruptibleFFI, RankNTypes #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
@@ -23,6 +23,7 @@ module System.Posix.Process.Common (
-- ** Forking and executing
#ifdef __GLASGOW_HASKELL__
forkProcess,
+ forkProcessWithUnmask,
#endif
-- ** Exiting
@@ -306,6 +307,13 @@ forkProcess action = do
(\stable -> throwErrnoIfMinus1 "forkProcess" (forkProcessPrim stable))
foreign import ccall "forkProcess" forkProcessPrim :: StablePtr (IO ()) -> IO CPid
+
+-- | Variant of 'forkProcess' in the style of 'forkIOWithUnmask'.
+--
+-- /Since: 2.7.0.0/
+forkProcessWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ProcessID
+forkProcessWithUnmask action = forkProcess (action unsafeUnmask)
+
#endif /* __GLASGOW_HASKELL__ */
-- -----------------------------------------------------------------------------