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/utsname.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/utsname.c')
-rw-r--r-- | kernel/utsname.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/kernel/utsname.c b/kernel/utsname.c new file mode 100644 index 000000000000..1824384ecfa3 --- /dev/null +++ b/kernel/utsname.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 IBM Corporation | ||
3 | * | ||
4 | * Author: Serge Hallyn <serue@us.ibm.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation, version 2 of the | ||
9 | * License. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/uts.h> | ||
14 | #include <linux/utsname.h> | ||
15 | #include <linux/version.h> | ||
16 | |||
17 | /* | ||
18 | * Copy task tsk's utsname namespace, or clone it if flags | ||
19 | * specifies CLONE_NEWUTS. In latter case, changes to the | ||
20 | * utsname of this process won't be seen by parent, and vice | ||
21 | * versa. | ||
22 | */ | ||
23 | int copy_utsname(int flags, struct task_struct *tsk) | ||
24 | { | ||
25 | struct uts_namespace *old_ns = tsk->nsproxy->uts_ns; | ||
26 | int err = 0; | ||
27 | |||
28 | if (!old_ns) | ||
29 | return 0; | ||
30 | |||
31 | get_uts_ns(old_ns); | ||
32 | |||
33 | return err; | ||
34 | } | ||
35 | |||
36 | void free_uts_ns(struct kref *kref) | ||
37 | { | ||
38 | struct uts_namespace *ns; | ||
39 | |||
40 | ns = container_of(kref, struct uts_namespace, kref); | ||
41 | kfree(ns); | ||
42 | } | ||