Paul Eggert wrote: > On platforms lacking fchdir, > put a wrapper around 'open' so that we can keep track of which file > descriptors correspond to directories. The 'open' wrapper puts the > name of the opened directory into a hash table. (The name must be > absolute, so 'open' may need to do the equivalent of pwd. This could > be further optimized by wrapping 'chdir' and 'close', though I'm not > sure it's worth the trouble. We might also get away with using > O_DIRECTORY to decide whether to put an entry in the hash table.)
That's an interesting idea. Actually, I think a hash table would not be necessary; a linear table, indexed by the file descriptor, would be enough. Jim Meyering wrote: > A fundamental goal in coreutils development has been to code to the most > modern/useful/portable interfaces. Anything else should be hidden as far > under the covers as possible. That's one of the reasons there are so > many replacement functions in coreutils and gnulib and so few #ifdefs > in coreutils/src/*.c. I agree it's a good choice to do it this way. > And since BeOS seems to be a fringe > system (i.e., nearly museum-only), no one will notice the performance hit. It's not only BeOS, it's also mingw and djgpp which lack an fchdir(). Bruno