Move include/ust/ to include/lttng/
[lttng-ust.git] / libust / lttng-context-vtid.c
index fd1e320078a1e949aab91df298dc326a21aa27fc..6f7e078d22d2910072748adfd0ee59b8c9a695b4 100644 (file)
@@ -9,9 +9,9 @@
 
 #include <sys/types.h>
 #include <unistd.h>
-#include <ust/lttng-events.h>
-#include <ust/lttng-tracer.h>
-#include <ust/ringbuffer-config.h>
+#include <lttng/ust-events.h>
+#include <lttng/ust-tracer.h>
+#include <lttng/ringbuffer-config.h>
 
 #ifdef __linux__
 #include <syscall.h>
@@ -38,6 +38,16 @@ static inline pid_t gettid(void)
  */
 static __thread pid_t cached_vtid;
 
+/*
+ * Upon fork or clone, the TID assigned to our thread is not the same as
+ * we kept in cache. Luckily, we are the only thread surviving in the
+ * child process, so we can simply clear our cached version.
+ */
+void lttng_context_vtid_reset(void)
+{
+       cached_vtid = 0;
+}
+
 static
 size_t vtid_get_size(size_t offset)
 {
@@ -50,10 +60,10 @@ size_t vtid_get_size(size_t offset)
 
 static
 void vtid_record(struct lttng_ctx_field *field,
-                struct lib_ring_buffer_ctx *ctx,
+                struct lttng_ust_lib_ring_buffer_ctx *ctx,
                 struct ltt_channel *chan)
 {
-       if (unlikely(!cached_vtid))
+       if (caa_unlikely(!cached_vtid))
                cached_vtid = gettid();
        lib_ring_buffer_align_ctx(ctx, lttng_alignof(cached_vtid));
        chan->ops->event_write(ctx, &cached_vtid, sizeof(cached_vtid));
This page took 0.024543 seconds and 4 git commands to generate.