X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/9bccf70c0258c7cac2dcb80011b2a964d884c552..4bd07ac2140668789aa3ee8ec4dde4a3e0a3bba5:/bsd/man/man2/pipe.2?ds=sidebyside diff --git a/bsd/man/man2/pipe.2 b/bsd/man/man2/pipe.2 index 759b9b9ef..df5b9d85c 100644 --- a/bsd/man/man2/pipe.2 +++ b/bsd/man/man2/pipe.2 @@ -33,7 +33,7 @@ .\" .\" @(#)pipe.2 8.1 (Berkeley) 6/4/93 .\" -.Dd June 4, 1993 +.Dd February 17, 2011 .Dt PIPE 2 .Os BSD 4 .Sh NAME @@ -42,34 +42,36 @@ .Sh SYNOPSIS .Fd #include .Ft int -.Fn pipe "int *fildes" +.Fo pipe +.Fa "int fildes[2]" +.Fc .Sh DESCRIPTION The .Fn pipe function creates a -.Em pipe , -which is an object allowing -unidirectional data flow, +.Em pipe +(an object that allows unidirectional data flow) and allocates a pair of file descriptors. The first descriptor connects to the .Em read end -of the pipe, -and the second connects to the -.Em write end , -so that data written to +of the pipe; +the second connects to the +.Em write end . +.Pp +Data written to .Fa fildes[1] appears on (i.e., can be read from) .Fa fildes[0] . This allows the output of one program to be sent to another program: -the source's standard output is set up to be -the write end of the pipe, -and the sink's standard input is set up to be -the read end of the pipe. -The pipe itself persists until all its associated descriptors are -closed. +the source's standard output is set up +to be the write end of the pipe; +the sink's standard input is set up +to be the read end of the pipe. +The pipe itself persists +until all of its associated descriptors are closed. .Pp A pipe whose read or write end has been closed is considered .Em widowed . @@ -80,6 +82,12 @@ signal. Widowing a pipe is the only way to deliver end-of-file to a reader: after the reader consumes any buffered data, reading a widowed pipe returns a zero count. +.Pp +The generation of the +.Dv SIGPIPE +signal can be suppressed using the +.Dv F_SETNOSIGPIPE +fcntl command. .Sh RETURN VALUES On successful creation of the pipe, zero is returned. Otherwise, a value of -1 is returned and the variable @@ -91,22 +99,26 @@ The .Fn pipe call will fail if: .Bl -tag -width Er -.It Bq Er EMFILE -Too many descriptors are active. -.It Bq Er ENFILE -The system file table is full. +.\" =========== .It Bq Er EFAULT The .Fa fildes buffer is in an invalid area of the process's address space. +.\" =========== +.It Bq Er EMFILE +Too many descriptors are active. +.\" =========== +.It Bq Er ENFILE +The system file table is full. .El .Sh SEE ALSO .Xr sh 1 , -.Xr read 2 , -.Xr write 2 , .Xr fork 2 , -.Xr socketpair 2 +.Xr read 2 , +.Xr socketpair 2 , +.Xr fcntl 2 , +.Xr write 2 .Sh HISTORY A .Fn pipe