Skip to contentSkip to conversation

Add support for pid namespaces hierarchy

PATCH In review [email protected] 1 participant 1 message Aug 10, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 6/20 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).

---

 include/linux/pid_namespace.h |    2 ++
 kernel/pid.c                  |    3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
include/linux/pid_namespace.h renamed from include/linux/pid_namespace.h.ve5 +2 -0
@@ -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;
kernel/pid.c renamed from kernel/pid.c.ve5 +2 -1
@@ -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)