aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/signal.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2008-07-25 04:47:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 13:53:38 -0400
commitd4434207616980885205c605697868c0f07e4378 (patch)
tree82415d69b92557e09d57f42c49aba05ef4775a89 /kernel/signal.c
parent6715ca451cfff1c9ce4b33ad9918a1dacf43997c (diff)
signals: collect_signal: simplify the "still_pending" logic
Factor out sigdelset() calls and remove the "still_pending" variable. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Acked-by: Roland McGrath <roland@redhat.com> 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.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/kernel/signal.c b/kernel/signal.c
index c5b9aabb1550..50ad439377b2 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -341,7 +341,6 @@ unblock_all_signals(void)
341static int collect_signal(int sig, struct sigpending *list, siginfo_t *info) 341static int collect_signal(int sig, struct sigpending *list, siginfo_t *info)
342{ 342{
343 struct sigqueue *q, *first = NULL; 343 struct sigqueue *q, *first = NULL;
344 int still_pending = 0;
345 344
346 /* 345 /*
347 * Collect the siginfo appropriate to this signal. Check if 346 * Collect the siginfo appropriate to this signal. Check if
@@ -349,26 +348,24 @@ static int collect_signal(int sig, struct sigpending *list, siginfo_t *info)
349 */ 348 */
350 list_for_each_entry(q, &list->list, list) { 349 list_for_each_entry(q, &list->list, list) {
351 if (q->info.si_signo == sig) { 350 if (q->info.si_signo == sig) {
352 if (first) { 351 if (first)
353 still_pending = 1; 352 goto still_pending;
354 break;
355 }
356 first = q; 353 first = q;
357 } 354 }
358 } 355 }
356
357 sigdelset(&list->signal, sig);
358
359 if (first) { 359 if (first) {
360still_pending:
360 list_del_init(&first->list); 361 list_del_init(&first->list);
361 copy_siginfo(info, &first->info); 362 copy_siginfo(info, &first->info);
362 __sigqueue_free(first); 363 __sigqueue_free(first);
363 if (!still_pending)
364 sigdelset(&list->signal, sig);
365 } else { 364 } else {
366
367 /* Ok, it wasn't in the queue. This must be 365 /* Ok, it wasn't in the queue. This must be
368 a fast-pathed signal or we must have been 366 a fast-pathed signal or we must have been
369 out of queue space. So zero out the info. 367 out of queue space. So zero out the info.
370 */ 368 */
371 sigdelset(&list->signal, sig);
372 info->si_signo = sig; 369 info->si_signo = sig;
373 info->si_errno = 0; 370 info->si_errno = 0;
374 info->si_code = 0; 371 info->si_code = 0;