diff options
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index da28745f7c38..6cdf60712bd2 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -885,7 +885,8 @@ static void forget_original_parent(struct task_struct *father) | |||
885 | */ | 885 | */ |
886 | static void exit_notify(struct task_struct *tsk, int group_dead) | 886 | static void exit_notify(struct task_struct *tsk, int group_dead) |
887 | { | 887 | { |
888 | int state; | 888 | int signal; |
889 | void *cookie; | ||
889 | 890 | ||
890 | /* | 891 | /* |
891 | * This does two things: | 892 | * This does two things: |
@@ -922,22 +923,11 @@ static void exit_notify(struct task_struct *tsk, int group_dead) | |||
922 | !capable(CAP_KILL)) | 923 | !capable(CAP_KILL)) |
923 | tsk->exit_signal = SIGCHLD; | 924 | tsk->exit_signal = SIGCHLD; |
924 | 925 | ||
925 | /* If something other than our normal parent is ptracing us, then | 926 | signal = tracehook_notify_death(tsk, &cookie, group_dead); |
926 | * send it a SIGCHLD instead of honoring exit_signal. exit_signal | 927 | if (signal > 0) |
927 | * only has special meaning to our real parent. | 928 | signal = do_notify_parent(tsk, signal); |
928 | */ | ||
929 | if (!task_detached(tsk) && thread_group_empty(tsk)) { | ||
930 | int signal = ptrace_reparented(tsk) ? | ||
931 | SIGCHLD : tsk->exit_signal; | ||
932 | do_notify_parent(tsk, signal); | ||
933 | } else if (tsk->ptrace) { | ||
934 | do_notify_parent(tsk, SIGCHLD); | ||
935 | } | ||
936 | 929 | ||
937 | state = EXIT_ZOMBIE; | 930 | tsk->exit_state = signal < 0 ? EXIT_DEAD : EXIT_ZOMBIE; |
938 | if (task_detached(tsk) && likely(!tsk->ptrace)) | ||
939 | state = EXIT_DEAD; | ||
940 | tsk->exit_state = state; | ||
941 | 931 | ||
942 | /* mt-exec, de_thread() is waiting for us */ | 932 | /* mt-exec, de_thread() is waiting for us */ |
943 | if (thread_group_leader(tsk) && | 933 | if (thread_group_leader(tsk) && |
@@ -947,8 +937,10 @@ static void exit_notify(struct task_struct *tsk, int group_dead) | |||
947 | 937 | ||
948 | write_unlock_irq(&tasklist_lock); | 938 | write_unlock_irq(&tasklist_lock); |
949 | 939 | ||
940 | tracehook_report_death(tsk, signal, cookie, group_dead); | ||
941 | |||
950 | /* If the process is dead, release it - nobody will wait for it */ | 942 | /* If the process is dead, release it - nobody will wait for it */ |
951 | if (state == EXIT_DEAD) | 943 | if (signal < 0) |
952 | release_task(tsk); | 944 | release_task(tsk); |
953 | } | 945 | } |
954 | 946 | ||