Fix: ACCESS_ONCE() removed in kernel 4.15
[lttng-modules.git] / probes / lttng-tracepoint-event-impl.h
index ed7072cf19377973de61f38e12b0547a1bf13d36..61f1c2d8fb73b5bbc191e219077c6f498adff3be 100644 (file)
@@ -222,6 +222,24 @@ void __event_template_proto___##_name(void);
                .string = (_string),                                    \
        },
 
+/* Enumeration entry (automatic value; follows the rules of CTF) */
+#undef ctf_enum_auto
+#define ctf_enum_auto(_string)                                 \
+       {                                                               \
+               .start = {                                              \
+                       .signedness = -1,                               \
+                       .value = -1,                                    \
+               },                                                      \
+               .end = {                                                \
+                       .signedness = -1,                               \
+                       .value = -1,                                    \
+               },                                                      \
+               .string = (_string),                                    \
+               .options = {                                            \
+                       .is_auto = 1,                                   \
+               }                                                       \
+       },
+
 #undef TP_ENUM_VALUES
 #define TP_ENUM_VALUES(...)                                            \
        __VA_ARGS__
@@ -1112,7 +1130,7 @@ static void __event_probe__##_name(void *__data, _proto)                \
        struct lib_ring_buffer_ctx __ctx;                                     \
        ssize_t __event_len;                                                  \
        size_t __event_align;                                                 \
-       size_t __orig_dynamic_len_offset, __dynamic_len_idx;                  \
+       size_t __orig_dynamic_len_offset, __dynamic_len_idx __attribute__((unused)); \
        union {                                                               \
                size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)];   \
                char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
@@ -1125,14 +1143,14 @@ static void __event_probe__##_name(void *__data, _proto)                      \
                                                                              \
        if (!_TP_SESSION_CHECK(session, __session))                           \
                return;                                                       \
-       if (unlikely(!ACCESS_ONCE(__session->active)))                        \
+       if (unlikely(!READ_ONCE(__session->active)))                          \
                return;                                                       \
-       if (unlikely(!ACCESS_ONCE(__chan->enabled)))                          \
+       if (unlikely(!READ_ONCE(__chan->enabled)))                            \
                return;                                                       \
-       if (unlikely(!ACCESS_ONCE(__event->enabled)))                         \
+       if (unlikely(!READ_ONCE(__event->enabled)))                           \
                return;                                                       \
        __lpf = lttng_rcu_dereference(__session->pid_tracker);                \
-       if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid)))  \
+       if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->tgid))) \
                return;                                                       \
        __orig_dynamic_len_offset = this_cpu_ptr(&lttng_dynamic_len_stack)->offset; \
        __dynamic_len_idx = __orig_dynamic_len_offset;                        \
@@ -1186,7 +1204,7 @@ static void __event_probe__##_name(void *__data)                        \
        struct lib_ring_buffer_ctx __ctx;                                     \
        ssize_t __event_len;                                                  \
        size_t __event_align;                                                 \
-       size_t __orig_dynamic_len_offset, __dynamic_len_idx;                  \
+       size_t __orig_dynamic_len_offset, __dynamic_len_idx __attribute__((unused)); \
        union {                                                               \
                size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)];   \
                char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
@@ -1199,11 +1217,11 @@ static void __event_probe__##_name(void *__data)                              \
                                                                              \
        if (!_TP_SESSION_CHECK(session, __session))                           \
                return;                                                       \
-       if (unlikely(!ACCESS_ONCE(__session->active)))                        \
+       if (unlikely(!READ_ONCE(__session->active)))                          \
                return;                                                       \
-       if (unlikely(!ACCESS_ONCE(__chan->enabled)))                          \
+       if (unlikely(!READ_ONCE(__chan->enabled)))                            \
                return;                                                       \
-       if (unlikely(!ACCESS_ONCE(__event->enabled)))                         \
+       if (unlikely(!READ_ONCE(__event->enabled)))                           \
                return;                                                       \
        __lpf = lttng_rcu_dereference(__session->pid_tracker);                \
        if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid)))  \
This page took 0.024214 seconds and 4 git commands to generate.