
19 May
2015
19 May
'15
2:06 p.m.
On Tue, May 19, 2015 at 9:29 AM, Jonas Scholl
foreign import ccall unsafe "sendfile64" c_sendfile64 :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
foreign import ccall unsafe "sendfile" c_sendfile32 :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
c_sendfile :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t) c_sendfile = case sizeOf (undefined :: COff) of 4 -> c_sendfile32 8 -> c_sendfile64 _ -> error "COff has an unsupported size"
This has the advantage of being nicer to cross-compilers. Perhaps it won’t degrade performance significantly.