diff options
author | Oleg Nesterov <oleg@redhat.com> | 2010-05-26 17:43:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:46 -0400 |
commit | 09faef11df8c559a23e2405d123cb2683733a79a (patch) | |
tree | db8e4c94677be8afebde938c2e6b7ba07b6b6db0 /kernel/signal.c | |
parent | 9c3391684415c9dca239130d9e433a60a4edf04b (diff) |
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>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 17 |
1 files changed, 9 insertions, 8 deletions
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) | |||
1085 | /* | 1085 | /* |
1086 | * Nuke all other threads in the group. | 1086 | * Nuke all other threads in the group. |
1087 | */ | 1087 | */ |
1088 | void zap_other_threads(struct task_struct *p) | 1088 | int zap_other_threads(struct task_struct *p) |
1089 | { | 1089 | { |
1090 | struct task_struct *t; | 1090 | struct task_struct *t = p; |
1091 | int count = 0; | ||
1091 | 1092 | ||
1092 | p->signal->group_stop_count = 0; | 1093 | p->signal->group_stop_count = 0; |
1093 | 1094 | ||
1094 | for (t = next_thread(p); t != p; t = next_thread(t)) { | 1095 | while_each_thread(p, t) { |
1095 | /* | 1096 | count++; |
1096 | * Don't bother with already dead threads | 1097 | |
1097 | */ | 1098 | /* Don't bother with already dead threads */ |
1098 | if (t->exit_state) | 1099 | if (t->exit_state) |
1099 | continue; | 1100 | continue; |
1100 | |||
1101 | /* SIGKILL will be handled before any pending SIGSTOP */ | ||
1102 | sigaddset(&t->pending.signal, SIGKILL); | 1101 | sigaddset(&t->pending.signal, SIGKILL); |
1103 | signal_wake_up(t, 1); | 1102 | signal_wake_up(t, 1); |
1104 | } | 1103 | } |
1104 | |||
1105 | return count; | ||
1105 | } | 1106 | } |
1106 | 1107 | ||
1107 | struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags) | 1108 | struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags) |