|
@@ -1055,28 +1055,44 @@ int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * kill_pg_info() sends a signal to a process group: this is what the tty
|
|
|
|
|
|
+ * kill_pgrp_info() sends a signal to a process group: this is what the tty
|
|
* control characters do (^C, ^Z etc)
|
|
* control characters do (^C, ^Z etc)
|
|
*/
|
|
*/
|
|
|
|
|
|
-int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
|
|
|
|
|
|
+int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp)
|
|
{
|
|
{
|
|
struct task_struct *p = NULL;
|
|
struct task_struct *p = NULL;
|
|
int retval, success;
|
|
int retval, success;
|
|
|
|
|
|
- if (pgrp <= 0)
|
|
|
|
- return -EINVAL;
|
|
|
|
-
|
|
|
|
success = 0;
|
|
success = 0;
|
|
retval = -ESRCH;
|
|
retval = -ESRCH;
|
|
- do_each_task_pid(pgrp, PIDTYPE_PGID, p) {
|
|
|
|
|
|
+ do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
|
|
int err = group_send_sig_info(sig, info, p);
|
|
int err = group_send_sig_info(sig, info, p);
|
|
success |= !err;
|
|
success |= !err;
|
|
retval = err;
|
|
retval = err;
|
|
- } while_each_task_pid(pgrp, PIDTYPE_PGID, p);
|
|
|
|
|
|
+ } while_each_pid_task(pgrp, PIDTYPE_PGID, p);
|
|
return success ? 0 : retval;
|
|
return success ? 0 : retval;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp)
|
|
|
|
+{
|
|
|
|
+ int retval;
|
|
|
|
+
|
|
|
|
+ read_lock(&tasklist_lock);
|
|
|
|
+ retval = __kill_pgrp_info(sig, info, pgrp);
|
|
|
|
+ read_unlock(&tasklist_lock);
|
|
|
|
+
|
|
|
|
+ return retval;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int __kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
|
|
|
|
+{
|
|
|
|
+ if (pgrp <= 0)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
+ return __kill_pgrp_info(sig, info, find_pid(pgrp));
|
|
|
|
+}
|
|
|
|
+
|
|
int
|
|
int
|
|
kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
|
|
kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
|
|
{
|
|
{
|
|
@@ -1089,8 +1105,7 @@ kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
|
|
return retval;
|
|
return retval;
|
|
}
|
|
}
|
|
|
|
|
|
-int
|
|
|
|
-kill_proc_info(int sig, struct siginfo *info, pid_t pid)
|
|
|
|
|
|
+int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
|
|
{
|
|
{
|
|
int error;
|
|
int error;
|
|
int acquired_tasklist_lock = 0;
|
|
int acquired_tasklist_lock = 0;
|
|
@@ -1101,7 +1116,7 @@ kill_proc_info(int sig, struct siginfo *info, pid_t pid)
|
|
read_lock(&tasklist_lock);
|
|
read_lock(&tasklist_lock);
|
|
acquired_tasklist_lock = 1;
|
|
acquired_tasklist_lock = 1;
|
|
}
|
|
}
|
|
- p = find_task_by_pid(pid);
|
|
|
|
|
|
+ p = pid_task(pid, PIDTYPE_PID);
|
|
error = -ESRCH;
|
|
error = -ESRCH;
|
|
if (p)
|
|
if (p)
|
|
error = group_send_sig_info(sig, info, p);
|
|
error = group_send_sig_info(sig, info, p);
|
|
@@ -1111,6 +1126,16 @@ kill_proc_info(int sig, struct siginfo *info, pid_t pid)
|
|
return error;
|
|
return error;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int
|
|
|
|
+kill_proc_info(int sig, struct siginfo *info, pid_t pid)
|
|
|
|
+{
|
|
|
|
+ int error;
|
|
|
|
+ rcu_read_lock();
|
|
|
|
+ error = kill_pid_info(sig, info, find_pid(pid));
|
|
|
|
+ rcu_read_unlock();
|
|
|
|
+ return error;
|
|
|
|
+}
|
|
|
|
+
|
|
/* like kill_proc_info(), but doesn't use uid/euid of "current" */
|
|
/* like kill_proc_info(), but doesn't use uid/euid of "current" */
|
|
int kill_proc_info_as_uid(int sig, struct siginfo *info, pid_t pid,
|
|
int kill_proc_info_as_uid(int sig, struct siginfo *info, pid_t pid,
|
|
uid_t uid, uid_t euid, u32 secid)
|
|
uid_t uid, uid_t euid, u32 secid)
|
|
@@ -1264,6 +1289,18 @@ force_sigsegv(int sig, struct task_struct *p)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int kill_pgrp(struct pid *pid, int sig, int priv)
|
|
|
|
+{
|
|
|
|
+ return kill_pgrp_info(sig, __si_special(priv), pid);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(kill_pgrp);
|
|
|
|
+
|
|
|
|
+int kill_pid(struct pid *pid, int sig, int priv)
|
|
|
|
+{
|
|
|
|
+ return kill_pid_info(sig, __si_special(priv), pid);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(kill_pid);
|
|
|
|
+
|
|
int
|
|
int
|
|
kill_pg(pid_t pgrp, int sig, int priv)
|
|
kill_pg(pid_t pgrp, int sig, int priv)
|
|
{
|
|
{
|