To: None <firstname.lastname@example.org>
From: Jean-Baptiste Campesato <email@example.com>
Date: 03/02/2007 22:00:25
I've finished to implement a "first draft" of a Plan 9-like getcwd as
described in Rob Pike's paper:
I added a char called cwdi_cwd in cwdinfo. cwdi_cwd is modified by a
chdir, a fchdir, a chroot, a fchroot, or after a mount modifying
If the pwd isn't modified by a chdir, I set cwdi_cwd to "." (In this
case getcwd will use the old method: getting the path from the vnode).
I modified init to put "." in cwdi0.cwdi_cwd and cwdinit() to copy
cwdi_cwd from the parent process to the new process.
If cwdi_cwd begins by /, getcwd cleans it (delete ./, ../, //) and
sends it to userland.
These modifications are active only if DOTDOT is defined.
I hope that I forgot nothing.
For tiny computer this system should be disabled: cwdi_cwd adds 1kb per process.
I have to work on error management and KNF now.
I'm not sure that I use well getcwd_common in cwdclean (No problem for
It seems that this getcwd isn't POSIX compliant (But ksh uses a
builtin Plan 9-like pwd...):
"The pathname copied to the array shall contain no components that are
Maybe creating a new getcwd function would be better ? (eg: getcwdd...)
Or aborting this project ?
The diff file is located here: http://zulzul.free.fr/camje/dotdot.diff