This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: PATCH: linux-generic dup2 behaviour
On Wednesday 14 September 2011, Roland McGrath wrote:
> Frankly the kernel behavior in that case seems anti-useful to me. It's
> clear that it was explicitly intended, but I don't know the rationale.
> Perhaps you can find some LKML discussion from the time dup3 was
> introduced, or raise the subject there to get some clarification.
FWIW, the current dup3 behavior was introduced in a patch "[PATCH] get rid
of corner case in dup3() entirely" that you can find at
http://www.kerneltrap.com/mailarchive/git-commits-head/2008/7/27/2701254
The original dup3 patch shortly before that had the current CLOEXEC
semantics, but was handling dup3(fd,fd,0) just like dup2(fd,fd):
http://www.kerneltrap.com/mailarchive/linux-netdev/2008/5/6/1745254
Arnd