[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Openat without die
From: |
Eric Blake |
Subject: |
Re: Openat without die |
Date: |
Wed, 12 Jan 2011 06:49:02 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 |
On 01/12/2011 03:25 AM, Bastien ROUCARIES wrote:
>> And, rather than checking != ENOTSUP, it might be safer to check ==
>> ENOMEM, so that you are minimizing the impact of your change. The whole
>> point of patch 3 appears to be avoiding the risk of the fchdir()
>> fallback on the rare systems where *at is missing and /proc/self/fd/
>> works, and in the corner case where trying to use /proc/self/fd failed
>> due to tight memory constraints, but as written, it avoids the fchdir()
>> fallback even for non-memory related cases, where the fchdir() may have
>> been appropriate.
>
> I plan to factorize this part of code in its own function, and use a stub
> that that return -1 and set errno to ENOTSUP. But wait
> if errno is declared volatile it will not work. Will use #ifdef.
Huh? Per POSIX, errno is threadsafe and is not declared volatile, and
the gnulib replacement header means that direct comparison will work
with pretty much any POSIX-required errno value. I'm not sure why you
think you need #ifdef.
>> /proc/self/fd/ exists but is broken on cygwin 1.5 and 1.7, and on
>> Solaris 10, so those platforms already use the fchdir() fallback.
>> Meanwhile, cygwin 1.7 has all the *at functions, and while Solaris 10
>> only has a subset of *at functions, my understanding is that the rest
>> are being added for Solaris 11.
>
> So /proc/self/fd is a linux only fallback ?
Not necessarily - I only sampled three systems - some of the BSD systems
may have a working /proc/self/fd. But the point is that several systems
lack /proc/self/fd, and several systems provide it but with the caveat
that /proc/self/fd/n/.. is broken, leaving Linux as one of the few
systems where /proc/self/fd can be used to implement *at functions safely.
> Ok so we could move proc stuff to old linux only #define
No - rather than favoring #ifdef __linux__, you should favor feature
tests, as is already the case.
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: Openat without die, (continued)
- Re: Openat without die, Paul Eggert, 2011/01/11
- Re: Openat without die, Eric Blake, 2011/01/11
- Re: Openat without die, Jim Meyering, 2011/01/11
- Re: Openat without die, Paul Eggert, 2011/01/11
- Re: Openat without die, Jim Meyering, 2011/01/11
- Re: Openat without die, Paul Eggert, 2011/01/11
- Re: Openat without die, Jim Meyering, 2011/01/11
- Re: Openat without die, Jim Meyering, 2011/01/11
- Message not available
- ChangeLog fix for openat-die fix, Paul Eggert, 2011/01/12
- Re: Openat without die, Bastien ROUCARIES, 2011/01/12
- Re: Openat without die,
Eric Blake <=
- Re: Openat without die, Bruno Haible, 2011/01/11
- Re: Openat without die, Jim Meyering, 2011/01/13
Re: Openat without die, Jim Meyering, 2011/01/11