Ejemplo n.º 1
0
void silent_exit(void) {
    struct task_struct *parent;

    write_lock_irq(&tasklist_lock);
    parent = current->parent;
    if (BPROC_ISMASQ(current)) {
	/* unmasq includes a re-parent step */
	masq_remove_proc(current, 0);
    } else {
	/* Reparent self to init */
	current->exit_signal = SIGCHLD;
	set_parents(current, child_reaper, child_reaper);
    }
    __wake_up_parent(current,parent);
    write_unlock_irq(&tasklist_lock);
    do_exit(0);
}
Ejemplo n.º 2
0
/*
 * Called with tasklist_lock held for writing.
 * Unlink a traced task, and clean it up if it was a traced zombie.
 * Return true if it needs to be reaped with release_task().
 * (We can't call release_task() here because we already hold tasklist_lock.)
 *
 * If it's a zombie, our attachedness prevented normal parent notification
 * or self-reaping.  Do notification now if it would have happened earlier.
 * If it should reap itself, return true.
 *
 * If it's our own child, there is no notification to do. But if our normal
 * children self-reap, then this child was prevented by ptrace and we must
 * reap it now, in that case we must also wake up sub-threads sleeping in
 * do_wait().
 */
static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p)
{
	__ptrace_unlink(p);

	if (p->exit_state == EXIT_ZOMBIE) {
		if (!task_detached(p) && thread_group_empty(p)) {
			if (!same_thread_group(p->real_parent, tracer))
				do_notify_parent(p, p->exit_signal);
			else if (ignoring_children(tracer->sighand)) {
				__wake_up_parent(p, tracer);
				p->exit_signal = -1;
			}
		}
		if (task_detached(p)) {
			/* Mark it as in the process of being reaped. */
			p->exit_state = EXIT_DEAD;
			return true;
		}
	}

	return false;
}