Blame view
include/linux/pid_namespace.h
2.37 KB
61a58c6c2
|
1 2 |
#ifndef _LINUX_PID_NS_H #define _LINUX_PID_NS_H |
aa5a6662f
|
3 4 |
#include <linux/sched.h> |
187f1882b
|
5 |
#include <linux/bug.h> |
aa5a6662f
|
6 |
#include <linux/mm.h> |
a27bb332c
|
7 |
#include <linux/workqueue.h> |
aa5a6662f
|
8 |
#include <linux/threads.h> |
9a575a92d
|
9 10 |
#include <linux/nsproxy.h> #include <linux/kref.h> |
435d5f4bb
|
11 |
#include <linux/ns_common.h> |
aa5a6662f
|
12 13 14 15 16 |
struct pidmap { atomic_t nr_free; void *page; }; |
5cc544516
|
17 18 19 |
#define BITS_PER_PAGE (PAGE_SIZE * 8) #define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1) #define PIDMAP_ENTRIES ((PID_MAX_LIMIT+BITS_PER_PAGE-1)/BITS_PER_PAGE) |
aa5a6662f
|
20 |
|
59eda0e07
|
21 |
struct fs_pin; |
20fad13ac
|
22 |
|
61a58c6c2
|
23 |
struct pid_namespace { |
9a575a92d
|
24 25 |
struct kref kref; struct pidmap pidmap[PIDMAP_ENTRIES]; |
1adfcb03e
|
26 |
struct rcu_head rcu; |
9a575a92d
|
27 |
int last_pid; |
c876ad768
|
28 |
unsigned int nr_hashed; |
84d737866
|
29 |
struct task_struct *child_reaper; |
baf8f0f82
|
30 |
struct kmem_cache *pid_cachep; |
caafa4324
|
31 |
unsigned int level; |
faacbfd3a
|
32 |
struct pid_namespace *parent; |
07543f5c7
|
33 34 |
#ifdef CONFIG_PROC_FS struct vfsmount *proc_mnt; |
021ada7df
|
35 |
struct dentry *proc_self; |
0097875bd
|
36 |
struct dentry *proc_thread_self; |
07543f5c7
|
37 |
#endif |
20fad13ac
|
38 |
#ifdef CONFIG_BSD_PROCESS_ACCT |
59eda0e07
|
39 |
struct fs_pin *bacct; |
20fad13ac
|
40 |
#endif |
49f4d8b93
|
41 |
struct user_namespace *user_ns; |
f333c700c
|
42 |
struct ucounts *ucounts; |
0a01f2cc3
|
43 |
struct work_struct proc_work; |
dcb0f2228
|
44 |
kgid_t pid_gid; |
0499680a4
|
45 |
int hide_pid; |
cf3f89214
|
46 |
int reboot; /* group exit code if this pidns was rebooted */ |
435d5f4bb
|
47 |
struct ns_common ns; |
3fbc96486
|
48 |
}; |
61a58c6c2
|
49 |
extern struct pid_namespace init_pid_ns; |
3fbc96486
|
50 |
|
c876ad768
|
51 |
#define PIDNS_HASH_ADDING (1U << 31) |
57d5f66b8
|
52 |
#ifdef CONFIG_PID_NS |
a05f7b15d
|
53 |
static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) |
9a575a92d
|
54 |
{ |
b461cc038
|
55 56 |
if (ns != &init_pid_ns) kref_get(&ns->kref); |
a05f7b15d
|
57 |
return ns; |
9a575a92d
|
58 |
} |
49f4d8b93
|
59 60 |
extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct user_namespace *user_ns, struct pid_namespace *ns); |
74bd59bb3
|
61 |
extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); |
cf3f89214
|
62 |
extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); |
bbc2e3ef8
|
63 |
extern void put_pid_ns(struct pid_namespace *ns); |
9a575a92d
|
64 |
|
57d5f66b8
|
65 66 67 68 69 70 71 |
#else /* !CONFIG_PID_NS */ #include <linux/err.h> static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) { return ns; } |
49f4d8b93
|
72 73 |
static inline struct pid_namespace *copy_pid_ns(unsigned long flags, struct user_namespace *user_ns, struct pid_namespace *ns) |
57d5f66b8
|
74 75 76 77 78 79 80 81 82 |
{ if (flags & CLONE_NEWPID) ns = ERR_PTR(-EINVAL); return ns; } static inline void put_pid_ns(struct pid_namespace *ns) { } |
74bd59bb3
|
83 84 85 86 |
static inline void zap_pid_ns_processes(struct pid_namespace *ns) { BUG(); } |
cf3f89214
|
87 88 89 90 91 |
static inline int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd) { return 0; } |
57d5f66b8
|
92 |
#endif /* CONFIG_PID_NS */ |
61bce0f13
|
93 |
extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk); |
3ae4eed34
|
94 95 |
void pidhash_init(void); void pidmap_init(void); |
61a58c6c2
|
96 |
#endif /* _LINUX_PID_NS_H */ |