summaryrefslogtreecommitdiff
path: root/kernel/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c52
1 files changed, 14 insertions, 38 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 5630255..8072e56 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1096,42 +1096,21 @@ int kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp)
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
-kill_pg_info(int sig, struct siginfo *info, pid_t pgrp)
-{
- int retval;
-
- read_lock(&tasklist_lock);
- retval = __kill_pg_info(sig, info, pgrp);
- read_unlock(&tasklist_lock);
-
- return retval;
-}
-
int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
{
int error;
- int acquired_tasklist_lock = 0;
struct task_struct *p;
rcu_read_lock();
- if (unlikely(sig_needs_tasklist(sig))) {
+ if (unlikely(sig_needs_tasklist(sig)))
read_lock(&tasklist_lock);
- acquired_tasklist_lock = 1;
- }
+
p = pid_task(pid, PIDTYPE_PID);
error = -ESRCH;
if (p)
error = group_send_sig_info(sig, info, p);
- if (unlikely(acquired_tasklist_lock))
+
+ if (unlikely(sig_needs_tasklist(sig)))
read_unlock(&tasklist_lock);
rcu_read_unlock();
return error;
@@ -1192,8 +1171,10 @@ EXPORT_SYMBOL_GPL(kill_pid_info_as_uid);
static int kill_something_info(int sig, struct siginfo *info, int pid)
{
+ int ret;
+ rcu_read_lock();
if (!pid) {
- return kill_pg_info(sig, info, process_group(current));
+ ret = kill_pgrp_info(sig, info, task_pgrp(current));
} else if (pid == -1) {
int retval = 0, count = 0;
struct task_struct * p;
@@ -1208,12 +1189,14 @@ static int kill_something_info(int sig, struct siginfo *info, int pid)
}
}
read_unlock(&tasklist_lock);
- return count ? retval : -ESRCH;
+ ret = count ? retval : -ESRCH;
} else if (pid < 0) {
- return kill_pg_info(sig, info, -pid);
+ ret = kill_pgrp_info(sig, info, find_pid(-pid));
} else {
- return kill_proc_info(sig, info, pid);
+ ret = kill_pid_info(sig, info, find_pid(pid));
}
+ rcu_read_unlock();
+ return ret;
}
/*
@@ -1312,12 +1295,6 @@ int kill_pid(struct pid *pid, int sig, int priv)
EXPORT_SYMBOL(kill_pid);
int
-kill_pg(pid_t pgrp, int sig, int priv)
-{
- return kill_pg_info(sig, __si_special(priv), pgrp);
-}
-
-int
kill_proc(pid_t pid, int sig, int priv)
{
return kill_proc_info(sig, __si_special(priv), pid);
@@ -1906,7 +1883,7 @@ relock:
/* signals can be posted during this window */
- if (is_orphaned_pgrp(process_group(current)))
+ if (is_current_pgrp_orphaned())
goto relock;
spin_lock_irq(&current->sighand->siglock);
@@ -1956,7 +1933,6 @@ EXPORT_SYMBOL(recalc_sigpending);
EXPORT_SYMBOL_GPL(dequeue_signal);
EXPORT_SYMBOL(flush_signals);
EXPORT_SYMBOL(force_sig);
-EXPORT_SYMBOL(kill_pg);
EXPORT_SYMBOL(kill_proc);
EXPORT_SYMBOL(ptrace_notify);
EXPORT_SYMBOL(send_sig);
@@ -2283,7 +2259,7 @@ static int do_tkill(int tgid, int pid, int sig)
* @pid: the PID of the thread
* @sig: signal to be sent
*
- * This syscall also checks the tgid and returns -ESRCH even if the PID
+ * This syscall also checks the @tgid and returns -ESRCH even if the PID
* exists but it's not belonging to the target process anymore. This
* method solves the problem of threads exiting and PIDs getting reused.
*/