signal: Push pid type down into __send_signal
This information is already available in the callers and by pushing it down it makes the code a little clearer, and allows implementing better handling of signales set to a group of processes in fork. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
Родитель
b213984bd3
Коммит
5a883cee74
|
@ -998,7 +998,7 @@ static inline void userns_fixup_signal_uid(struct siginfo *info, struct task_str
|
|||
#endif
|
||||
|
||||
static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
|
||||
int group, int from_ancestor_ns)
|
||||
enum pid_type type, int from_ancestor_ns)
|
||||
{
|
||||
struct sigpending *pending;
|
||||
struct sigqueue *q;
|
||||
|
@ -1012,7 +1012,7 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
|
|||
from_ancestor_ns || (info == SEND_SIG_FORCED)))
|
||||
goto ret;
|
||||
|
||||
pending = group ? &t->signal->shared_pending : &t->pending;
|
||||
pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending;
|
||||
/*
|
||||
* Short-circuit ignored signals and support queuing
|
||||
* exactly one non-rt signal, so that we can get more
|
||||
|
@ -1096,9 +1096,9 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
|
|||
out_set:
|
||||
signalfd_notify(t, sig);
|
||||
sigaddset(&pending->signal, sig);
|
||||
complete_signal(sig, t, group);
|
||||
complete_signal(sig, t, type != PIDTYPE_PID);
|
||||
ret:
|
||||
trace_signal_generate(sig, info, t, group, result);
|
||||
trace_signal_generate(sig, info, t, type != PIDTYPE_PID, result);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1112,7 +1112,7 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
|
|||
!task_pid_nr_ns(current, task_active_pid_ns(t));
|
||||
#endif
|
||||
|
||||
return __send_signal(sig, info, t, type != PIDTYPE_PID, from_ancestor_ns);
|
||||
return __send_signal(sig, info, t, type, from_ancestor_ns);
|
||||
}
|
||||
|
||||
static void print_fatal_signal(int signr)
|
||||
|
@ -1377,7 +1377,7 @@ int kill_pid_info_as_cred(int sig, struct siginfo *info, struct pid *pid,
|
|||
|
||||
if (sig) {
|
||||
if (lock_task_sighand(p, &flags)) {
|
||||
ret = __send_signal(sig, info, p, 1, 0);
|
||||
ret = __send_signal(sig, info, p, PIDTYPE_TGID, 0);
|
||||
unlock_task_sighand(p, &flags);
|
||||
} else
|
||||
ret = -ESRCH;
|
||||
|
|
Загрузка…
Ссылка в новой задаче