Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sh(1)

read(2)

write(2)

fork(2)

socketpair(2)

PIPE(2)

NAME

pipe − create an interprocess communication channel

USAGE

pipe(fildes) int fildes[2];

DESCRIPTION

The pipe system call creates an I/O mechanism called a pipe.  The file descriptors returned can be used in read(2) and write(2) operations.  When the pipe is written using the descriptor fildes[1], up to 5120 bytes of data are buffered before the writing process is suspended.  A read(2) using the descriptor fildes[0] will pick up the data. 

It is assumed that after the pipe has been set up, two or more cooperating processes (created by subsequent fork(2) calls) will pass data through the pipe with read and write calls. 

The shell has a syntax that allows users to set up a linear array of processes connected by pipes. 

Read calls on an empty pipe (one with no buffered data and no writers) return an end-of-file. 

Attempts to write to a pipe that has no readers will generate a SIGPIPE signal. 

NOTES

Deadlock will occur if more than 5120 bytes are necessary in any pipe among a loop of processes. 

RETURN VALUE

A successful call returns zero.  A failed call returns -1 and sets errno as indicated below. 

ERRORS

The pipe call will fail if:

[EMFILE] Too many descriptors are active. 

[EFAULT] The fildes buffer is in an invalid area of the process’s address space. 

RELATED INFORMATION

sh(1), read(2), write(2), fork(2), socketpair(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026