Annotation of cci/usr/src/man/man2/pipe.2, revision 1.1.1.1

1.1       root        1: .TH PIPE 2 "12 February 1983"
                      2: .UC 4
                      3: .SH NAME
                      4: pipe \- create an interprocess communication channel
                      5: .SH SYNOPSIS
                      6: .nf
                      7: .ft B
                      8: pipe(fildes)
                      9: int fildes[2];
                     10: .fi
                     11: .ft R
                     12: .SH DESCRIPTION
                     13: The
                     14: .I pipe
                     15: system call
                     16: creates an I/O mechanism called a pipe.
                     17: The file descriptors returned can
                     18: be used in read and write operations.
                     19: When the pipe is written using the descriptor
                     20: .IR fildes [1]
                     21: up to 4096 bytes of data are buffered
                     22: before the writing process is suspended.
                     23: A read using the descriptor
                     24: .IR fildes [0]
                     25: will pick up the data.
                     26: .PP
                     27: It is assumed that after the
                     28: pipe has been set up,
                     29: two (or more)
                     30: cooperating processes
                     31: (created by subsequent
                     32: .I fork
                     33: calls)
                     34: will pass data through the
                     35: pipe with
                     36: .I read
                     37: and
                     38: .I write
                     39: calls.
                     40: .PP
                     41: The shell has a syntax
                     42: to set up a linear array of processes
                     43: connected by pipes.
                     44: .PP
                     45: Read calls on an empty
                     46: pipe (no buffered data) with only one end
                     47: (all write file descriptors closed)
                     48: returns an end-of-file.
                     49: .PP
                     50: Pipes are really a special case of the 
                     51: .IR socketpair (2)
                     52: call and, in fact, are implemented as such in the system.
                     53: .PP
                     54: A signal is generated if a write on a pipe with only one end is attempted.
                     55: .SH "RETURN VALUE
                     56: The function value zero is returned if the
                     57: pipe was created; \-1 if an error occurred.
                     58: .SH ERRORS
                     59: The \fIpipe\fP call will fail if:
                     60: .TP 15
                     61: [EMFILE]
                     62: Too many descriptors are active.
                     63: .TP 15
                     64: [EFAULT]
                     65: The \fIfildes\fP buffer is in an invalid area of the process's address
                     66: space.
                     67: .SH "SEE ALSO"
                     68: sh(1), read(2), write(2), fork(2), socketpair(2)
                     69: .SH BUGS
                     70: Should more than 4096 bytes be necessary in any
                     71: pipe among a loop of processes, deadlock will occur.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.