0 | module System.Linux.Pipe
 1 |
 2 | import System.Linux.Pipe.Prim as P
 3 | import public System.Posix.Pipe
 4 |
 5 | %default total
 6 |
 7 | export %foreign "C:li_o_direct, linux-idris"
 8 | o_direct : Bits32
 9 |
10 | ||| With this flag set, a pipe will treat every `write` as a distinct data
11 | ||| package, and `read` will read one package at a time.
12 | |||
13 | ||| Note, that when writing more than `PIPE_BUF` bytes at a time, the data
14 | ||| will be split into smaller packages.
15 | export %inline
16 | O_DIRECT : Flags
17 | O_DIRECT = F o_direct
18 |
19 | --------------------------------------------------------------------------------
20 | -- API
21 | --------------------------------------------------------------------------------
22 |
23 | ||| Linux-specific version of `pipe` that allows setting additional
24 | ||| flags (`O_NONBLOCK`, `O_CLOEXEC`, `O_DIRECT`).
25 | export %inline
26 | pipe2 : Has Errno es => EIO1 f => CArrayIO 2 Fd -> Flags -> f es ()
27 | pipe2 p fs = elift1 (P.pipe2 p fs)
28 |