summaryrefslogtreecommitdiff
path: root/include/linux/utsname.h
diff options
context:
space:
mode:
authorSerge E. Hallyn <serue@us.ibm.com>2006-10-02 02:18:14 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 07:57:21 -0700
commit4865ecf1315b450ab3317a745a6678c04d311e40 (patch)
tree6cf5d3028f8642eba2a8094eb413db080cc9219c /include/linux/utsname.h
parent96b644bdec977b97a45133e5b4466ba47a7a5e65 (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 'include/linux/utsname.h')
-rw-r--r--include/linux/utsname.h40
1 files changed, 37 insertions, 3 deletions
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 77e97a5755d9..afa54e1542b3 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -1,6 +1,11 @@
#ifndef _LINUX_UTSNAME_H
#define _LINUX_UTSNAME_H
+#include <linux/sched.h>
+#include <linux/kref.h>
+#include <linux/nsproxy.h>
+#include <asm/atomic.h>
+
#define __OLD_UTS_LEN 8
struct oldold_utsname {
@@ -30,17 +35,46 @@ struct new_utsname {
char domainname[65];
};
-extern struct new_utsname system_utsname;
+struct uts_namespace {
+ struct kref kref;
+ struct new_utsname name;
+};
+extern struct uts_namespace init_uts_ns;
+
+static inline void get_uts_ns(struct uts_namespace *ns)
+{
+ kref_get(&ns->kref);
+}
+
+#ifdef CONFIG_UTS_NS
+extern int copy_utsname(int flags, struct task_struct *tsk);
+extern void free_uts_ns(struct kref *kref);
+
+static inline void put_uts_ns(struct uts_namespace *ns)
+{
+ kref_put(&ns->kref, free_uts_ns);
+}
+#else
+static inline int copy_utsname(int flags, struct task_struct *tsk)
+{
+ return 0;
+}
+static inline void put_uts_ns(struct uts_namespace *ns)
+{
+}
+#endif
static inline struct new_utsname *utsname(void)
{
- return &system_utsname;
+ return &current->nsproxy->uts_ns->name;
}
static inline struct new_utsname *init_utsname(void)
{
- return &system_utsname;
+ return &init_uts_ns.name;
}
+#define system_utsname init_uts_ns.name
+
extern struct rw_semaphore uts_sem;
#endif