
On 21:06 Tue 19 May , Kazu Yamamoto wrote:
Hi,
I'm a maintainer of simple-sendfile and need to implement the following is to rescue 32bit Linux:
- If the COff size is 8, the following FFI is used:
foreign import ccall unsafe "sendfile64" c_sendfile :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
- Otherwise, the following FFI is used:
foreign import ccall unsafe "sendfile" c_sendfile :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
How can I implement this?
I guess that Setup.hs should evaluate (sizeOf (1 :: COff)) and define a C macro, say LARGE_OFFSET and write the following code.
#ifdef LARGE_OFFSET foreign import ccall unsafe "sendfile64" #else foreign import ccall unsafe "sendfile" #endif
I have no experience to use Build-Type: other than Simple in cabal files. Would someone explain how to implement it concretely or suggest examples which implement similar things?
For more informaion, please read: https://github.com/yesodweb/wai/issues/372
Thanks.
--Kazu _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
I believe you could use __USE_FILE_OFFSET64 macro imported from sys/types.h. I'm not sure if it's present on other than linux/glibc systems though.