API refactoring: introduce probe context
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 22 Apr 2021 12:46:18 +0000 (08:46 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 22 Apr 2021 15:22:27 +0000 (11:22 -0400)
Introduce a "probe context" to allow passing the "ip" context from the
probe function to the get_value callback used by the bytecode
interpreter. This enables the "ip" context to be used from the filter
bytecode and from the capture bytecode.

Also fix signedness of the return type of the get_value context
callbacks for cases where the type is unsigned.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2cb40a9b3bb34c42392bb663368e5af360554dbb

38 files changed:
include/lttng/ust-events.h
include/lttng/ust-ringbuffer-context.h
include/lttng/ust-tracepoint-event.h
src/common/events.h
src/common/ust-context-provider.h
src/lib/lttng-ust-java-agent/jni/common/lttng_ust_context.c
src/lib/lttng-ust/context-provider-internal.h
src/lib/lttng-ust/event-notifier-notification.c
src/lib/lttng-ust/events.h
src/lib/lttng-ust/lttng-bytecode-interpreter.c
src/lib/lttng-ust/lttng-bytecode.h
src/lib/lttng-ust/lttng-context-cgroup-ns.c
src/lib/lttng-ust/lttng-context-cpu-id.c
src/lib/lttng-ust/lttng-context-ip.c
src/lib/lttng-ust/lttng-context-ipc-ns.c
src/lib/lttng-ust/lttng-context-mnt-ns.c
src/lib/lttng-ust/lttng-context-net-ns.c
src/lib/lttng-ust/lttng-context-perf-counters.c
src/lib/lttng-ust/lttng-context-pid-ns.c
src/lib/lttng-ust/lttng-context-procname.c
src/lib/lttng-ust/lttng-context-pthread-id.c
src/lib/lttng-ust/lttng-context-time-ns.c
src/lib/lttng-ust/lttng-context-user-ns.c
src/lib/lttng-ust/lttng-context-uts-ns.c
src/lib/lttng-ust/lttng-context-vegid.c
src/lib/lttng-ust/lttng-context-veuid.c
src/lib/lttng-ust/lttng-context-vgid.c
src/lib/lttng-ust/lttng-context-vpid.c
src/lib/lttng-ust/lttng-context-vsgid.c
src/lib/lttng-ust/lttng-context-vsuid.c
src/lib/lttng-ust/lttng-context-vtid.c
src/lib/lttng-ust/lttng-context-vuid.c
src/lib/lttng-ust/lttng-context.c
src/lib/lttng-ust/lttng-events.c
src/lib/lttng-ust/lttng-ring-buffer-client-template.h
src/lib/lttng-ust/lttng-tracer-core.h
src/lib/lttng-ust/ust-core.c
tests/compile/test-app-ctx/hello.c

index 5e94bafeb567789e827a1abfc6e35abe01dd38c7..cae9e71a55ef1cecbc2ebbc9b3e06222e6ddbb98 100644 (file)
@@ -300,6 +300,26 @@ struct lttng_ust_probe_desc {
 
 /* Data structures used by the tracer. */
 
+/*
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ *
+ * The probe_ctx is not const because it may be extended to add future
+ * fields which could be modified by callbacks.
+ */
+struct lttng_ust_probe_ctx {
+       uint32_t struct_size;                   /* Size of this structure. */
+
+       void *ip;                               /* caller ip address */
+
+       /* End of base ABI. Fields below should be used after checking struct_size. */
+};
+
 /*
  * lttng_event structure is referred to by the tracing fast path. It
  * must be kept small.
@@ -351,6 +371,7 @@ struct lttng_ust_event_common {
        int eval_filter;                                /* Need to evaluate filters */
        int (*run_filter)(const struct lttng_ust_event_common *event,
                const char *stack_data,
+               struct lttng_ust_probe_ctx *probe_ctx,
                void *filter_ctx);
 
        /* End of base ABI. Fields below should be used after checking struct_size. */
@@ -395,7 +416,6 @@ struct lttng_ust_event_recorder {
 struct lttng_ust_notification_ctx {
        uint32_t struct_size;           /* Size of this structure. */
        int eval_capture;               /* Capture evaluation available. */
-
        /* End of base ABI. Fields below should be used after checking struct_size. */
 };
 
@@ -424,6 +444,7 @@ struct lttng_ust_event_notifier {
        int eval_capture;                               /* Need to evaluate capture */
        void (*notification_send)(const struct lttng_ust_event_notifier *event_notifier,
                const char *stack_data,
+               struct lttng_ust_probe_ctx *probe_ctx,
                struct lttng_ust_notification_ctx *notif_ctx);
 
        /* End of base ABI. Fields below should be used after checking struct_size. */
index 133d802d1d29d029ff72b5b55afbec6986ef7b7b..70ec24409f610857b613522a2cd4051b24e570ba 100644 (file)
@@ -23,6 +23,7 @@ struct lttng_ust_ring_buffer;
 struct lttng_ust_ring_buffer_channel;
 struct lttng_ust_ring_buffer_ctx;
 struct lttng_ust_ring_buffer_ctx_private;
+struct lttng_ust_probe_ctx;
 
 /*
  * ring buffer context
@@ -44,7 +45,7 @@ struct lttng_ust_ring_buffer_ctx {
                                                 * alignment of the largest element
                                                 * in the payload
                                                 */
-       void *ip;                               /* caller ip address */
+       struct lttng_ust_probe_ctx *probe_ctx;  /* Probe context */
 
        /* Private ring buffer context, set by reserve callback. */
        struct lttng_ust_ring_buffer_ctx_private *priv;
@@ -63,18 +64,18 @@ struct lttng_ust_ring_buffer_ctx {
 static inline
 void lttng_ust_ring_buffer_ctx_init(struct lttng_ust_ring_buffer_ctx *ctx,
                                        void *client_priv, size_t data_size, int largest_align,
-                                       void *ip)
+                                       struct lttng_ust_probe_ctx *probe_ctx)
        lttng_ust_notrace;
 static inline
 void lttng_ust_ring_buffer_ctx_init(struct lttng_ust_ring_buffer_ctx *ctx,
                                        void *client_priv, size_t data_size, int largest_align,
-                                       void *ip)
+                                       struct lttng_ust_probe_ctx *probe_ctx)
 {
        ctx->struct_size = sizeof(struct lttng_ust_ring_buffer_ctx);
        ctx->client_priv = client_priv;
        ctx->data_size = data_size;
        ctx->largest_align = largest_align;
-       ctx->ip = ip;
+       ctx->probe_ctx = probe_ctx;
        ctx->priv = NULL;
 }
 
index 801ccda40a5ca354fffdfa8ef0e8a1e9d8bcb311..9678b83c934604ec975e30dade671882d13fa115 100644 (file)
@@ -880,16 +880,17 @@ size_t lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_PR
  * Perform UNION (||) of filter runtime list.
  */
 #undef LTTNG_UST__TRACEPOINT_EVENT_CLASS
-#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields)          \
+#define LTTNG_UST__TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields)   \
 static                                                                       \
-void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args))           \
+void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
        lttng_ust_notrace;                                                    \
 static                                                                       \
-void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args))           \
+void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PROTO(_args)) \
 {                                                                            \
        struct lttng_ust_event_common *__event = (struct lttng_ust_event_common *) __tp_data; \
        size_t __dynamic_len_idx = 0;                                         \
        const size_t __num_fields = LTTNG_UST__TP_ARRAY_SIZE(lttng_ust__event_fields___##_provider##___##_name) - 1; \
+       struct lttng_ust_probe_ctx __probe_ctx;                               \
        union {                                                               \
                size_t __dynamic_len[__num_fields];                           \
                char __interpreter_stack_data[2 * sizeof(unsigned long) * __num_fields]; \
@@ -906,7 +907,7 @@ void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PRO
                struct lttng_ust_channel_buffer *__chan = lttng_ust__event_recorder->chan; \
                struct lttng_ust_channel_common *__chan_common = __chan->parent; \
                                                                              \
-               if (!LTTNG_UST__TP_SESSION_CHECK(session, __chan_common->session))      \
+               if (!LTTNG_UST__TP_SESSION_CHECK(session, __chan_common->session)) \
                        return;                                               \
                if (caa_unlikely(!CMM_ACCESS_ONCE(__chan_common->session->active))) \
                        return;                                               \
@@ -919,29 +920,31 @@ void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PRO
        }                                                                     \
        if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled)))                 \
                return;                                                       \
-       if (caa_unlikely(!LTTNG_UST_TP_RCU_LINK_TEST()))                                      \
+       if (caa_unlikely(!LTTNG_UST_TP_RCU_LINK_TEST()))                      \
                return;                                                       \
-       if (caa_unlikely(CMM_ACCESS_ONCE(__event->eval_filter))) { \
+       __probe_ctx.struct_size = sizeof(struct lttng_ust_probe_ctx);         \
+       __probe_ctx.ip = LTTNG_UST__TP_IP_PARAM(LTTNG_UST_TP_IP_PARAM);       \
+       if (caa_unlikely(CMM_ACCESS_ONCE(__event->eval_filter))) {            \
                lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \
-                       LTTNG_UST__TP_ARGS_DATA_VAR(_args));                          \
+                       LTTNG_UST__TP_ARGS_DATA_VAR(_args));                  \
                __interpreter_stack_prepared = true;                          \
-               if (caa_likely(__event->run_filter(__event, \
-                               __stackvar.__interpreter_stack_data, NULL) != LTTNG_UST_EVENT_FILTER_ACCEPT)) \
+               if (caa_likely(__event->run_filter(__event,                   \
+                               __stackvar.__interpreter_stack_data, &__probe_ctx, NULL) != LTTNG_UST_EVENT_FILTER_ACCEPT)) \
                        return;                                               \
        }                                                                     \
        switch (__event->type) {                                              \
        case LTTNG_UST_EVENT_TYPE_RECORDER:                                   \
        {                                                                     \
-               size_t __event_len, lttng_ust__event_align;                           \
+               size_t __event_len, lttng_ust__event_align;                   \
                struct lttng_ust_event_recorder *lttng_ust__event_recorder = (struct lttng_ust_event_recorder *) __event->child; \
                struct lttng_ust_channel_buffer *__chan = lttng_ust__event_recorder->chan; \
-               struct lttng_ust_ring_buffer_ctx __ctx;               \
+               struct lttng_ust_ring_buffer_ctx __ctx;                       \
                                                                              \
                __event_len = lttng_ust__event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \
                         LTTNG_UST__TP_ARGS_DATA_VAR(_args));                         \
                lttng_ust__event_align = lttng_ust__event_get_align__##_provider##___##_name(LTTNG_UST__TP_ARGS_VAR(_args)); \
                lttng_ust_ring_buffer_ctx_init(&__ctx, lttng_ust__event_recorder, __event_len, lttng_ust__event_align, \
-                               LTTNG_UST__TP_IP_PARAM(LTTNG_UST_TP_IP_PARAM));       \
+                               &__probe_ctx);                                \
                __ret = __chan->ops->event_reserve(&__ctx);                   \
                if (__ret < 0)                                                \
                        return;                                               \
@@ -959,10 +962,11 @@ void lttng_ust__event_probe__##_provider##___##_name(LTTNG_UST__TP_ARGS_DATA_PRO
                                                                              \
                if (caa_unlikely(!__interpreter_stack_prepared && __notif_ctx.eval_capture)) \
                        lttng_ust__event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \
-                               LTTNG_UST__TP_ARGS_DATA_VAR(_args));                  \
+                               LTTNG_UST__TP_ARGS_DATA_VAR(_args));          \
                                                                              \
-               lttng_ust__event_notifier->notification_send(lttng_ust__event_notifier,       \
+               lttng_ust__event_notifier->notification_send(lttng_ust__event_notifier, \
                                __stackvar.__interpreter_stack_data,          \
+                               &__probe_ctx,                                 \
                                &__notif_ctx);                                \
                break;                                                        \
        }                                                                     \
index 5fdec87092074907492398d15c0eb03405158c1c..bba28cc27518da62f0b5c39ad5259863309aea6e 100644 (file)
@@ -305,6 +305,7 @@ struct lttng_ust_bytecode_runtime {
        int link_failed;
        int (*interpreter_func)(struct lttng_ust_bytecode_runtime *bytecode_runtime,
                        const char *interpreter_stack_data,
+                       struct lttng_ust_probe_ctx *probe_ctx,
                        void *ctx);
        struct cds_list_head node;              /* list of bytecode runtime in event */
        /*
@@ -441,10 +442,13 @@ struct lttng_ust_registered_probe {
 
 struct lttng_ust_ctx_field {
        const struct lttng_ust_event_field *event_field;
-       size_t (*get_size)(void *priv, size_t offset);
-       void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx,
-                      struct lttng_ust_channel_buffer *chan);
-       void (*get_value)(void *priv, struct lttng_ust_ctx_value *value);
+       size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       size_t offset);
+       void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ring_buffer_ctx *ctx,
+                       struct lttng_ust_channel_buffer *chan);
+       void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ctx_value *value);
        void (*destroy)(void *priv);
        void *priv;
 };
index c9362fb1fc46eca469d3579094e4b5f24cc06137..d8c9a138c7d8f05e48a8b7dedc3fde565f2e4fa4 100644 (file)
@@ -17,6 +17,7 @@
 #include "common/dynamic-type.h"
 
 struct lttng_ust_registered_context_provider;
+struct lttng_ust_probe_ctx;
 
 /*
  * Context value
@@ -54,10 +55,13 @@ struct lttng_ust_context_provider {
        uint32_t struct_size;
 
        const char *name;
-       size_t (*get_size)(void *priv, size_t offset);
-       void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx,
-                      struct lttng_ust_channel_buffer *chan);
-       void (*get_value)(void *priv, struct lttng_ust_ctx_value *value);
+       size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       size_t offset);
+       void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ring_buffer_ctx *ctx,
+                       struct lttng_ust_channel_buffer *chan);
+       void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ctx_value *value);
        void *priv;
 
        /* End of base ABI. Fields below should be used after checking struct_size. */
index 6f6d0e0696b354fcfe05a0154b5142ef329a3fec..4f4fa9b77d4cd671c85ef759eb713b103c675667 100644 (file)
@@ -79,7 +79,8 @@ static struct lttng_ust_jni_ctx_entry *lookup_ctx_by_name(const char *ctx_name)
        return NULL;
 }
 
-static size_t get_size_cb(void *priv, size_t offset)
+static size_t get_size_cb(void *priv, struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               size_t offset)
 {
        struct lttng_ust_jni_ctx_entry *jctx;
        size_t size = 0;
@@ -142,6 +143,7 @@ static size_t get_size_cb(void *priv, size_t offset)
 }
 
 static void record_cb(void *priv,
+                struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                 struct lttng_ust_ring_buffer_ctx *ctx,
                 struct lttng_ust_channel_buffer *lttng_chan_buf)
 {
@@ -247,7 +249,8 @@ static void record_cb(void *priv,
        }
 }
 
-static void get_value_cb(void *priv, struct lttng_ust_ctx_value *value)
+static void get_value_cb(void *priv, struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ctx_value *value)
 {
        struct lttng_ust_jni_provider *jni_provider = (struct lttng_ust_jni_provider *) priv;
        struct lttng_ust_jni_ctx_entry *jctx;
index f9ee9b29f012d1c29002c80bcc82de282f149a01..92de7dffd82f39d48543f4e36ac1d628dab66210 100644 (file)
 #include <lttng/ust-events.h>
 
 void lttng_ust_context_set_event_notifier_group_provider(const char *name,
-               size_t (*get_size)(void *priv, size_t offset),
-               void (*record)(void *priv,
+               size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       size_t offset),
+               void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
                        struct lttng_ust_ring_buffer_ctx *ctx,
                        struct lttng_ust_channel_buffer *chan),
-               void (*get_value)(void *priv,
+               void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
                        struct lttng_ust_ctx_value *value),
                void *priv)
        __attribute__((visibility("hidden")));
index fe228c5d0553ed071c1f152f8eb299c8a7ed9f18..d4849421f8d421439d2b1a677fe989e67f9092e5 100644 (file)
@@ -362,6 +362,7 @@ void notification_send(struct lttng_event_notifier_notification *notif,
 void lttng_event_notifier_notification_send(
                const struct lttng_ust_event_notifier *event_notifier,
                const char *stack_data,
+               struct lttng_ust_probe_ctx *probe_ctx,
                struct lttng_ust_notification_ctx *notif_ctx)
 {
        /*
@@ -386,7 +387,7 @@ void lttng_event_notifier_notification_send(
                        struct lttng_interpreter_output output;
 
                        if (capture_bc_runtime->interpreter_func(capture_bc_runtime,
-                                       stack_data, &output) == LTTNG_UST_BYTECODE_INTERPRETER_OK)
+                                       stack_data, probe_ctx, &output) == LTTNG_UST_BYTECODE_INTERPRETER_OK)
                                notification_append_capture(&notif, &output);
                        else
                                notification_append_empty_capture(&notif);
index bf76d7a319344e06c945c7df945cefbfc80f0bb4..d928a0e16589a5a008d8751f9ac345e1f35917dd 100644 (file)
@@ -302,6 +302,7 @@ void lttng_ust_free_channel_common(struct lttng_ust_channel_common *chan)
 
 int lttng_ust_interpret_event_filter(const struct lttng_ust_event_common *event,
                const char *interpreter_stack_data,
+               struct lttng_ust_probe_ctx *probe_ctx,
                void *filter_ctx)
        __attribute__((visibility("hidden")));
 
@@ -321,18 +322,24 @@ int lttng_ust_add_app_context_to_ctx_rcu(const char *name, struct lttng_ust_ctx
 
 int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx,
                const char *name,
-               size_t (*get_size)(void *priv, size_t offset),
-               void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx,
+               size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       size_t offset),
+               void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ring_buffer_ctx *ctx,
                        struct lttng_ust_channel_buffer *chan),
-               void (*get_value)(void *priv, struct lttng_ust_ctx_value *value),
+               void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ctx_value *value),
                void *priv)
        __attribute__((visibility("hidden")));
 
 void lttng_ust_context_set_session_provider(const char *name,
-               size_t (*get_size)(void *priv, size_t offset),
-               void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx,
+               size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       size_t offset),
+               void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ring_buffer_ctx *ctx,
                        struct lttng_ust_channel_buffer *chan),
-               void (*get_value)(void *priv, struct lttng_ust_ctx_value *value),
+               void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ctx_value *value),
                void *priv)
        __attribute__((visibility("hidden")));
 
index 0afa8ae69237703c071e5cedf7f13ae70b4f66a3..d677fb990eaa87c2345770def788bd7eca46bc96 100644 (file)
@@ -153,6 +153,7 @@ int stack_strcmp(struct estack *stack, int top, const char *cmp_type __attribute
 int lttng_bytecode_interpret_error(
                struct lttng_ust_bytecode_runtime *bytecode_runtime __attribute__((unused)),
                const char *stack_data __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                void *ctx __attribute__((unused)))
 {
        return LTTNG_UST_BYTECODE_INTERPRETER_ERROR;
@@ -215,6 +216,7 @@ LABEL_##name
                (reg_type == REG_U64 || reg_type == REG_S64)
 
 static int context_get_index(struct lttng_ust_ctx *ctx,
+               struct lttng_ust_probe_ctx *probe_ctx,
                struct load_ptr *ptr,
                uint32_t idx)
 {
@@ -230,7 +232,7 @@ static int context_get_index(struct lttng_ust_ctx *ctx,
 
        switch (field->type->type) {
        case lttng_ust_type_integer:
-               ctx_field->get_value(ctx_field->priv, &v);
+               ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                if (lttng_ust_get_type_integer(field->type)->signedness) {
                        ptr->object_type = OBJECT_TYPE_S64;
                        ptr->u.s64 = v.u.s64;
@@ -246,7 +248,7 @@ static int context_get_index(struct lttng_ust_ctx *ctx,
                const struct lttng_ust_type_integer *itype;
 
                itype = lttng_ust_get_type_integer(lttng_ust_get_type_enum(field->type)->container_type);
-               ctx_field->get_value(ctx_field->priv, &v);
+               ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                if (itype->signedness) {
                        ptr->object_type = OBJECT_TYPE_SIGNED_ENUM;
                        ptr->u.s64 = v.u.s64;
@@ -268,7 +270,7 @@ static int context_get_index(struct lttng_ust_ctx *ctx,
                        return -EINVAL;
                }
                ptr->object_type = OBJECT_TYPE_STRING;
-               ctx_field->get_value(ctx_field->priv, &v);
+               ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                ptr->ptr = v.u.str;
                break;
        case lttng_ust_type_sequence:
@@ -281,22 +283,22 @@ static int context_get_index(struct lttng_ust_ctx *ctx,
                        return -EINVAL;
                }
                ptr->object_type = OBJECT_TYPE_STRING;
-               ctx_field->get_value(ctx_field->priv, &v);
+               ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                ptr->ptr = v.u.str;
                break;
        case lttng_ust_type_string:
                ptr->object_type = OBJECT_TYPE_STRING;
-               ctx_field->get_value(ctx_field->priv, &v);
+               ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                ptr->ptr = v.u.str;
                break;
        case lttng_ust_type_float:
                ptr->object_type = OBJECT_TYPE_DOUBLE;
-               ctx_field->get_value(ctx_field->priv, &v);
+               ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                ptr->u.d = v.u.d;
                ptr->ptr = &ptr->u.d;
                break;
        case lttng_ust_type_dynamic:
-               ctx_field->get_value(ctx_field->priv, &v);
+               ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                switch (v.sel) {
                case LTTNG_UST_DYNAMIC_TYPE_NONE:
                        return -EINVAL;
@@ -343,6 +345,7 @@ static int context_get_index(struct lttng_ust_ctx *ctx,
 }
 
 static int dynamic_get_index(struct lttng_ust_ctx *ctx,
+               struct lttng_ust_probe_ctx *probe_ctx,
                struct bytecode_runtime *runtime,
                uint64_t index, struct estack_entry *stack_top)
 {
@@ -403,6 +406,7 @@ static int dynamic_get_index(struct lttng_ust_ctx *ctx,
        case LOAD_ROOT_APP_CONTEXT:     /* Fall-through */
        {
                ret = context_get_index(ctx,
+                               probe_ctx,
                                &stack_top->u.ptr,
                                gid->ctx_index);
                if (ret) {
@@ -711,6 +715,7 @@ again:
  */
 int lttng_bytecode_interpret(struct lttng_ust_bytecode_runtime *ust_bytecode,
                const char *interpreter_stack_data,
+               struct lttng_ust_probe_ctx *probe_ctx,
                void *caller_ctx)
 {
        struct bytecode_runtime *bytecode = caa_container_of(ust_bytecode, struct bytecode_runtime, p);
@@ -2138,7 +2143,7 @@ int lttng_bytecode_interpret(struct lttng_ust_bytecode_runtime *ust_bytecode,
                        dbg_printf("get context ref offset %u type dynamic\n",
                                ref->offset);
                        ctx_field = &ctx->fields[ref->offset];
-                       ctx_field->get_value(ctx_field->priv, &v);
+                       ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
                        switch (v.sel) {
                        case LTTNG_UST_DYNAMIC_TYPE_NONE:
@@ -2186,7 +2191,7 @@ int lttng_bytecode_interpret(struct lttng_ust_bytecode_runtime *ust_bytecode,
                        dbg_printf("get context ref offset %u type string\n",
                                ref->offset);
                        ctx_field = &ctx->fields[ref->offset];
-                       ctx_field->get_value(ctx_field->priv, &v);
+                       ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax(stack, top)->u.s.str = v.u.str;
                        if (unlikely(!estack_ax(stack, top)->u.s.str)) {
@@ -2213,7 +2218,7 @@ int lttng_bytecode_interpret(struct lttng_ust_bytecode_runtime *ust_bytecode,
                        dbg_printf("get context ref offset %u type s64\n",
                                ref->offset);
                        ctx_field = &ctx->fields[ref->offset];
-                       ctx_field->get_value(ctx_field->priv, &v);
+                       ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
                        estack_ax_v = v.u.s64;
                        estack_ax_t = REG_S64;
@@ -2232,7 +2237,7 @@ int lttng_bytecode_interpret(struct lttng_ust_bytecode_runtime *ust_bytecode,
                        dbg_printf("get context ref offset %u type double\n",
                                ref->offset);
                        ctx_field = &ctx->fields[ref->offset];
-                       ctx_field->get_value(ctx_field->priv, &v);
+                       ctx_field->get_value(ctx_field->priv, probe_ctx, &v);
                        estack_push(stack, top, ax, bx, ax_t, bx_t);
                        memcpy(&estack_ax(stack, top)->u.d, &v.u.d, sizeof(struct literal_double));
                        estack_ax_t = REG_DOUBLE;
@@ -2316,7 +2321,7 @@ int lttng_bytecode_interpret(struct lttng_ust_bytecode_runtime *ust_bytecode,
                        struct get_index_u16 *index = (struct get_index_u16 *) insn->data;
 
                        dbg_printf("op get index u16\n");
-                       ret = dynamic_get_index(ctx, bytecode, index->index, estack_ax(stack, top));
+                       ret = dynamic_get_index(ctx, probe_ctx, bytecode, index->index, estack_ax(stack, top));
                        if (ret)
                                goto end;
                        estack_ax_v = estack_ax(stack, top)->u.v;
@@ -2331,7 +2336,7 @@ int lttng_bytecode_interpret(struct lttng_ust_bytecode_runtime *ust_bytecode,
                        struct get_index_u64 *index = (struct get_index_u64 *) insn->data;
 
                        dbg_printf("op get index u64\n");
-                       ret = dynamic_get_index(ctx, bytecode, index->index, estack_ax(stack, top));
+                       ret = dynamic_get_index(ctx, probe_ctx, bytecode, index->index, estack_ax(stack, top));
                        if (ret)
                                goto end;
                        estack_ax_v = estack_ax(stack, top)->u.v;
@@ -2513,6 +2518,7 @@ end:
  */
 int lttng_ust_interpret_event_filter(const struct lttng_ust_event_common *event,
                const char *interpreter_stack_data,
+               struct lttng_ust_probe_ctx *probe_ctx,
                void *event_filter_ctx __attribute__((unused)))
 {
        struct lttng_ust_bytecode_runtime *filter_bc_runtime;
@@ -2522,7 +2528,7 @@ int lttng_ust_interpret_event_filter(const struct lttng_ust_event_common *event,
 
        cds_list_for_each_entry_rcu(filter_bc_runtime, filter_bytecode_runtime_head, node) {
                if (caa_likely(filter_bc_runtime->interpreter_func(filter_bc_runtime,
-                               interpreter_stack_data, &bytecode_filter_ctx) == LTTNG_UST_BYTECODE_INTERPRETER_OK)) {
+                               interpreter_stack_data, probe_ctx, &bytecode_filter_ctx) == LTTNG_UST_BYTECODE_INTERPRETER_OK)) {
                        if (caa_unlikely(bytecode_filter_ctx.result == LTTNG_UST_BYTECODE_FILTER_ACCEPT)) {
                                filter_record = true;
                                break;
index 46f721204567c5f5e85cafd06e5f4670c45e31ed..d8f2413c2c335955f3bd1eaaf8ee8aaf95f6cb00 100644 (file)
@@ -330,11 +330,13 @@ int lttng_bytecode_specialize(const struct lttng_ust_event_desc *event_desc,
 
 int lttng_bytecode_interpret_error(struct lttng_ust_bytecode_runtime *bytecode_runtime,
                const char *stack_data,
+               struct lttng_ust_probe_ctx *probe_ctx,
                void *ctx)
        __attribute__((visibility("hidden")));
 
 int lttng_bytecode_interpret(struct lttng_ust_bytecode_runtime *bytecode_runtime,
                const char *stack_data,
+               struct lttng_ust_probe_ctx *probe_ctx,
                void *ctx)
        __attribute__((visibility("hidden")));
 
index 3f86f175fcfb41a1410f8486ce2021c6688a46ac..fa67a64cc3b1d19ccaffdb8d0b05126d024aeec1 100644 (file)
@@ -92,6 +92,7 @@ void lttng_context_cgroup_ns_reset(void)
 
 static
 size_t cgroup_ns_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -103,8 +104,9 @@ size_t cgroup_ns_get_size(void *priv __attribute__((unused)),
 
 static
 void cgroup_ns_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        ino_t cgroup_ns;
 
@@ -115,9 +117,10 @@ void cgroup_ns_record(void *priv __attribute__((unused)),
 
 static
 void cgroup_ns_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_cgroup_ns();
+       value->u.u64 = get_cgroup_ns();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 0b87bd3c2455632c3a9b86c6134a8a38addf730f..37e8327f28fc05daaa4ca03ca4ad8c0f2161f8d1 100644 (file)
@@ -26,6 +26,7 @@
 
 static
 size_t cpu_id_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -37,8 +38,9 @@ size_t cpu_id_get_size(void *priv __attribute__((unused)),
 
 static
 void cpu_id_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        int cpu;
 
@@ -48,6 +50,7 @@ void cpu_id_record(void *priv __attribute__((unused)),
 
 static
 void cpu_id_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = lttng_ust_get_cpu();
index 00ed8b06acad41d3793153c056299471f2618713..bc22ce296155b1d23d65e229226566ffbfdb1de2 100644 (file)
@@ -19,6 +19,7 @@
 
 static
 size_t ip_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -30,15 +31,24 @@ size_t ip_get_size(void *priv __attribute__((unused)),
 
 static
 void ip_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx,
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        void *ip;
 
-       ip = ctx->ip;
+       ip = probe_ctx->ip;
        chan->ops->event_write(ctx, &ip, sizeof(ip), lttng_ust_rb_alignof(ip));
 }
 
+static
+void ip_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx,
+               struct lttng_ust_ctx_value *value)
+{
+       value->u.u64 = (unsigned long) probe_ctx->ip;
+}
+
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
        lttng_ust_static_event_field("ip",
                lttng_ust_static_type_integer(sizeof(void *) * CHAR_BIT,
@@ -48,7 +58,8 @@ static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
                false, false),
        ip_get_size,
        ip_record,
-       NULL, NULL, NULL);
+       ip_get_value,
+       NULL, NULL);
 
 int lttng_add_ip_to_ctx(struct lttng_ust_ctx **ctx)
 {
index fcf6b0cc50106e0ac3f7d9831e1ae0d96c9d9c97..96267ef9d27b3c16fcae43a32c4992880c08df73 100644 (file)
@@ -91,6 +91,7 @@ void lttng_context_ipc_ns_reset(void)
 
 static
 size_t ipc_ns_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -102,8 +103,9 @@ size_t ipc_ns_get_size(void *priv __attribute__((unused)),
 
 static
 void ipc_ns_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        ino_t ipc_ns;
 
@@ -113,9 +115,10 @@ void ipc_ns_record(void *priv __attribute__((unused)),
 
 static
 void ipc_ns_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_ipc_ns();
+       value->u.u64 = get_ipc_ns();
 }
 
 const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index d62bc860d99ca6f65decea985a0cfab913787037..e83b9bbe021341e1fea4adbcaa606ddc0a798082 100644 (file)
@@ -74,6 +74,7 @@ void lttng_context_mnt_ns_reset(void)
 
 static
 size_t mnt_ns_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -85,8 +86,9 @@ size_t mnt_ns_get_size(void *priv __attribute__((unused)),
 
 static
 void mnt_ns_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        ino_t mnt_ns;
 
@@ -96,9 +98,10 @@ void mnt_ns_record(void *priv __attribute__((unused)),
 
 static
 void mnt_ns_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_mnt_ns();
+       value->u.u64 = get_mnt_ns();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 5b269c611687997dc0d68e9f5b01129d85b52373..6982a351e002d3aa846d12793953f544660ab79b 100644 (file)
@@ -91,6 +91,7 @@ void lttng_context_net_ns_reset(void)
 
 static
 size_t net_ns_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -102,8 +103,9 @@ size_t net_ns_get_size(void *priv __attribute__((unused)),
 
 static
 void net_ns_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        ino_t net_ns;
 
@@ -113,9 +115,10 @@ void net_ns_record(void *priv __attribute__((unused)),
 
 static
 void net_ns_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_net_ns();
+       value->u.u64 = get_net_ns();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 5a7dec4aac0e900013f07f372ca69255675051c7..1d44a54ae1e6afd1ecf8f81d896055b8393bec9d 100644 (file)
@@ -161,6 +161,7 @@ void lttng_perf_unlock(void)
 
 static
 size_t perf_counter_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -442,8 +443,9 @@ uint64_t wrapper_perf_counter_read(void *priv)
 
 static
 void perf_counter_record(void *priv,
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        uint64_t value;
 
@@ -453,9 +455,10 @@ void perf_counter_record(void *priv,
 
 static
 void perf_counter_get_value(void *priv,
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = wrapper_perf_counter_read(priv);
+       value->u.u64 = wrapper_perf_counter_read(priv);
 }
 
 /* Called with perf lock held */
index f1bb48faabd45f55c4882ff69f6b7573b47a7321..e944140eb28aec81237f8c0f14a60f25bcd12d90 100644 (file)
@@ -77,6 +77,7 @@ void lttng_context_pid_ns_reset(void)
 
 static
 size_t pid_ns_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -88,8 +89,9 @@ size_t pid_ns_get_size(void *priv __attribute__((unused)),
 
 static
 void pid_ns_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        ino_t pid_ns;
 
@@ -99,9 +101,10 @@ void pid_ns_record(void *priv __attribute__((unused)),
 
 static
 void pid_ns_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_pid_ns();
+       value->u.u64 = get_pid_ns();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 093b50c7c1444b60d791fee756b883b0c195d365..28c8490d0b40e3b63a063445d89e25c34a196d20 100644 (file)
@@ -67,6 +67,7 @@ void lttng_ust_context_procname_reset(void)
 
 static
 size_t procname_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset __attribute__((unused)))
 {
        return LTTNG_UST_ABI_PROCNAME_LEN;
@@ -74,8 +75,9 @@ size_t procname_get_size(void *priv __attribute__((unused)),
 
 static
 void procname_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        const char *procname;
 
@@ -85,6 +87,7 @@ void procname_record(void *priv __attribute__((unused)),
 
 static
 void procname_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
        value->u.str = wrapper_getprocname();
index af98816b4d5801001bbbb02ae1967938ea97a9a0..452639e1d6f81f36b3f8c53de10c92a2db773a06 100644 (file)
@@ -18,6 +18,7 @@
 
 static
 size_t pthread_id_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -29,8 +30,9 @@ size_t pthread_id_get_size(void *priv __attribute__((unused)),
 
 static
 void pthread_id_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        unsigned long pthread_id;
 
@@ -40,9 +42,10 @@ void pthread_id_record(void *priv __attribute__((unused)),
 
 static
 void pthread_id_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = (unsigned long) pthread_self();
+       value->u.u64 = (unsigned long) pthread_self();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 78423298909b0041386484fc4062275d4ca2678f..4f532b486d787f4f28f656fbe021b32e93b85405 100644 (file)
@@ -90,6 +90,7 @@ void lttng_context_time_ns_reset(void)
 
 static
 size_t time_ns_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -101,8 +102,9 @@ size_t time_ns_get_size(void *priv __attribute__((unused)),
 
 static
 void time_ns_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        ino_t time_ns;
 
@@ -112,9 +114,10 @@ void time_ns_record(void *priv __attribute__((unused)),
 
 static
 void time_ns_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_time_ns();
+       value->u.u64 = get_time_ns();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 97612bc60dbeec80dfd7c4b8624886c30d5f5914..813e357bfc24f89c711ace45ef2ae7592f489bf1 100644 (file)
@@ -74,6 +74,7 @@ void lttng_context_user_ns_reset(void)
 
 static
 size_t user_ns_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -85,8 +86,9 @@ size_t user_ns_get_size(void *priv __attribute__((unused)),
 
 static
 void user_ns_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        ino_t user_ns;
 
@@ -96,9 +98,10 @@ void user_ns_record(void *priv __attribute__((unused)),
 
 static
 void user_ns_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_user_ns();
+       value->u.u64 = get_user_ns();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 0ec8ed44adac564e2ee94c19d88ce2ac6c036d9c..619649b30ccfe22711e0d3bd3b25d5112c9de416 100644 (file)
@@ -92,6 +92,7 @@ void lttng_context_uts_ns_reset(void)
 
 static
 size_t uts_ns_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -103,8 +104,9 @@ size_t uts_ns_get_size(void *priv __attribute__((unused)),
 
 static
 void uts_ns_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        ino_t uts_ns;
 
@@ -114,9 +116,10 @@ void uts_ns_record(void *priv __attribute__((unused)),
 
 static
 void uts_ns_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_uts_ns();
+       value->u.u64 = get_uts_ns();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 682f7d9a573a6e38d451ccb28e239623dcf96ca2..23b0cd6faaaef2c4b9637e9171b5c8c413c958ad 100644 (file)
@@ -63,6 +63,7 @@ void lttng_context_vegid_reset(void)
 
 static
 size_t vegid_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -74,8 +75,9 @@ size_t vegid_get_size(void *priv __attribute__((unused)),
 
 static
 void vegid_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        gid_t vegid;
 
@@ -85,9 +87,10 @@ void vegid_record(void *priv __attribute__((unused)),
 
 static
 void vegid_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_vegid();
+       value->u.u64 = get_vegid();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 505a1b636d34b54e8f27d777188871a3e26d0bf5..af2bd1a17ccc39192b6474bd56465cf4106da358 100644 (file)
@@ -63,6 +63,7 @@ void lttng_context_veuid_reset(void)
 
 static
 size_t veuid_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -74,8 +75,9 @@ size_t veuid_get_size(void *priv __attribute__((unused)),
 
 static
 void veuid_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        uid_t veuid;
 
@@ -85,9 +87,10 @@ void veuid_record(void *priv __attribute__((unused)),
 
 static
 void veuid_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_veuid();
+       value->u.u64 = get_veuid();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index c19be225a3a687137aa317af21db9a55559888af..2f62b85de951b7225b4ea9f4dcb377b92da91517 100644 (file)
@@ -63,6 +63,7 @@ void lttng_context_vgid_reset(void)
 
 static
 size_t vgid_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -74,8 +75,9 @@ size_t vgid_get_size(void *priv __attribute__((unused)),
 
 static
 void vgid_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        gid_t vgid;
 
@@ -85,9 +87,10 @@ void vgid_record(void *priv __attribute__((unused)),
 
 static
 void vgid_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_vgid();
+       value->u.u64 = get_vgid();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 1558ee9851fb28ddf284f0cca0ef9453c1a207a7..57174b0a3c444dfb4aaf0f8dcc27bdab4a09b174 100644 (file)
@@ -47,6 +47,7 @@ void lttng_context_vpid_reset(void)
 
 static
 size_t vpid_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -58,8 +59,9 @@ size_t vpid_get_size(void *priv __attribute__((unused)),
 
 static
 void vpid_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        pid_t vpid = wrapper_getvpid();
 
@@ -68,6 +70,7 @@ void vpid_record(void *priv __attribute__((unused)),
 
 static
 void vpid_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = wrapper_getvpid();
index f66b6b76db342615b6e97f847d11c380454d99a4..37b227d36ba64ab5fef055baea40367150bd95e1 100644 (file)
@@ -67,6 +67,7 @@ void lttng_context_vsgid_reset(void)
 
 static
 size_t vsgid_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -78,8 +79,9 @@ size_t vsgid_get_size(void *priv __attribute__((unused)),
 
 static
 void vsgid_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        gid_t vsgid;
 
@@ -89,9 +91,10 @@ void vsgid_record(void *priv __attribute__((unused)),
 
 static
 void vsgid_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_vsgid();
+       value->u.u64 = get_vsgid();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 2e442c94433dcbf031921452bab8419fb03cdb8a..a0428f24c36fb931f30ae09ad6217d124b3b58ac 100644 (file)
@@ -67,6 +67,7 @@ void lttng_context_vsuid_reset(void)
 
 static
 size_t vsuid_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -78,8 +79,9 @@ size_t vsuid_get_size(void *priv __attribute__((unused)),
 
 static
 void vsuid_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        uid_t vsuid;
 
@@ -89,9 +91,10 @@ void vsuid_record(void *priv __attribute__((unused)),
 
 static
 void vsuid_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_vsuid();
+       value->u.u64 = get_vsuid();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 6a206a906d39a84529066942b825933e893db521..97a023d200af68f07abb43b4506170a031ab068b 100644 (file)
@@ -38,6 +38,7 @@ void lttng_context_vtid_reset(void)
 
 static
 size_t vtid_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -62,8 +63,9 @@ pid_t wrapper_getvtid(void)
 
 static
 void vtid_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        pid_t vtid = wrapper_getvtid();
 
@@ -72,6 +74,7 @@ void vtid_record(void *priv __attribute__((unused)),
 
 static
 void vtid_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
        value->u.s64 = wrapper_getvtid();
index d96a8c9ba40bbdd796729a2cb71d8310eea0f122..b50d8b9fecc8b2a6a44b32b4f989ed58c06d2e54 100644 (file)
@@ -63,6 +63,7 @@ void lttng_context_vuid_reset(void)
 
 static
 size_t vuid_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -74,8 +75,9 @@ size_t vuid_get_size(void *priv __attribute__((unused)),
 
 static
 void vuid_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        uid_t vuid;
 
@@ -85,9 +87,10 @@ void vuid_record(void *priv __attribute__((unused)),
 
 static
 void vuid_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
-       value->u.s64 = get_vuid();
+       value->u.u64 = get_vuid();
 }
 
 static const struct lttng_ust_ctx_field *ctx_field = lttng_ust_static_ctx_field(
index 046f2a85e86955aef62195321dd08dcbbdd43add..427afe56d78d86ece23454e71dc7b5de248484f2 100644 (file)
@@ -254,10 +254,13 @@ void lttng_destroy_context(struct lttng_ust_ctx *ctx)
  */
 int lttng_ust_context_set_provider_rcu(struct lttng_ust_ctx **_ctx,
                const char *name,
-               size_t (*get_size)(void *priv, size_t offset),
-               void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx,
+               size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       size_t offset),
+               void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ring_buffer_ctx *ctx,
                        struct lttng_ust_channel_buffer *chan),
-               void (*get_value)(void *priv, struct lttng_ust_ctx_value *value),
+               void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ctx_value *value),
                void *priv)
 {
        int i, ret;
index 386106136bf4ca08c15ada7913c6c32179d5576b..4bacbb951e7405cbd03ff849ba48614fb3d0c985 100644 (file)
@@ -1997,10 +1997,13 @@ void lttng_session_lazy_sync_event_enablers(struct lttng_ust_session *session)
  * context (either app context callbacks, or dummy callbacks).
  */
 void lttng_ust_context_set_session_provider(const char *name,
-               size_t (*get_size)(void *priv, size_t offset),
-               void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx,
+               size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       size_t offset),
+               void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ring_buffer_ctx *ctx,
                        struct lttng_ust_channel_buffer *chan),
-               void (*get_value)(void *priv, struct lttng_ust_ctx_value *value),
+               void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ctx_value *value),
                void *priv)
 {
        struct lttng_ust_session_private *session_priv;
@@ -2037,10 +2040,13 @@ void lttng_ust_context_set_session_provider(const char *name,
  * context (either app context callbacks, or dummy callbacks).
  */
 void lttng_ust_context_set_event_notifier_group_provider(const char *name,
-               size_t (*get_size)(void *priv, size_t offset),
-               void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx,
+               size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       size_t offset),
+               void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ring_buffer_ctx *ctx,
                        struct lttng_ust_channel_buffer *chan),
-               void (*get_value)(void *priv, struct lttng_ust_ctx_value *value),
+               void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+                       struct lttng_ust_ctx_value *value),
                void *priv)
 {
        struct lttng_event_notifier_group *event_notifier_group;
index 14aa2a48bede21ab1aa49de5e77a5864320dff02..bc7fc2f2fe900a72a280437d814051b68549fb12 100644 (file)
@@ -98,7 +98,8 @@ size_t ctx_get_aligned_size(size_t offset, struct lttng_ust_ctx *ctx,
 }
 
 static inline
-void ctx_get_struct_size(struct lttng_ust_ctx *ctx, size_t *ctx_len)
+void ctx_get_struct_size(struct lttng_ust_ring_buffer_ctx *bufctx,
+               struct lttng_ust_ctx *ctx, size_t *ctx_len)
 {
        int i;
        size_t offset = 0;
@@ -108,7 +109,7 @@ void ctx_get_struct_size(struct lttng_ust_ctx *ctx, size_t *ctx_len)
                return;
        }
        for (i = 0; i < ctx->nr_fields; i++)
-               offset += ctx->fields[i].get_size(ctx->fields[i].priv, offset);
+               offset += ctx->fields[i].get_size(ctx->fields[i].priv, bufctx->probe_ctx, offset);
        *ctx_len = offset;
 }
 
@@ -123,7 +124,7 @@ void ctx_record(struct lttng_ust_ring_buffer_ctx *bufctx,
                return;
        lttng_ust_ring_buffer_align_ctx(bufctx, ctx->largest_align);
        for (i = 0; i < ctx->nr_fields; i++)
-               ctx->fields[i].record(ctx->fields[i].priv, bufctx, chan);
+               ctx->fields[i].record(ctx->fields[i].priv, bufctx->probe_ctx, bufctx, chan);
 }
 
 /*
@@ -690,8 +691,8 @@ int lttng_event_reserve(struct lttng_ust_ring_buffer_ctx *ctx)
        client_ctx.chan_ctx = lttng_ust_rcu_dereference(lttng_chan->priv->ctx);
        client_ctx.event_ctx = lttng_ust_rcu_dereference(event_recorder->priv->ctx);
        /* Compute internal size of context structures. */
-       ctx_get_struct_size(client_ctx.chan_ctx, &client_ctx.packet_context_len);
-       ctx_get_struct_size(client_ctx.event_ctx, &client_ctx.event_context_len);
+       ctx_get_struct_size(ctx, client_ctx.chan_ctx, &client_ctx.packet_context_len);
+       ctx_get_struct_size(ctx, client_ctx.event_ctx, &client_ctx.event_context_len);
 
        nesting = lib_ring_buffer_nesting_inc(&client_config);
        if (nesting < 0)
index bfead6e53c364c9389df2e3ab9cd26c7c00e467a..75765394ec59cb9f7611bd7e509ecba0f672feea 100644 (file)
@@ -73,19 +73,23 @@ char* lttng_ust_sockinfo_get_procname(void *owner)
 void lttng_ust_sockinfo_session_enabled(void *owner)
        __attribute__((visibility("hidden")));
 
-size_t lttng_ust_dummy_get_size(void *priv, size_t offset)
+size_t lttng_ust_dummy_get_size(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+               size_t offset)
        __attribute__((visibility("hidden")));
 
-void lttng_ust_dummy_record(void *priv, struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+void lttng_ust_dummy_record(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
        __attribute__((visibility("hidden")));
 
-void lttng_ust_dummy_get_value(void *priv, struct lttng_ust_ctx_value *value)
+void lttng_ust_dummy_get_value(void *priv, struct lttng_ust_probe_ctx *probe_ctx,
+               struct lttng_ust_ctx_value *value)
        __attribute__((visibility("hidden")));
 
 void lttng_event_notifier_notification_send(
                const struct lttng_ust_event_notifier *event_notifier,
                const char *stack_data,
+               struct lttng_ust_probe_ctx *probe_ctx,
                struct lttng_ust_notification_ctx *notif_ctx)
        __attribute__((visibility("hidden")));
 
index ead25295f4e1a0e7a92a89877f5f9eb3d6aa46a8..d070124edf622c68c7215d73418fc31e770dd6cf 100644 (file)
@@ -109,6 +109,7 @@ struct lttng_enum *lttng_ust_enum_get_from_desc(struct lttng_ust_session *sessio
 }
 
 size_t lttng_ust_dummy_get_size(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                size_t offset)
 {
        size_t size = 0;
@@ -119,8 +120,9 @@ size_t lttng_ust_dummy_get_size(void *priv __attribute__((unused)),
 }
 
 void lttng_ust_dummy_record(void *priv __attribute__((unused)),
-                struct lttng_ust_ring_buffer_ctx *ctx,
-                struct lttng_ust_channel_buffer *chan)
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+               struct lttng_ust_ring_buffer_ctx *ctx,
+               struct lttng_ust_channel_buffer *chan)
 {
        char sel_char = (char) LTTNG_UST_DYNAMIC_TYPE_NONE;
 
@@ -128,6 +130,7 @@ void lttng_ust_dummy_record(void *priv __attribute__((unused)),
 }
 
 void lttng_ust_dummy_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
        value->sel = LTTNG_UST_DYNAMIC_TYPE_NONE;
index 723f179f4809c9e8d13d8f1718eb1650ee4583ae..85df998486c3c56f6d2a7980e9e4b88e97de75c5 100644 (file)
@@ -42,7 +42,9 @@ void test_inc_count(void)
 }
 
 static
-size_t test_get_size(void *priv __attribute__((unused)), size_t offset)
+size_t test_get_size(void *priv __attribute__((unused)),
+                    struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
+                    size_t offset)
 {
        int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;
        size_t size = 0;
@@ -104,6 +106,7 @@ size_t test_get_size(void *priv __attribute__((unused)), size_t offset)
 
 static
 void test_record(void *priv __attribute__((unused)),
+                struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                 struct lttng_ust_ring_buffer_ctx *ctx,
                 struct lttng_ust_channel_buffer *lttng_chan_buf)
 {
@@ -197,6 +200,7 @@ void test_record(void *priv __attribute__((unused)),
 
 static
 void test_get_value(void *priv __attribute__((unused)),
+               struct lttng_ust_probe_ctx *probe_ctx __attribute__((unused)),
                struct lttng_ust_ctx_value *value)
 {
        int sel = test_count % _NR_LTTNG_UST_DYNAMIC_TYPES;
This page took 0.061499 seconds and 4 git commands to generate.