Re: getcwd does lots of stat'ing

From: Andreas Jaeger (aj@suse.de)
Date: Fri May 26 2000 - 01:46:11 EST


>>>>> Cameron Schaus writes:

> Why does a call to getcwd descend the direcotries until a mount point
> is hit? I noticed this while profiling some code at work (this is
> very expensive on nfs mounted drives). Every directory that it finds,
> it runs lstat on.

> Is this done in the libc implementation of getcwd, or does the kernel
> system call do this? I am running 2.2.14 with Trond's nfsv3 patches
> with the Debian 2.1 distribution.

glibc calls the getcwd syscall if that exists and falls back reading
/proc/self/cwd and then back to lstating the directories (see
sysdeps/unix/sysv/linux/getcwd.c in the glibc sources).

Andreas

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:15 EST