diff options
author | Oleg Nesterov <oleg@redhat.com> | 2010-05-26 14:43:11 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 09:12:46 -0700 |
commit | 09faef11df8c559a23e2405d123cb2683733a79a (patch) | |
tree | db8e4c94677be8afebde938c2e6b7ba07b6b6db0 | |
parent | 9c3391684415c9dca239130d9e433a60a4edf04b (diff) | |
download | kernel-common-09faef11df8c559a23e2405d123cb2683733a79a.tar.gz kernel-common-09faef11df8c559a23e2405d123cb2683733a79a.tar.bz2 kernel-common-09faef11df8c559a23e2405d123cb2683733a79a.zip |
exit: change zap_other_threads() to count sub-threads
Change zap_other_threads() to return the number of other sub-threads found
on ->thread_group list.
Other changes are cosmetic:
- change the code to use while_each_thread() helper
- remove the obsolete comment about SIGKILL/SIGSTOP
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Roland McGrath <roland@redhat.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/sched.h | 2 | ||||
-rw-r--r-- | kernel/signal.c | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4f31a166b1a1..a95a2455cebe 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -2036,7 +2036,7 @@ extern int do_notify_parent(struct task_struct *, int); extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); extern void force_sig(int, struct task_struct *); extern int send_sig(int, struct task_struct *, int); -extern void zap_other_threads(struct task_struct *p); +extern int zap_other_threads(struct task_struct *p); extern struct sigqueue *sigqueue_alloc(void); extern void sigqueue_free(struct sigqueue *); extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); diff --git a/kernel/signal.c b/kernel/signal.c index 2ee9573ed11f..906ae5a1779c 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1085,23 +1085,24 @@ force_sig_info(int sig, struct siginfo *info, struct task_struct *t) /* * Nuke all other threads in the group. */ -void zap_other_threads(struct task_struct *p) +int zap_other_threads(struct task_struct *p) { - struct task_struct *t; + struct task_struct *t = p; + int count = 0; p->signal->group_stop_count = 0; - for (t = next_thread(p); t != p; t = next_thread(t)) { - /* - * Don't bother with already dead threads - */ + while_each_thread(p, t) { + count++; + + /* Don't bother with already dead threads */ if (t->exit_state) continue; - - /* SIGKILL will be handled before any pending SIGSTOP */ sigaddset(&t->pending.signal, SIGKILL); signal_wake_up(t, 1); } + + return count; } struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags) |