1module System.Linux.Sendfile (
2    sendfile
3  , sendfileFd
4  , FileRange(..)
5  ) where
6
7import Data.ByteString (ByteString)
8import Network.Sendfile.Linux (sendfile', sendfileFd')
9import Network.Sendfile.Types (FileRange(..))
10import System.Posix.Types (Fd)
11
12-- |
13-- Simple binding for sendfile() of Linux.
14-- Used system calls:
15--
16--  - EntireFile -- open(), stat(), sendfile(), and close()
17--
18--  - PartOfFile -- open(), sendfile(), and close()
19--
20-- If the size of the file is unknown when sending the entire file,
21-- specifying PartOfFile is much faster.
22--
23-- The fourth action argument is called when a file is sent as chunks.
24-- Chucking is inevitable if the socket is non-blocking (this is the
25-- default) and the file is large. The action is called after a chunk
26-- is sent and bofore waiting the socket to be ready for writing.
27
28sendfile :: Fd -> ByteString -> FileRange -> IO () -> IO ()
29sendfile = sendfile'
30
31-- |
32-- Simple binding for sendfile() of Linux.
33-- Used system calls:
34--
35--  - EntireFile -- stat() and sendfile()
36--
37--  - PartOfFile -- sendfile()
38--
39-- If the size of the file is unknown when sending the entire file,
40-- specifying PartOfFile is much faster.
41--
42-- The fourth action argument is called when a file is sent as chunks.
43-- Chucking is inevitable if the socket is non-blocking (this is the
44-- default) and the file is large. The action is called after a chunk
45-- is sent and bofore waiting the socket to be ready for writing.
46
47sendfileFd :: Fd -> Fd -> FileRange -> IO () -> IO ()
48sendfileFd = sendfileFd'
49