提交 faacbfd3 编写于 作者: P Pavel Emelyanov 提交者: Linus Torvalds

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: NPavel 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: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 4c3f2ead
...@@ -21,6 +21,8 @@ struct pid_namespace { ...@@ -21,6 +21,8 @@ struct pid_namespace {
int last_pid; int last_pid;
struct task_struct *child_reaper; struct task_struct *child_reaper;
struct kmem_cache *pid_cachep; struct kmem_cache *pid_cachep;
int level;
struct pid_namespace *parent;
}; };
extern struct pid_namespace init_pid_ns; extern struct pid_namespace init_pid_ns;
......
...@@ -67,7 +67,8 @@ struct pid_namespace init_pid_ns = { ...@@ -67,7 +67,8 @@ struct pid_namespace init_pid_ns = {
[ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL } [ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL }
}, },
.last_pid = 0, .last_pid = 0,
.child_reaper = &init_task .level = 0,
.child_reaper = &init_task,
}; };
int is_global_init(struct task_struct *tsk) int is_global_init(struct task_struct *tsk)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册