This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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 14 September 2011 07:55, Chris Metcalf <cmetcalf@tilera.com> wrote:
> 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.

Yeah, I kind of figured that out shortly after hitting the "send" button.
I've got a mild cold, that's my excuse.

> 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. :-)

I'll send a patch later this afternoon; I figure I should at least
test it first,
but that is easier said than done :-)

>ÂIn any case I'll add the m4 test suite to my
> list of things to confirm works properly.

The m4 test cases aren't all that stunning; for me, 3 of 108 failed,
and this patch should fix 2 of these.  The third was test-readlink which
is expecting
readlink("", buf, sizeof buf);
to set ENOENT, and instead it sets EINVAL

I was willing to ascribe this to poor test case design, but now that
we're on topic... any suggestions?

--linas


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