aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-03-07 21:48:39 -0500
committerEric W. Biederman <ebiederm@xmission.com>2011-05-10 17:35:47 -0400
commita00eaf11a223c63fbb212369d6db69ce4c55a2d1 (patch)
tree1c38d8591c229243cb09386a0f5b3737da421cf1 /ipc
parent34482e89a5218f0f9317abf1cfba3bb38b5c29dd (diff)
ns proc: Add support for the ipc namespace
Acked-by: Daniel Lezcano <daniel.lezcano@free.fr> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/namespace.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/ipc/namespace.c b/ipc/namespace.c
index 8054c8e5faf1..ce0a647869b1 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -12,6 +12,7 @@
12#include <linux/fs.h> 12#include <linux/fs.h>
13#include <linux/mount.h> 13#include <linux/mount.h>
14#include <linux/user_namespace.h> 14#include <linux/user_namespace.h>
15#include <linux/proc_fs.h>
15 16
16#include "util.h" 17#include "util.h"
17 18
@@ -140,3 +141,39 @@ void put_ipc_ns(struct ipc_namespace *ns)
140 free_ipc_ns(ns); 141 free_ipc_ns(ns);
141 } 142 }
142} 143}
144
145static void *ipcns_get(struct task_struct *task)
146{
147 struct ipc_namespace *ns = NULL;
148 struct nsproxy *nsproxy;
149
150 rcu_read_lock();
151 nsproxy = task_nsproxy(task);
152 if (nsproxy)
153 ns = get_ipc_ns(nsproxy->ipc_ns);
154 rcu_read_unlock();
155
156 return ns;
157}
158
159static void ipcns_put(void *ns)
160{
161 return put_ipc_ns(ns);
162}
163
164static int ipcns_install(struct nsproxy *nsproxy, void *ns)
165{
166 /* Ditch state from the old ipc namespace */
167 exit_sem(current);
168 put_ipc_ns(nsproxy->ipc_ns);
169 nsproxy->ipc_ns = get_ipc_ns(ns);
170 return 0;
171}
172
173const struct proc_ns_operations ipcns_operations = {
174 .name = "ipc",
175 .type = CLONE_NEWIPC,
176 .get = ipcns_get,
177 .put = ipcns_put,
178 .install = ipcns_install,
179};