X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Flttng%2Fevents.h;h=464adb2c2ff9a8ecd187137be8b453ed31ef925d;hb=ea2d95e474476e28aca898d29f7564db4e4eb283;hp=c396e790d76e4663a0beac722c1112e9cc772535;hpb=a775608d0d1d6142c80c26b21ff79bf7e04d8e53;p=lttng-modules.git diff --git a/include/lttng/events.h b/include/lttng/events.h index c396e790..464adb2c 100644 --- a/include/lttng/events.h +++ b/include/lttng/events.h @@ -109,7 +109,7 @@ struct lttng_kernel_type_array { struct lttng_kernel_type_sequence { struct lttng_kernel_type_common parent; - const char *length_name; /* Length field name. */ + const char *length_name; /* Length field name. If NULL, use previous field. */ const struct lttng_kernel_type_common *elem_type; unsigned int alignment; /* Alignment before elements. */ enum lttng_kernel_string_encoding encoding; @@ -124,7 +124,7 @@ struct lttng_kernel_type_struct { struct lttng_kernel_type_variant { struct lttng_kernel_type_common parent; - const char *tag_name; + const char *tag_name; /* Tag field name. If NULL, use previous field. */ const struct lttng_kernel_event_field **choices; /* Array of pointers to fields. */ unsigned int nr_choices; unsigned int alignment; @@ -246,11 +246,10 @@ struct lttng_kernel_event_field { _fields \ ) -#define lttng_kernel_static_ctx_field(_event_field, _get_size, _get_size_arg, _record, _get_value, _destroy, _priv) \ +#define lttng_kernel_static_ctx_field(_event_field, _get_size, _record, _get_value, _destroy, _priv) \ __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, { \ .event_field = (_event_field), \ .get_size = (_get_size), \ - .get_size_arg = (_get_size_arg), \ .record = (_record), \ .get_value = (_get_value), \ .destroy = (_destroy), \ @@ -303,10 +302,12 @@ struct lttng_kernel_event_field { } \ }), -union lttng_ctx_value { - int64_t s64; - const char *str; - double d; +struct lttng_ctx_value { + union { + int64_t s64; + const char *str; + double d; + } u; }; /* @@ -334,17 +335,14 @@ struct lttng_probe_ctx { struct lttng_kernel_ctx_field { const struct lttng_kernel_event_field *event_field; - size_t (*get_size)(size_t offset); - size_t (*get_size_arg)(size_t offset, struct lttng_kernel_ctx_field *field, - struct lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan); - void (*record)(struct lttng_kernel_ctx_field *field, - struct lib_ring_buffer_ctx *ctx, - struct lttng_channel *chan); - void (*get_value)(struct lttng_kernel_ctx_field *field, - struct lttng_probe_ctx *lttng_probe_ctx, - union lttng_ctx_value *value); - void (*destroy)(struct lttng_kernel_ctx_field *field); + size_t (*get_size)(void *priv, struct lttng_probe_ctx *probe_ctx, + size_t offset); + void (*record)(void *priv, struct lttng_probe_ctx *probe_ctx, + struct lib_ring_buffer_ctx *ctx, + struct lttng_channel *chan); + void (*get_value)(void *priv, struct lttng_probe_ctx *probe_ctx, + struct lttng_ctx_value *value); + void (*destroy)(void *priv); void *priv; }; @@ -376,13 +374,13 @@ struct lttng_kernel_probe_desc { struct lttng_krp; /* Kretprobe handling */ -enum lttng_bytecode_node_type { - LTTNG_BYTECODE_NODE_TYPE_FILTER, - LTTNG_BYTECODE_NODE_TYPE_CAPTURE, +enum lttng_kernel_bytecode_type { + LTTNG_KERNEL_BYTECODE_TYPE_FILTER, + LTTNG_KERNEL_BYTECODE_TYPE_CAPTURE, }; struct lttng_bytecode_node { - enum lttng_bytecode_node_type type; + enum lttng_kernel_bytecode_type type; struct list_head node; struct lttng_enabler *enabler; struct { @@ -393,29 +391,16 @@ struct lttng_bytecode_node { } bc; }; -/* - * Bytecode interpreter return value masks. - */ -enum lttng_bytecode_interpreter_ret { - LTTNG_INTERPRETER_DISCARD = 0, - LTTNG_INTERPRETER_RECORD_FLAG = (1ULL << 0), - /* Other bits are kept for future use. */ -}; - struct lttng_interpreter_output; struct lttng_bytecode_runtime { /* Associated bytecode */ + enum lttng_kernel_bytecode_type type; struct lttng_bytecode_node *bc; - union { - uint64_t (*filter)(void *filter_data, + int (*interpreter_func)(struct lttng_bytecode_runtime *kernel_bytecode, + const char *interpreter_stack_data, struct lttng_probe_ctx *lttng_probe_ctx, - const char *filter_stack_data); - uint64_t (*capture)(void *filter_data, - const char *capture_stack_data, - struct lttng_probe_ctx *lttng_probe_ctx, - struct lttng_interpreter_output *output); - } interpreter_funcs; + void *caller_ctx); int link_failed; struct list_head node; /* list of bytecode runtime in event */ struct lttng_kernel_ctx *ctx; @@ -456,6 +441,14 @@ enum lttng_syscall_abi { LTTNG_SYSCALL_ABI_COMPAT, }; +/* + * Result of the run_filter() callback. + */ +enum lttng_kernel_event_filter_result { + LTTNG_KERNEL_EVENT_FILTER_ACCEPT = 0, + LTTNG_KERNEL_EVENT_FILTER_REJECT = 1, +}; + struct lttng_kernel_event_common_private; enum lttng_kernel_event_type { @@ -471,8 +464,9 @@ struct lttng_kernel_event_common { int enabled; int eval_filter; /* Need to evaluate filters */ - int (*run_filter)(struct lttng_kernel_event_common *event, + int (*run_filter)(const struct lttng_kernel_event_common *event, const char *stack_data, + struct lttng_probe_ctx *probe_ctx, void *filter_ctx); }; @@ -566,8 +560,7 @@ struct lttng_channel_ops { struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan); int (*buffer_has_read_closed_stream)(struct channel *chan); void (*buffer_read_close)(struct lib_ring_buffer *buf); - int (*event_reserve)(struct lib_ring_buffer_ctx *ctx, - uint32_t event_id); + int (*event_reserve)(struct lib_ring_buffer_ctx *ctx); void (*event_commit)(struct lib_ring_buffer_ctx *ctx); void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src, size_t len);