From: Mathieu Desnoyers Date: Fri, 7 Sep 2018 15:28:51 +0000 (-0400) Subject: Fix: reset procname on fork in child process X-Git-Tag: v2.12.0-rc1~73 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=46228a6fe4d7503c23c5f74fe1bd26a27847f413;p=lttng-ust.git Fix: reset procname on fork in child process lttng-ust(3) documents: procname Thread name, as set by exec(3) or prctl(2). It is recommended that programs set their thread name with prctl(2) before hitting the first tracepoint for that thread. We can rightfully expect that this applies to the first thread created within a child process upon fork. Reset the procname cache in the child on fork. Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h index 8926785b..902f2b2f 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -677,6 +677,7 @@ int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx); int lttng_add_dyntest_to_ctx(struct lttng_ctx **ctx); void lttng_context_vtid_reset(void); void lttng_context_vpid_reset(void); +void lttng_context_procname_reset(void); #ifdef LTTNG_UST_HAVE_PERF_EVENT int lttng_add_perf_counter_to_ctx(uint32_t type, diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index d4add1c0..b6183315 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -2013,6 +2013,7 @@ void ust_after_fork_child(sigset_t *restore_sigset) return; lttng_context_vpid_reset(); lttng_context_vtid_reset(); + lttng_context_procname_reset(); DBG("process %d", getpid()); /* Release urcu mutexes */ rcu_bp_after_fork_child();