lkml.org 
[lkml]   [2011]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [rfc 2/3] fs, proc: Introduce the Children: line in /proc/<pid>/status
Hello, Cyrill.

On Thu, Dec 01, 2011 at 01:54:34PM +0400, Cyrill Gorcunov wrote:
> Index: linux-2.6.git/fs/proc/array.c
> ===================================================================
> --- linux-2.6.git.orig/fs/proc/array.c
> +++ linux-2.6.git/fs/proc/array.c
> @@ -547,3 +547,17 @@ int proc_pid_statm(struct seq_file *m, s
>
> return 0;
> }
> +
> +int proc_pid_children(struct seq_file *m, struct pid_namespace *ns,
> + struct pid *pid, struct task_struct *task)
> +{
> + struct task_struct *c;
> +
> + read_lock(&tasklist_lock);
> + list_for_each_entry(c, &task->children, sibling)
> + seq_printf(m, " %d", pid_nr_ns(task_pid(c), ns));
> + read_unlock(&tasklist_lock);
> + seq_putc(m, '\n');
> +
> + return 0;
> +}

I don't think using non-seekable single seqfile is a good idea here.
It works if the whole list fits in PAGE_SIZE but assuming five digit
pid, that's only ~680 pids.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2011-12-01 16:47    [W:0.248 / U:1.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site