OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on OMAP4
[zen-stable.git] / include / linux / pid_namespace.h
blobe7cf6669ac3482e606c04e90470af6a37d4adcf4
1 #ifndef _LINUX_PID_NS_H
2 #define _LINUX_PID_NS_H
4 #include <linux/sched.h>
5 #include <linux/mm.h>
6 #include <linux/threads.h>
7 #include <linux/nsproxy.h>
8 #include <linux/kref.h>
10 struct pidmap {
11 atomic_t nr_free;
12 void *page;
15 #define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
17 struct bsd_acct_struct;
19 struct pid_namespace {
20 struct kref kref;
21 struct pidmap pidmap[PIDMAP_ENTRIES];
22 int last_pid;
23 struct task_struct *child_reaper;
24 struct kmem_cache *pid_cachep;
25 unsigned int level;
26 struct pid_namespace *parent;
27 #ifdef CONFIG_PROC_FS
28 struct vfsmount *proc_mnt;
29 #endif
30 #ifdef CONFIG_BSD_PROCESS_ACCT
31 struct bsd_acct_struct *bacct;
32 #endif
33 gid_t pid_gid;
34 int hide_pid;
37 extern struct pid_namespace init_pid_ns;
39 #ifdef CONFIG_PID_NS
40 static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
42 if (ns != &init_pid_ns)
43 kref_get(&ns->kref);
44 return ns;
47 extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
48 extern void free_pid_ns(struct kref *kref);
49 extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
51 static inline void put_pid_ns(struct pid_namespace *ns)
53 if (ns != &init_pid_ns)
54 kref_put(&ns->kref, free_pid_ns);
57 #else /* !CONFIG_PID_NS */
58 #include <linux/err.h>
60 static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
62 return ns;
65 static inline struct pid_namespace *
66 copy_pid_ns(unsigned long flags, struct pid_namespace *ns)
68 if (flags & CLONE_NEWPID)
69 ns = ERR_PTR(-EINVAL);
70 return ns;
73 static inline void put_pid_ns(struct pid_namespace *ns)
78 static inline void zap_pid_ns_processes(struct pid_namespace *ns)
80 BUG();
82 #endif /* CONFIG_PID_NS */
84 extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
85 void pidhash_init(void);
86 void pidmap_init(void);
88 #endif /* _LINUX_PID_NS_H */