aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
authorGravatar Herbert Valerio Riedel <hvr@gnu.org>2016-01-31 00:43:21 +0100
committerGravatar Herbert Valerio Riedel <hvr@gnu.org>2016-01-31 00:43:21 +0100
commit91b82383873b46385d239f2b059f353b11f07e0f (patch)
tree9a182bddec448371f9d4fab804a79f2f7cad26a5 /System
parent3e32e3912254b5b13ce27715cbd369e5e4b33241 (diff)
Replace `__hsunix_getpw{nam,uid_r}` wrappers with CApiFFI
Diffstat (limited to 'System')
-rw-r--r--System/Posix/User.hsc9
1 files changed, 6 insertions, 3 deletions
diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc
index 01a417d..63bf466 100644
--- a/System/Posix/User.hsc
+++ b/System/Posix/User.hsc
@@ -53,7 +53,6 @@ import Foreign.C
import Foreign.Ptr
import Foreign.Marshal
import Foreign.Storable
-import System.Posix.Internals ( CGroup, CPasswd )
#if !defined(HAVE_GETPWNAM_R) || !defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)
import Control.Concurrent.MVar ( MVar, newMVar, withMVar )
@@ -64,6 +63,10 @@ import Control.Exception
import Control.Monad
import System.IO.Error
+-- internal types
+data {-# CTYPE "struct passwd" #-} CPasswd
+data {-# CTYPE "struct group" #-} CGroup
+
-- -----------------------------------------------------------------------------
-- user environemnt
@@ -318,7 +321,7 @@ getUserEntryForID uid =
doubleAllocWhileERANGE "getUserEntryForID" "user" pwBufSize unpackUserEntry $
c_getpwuid_r uid ppw
-foreign import ccall unsafe "__hsunix_getpwuid_r"
+foreign import capi unsafe "HsUnix.h getpwuid_r"
c_getpwuid_r :: CUid -> Ptr CPasswd ->
CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt
#elif HAVE_GETPWUID
@@ -345,7 +348,7 @@ getUserEntryForName name =
doubleAllocWhileERANGE "getUserEntryForName" "user" pwBufSize unpackUserEntry $
c_getpwnam_r pstr ppw
-foreign import ccall unsafe "__hsunix_getpwnam_r"
+foreign import capi unsafe "HsUnix.h getpwnam_r"
c_getpwnam_r :: CString -> Ptr CPasswd
-> CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt
#elif HAVE_GETPWNAM