Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dup(3) — A/UX 0.7

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

accept(2N)

open(2)

close(2)

pipe(2)

socket(2N)

getdtablesize(3N)



     dup(3)                                                     dup(3)



     NAME
          dup - duplicate a descriptor

     SYNOPSIS
          news = dup(oldd)
          int newd, oldd;

     DESCRIPTION
          dup duplicates an existing object descriptor.  The argument
          oldd is a small non-negative integer index in the per-
          process descriptor table.  The value must be less than the
          size of the table, which is returned by getdtablesize(3N).
          The new descriptor newd returned by the call is the lowest
          numbered descriptor which 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,
          read(2), write(3), and lseek(2) 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 open(2) call.

     RETURN VALUE
          The value -1 is returned if an error occurs in either call.
          The external variable errno indicates the cause of the
          error.

     ERRORS
          dup fails if:

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

          [EMFILE]     Too many descriptors are active.

     SEE ALSO
          accept(2N), open(2), close(2), pipe(2), socket(2N),
          getdtablesize(3N).
















     Page 1                                        (last mod. 1/14/87)



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