From 9c716ca855cb7c4f56bde62a7b8bf5ba7306ece1 Mon Sep 17 00:00:00 2001 From: Oleg Nesterov Date: Tue, 28 Mar 2006 16:11:29 -0800 Subject: [PATCH] --- yaml --- r: 24575 b: refs/heads/master c: a1d5e21e3e388fb2c16463d007e788b1e41b74f1 h: refs/heads/master i: 24573: 9d536455f48bf75f584f2d56c6c59c241a7b6cc7 24571: e7c68934a1416353f6cd22c6100f713327f699f3 24567: 94d095245c11f208cc49d2676db5810a57239c67 24559: dfa9166c19c75a5bfcc952ff7434c2be5dafe500 24543: e7ac25990f21b9e7456aa52f69e2a36495f7f07c 24511: 1040a956af15b46aabe7d4866d4d94cf4d98e432 24447: f6c0f687e90b7a3a3b71daf344d784cd0dc5ac16 24319: 41d7a060eebaa89e18b38d53ba0e069f71c1fa43 24063: d2bd304b1fdb20518dfbc02f1c70f5f68e3dbd52 23551: b06c5bab229e268a77341e9c392c10394ce5f177 22527: 39c72eff6be891261acf8c0b8203327be14b8cf6 20479: 1f6aadaef35dc42c25871b55751f3d4a38d32ea2 16383: 44c5429a92a99d5f29c59a2bc217206709bccf35 v: v3 --- [refs] | 2 +- trunk/kernel/signal.c | 32 +++++++++++--------------------- 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/[refs] b/[refs] index f56329d9bb15..77f7786c2e12 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 883606a7c9e84e206f96c38f88c4bd66df72f51e +refs/heads/master: a1d5e21e3e388fb2c16463d007e788b1e41b74f1 diff --git a/trunk/kernel/signal.c b/trunk/kernel/signal.c index 24d5059ab0a9..0528a959daa9 100644 --- a/trunk/kernel/signal.c +++ b/trunk/kernel/signal.c @@ -591,9 +591,7 @@ static int check_kill_permission(int sig, struct siginfo *info, } /* forward decl */ -static void do_notify_parent_cldstop(struct task_struct *tsk, - int to_self, - int why); +static void do_notify_parent_cldstop(struct task_struct *tsk, int why); /* * Handle magic process-wide effects of stop/continue signals. @@ -643,7 +641,7 @@ static void handle_stop_signal(int sig, struct task_struct *p) p->signal->group_stop_count = 0; p->signal->flags = SIGNAL_STOP_CONTINUED; spin_unlock(&p->sighand->siglock); - do_notify_parent_cldstop(p, (p->ptrace & PT_PTRACED), CLD_STOPPED); + do_notify_parent_cldstop(p, CLD_STOPPED); spin_lock(&p->sighand->siglock); } rm_from_queue(SIG_KERNEL_STOP_MASK, &p->signal->shared_pending); @@ -684,7 +682,7 @@ static void handle_stop_signal(int sig, struct task_struct *p) p->signal->flags = SIGNAL_STOP_CONTINUED; p->signal->group_exit_code = 0; spin_unlock(&p->sighand->siglock); - do_notify_parent_cldstop(p, (p->ptrace & PT_PTRACED), CLD_CONTINUED); + do_notify_parent_cldstop(p, CLD_CONTINUED); spin_lock(&p->sighand->siglock); } else { /* @@ -1519,14 +1517,14 @@ void do_notify_parent(struct task_struct *tsk, int sig) spin_unlock_irqrestore(&psig->siglock, flags); } -static void do_notify_parent_cldstop(struct task_struct *tsk, int to_self, int why) +static void do_notify_parent_cldstop(struct task_struct *tsk, int why) { struct siginfo info; unsigned long flags; struct task_struct *parent; struct sighand_struct *sighand; - if (to_self) + if (tsk->ptrace & PT_PTRACED) parent = tsk->parent; else { tsk = tsk->group_leader; @@ -1601,7 +1599,7 @@ static void ptrace_stop(int exit_code, int nostop_code, siginfo_t *info) !(current->ptrace & PT_ATTACHED)) && (likely(current->parent->signal != current->signal) || !unlikely(current->signal->flags & SIGNAL_GROUP_EXIT))) { - do_notify_parent_cldstop(current, 1, CLD_TRAPPED); + do_notify_parent_cldstop(current, CLD_TRAPPED); read_unlock(&tasklist_lock); schedule(); } else { @@ -1650,25 +1648,17 @@ void ptrace_notify(int exit_code) static void finish_stop(int stop_count) { - int to_self; - /* * If there are no other threads in the group, or if there is * a group stop in progress and we are the last to stop, * report to the parent. When ptraced, every thread reports itself. */ - if (current->ptrace & PT_PTRACED) - to_self = 1; - else if (stop_count == 0) - to_self = 0; - else - goto out; - - read_lock(&tasklist_lock); - do_notify_parent_cldstop(current, to_self, CLD_STOPPED); - read_unlock(&tasklist_lock); + if (stop_count == 0 || (current->ptrace & PT_PTRACED)) { + read_lock(&tasklist_lock); + do_notify_parent_cldstop(current, CLD_STOPPED); + read_unlock(&tasklist_lock); + } -out: schedule(); /* * Now we don't run again until continued.