[commit: packages/unix] master: Replace `__hsunix_times` wrapper with CApiFFI (7fdf4cd)

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


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/7fdf4cda3b229e2873a46e0482c83f52b714c5fe/unix

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

commit 7fdf4cda3b229e2873a46e0482c83f52b714c5fe
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Jan 30 17:31:48 2016 +0100

    Replace `__hsunix_times` wrapper with CApiFFI


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

7fdf4cda3b229e2873a46e0482c83f52b714c5fe
 System/Posix/Process/Common.hsc | 3 ++-
 cbits/HsUnix.c                  | 6 ------
 include/HsUnix.h                | 3 ---
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc
index 66e0d20..c13bf5e 100644
--- a/System/Posix/Process/Common.hsc
+++ b/System/Posix/Process/Common.hsc
@@ -1,3 +1,4 @@
+{-# LANGUAGE CApiFFI #-}
 {-# LANGUAGE InterruptibleFFI, RankNTypes #-}
 #ifdef __GLASGOW_HASKELL__
 {-# LANGUAGE Trustworthy #-}
@@ -213,7 +214,7 @@ getProcessTimes = do
 
 type CTms = ()
 
-foreign import ccall unsafe "__hsunix_times"
+foreign import capi unsafe "HsUnix.h times"
   c_times :: Ptr CTms -> IO CClock
 
 -- -----------------------------------------------------------------------------
diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c
index e61f835..66d951d 100644
--- a/cbits/HsUnix.c
+++ b/cbits/HsUnix.c
@@ -76,12 +76,6 @@ int __hsunix_nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
 }
 #endif
 
-// times is a macro on some platforms, so we need a wrapper:
-clock_t __hsunix_times(struct tms *tp)
-{
-    return times(tp);
-}
-
 #ifdef HAVE_PTSNAME
 // I cannot figure out how to make the definitions of the following
 // functions visible in <stdlib.h> on Linux.  But these definitions
diff --git a/include/HsUnix.h b/include/HsUnix.h
index 62d0f31..389d877 100644
--- a/include/HsUnix.h
+++ b/include/HsUnix.h
@@ -143,9 +143,6 @@ int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t,
 int __hsunix_nanosleep(const struct timespec *, struct timespec *);
 #endif
 
-// times is a macro on some platforms, so we need a wrapper:
-clock_t __hsunix_times(struct tms *);
-
 #ifdef HAVE_PTSNAME
 // I cannot figure out how to make the definitions of the following
 // functions visible in <stdlib.h> on Linux.  But these definitions



More information about the ghc-commits mailing list