[commit: packages/unix] master, safe710fixes, safe710fixes-again, safefixes710again: fix getGroupEntryForID/Name on Solaris (3c28bc8)

git at git.haskell.org git at git.haskell.org
Thu Mar 19 15:49:51 UTC 2015


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

On branches: master,safe710fixes,safe710fixes-again,safefixes710again
Link       : http://ghc.haskell.org/trac/ghc/changeset/3c28bc83695cb5351d24920dac655b944a8abfba/unix

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

commit 3c28bc83695cb5351d24920dac655b944a8abfba
Author: Karel Gardas <karel.gardas at centrum.cz>
Date:   Mon Sep 8 20:17:47 2014 +0200

    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.


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

3c28bc83695cb5351d24920dac655b944a8abfba
 System/Posix/User.hsc | 6 +++---
 changelog.md          | 6 ++++++
 2 files changed, 9 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
diff --git a/changelog.md b/changelog.md
index 9d587ab..e8632e2 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,9 @@
+
+  * Fix `getGroupEntryForID/getGroupEntryForName' on Solaris. Solaris uses
+    CPP macros for required getgrgid_r and getgrnam_r functions definition
+    so the fix is to change from C ABI calling convention to C API calling
+    convention
+
 ## 2.7.0.1  *Mar 2014*
 
   * Bundled with GHC 7.8.1



More information about the ghc-commits mailing list