pxfdup(3F)

PXFDUP - Duplicate an open file descriptor

As shipped in IRIX 6.5.22. Added in IRIX 6.5.19.

NAME
     PXFDUP -  Duplicate an open file descriptor

SYNOPSIS
     SUBROUTINE PXFDUP (ifildes, ifid, ierror)
     INTEGER ifildes, ifid, ierror

     SUBROUTINE PXFDUP2 (ifildes, ifildes2, ierror)
     INTEGER ifildes, ifildes2, ierror

DESCRIPTION
     PXFDUP uses the dup(2) system call to duplicate an open file descriptor.
     The argument ifildes is a file descriptor obtained from a pxfcreat,
     pxfopen, pxfdup, pxffcntl, or pxfpipe call.

     ifid is a file descriptor with the following characteristics:

     *   Same open file or pipe as ifildes.

     *   Same file pointer as ifildes. Both file descriptors share one file
         pointer.

     *   Same access mode as ifildes (read, write, read/write).

     PXFDUP2 uses the dup2 function to duplicate an open file descriptor
     ifildes onto a new file descriptor ifildes2.  ifildes2 must be a non-
     negative integer less than the maximum number of open files that will
     refer to the same file as ifildes after dup2.  If ifildes2 already refers
     to an open file, that file is first closed, as if the close system call
     had been performed.  If ifildes2 already refers to ifildes or if ifildes
     is not a valid open file descriptor, ifildes2 will not be closed first.

     The following are valid arguments for this routine:

     ifildes   Default integer input variable containing a file

     ifildes2  Default integer input variable containing a file descriptor.

     ifid      Default integer output variable containing the duplicate file
               descriptor.

     ierror    Default integer output variable that contains zero if the
               operation was successful or nonzero if the operation was not
               successful.

     PXFDUP may return one of the following error values:

     EBADF       If ifildes is not a valid open file descriptor.

     EMFILE      If the number of file descriptors would exceed OPEN_MAX.
     On IRIX systems, PXFDUP may also return:

     EINTR       If the dup system call was interrupted by a signal.

     ENOLINK     If file descriptor is on a remote machine and the link to
                 that machine is no longer active.

     PXFDUP2 may return one of the following error values:

     EBADF
          If ifildes is not a valid open file descriptor, or if ifildes2 is
          negative or greater than or equal to the maximum number of open
          files available.

     EINTR
          If the dup2 system call was interrupted by a signal.

     EMFILE
          If the maximum number of files are currently open.

NOTES
     The PXF_DEFINITIONS module can be used by Fortran 90 users to enable
     caller-callee interface checking.

SEE ALSO
     dup(2)