[commit: packages/unix] master: Replace `<sys/wait.h>` macro wrappers with CApiFFI (11eb5aa)

git at git.haskell.org git at git.haskell.org
Tue Apr 19 21:37:37 UTC 2016


Repository : ssh://git@git.haskell.org/unix

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/11eb5aabcc3c98eddf1b375c4184fe0df58d7eab/unix

>---------------------------------------------------------------

commit 11eb5aabcc3c98eddf1b375c4184fe0df58d7eab
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Jan 30 17:47:32 2016 +0100

    Replace `<sys/wait.h>` macro wrappers with CApiFFI


>---------------------------------------------------------------

11eb5aabcc3c98eddf1b375c4184fe0df58d7eab
 System/Posix/Process/Internals.hs | 16 +++++++++-------
 cbits/HsUnix.c                    |  9 ---------
 include/HsUnix.h                  |  7 -------
 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



More information about the ghc-commits mailing list