RTEMS Logo

RTEMS 4.10.2 On-Line Library


Input and Output Primitives Manager dup2 - Duplicates an open file descriptor

PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

5.4.3: dup2 - Duplicates an open file descriptor

CALLING SEQUENCE:

#include <unistd.h>

int dup2(
  int fildes,
  int fildes2
);

STATUS CODES:

EBADF
Invalid file descriptor.
EINTR
Function was interrupted by a signal.
EMFILE
The process already has the maximum number of file descriptors open and tried to open a new one.

DESCRIPTION:

dup2 creates a copy of the file descriptor oldfd.

The old and new descriptors may be used interchangeably. They share locks, file position pointers and flags; for example, if the file position is modified by using lseek on one of the descriptors, the position is also changed for the other.

NOTES:

NONE


PREV UP NEXT Bookshelf RTEMS POSIX API User's Guide

Copyright © 1988-2008 OAR Corporation