From 46228a6fe4d7503c23c5f74fe1bd26a27847f413 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 7 Sep 2018 11:28:51 -0400 Subject: [PATCH] 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 --- include/lttng/ust-events.h | 1 + liblttng-ust/lttng-ust-comm.c | 1 + 2 files changed, 2 insertions(+) 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(); -- 2.34.1