[Devel] Add pid_namespace to nsproxy

Sukadev Bhattiprolu sukadev at us.ibm.com
Thu Sep 7 22:41:00 PDT 2006


Add a notion of pid namespace to nsproxy (and by extension, to task_struct).
Currently there is only one pid namespace, init_pid_ns and all tasks belong
to this pid namespace. When a new task is created, it inherits its parent's
pid namespace (in copy_process()).

This is based on Eric Biederman's patch: http://lkml.org/lkml/2006/2/6/285

Signed-off-by: Sukadev Bhattiprolu <sukadev at us.ibm.com>
Cc: Eric Biederman <ebiederm at xmission.com>
Cc: Cedric Le Goater <clg at fr.ibm.com>
Cc: Dave Hansen <haveblue at us.ibm.com>
Cc: Serge Hallyn <serue at us.ibm.com>
Cc: containers at lists.osdl.org

 include/linux/init_task.h |    2 ++
 include/linux/nsproxy.h   |    1 +
 2 files changed, 3 insertions(+)

Index: lx26-18-rc5-mm1/include/linux/init_task.h
===================================================================
--- lx26-18-rc5-mm1.orig/include/linux/init_task.h	2006-09-07 22:21:06.000000000 -0700
+++ lx26-18-rc5-mm1/include/linux/init_task.h	2006-09-07 22:29:58.000000000 -0700
@@ -7,6 +7,7 @@
 #include <linux/utsname.h>
 #include <linux/lockdep.h>
 #include <linux/ipc.h>
+#include <linux/pid_namespace.h>
 
 #define INIT_FDTABLE \
 {							\
@@ -72,6 +73,7 @@
 
 extern struct nsproxy init_nsproxy;
 #define INIT_NSPROXY(nsproxy) {						\
+	.pid_ns		= &init_pid_ns,					\
 	.count		= ATOMIC_INIT(1),				\
 	.nslock		= SPIN_LOCK_UNLOCKED,				\
 	.uts_ns		= &init_uts_ns,					\
Index: lx26-18-rc5-mm1/include/linux/nsproxy.h
===================================================================
--- lx26-18-rc5-mm1.orig/include/linux/nsproxy.h	2006-09-07 22:21:06.000000000 -0700
+++ lx26-18-rc5-mm1/include/linux/nsproxy.h	2006-09-07 22:30:22.000000000 -0700
@@ -23,6 +23,7 @@ struct ipc_namespace;
 struct nsproxy {
 	atomic_t count;
 	spinlock_t nslock;
+	struct pid_namespace *pid_ns;
 	struct uts_namespace *uts_ns;
 	struct ipc_namespace *ipc_ns;
 	struct namespace *namespace;
_______________________________________________
Containers mailing list
Containers at lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers




More information about the Devel mailing list