Commit 09faef11 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

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: default avatarOleg Nesterov <oleg@redhat.com>
Acked-by: default avatarRoland McGrath <roland@redhat.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9c339168
...@@ -2036,7 +2036,7 @@ extern int do_notify_parent(struct task_struct *, int); ...@@ -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 __wake_up_parent(struct task_struct *p, struct task_struct *parent);
extern void force_sig(int, struct task_struct *); extern void force_sig(int, struct task_struct *);
extern int send_sig(int, struct task_struct *, int); 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 struct sigqueue *sigqueue_alloc(void);
extern void sigqueue_free(struct sigqueue *); extern void sigqueue_free(struct sigqueue *);
extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group);
......
...@@ -1085,23 +1085,24 @@ force_sig_info(int sig, struct siginfo *info, struct task_struct *t) ...@@ -1085,23 +1085,24 @@ force_sig_info(int sig, struct siginfo *info, struct task_struct *t)
/* /*
* Nuke all other threads in the group. * 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; p->signal->group_stop_count = 0;
for (t = next_thread(p); t != p; t = next_thread(t)) { while_each_thread(p, t) {
/* count++;
* Don't bother with already dead threads
*/ /* Don't bother with already dead threads */
if (t->exit_state) if (t->exit_state)
continue; continue;
/* SIGKILL will be handled before any pending SIGSTOP */
sigaddset(&t->pending.signal, SIGKILL); sigaddset(&t->pending.signal, SIGKILL);
signal_wake_up(t, 1); signal_wake_up(t, 1);
} }
return count;
} }
struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags) struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment