Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dup(2) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

accept(2N)

open(2)

close(2)

getdtablesize(2N)

pipe(2)

socket(2N)

dup2(3N)




dup(2) dup(2)
NAME dup - duplicate a descriptor SYNOPSIS int dup(oldd) int 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(2N). The new descriptor returned by the call is the lowest num- bered descriptor which is not currently in use by the pro- cess. The object referenced by the descriptor does not distinguish between references using the old and new descriptor in any way. Thus if the old and new descriptor are duplicate references to an open file, read(2), write(2), and lseek(2) calls all move a single pointer into the file. If a separate pointer into the file is desired, a different ob- ject 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 and errno is set to indicate the error. ERRORS dup fails if: [EBADF] The old descriptor is not a valid active descrip- tor [EMFILE] Too many descriptors are active. SEE ALSO accept(2N), open(2), close(2), getdtablesize(2N), pipe(2), socket(2N), dup2(3N). April, 1990 1

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