diff options
Diffstat (limited to 'usr/src/man/man3c/dup2.3c')
-rw-r--r-- | usr/src/man/man3c/dup2.3c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/usr/src/man/man3c/dup2.3c b/usr/src/man/man3c/dup2.3c index eb19b74ff5..a2742a732f 100644 --- a/usr/src/man/man3c/dup2.3c +++ b/usr/src/man/man3c/dup2.3c @@ -1,12 +1,13 @@ '\" te +.\" Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. .\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 1989 AT&T .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH DUP2 3C "Dec 19, 2003" +.TH DUP2 3C "Apr 19, 2013" .SH NAME -dup2 \- duplicate an open file descriptor +dup2, dup3 \- duplicate an open file descriptor .SH SYNOPSIS .LP .nf @@ -15,6 +16,11 @@ dup2 \- duplicate an open file descriptor \fBint\fR \fBdup2\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIfildes2\fR); .fi +.LP +.nf +\fBint\fR \fBdup3\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIfildes2\fR, \dBint\fR \fIflags\fR); +.fi + .SH DESCRIPTION .sp .LP @@ -30,6 +36,14 @@ to \fIfildes\fR, or if \fIfildes\fR is not a valid open file descriptor, .LP The \fBdup2()\fR function is equivalent to \fBfcntl\fR(\fIfildes\fR, \fBF_DUP2FD\fR, \fIfildes2\fR). +.sp +.LP +Ths \fBdup3()\fR function works similarly to the \fBdup2()\fR function with +two exceptions. If \fIfildes\fR and \fIfildes2\fR point to the same file +descriptor, -1 is returned and errno set to \fBEINVAL\fR. If \fIflags\fR +is \fBO_CLOEXEC\fR, then \fIfiledes2\fB will have the \fBFD_CLOEXEC\fR flag +set causing the file descriptor to be closed during any future call of +\fBexec\fR(2). .SH RETURN VALUES .sp .LP @@ -39,7 +53,7 @@ set to indicate the error. .SH ERRORS .sp .LP -The \fBdup2()\fR function will fail if: +The \fBdup2()\fR and \fBdup3()\fR functions will fail if: .sp .ne 2 .na @@ -77,6 +91,18 @@ A signal was caught during the \fBdup2()\fR call. The process has too many open files. See \fBfcntl\fR(2). .RE +.sp +.LP +Additionally, the \fBdup3()\fR function will fail if: +.sp +.ne 2 +.na +\fB\fBEINVAL\fR\fR +.ad +.RS 10n +\fIflags\fR has a value other than 0 or \fBO_CLOEXEC\fR or \fIfildes\fR and \fIfildes2\fB point to the same file descriptor. +.RE + .SH ATTRIBUTES .sp .LP |