Subject: =?WINDOWS-1252?Q?Fix_=93..=94_semantics_project?=
To: None <tech-kern@netbsd.org>
From: Jean-Baptiste Campesato <camjelemon@gmail.com>
List: tech-kern
Date: 03/02/2007 22:00:25
Hello,
I've finished to implement a "first draft" of a Plan 9-like getcwd as
described in Rob Pike's paper:
http://www.netbsd.org/contrib/projects.html#dotdot
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
cwdi_cdir (checkdirs()).
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
the moment)...
It seems that this getcwd isn't POSIX compliant (But ksh uses a
builtin Plan 9-like pwd...):
http://www.opengroup.org/onlinepubs/000095399/functions/getcwd.html
"The pathname copied to the array shall contain no components that are
symbolic links."
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
Thanks,
Jean-Baptiste Campesato.