aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pid_namespace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pid_namespace.h')
-rw-r--r--include/linux/pid_namespace.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
new file mode 100644
index 000000000000..d2a9d419f01f
--- /dev/null
+++ b/include/linux/pid_namespace.h
@@ -0,0 +1,45 @@
1#ifndef _LINUX_PID_NS_H
2#define _LINUX_PID_NS_H
3
4#include <linux/sched.h>
5#include <linux/mm.h>
6#include <linux/threads.h>
7#include <linux/pid.h>
8#include <linux/nsproxy.h>
9#include <linux/kref.h>
10
11struct pidmap {
12 atomic_t nr_free;
13 void *page;
14};
15
16#define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
17
18struct pid_namespace {
19 struct kref kref;
20 struct pidmap pidmap[PIDMAP_ENTRIES];
21 int last_pid;
22 struct task_struct *child_reaper;
23};
24
25extern struct pid_namespace init_pid_ns;
26
27static inline void get_pid_ns(struct pid_namespace *ns)
28{
29 kref_get(&ns->kref);
30}
31
32extern int copy_pid_ns(int flags, struct task_struct *tsk);
33extern void free_pid_ns(struct kref *kref);
34
35static inline void put_pid_ns(struct pid_namespace *ns)
36{
37 kref_put(&ns->kref, free_pid_ns);
38}
39
40static inline struct task_struct *child_reaper(struct task_struct *tsk)
41{
42 return tsk->nsproxy->pid_ns->child_reaper;
43}
44
45#endif /* _LINUX_PID_NS_H */