This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: linux-generic dup2 behaviour


On 9/13/2011 6:27 PM, Roland McGrath wrote:
> The only option I see without a kernel change is to make libc's dup2 use a
> special case for oldfd==newfd that just does a probe call like fcntl(oldfd,
> F_GETFD, 0) for the sole purpose of detecting EBADF.  I suspect kernel
> folks will be likely to insist you to do that just so they don't have to
> change the kernel.

This certainly seems like the best way to me.  That particular case is a
pretty unuseful one anyway, so adding an extra syscall test is off the
critical path, and won't take much code space either.

Linas, if you're doing this work anyway and are running the m4 test, I'd be
happy to incorporate the fix into the Tilera sources, which really, Any Day
Now, I'll be submitting. :-)  In any case I'll add the m4 test suite to my
list of things to confirm works properly.

-- 
Chris Metcalf, Tilera Corp.
http://www.tilera.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]