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>
8 #include <linux/ns_common.h>
10 #include <uapi/linux/utsname.h>
20 struct user_namespace
;
21 extern struct user_namespace init_user_ns
;
23 struct uts_namespace
{
25 struct new_utsname name
;
26 struct user_namespace
*user_ns
;
29 extern struct uts_namespace init_uts_ns
;
32 static inline void get_uts_ns(struct uts_namespace
*ns
)
37 extern struct uts_namespace
*copy_utsname(unsigned long flags
,
38 struct user_namespace
*user_ns
, struct uts_namespace
*old_ns
);
39 extern void free_uts_ns(struct kref
*kref
);
41 static inline void put_uts_ns(struct uts_namespace
*ns
)
43 kref_put(&ns
->kref
, free_uts_ns
);
46 static inline void get_uts_ns(struct uts_namespace
*ns
)
50 static inline void put_uts_ns(struct uts_namespace
*ns
)
54 static inline struct uts_namespace
*copy_utsname(unsigned long flags
,
55 struct user_namespace
*user_ns
, struct uts_namespace
*old_ns
)
57 if (flags
& CLONE_NEWUTS
)
58 return ERR_PTR(-EINVAL
);
64 #ifdef CONFIG_PROC_SYSCTL
65 extern void uts_proc_notify(enum uts_proc proc
);
67 static inline void uts_proc_notify(enum uts_proc proc
)
72 static inline struct new_utsname
*utsname(void)
74 return ¤t
->nsproxy
->uts_ns
->name
;
77 static inline struct new_utsname
*init_utsname(void)
79 return &init_uts_ns
.name
;
82 extern struct rw_semaphore uts_sem
;
84 #endif /* _LINUX_UTSNAME_H */