[PATCH] Fix error when judging if process has children

Dmitry V. Levin ldv at altlinux.org
Thu Aug 12 22:51:10 UTC 2010


On Mon, Aug 09, 2010 at 06:32:44PM -0700, Roland McGrath wrote:
> > There is a possibility to count a process with both CLONE_THREAD and
> > CLONE_DETACHED flags set twice, but I'm doubt that such a combination of
> > CLONE_ flags is real, since CLONE_DETACHED is officially no-op in kernel
> > for a very long time.  Maybe it would be even better to drop this
> > nclone_detached completely from strace.
> 
> CLONE_DETACHED is indeed obsolete.  But when it existed, CLONE_THREAD and
> CLONE_DETACHED both being set was the norm.  I don't think CLONE_DETACHED
> really matters to strace's logic.  CLONE_THREAD is what indicates that
> exit_group syscalls and fatal signals will kill all sibling threads.
> But one should double-check how nclone_detached is being used in strace.

There are exactly two places in the strace code where nclone_detached is
checked.  First one is that calculation of got_kids in internal_wait()
where, if I got all right, nclone_detached should not be taken into
account since linux 2.6.2.  Second one is handle_group_exit() where
nclone_detached is used only if CLONE_THREAD is not in effect;
in that case, the use seems to have no consequences.

That is, I think that nclone_detached could be safely removed: it would be
a no-op change besides a fix for CLONE_THREAD|CLONE_DETACHED handling in
internal_wait().


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20100813/f48ecebe/attachment.bin>


More information about the Strace-devel mailing list