1 #ifndef _LINUX_UTSNAME_H
2 #define _LINUX_UTSNAME_H
5 #include <linux/sched.h>
6 #include <linux/kref.h>
7 #include <linux/nsproxy.h>
9 #include <uapi/linux/utsname.h>
19 struct user_namespace;
20 extern struct user_namespace init_user_ns;
22 struct uts_namespace {
24 struct new_utsname name;
25 struct user_namespace *user_ns;
26 unsigned int proc_inum;
28 extern struct uts_namespace init_uts_ns;
31 static inline void get_uts_ns(struct uts_namespace *ns)
36 extern struct uts_namespace *copy_utsname(unsigned long flags,
37 struct user_namespace *user_ns, struct uts_namespace *old_ns);
38 extern void free_uts_ns(struct kref *kref);
40 static inline void put_uts_ns(struct uts_namespace *ns)
42 kref_put(&ns->kref, free_uts_ns);
45 static inline void get_uts_ns(struct uts_namespace *ns)
49 static inline void put_uts_ns(struct uts_namespace *ns)
53 static inline struct uts_namespace *copy_utsname(unsigned long flags,
54 struct user_namespace *user_ns, struct uts_namespace *old_ns)
56 if (flags & CLONE_NEWUTS)
57 return ERR_PTR(-EINVAL);
63 #ifdef CONFIG_PROC_SYSCTL
64 extern void uts_proc_notify(enum uts_proc proc);
66 static inline void uts_proc_notify(enum uts_proc proc)
71 static inline struct new_utsname *utsname(void)
73 return ¤t->nsproxy->uts_ns->name;
76 static inline struct new_utsname *init_utsname(void)
78 return &init_uts_ns.name;
81 extern struct rw_semaphore uts_sem;
83 #endif /* _LINUX_UTSNAME_H */