Annotation of 43BSDReno/lib/libc/sys/pipe.2, revision 1.1.1.1

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