1 #ifndef _LINUX_PID_NS_H
2 #define _LINUX_PID_NS_H
4 #include <linux/sched.h>
6 #include <linux/threads.h>
8 #include <linux/nsproxy.h>
9 #include <linux/kref.h>
16 #define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
18 struct pid_namespace {
20 struct pidmap pidmap[PIDMAP_ENTRIES];
22 struct task_struct *child_reaper;
23 struct kmem_cache *pid_cachep;
26 extern struct pid_namespace init_pid_ns;
28 static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
34 extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
35 extern void free_pid_ns(struct kref *kref);
37 static inline void put_pid_ns(struct pid_namespace *ns)
39 kref_put(&ns->kref, free_pid_ns);
42 static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk)
44 return tsk->nsproxy->pid_ns;
47 static inline struct task_struct *task_child_reaper(struct task_struct *tsk)
49 return init_pid_ns.child_reaper;
52 #endif /* _LINUX_PID_NS_H */