Blame view

include/linux/pid_namespace.h 2.37 KB
61a58c6c2   Sukadev Bhattiprolu   [PATCH] rename st...
1
2
  #ifndef _LINUX_PID_NS_H
  #define _LINUX_PID_NS_H
aa5a6662f   Sukadev Bhattiprolu   [PATCH] Move pidm...
3
4
  
  #include <linux/sched.h>
187f1882b   Paul Gortmaker   BUG: headers with...
5
  #include <linux/bug.h>
aa5a6662f   Sukadev Bhattiprolu   [PATCH] Move pidm...
6
  #include <linux/mm.h>
a27bb332c   Kent Overstreet   aio: don't includ...
7
  #include <linux/workqueue.h>
aa5a6662f   Sukadev Bhattiprolu   [PATCH] Move pidm...
8
  #include <linux/threads.h>
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
9
10
  #include <linux/nsproxy.h>
  #include <linux/kref.h>
435d5f4bb   Al Viro   common object emb...
11
  #include <linux/ns_common.h>
aa5a6662f   Sukadev Bhattiprolu   [PATCH] Move pidm...
12
13
14
15
16
  
  struct pidmap {
         atomic_t nr_free;
         void *page;
  };
5cc544516   Raphael S.Carvalho   pid_namespace.c/....
17
18
19
  #define BITS_PER_PAGE		(PAGE_SIZE * 8)
  #define BITS_PER_PAGE_MASK	(BITS_PER_PAGE-1)
  #define PIDMAP_ENTRIES		((PID_MAX_LIMIT+BITS_PER_PAGE-1)/BITS_PER_PAGE)
aa5a6662f   Sukadev Bhattiprolu   [PATCH] Move pidm...
20

59eda0e07   Al Viro   new fs_pin killin...
21
  struct fs_pin;
20fad13ac   Pavel Emelyanov   pidns: add the st...
22

61a58c6c2   Sukadev Bhattiprolu   [PATCH] rename st...
23
  struct pid_namespace {
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
24
25
  	struct kref kref;
  	struct pidmap pidmap[PIDMAP_ENTRIES];
1adfcb03e   Al Viro   pid_namespace: ma...
26
  	struct rcu_head rcu;
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
27
  	int last_pid;
c876ad768   Eric W. Biederman   pidns: Stop pid a...
28
  	unsigned int nr_hashed;
84d737866   Sukadev Bhattiprolu   [PATCH] add child...
29
  	struct task_struct *child_reaper;
baf8f0f82   Pavel Emelianov   pid namespaces: d...
30
  	struct kmem_cache *pid_cachep;
caafa4324   Pavel Emelyanov   pidns: make pid->...
31
  	unsigned int level;
faacbfd3a   Pavel Emelyanov   pid namespaces: a...
32
  	struct pid_namespace *parent;
07543f5c7   Pavel Emelyanov   pid namespaces: m...
33
34
  #ifdef CONFIG_PROC_FS
  	struct vfsmount *proc_mnt;
021ada7df   Al Viro   procfs: switch /p...
35
  	struct dentry *proc_self;
0097875bd   Eric W. Biederman   proc: Implement /...
36
  	struct dentry *proc_thread_self;
07543f5c7   Pavel Emelyanov   pid namespaces: m...
37
  #endif
20fad13ac   Pavel Emelyanov   pidns: add the st...
38
  #ifdef CONFIG_BSD_PROCESS_ACCT
59eda0e07   Al Viro   new fs_pin killin...
39
  	struct fs_pin *bacct;
20fad13ac   Pavel Emelyanov   pidns: add the st...
40
  #endif
49f4d8b93   Eric W. Biederman   pidns: Capture th...
41
  	struct user_namespace *user_ns;
f333c700c   Eric W. Biederman   pidns: Add a limi...
42
  	struct ucounts *ucounts;
0a01f2cc3   Eric W. Biederman   pidns: Make the p...
43
  	struct work_struct proc_work;
dcb0f2228   Eric W. Biederman   userns: Convert p...
44
  	kgid_t pid_gid;
0499680a4   Vasiliy Kulikov   procfs: add hidep...
45
  	int hide_pid;
cf3f89214   Daniel Lezcano   pidns: add reboot...
46
  	int reboot;	/* group exit code if this pidns was rebooted */
435d5f4bb   Al Viro   common object emb...
47
  	struct ns_common ns;
3fbc96486   Sukadev Bhattiprolu   [PATCH] Define st...
48
  };
61a58c6c2   Sukadev Bhattiprolu   [PATCH] rename st...
49
  extern struct pid_namespace init_pid_ns;
3fbc96486   Sukadev Bhattiprolu   [PATCH] Define st...
50

c876ad768   Eric W. Biederman   pidns: Stop pid a...
51
  #define PIDNS_HASH_ADDING (1U << 31)
57d5f66b8   Eric W. Biederman   pidns: Place unde...
52
  #ifdef CONFIG_PID_NS
a05f7b15d   Pavel Emelianov   pid namespaces: m...
53
  static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
54
  {
b461cc038   Pavel Emelyanov   pid namespaces: m...
55
56
  	if (ns != &init_pid_ns)
  		kref_get(&ns->kref);
a05f7b15d   Pavel Emelianov   pid namespaces: m...
57
  	return ns;
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
58
  }
49f4d8b93   Eric W. Biederman   pidns: Capture th...
59
60
  extern struct pid_namespace *copy_pid_ns(unsigned long flags,
  	struct user_namespace *user_ns, struct pid_namespace *ns);
74bd59bb3   Pavel Emelyanov   namespaces: clean...
61
  extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
cf3f89214   Daniel Lezcano   pidns: add reboot...
62
  extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd);
bbc2e3ef8   Cyrill Gorcunov   pidns: remove rec...
63
  extern void put_pid_ns(struct pid_namespace *ns);
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
64

57d5f66b8   Eric W. Biederman   pidns: Place unde...
65
66
67
68
69
70
71
  #else /* !CONFIG_PID_NS */
  #include <linux/err.h>
  
  static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
  {
  	return ns;
  }
49f4d8b93   Eric W. Biederman   pidns: Capture th...
72
73
  static inline struct pid_namespace *copy_pid_ns(unsigned long flags,
  	struct user_namespace *user_ns, struct pid_namespace *ns)
57d5f66b8   Eric W. Biederman   pidns: Place unde...
74
75
76
77
78
79
80
81
82
  {
  	if (flags & CLONE_NEWPID)
  		ns = ERR_PTR(-EINVAL);
  	return ns;
  }
  
  static inline void put_pid_ns(struct pid_namespace *ns)
  {
  }
74bd59bb3   Pavel Emelyanov   namespaces: clean...
83
84
85
86
  static inline void zap_pid_ns_processes(struct pid_namespace *ns)
  {
  	BUG();
  }
cf3f89214   Daniel Lezcano   pidns: add reboot...
87
88
89
90
91
  
  static inline int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd)
  {
  	return 0;
  }
57d5f66b8   Eric W. Biederman   pidns: Place unde...
92
  #endif /* CONFIG_PID_NS */
61bce0f13   Eric W. Biederman   pid: generalize t...
93
  extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
3ae4eed34   Adrian Bunk   proper pid{hash,m...
94
95
  void pidhash_init(void);
  void pidmap_init(void);
61a58c6c2   Sukadev Bhattiprolu   [PATCH] rename st...
96
  #endif /* _LINUX_PID_NS_H */