Messages in this thread | | | Date | Mon, 11 Aug 1997 08:03:40 +0200 | From | Martin von Loewis <> | Subject | Re: chdir for cloned tasks? |
| |
> I understand what the CLONE_FS flag does -- my question was whether such > a cloned task, when it makes a system call to sys_chdir, should get a > private copy. The present sys_chdir code doesn't check whether the task > is a clone or not, so one clone changing directory would change it for > all clones.
As Ingo said: This depends on whether CLONE_FS was there at clone(2) time. If it was, changing the directory would change it for all clones. If it wasn't, changing it does *not* change it for the other clones, because they have a copy of proc->fs.
So is this the intended behaviour? The application program can choose whether it wants to share the cwd with the new clone. This moves policy out of the kernel, so it seems like a good idea. The application program cannot make this choice for the cwd individually; it would share the umask and the root directory as well. This is probably acceptable.
AFAIK, being able to share the cwd between clones is required to implement Posix threads (please somebody correct me if I'm wrong). So it would be *wrong* if sys_chdir took clones into account.
Regards, Martin
| |