Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dup2(S) — OpenDesktop Software Development System 1.0.0d

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     DUP2(S)                   UNIX System V                   DUP2(S)



     Name
          dup2 - duplicate an open file descriptor

     Syntax
          int dup2 (fildes, fildes2)
          int fildes, fildes2;

     Description
          The fildes argument is a file descriptor referring to an
          open file, and fildes2 is a non-negative integer less than
          NOFiles. dup2 causes fildes2 to refer to the same file as
          fildes. If fildes2 already referred to an open file, it is
          closed first.

          The dup2 function will fail if one or more of the following
          is true:

          [EBADF]        fildes is not a valid open file descriptor.

          [EMFILE]       NOFiles file descriptors are currently open.

     See Also
          creat(S), close(S), exec(S), fcntl(S), open(S), pipe(S),
          lockf(S).

     Diagnostics
          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.

     Standards Conformance
          dup2 is conformant with:
          IEEE POSIX Std 1003.1-1988 with C Standard Language-
          Dependent System Support;
          and NIST FIPS 151-1.

                                                (printed 6/20/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026