Fix: race between lttng-ust getenv() and application setenv()
[lttng-ust.git] / liblttng-ust-ctl / ustctl.c
index 0165786c256b18203f49e9951132ead745ad638e..4067758254438c45e2db0363ba55ee8d5d2f08a0 100644 (file)
@@ -18,6 +18,7 @@
 
 #define _GNU_SOURCE
 #include <string.h>
+#include <lttng/ust-config.h>
 #include <lttng/ust-ctl.h>
 #include <lttng/ust-abi.h>
 #include <lttng/ust-events.h>
@@ -1742,7 +1743,7 @@ int ustctl_get_instance_id(struct ustctl_consumer_stream *stream,
        return client_cb->instance_id(buf, handle, id);
 }
 
-#if defined(__x86_64__) || defined(__i386__)
+#ifdef LTTNG_UST_HAVE_PERF_EVENT
 
 int ustctl_has_perf_counters(void)
 {
@@ -2183,10 +2184,28 @@ int ustctl_reply_register_channel(int sock,
        return 0;
 }
 
+/* Regenerate the statedump. */
+int ustctl_regenerate_statedump(int sock, int handle)
+{
+       struct ustcomm_ust_msg lum;
+       struct ustcomm_ust_reply lur;
+       int ret;
+
+       memset(&lum, 0, sizeof(lum));
+       lum.handle = handle;
+       lum.cmd = LTTNG_UST_SESSION_STATEDUMP;
+       ret = ustcomm_send_app_cmd(sock, &lum, &lur);
+       if (ret)
+               return ret;
+       DBG("Regenerated statedump for handle %u", handle);
+       return 0;
+}
+
 static __attribute__((constructor))
 void ustctl_init(void)
 {
        init_usterr();
+       lttng_ust_getenv_init();        /* Needs init_usterr() to be completed. */
        lttng_ust_clock_init();
        lttng_ring_buffer_metadata_client_init();
        lttng_ring_buffer_client_overwrite_init();
This page took 0.023877 seconds and 4 git commands to generate.