[commit: packages/unix] master: Replace `__hscore_{set, get}rlimit` wrappers with CApiFFI (3646040)

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


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/364604035c60fe5c21cda2e2f37027ebadc81ebd/unix

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

commit 364604035c60fe5c21cda2e2f37027ebadc81ebd
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Jan 31 00:09:09 2016 +0100

    Replace `__hscore_{set,get}rlimit` wrappers with CApiFFI


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

364604035c60fe5c21cda2e2f37027ebadc81ebd
 System/Posix/Resource.hsc |  5 +++--
 cbits/HsUnix.c            | 11 -----------
 include/HsUnix.h          |  5 -----
 3 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/System/Posix/Resource.hsc b/System/Posix/Resource.hsc
index 3418ecf..309d394 100644
--- a/System/Posix/Resource.hsc
+++ b/System/Posix/Resource.hsc
@@ -1,3 +1,4 @@
+{-# LANGUAGE CApiFFI #-}
 #if __GLASGOW_HASKELL__ >= 709
 {-# LANGUAGE Safe #-}
 #else
@@ -57,10 +58,10 @@ data ResourceLimit
 
 data {-# CTYPE "struct rlimit" #-} RLimit
 
-foreign import ccall unsafe "HsUnix.h __hscore_getrlimit"
+foreign import capi unsafe "HsUnix.h getrlimit"
   c_getrlimit :: CInt -> Ptr RLimit -> IO CInt
 
-foreign import ccall unsafe "HsUnix.h __hscore_setrlimit"
+foreign import capi unsafe "HsUnix.h setrlimit"
   c_setrlimit :: CInt -> Ptr RLimit -> IO CInt
 
 getResourceLimit :: Resource -> IO ResourceLimits
diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c
index 09cfc9c..55f9679 100644
--- a/cbits/HsUnix.c
+++ b/cbits/HsUnix.c
@@ -81,17 +81,6 @@ char *__hscore_mkdtemp(char *filetemplate) {
 }
 #endif
 
-
-#if !defined(irix_HOST_OS)
-int __hscore_getrlimit(int resource, struct rlimit *rlim) {
-    return (getrlimit(resource, rlim));
-}
-
-int __hscore_setrlimit(int resource, struct rlimit *rlim) {
-    return (setrlimit(resource, rlim));
-}
-#endif
-
 #ifdef HAVE_UNSETENV
 int __hsunix_unsetenv(const char *name)
 {
diff --git a/include/HsUnix.h b/include/HsUnix.h
index 98990b2..093c9e3 100644
--- a/include/HsUnix.h
+++ b/include/HsUnix.h
@@ -144,11 +144,6 @@ int __hscore_mkstemps(char *filetemplate, int suffixlen);
 char *__hscore_mkdtemp(char *filetemplate);
 #endif
 
-#if !defined(irix_HOST_OS)
-int __hscore_getrlimit(int resource, struct rlimit *rlim);
-int __hscore_setrlimit(int resource, struct rlimit *rlim);
-#endif
-
 int __hsunix_unsetenv(const char *name);
 
 /* A size that will contain many path names, but not necessarily all



More information about the ghc-commits mailing list