#define SEND_SIG_PRIV ((struct siginfo *) 1)
#define SEND_SIG_FORCED ((struct siginfo *) 2)
+static inline int is_si_special(const struct siginfo *info)
+{
+ return info <= SEND_SIG_FORCED;
+}
+
/* True if we are on the alternate signal stack. */
static inline int on_sig_stack(unsigned long sp)
if (!valid_signal(sig))
return error;
error = -EPERM;
- if ((info == SEND_SIG_NOINFO ||
- (info != SEND_SIG_PRIV && info != SEND_SIG_FORCED
- && SI_FROMUSER(info)))
+ if ((info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info)))
&& ((sig != SIGCONT) ||
(current->signal->session != t->signal->session))
&& (current->euid ^ t->suid) && (current->euid ^ t->uid)
pass on the info struct. */
q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN &&
- (info < SEND_SIG_FORCED ||
+ (is_si_special(info) ||
info->si_code >= 0)));
if (q) {
list_add_tail(&q->list, &signals->list);
copy_siginfo(&q->info, info);
break;
}
- } else {
- if (sig >= SIGRTMIN
- && info != SEND_SIG_NOINFO && info != SEND_SIG_PRIV
- && info->si_code != SI_USER)
+ } else if (!is_si_special(info)) {
+ if (sig >= SIGRTMIN && info->si_code != SI_USER)
/*
* Queue overflow, abort. We may abort if the signal was rt
* and sent by user using something other than kill().
*/
return -EAGAIN;
- if ((info > SEND_SIG_PRIV) && (info->si_code == SI_TIMER))
+ if (info->si_code == SI_TIMER)
/*
* Set up a return to indicate that we dropped
* the signal.
BUG();
assert_spin_locked(&t->sighand->siglock);
- if ((info > SEND_SIG_FORCED) && (info->si_code == SI_TIMER))
+ if (!is_si_special(info) && (info->si_code == SI_TIMER))
/*
* Set up a return to indicate that we dropped the signal.
*/
assert_spin_locked(&p->sighand->siglock);
handle_stop_signal(sig, p);
- if ((info > SEND_SIG_FORCED) && (info->si_code == SI_TIMER))
+ if (!is_si_special(info) && (info->si_code == SI_TIMER))
/*
* Set up a return to indicate that we dropped the signal.
*/