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.9.4~6 X-Git-Url: http://git.liburcu.org/?p=lttng-ust.git;a=commitdiff_plain;h=efe79472dcf3261468de7f5388ad596ba2325458;hp=bfcf776acfcd6fd2e1c4df1441811e0ff2a81755 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 0b2291b3..cf14b4f3 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -674,6 +674,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 b5c71da2..f1a8ff00 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -1972,6 +1972,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();