From 7e0f021a9aec35fd8e6725e87e3313b101d26f5e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 27 Jan 2008 11:37:44 +0100 Subject: Initial import (2.0.2-6) --- reference/C/MAN/dup.htm | 98 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 reference/C/MAN/dup.htm (limited to 'reference/C/MAN/dup.htm') diff --git a/reference/C/MAN/dup.htm b/reference/C/MAN/dup.htm new file mode 100644 index 0000000..4ade0c3 --- /dev/null +++ b/reference/C/MAN/dup.htm @@ -0,0 +1,98 @@ +dup + +
+
+
+
+
+

DUP(2) Linux Programmer's Manual DUP(2) +

+ +

NAME +

dup, dup2 - duplicate a file descriptor + +

SYNOPSIS +

#include <unistd.h> + + int dup(int oldfd); + int dup2(int oldfd, int newfd); + +

DESCRIPTION +

dup and dup2 create 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. + + The two descriptors do not share the close-on-exec flag, + however. + + dup uses the lowest-numbered unused descriptor for the new + descriptor. + + dup2 makes newfd be the copy of oldfd, closing newfd first + if necessary. + +

RETURN VALUE +

dup and dup2 return the new descriptor, or -1 if an error + occurred (in which case, errno is set appropriately). + +

ERRORS +

EBADF oldfd isn't an open file descriptor, or newfd is + out of the allowed range for file descriptors. + + EMFILE The process already has the maximum number of file + descriptors open and tried to open a new one. + +

WARNING +

The error returned by dup2 is different to that returned + by fcntl(...,F_DUPFD,...) when newfd is out of range. On + some systems dup2 also sometimes returns EINVAL like + F_DUPFD. + +

CONFORMING TO +

SVID, AT&T, POSIX, X/OPEN, BSD 4.3 + +
+
+

SEE ALSO +

+fcntl, +open, +

+
+
+
+
+
+
+
+
+

Linux 1.1.46 21 August 1994 1 +

+ +
+

+


+

+

+ + + + +
+Top + +Master Index + +Keywords + +Functions +
+
+

+


+ +This manual page was brought to you by mjl_man V-2.0 -- cgit v1.2.3-54-g00ecf