aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2008-02-08 07:19:15 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:27 -0500
commit44c4e1b2581f7273ab14ef30b6430618801c57b1 (patch)
tree9881990d56dd58f0c93991217a999bab145946fa /kernel
parent161550d74c07303ffa6187ba776f62df5a906a21 (diff)
pid: Extend/Fix pid_vnr
pid_vnr returns the user space pid with respect to the pid namespace the struct pid was allocated in. What we want before we return a pid to user space is the user space pid with respect to the pid namespace of current. pid_vnr is a very nice optimization but because it isn't quite what we want it is easy to use pid_vnr at times when we aren't certain the struct pid was allocated in our pid namespace. Currently this describes at least tiocgpgrp and tiocgsid in ttyio.c the parent process reported in the core dumps and the parent process in get_signal_to_deliver. So unless the performance impact is huge having an interface that does what we want instead of always what we want should be much more reliable and much less error prone. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/pid.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index 939746fb4ce7..a32859c4a3cd 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -443,6 +443,12 @@ pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
443 return nr; 443 return nr;
444} 444}
445 445
446pid_t pid_vnr(struct pid *pid)
447{
448 return pid_nr_ns(pid, current->nsproxy->pid_ns);
449}
450EXPORT_SYMBOL_GPL(pid_vnr);
451
446pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 452pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
447{ 453{
448 return pid_nr_ns(task_pid(tsk), ns); 454 return pid_nr_ns(task_pid(tsk), ns);