[PATCH] add child reaper to pid_namespace
Add a per pid_namespace child-reaper. This is needed so processes are reaped
within the same pid space and do not spill over to the parent pid space. Its
also needed so containers preserve existing semantic that pid == 1 would reap
orphaned children.
This is based on Eric Biederman's patch: http://lkml.org/lkml/2006/2/6/285
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 76e7c6b..d2a9d41 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -19,6 +19,7 @@
struct kref kref;
struct pidmap pidmap[PIDMAP_ENTRIES];
int last_pid;
+ struct task_struct *child_reaper;
};
extern struct pid_namespace init_pid_ns;
@@ -36,4 +37,9 @@
kref_put(&ns->kref, free_pid_ns);
}
+static inline struct task_struct *child_reaper(struct task_struct *tsk)
+{
+ return tsk->nsproxy->pid_ns->child_reaper;
+}
+
#endif /* _LINUX_PID_NS_H */