aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/tracehook.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/tracehook.h')
-rw-r--r--include/linux/tracehook.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 6dc428dd2f38..4c50e1b57349 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -471,4 +471,56 @@ static inline int tracehook_notify_jctl(int notify, int why)
471 return notify || (current->ptrace & PT_PTRACED); 471 return notify || (current->ptrace & PT_PTRACED);
472} 472}
473 473
474/**
475 * tracehook_notify_death - task is dead, ready to notify parent
476 * @task: @current task now exiting
477 * @death_cookie: value to pass to tracehook_report_death()
478 * @group_dead: nonzero if this was the last thread in the group to die
479 *
480 * Return the signal number to send our parent with do_notify_parent(), or
481 * zero to send no signal and leave a zombie, or -1 to self-reap right now.
482 *
483 * Called with write_lock_irq(&tasklist_lock) held.
484 */
485static inline int tracehook_notify_death(struct task_struct *task,
486 void **death_cookie, int group_dead)
487{
488 if (task->exit_signal == -1)
489 return task->ptrace ? SIGCHLD : -1;
490
491 /*
492 * If something other than our normal parent is ptracing us, then
493 * send it a SIGCHLD instead of honoring exit_signal. exit_signal
494 * only has special meaning to our real parent.
495 */
496 if (thread_group_empty(task) && !ptrace_reparented(task))
497 return task->exit_signal;
498
499 return task->ptrace ? SIGCHLD : 0;
500}
501
502/**
503 * tracehook_report_death - task is dead and ready to be reaped
504 * @task: @current task now exiting
505 * @signal: signal number sent to parent, or 0 or -1
506 * @death_cookie: value passed back from tracehook_notify_death()
507 * @group_dead: nonzero if this was the last thread in the group to die
508 *
509 * Thread has just become a zombie or is about to self-reap. If positive,
510 * @signal is the signal number just sent to the parent (usually %SIGCHLD).
511 * If @signal is -1, this thread will self-reap. If @signal is 0, this is
512 * a delayed_group_leader() zombie. The @death_cookie was passed back by
513 * tracehook_notify_death().
514 *
515 * If normal reaping is not inhibited, @task->exit_state might be changing
516 * in parallel.
517 *
518 * Called without locks.
519 */
520static inline void tracehook_report_death(struct task_struct *task,
521 int signal, void *death_cookie,
522 int group_dead)
523{
524}
525
474#endif /* <linux/tracehook.h> */ 526#endif /* <linux/tracehook.h> */