Deleted Added
full compact
dup.2 (108087) dup.2 (131504)
1.\" Copyright (c) 1980, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)dup.2 8.1 (Berkeley) 6/4/93
1.\" Copyright (c) 1980, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)dup.2 8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: head/lib/libc/sys/dup.2 108087 2002-12-19 09:40:28Z ru $
33.\" $FreeBSD: head/lib/libc/sys/dup.2 131504 2004-07-02 23:52:20Z ru $
34.\"
35.Dd June 4, 1993
36.Dt DUP 2
37.Os
38.Sh NAME
39.Nm dup ,
40.Nm dup2
41.Nd duplicate an existing file descriptor

--- 12 unchanged lines hidden (view full) ---

54duplicates an existing object descriptor and returns its value to
55the calling process
56.Fa ( newd
57=
58.Fn dup oldd ) .
59The argument
60.Fa oldd
61is a small non-negative integer index in
34.\"
35.Dd June 4, 1993
36.Dt DUP 2
37.Os
38.Sh NAME
39.Nm dup ,
40.Nm dup2
41.Nd duplicate an existing file descriptor

--- 12 unchanged lines hidden (view full) ---

54duplicates an existing object descriptor and returns its value to
55the calling process
56.Fa ( newd
57=
58.Fn dup oldd ) .
59The argument
60.Fa oldd
61is a small non-negative integer index in
62the per-process descriptor table. The value must be less
62the per-process descriptor table.
63The value must be less
63than the size of the table, which is returned by
64.Xr getdtablesize 2 .
65The new descriptor returned by the call
66is the lowest numbered descriptor
67currently not in use by the process.
68.Pp
69The object referenced by the descriptor does not distinguish
70between

--- 20 unchanged lines hidden (view full) ---

91.Xr open 2
92system call.
93The close-on-exec flag on the new file descriptor is unset.
94.Pp
95In
96.Fn dup2 ,
97the value of the new descriptor
98.Fa newd
64than the size of the table, which is returned by
65.Xr getdtablesize 2 .
66The new descriptor returned by the call
67is the lowest numbered descriptor
68currently not in use by the process.
69.Pp
70The object referenced by the descriptor does not distinguish
71between

--- 20 unchanged lines hidden (view full) ---

92.Xr open 2
93system call.
94The close-on-exec flag on the new file descriptor is unset.
95.Pp
96In
97.Fn dup2 ,
98the value of the new descriptor
99.Fa newd
99is specified. If this descriptor is already in use and
100is specified.
101If this descriptor is already in use and
100.Fa oldd
101\*(Ne
102.Fa newd ,
103the descriptor is first deallocated as if the
104.Xr close 2
105system call had been used.
106If
107.Fa oldd

--- 57 unchanged lines hidden ---
102.Fa oldd
103\*(Ne
104.Fa newd ,
105the descriptor is first deallocated as if the
106.Xr close 2
107system call had been used.
108If
109.Fa oldd

--- 57 unchanged lines hidden ---