Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

close(2)

exec(2)

fcntl(2)

open(2)

pipe(2)



DUP(2)                   DOMAIN/IX SYS5                    DUP(2)



NAME
     dup - duplicate an open file descriptor

USAGE
     int dup (fildes)
     int fildes;


DESCRIPTION
     Fildes is the name of a file descriptor returned by a creat,
     open, dup, fcntl, or pipe system call.  Dup returns a new
     file descriptor that has the following characteristics in
     common with the original:

     ⊕  Same open file (or pipe).

     ⊕  Same file pointer (i.e., both file descriptors share one
        file pointer).

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

     The new file descriptor remains open across exec system
     calls.  See fcntl(2).

     The file descriptor returned is given the lowest number
     available.

RETURN VALUE
     A successful call returns a non-negative integer file
     descriptor.  A failed call returns -1 and sets errno as
     indicated below.

ERRORS
     Dup fails if one or more of the following is true:

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

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

RELATED INFORMATION
     creat(2), close(2), exec(2), fcntl(2), open(2), pipe(2)











Printed 12/4/86                                             DUP-1





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