[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100622160442.GA9072@redhat.com>
Date: Tue, 22 Jun 2010 18:04:42 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Mike McCormack <mikem@...g3k.org>
Cc: akpm@...ux-foundation.org, kosaki.motohiro@...fujitsu.com,
serue@...ibm.com, jmorris@...ei.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] proc: Add complete process group list
On 06/23, Mike McCormack wrote:
>
> The new file /proc/<pid>/groups consists of a single group id per line,
> with each line being 11 characters long. This should be enough space
> for 16bit or 32bit group ids.
>
> This feature might be useful for a server listening on a unix domain pipe
> to determine the list of groups that a client process is in from its pid.
As usual, I can never comment whether we need this or not. Just a minor
nit about the code,
> +static int groups_proc_show(struct seq_file *m, void *v)
> +{
> + struct inode *inode = m->private;
> + struct group_info *group_info;
> + struct task_struct *task;
> + const struct cred *cred;
> + struct pid *pid;
> + unsigned int g;
> +
> + pid = proc_pid(inode);
> + task = get_pid_task(pid, PIDTYPE_PID);
get_proc_task() ?
> + if (!task)
> + return -ESRCH;
> +
> + cred = get_task_cred(task);
OTOH. Not that I think this is terribly important, but I don't think
this needs get_task_struct + get_cred,
group_info = NULL;
rcu_read_lock();
task = pid_task(proc_pid(inode), PIDTYPE_PID);
if (task) {
group_info = _task_cred(task)->group_info;
get_group_info(group_info);
}
rcu_read_unlock();
if (!group_info)
retrn ESRCH;
Feel free to ignore though.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists