diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2006-10-02 05:18:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:21 -0400 |
commit | 4865ecf1315b450ab3317a745a6678c04d311e40 (patch) | |
tree | 6cf5d3028f8642eba2a8094eb413db080cc9219c /kernel/nsproxy.c | |
parent | 96b644bdec977b97a45133e5b4466ba47a7a5e65 (diff) |
[PATCH] namespaces: utsname: implement utsname namespaces
This patch defines the uts namespace and some manipulators.
Adds the uts namespace to task_struct, and initializes a
system-wide init namespace.
It leaves a #define for system_utsname so sysctl will compile.
This define will be removed in a separate patch.
[akpm@osdl.org: build fix, cleanup]
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Cc: Kirill Korotaev <dev@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Herbert Poetzl <herbert@13thfloor.at>
Cc: Andrey Savochkin <saw@sw.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/nsproxy.c')
-rw-r--r-- | kernel/nsproxy.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index e10385c17f73..47c19280c55b 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/nsproxy.h> | 14 | #include <linux/nsproxy.h> |
15 | #include <linux/init_task.h> | 15 | #include <linux/init_task.h> |
16 | #include <linux/namespace.h> | 16 | #include <linux/namespace.h> |
17 | #include <linux/utsname.h> | ||
17 | 18 | ||
18 | struct nsproxy init_nsproxy = INIT_NSPROXY(init_nsproxy); | 19 | struct nsproxy init_nsproxy = INIT_NSPROXY(init_nsproxy); |
19 | 20 | ||
@@ -59,6 +60,8 @@ struct nsproxy *dup_namespaces(struct nsproxy *orig) | |||
59 | if (ns) { | 60 | if (ns) { |
60 | if (ns->namespace) | 61 | if (ns->namespace) |
61 | get_namespace(ns->namespace); | 62 | get_namespace(ns->namespace); |
63 | if (ns->uts_ns) | ||
64 | get_uts_ns(ns->uts_ns); | ||
62 | } | 65 | } |
63 | 66 | ||
64 | return ns; | 67 | return ns; |
@@ -97,6 +100,15 @@ int copy_namespaces(int flags, struct task_struct *tsk) | |||
97 | goto out; | 100 | goto out; |
98 | } | 101 | } |
99 | 102 | ||
103 | err = copy_utsname(flags, tsk); | ||
104 | if (err) { | ||
105 | if (new_ns->namespace) | ||
106 | put_namespace(new_ns->namespace); | ||
107 | tsk->nsproxy = old_ns; | ||
108 | put_nsproxy(new_ns); | ||
109 | goto out; | ||
110 | } | ||
111 | |||
100 | out: | 112 | out: |
101 | put_nsproxy(old_ns); | 113 | put_nsproxy(old_ns); |
102 | return err; | 114 | return err; |
@@ -106,5 +118,7 @@ void free_nsproxy(struct nsproxy *ns) | |||
106 | { | 118 | { |
107 | if (ns->namespace) | 119 | if (ns->namespace) |
108 | put_namespace(ns->namespace); | 120 | put_namespace(ns->namespace); |
121 | if (ns->uts_ns) | ||
122 | put_uts_ns(ns->uts_ns); | ||
109 | kfree(ns); | 123 | kfree(ns); |
110 | } | 124 | } |