Re: Patch: CLONE_PPID (was kernel thread support - LWP's)

Jeremy Fitzhardinge (jeremy@goop.org)
Tue, 20 Jul 1999 18:10:33 -0700 (PDT)


On 20-Jul-99 Tim Hockin wrote:
>> if (fork())
>> execl("unsuspecting program");
>> else
>> {
>> /* do things, exit when it's least expected */
>> }
>
>
> how is that having a child it doesn't know about? exec replaces the
> current process, not forks another. And even if it did fork, the third
> task would be a child of the second, not the first.

I don't follow you. The fork() in the example above creates a new child
process. The exec starts a new program in the parent process, which has a
pre-existing child. If the exec()ed program does wait()s, it will see the exit
status for a child process it didn't know it had. There can be any number of
forks in the parent process before the exec, so there can be any number of
unexpected children.

The only difference between this scenario and CLONE_PPID is that the former has
to pre-create all the unexpected children, whereas CLONE_PPID create them after
the exec().

J

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