提交 a1d5e21e 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

[PATCH] do_notify_parent_cldstop: remove 'to_self' param

The previous patch has changed callsites of do_notify_parent_cldstop() so that
to_self == (->ptrace & PT_PTRACED) always (as it should be).  We can remove
this parameter now.
Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 883606a7
...@@ -591,9 +591,7 @@ static int check_kill_permission(int sig, struct siginfo *info, ...@@ -591,9 +591,7 @@ static int check_kill_permission(int sig, struct siginfo *info,
} }
/* forward decl */ /* forward decl */
static void do_notify_parent_cldstop(struct task_struct *tsk, static void do_notify_parent_cldstop(struct task_struct *tsk, int why);
int to_self,
int why);
/* /*
* Handle magic process-wide effects of stop/continue signals. * Handle magic process-wide effects of stop/continue signals.
...@@ -643,7 +641,7 @@ static void handle_stop_signal(int sig, struct task_struct *p) ...@@ -643,7 +641,7 @@ static void handle_stop_signal(int sig, struct task_struct *p)
p->signal->group_stop_count = 0; p->signal->group_stop_count = 0;
p->signal->flags = SIGNAL_STOP_CONTINUED; p->signal->flags = SIGNAL_STOP_CONTINUED;
spin_unlock(&p->sighand->siglock); 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); spin_lock(&p->sighand->siglock);
} }
rm_from_queue(SIG_KERNEL_STOP_MASK, &p->signal->shared_pending); 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) ...@@ -684,7 +682,7 @@ static void handle_stop_signal(int sig, struct task_struct *p)
p->signal->flags = SIGNAL_STOP_CONTINUED; p->signal->flags = SIGNAL_STOP_CONTINUED;
p->signal->group_exit_code = 0; p->signal->group_exit_code = 0;
spin_unlock(&p->sighand->siglock); 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); spin_lock(&p->sighand->siglock);
} else { } else {
/* /*
...@@ -1519,14 +1517,14 @@ void do_notify_parent(struct task_struct *tsk, int sig) ...@@ -1519,14 +1517,14 @@ void do_notify_parent(struct task_struct *tsk, int sig)
spin_unlock_irqrestore(&psig->siglock, flags); 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; struct siginfo info;
unsigned long flags; unsigned long flags;
struct task_struct *parent; struct task_struct *parent;
struct sighand_struct *sighand; struct sighand_struct *sighand;
if (to_self) if (tsk->ptrace & PT_PTRACED)
parent = tsk->parent; parent = tsk->parent;
else { else {
tsk = tsk->group_leader; tsk = tsk->group_leader;
...@@ -1601,7 +1599,7 @@ static void ptrace_stop(int exit_code, int nostop_code, siginfo_t *info) ...@@ -1601,7 +1599,7 @@ static void ptrace_stop(int exit_code, int nostop_code, siginfo_t *info)
!(current->ptrace & PT_ATTACHED)) && !(current->ptrace & PT_ATTACHED)) &&
(likely(current->parent->signal != current->signal) || (likely(current->parent->signal != current->signal) ||
!unlikely(current->signal->flags & SIGNAL_GROUP_EXIT))) { !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); read_unlock(&tasklist_lock);
schedule(); schedule();
} else { } else {
...@@ -1650,25 +1648,17 @@ void ptrace_notify(int exit_code) ...@@ -1650,25 +1648,17 @@ void ptrace_notify(int exit_code)
static void static void
finish_stop(int stop_count) finish_stop(int stop_count)
{ {
int to_self;
/* /*
* If there are no other threads in the group, or if there is * 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, * a group stop in progress and we are the last to stop,
* report to the parent. When ptraced, every thread reports itself. * report to the parent. When ptraced, every thread reports itself.
*/ */
if (current->ptrace & PT_PTRACED) if (stop_count == 0 || (current->ptrace & PT_PTRACED)) {
to_self = 1; read_lock(&tasklist_lock);
else if (stop_count == 0) do_notify_parent_cldstop(current, CLD_STOPPED);
to_self = 0; read_unlock(&tasklist_lock);
else }
goto out;
read_lock(&tasklist_lock);
do_notify_parent_cldstop(current, to_self, CLD_STOPPED);
read_unlock(&tasklist_lock);
out:
schedule(); schedule();
/* /*
* Now we don't run again until continued. * Now we don't run again until continued.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册