OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 7/20] Add support for pid namespaces hierarchy
[PATCH 7/20] Add support for pid namespaces hierarchy [message #15622] Tue, 07 August 2007 09:29
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
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>

---

 include/linux/pid_namespace.h |    2 ++
 kernel/pid.c                  |    3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

--- ./include/linux/pid_namespace.h.ve7	2007-08-06 14:54:42.000000000 +0400
+++ ./include/linux/pid_namespace.h	2007-08-06 14:58:34.000000000 +0400
@@ -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.ve7	2007-08-06 14:58:17.000000000 +0400
+++ ./kernel/pid.c	2007-08-06 14:58:19.000000000 +0400
@@ -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,
 };
 EXPORT_SYMBOL(init_pid_ns);
Previous Topic: [PATCH 6/20] Introduce struct upid
Next Topic: [PATCH 8/20] Make alloc_pid(), free_pid() and put_pid() work with struct upid
Goto Forum:
  


Current Time: Sun Jul 21 04:45:28 GMT 2024

Total time taken to generate the page: 0.02265 seconds