Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dup(2) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close(2)

creat(2)

dup2(3C)

exec(2)

fcntl(2)

getrlimit(2)

lockf(3C)

open(2)

pipe(2)

dup(2)






       dup(2)                                                        dup(2)


       NAME
             dup - duplicate an open file descriptor

       SYNOPSIS
             #include <unistd.h>
             int dup(int fildes);

       DESCRIPTION
             dup duplicates an open file descriptor.  fildes is a file
             descriptor obtained from a creat, open, dup, fcntl, pipe, or
             ioctl system call.  dup returns a new file descriptor having
             the following 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 is set to remain open across exec
             system calls [see fcntl(2)].

             The file descriptor returned is the lowest one available.

          Return Values
             On success, dup returns a non-negative integer, namely the
             file descriptor.  On failure, dup returns -1 and sets errno to
             identify the error.

          Errors
             In the following conditions, dup fails and sets errno to:

             EBADF          fildes is not a valid open file descriptor.

             EINTR          A signal was caught during the dup system call.

             EMFILE         The process has too many open files [see
                            getrlimit(2)].

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

       REFERENCES
             close(2), creat(2), dup2(3C), exec(2), fcntl(2), getrlimit(2),
             lockf(3C), open(2), pipe(2)


                           Copyright 1994 Novell, Inc.               Page 1













      dup(2)                                                        dup(2)


      NOTICES
         Considerations for Threads Programming
            Open file descriptors are a process resource and available to
            any sibling thread; if used concurrently, actions by one
            thread can interfere with those of a sibling.











































                          Copyright 1994 Novell, Inc.               Page 2








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