Robert Forsman <[EMAIL PROTECTED]> writes:
> Back in the old days pwd did its job by statting "../*" to get the inode
> and see if "../whatever" had the same inode as ".". It was then able to
> determine the name of "." relative to ".." . You then repeat the process
> all the way up the tree till you find "/" . Under that scheme you would
> run the risk of statting /coda.
This is the ``classical way'' of doing getcwd on unix (you forgot the extra
handing for (unix) mountpoints that is needed).
> However, according to strace, the pwd program does nothing of the sort.
Hopefully it just uses the `getcwd()' libc call. And with modern glibc,
that resolves back to using the 'sys_getcwd()' syscall, that exists on a
linux kernel with dcache-entries. Sys_getcwd simply walk from leaf in the
dcache-entry (cwd) to the root collecting the names of each dcache-entry.
Love