*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> dup2 (3c)              
Title
Content
Arch
Section
 

Contents


dup2(3C)							      dup2(3C)


NAME    [Toc]    [Back]

     dup2 - duplicate an open file descriptor

SYNOPSIS    [Toc]    [Back]

     #include <unistd.h>

     int dup2 (int fildes, int fildes2);

DESCRIPTION    [Toc]    [Back]

     fildes is a file descriptor referring to an open file, and	fildes2	is a
     non-negative integer less than the	maximum	number of open files
     available.	 dup2 causes fildes2 to	refer to the same file as fildes.  If
     fildes2 already referred to an open file, not fildes, it is closed	first.
     If	fildes2	refers to fildes, or if	fildes is not a	valid open file
     descriptor, fildes2 will not be closed first.

     dup2 will fail if one or more of the following are	true:

     EBADF	    fildes is not a valid open file descriptor.

     EBADF	    fildes2 is negative	or greater than	or equal to the
		    maximum number of open files available.

     EINTR	    a signal was caught	during the dup2	call.

     EMFILE	    The	maximum	number of file descriptors are currently open.

SEE ALSO    [Toc]    [Back]

      
      
     creat(2), close(2), exec(2), fcntl(2), open(2), pipe(2), lockf(3C),
     limits(4)

DIAGNOSTICS    [Toc]    [Back]

     Upon successful completion	a non-negative integer,	namely,	the file
     descriptor, is returned.  Otherwise, a value of -1	is returned and	errno
     is	set to indicate	the error.


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
dup2 HP-UX duplicate an open file descriptor to a specific slot
dup Linux duplicate a file descriptor
dup2 FreeBSD duplicate an existing file descriptor
dup NetBSD duplicate an existing file descriptor
dup OpenBSD duplicate an existing file descriptor
dup2 OpenBSD duplicate an existing file descriptor
dup FreeBSD duplicate an existing file descriptor
dup2 NetBSD duplicate an existing file descriptor
AFidentifyfd IRIX retrieve the audio file format of a file descriptor / open AFfilehandle
getdtablehi IRIX get largest open file descriptor index
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service