Skip to content
Snippets Groups Projects
Commit bc4bd179 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel :man_dancing:
Browse files

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`.
parent 43343c15
No related branches found
No related tags found
No related merge requests found
#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
-- -----------------------------------------------------------------------------
......
#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
-- -----------------------------------------------------------------------------
......
......@@ -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
......
......@@ -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])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment