Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dup(2) — DG/UX R4.11MU05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

accept(2)

close(2)

creat(2)

dup2(2)

exec(2)

fcntl(2)

getdtablesize(2)

open(2)

pipe(2)

socket(2)

socketpair(2)



dup(2)                         DG/UX R4.11MU05                        dup(2)


NAME
       dup - duplicate an open file descriptor

SYNOPSIS
       #include <unistd.h>

       int  dup (fildes)
       int  fildes;

   where:
       fildes    A valid, active file descriptor

DESCRIPTION
       If fildes is a valid, active descriptor, then this call returns a new
       file descriptor with both descriptors sharing the same object
       pointer.  The new descriptor is set to remain open across exec system
       calls.  This call is identical to newfiledes = fcntl (filedes,
       FDUPFD, 0).

       The new descriptor belongs to the same descriptor class as filedes.
       That is, if filedes is a shared descriptor, the new descriptor is in
       the same shared descriptor array, and if filedes is a per-process
       descriptor, then so is the new descriptor.

ACCESS CONTROL
       None.

RETURN VALUE
       0..NOFILE-1    The value of the new file descriptor.

       -1             An error occurred.  errno is set to indicate the
                      error.

DIAGNOSTICS
       Errno may be set to one of the following error codes:

       EBADF     Fildes is not a valid, active descriptor.

       EMFILE    All descriptors are open.

SEE ALSO
       accept(2), close(2), creat(2), dup2(2), exec(2), fcntl(2),
       getdtablesize(2), open(2), pipe(2), socket(2), socketpair(2),
       dgattachtoshareddescriptors(2).

STANDARDS
       When using m88kbcs as the Software Development Environment target,
       the dup function will be emulated using the fcntl(2) system call.
       Since this is an emulation, a slight performance degradation may be
       noticed in comparison to using dup in /lib/libc.a.


Licensed material--property of copyright holder(s)

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