Penguin

Differences between current version and revision by previous author of dup(2).

Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History

Newer page: version 3 Last edited on Thursday, October 31, 2002 5:53:01 pm by PerryLorier
Older page: version 1 Last edited on Tuesday, June 4, 2002 12:23:40 am by perry Revert
@@ -1,89 +1,36 @@
-DUP  
-!!!DUP  
-NAME  
-SYNOPSIS  
-DESCRIPTION  
-RETURN VALUE  
-ERRORS  
-WARNING  
-CONFORMING TO  
-SEE ALSO  
-----  
 !!NAME 
-  
  
 dup, dup2 - duplicate a file descriptor 
 !!SYNOPSIS 
  
  
-__#include  
- __ ''oldfd'' __);  
- int dup2 (int__ ''oldfd''__, int__ ''newfd ''__);  
- __ 
+ __#include <unistd.h> __  
+ __int dup (int__ ''oldfd''__);__  
+  
 !!DESCRIPTION 
  
+__dup__ create a copy of the file descriptor ''oldfd''.  
  
-__dup__ and __dup2__ create a copy of the file  
-descriptor ''oldfd''.  
  
+After successful return of __dup__, the old and new descriptors may be used interchangeably. They share locks, file position pointers and flags; for example, if the file position is modified by using lseek(2) on one of the descriptors, the position is also changed for the other.  
  
-After successful return of __dup __ or __dup2__, the  
-old and new descriptors may be used interchangeably. They  
- share locks, file position pointers and flags; for example,  
-if the file position is modified by using __lseek__ on  
-one of the descriptors , the position is also changed for the  
-other
+The two descriptors do __not __ share the close- on-exec flag , however
  
+dup(2) uses the lowest-numbered unused descriptor for the new descriptor.  
  
-The two descriptors do not share the close-on-exec flag,  
-however.  
-  
-  
-__dup__ uses the lowest-numbered unused descriptor for  
-the new descriptor.  
-  
-  
-__dup2__ makes ''newfd'' be the copy of ''oldfd'',  
-closing ''newfd'' first if necessary.  
 !!RETURN VALUE 
  
+__dup__ returns the new descriptor, or -1 if an error occurred (in which case, ''errno'' is set appropriately).  
  
-__dup__ and __dup2__ return the new descriptor, or -1  
-if an error occurred (in which case, ''errno'' is set  
-appropriately).  
 !!ERRORS 
  
+;[EBADF]: ''oldfd'' isn't an open file descriptor  
+;[EMFILE]: The process already has the maximum number of file descriptors open and tried to open a new one.  
  
-__EBADF__  
-  
-  
-''oldfd'' isn't an open file descriptor, or ''newfd''  
-is out of the allowed range for file  
-descriptors.  
-  
-  
-__EMFILE__  
-  
-  
-The process already has the maximum number of file  
-descriptors open and tried to open a new one.  
-!!WARNING  
-  
-  
-The error returned by __dup2__ is different to that  
-returned by __fcntl(__..., __F_DUPFD__, ...__)__  
-when ''newfd'' is out of range. On some systems  
-__dup2__ also sometimes returns __EINVAL__ like  
-__F_DUPFD__.  
 !!CONFORMING TO 
  
+SVr4, SVID, POSIX, X/OPEN, BSD 4.3. SVr4 documents additional [EINTR] and [ENOLINK] error conditions. POSIX.1 adds [EINTR].  
  
-SVr4, SVID, POSIX, X/OPEN, BSD 4.3. SVr4 documents  
-additional EINTR and ENOLINK error conditions. POSIX.1 adds  
-EINTR.  
 !!SEE ALSO 
  
-  
- fcntl(2), open(2),  
- close(2)  
-----  
+fcntl(2), open(2), close(2) 
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.