| Kernel v2.4.13-ac8 /kernel/exit.c |
|---|
 2.4.13-ac8
 kernel
 exit.c
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla/kernel/exit.c linux.ac/kernel/exit.c
--- linux.vanilla/kernel/exit.c Thu Oct 25 16:26:39 2001
+++ linux.ac/kernel/exit.c Sun Oct 21 18:38:23 2001
@@ -39,6 +39,7 @@
break;
task_unlock(p);
do {
+ cpu_relax();
barrier();
} while (p->has_cpu);
}
@@ -149,21 +150,34 @@
}
/*
- * When we die, we re-parent all our children to
+ * When we die, we re-parent all our children.
+ * Try to give them to another thread in our process
+ * group, and if no such member exists, give it to
* the global child reaper process (ie "init")
*/
static inline void forget_original_parent(struct task_struct * father)
{
- struct task_struct * p;
+ struct task_struct * p, *reaper;
read_lock(&tasklist_lock);
+ /* Next in our thread group */
+ reaper = next_thread(father);
+ if (reaper == father)
+ reaper = child_reaper;
+
for_each_task(p) {
if (p->p_opptr == father) {
/* We dont want people slaying init */
p->exit_signal = SIGCHLD;
p->self_exec_id++;
- p->p_opptr = child_reaper;
+
+ /* Make sure we're not reparenting to ourselves */
+ if (p == reaper)
+ p->p_opptr = child_reaper;
+ else
+ p->p_opptr = reaper;
+
if (p->pdeath_signal) send_sig(p->pdeath_signal, p, 0);
}
}
|