Fix “..” semantics project

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jean-Baptiste Campesato
Date: Friday, March 2, 2007 - 2:00 pm

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.
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Fix “..” semantics project, Jean-Baptiste Campesato, (Fri Mar 2, 2:00 pm)
(unknown), Andrew Reilly, (Fri Mar 2, 8:16 pm)