if (!who)
p = current;
else
- p = find_task_by_pid_ns(who,
- current->nsproxy->pid_ns);
+ p = find_task_by_vpid(who);
if (p)
ret = set_task_ioprio(p, ioprio);
break;
if (!who)
p = current;
else
- p = find_task_by_pid_ns(who,
- current->nsproxy->pid_ns);
+ p = find_task_by_vpid(who);
if (p)
ret = get_task_ioprio(p);
break;
* 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_vpid():
+ * finds a task by its virtual pid
* find_task_by_pid():
* finds a task by its global pid
*
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 struct task_struct *find_task_by_pid(pid_t nr);
+extern struct task_struct *find_task_by_vpid(pid_t nr);
+extern struct task_struct *find_task_by_pid_ns(pid_t nr,
+ struct pid_namespace *ns);
extern void __set_special_pids(pid_t session, pid_t pgrp);
read_lock(&tasklist_lock);
if (pid && pid != task_pid_vnr(current)) {
- target = find_task_by_pid_ns(pid,
- current->nsproxy->pid_ns);
+ target = find_task_by_vpid(pid);
if (!target) {
ret = -ESRCH;
goto out;
read_lock(&tasklist_lock);
if (pid > 0 && pid != task_pid_vnr(current)) {
- target = find_task_by_pid_ns(pid,
- current->nsproxy->pid_ns);
+ target = find_task_by_vpid(pid);
if (!target) {
ret = -ESRCH;
goto out;
struct task_struct *p;
rcu_read_lock();
- p = find_task_by_pid_ns(pid,
- current->nsproxy->pid_ns);
-
+ p = find_task_by_vpid(pid);
if (!p || ((current->euid != p->euid) && (current->euid != p->uid)))
p = ERR_PTR(-ESRCH);
else
ret = -ESRCH;
rcu_read_lock();
- p = find_task_by_pid_ns(pid,
- current->nsproxy->pid_ns);
+ p = find_task_by_vpid(pid);
if (!p)
goto err_unlock;
ret = -EPERM;
ret = -ESRCH;
read_lock(&tasklist_lock);
- p = find_task_by_pid_ns(pid,
- current->nsproxy->pid_ns);
+ p = find_task_by_vpid(pid);
if (!p)
goto err_unlock;
ret = -EPERM;
EXPORT_SYMBOL(find_task_by_pid_type_ns);
+struct task_struct *find_task_by_pid(pid_t nr)
+{
+ return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns);
+}
+EXPORT_SYMBOL(find_task_by_pid);
+
+struct task_struct *find_task_by_vpid(pid_t vnr)
+{
+ return find_task_by_pid_type_ns(PIDTYPE_PID, vnr,
+ current->nsproxy->pid_ns);
+}
+EXPORT_SYMBOL(find_task_by_vpid);
+
+struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
+{
+ return find_task_by_pid_type_ns(PIDTYPE_PID, nr, ns);
+}
+EXPORT_SYMBOL(find_task_by_pid_ns);
+
struct pid *get_task_pid(struct task_struct *task, enum pid_type type)
{
struct pid *pid;
return ERR_PTR(-EPERM);
read_lock(&tasklist_lock);
- child = find_task_by_pid_ns(pid,
- current->nsproxy->pid_ns);
+ child = find_task_by_vpid(pid);
if (child)
get_task_struct(child);
*/
static struct task_struct *find_process_by_pid(pid_t pid)
{
- return pid ?
- find_task_by_pid_ns(pid, current->nsproxy->pid_ns) : current;
+ return pid ? find_task_by_vpid(pid) : current;
}
/* Actually do priority change: must hold rq lock. */
info.si_uid = current->uid;
read_lock(&tasklist_lock);
- p = find_task_by_pid_ns(pid, current->nsproxy->pid_ns);
+ p = find_task_by_vpid(pid);
if (p && (tgid <= 0 || task_tgid_vnr(p) == tgid)) {
error = check_kill_permission(sig, &info, p);
/*
switch (which) {
case PRIO_PROCESS:
if (who)
- p = find_task_by_pid_ns(who,
- current->nsproxy->pid_ns);
+ p = find_task_by_vpid(who);
else
p = current;
if (p)
switch (which) {
case PRIO_PROCESS:
if (who)
- p = find_task_by_pid_ns(who,
- current->nsproxy->pid_ns);
+ p = find_task_by_vpid(who);
else
p = current;
if (p) {
* session id and so the check will always fail and make it so
* init cannot successfully call setsid.
*/
- if (session > 1 && find_task_by_pid_type(PIDTYPE_PGID, session))
+ if (session > 1 && find_task_by_pid_type_ns(PIDTYPE_PGID,
+ session, &init_pid_ns))
goto out;
group_leader->signal->leader = 1;
/* Find the mm_struct */
read_lock(&tasklist_lock);
- task = pid ?
- find_task_by_pid_ns(pid, current->nsproxy->pid_ns) : current;
+ task = pid ? find_task_by_vpid(pid) : current;
if (!task) {
read_unlock(&tasklist_lock);
return -ESRCH;
/* Find the mm_struct */
read_lock(&tasklist_lock);
- task = pid ?
- find_task_by_pid_ns(pid, current->nsproxy->pid_ns) : current;
+ task = pid ? find_task_by_vpid(pid) : current;
if (!task) {
read_unlock(&tasklist_lock);
return -ESRCH;