kern/176233: [libc] [patch] New dup3() implementation for FreeBSD

Jilles Tjoelker jilles at stack.nl
Tue Feb 19 23:30:02 UTC 2013


The following reply was made to PR kern/176233; it has been noted by GNATS.

From: Jilles Tjoelker <jilles at stack.nl>
To: bug-followup at FreeBSD.org, jau at iki.fi
Cc:  
Subject: Re: kern/176233: [libc] [patch] New dup3() implementation for FreeBSD
Date: Wed, 20 Feb 2013 00:28:41 +0100

 PR kern/176233:
 > [dup3 implementation based on F_DUP2FD_CLOEXEC]
 
 The dup3() function appears to be used in the wild and there is a gnulib
 replacement for it, even though it seems of rather limited use compared
 to fcntl(F_DUPFD_CLOEXEC). Most uses of dup2() are for passing fd 0, 1
 or 2 to a process so that the close-on-exec flag should be clear.
 
 I think glibc's [EINVAL] on oldfd == newfd actually makes some sense as
 it forces the programmer to separate clearly the cases where oldfd !=
 newfd and oldfd == newfd. http://austingroupbugs.net/view.php?id=411
 also proposes requiring it.
 
 The O_NONBLOCK and O_NOSIGPIPE flags appear contrary to the idea of
 dup2/dup3 since they affect the underlying object and not just the new
 file descriptor like O_CLOEXEC does.
 
 Unknown/unsupported flags should indeed [EINVAL] so we have a chance to
 add new flags later.
 
 -- 
 Jilles Tjoelker


More information about the freebsd-bugs mailing list