summaryrefslogtreecommitdiffstats
path: root/kernel/ptrace.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2009-04-02 16:58:11 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-02 19:04:59 -0700
commit95c3eb76dc07fd81289888ffc42948196b34b444 (patch)
treea656316699a090405387d0071bac2a03a7128f57 /kernel/ptrace.c
parent6588c1e3ff01418acafd938db0740e3477dc8cb7 (diff)
downloadlinux-95c3eb76dc07fd81289888ffc42948196b34b444.tar.gz
linux-95c3eb76dc07fd81289888ffc42948196b34b444.tar.bz2
linux-95c3eb76dc07fd81289888ffc42948196b34b444.zip
ptrace: kill __ptrace_detach(), fix ->exit_state check
Move the code from __ptrace_detach() to its single caller and kill this helper. Also, fix the ->exit_state check, we shouldn't wake up EXIT_DEAD tasks. Actually, I think task_is_stopped_or_traced() makes more sense, but this needs another patch. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Jerome Marchand <jmarchan@redhat.com> Cc: Roland McGrath <roland@redhat.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/ptrace.c')
-rw-r--r--kernel/ptrace.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index c9cf48b21f05..f62a568e84ec 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -235,16 +235,6 @@ out:
return retval;
}
-static inline void __ptrace_detach(struct task_struct *child, unsigned int data)
-{
- child->exit_code = data;
- /* .. re-parent .. */
- __ptrace_unlink(child);
- /* .. and wake it up. */
- if (child->exit_state != EXIT_ZOMBIE)
- wake_up_process(child);
-}
-
int ptrace_detach(struct task_struct *child, unsigned int data)
{
if (!valid_signal(data))
@@ -254,10 +244,16 @@ int ptrace_detach(struct task_struct *child, unsigned int data)
ptrace_disable(child);
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- write_lock_irq(&tasklist_lock);
/* protect against de_thread()->release_task() */
- if (child->ptrace)
- __ptrace_detach(child, data);
+ write_lock_irq(&tasklist_lock);
+ if (child->ptrace) {
+ child->exit_code = data;
+
+ __ptrace_unlink(child);
+
+ if (!child->exit_state)
+ wake_up_process(child);
+ }
write_unlock_irq(&tasklist_lock);
return 0;