aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-10-19 02:40:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 14:53:38 -0400
commitfaacbfd3a6808bf87d8f353b42eceeaba2c78a47 (patch)
treec05ad8985ec2367550cbb3321934fd0e8e9208d2
parent4c3f2ead5a3dff9069a45560ba4d007c8ae2e2ee (diff)
pid namespaces: add support for pid namespaces hierarchy
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>
-rw-r--r--include/linux/pid_namespace.h2
-rw-r--r--kernel/pid.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index aea13ec31aba..14376ebf4bac 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -21,6 +21,8 @@ struct pid_namespace {
21 int last_pid; 21 int last_pid;
22 struct task_struct *child_reaper; 22 struct task_struct *child_reaper;
23 struct kmem_cache *pid_cachep; 23 struct kmem_cache *pid_cachep;
24 int level;
25 struct pid_namespace *parent;
24}; 26};
25 27
26extern struct pid_namespace init_pid_ns; 28extern struct pid_namespace init_pid_ns;
diff --git a/kernel/pid.c b/kernel/pid.c
index bb0785109d39..c7346fb801fc 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -67,7 +67,8 @@ struct pid_namespace init_pid_ns = {
67 [ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL } 67 [ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL }
68 }, 68 },
69 .last_pid = 0, 69 .last_pid = 0,
70 .child_reaper = &init_task 70 .level = 0,
71 .child_reaper = &init_task,
71}; 72};
72 73
73int is_global_init(struct task_struct *tsk) 74int is_global_init(struct task_struct *tsk)