RE: Children first in fork

David Schwartz
2001-04-19T12:07:45Z

> Hello all,
>
> I have read on lwn.net that the patch that makes children run first after
> a fork has been integrated in the latest pre-kernel.
>
> I am a little bit concerned by that, as I have begun to write a program
> that monitors process using ptrace. The difficulty is to ptrace-attach
> the child in a fork before it can do anything unmonitored. When the
> parent runs first, the return from the fork system called is trapped by
> the monitor program which has enough time to ptrace-attach the child. If
> the child runs first, it is not even remotely the case anymore.
>
> I understand that performance is more important that the possibility to
> ptrace across forks, but I still think that there should be a way to
> attach the children of a ptraced-process. Is there currently a way to
> achieve this in the kernel that I am not aware of ?

It seems to me that what you really want is a fork option to create the
child in a suspended state.

DS