Re: wait() and strace -f

Kurt Roeckx (Q@ping.be)
Tue, 18 Dec 2001 21:18:39 +0100


On Tue, Dec 18, 2001 at 04:59:58PM +0900, OGAWA Hirofumi wrote:
> Kurt Roeckx <Q@ping.be> writes:
>
> > I think it's related to strace being the "real" parent of the
> > child. But that doesn't really explain why I need 2 childs.
>
> Probably, it's feature (or bug) of strace. I'm seems, if strace has
> child, trace of a child is started before wait() of parent. Then,
> exit() of child continue wait() of parent.

If I understand what you're saying, sleep(1) in child1, and
sleep(2) in the parent should fix the problem, which it doesn't.

And it still doesn't explain why it only happens with 2 childs.

Maybe I should have mentioned this before: the wait will clean up
the first child at the time the second child dies, or atleast
that's what wait() returns.

> > if (!fork())
> > {
> > /* Child 1. */
> sleep(2);
> > return 0;
> > }
>
> The above change is continued the parent after 2 seconds.

I know that too, as I said, only when child 1 dies before the
parent calls wait().

Kurt

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