Commit b67a1b9e authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

[PATCH] remove hardcoded SEND_SIG_xxx constants

This patch replaces hardcoded SEND_SIG_xxx constants with
their symbolic names.

No changes in affected .o files.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3e6716e7
...@@ -547,7 +547,7 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced) ...@@ -547,7 +547,7 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced)
if (p->pdeath_signal) if (p->pdeath_signal)
/* We already hold the tasklist_lock here. */ /* We already hold the tasklist_lock here. */
group_send_sig_info(p->pdeath_signal, (void *) 0, p); group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);
/* Move the child from its dying parent to the new one. */ /* Move the child from its dying parent to the new one. */
if (unlikely(traced)) { if (unlikely(traced)) {
...@@ -591,8 +591,8 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced) ...@@ -591,8 +591,8 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced)
int pgrp = process_group(p); int pgrp = process_group(p);
if (will_become_orphaned_pgrp(pgrp, NULL) && has_stopped_jobs(pgrp)) { if (will_become_orphaned_pgrp(pgrp, NULL) && has_stopped_jobs(pgrp)) {
__kill_pg_info(SIGHUP, (void *)1, pgrp); __kill_pg_info(SIGHUP, SEND_SIG_PRIV, pgrp);
__kill_pg_info(SIGCONT, (void *)1, pgrp); __kill_pg_info(SIGCONT, SEND_SIG_PRIV, pgrp);
} }
} }
} }
...@@ -727,8 +727,8 @@ static void exit_notify(struct task_struct *tsk) ...@@ -727,8 +727,8 @@ static void exit_notify(struct task_struct *tsk)
(t->signal->session == tsk->signal->session) && (t->signal->session == tsk->signal->session) &&
will_become_orphaned_pgrp(process_group(tsk), tsk) && will_become_orphaned_pgrp(process_group(tsk), tsk) &&
has_stopped_jobs(process_group(tsk))) { has_stopped_jobs(process_group(tsk))) {
__kill_pg_info(SIGHUP, (void *)1, process_group(tsk)); __kill_pg_info(SIGHUP, SEND_SIG_PRIV, process_group(tsk));
__kill_pg_info(SIGCONT, (void *)1, process_group(tsk)); __kill_pg_info(SIGCONT, SEND_SIG_PRIV, process_group(tsk));
} }
/* Let father know we died /* Let father know we died
......
...@@ -651,8 +651,9 @@ static int check_kill_permission(int sig, struct siginfo *info, ...@@ -651,8 +651,9 @@ static int check_kill_permission(int sig, struct siginfo *info,
if (!valid_signal(sig)) if (!valid_signal(sig))
return error; return error;
error = -EPERM; error = -EPERM;
if ((!info || ((unsigned long)info != 1 && if ((info == SEND_SIG_NOINFO ||
(unsigned long)info != 2 && SI_FROMUSER(info))) (info != SEND_SIG_PRIV && info != SEND_SIG_FORCED
&& SI_FROMUSER(info)))
&& ((sig != SIGCONT) || && ((sig != SIGCONT) ||
(current->signal->session != t->signal->session)) (current->signal->session != t->signal->session))
&& (current->euid ^ t->suid) && (current->euid ^ t->uid) && (current->euid ^ t->suid) && (current->euid ^ t->uid)
...@@ -789,7 +790,7 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t, ...@@ -789,7 +790,7 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
* fast-pathed signals for kernel-internal things like SIGSTOP * fast-pathed signals for kernel-internal things like SIGSTOP
* or SIGKILL. * or SIGKILL.
*/ */
if ((unsigned long)info == 2) if (info == SEND_SIG_FORCED)
goto out_set; goto out_set;
/* Real-time signals must be queued if sent by sigqueue, or /* Real-time signals must be queued if sent by sigqueue, or
...@@ -801,19 +802,19 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t, ...@@ -801,19 +802,19 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
pass on the info struct. */ pass on the info struct. */
q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN && q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN &&
((unsigned long) info < 2 || (info < SEND_SIG_FORCED ||
info->si_code >= 0))); info->si_code >= 0)));
if (q) { if (q) {
list_add_tail(&q->list, &signals->list); list_add_tail(&q->list, &signals->list);
switch ((unsigned long) info) { switch ((unsigned long) info) {
case 0: case (unsigned long) SEND_SIG_NOINFO:
q->info.si_signo = sig; q->info.si_signo = sig;
q->info.si_errno = 0; q->info.si_errno = 0;
q->info.si_code = SI_USER; q->info.si_code = SI_USER;
q->info.si_pid = current->pid; q->info.si_pid = current->pid;
q->info.si_uid = current->uid; q->info.si_uid = current->uid;
break; break;
case 1: case (unsigned long) SEND_SIG_PRIV:
q->info.si_signo = sig; q->info.si_signo = sig;
q->info.si_errno = 0; q->info.si_errno = 0;
q->info.si_code = SI_KERNEL; q->info.si_code = SI_KERNEL;
...@@ -825,14 +826,15 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t, ...@@ -825,14 +826,15 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
break; break;
} }
} else { } else {
if (sig >= SIGRTMIN && info && (unsigned long)info != 1 if (sig >= SIGRTMIN
&& info != SEND_SIG_NOINFO && info != SEND_SIG_PRIV
&& info->si_code != SI_USER) && info->si_code != SI_USER)
/* /*
* Queue overflow, abort. We may abort if the signal was rt * Queue overflow, abort. We may abort if the signal was rt
* and sent by user using something other than kill(). * and sent by user using something other than kill().
*/ */
return -EAGAIN; return -EAGAIN;
if (((unsigned long)info > 1) && (info->si_code == SI_TIMER)) if ((info > SEND_SIG_PRIV) && (info->si_code == SI_TIMER))
/* /*
* Set up a return to indicate that we dropped * Set up a return to indicate that we dropped
* the signal. * the signal.
...@@ -858,7 +860,7 @@ specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t) ...@@ -858,7 +860,7 @@ specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t)
BUG(); BUG();
assert_spin_locked(&t->sighand->siglock); assert_spin_locked(&t->sighand->siglock);
if (((unsigned long)info > 2) && (info->si_code == SI_TIMER)) if ((info > SEND_SIG_FORCED) && (info->si_code == SI_TIMER))
/* /*
* Set up a return to indicate that we dropped the signal. * Set up a return to indicate that we dropped the signal.
*/ */
...@@ -914,7 +916,7 @@ force_sig_specific(int sig, struct task_struct *t) ...@@ -914,7 +916,7 @@ force_sig_specific(int sig, struct task_struct *t)
t->sighand->action[sig-1].sa.sa_handler = SIG_DFL; t->sighand->action[sig-1].sa.sa_handler = SIG_DFL;
sigdelset(&t->blocked, sig); sigdelset(&t->blocked, sig);
recalc_sigpending_tsk(t); recalc_sigpending_tsk(t);
specific_send_sig_info(sig, (void *)2, t); specific_send_sig_info(sig, SEND_SIG_FORCED, t);
spin_unlock_irqrestore(&t->sighand->siglock, flags); spin_unlock_irqrestore(&t->sighand->siglock, flags);
} }
...@@ -1050,7 +1052,7 @@ __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p) ...@@ -1050,7 +1052,7 @@ __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
assert_spin_locked(&p->sighand->siglock); assert_spin_locked(&p->sighand->siglock);
handle_stop_signal(sig, p); handle_stop_signal(sig, p);
if (((unsigned long)info > 2) && (info->si_code == SI_TIMER)) if ((info > SEND_SIG_FORCED) && (info->si_code == SI_TIMER))
/* /*
* Set up a return to indicate that we dropped the signal. * Set up a return to indicate that we dropped the signal.
*/ */
...@@ -1285,10 +1287,13 @@ send_sig_info(int sig, struct siginfo *info, struct task_struct *p) ...@@ -1285,10 +1287,13 @@ send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
return ret; return ret;
} }
#define __si_special(priv) \
((priv) ? SEND_SIG_PRIV : SEND_SIG_NOINFO)
int int
send_sig(int sig, struct task_struct *p, int priv) send_sig(int sig, struct task_struct *p, int priv)
{ {
return send_sig_info(sig, (void*)(long)(priv != 0), p); return send_sig_info(sig, __si_special(priv), p);
} }
/* /*
...@@ -1308,7 +1313,7 @@ send_group_sig_info(int sig, struct siginfo *info, struct task_struct *p) ...@@ -1308,7 +1313,7 @@ send_group_sig_info(int sig, struct siginfo *info, struct task_struct *p)
void void
force_sig(int sig, struct task_struct *p) force_sig(int sig, struct task_struct *p)
{ {
force_sig_info(sig, (void*)1L, p); force_sig_info(sig, SEND_SIG_PRIV, p);
} }
/* /*
...@@ -1333,13 +1338,13 @@ force_sigsegv(int sig, struct task_struct *p) ...@@ -1333,13 +1338,13 @@ force_sigsegv(int sig, struct task_struct *p)
int int
kill_pg(pid_t pgrp, int sig, int priv) kill_pg(pid_t pgrp, int sig, int priv)
{ {
return kill_pg_info(sig, (void *)(long)(priv != 0), pgrp); return kill_pg_info(sig, __si_special(priv), pgrp);
} }
int int
kill_proc(pid_t pid, int sig, int priv) kill_proc(pid_t pid, int sig, int priv)
{ {
return kill_proc_info(sig, (void *)(long)(priv != 0), pid); return kill_proc_info(sig, __si_special(priv), pid);
} }
/* /*
......
...@@ -2713,8 +2713,8 @@ static int selinux_task_kill(struct task_struct *p, struct siginfo *info, int si ...@@ -2713,8 +2713,8 @@ static int selinux_task_kill(struct task_struct *p, struct siginfo *info, int si
if (rc) if (rc)
return rc; return rc;
if (info && ((unsigned long)info == 1 || if (info != SEND_SIG_NOINFO && (info == SEND_SIG_PRIV ||
(unsigned long)info == 2 || SI_FROMKERNEL(info))) info == SEND_SIG_FORCED || SI_FROMKERNEL(info)))
return 0; return 0;
if (!sig) if (!sig)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment