Fix: reset procname on fork in child process
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 7 Sep 2018 15:28:51 +0000 (11:28 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 7 Sep 2018 17:15:22 +0000 (13:15 -0400)
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 <mathieu.desnoyers@efficios.com>
include/lttng/ust-events.h
liblttng-ust/lttng-ust-comm.c

index 8926785b61a8a8880ac8b75abd66cec9e32a3037..902f2b2f24826ffdcff90b25afba079f6a1030aa 100644 (file)
@@ -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,
index d4add1c07ec9555aa0a35009c7a93a54749c34a7..b61833155425988d261e9e584247e3b76ebf9c90 100644 (file)
@@ -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();
This page took 0.025812 seconds and 4 git commands to generate.