i386: voyager: use __maybe_unused
[powerpc.git] / kernel / pid.c
index 25807e1..d3ad724 100644 (file)
@@ -59,10 +59,14 @@ 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 }
        },
-       .last_pid = 0
+       .last_pid = 0,
+       .child_reaper = &init_task
 };
 
 /*
@@ -207,7 +211,7 @@ struct pid *alloc_pid(void)
        if (!pid)
                goto out;
 
-       nr = alloc_pidmap(&init_pid_ns);
+       nr = alloc_pidmap(current->nsproxy->pid_ns);
        if (nr < 0)
                goto out_free;
 
@@ -349,13 +353,28 @@ struct pid *find_ge_pid(int nr)
                pid = find_pid(nr);
                if (pid)
                        break;
-               nr = next_pidmap(&init_pid_ns, nr);
+               nr = next_pidmap(current->nsproxy->pid_ns, nr);
        } while (nr > 0);
 
        return pid;
 }
 EXPORT_SYMBOL_GPL(find_get_pid);
 
+struct pid_namespace *copy_pid_ns(int flags, struct pid_namespace *old_ns)
+{
+       BUG_ON(!old_ns);
+       get_pid_ns(old_ns);
+       return old_ns;
+}
+
+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
@@ -388,7 +407,5 @@ void __init pidmap_init(void)
        set_bit(0, init_pid_ns.pidmap[0].page);
        atomic_dec(&init_pid_ns.pidmap[0].nr_free);
 
-       pid_cachep = kmem_cache_create("pid", sizeof(struct pid),
-                                       __alignof__(struct pid),
-                                       SLAB_PANIC, NULL, NULL);
+       pid_cachep = KMEM_CACHE(pid, SLAB_PANIC);
 }