Commit 5970f506 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺
Browse files

Merge pull request #5 from hvr/pr-LFS

Fix potential LFS related issues
parents c46a7fec 1b53296f
......@@ -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 ()
......
#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
-- -----------------------------------------------------------------------------
......
......@@ -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
......
<<<<<<< HEAD
# Changelog for [`unix` package](http://hackage.haskell.org/package/unix)
## 2.7.0.2 *TBA*
......@@ -9,6 +10,9 @@
CPP macros for required getgrgid_r and getgrnam_r functions definition
so the fix is to change from C ABI calling convention to C API calling
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*
......
......@@ -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])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment