pid namespaces: helpers to find the task by its numerical ids

When searching the task by numerical id on may need to find it using global
pid (as it is done now in kernel) or by its virtual id, e.g.  when sending a
signal to a task from one namespace the sender will specify the task's virtual
id and we should find the task by this value.

[[email protected]: fix gfs2 linkage]
Signed-off-by: Pavel Emelyanov <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Sukadev Bhattiprolu <[email protected]>
Cc: Paul Menage <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Pavel Emelyanov 2007-10-18 23:40:06 -07:00 • committed by Linus Torvalds
commit 198fe21b0a
4 changed files with 70 additions and 22 deletions

View file

@ -2333,7 +2333,7 @@ static struct task_struct *next_tgid(unsigned int tgid)
rcu_read_lock();
retry:
task = NULL;
pid = find_ge_pid(tgid);
pid = find_ge_pid(tgid, &init_pid_ns);
if (pid) {
tgid = pid->nr + 1;
task = pid_task(pid, PIDTYPE_PID);