aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Herbert Valerio Riedel <hvr@gnu.org>2016-01-30 17:47:32 +0100
committerGravatar Herbert Valerio Riedel <hvr@gnu.org>2016-01-30 17:47:32 +0100
commit11eb5aabcc3c98eddf1b375c4184fe0df58d7eab (patch)
tree607047937b23032f97da86b1b172b05d6ac6eb2a
parent7fdf4cda3b229e2873a46e0482c83f52b714c5fe (diff)
Replace `<sys/wait.h>` macro wrappers with CApiFFI
-rw-r--r--System/Posix/Process/Internals.hs16
-rw-r--r--cbits/HsUnix.c9
-rw-r--r--include/HsUnix.h7
3 files changed, 9 insertions, 23 deletions
diff --git a/System/Posix/Process/Internals.hs b/System/Posix/Process/Internals.hs
index 19dc1c1..970bc9f 100644
--- a/System/Posix/Process/Internals.hs
+++ b/System/Posix/Process/Internals.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE CPP #-}
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
@@ -56,24 +57,25 @@ decipherWaitStatus wstat =
ioError (mkIOError illegalOperationErrorType
"waitStatus" Nothing Nothing)
-foreign import ccall unsafe "__hsunix_wifexited"
+
+foreign import capi unsafe "HsUnix.h WIFEXITED"
c_WIFEXITED :: CInt -> CInt
-foreign import ccall unsafe "__hsunix_wexitstatus"
+foreign import capi unsafe "HsUnix.h WEXITSTATUS"
c_WEXITSTATUS :: CInt -> CInt
-foreign import ccall unsafe "__hsunix_wifsignaled"
+foreign import capi unsafe "HsUnix.h WIFSIGNALED"
c_WIFSIGNALED :: CInt -> CInt
-foreign import ccall unsafe "__hsunix_wtermsig"
+foreign import capi unsafe "HsUnix.h WTERMSIG"
c_WTERMSIG :: CInt -> CInt
-foreign import ccall unsafe "__hsunix_wifstopped"
+foreign import capi unsafe "HsUnix.h WIFSTOPPED"
c_WIFSTOPPED :: CInt -> CInt
-foreign import ccall unsafe "__hsunix_wstopsig"
+foreign import capi unsafe "HsUnix.h WSTOPSIG"
c_WSTOPSIG :: CInt -> CInt
-foreign import ccall unsafe "__hsunix_wcoredump"
+foreign import capi unsafe "HsUnix.h WCOREDUMP"
c_WCOREDUMP :: CInt -> CInt
diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c
index 66d951d..8300949 100644
--- a/cbits/HsUnix.c
+++ b/cbits/HsUnix.c
@@ -8,20 +8,11 @@
#include "HsUnix.h"
-int __hsunix_wifexited (int stat) { return WIFEXITED(stat); }
-int __hsunix_wexitstatus (int stat) { return WEXITSTATUS(stat); }
-int __hsunix_wifsignaled (int stat) { return WIFSIGNALED(stat); }
-int __hsunix_wtermsig (int stat) { return WTERMSIG(stat); }
-int __hsunix_wifstopped (int stat) { return WIFSTOPPED(stat); }
-int __hsunix_wstopsig (int stat) { return WSTOPSIG(stat); }
-
// not part of POSIX, hence may not be always defined
#ifndef WCOREDUMP
# define WCOREDUMP(s) 0
#endif
-int __hsunix_wcoredump (int stat) { return WCOREDUMP(stat); }
-
#ifdef HAVE_RTLDNEXT
void *__hsunix_rtldNext (void) {return RTLD_NEXT;}
#endif
diff --git a/include/HsUnix.h b/include/HsUnix.h
index 389d877..cfc221f 100644
--- a/include/HsUnix.h
+++ b/include/HsUnix.h
@@ -94,13 +94,6 @@ extern HsInt nocldstop;
extern char **environ;
-int __hsunix_wifexited (int stat);
-int __hsunix_wexitstatus (int stat);
-int __hsunix_wifsignaled (int stat);
-int __hsunix_wtermsig (int stat);
-int __hsunix_wifstopped (int stat);
-int __hsunix_wstopsig (int stat);
-
#ifdef HAVE_RTLDNEXT
void *__hsunix_rtldNext (void);
#endif