dup man page on Ultrix

Man page or keyword search:  
man Server   3690 pages
apropos Keyword Search (all sections)
Output format
Ultrix logo
[printable version]

dup(2)									dup(2)

Name
       dup, dup2 - duplicate an open file descriptor

Syntax
       newd = dup(oldd)
       int newd, oldd;

       dup2(oldd, newd)
       int oldd, newd;

Description
       The system call duplicates an existing object descriptor.  The argument
       oldd is a small non-negative integer index in the per-process  descrip‐
       tor table.  The value must be less than the size of the table, which is
       returned by The new descriptor, newd, returned by the call is the  low‐
       est numbered descriptor that is not currently in use by the process.

       The  object  referenced	by the descriptor does not distinguish between
       references using oldd and newd in any way.  Thus, if newd and oldd  are
       duplicate  references  to  an  open  file,  and calls all move a single
       pointer into the file.  If a separate pointer into the file is desired,
       a different object reference to the file must be obtained by issuing an
       additional call.

       In the second form of the call, specify the value of  newd  needed.  If
       this  descriptor is already in use, the descriptor is first deallocated
       as if a call had been done.

Return Values
       The value -1 is returned if an error occurs in either call.  The exter‐
       nal variable errno indicates the cause of the error.

Diagnostics
       The and system calls fail under the following conditions:

       [EBADF]	      The oldd or newd is not a valid active descriptor.

       [EMFILE]	      Too many descriptors are active.

       [EINTR]	      The or function was terminated prematurely by a signal.

See Also
       accept(2),  close(2),  getdtablesize(2),	 lseek(2),  open(2),  pipe(2),
       read(2), socket(2), socketpair(2), write(2)

									dup(2)
[top]

List of man pages available for Ultrix

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net