lkml.org 
[lkml]   [1997]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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

\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.152 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site