1 #ifndef _LINUX_PID_NS_H
2 #define _LINUX_PID_NS_H
4 #include <linux/sched.h>
6 #include <linux/threads.h>
7 #include <linux/nsproxy.h>
8 #include <linux/kref.h>
15 #define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
17 struct bsd_acct_struct;
19 struct pid_namespace {
21 struct pidmap pidmap[PIDMAP_ENTRIES];
23 struct task_struct *child_reaper;
24 struct kmem_cache *pid_cachep;
26 struct pid_namespace *parent;
28 struct vfsmount *proc_mnt;
30 #ifdef CONFIG_BSD_PROCESS_ACCT
31 struct bsd_acct_struct *bacct;
35 extern struct pid_namespace init_pid_ns;
38 static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
40 if (ns != &init_pid_ns)
45 extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
46 extern void free_pid_ns(struct kref *kref);
47 extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
49 static inline void put_pid_ns(struct pid_namespace *ns)
51 if (ns != &init_pid_ns)
52 kref_put(&ns->kref, free_pid_ns);
55 #else /* !CONFIG_PID_NS */
56 #include <linux/err.h>
58 static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
63 static inline struct pid_namespace *
64 copy_pid_ns(unsigned long flags, struct pid_namespace *ns)
66 if (flags & CLONE_NEWPID)
67 ns = ERR_PTR(-EINVAL);
71 static inline void put_pid_ns(struct pid_namespace *ns)
76 static inline void zap_pid_ns_processes(struct pid_namespace *ns)
80 #endif /* CONFIG_PID_NS */
82 extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
83 void pidhash_init(void);
84 void pidmap_init(void);
86 #endif /* _LINUX_PID_NS_H */