From: Oleg Nesterov <oleg@redhat.com>
To: Richard Guy Briggs <rgb@redhat.com>
Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org,
eparis@redhat.com, sgrubb@redhat.com, akpm@linux-foundation.org,
peterz@infradead.org, stable@vger.kernel.org,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [PATCH 7/7] pid: get pid_t ppid of task in init_pid_ns
Date: Thu, 20 Feb 2014 20:01:22 +0100 [thread overview]
Message-ID: <20140220190114.GC23993@redhat.com> (raw)
In-Reply-To: <328c85752a7eb053e72d9194827b91fc228d4f67.1390495874.git.rgb@redhat.com>
On 01/23, Richard Guy Briggs wrote:
>
> Added the functions task_ppid_nr_ns() and task_ppid_nr() to abstract the lookup
> of the PPID (real_parent's pid_t) of a process, including rcu locking, in the
> arbitrary and init_pid_ns.
> This provides an alternative to sys_getppid(), which is relative to the child
> process' pid namespace.
I agree, this makes sense.
imho it would be better to send this patch along with sys_getppid()
conversions, but I won't argue.
> +static int pid_alive(const struct task_struct *p);
> +static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
> +{
> + pid_t pid = 0;
> +
> + rcu_read_lock();
> + if (pid_alive(tsk))
> + pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
> + rcu_read_unlock();
> +
> + return pid;
> +}
Perhaps it should be named task_ptgid_nr_ns() or even parent_tgid_nr_ns().
Since it returns tgid, not pid (== tid).
But this is cosmetic, I won't insist.
Oleg.
next prev parent reply other threads:[~2014-02-20 19:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ae3d74e79649d9e4962d0da030fb4852ddc5b8d1.1387227114.git.rgb@redhat.com>
[not found] ` <cover.1390495874.git.rgb@redhat.com>
2014-01-23 19:32 ` [PATCH 7/7] pid: get pid_t ppid of task in init_pid_ns Richard Guy Briggs
2014-02-20 19:01 ` Oleg Nesterov [this message]
2014-02-21 18:10 ` Richard Guy Briggs
2014-02-24 18:32 ` Oleg Nesterov
2014-03-17 20:14 ` Tony Luck
2014-03-17 20:15 ` Eric Paris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140220190114.GC23993@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=eparis@redhat.com \
--cc=linux-audit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rgb@redhat.com \
--cc=sgrubb@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).