Blame view

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

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

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