Remove unused TRACEPOINT_HAS_DATA_ARG
[lttng-modules.git] / include / lttng / events-internal.h
index 5c1d356bf2f2bae07d0e9d3883286ec89f65c8c8..a0d4fbc072f7861881fb47994c183f1fa13a38bb 100644 (file)
 
 #include <lttng/events.h>
 
+enum lttng_enabler_format_type {
+       LTTNG_ENABLER_FORMAT_STAR_GLOB,
+       LTTNG_ENABLER_FORMAT_NAME,
+};
+
+/*
+ * Objects in a linked-list of enablers, owned by an event.
+ */
+struct lttng_enabler_ref {
+       struct list_head node;                  /* enabler ref list */
+       struct lttng_enabler *ref;              /* backward ref */
+};
+
 struct lttng_kernel_event_common_private {
        struct lttng_kernel_event_common *pub;          /* Public event interface */
 
@@ -20,7 +33,7 @@ struct lttng_kernel_event_common_private {
        uint64_t user_token;
 
        int has_enablers_without_filter_bytecode;
-       /* list of struct lttng_bytecode_runtime, sorted by seqnum */
+       /* list of struct lttng_kernel_bytecode_runtime, sorted by seqnum */
        struct list_head filter_bytecode_runtime_head;
        enum lttng_kernel_abi_instrumentation instrumentation;
        /* Selected by instrumentation */
@@ -78,6 +91,38 @@ struct lttng_kernel_bytecode_filter_ctx {
        enum lttng_kernel_bytecode_filter_result result;
 };
 
+struct lttng_interpreter_output;
+
+enum lttng_kernel_bytecode_type {
+       LTTNG_KERNEL_BYTECODE_TYPE_FILTER,
+       LTTNG_KERNEL_BYTECODE_TYPE_CAPTURE,
+};
+
+struct lttng_kernel_bytecode_node {
+       enum lttng_kernel_bytecode_type type;
+       struct list_head node;
+       struct lttng_enabler *enabler;
+       struct {
+               uint32_t len;
+               uint32_t reloc_offset;
+               uint64_t seqnum;
+               char data[];
+       } bc;
+};
+
+struct lttng_kernel_bytecode_runtime {
+       /* Associated bytecode */
+       enum lttng_kernel_bytecode_type type;
+       struct lttng_kernel_bytecode_node *bc;
+       int (*interpreter_func)(struct lttng_kernel_bytecode_runtime *kernel_bytecode,
+                               const char *interpreter_stack_data,
+                               struct lttng_kernel_probe_ctx *lttng_probe_ctx,
+                               void *caller_ctx);
+       int link_failed;
+       struct list_head node;  /* list of bytecode runtime in event */
+       struct lttng_kernel_ctx *ctx;
+};
+
 /*
  * Enabler field, within whatever object is enabling an event. Target of
  * backward reference.
@@ -85,7 +130,7 @@ struct lttng_kernel_bytecode_filter_ctx {
 struct lttng_enabler {
        enum lttng_enabler_format_type format_type;
 
-       /* head list of struct lttng_bytecode_node */
+       /* head list of struct lttng_kernel_bytecode_node */
        struct list_head filter_bytecode_head;
 
        struct lttng_kernel_abi_event event_param;
@@ -106,7 +151,7 @@ struct lttng_event_notifier_enabler {
        struct list_head node;  /* List of event_notifier enablers */
        struct lttng_event_notifier_group *group;
 
-       /* head list of struct lttng_bytecode_node */
+       /* head list of struct lttng_kernel_bytecode_node */
        struct list_head capture_bytecode_head;
        uint64_t num_captures;
 };
@@ -139,12 +184,12 @@ struct lttng_perf_counter_field {
 
 struct lttng_kernel_ctx_field {
        const struct lttng_kernel_event_field *event_field;
-       size_t (*get_size)(void *priv, struct lttng_probe_ctx *probe_ctx,
+       size_t (*get_size)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
                        size_t offset);
-       void (*record)(void *priv, struct lttng_probe_ctx *probe_ctx,
+       void (*record)(void *priv, struct lttng_kernel_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,
+       void (*get_value)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
                        struct lttng_ctx_value *value);
        void (*destroy)(void *priv);
        void *priv;
@@ -235,7 +280,7 @@ static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kern
 
 int lttng_kernel_interpret_event_filter(const struct lttng_kernel_event_common *event,
                const char *interpreter_stack_data,
-               struct lttng_probe_ctx *probe_ctx,
+               struct lttng_kernel_probe_ctx *probe_ctx,
                void *event_filter_ctx);
 
 static inline
@@ -430,7 +475,123 @@ int lttng_cpuhp_perf_counter_dead(unsigned int cpu,
 }
 #endif
 
+struct lttng_event_enabler *lttng_event_enabler_create(
+               enum lttng_enabler_format_type format_type,
+               struct lttng_kernel_abi_event *event_param,
+               struct lttng_channel *chan);
+
+int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler);
+int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler);
+struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create(
+               struct lttng_event_notifier_group *event_notifier_group,
+               enum lttng_enabler_format_type format_type,
+               struct lttng_kernel_abi_event_notifier *event_notifier_param);
+
+int lttng_event_notifier_enabler_enable(
+               struct lttng_event_notifier_enabler *event_notifier_enabler);
+int lttng_event_notifier_enabler_disable(
+               struct lttng_event_notifier_enabler *event_notifier_enabler);
+
+int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler,
+               struct lttng_kernel_abi_filter_bytecode __user *bytecode);
+int lttng_event_notifier_enabler_attach_filter_bytecode(
+               struct lttng_event_notifier_enabler *event_notifier_enabler,
+               struct lttng_kernel_abi_filter_bytecode __user *bytecode);
+int lttng_event_notifier_enabler_attach_capture_bytecode(
+               struct lttng_event_notifier_enabler *event_notifier_enabler,
+               struct lttng_kernel_abi_capture_bytecode __user *bytecode);
+
+int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
+               struct lttng_enabler *enabler);
+
+void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc,
+               struct lttng_kernel_ctx *ctx,
+               struct list_head *instance_bytecode_runtime_head,
+               struct list_head *enabler_bytecode_runtime_head);
+
+#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
+int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler);
+int lttng_syscalls_unregister_channel(struct lttng_channel *chan);
+int lttng_syscalls_destroy_event(struct lttng_channel *chan);
+int lttng_syscall_filter_enable_event(
+               struct lttng_channel *chan,
+               struct lttng_kernel_event_recorder *event);
+int lttng_syscall_filter_disable_event(
+               struct lttng_channel *chan,
+               struct lttng_kernel_event_recorder *event);
+
+long lttng_channel_syscall_mask(struct lttng_channel *channel,
+               struct lttng_kernel_abi_syscall_mask __user *usyscall_mask);
+
+int lttng_syscalls_register_event_notifier(
+               struct lttng_event_notifier_enabler *event_notifier_enabler);
+int lttng_syscalls_create_matching_event_notifiers(
+               struct lttng_event_notifier_enabler *event_notifier_enabler);
+int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group);
+int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
+int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
+#else
+static inline int lttng_syscalls_register_event(
+               struct lttng_event_enabler *event_enabler)
+{
+       return -ENOSYS;
+}
+
+static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan)
+{
+       return 0;
+}
+
+static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
+{
+       return 0;
+}
+
+static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan,
+               struct lttng_kernel_event_recorder *event);
+{
+       return -ENOSYS;
+}
+
+static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan,
+               struct lttng_kernel_event_recorder *event);
+{
+       return -ENOSYS;
+}
+
+static inline long lttng_channel_syscall_mask(struct lttng_channel *channel,
+               struct lttng_kernel_syscall_mask __user *usyscall_mask)
+{
+       return -ENOSYS;
+}
+
+static inline int lttng_syscalls_register_event_notifier(
+               struct lttng_event_notifier_group *group)
+{
+       return -ENOSYS;
+}
+
+static inline int lttng_syscalls_unregister_event_notifier_group(
+               struct lttng_event_notifier_group *group)
+{
+       return 0;
+}
+
+static inline int lttng_syscall_filter_enable_event_notifier(
+               struct lttng_event_notifier_group *group,
+               const char *name)
+{
+       return -ENOSYS;
+}
 
+static inline int lttng_syscall_filter_disable_event_notifier(
+               struct lttng_event_notifier_group *group,
+               const char *name)
+{
+       return -ENOSYS;
+}
+
+#endif
 
 #define lttng_kernel_static_ctx_field(_event_field, _get_size, _record, _get_value, _destroy, _priv)   \
        __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, {                                 \
This page took 0.028964 seconds and 4 git commands to generate.