Re: [RFC][PATCH 0/3] fork: Add the ability to create tasks withgiven pids

From: Oleg Nesterov
Date: Sun Nov 27 2011 - 12:39:36 EST


On 11/27, Konstantin Khlebnikov wrote:
>
> We can add flag to sys_wait4(), and stash pid in wait_task_zombie(), right before release_task()
> code will looks something like this:
>
> - if (p != NULL)
> + if (p != NULL) {
> + if ((wo->wo_flags & WCATCHPID) && !current->pid_stash) {
> + struct pid *pid = task_pid(p);
> +
> + pid->flags |= PID_STASHED;
> + current->pid_stash = get_pid(pid);
> + }
> release_task(p);
> + }
>
> And next fork() creates child with the same pid.
> So, struct pid will work like boomerang =)

Like PR_RESERVE_PID, this can only help if the tracee (or whatever)
is single-threaded and it is the natural child.

Personally I do not think such a limited interface makes sense.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/