mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 11:16:11 +00:00
signals: split do_tkill
Split out the code from do_tkill to make it reusable by the follow up patch which implements sys_rt_tgsigqueueinfo Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Oleg Nesterov <oleg@redhat.com>
This commit is contained in:
parent
091438dd56
commit
30b4ae8a44
1 changed files with 18 additions and 12 deletions
|
@ -2278,24 +2278,17 @@ SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
|
||||||
return kill_something_info(sig, &info, pid);
|
return kill_something_info(sig, &info, pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_tkill(pid_t tgid, pid_t pid, int sig)
|
static int
|
||||||
|
do_send_specific(pid_t tgid, pid_t pid, int sig, struct siginfo *info)
|
||||||
{
|
{
|
||||||
int error;
|
|
||||||
struct siginfo info;
|
|
||||||
struct task_struct *p;
|
struct task_struct *p;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
int error = -ESRCH;
|
||||||
error = -ESRCH;
|
|
||||||
info.si_signo = sig;
|
|
||||||
info.si_errno = 0;
|
|
||||||
info.si_code = SI_TKILL;
|
|
||||||
info.si_pid = task_tgid_vnr(current);
|
|
||||||
info.si_uid = current_uid();
|
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
p = find_task_by_vpid(pid);
|
p = find_task_by_vpid(pid);
|
||||||
if (p && (tgid <= 0 || task_tgid_vnr(p) == tgid)) {
|
if (p && (tgid <= 0 || task_tgid_vnr(p) == tgid)) {
|
||||||
error = check_kill_permission(sig, &info, p);
|
error = check_kill_permission(sig, info, p);
|
||||||
/*
|
/*
|
||||||
* The null signal is a permissions and process existence
|
* The null signal is a permissions and process existence
|
||||||
* probe. No signal is actually delivered.
|
* probe. No signal is actually delivered.
|
||||||
|
@ -2305,7 +2298,7 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig)
|
||||||
* signal is private anyway.
|
* signal is private anyway.
|
||||||
*/
|
*/
|
||||||
if (!error && sig && lock_task_sighand(p, &flags)) {
|
if (!error && sig && lock_task_sighand(p, &flags)) {
|
||||||
error = specific_send_sig_info(sig, &info, p);
|
error = specific_send_sig_info(sig, info, p);
|
||||||
unlock_task_sighand(p, &flags);
|
unlock_task_sighand(p, &flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2314,6 +2307,19 @@ static int do_tkill(pid_t tgid, pid_t pid, int sig)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int do_tkill(pid_t tgid, pid_t pid, int sig)
|
||||||
|
{
|
||||||
|
struct siginfo info;
|
||||||
|
|
||||||
|
info.si_signo = sig;
|
||||||
|
info.si_errno = 0;
|
||||||
|
info.si_code = SI_TKILL;
|
||||||
|
info.si_pid = task_tgid_vnr(current);
|
||||||
|
info.si_uid = current_uid();
|
||||||
|
|
||||||
|
return do_send_specific(tgid, pid, sig, &info);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sys_tgkill - send signal to one specific thread
|
* sys_tgkill - send signal to one specific thread
|
||||||
* @tgid: the thread group ID of the thread
|
* @tgid: the thread group ID of the thread
|
||||||
|
|
Loading…
Reference in a new issue