1io_pipe(3) Library Functions Manual io_pipe(3)
2
3
4
6 io_pipe - create a Unix pipe
7
9 #include <io.h>
10
11 int io_pipe(int64 pfd[2]);
12
14 io_pipe creates a new UNIX ``pipe.'' The pipe can receive data and pro‐
15 vide data; any bytes written to the pipe can then be read from the pipe
16 in the same order.
17
18 A pipe is typically stored in an 8192-byte memory buffer; the exact
19 number depends on the UNIX kernel. Bytes are written to the end of the
20 buffer and read from the beginning of the buffer. Once a byte has been
21 read, it is eliminated from the buffer, making space for another byte
22 to be written; readers cannot ``rewind'' a pipe to read old data. Once
23 8192 bytes have been written to the buffer, the pipe will not be ready
24 for further writing until some of the bytes have been read. Once all
25 the bytes written have been read, the pipe will not be ready for fur‐
26 ther reading until more bytes are written.
27
28 io_pipe sets d[0] to the number of a new descriptor reading from the
29 pipe, and sets d[1] to the number of a new descriptor writing to the
30 pipe. It then returns 1 to indicate success. If something goes wrong,
31 io_pipe returns 0, setting errno to indicate the error; in this case it
32 frees any memory that it allocated for the new pipe, and it leaves d
33 alone.
34
36 io_readfile(3), io_createfile(3), io_socketpair(3)
37
38
39
40 io_pipe(3)