pipe(2) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

pipe(2)

pipe(2)                          System Calls                          pipe(2)



NAME
       pipe, pipe2 - create an interprocess channel

SYNOPSIS
       #include <unistd.h>

       int pipe(int fildes[2]);

       int pipe2(int fildes[2], int flags);

DESCRIPTION
       The  pipe() function creates an I/O mechanism called a pipe and returns
       two file descriptors, fildes[0] and  fildes[1].  The  files  associated
       with  fildes[0] and fildes[1] are streams and are both opened for read‐
       ing and writing. The O_NDELAY, O_NONBLOCK,  and  FD_CLOEXEC  flags  are
       cleared  on both file descriptors. The fcntl(2) function can be used to
       set these flags.


       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 pipe2() function behaves like pipe()  but  has  a  second  argument
       which  can  contain  the following open(2) flags: O_CLOEXEC, O_CLOFORK,
       O_NOSIGPIPE, O_NDELAY, O_NONBLOCK and O_NOSTDFD.


       Upon successful completion pipe()  and  pipe2()  mark  for  update  the
       st_atime, st_ctime, and st_mtime fields of the pipe.

RETURN VALUES
       Upon  successful  completion,  0 is returned. Otherwise, −1 is returned
       and errno is set to indicate the error.

ERRORS
       The pipe() and pipe2() functions will fail if:

       EMFILE    More than {OPEN_MAX} file descriptors are already in  use  by
                 this process.


       ENFILE    The  number  of simultaneously open files in the system would
                 exceed a system-imposed limit.



       The pipe2() function will fail if:

       EINVAL    An invalid flags argument has been passed


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE  TYPEAT‐
       TRIBUTE  VALUE  _  Interface StabilityCommitted _ MT-LevelAsync-Signal-
       Safe _ StandardSee standards(7).


SEE ALSO
       sh(1), fcntl(2),  fstat(2),  getmsg(2),  poll(2),  poll(2),  putmsg(2),
       read(2), write(2), streamio(4I), attributes(7), standards(7)

NOTES
       Since  a  pipe is bi-directional, there are two separate flows of data.
       Therefore, the size (st_size) returned by a call to fstat(2) with argu‐
       ment  fildes[0] or fildes[1] is the number of bytes available for read‐
       ing from fildes[0] or  fildes[1]  respectively.  Previously,  the  size
       (st_size)  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).



Oracle Solaris 11.4               20 May 2020                          pipe(2)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3