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 ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature