Blame view

include/linux/pid_namespace.h 1.83 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
5
6
  
  #include <linux/sched.h>
  #include <linux/mm.h>
  #include <linux/threads.h>
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
7
8
  #include <linux/nsproxy.h>
  #include <linux/kref.h>
aa5a6662f   Sukadev Bhattiprolu   [PATCH] Move pidm...
9
10
11
12
13
14
15
  
  struct pidmap {
         atomic_t nr_free;
         void *page;
  };
  
  #define PIDMAP_ENTRIES         ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
20fad13ac   Pavel Emelyanov   pidns: add the st...
16
  struct bsd_acct_struct;
61a58c6c2   Sukadev Bhattiprolu   [PATCH] rename st...
17
  struct pid_namespace {
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
18
19
20
  	struct kref kref;
  	struct pidmap pidmap[PIDMAP_ENTRIES];
  	int last_pid;
84d737866   Sukadev Bhattiprolu   [PATCH] add child...
21
  	struct task_struct *child_reaper;
baf8f0f82   Pavel Emelianov   pid namespaces: d...
22
  	struct kmem_cache *pid_cachep;
caafa4324   Pavel Emelyanov   pidns: make pid->...
23
  	unsigned int level;
faacbfd3a   Pavel Emelyanov   pid namespaces: a...
24
  	struct pid_namespace *parent;
07543f5c7   Pavel Emelyanov   pid namespaces: m...
25
26
27
  #ifdef CONFIG_PROC_FS
  	struct vfsmount *proc_mnt;
  #endif
20fad13ac   Pavel Emelyanov   pidns: add the st...
28
29
30
  #ifdef CONFIG_BSD_PROCESS_ACCT
  	struct bsd_acct_struct *bacct;
  #endif
0499680a4   Vasiliy Kulikov   procfs: add hidep...
31
32
  	gid_t pid_gid;
  	int hide_pid;
3fbc96486   Sukadev Bhattiprolu   [PATCH] Define st...
33
  };
61a58c6c2   Sukadev Bhattiprolu   [PATCH] rename st...
34
  extern struct pid_namespace init_pid_ns;
3fbc96486   Sukadev Bhattiprolu   [PATCH] Define st...
35

57d5f66b8   Eric W. Biederman   pidns: Place unde...
36
  #ifdef CONFIG_PID_NS
a05f7b15d   Pavel Emelianov   pid namespaces: m...
37
  static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
38
  {
b461cc038   Pavel Emelyanov   pid namespaces: m...
39
40
  	if (ns != &init_pid_ns)
  		kref_get(&ns->kref);
a05f7b15d   Pavel Emelianov   pid namespaces: m...
41
  	return ns;
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
42
  }
213dd266d   Eric W. Biederman   namespace: ensure...
43
  extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
44
  extern void free_pid_ns(struct kref *kref);
74bd59bb3   Pavel Emelyanov   namespaces: clean...
45
  extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
46
47
48
  
  static inline void put_pid_ns(struct pid_namespace *ns)
  {
b461cc038   Pavel Emelyanov   pid namespaces: m...
49
50
  	if (ns != &init_pid_ns)
  		kref_put(&ns->kref, free_pid_ns);
9a575a92d   Cedric Le Goater   [PATCH] to nsproxy
51
  }
57d5f66b8   Eric W. Biederman   pidns: Place unde...
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  #else /* !CONFIG_PID_NS */
  #include <linux/err.h>
  
  static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
  {
  	return ns;
  }
  
  static inline struct pid_namespace *
  copy_pid_ns(unsigned long flags, struct pid_namespace *ns)
  {
  	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...
71
72
73
74
75
  
  static inline void zap_pid_ns_processes(struct pid_namespace *ns)
  {
  	BUG();
  }
57d5f66b8   Eric W. Biederman   pidns: Place unde...
76
  #endif /* CONFIG_PID_NS */
61bce0f13   Eric W. Biederman   pid: generalize t...
77
  extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
3ae4eed34   Adrian Bunk   proper pid{hash,m...
78
79
  void pidhash_init(void);
  void pidmap_init(void);
61a58c6c2   Sukadev Bhattiprolu   [PATCH] rename st...
80
  #endif /* _LINUX_PID_NS_H */