Messages in this thread | | | Date | Sun, 27 Nov 2011 18:34:30 +0100 | From | Oleg Nesterov <> | Subject | Re: [RFC][PATCH 0/3] fork: Add the ability to create tasks with given pids |
| |
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.
| |