]> Pileus Git - ~andy/linux/commitdiff
pid namespaces: add support for pid namespaces hierarchy
authorPavel Emelyanov <xemul@openvz.org>
Fri, 19 Oct 2007 06:40:04 +0000 (23:40 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 19 Oct 2007 18:53:38 +0000 (11:53 -0700)
Each namespace has a parent and is characterized by its "level".  Level is the
number of the namespace generation.  E.g.  init namespace has level 0, after
cloning new one it will have level 1, the next one - 2 and so on and so forth.
 This level is not explicitly limited.

True hierarchy must have some way to find each namespace's children, but it is
not used in the patches, so this ability is not added (yet).

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/pid_namespace.h
kernel/pid.c

index aea13ec31aba29a805b17adb05632bde935f47b9..14376ebf4bac304f926471f380018fb974f3ec7d 100644 (file)
@@ -21,6 +21,8 @@ struct pid_namespace {
        int last_pid;
        struct task_struct *child_reaper;
        struct kmem_cache *pid_cachep;
+       int level;
+       struct pid_namespace *parent;
 };
 
 extern struct pid_namespace init_pid_ns;
index bb0785109d39998c63ec881bb4f92fed69efaa87..c7346fb801fca1f468f537722f349e2225a15c62 100644 (file)
@@ -67,7 +67,8 @@ struct pid_namespace init_pid_ns = {
                [ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL }
        },
        .last_pid = 0,
-       .child_reaper = &init_task
+       .level = 0,
+       .child_reaper = &init_task,
 };
 
 int is_global_init(struct task_struct *tsk)