aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2005-10-30 18:03:45 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:31 -0500
commit621d31219d9a788bda924a0613048053f3f5f211 (patch)
tree9fb9846fdd999ba04c436aa84c7da0d8233ac545 /kernel/signal.c
parentb67a1b9e4bf878aa5d4b6b44cb5a251a2f425f0d (diff)
[PATCH] cleanup the usage of SEND_SIG_xxx constants
This patch simplifies some checks for magic siginfo values. It should not change the behaviour in any way. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 1f7b2aaa4a39..27533b90c347 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -651,9 +651,7 @@ static int check_kill_permission(int sig, struct siginfo *info,
651 if (!valid_signal(sig)) 651 if (!valid_signal(sig))
652 return error; 652 return error;
653 error = -EPERM; 653 error = -EPERM;
654 if ((info == SEND_SIG_NOINFO || 654 if ((info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info)))
655 (info != SEND_SIG_PRIV && info != SEND_SIG_FORCED
656 && SI_FROMUSER(info)))
657 && ((sig != SIGCONT) || 655 && ((sig != SIGCONT) ||
658 (current->signal->session != t->signal->session)) 656 (current->signal->session != t->signal->session))
659 && (current->euid ^ t->suid) && (current->euid ^ t->uid) 657 && (current->euid ^ t->suid) && (current->euid ^ t->uid)
@@ -802,7 +800,7 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
802 pass on the info struct. */ 800 pass on the info struct. */
803 801
804 q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN && 802 q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN &&
805 (info < SEND_SIG_FORCED || 803 (is_si_special(info) ||
806 info->si_code >= 0))); 804 info->si_code >= 0)));
807 if (q) { 805 if (q) {
808 list_add_tail(&q->list, &signals->list); 806 list_add_tail(&q->list, &signals->list);
@@ -825,16 +823,14 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
825 copy_siginfo(&q->info, info); 823 copy_siginfo(&q->info, info);
826 break; 824 break;
827 } 825 }
828 } else { 826 } else if (!is_si_special(info)) {
829 if (sig >= SIGRTMIN 827 if (sig >= SIGRTMIN && info->si_code != SI_USER)
830 && info != SEND_SIG_NOINFO && info != SEND_SIG_PRIV
831 && info->si_code != SI_USER)
832 /* 828 /*
833 * Queue overflow, abort. We may abort if the signal was rt 829 * Queue overflow, abort. We may abort if the signal was rt
834 * and sent by user using something other than kill(). 830 * and sent by user using something other than kill().
835 */ 831 */
836 return -EAGAIN; 832 return -EAGAIN;
837 if ((info > SEND_SIG_PRIV) && (info->si_code == SI_TIMER)) 833 if (info->si_code == SI_TIMER)
838 /* 834 /*
839 * Set up a return to indicate that we dropped 835 * Set up a return to indicate that we dropped
840 * the signal. 836 * the signal.
@@ -860,7 +856,7 @@ specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t)
860 BUG(); 856 BUG();
861 assert_spin_locked(&t->sighand->siglock); 857 assert_spin_locked(&t->sighand->siglock);
862 858
863 if ((info > SEND_SIG_FORCED) && (info->si_code == SI_TIMER)) 859 if (!is_si_special(info) && (info->si_code == SI_TIMER))
864 /* 860 /*
865 * Set up a return to indicate that we dropped the signal. 861 * Set up a return to indicate that we dropped the signal.
866 */ 862 */
@@ -1052,7 +1048,7 @@ __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
1052 assert_spin_locked(&p->sighand->siglock); 1048 assert_spin_locked(&p->sighand->siglock);
1053 handle_stop_signal(sig, p); 1049 handle_stop_signal(sig, p);
1054 1050
1055 if ((info > SEND_SIG_FORCED) && (info->si_code == SI_TIMER)) 1051 if (!is_si_special(info) && (info->si_code == SI_TIMER))
1056 /* 1052 /*
1057 * Set up a return to indicate that we dropped the signal. 1053 * Set up a return to indicate that we dropped the signal.
1058 */ 1054 */