From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Emelyanov Subject: [PATCH 3/7] proc: Introduce the Children: line in /proc//status Date: Fri, 15 Jul 2011 17:46:43 +0400 Message-ID: <4E2044C3.7050506@parallels.com> References: <4E204466.8010204@parallels.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4E204466.8010204-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Nathan Lynch , Oren Laadan , Daniel Lezcano , Serge Hallyn , Tejun Heo Cc: Cyrill Gorcunov , Linux Containers , Glauber Costa List-Id: containers.vger.kernel.org Although we can get the pids of some task's issue, this is just more convenient to have them this way. Signed-off-by: Pavel Emelyanov . --- fs/proc/array.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/fs/proc/array.c b/fs/proc/array.c index 5e4f776..f01f480 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -158,6 +158,18 @@ static inline const char *get_task_state(struct task_struct *tsk) return *p; } +static void task_children(struct seq_file *m, struct task_struct *p, struct pid_namespace *ns) +{ + struct task_struct *c; + + seq_printf(m, "Children:"); + read_lock(&tasklist_lock); + list_for_each_entry(c, &p->children, sibling) + seq_printf(m, " %d", pid_nr_ns(task_pid(c), ns)); + read_unlock(&tasklist_lock); + seq_putc(m, '\n'); +} + static inline void task_state(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *p) { @@ -192,6 +204,8 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, cred->uid, cred->euid, cred->suid, cred->fsuid, cred->gid, cred->egid, cred->sgid, cred->fsgid); + task_children(m, p, ns); + task_lock(p); if (p->files) fdt = files_fdtable(p->files); -- 1.5.5.6