]> granicus.if.org Git - strace/commit
strace.c: pre-allocate tcb on PTRACE_EVENT_{FORK,VFORK,CLONE}
authorEugene Syromyatnikov <evgsyr@gmail.com>
Thu, 21 Feb 2019 18:41:58 +0000 (19:41 +0100)
committerEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 27 Feb 2019 16:30:51 +0000 (17:30 +0100)
commitfb3530d1efdb2ed4faebae149adaa10437a1164b
tree6b1bcb7c2dec3d0036d4dc68aa43d5f9449e5b09
parentd3a9a5ad718635f9b97f7c99e797e633ffde3a65
strace.c: pre-allocate tcb on PTRACE_EVENT_{FORK,VFORK,CLONE}

In an attempt to resolve a race between the first stop of a new child
and the death of the last process.

* defs.h (TCB_PREALLOCATED): New constant.
* strace.c (pid2tcb): Add skip_preallocated parameter.
(maybe_allocate_tcb): Add tcp parameter, use it instead of allocating a
new tcp if it is not NULL.
(maybe_switch_tcbs): Pass true as a second argument to pid2tcb.
(next_event): Pass tcp to maybe_switch_tcbs if it is pre-allocated,
pre-allocate a tcb on PTRACE_EVENT_{FORK,VFORK,CLONE} if followfork is
enabled and we successfully retrieved the new pid.
defs.h
strace.c