Implement event notifiers for kprobes
[lttng-modules.git] / include / lttng / events.h
index 4c94116eec236470bebbfe4de3815a228dae1b3d..cf04a30585dc3f0839e1dd9937f672f9477c5893 100644 (file)
@@ -170,6 +170,7 @@ struct lttng_perf_counter_field {
 
 struct lttng_probe_ctx {
        struct lttng_event *event;
+       struct lttng_event_notifier *event_notifier; // Not sure if we will ever need it.
        uint8_t interruptible;
 };
 
@@ -212,6 +213,7 @@ struct lttng_event_desc {
        const struct lttng_event_field *fields; /* event payload */
        unsigned int nr_fields;
        struct module *owner;
+       void *event_notifier_callback;
 };
 
 struct lttng_probe_desc {
@@ -274,6 +276,11 @@ struct lttng_uprobe_handler {
        struct list_head node;
 };
 
+struct lttng_kprobe {
+       struct kprobe kp;
+       char *symbol_name;
+};
+
 enum lttng_syscall_entryexit {
        LTTNG_SYSCALL_ENTRY,
        LTTNG_SYSCALL_EXIT,
@@ -298,10 +305,7 @@ struct lttng_event {
        struct lttng_ctx *ctx;
        enum lttng_kernel_instrumentation instrumentation;
        union {
-               struct {
-                       struct kprobe kp;
-                       char *symbol_name;
-               } kprobe;
+               struct lttng_kprobe kprobe;
                struct {
                        struct lttng_krp *lttng_krp;
                        char *symbol_name;
@@ -340,6 +344,7 @@ struct lttng_event_notifier {
 
        enum lttng_kernel_instrumentation instrumentation;
        union {
+               struct lttng_kprobe kprobe;
        } u;
 
        /* Backward references: list of lttng_enabler_ref (ref to enablers) */
@@ -654,7 +659,9 @@ int lttng_event_notifier_enabler_enable(
 int lttng_event_notifier_enabler_disable(
                struct lttng_event_notifier_enabler *event_notifier_enabler);
 int lttng_fix_pending_events(void);
+int lttng_fix_pending_event_notifiers(void);
 int lttng_session_active(void);
+bool lttng_event_notifier_active(void);
 
 struct lttng_session *lttng_session_create(void);
 int lttng_session_enable(struct lttng_session *session);
@@ -717,6 +724,9 @@ int lttng_channel_disable(struct lttng_channel *channel);
 int lttng_event_enable(struct lttng_event *event);
 int lttng_event_disable(struct lttng_event *event);
 
+int lttng_event_notifier_enable(struct lttng_event_notifier *event_notifier);
+int lttng_event_notifier_disable(struct lttng_event_notifier *event_notifier);
+
 void lttng_transport_register(struct lttng_transport *transport);
 void lttng_transport_unregister(struct lttng_transport *transport);
 
@@ -1003,16 +1013,22 @@ void lttng_logger_exit(void);
 extern int lttng_statedump_start(struct lttng_session *session);
 
 #ifdef CONFIG_KPROBES
-int lttng_kprobes_register(const char *name,
+int lttng_kprobes_register_event(const char *name,
                const char *symbol_name,
                uint64_t offset,
                uint64_t addr,
                struct lttng_event *event);
-void lttng_kprobes_unregister(struct lttng_event *event);
-void lttng_kprobes_destroy_private(struct lttng_event *event);
+void lttng_kprobes_unregister_event(struct lttng_event *event);
+void lttng_kprobes_destroy_event_private(struct lttng_event *event);
+int lttng_kprobes_register_event_notifier(const char *symbol_name,
+               uint64_t offset,
+               uint64_t addr,
+               struct lttng_event_notifier *event_notifier);
+void lttng_kprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier);
+void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier);
 #else
 static inline
-int lttng_kprobes_register(const char *name,
+int lttng_kprobes_register_event(const char *name,
                const char *symbol_name,
                uint64_t offset,
                uint64_t addr,
@@ -1022,12 +1038,31 @@ int lttng_kprobes_register(const char *name,
 }
 
 static inline
-void lttng_kprobes_unregister(struct lttng_event *event)
+void lttng_kprobes_unregister_event(struct lttng_event *event)
+{
+}
+
+static inline
+void lttng_kprobes_destroy_event_private(struct lttng_event *event)
+{
+}
+
+static inline
+int lttng_kprobes_register_event_notifier(const char *symbol_name,
+               uint64_t offset,
+               uint64_t addr,
+               struct lttng_event_notifier *event_notifier)
+{
+       return -ENOSYS;
+}
+
+static inline
+void lttng_kprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier)
 {
 }
 
 static inline
-void lttng_kprobes_destroy_private(struct lttng_event *event)
+void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
 {
 }
 #endif
This page took 0.024813 seconds and 4 git commands to generate.