aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/init_task.h2
-rw-r--r--include/linux/nsproxy.h2
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/utsname.h40
4 files changed, 42 insertions, 3 deletions
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 4865348ca8bd..e08531ec32f0 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -4,6 +4,7 @@
#include <linux/file.h>
#include <linux/rcupdate.h>
#include <linux/irqflags.h>
+#include <linux/utsname.h>
#include <linux/lockdep.h>
#define INIT_FDTABLE \
@@ -72,6 +73,7 @@ extern struct nsproxy init_nsproxy;
#define INIT_NSPROXY(nsproxy) { \
.count = ATOMIC_INIT(1), \
.nslock = SPIN_LOCK_UNLOCKED, \
+ .uts_ns = &init_uts_ns, \
.namespace = NULL, \
}
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 7ebe66670c59..9c2e0ad508db 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -5,6 +5,7 @@
#include <linux/sched.h>
struct namespace;
+struct uts_namespace;
/*
* A structure to contain pointers to all per-process
@@ -21,6 +22,7 @@ struct namespace;
struct nsproxy {
atomic_t count;
spinlock_t nslock;
+ struct uts_namespace *uts_ns;
struct namespace *namespace;
};
extern struct nsproxy init_nsproxy;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 670b89a20070..46d6f5be72f2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -753,6 +753,7 @@ static inline void prefetch_stack(struct task_struct *t) { }
struct audit_context; /* See audit.c */
struct mempolicy;
struct pipe_inode_info;
+struct uts_namespace;
enum sleep_type {
SLEEP_NORMAL,
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