aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
authorGravatar Simon Marlow <marlowsd@gmail.com>2009-07-23 07:57:25 +0000
committerGravatar Simon Marlow <marlowsd@gmail.com>2009-07-23 07:57:25 +0000
commit4eac1ce4a5624e6c21f426a9338d213667b84dde (patch)
tree90060d6562a71457546c284bc7b49777a5835e27 /System
parent64adb7f67518eb1f0a07948aeed37b03a0a3a761 (diff)
NetBSD does not have support for symbol versioning, so updated systen
functions need to be given a new name, and the header files contain some __asm hackery in order to let the program call the correct function. This mean that you need to use the header files in order to call the correct system functions, which prevents things like "foreign import ccall" from working. Ghc solves this with wrapper functions for some of the renamed functions, but it has not been updated for newer versions of NetBSD that has recently versioned some more functions. The attached patches introduces wrapper functions for all currently NetBSD-versioned functions used in libraries/unix. Solves ~20 testsuite failures. Contributed by: Krister Walfridsson <krister.walfridsson@gmail.com>
Diffstat (limited to 'System')
-rw-r--r--System/Posix/Directory.hsc2
-rw-r--r--System/Posix/Process.hsc2
-rw-r--r--System/Posix/Time.hsc2
-rw-r--r--System/Posix/Unistd.hsc2
-rw-r--r--System/Posix/User.hsc6
5 files changed, 7 insertions, 7 deletions
diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc
index 35fe291..3f676ce 100644
--- a/System/Posix/Directory.hsc
+++ b/System/Posix/Directory.hsc
@@ -61,7 +61,7 @@ openDirStream name =
dirp <- throwErrnoPathIfNull "openDirStream" name $ c_opendir s
return (DirStream dirp)
-foreign import ccall unsafe "opendir"
+foreign import ccall unsafe "__hsunix_opendir"
c_opendir :: CString -> IO (Ptr CDir)
-- | @readDirStream dp@ calls @readdir@ to obtain the
diff --git a/System/Posix/Process.hsc b/System/Posix/Process.hsc
index 147b508..cf60844 100644
--- a/System/Posix/Process.hsc
+++ b/System/Posix/Process.hsc
@@ -173,7 +173,7 @@ getProcessTimes = do
type CTms = ()
-foreign import ccall unsafe "times"
+foreign import ccall unsafe "__hsunix_times"
c_times :: Ptr CTms -> IO CClock
-- -----------------------------------------------------------------------------
diff --git a/System/Posix/Time.hsc b/System/Posix/Time.hsc
index 0fbce38..1d2e107 100644
--- a/System/Posix/Time.hsc
+++ b/System/Posix/Time.hsc
@@ -33,5 +33,5 @@ import Foreign.C
epochTime :: IO EpochTime
epochTime = throwErrnoIfMinus1 "epochTime" (c_time nullPtr)
-foreign import ccall unsafe "time"
+foreign import ccall unsafe "__hsunix_time"
c_time :: Ptr CTime -> IO CTime
diff --git a/System/Posix/Unistd.hsc b/System/Posix/Unistd.hsc
index f0cac21..4aefd60 100644
--- a/System/Posix/Unistd.hsc
+++ b/System/Posix/Unistd.hsc
@@ -158,7 +158,7 @@ nanosleep nsecs = do
data CTimeSpec
-foreign import ccall safe "nanosleep"
+foreign import ccall safe "__hsunix_nanosleep"
c_nanosleep :: Ptr CTimeSpec -> Ptr CTimeSpec -> IO CInt
#endif
diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc
index 47a7a72..88150a0 100644
--- a/System/Posix/User.hsc
+++ b/System/Posix/User.hsc
@@ -292,7 +292,7 @@ getUserEntryForID uid = do
peekElemOff pppw 0
unpackUserEntry ppw
-foreign import ccall unsafe "getpwuid_r"
+foreign import ccall unsafe "__hsunix_getpwuid_r"
c_getpwuid_r :: CUid -> Ptr CPasswd ->
CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt
#elif HAVE_GETPWUID
@@ -328,7 +328,7 @@ getUserEntryForName name = do
(Just name)
unpackUserEntry ppw
-foreign import ccall unsafe "getpwnam_r"
+foreign import ccall unsafe "__hsunix_getpwnam_r"
c_getpwnam_r :: CString -> Ptr CPasswd
-> CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt
#elif HAVE_GETPWNAM
@@ -359,7 +359,7 @@ getAllUserEntries =
else do thisentry <- unpackUserEntry ppw
worker (thisentry : accum)
-foreign import ccall unsafe "getpwent"
+foreign import ccall unsafe "__hsunix_getpwent"
c_getpwent :: IO (Ptr CPasswd)
foreign import ccall unsafe "setpwent"
c_setpwent :: IO ()