Skip to content

Commit

Permalink
tracehook: vfork-done
Browse files Browse the repository at this point in the history
This moves the PTRACE_EVENT_VFORK_DONE tracing into a tracehook.h inline,
tracehook_report_vfork_done().  The change has no effect, just clean-up.

Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Roland McGrath authored and Linus Torvalds committed Jul 26, 2008
1 parent 09a0539 commit daded34
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
18 changes: 18 additions & 0 deletions include/linux/tracehook.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,22 @@ static inline void tracehook_report_clone_complete(int trace,
ptrace_event(0, trace, pid);
}

/**
* tracehook_report_vfork_done - vfork parent's child has exited or exec'd
* @child: child task, already running
* @pid: new child's PID in the parent's namespace
*
* Called after a %CLONE_VFORK parent has waited for the child to complete.
* The clone/vfork system call will return immediately after this.
* The @child pointer may be invalid if a self-reaping child died and
* tracehook_report_clone() took no action to prevent it from self-reaping.
*
* Called with no locks held.
*/
static inline void tracehook_report_vfork_done(struct task_struct *child,
pid_t pid)
{
ptrace_event(PT_TRACE_VFORK_DONE, PTRACE_EVENT_VFORK_DONE, pid);
}

#endif /* <linux/tracehook.h> */
5 changes: 1 addition & 4 deletions kernel/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,10 +1414,7 @@ long do_fork(unsigned long clone_flags,
freezer_do_not_count();
wait_for_completion(&vfork);
freezer_count();
if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) {
current->ptrace_message = nr;
ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP);
}
tracehook_report_vfork_done(p, nr);
}
} else {
nr = PTR_ERR(p);
Expand Down

0 comments on commit daded34

Please sign in to comment.