procfs: add hidepid= and gid= mount options
[deliverable/linux.git] / include / linux / pid_namespace.h
CommitLineData
61a58c6c
SB
1#ifndef _LINUX_PID_NS_H
2#define _LINUX_PID_NS_H
aa5a6662
SB
3
4#include <linux/sched.h>
5#include <linux/mm.h>
6#include <linux/threads.h>
9a575a92
CLG
7#include <linux/nsproxy.h>
8#include <linux/kref.h>
aa5a6662
SB
9
10struct pidmap {
11 atomic_t nr_free;
12 void *page;
13};
14
15#define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
16
20fad13a
PE
17struct bsd_acct_struct;
18
61a58c6c 19struct pid_namespace {
9a575a92
CLG
20 struct kref kref;
21 struct pidmap pidmap[PIDMAP_ENTRIES];
22 int last_pid;
84d73786 23 struct task_struct *child_reaper;
baf8f0f8 24 struct kmem_cache *pid_cachep;
caafa432 25 unsigned int level;
faacbfd3 26 struct pid_namespace *parent;
07543f5c
PE
27#ifdef CONFIG_PROC_FS
28 struct vfsmount *proc_mnt;
29#endif
20fad13a
PE
30#ifdef CONFIG_BSD_PROCESS_ACCT
31 struct bsd_acct_struct *bacct;
32#endif
0499680a
VK
33 gid_t pid_gid;
34 int hide_pid;
3fbc9648
SB
35};
36
61a58c6c 37extern struct pid_namespace init_pid_ns;
3fbc9648 38
57d5f66b 39#ifdef CONFIG_PID_NS
a05f7b15 40static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
9a575a92 41{
b461cc03
PE
42 if (ns != &init_pid_ns)
43 kref_get(&ns->kref);
a05f7b15 44 return ns;
9a575a92
CLG
45}
46
213dd266 47extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
9a575a92 48extern void free_pid_ns(struct kref *kref);
74bd59bb 49extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
9a575a92
CLG
50
51static inline void put_pid_ns(struct pid_namespace *ns)
52{
b461cc03
PE
53 if (ns != &init_pid_ns)
54 kref_put(&ns->kref, free_pid_ns);
9a575a92
CLG
55}
56
57d5f66b
EB
57#else /* !CONFIG_PID_NS */
58#include <linux/err.h>
59
60static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
61{
62 return ns;
63}
64
65static inline struct pid_namespace *
66copy_pid_ns(unsigned long flags, struct pid_namespace *ns)
67{
68 if (flags & CLONE_NEWPID)
69 ns = ERR_PTR(-EINVAL);
70 return ns;
71}
72
73static inline void put_pid_ns(struct pid_namespace *ns)
74{
75}
76
74bd59bb
PE
77
78static inline void zap_pid_ns_processes(struct pid_namespace *ns)
79{
80 BUG();
81}
57d5f66b
EB
82#endif /* CONFIG_PID_NS */
83
61bce0f1 84extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
3ae4eed3
AB
85void pidhash_init(void);
86void pidmap_init(void);
87
61a58c6c 88#endif /* _LINUX_PID_NS_H */
This page took 0.701514 seconds and 5 git commands to generate.