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. [akpm@linux-foundation.org: fix gfs2 linkage] Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com> Cc: Paul Menage <menage@google.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
7af5729474
commit
198fe21b0a
@@ -1514,8 +1514,35 @@ extern struct task_struct init_task;
|
||||
|
||||
extern struct mm_struct init_mm;
|
||||
|
||||
#define find_task_by_pid(nr) find_task_by_pid_type(PIDTYPE_PID, nr)
|
||||
extern struct task_struct *find_task_by_pid_type(int type, int pid);
|
||||
extern struct pid_namespace init_pid_ns;
|
||||
|
||||
/*
|
||||
* find a task by one of its numerical ids
|
||||
*
|
||||
* find_task_by_pid_type_ns():
|
||||
* it is the most generic call - it finds a task by all id,
|
||||
* type and namespace specified
|
||||
* find_task_by_pid_ns():
|
||||
* finds a task by its pid in the specified namespace
|
||||
* find_task_by_pid_type():
|
||||
* finds a task by its global id with the specified type, e.g.
|
||||
* by global session id
|
||||
* find_task_by_pid():
|
||||
* finds a task by its global pid
|
||||
*
|
||||
* see also find_pid() etc in include/linux/pid.h
|
||||
*/
|
||||
|
||||
extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
|
||||
struct pid_namespace *ns);
|
||||
|
||||
#define find_task_by_pid_ns(nr, ns) \
|
||||
find_task_by_pid_type_ns(PIDTYPE_PID, nr, ns)
|
||||
#define find_task_by_pid_type(type, nr) \
|
||||
find_task_by_pid_type_ns(type, nr, &init_pid_ns)
|
||||
#define find_task_by_pid(nr) \
|
||||
find_task_by_pid_type(PIDTYPE_PID, nr)
|
||||
|
||||
extern void __set_special_pids(pid_t session, pid_t pgrp);
|
||||
|
||||
/* per-UID process charging. */
|
||||
|
||||
Reference in New Issue
Block a user