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 pid_namespace
{
19 struct pidmap pidmap
[PIDMAP_ENTRIES
];
21 struct task_struct
*child_reaper
;
22 struct kmem_cache
*pid_cachep
;
24 struct pid_namespace
*parent
;
26 struct vfsmount
*proc_mnt
;
30 extern struct pid_namespace init_pid_ns
;
32 static inline struct pid_namespace
*get_pid_ns(struct pid_namespace
*ns
)
34 if (ns
!= &init_pid_ns
)
39 extern struct pid_namespace
*copy_pid_ns(unsigned long flags
, struct pid_namespace
*ns
);
40 extern void free_pid_ns(struct kref
*kref
);
42 static inline void put_pid_ns(struct pid_namespace
*ns
)
44 if (ns
!= &init_pid_ns
)
45 kref_put(&ns
->kref
, free_pid_ns
);
48 static inline struct pid_namespace
*task_active_pid_ns(struct task_struct
*tsk
)
50 return tsk
->nsproxy
->pid_ns
;
53 static inline struct task_struct
*task_child_reaper(struct task_struct
*tsk
)
55 BUG_ON(tsk
!= current
);
56 return tsk
->nsproxy
->pid_ns
->child_reaper
;
59 #endif /* _LINUX_PID_NS_H */