Subject: [PATCH] Modify exit.c to keep thread group leaders around until they have no children. From: Eric W. Biederman Date: 1130686664 -0700 --- kernel/exit.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) 31daa68a385b5deca7a914a79f812753e4a1284e diff --git a/kernel/exit.c b/kernel/exit.c index bfee5fd..10570c7 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -626,7 +626,6 @@ static inline void forget_original_paren } } while (reaper->exit_state); - /* * There are only two places where our children can be: * @@ -749,8 +748,19 @@ static void exit_notify(struct task_stru * else in the pspace. */ if (pspace_leader(tsk)) { + DECLARE_WAITQUEUE(wait, current); tsk->sighand->action[SIGCHLD-1].sa.sa_handler = SIG_IGN; __kill_pspace_info(SIGKILL, (void *)1, tsk->pspace); + /* FIXME how does this work for signal/thread groups? */ + add_wait_queue(&tsk->signal->wait_chldexit, &wait); + while(!list_empty(&tsk->children)) { + write_unlock_irq(&tasklist_lock); + current->state = TASK_INTERRUPTIBLE; + schedule(); + write_lock_irq(&tasklist_lock); + } + current->state = TASK_RUNNING; + remove_wait_queue(&tsk->signal->wait_chldexit, &wait); } /* Let father know we died -- 1.0.GIT