blob: 76e7c6b2cf3304e003f7002597d7d6627c7a7f9c [file] [log] [blame]
Sukadev Bhattiprolu61a58c62006-12-08 02:37:58 -08001#ifndef _LINUX_PID_NS_H
2#define _LINUX_PID_NS_H
Sukadev Bhattiproluaa5a6662006-10-02 02:17:23 -07003
4#include <linux/sched.h>
5#include <linux/mm.h>
6#include <linux/threads.h>
7#include <linux/pid.h>
Cedric Le Goater9a575a92006-12-08 02:37:59 -08008#include <linux/nsproxy.h>
9#include <linux/kref.h>
Sukadev Bhattiproluaa5a6662006-10-02 02:17:23 -070010
11struct pidmap {
12 atomic_t nr_free;
13 void *page;
14};
15
16#define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8)
17
Sukadev Bhattiprolu61a58c62006-12-08 02:37:58 -080018struct pid_namespace {
Cedric Le Goater9a575a92006-12-08 02:37:59 -080019 struct kref kref;
20 struct pidmap pidmap[PIDMAP_ENTRIES];
21 int last_pid;
Sukadev Bhattiprolu3fbc9642006-10-02 02:17:24 -070022};
23
Sukadev Bhattiprolu61a58c62006-12-08 02:37:58 -080024extern struct pid_namespace init_pid_ns;
Sukadev Bhattiprolu3fbc9642006-10-02 02:17:24 -070025
Cedric Le Goater9a575a92006-12-08 02:37:59 -080026static inline void get_pid_ns(struct pid_namespace *ns)
27{
28 kref_get(&ns->kref);
29}
30
31extern int copy_pid_ns(int flags, struct task_struct *tsk);
32extern void free_pid_ns(struct kref *kref);
33
34static inline void put_pid_ns(struct pid_namespace *ns)
35{
36 kref_put(&ns->kref, free_pid_ns);
37}
38
Sukadev Bhattiprolu61a58c62006-12-08 02:37:58 -080039#endif /* _LINUX_PID_NS_H */