2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
11 /*****************************************************************************
23 Duplicates a file descriptor.
25 The object referenced by the descriptor does not distinguish between oldd
26 and newd in any way. Thus if newd and oldd are duplicate references to
27 an open file, read(), write() and lseek() calls all move a single
28 pointer into the file, and append mode, non-blocking I/O and asynchronous
29 I/O options are shared between the references. If a separate pointer
30 into the file is desired, a different object reference to the file must be
31 obtained by issuing an additional open(2) call. The close-on-exec flag
32 on the new file descriptor is unset.
35 oldfd - The file descriptor to be duplicated
38 -1 for error or the new descriptor.
40 The new descriptor returned by the call is the lowest numbered
41 descriptor currently not in use by the process.
44 This function must not be used in a shared library or
45 in a threaded application.
52 bsdsocket.library/accept(), open(), close(), fcntl(), pipe()
53 bsdsocket.library/socket()
57 ******************************************************************************/
59 return dup2(oldfd
, __getfirstfd(0));