summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/dup.2
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys/dup.2')
-rw-r--r--lib/libc/sys/dup.225
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/libc/sys/dup.2 b/lib/libc/sys/dup.2
index c87b386..d2a4b7e 100644
--- a/lib/libc/sys/dup.2
+++ b/lib/libc/sys/dup.2
@@ -28,7 +28,7 @@
.\" @(#)dup.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd June 4, 1993
+.Dd August 14, 2011
.Dt DUP 2
.Os
.Sh NAME
@@ -115,6 +115,11 @@ and
is a valid descriptor, then
.Fn dup2
is successful, and does nothing.
+.Pp
+The related
+.Xr cap_new 2
+system call allows file descriptors to be duplicated with restrictions on
+their use.
.Sh RETURN VALUES
The value -1 is returned if an error occurs in either call.
The external variable
@@ -123,22 +128,30 @@ indicates the cause of the error.
.Sh ERRORS
The
.Fn dup
-and
-.Fn dup2
-system calls fail if:
+system call fails if:
.Bl -tag -width Er
.It Bq Er EBADF
The
.Fa oldd
-or
-.Fa newd
argument
is not a valid active descriptor
.It Bq Er EMFILE
Too many descriptors are active.
.El
+The
+.Fn dup2
+system call fails if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa oldd
+argument is not a valid active descriptor or the
+.Fa newd
+argument is negative or exceeds the maximum allowable descriptor number
+.El
.Sh SEE ALSO
.Xr accept 2 ,
+.Xr cap_new 2 ,
.Xr close 2 ,
.Xr fcntl 2 ,
.Xr getdtablesize 2 ,
OpenPOWER on IntegriCloud