Implement tracepoint wildcard support
[lttng-modules.git] / probes / lttng-events.h
index 22cabbaa50a996b5acc5733e76b2d4ea97478254..5fc4d9f30361168d7fb08d0af1cc20966eca6845 100644 (file)
@@ -421,8 +421,12 @@ static const struct lttng_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
 
 /* non-const because list head will be modified when registered. */
 static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
+       .provider = __stringify(TRACE_SYSTEM),
        .event_desc = TP_ID(__event_desc___, TRACE_SYSTEM),
        .nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)),
+       .head = { NULL, NULL },
+       .lazy_init_head = { NULL, NULL },
+       .lazy = 0,
 };
 
 #undef TP_ID1
@@ -837,6 +841,7 @@ static void __event_probe__##_name(void *__data, _proto)                  \
        struct probe_local_vars { _locvar };                                  \
        struct lttng_event *__event = __data;                                 \
        struct lttng_channel *__chan = __event->chan;                         \
+       struct lttng_session *__session = __chan->session;                    \
        struct lib_ring_buffer_ctx __ctx;                                     \
        size_t __event_len, __event_align;                                    \
        size_t __dynamic_len_idx __attribute__((unused)) = 0;                 \
@@ -846,15 +851,19 @@ static void __event_probe__##_name(void *__data, _proto)                \
        struct probe_local_vars __tp_locvar;                                  \
        struct probe_local_vars *tp_locvar __attribute__((unused)) =          \
                        &__tp_locvar;                                         \
+       struct lttng_pid_tracker *__lpf;                                      \
                                                                              \
-       if (!_TP_SESSION_CHECK(session, __chan->session))                     \
+       if (!_TP_SESSION_CHECK(session, __session))                           \
                return;                                                       \
-       if (unlikely(!ACCESS_ONCE(__chan->session->active)))                  \
+       if (unlikely(!ACCESS_ONCE(__session->active)))                        \
                return;                                                       \
        if (unlikely(!ACCESS_ONCE(__chan->enabled)))                          \
                return;                                                       \
        if (unlikely(!ACCESS_ONCE(__event->enabled)))                         \
                return;                                                       \
+       __lpf = rcu_dereference(__session->pid_tracker);                      \
+       if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid)))  \
+               return;                                                       \
        _code                                                                 \
        __event_len = __event_get_size__##_name(__dynamic_len, tp_locvar,     \
                                _args);                                       \
@@ -879,6 +888,7 @@ static void __event_probe__##_name(void *__data)                          \
        struct probe_local_vars { _locvar };                                  \
        struct lttng_event *__event = __data;                                 \
        struct lttng_channel *__chan = __event->chan;                         \
+       struct lttng_session *__session = __chan->session;                    \
        struct lib_ring_buffer_ctx __ctx;                                     \
        size_t __event_len, __event_align;                                    \
        size_t __dynamic_len_idx __attribute__((unused)) = 0;                 \
@@ -888,15 +898,19 @@ static void __event_probe__##_name(void *__data)                        \
        struct probe_local_vars __tp_locvar;                                  \
        struct probe_local_vars *tp_locvar __attribute__((unused)) =          \
                        &__tp_locvar;                                         \
+       struct lttng_pid_tracker *__lpf;                                      \
                                                                              \
-       if (!_TP_SESSION_CHECK(session, __chan->session))                     \
+       if (!_TP_SESSION_CHECK(session, __session))                           \
                return;                                                       \
-       if (unlikely(!ACCESS_ONCE(__chan->session->active)))                  \
+       if (unlikely(!ACCESS_ONCE(__session->active)))                        \
                return;                                                       \
        if (unlikely(!ACCESS_ONCE(__chan->enabled)))                          \
                return;                                                       \
        if (unlikely(!ACCESS_ONCE(__event->enabled)))                         \
                return;                                                       \
+       __lpf = rcu_dereference(__session->pid_tracker);                      \
+       if (__lpf && likely(!lttng_pid_tracker_lookup(__lpf, current->pid)))  \
+               return;                                                       \
        _code                                                                 \
        __event_len = __event_get_size__##_name(__dynamic_len, tp_locvar);    \
        __event_align = __event_get_align__##_name(tp_locvar);                \
This page took 0.041734 seconds and 4 git commands to generate.