Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139693
b: refs/heads/master
c: 7f5d365
h: refs/heads/master
i:
  139691: bee8c6b
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Apr 3, 2009
1 parent e05a6cb commit 60f0e92
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b1442b055c154699a6a2c436f3352f71b6beede3
refs/heads/master: 7f5d3652d469cdf9eb2365dfea7ce3fb9e1409cc
22 changes: 17 additions & 5 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,33 +810,44 @@ static void ptrace_exit_finish(struct task_struct *parent,
}
}

static void reparent_thread(struct task_struct *p, struct task_struct *father)
/* Returns nonzero if the child should be released. */
static int reparent_thread(struct task_struct *p, struct task_struct *father)
{
int dead;

if (p->pdeath_signal)
/* We already hold the tasklist_lock here. */
group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);

list_move_tail(&p->sibling, &p->real_parent->children);

if (task_detached(p))
return;
return 0;
/* If this is a threaded reparent there is no need to
* notify anyone anything has happened.
*/
if (same_thread_group(p->real_parent, father))
return;
return 0;

/* We don't want people slaying init. */
p->exit_signal = SIGCHLD;

/* If we'd notified the old parent about this child's death,
* also notify the new parent.
*/
dead = 0;
if (!p->ptrace &&
p->exit_state == EXIT_ZOMBIE && thread_group_empty(p))
p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) {
do_notify_parent(p, p->exit_signal);
if (task_detached(p)) {
p->exit_state = EXIT_DEAD;
dead = 1;
}
}

kill_orphaned_pgrp(p, father);

return dead;
}

/*
Expand Down Expand Up @@ -896,7 +907,8 @@ static void forget_original_parent(struct task_struct *father)
BUG_ON(p->ptrace);
p->parent = p->real_parent;
}
reparent_thread(p, father);
if (reparent_thread(p, father))
list_add(&p->ptrace_entry, &ptrace_dead);;
}

write_unlock_irq(&tasklist_lock);
Expand Down

0 comments on commit 60f0e92

Please sign in to comment.