X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/b0d623f7f2ae71ed96e60569f61f9a9a27016e80..cb3231590a3c94ab4375e2228bd5e86b0cf1ad7e:/bsd/man/man2/dup.2?ds=sidebyside diff --git a/bsd/man/man2/dup.2 b/bsd/man/man2/dup.2 index c13ca0bb5..ec0f84d32 100644 --- a/bsd/man/man2/dup.2 +++ b/bsd/man/man2/dup.2 @@ -33,7 +33,7 @@ .\" .\" @(#)dup.2 8.1 (Berkeley) 6/4/93 .\" -.Dd June 4, 1993 +.Dd December 1, 2010 .Dt DUP 2 .Os BSD 4 .Sh NAME @@ -52,7 +52,7 @@ .Fa "int fildes2" .Fc .Sh DESCRIPTION -.Fn Dup +.Fn dup duplicates an existing object descriptor and returns its value to the calling process .Fa ( fildes2 @@ -100,8 +100,18 @@ In the value of the new descriptor .Fa fildes2 is specified. -If this descriptor is already in use, -the descriptor is first deallocated as if a +If +.Fa fildes +and +.Fa fildes2 +are equal, then +.Fn dup2 +just returns +.Fa fildes2 ; +no other changes are made to the existing descriptor. +Otherwise, if descriptor +.Fa fildes2 +is already in use, it is first deallocated as if a .Xr close 2 call had been done first. .Sh RETURN VALUES @@ -147,7 +157,7 @@ is negative or greater than the maximum allowable number (see getdtablesize(2)). .Xr socket 2 , .Xr socketpair 2 .Sh STANDARDS -.Fn Dup +.Fn dup and .Fn dup2 are expected to conform to