Research V7 development
authorKen Thompson <ken@research.uucp>
Fri, 12 Jan 1979 20:41:11 +0000 (15:41 -0500)
committerKen Thompson <ken@research.uucp>
Fri, 12 Jan 1979 20:41:11 +0000 (15:41 -0500)
Work on file usr/man/man2/pipe.2

Synthesized-from: v7

usr/man/man2/pipe.2 [new file with mode: 0644]

diff --git a/usr/man/man2/pipe.2 b/usr/man/man2/pipe.2
new file mode 100644 (file)
index 0000000..0499160
--- /dev/null
@@ -0,0 +1,64 @@
+.TH PIPE 2 
+.SH NAME
+pipe \- create an interprocess channel
+.SH SYNOPSIS
+.B pipe(fildes)
+.br
+.B int fildes[2];
+.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.
+Writes with a count of 4096 bytes or less are atomic;
+no other process can intersperse 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.
+.SH "SEE ALSO"
+sh(1), read(2), write(2), fork(2)
+.SH DIAGNOSTICS
+The function value zero is returned if the
+pipe was created; \-1 if
+too many files are already open.
+A signal is generated if a write on a pipe with only one end is attempted.
+.SH BUGS
+Should more than 4096 bytes be necessary in any
+pipe among a loop of processes, deadlock will occur.
+.SH ASSEMBLER
+(pipe = 42.)
+.br
+.B sys pipe
+.br
+(read file descriptor in r0)
+.br
+(write file descriptor in r1)