Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dup2(3c) — 4D1 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

close(2)

exec(2)

fcntl(2)

open(2)

pipe(2)

lockf(3C)



     DUP2(3C)                                                 DUP2(3C)



     NAME
          dup2 - duplicate an open file descriptor

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

     DESCRIPTION
          Fildes 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.

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

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

          [EMFILE]       NOFILES file descriptors are currently open.

     SEE ALSO
          creat(2), close(2), exec(2), fcntl(2), open(2), pipe(2),
          lockf(3C).

     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.

     ORIGIN
          AT&T V.3
























     Page 1                                        (last mod. 8/20/87)



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