namespaces.7: Document PID namespace case where getppid() can return 0

getppid() can return 0 if parent is in a different namespace.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2013-01-15 06:23:09 +01:00
parent 7091f8f392
commit 110026abe4
1 changed files with 16 additions and 0 deletions

View File

@ -367,6 +367,22 @@ A call to
always returns the PID associated with the namespace in which
the process resides.
Some processes in a PID namespaces may have parents
that are outside of the namespace.
For example, the parent of the initial process in the namespace
(i.e.,
the
.BR init (1)
process with PID 1) is necessarily in another namespace.
Likewise, the direct children of a process that uses
.BR setns (2)
to cause its children to join a PID namespace are in a different
PID namespace from the caller of
.BR setns (2).
Calls to
.BR getppid (2)
for such processes return 0.
After creating a new PID namespace,
it is useful for the child to change its root directory
and mount a new procfs instance at