Blame view

include/linux/utsname.h 1.72 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
  #ifndef _LINUX_UTSNAME_H
  #define _LINUX_UTSNAME_H
b119f13f5   Cedric Le Goater   [PATCH] ipc: head...
4
5
6
7
  
  #include <linux/sched.h>
  #include <linux/kref.h>
  #include <linux/nsproxy.h>
435d5f4bb   Al Viro   common object emb...
8
  #include <linux/ns_common.h>
58bfdd6de   Pavel Emelyanov   namespaces: move ...
9
  #include <linux/err.h>
607ca46e9   David Howells   UAPI: (Scripted) ...
10
  #include <uapi/linux/utsname.h>
b119f13f5   Cedric Le Goater   [PATCH] ipc: head...
11

f1ecf0685   Lucas De Marchi   sysctl: add suppo...
12
13
14
15
16
17
18
  enum uts_proc {
  	UTS_PROC_OSTYPE,
  	UTS_PROC_OSRELEASE,
  	UTS_PROC_VERSION,
  	UTS_PROC_HOSTNAME,
  	UTS_PROC_DOMAINNAME,
  };
59607db36   Serge E. Hallyn   userns: add a use...
19
20
  struct user_namespace;
  extern struct user_namespace init_user_ns;
4865ecf13   Serge E. Hallyn   [PATCH] namespace...
21
22
23
  struct uts_namespace {
  	struct kref kref;
  	struct new_utsname name;
59607db36   Serge E. Hallyn   userns: add a use...
24
  	struct user_namespace *user_ns;
f7af3d1c0   Eric W. Biederman   utsns: Add a limi...
25
  	struct ucounts *ucounts;
435d5f4bb   Al Viro   common object emb...
26
  	struct ns_common ns;
3859a271a   Kees Cook   randstruct: Mark ...
27
  } __randomize_layout;
4865ecf13   Serge E. Hallyn   [PATCH] namespace...
28
  extern struct uts_namespace init_uts_ns;
58bfdd6de   Pavel Emelyanov   namespaces: move ...
29
  #ifdef CONFIG_UTS_NS
4865ecf13   Serge E. Hallyn   [PATCH] namespace...
30
31
32
33
  static inline void get_uts_ns(struct uts_namespace *ns)
  {
  	kref_get(&ns->kref);
  }
213dd266d   Eric W. Biederman   namespace: ensure...
34
  extern struct uts_namespace *copy_utsname(unsigned long flags,
bcf58e725   Eric W. Biederman   userns: Make crea...
35
  	struct user_namespace *user_ns, struct uts_namespace *old_ns);
4865ecf13   Serge E. Hallyn   [PATCH] namespace...
36
37
38
39
40
41
  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);
  }
58bfdd6de   Pavel Emelyanov   namespaces: move ...
42
43
44
45
46
47
48
49
50
51
  #else
  static inline void get_uts_ns(struct uts_namespace *ns)
  {
  }
  
  static inline void put_uts_ns(struct uts_namespace *ns)
  {
  }
  
  static inline struct uts_namespace *copy_utsname(unsigned long flags,
bcf58e725   Eric W. Biederman   userns: Make crea...
52
  	struct user_namespace *user_ns, struct uts_namespace *old_ns)
58bfdd6de   Pavel Emelyanov   namespaces: move ...
53
54
55
  {
  	if (flags & CLONE_NEWUTS)
  		return ERR_PTR(-EINVAL);
bcf58e725   Eric W. Biederman   userns: Make crea...
56
  	return old_ns;
58bfdd6de   Pavel Emelyanov   namespaces: move ...
57
58
  }
  #endif
f1ecf0685   Lucas De Marchi   sysctl: add suppo...
59
60
61
62
63
64
65
  #ifdef CONFIG_PROC_SYSCTL
  extern void uts_proc_notify(enum uts_proc proc);
  #else
  static inline void uts_proc_notify(enum uts_proc proc)
  {
  }
  #endif
0bdd7aab7   Serge E. Hallyn   [PATCH] namespace...
66
67
  static inline struct new_utsname *utsname(void)
  {
4865ecf13   Serge E. Hallyn   [PATCH] namespace...
68
  	return &current->nsproxy->uts_ns->name;
0bdd7aab7   Serge E. Hallyn   [PATCH] namespace...
69
70
71
72
  }
  
  static inline struct new_utsname *init_utsname(void)
  {
4865ecf13   Serge E. Hallyn   [PATCH] namespace...
73
  	return &init_uts_ns.name;
0bdd7aab7   Serge E. Hallyn   [PATCH] namespace...
74
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
  extern struct rw_semaphore uts_sem;
b119f13f5   Cedric Le Goater   [PATCH] ipc: head...
76

b119f13f5   Cedric Le Goater   [PATCH] ipc: head...
77
  #endif /* _LINUX_UTSNAME_H */