[PATCH] to nsproxy
Add the pid namespace framework to the nsproxy object. The copy of the pid namespace only increases the refcount on the global pid namespace, init_pid_ns, and unshare is not implemented. There is no configuration option to activate or deactivate this feature because this not relevant for the moment. Signed-off-by: Cedric Le Goater <clg@fr.ibm.com> Cc: Kirill Korotaev <dev@openvz.org> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
61a58c6c23
commit
9a575a92db
23
kernel/pid.c
23
kernel/pid.c
@@ -59,6 +59,9 @@ static inline int mk_pid(struct pid_namespace *pid_ns,
|
||||
* the scheme scales to up to 4 million PIDs, runtime.
|
||||
*/
|
||||
struct pid_namespace init_pid_ns = {
|
||||
.kref = {
|
||||
.refcount = ATOMIC_INIT(2),
|
||||
},
|
||||
.pidmap = {
|
||||
[ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL }
|
||||
},
|
||||
@@ -356,6 +359,26 @@ struct pid *find_ge_pid(int nr)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(find_get_pid);
|
||||
|
||||
int copy_pid_ns(int flags, struct task_struct *tsk)
|
||||
{
|
||||
struct pid_namespace *old_ns = tsk->nsproxy->pid_ns;
|
||||
int err = 0;
|
||||
|
||||
if (!old_ns)
|
||||
return 0;
|
||||
|
||||
get_pid_ns(old_ns);
|
||||
return err;
|
||||
}
|
||||
|
||||
void free_pid_ns(struct kref *kref)
|
||||
{
|
||||
struct pid_namespace *ns;
|
||||
|
||||
ns = container_of(kref, struct pid_namespace, kref);
|
||||
kfree(ns);
|
||||
}
|
||||
|
||||
/*
|
||||
* The pid hash table is scaled according to the amount of memory in the
|
||||
* machine. From a minimum of 16 slots up to 4096 slots at one gigabyte or
|
||||
|
||||
Reference in New Issue
Block a user