aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-30 03:52:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:34 -0400
commitc5363d03637885310f1101b95cbbd26d067b4c8d (patch)
treee22fd822f03dd5437c53bf459ae986723aaa1613 /kernel/signal.c
parent93585eeaf3d42d608cd7232e7420c93fb676bba1 (diff)
signals: clean dequeue_signal from excess checks and assignments
The signr variable may be declared without initialization - it is set ro the return value from __dequeue_signal() right at the function beginning. Besides, after recalc_sigpending() two checks for signr to be not 0 may be merged into one. Both if-s become easier to read. Thanks to Oleg for pointing out mistakes in the first version of this patch. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Roland McGrath <roland@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r--kernel/signal.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index 24ee53b7f60c..6610a95506b3 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -377,7 +377,7 @@ static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
377 */ 377 */
378int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) 378int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
379{ 379{
380 int signr = 0; 380 int signr;
381 381
382 /* We only dequeue private signals from ourselves, we don't let 382 /* We only dequeue private signals from ourselves, we don't let
383 * signalfd steal them 383 * signalfd steal them
@@ -410,8 +410,12 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
410 } 410 }
411 } 411 }
412 } 412 }
413
413 recalc_sigpending(); 414 recalc_sigpending();
414 if (signr && unlikely(sig_kernel_stop(signr))) { 415 if (!signr)
416 return 0;
417
418 if (unlikely(sig_kernel_stop(signr))) {
415 /* 419 /*
416 * Set a marker that we have dequeued a stop signal. Our 420 * Set a marker that we have dequeued a stop signal. Our
417 * caller might release the siglock and then the pending 421 * caller might release the siglock and then the pending
@@ -427,9 +431,7 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
427 if (!(tsk->signal->flags & SIGNAL_GROUP_EXIT)) 431 if (!(tsk->signal->flags & SIGNAL_GROUP_EXIT))
428 tsk->signal->flags |= SIGNAL_STOP_DEQUEUED; 432 tsk->signal->flags |= SIGNAL_STOP_DEQUEUED;
429 } 433 }
430 if (signr && 434 if ((info->si_code & __SI_MASK) == __SI_TIMER && info->si_sys_private) {
431 ((info->si_code & __SI_MASK) == __SI_TIMER) &&
432 info->si_sys_private) {
433 /* 435 /*
434 * Release the siglock to ensure proper locking order 436 * Release the siglock to ensure proper locking order
435 * of timer locks outside of siglocks. Note, we leave 437 * of timer locks outside of siglocks. Note, we leave