aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
Diffstat (limited to 'System')
-rw-r--r--System/Posix/Directory/Common.hsc8
-rw-r--r--System/Posix/Files.hsc4
-rw-r--r--System/Posix/Files/ByteString.hsc4
-rw-r--r--System/Posix/SharedMem.hsc4
4 files changed, 12 insertions, 8 deletions
diff --git a/System/Posix/Directory/Common.hsc b/System/Posix/Directory/Common.hsc
index 86d87ca..7cc61af 100644
--- a/System/Posix/Directory/Common.hsc
+++ b/System/Posix/Directory/Common.hsc
@@ -62,20 +62,20 @@ newtype DirStreamOffset = DirStreamOffset COff
#ifdef HAVE_SEEKDIR
seekDirStream :: DirStream -> DirStreamOffset -> IO ()
seekDirStream (DirStream dirp) (DirStreamOffset off) =
- c_seekdir dirp off
+ c_seekdir dirp (fromIntegral off) -- TODO: check for CLong/COff overflow
foreign import ccall unsafe "seekdir"
- c_seekdir :: Ptr CDir -> COff -> IO ()
+ c_seekdir :: Ptr CDir -> CLong -> IO ()
#endif
#ifdef HAVE_TELLDIR
tellDirStream :: DirStream -> IO DirStreamOffset
tellDirStream (DirStream dirp) = do
off <- c_telldir dirp
- return (DirStreamOffset off)
+ return (DirStreamOffset (fromIntegral off)) -- TODO: check for overflow
foreign import ccall unsafe "telldir"
- c_telldir :: Ptr CDir -> IO COff
+ c_telldir :: Ptr CDir -> IO CLong
#endif
changeWorkingDirectoryFd :: Fd -> IO ()
diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc
index 7c20987..6aea6a9 100644
--- a/System/Posix/Files.hsc
+++ b/System/Posix/Files.hsc
@@ -1,6 +1,8 @@
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
+{-# LANGUAGE CApiFFI #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : System.Posix.Files
@@ -421,7 +423,7 @@ setFileSize file off =
withFilePath file $ \s ->
throwErrnoPathIfMinus1_ "setFileSize" file (c_truncate s off)
-foreign import ccall unsafe "truncate"
+foreign import capi unsafe "HsUnix.h truncate"
c_truncate :: CString -> COff -> IO CInt
-- -----------------------------------------------------------------------------
diff --git a/System/Posix/Files/ByteString.hsc b/System/Posix/Files/ByteString.hsc
index dc1a3f8..ec58cb1 100644
--- a/System/Posix/Files/ByteString.hsc
+++ b/System/Posix/Files/ByteString.hsc
@@ -1,6 +1,8 @@
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
#endif
+{-# LANGUAGE CApiFFI #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : System.Posix.Files.ByteString
@@ -421,7 +423,7 @@ setFileSize file off =
withFilePath file $ \s ->
throwErrnoPathIfMinus1_ "setFileSize" file (c_truncate s off)
-foreign import ccall unsafe "truncate"
+foreign import capi unsafe "HsUnix.h truncate"
c_truncate :: CString -> COff -> IO CInt
-- -----------------------------------------------------------------------------
diff --git a/System/Posix/SharedMem.hsc b/System/Posix/SharedMem.hsc
index 1d7a80a..c85e4b7 100644
--- a/System/Posix/SharedMem.hsc
+++ b/System/Posix/SharedMem.hsc
@@ -19,12 +19,12 @@ module System.Posix.SharedMem
(ShmOpenFlags(..), shmOpen, shmUnlink)
where
+#include "HsUnix.h"
+
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
-#include "HsUnix.h"
-
import System.Posix.Types
#if defined(HAVE_SHM_OPEN) || defined(HAVE_SHM_UNLINK)
import Foreign.C