File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / man / man2 / pipe.2
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:26:35 2019 UTC (6 years, 11 months ago) by root
Branches: bsd, MAIN
CVS tags: v121, HEAD
Power 6/32 Unix version 1.21

.TH PIPE 2 "12 February 1983"
.UC 4
.SH NAME
pipe \- create an interprocess communication channel
.SH SYNOPSIS
.nf
.ft B
pipe(fildes)
int fildes[2];
.fi
.ft R
.SH DESCRIPTION
The
.I pipe
system call
creates an I/O mechanism called a pipe.
The file descriptors returned can
be used in read and write operations.
When the pipe is written using the descriptor
.IR fildes [1]
up to 4096 bytes of data are buffered
before the writing process is suspended.
A read using the descriptor
.IR fildes [0]
will pick up the data.
.PP
It is assumed that after the
pipe has been set up,
two (or more)
cooperating processes
(created by subsequent
.I fork
calls)
will pass data through the
pipe with
.I read
and
.I write
calls.
.PP
The shell has a syntax
to set up a linear array of processes
connected by pipes.
.PP
Read calls on an empty
pipe (no buffered data) with only one end
(all write file descriptors closed)
returns an end-of-file.
.PP
Pipes are really a special case of the 
.IR socketpair (2)
call and, in fact, are implemented as such in the system.
.PP
If you attempt a write on a pipe with only one end, a signal is generated.
.SH "RETURN VALUE
The function value zero is returned if the
pipe was created; \-1 if an error occurred.
.SH ERRORS
The \fIpipe\fP call fails if:
.TP 15
[EMFILE]
Too many descriptors are active.
.TP 15
[EFAULT]
The \fIfildes\fP buffer is in an invalid area of the process's address
space.
.SH "SEE ALSO"
sh(1), read(2), write(2), fork(2), socketpair(2)
.SH BUGS
Should more than 4096 bytes be necessary in any
pipe among a loop of processes, deadlock occurs.

unix.superglobalmegacorp.com

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