aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
authorGravatar Karel Gardas <karel.gardas@centrum.cz>2014-09-08 20:17:47 +0200
committerGravatar Karel Gardas <karel.gardas@centrum.cz>2014-09-10 10:04:59 +0200
commit3c28bc83695cb5351d24920dac655b944a8abfba (patch)
tree1a54a5ae03f0e5f5078abde95e2d609e2ffef447 /System
parent30248d77d87ac7ec69b71cb3075d3ec64fa389fa (diff)
fix getGroupEntryForID/Name on Solaris
This patch fixes getGroupEntryForID and getGroupEntryForName on Solaris The issue on Solaris is that it defines both required getgrgid_r and getgrnam_r functions as CPP macros which depending on configuration are mapped to real function implementations with different names. The issue is solved by using C API calling convention instead of platform C ABI calling convention.
Diffstat (limited to 'System')
-rw-r--r--System/Posix/User.hsc6
1 files changed, 3 insertions, 3 deletions
diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc
index ff7268f..50c9f41 100644
--- a/System/Posix/User.hsc
+++ b/System/Posix/User.hsc
@@ -1,5 +1,5 @@
#ifdef __GLASGOW_HASKELL__
-{-# LANGUAGE Trustworthy #-}
+{-# LANGUAGE Trustworthy, CApiFFI #-}
#endif
-----------------------------------------------------------------------------
-- |
@@ -207,7 +207,7 @@ getGroupEntryForID gid =
doubleAllocWhileERANGE "getGroupEntryForID" "group" grBufSize unpackGroupEntry $
c_getgrgid_r gid pgr
-foreign import ccall unsafe "getgrgid_r"
+foreign import capi unsafe "HsUnix.h getgrgid_r"
c_getgrgid_r :: CGid -> Ptr CGroup -> CString
-> CSize -> Ptr (Ptr CGroup) -> IO CInt
#else
@@ -226,7 +226,7 @@ getGroupEntryForName name =
doubleAllocWhileERANGE "getGroupEntryForName" "group" grBufSize unpackGroupEntry $
c_getgrnam_r pstr pgr
-foreign import ccall unsafe "getgrnam_r"
+foreign import capi unsafe "HsUnix.h getgrnam_r"
c_getgrnam_r :: CString -> Ptr CGroup -> CString
-> CSize -> Ptr (Ptr CGroup) -> IO CInt
#else