From bc4bd179bda49b615a1c40df7402ddf80bf775b2 Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Thu, 7 Aug 2014 12:33:51 +0200 Subject: Use CAPI FFI imports for `truncate` This makes sure we pick up the LFS version of `truncate` in case `off_t` is affected by CPP defines such as `_FILE_OFFSET_BITS`. --- System/Posix/Files.hsc | 4 +++- System/Posix/Files/ByteString.hsc | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'System/Posix') diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index c8b5ddf..1822294 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 @@ -420,7 +422,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 80f0bea..cb68668 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 @@ -420,7 +422,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 -- ----------------------------------------------------------------------------- -- cgit v1.2.3