From 5fe0ab0b1d4d0b91f0fefcd38d2afaace9a0f712 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 caf7e63a..fb1df1eb 100644 --- a/include/lttng/ust-events.h +++ b/include/lttng/ust-events.h @@ -675,6 +675,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 d98fae40..bd4d7152 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -1988,6 +1988,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