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:19:11 +0000 (13:19 -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 caf7e63a30642024cd6a2bb5a9638afe21c9b4d7..fb1df1eb56b75d385683d4de92a71fa52090347e 100644 (file)
@@ -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,
index d98fae402d28d9d2504aee517f200291777c9cd4..bd4d7152db4557a624ce99c37521e5918a5780ad 100644 (file)
@@ -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();
This page took 0.026151 seconds and 4 git commands to generate.