Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dup(2) — sys5 — Apollo Domain/OS SR10.3.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close(2)

creat(2)

exec(2)

fcntl(2)

open(2)

pipe(2)

lockf(3C)

DUP(2)                               SysV                               DUP(2)



NAME
     dup - duplicate an open file descriptor

SYNOPSIS
     int dup (fildes)
     int fildes;

DESCRIPTION
     fildes is a file descriptor obtained from a creat, open, dup, fcntl, or
     pipe system call.  dup returns a new file descriptor having the following
     in common with the original:

     ⊕  Same open file (or pipe).

     ⊕  Same file pointer (that is, both file descriptors share one file
        pointer).

     ⊕  Same access mode (read, write, or read/write).

     The new file descriptor is set to remain open across exec system calls.
     See fcntl(2).

     The file descriptor returned is the lowest one available.

ERRORS
     dup fails if one or more of the following are true:

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

     [EINTR]     A signal was caught during the dup system call.

     [EMFILE]    The maximum number of open file descriptors allowed would be
                 exceeded.

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

DIAGNOSTICS
     A successful call returns a non-negative integer file descriptor.  A
     failed call returns -1 and sets errno as indicated under "Errors."

NOTES
     Under other implementations, dup fails if the following is true:

     [ENOLINK]   fildes is on a remote machine and the link to that machine is
                 no longer active.

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