Date: Tue, 19 Feb 2013 23:30:01 GMT From: Jilles Tjoelker <jilles@stack.nl> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/176233: [libc] [patch] New dup3() implementation for FreeBSD Message-ID: <201302192330.r1JNU1BG091189@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/176233; it has been noted by GNATS. From: Jilles Tjoelker <jilles@stack.nl> To: bug-followup@FreeBSD.org, jau@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302192330.r1JNU1BG091189>