Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pipe(2) — NEWS-os 5.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

getmsg(2)

poll(2)

putmsg(2)

read(2)

write(2)

streamio(7)

sh(1)



pipe(2)                   SYSTEM CALLS                    pipe(2)



NAME
     pipe - create an interprocess channel

SYNOPSIS
     #include <unistd.h>

     int pipe(int fildes[2]);

DESCRIPTION
     pipe creates an I/O mechanism called a pipe and returns  two
     file  descriptors, fildes[0] and fildes[1].  The files asso-
     ciated with fildes[0] and fildes[1] are streams and are both
     opened  for reading and writing. The ONDELAY and ONONBLOCK
     flags are cleared.

     A read from fildes[0] accesses the data written to fildes[1]
     on  a  first-in-first-out  (FIFO)  basis  and  a  read  from
     fildes[1] accesses the data written to fildes[0] also  on  a
     FIFO basis.

     The FDCLOEXEC flag will be clear on both file descriptors.

     Upon  successful  completion  pipe  marks  for  update   the
     statime, stctime, and stmtime fields of the pipe.

     pipe fails if:

     EMFILE         If {OPENMAX}-1 or more file descriptors  are
                    currently open for this process.

     ENFILE         A file table entry could not be allocated.

SEE ALSO
     fcntl(2), getmsg(2), poll(2), putmsg(2), read(2),  write(2),
     streamio(7).
     sh(1) in the User's Reference Manual.

DIAGNOSTICS
     Upon successful completion, a value of 0 is returned.   Oth-
     erwise,  a value of -1 is returned and errno is set to indi-
     cate the error.

NOTES
     Since a pipe is bi-directional, there are two separate flows
     of  data.   Therefore, the size (stsize) returned by a call
     to fstat(2) with argument  fildes[0]  or  fildes[1]  is  the
     number  of  bytes  available  for  reading from fildes[0] or
     fildes[1]  respectively.   Previously,  the  size  (stsize)
     returned  by  a call to fstat() with argument fildes[1] (the
     write-end) was the number of  bytes  available  for  reading
     from fildes[0] (the read-end).




                                                                1



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