Messages in this thread | | | Date | Thu, 24 Feb 2011 16:32:21 +0100 | From | Oleg Nesterov <> | Subject | Re: [path][rfc] add PR_DETACH prctl command |
| |
On 02/24, Stas Sergeev wrote: > > I am currently rewriting the patch to solve this all. > What I am trying to do now, is to reparent directly in prctl(), > but delay the list_move_tail(&p->sibling, &p->real_parent->children); > to the wait() call.
Ooh... good luck ;) but I expect this won't be simple. In fact, I do not understand how it is possible to do this correctly.
>> The problem is that ptrace uses this ->exit_code member as well. >> Suppose that the (ptraced) task calls PR_DETACH and, say, recieves >> a signal after that. See ptrace_signal(). > Also do_signal_stop() seems to alter it.
Yes. It is not immediately obvious but this is in fact for ptrace. Even if this thread is not traced, the tracer can attach later.
> Do you mean right now it can't happen that multiple events > alter the exit_code, and the parent notices only the last one?
Yes.
> In this case I need to add a separate variable.
I'd suggest you to always report 0 as the exit status. Much simpler. Then you can do another patch if you really want to report arg2.
Oleg.
| |