This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: -remap: Should we remap before / after simplification?


On Fri, Mar 16, 2001 at 12:50:46AM +0000, Joern Rennecke wrote:
> > IMHO, you should only simplify a pathname when you can prove the
> > simplified path and the original one get you the same file.
> 
> Or if you can use the OS to make the simplification for you.
> I.e. get the current working directory, cd to the basename of the
> file, get the current directory for the simplified basename of the
> file (might want to check if it's really simpler...), and cd back
> to the original directory.

If you're lucky, getcwd(3) just reads every directory between you and
the root, and stats (on average) half the entries in each.  If you're
unlucky it forks off a child process which execs /bin/pwd, which then
does the same directory walk.  If you're really unlucky it execs
/bin/sh -c pwd.

I will not support any change which is a performance improvement on
Linux and a lose on just about every other system in existence.  (Do
recent BSDs have getcwd(2)?)

Note I'm willing to consider doing readlink("/dev/fd/%d") on Linux if
we can find a way to not gunk up the code with #ifdefs, and if it is
measured to be a genuine performance win there; that won't hurt anyone
else.

zw


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