Unix/Linux Go Back    

OpenSolaris 2009.06 - man page for pipe (opensolaris section 2)

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)

pipe(2) 				   System Calls 				  pipe(2)

       pipe - create an interprocess channel

       #include <unistd.h>

       int pipe(int fildes[2]);

       The  pipe()  function creates an I/O mechanism called a pipe and returns two file descrip-
       tors, fildes[0] and fildes[1]. The files  associated  with  fildes[0]  and  fildes[1]  are
       streams	and  are  both	opened	for  reading  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.

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

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

       The pipe() function 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.

       See attributes(5) for descriptions of the following attributes:

       |      ATTRIBUTE TYPE	     |	    ATTRIBUTE VALUE	   |
       |Interface Stability	     |Standard			   |
       |MT-Level		     |Async-Signal-Safe 	   |

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

       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 argument  fildes[0] or fildes[1] is the num-
       ber  of	bytes available for reading 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).

SunOS 5.11				   23 Apr 2002					  pipe(2)
Unix & Linux Commands & Man Pages : ©2000 - 2018 Unix and Linux Forums

All times are GMT -4. The time now is 10:13 PM.