diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index c8b5ddf3fd1196b10580e4ec9c28aa63bd807f14..1822294cb71b1fd601fa23c34a9f1d8c35894976 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 80f0beabbd4fa7cae9a1e3a38876ffd163ae5ec8..cb68668c1c520455a012548686f727144fb9ec8f 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 -- ----------------------------------------------------------------------------- diff --git a/changelog.md b/changelog.md index c481922fcc33637136f001c7d6497eb75dc7d718..66caaeba3a4e449dc47bbe24c8262bb93f33ab7e 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,8 @@ convention * Fix potential type-mismatch in `telldir`/`seekdir` FFI imports + * Use CAPI FFI import for `truncate` to make sure the LFS-version is used. + ## 2.7.0.1 *Mar 2014* * Bundled with GHC 7.8.1 diff --git a/configure.ac b/configure.ac index 41274dc039d86186c014dad2125e273e3ce2a740..c10bf8981cbf5cdd2ec0a298886aba6ec0c5f967 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,9 @@ AC_C_CONST dnl ** Enable large file support. NB. do this before testing the type of dnl off_t, because it will affect the result of that test. +dnl +dnl WARNING: It's essential this check agrees with HsBaseConfig.h as otherwise +dnl the definitions of COff/coff_t don't line up AC_SYS_LARGEFILE AC_CHECK_HEADERS([dirent.h fcntl.h grp.h limits.h pwd.h signal.h string.h])