Implement PID tracking
[lttng-modules.git] / probes / lttng-events.h
index 22cabbaa50a996b5acc5733e76b2d4ea97478254..b885fa1831e0fdc5704fbaa1e593c9212ea42154 100644 (file)
@@ -837,6 +837,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 +847,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 +884,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 +894,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.024754 seconds and 4 git commands to generate.