#include <lttng/events.h>
-void lttng_event_notifier_notification_send(struct lttng_event_notifier *event_notifier,
- struct lttng_probe_ctx *lttng_probe_ctx,
+void lttng_event_notifier_notification_send(struct lttng_kernel_event_notifier *event_notifier,
+ struct lttng_probe_ctx *probe_ctx,
const char *stack_data,
- struct lttng_kernel_notifier_ctx *notif_ctx);
+ struct lttng_kernel_notification_ctx *notif_ctx);
#endif /* _LTTNG_EVENT_NOTIFIER_NOTIFICATION_H */
#include <lttng/events.h>
+struct lttng_kernel_event_common_private {
+ struct lttng_kernel_event_common *pub; /* Public event interface */
+
+ const struct lttng_kernel_event_desc *desc;
+ /* Backward references: list of lttng_enabler_ref (ref to enablers) */
+ struct list_head enablers_ref_head;
+ int registered; /* has reg'd tracepoint probe */
+ uint64_t user_token;
+
+ int has_enablers_without_filter_bytecode;
+ /* 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 */
+ union {
+ struct lttng_kprobe kprobe;
+ struct lttng_uprobe uprobe;
+ struct {
+ struct lttng_krp *lttng_krp;
+ char *symbol_name;
+ } kretprobe;
+ struct {
+ enum lttng_syscall_entryexit entryexit;
+ enum lttng_syscall_abi abi;
+ struct hlist_node node; /* chain registered syscall event_notifier */
+ unsigned int syscall_id;
+ } syscall;
+ } u;
+};
+
+struct lttng_kernel_event_recorder_private {
+ struct lttng_kernel_event_common_private parent;
+
+ struct lttng_kernel_event_recorder *pub; /* Public event interface */
+ struct list_head node; /* Event recorder list */
+ struct hlist_node hlist; /* Hash table of event recorders */
+ struct lttng_kernel_ctx *ctx;
+ unsigned int id;
+ unsigned int metadata_dumped:1;
+};
+
+struct lttng_kernel_event_notifier_private {
+ struct lttng_kernel_event_common_private parent;
+
+ struct lttng_kernel_event_notifier *pub; /* Public event notifier interface */
+ struct lttng_event_notifier_group *group; /* weak ref */
+ size_t num_captures; /* Needed to allocate the msgpack array. */
+ uint64_t error_counter_index;
+ struct list_head node; /* Event notifier list */
+ struct hlist_node hlist; /* Hash table of event notifiers */
+ struct list_head capture_bytecode_runtime_head;
+
+};
+
static inline
const struct lttng_kernel_type_integer *lttng_kernel_get_type_integer(const struct lttng_kernel_type_common *type)
{
};
struct lttng_probe_ctx {
- struct lttng_event *event;
- struct lttng_event_notifier *event_notifier; // Not sure if we will ever need it.
+ struct lttng_kernel_event_recorder *event;
+ struct lttng_kernel_event_notifier *event_notifier; // Not sure if we will ever need it.
uint8_t interruptible;
};
struct lttng_uprobe_handler {
union {
- struct lttng_event *event;
- struct lttng_event_notifier *event_notifier;
+ struct lttng_kernel_event_recorder *event;
+ struct lttng_kernel_event_notifier *event_notifier;
} u;
loff_t offset;
struct uprobe_consumer up_consumer;
LTTNG_SYSCALL_ABI_COMPAT,
};
-/*
- * lttng_event structure is referred to by the tracing fast path. It must be
- * kept small.
- */
-struct lttng_event {
- unsigned int id;
- struct lttng_channel *chan;
+struct lttng_kernel_event_common_private;
+
+enum lttng_kernel_event_type {
+ LTTNG_KERNEL_EVENT_TYPE_RECORDER = 0,
+ LTTNG_KERNEL_EVENT_TYPE_NOTIFIER = 1,
+};
+
+struct lttng_kernel_event_common {
+ struct lttng_kernel_event_common_private *priv; /* Private event interface */
+
+ enum lttng_kernel_event_type type;
+ /* Get child with container_of(). */
+
int enabled;
- const struct lttng_kernel_event_desc *desc;
- void *filter;
- struct lttng_kernel_ctx *ctx;
- enum lttng_kernel_abi_instrumentation instrumentation;
- union {
- struct lttng_kprobe kprobe;
- struct {
- struct lttng_krp *lttng_krp;
- char *symbol_name;
- } kretprobe;
- struct lttng_uprobe uprobe;
- struct {
- enum lttng_syscall_entryexit entryexit;
- enum lttng_syscall_abi abi;
- struct hlist_node node; /* chain registered syscall event */
- } syscall;
- } u;
- struct list_head list; /* Event list in session */
- unsigned int metadata_dumped:1;
-
- /* Backward references: list of lttng_enabler_ref (ref to enablers) */
- struct list_head enablers_ref_head;
- struct hlist_node hlist; /* session ht of events */
- int registered; /* has reg'd tracepoint probe */
- /* list of struct lttng_bytecode_runtime, sorted by seqnum */
- struct list_head filter_bytecode_runtime_head;
- int has_enablers_without_bytecode;
+ int eval_filter; /* Need to evaluate filters */
+ int (*run_filter)(struct lttng_kernel_event_common *event,
+ const char *stack_data,
+ void *filter_ctx);
};
-struct lttng_kernel_notifier_ctx {
- int eval_capture;
+struct lttng_kernel_event_recorder_private;
+
+struct lttng_kernel_event_recorder {
+ struct lttng_kernel_event_common parent;
+ struct lttng_kernel_event_recorder_private *priv; /* Private event record interface */
+
+ struct lttng_channel *chan;
};
-// FIXME: Really similar to lttng_event above. Could those be merged ?
-struct lttng_event_notifier {
- uint64_t user_token;
- uint64_t error_counter_index;
- int enabled;
- int registered; /* has reg'd tracepoint probe */
- const struct lttng_kernel_event_desc *desc;
- void *filter;
- struct list_head list; /* event_notifier list in event_notifier group */
+struct lttng_kernel_notification_ctx {
+ int eval_capture; /* Capture evaluation available. */
+};
- enum lttng_kernel_abi_instrumentation instrumentation;
- union {
- struct lttng_kprobe kprobe;
- struct lttng_uprobe uprobe;
- struct {
- enum lttng_syscall_entryexit entryexit;
- enum lttng_syscall_abi abi;
- struct hlist_node node; /* chain registered syscall event_notifier */
- unsigned int syscall_id;
- } syscall;
+struct lttng_kernel_event_notifier_private;
- } u;
+struct lttng_kernel_event_notifier {
+ struct lttng_kernel_event_common parent;
+ struct lttng_kernel_event_notifier_private *priv; /* Private event notifier interface */
- /* Backward references: list of lttng_enabler_ref (ref to enablers) */
- struct list_head enablers_ref_head;
- struct hlist_node hlist; /* session ht of event_notifiers */
- /* list of struct lttng_bytecode_runtime, sorted by seqnum */
- struct list_head filter_bytecode_runtime_head;
- size_t num_captures;
- struct list_head capture_bytecode_runtime_head;
- int has_enablers_without_bytecode;
- int eval_capture; /* Should evaluate capture */
-
- void (*send_notification)(struct lttng_event_notifier *event_notifier,
- struct lttng_probe_ctx *lttng_probe_ctx,
- const char *interpreter_stack_data,
- struct lttng_kernel_notifier_ctx *notif_ctx);
- struct lttng_event_notifier_group *group; /* Weak ref */
+ int eval_capture; /* Need to evaluate capture */
+ void (*notification_send)(struct lttng_kernel_event_notifier *event_notifier,
+ struct lttng_probe_ctx *probe_ctx,
+ const char *stack_data,
+ struct lttng_kernel_notification_ctx *notif_ctx);
};
enum lttng_enabler_format_type {
struct lttng_enabler base;
struct list_head node; /* per-session list of enablers */
struct lttng_channel *chan;
- /*
- * Unused, but kept around to make it explicit that the tracer can do
- * it.
- */
- struct lttng_kernel_ctx *ctx;
};
struct lttng_event_notifier_enabler {
struct lib_ring_buffer *buf; /* Ring buffer for event notifier group. */
wait_queue_head_t read_wait;
struct irq_work wakeup_pending; /* Pending wakeup irq work. */
- struct lttng_event_notifier *sc_unknown; /* for unknown syscalls */
- struct lttng_event_notifier *sc_compat_unknown;
+ struct lttng_kernel_event_notifier *sc_unknown; /* for unknown syscalls */
+ struct lttng_kernel_event_notifier *sc_compat_unknown;
struct lttng_syscall_filter *sc_filter;
unsigned int read_timer_interval);
void lttng_metadata_channel_destroy(struct lttng_channel *chan);
-struct lttng_event *lttng_event_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan,
struct lttng_kernel_abi_event *event_param,
- void *filter,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype);
-struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan,
struct lttng_kernel_abi_event *event_param,
- void *filter,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype);
-struct lttng_event *lttng_event_compat_old_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_channel *chan,
struct lttng_kernel_abi_old_event *old_event_param,
- void *filter,
const struct lttng_kernel_event_desc *internal_desc);
-struct lttng_event_notifier *lttng_event_notifier_create(
+struct lttng_kernel_event_notifier *lttng_event_notifier_create(
const struct lttng_kernel_event_desc *event_notifier_desc,
uint64_t id,
uint64_t error_counter_idx,
struct lttng_event_notifier_group *event_notifier_group,
struct lttng_kernel_abi_event_notifier *event_notifier_param,
- void *filter,
enum lttng_kernel_abi_instrumentation itype);
-struct lttng_event_notifier *_lttng_event_notifier_create(
+struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
const struct lttng_kernel_event_desc *event_notifier_desc,
uint64_t id,
uint64_t error_counter_idx,
struct lttng_event_notifier_group *event_notifier_group,
struct lttng_kernel_abi_event_notifier *event_notifier_param,
- void *filter,
enum lttng_kernel_abi_instrumentation itype);
int lttng_channel_enable(struct lttng_channel *channel);
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_enable(struct lttng_kernel_event_recorder *event);
+int lttng_event_disable(struct lttng_kernel_event_recorder *event);
-int lttng_event_notifier_enable(struct lttng_event_notifier *event_notifier);
-int lttng_event_notifier_disable(struct lttng_event_notifier *event_notifier);
+int lttng_event_notifier_enable(struct lttng_kernel_event_notifier *event_notifier);
+int lttng_event_notifier_disable(struct lttng_kernel_event_notifier *event_notifier);
void lttng_transport_register(struct lttng_transport *transport);
void lttng_transport_unregister(struct lttng_transport *transport);
struct lttng_enabler *enabler);
#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
-int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, void *filter);
+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_event *event);
+ struct lttng_kernel_event_recorder *event);
int lttng_syscall_filter_disable_event(
struct lttng_channel *chan,
- struct lttng_event *event);
+ 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,
- void *filter);
-int lttng_syscals_create_matching_event_notifiers(
- struct lttng_event_notifier_enabler *event_notifier_enabler, void *filter);
+ 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_event_notifier *event_notifier);
-int lttng_syscall_filter_disable_event_notifier(struct lttng_event_notifier *event_notifier);
+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, void *filter)
+ struct lttng_event_enabler *event_enabler)
{
return -ENOSYS;
}
}
static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan,
- struct lttng_event *event);
+ struct lttng_kernel_event_recorder *event);
{
return -ENOSYS;
}
static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan,
- struct lttng_event *event);
+ struct lttng_kernel_event_recorder *event);
{
return -ENOSYS;
}
}
static inline int lttng_syscalls_register_event_notifier(
- struct lttng_event_notifier_group *group, void *filter)
+ struct lttng_event_notifier_group *group)
{
return -ENOSYS;
}
struct lttng_kernel_ctx *ctx,
struct list_head *instance_bytecode_runtime_head,
struct list_head *enabler_bytecode_runtime_head);
-void lttng_free_event_filter_runtime(struct lttng_event *event);
-void lttng_free_event_notifier_filter_runtime(struct lttng_event_notifier *event_notifier);
+void lttng_free_event_filter_runtime(struct lttng_kernel_event_recorder *event);
+void lttng_free_event_notifier_filter_runtime(struct lttng_kernel_event_notifier *event_notifier);
int lttng_probes_init(void);
const char *symbol_name,
uint64_t offset,
uint64_t addr,
- struct lttng_event *event);
-void lttng_kprobes_unregister_event(struct lttng_event *event);
-void lttng_kprobes_destroy_event_private(struct lttng_event *event);
+ struct lttng_kernel_event_recorder *event);
+void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event);
+void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *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);
+ struct lttng_kernel_event_notifier *event_notifier);
+void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
+void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier);
#else
static inline
int lttng_kprobes_register_event(const char *name,
const char *symbol_name,
uint64_t offset,
uint64_t addr,
- struct lttng_event *event)
+ struct lttng_kernel_event_recorder *event)
{
return -ENOSYS;
}
static inline
-void lttng_kprobes_unregister_event(struct lttng_event *event)
+void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event)
{
}
static inline
-void lttng_kprobes_destroy_event_private(struct lttng_event *event)
+void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event)
{
}
int lttng_kprobes_register_event_notifier(const char *symbol_name,
uint64_t offset,
uint64_t addr,
- struct lttng_event_notifier *event_notifier)
+ struct lttng_kernel_event_notifier *event_notifier)
{
return -ENOSYS;
}
static inline
-void lttng_kprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier)
+void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
{
}
static inline
-void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
+void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
{
}
#endif
-int lttng_event_add_callsite(struct lttng_event *event,
+int lttng_event_add_callsite(struct lttng_kernel_event_recorder *event,
struct lttng_kernel_abi_event_callsite __user *callsite);
-int lttng_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+int lttng_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
struct lttng_kernel_abi_event_callsite __user *callsite);
#ifdef CONFIG_UPROBES
int lttng_uprobes_register_event(const char *name,
- int fd, struct lttng_event *event);
-int lttng_uprobes_event_add_callsite(struct lttng_event *event,
+ int fd, struct lttng_kernel_event_recorder *event);
+int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_recorder *event,
struct lttng_kernel_abi_event_callsite __user *callsite);
-void lttng_uprobes_unregister_event(struct lttng_event *event);
-void lttng_uprobes_destroy_event_private(struct lttng_event *event);
+void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event);
+void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event);
int lttng_uprobes_register_event_notifier(const char *name,
- int fd, struct lttng_event_notifier *event_notifier);
-int lttng_uprobes_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+ int fd, struct lttng_kernel_event_notifier *event_notifier);
+int lttng_uprobes_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
struct lttng_kernel_abi_event_callsite __user *callsite);
-void lttng_uprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier);
-void lttng_uprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier);
+void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
+void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier);
#else
static inline
int lttng_uprobes_register_event(const char *name,
- int fd, struct lttng_event *event)
+ int fd, struct lttng_kernel_event_recorder *event)
{
return -ENOSYS;
}
static inline
-int lttng_uprobes_event_add_callsite(struct lttng_event *event,
+int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_recorder *event,
struct lttng_kernel_abi_event_callsite __user *callsite)
{
return -ENOSYS;
}
static inline
-void lttng_uprobes_unregister_event(struct lttng_event *event)
+void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event)
{
}
static inline
-void lttng_uprobes_destroy_event_private(struct lttng_event *event)
+void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event)
{
}
static inline
int lttng_uprobes_register_event_notifier(const char *name,
- int fd, struct lttng_event_notifier *event_notifier)
+ int fd, struct lttng_kernel_event_notifier *event_notifier)
{
return -ENOSYS;
}
static inline
-int lttng_uprobes_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+int lttng_uprobes_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
struct lttng_kernel_abi_event_callsite __user *callsite)
{
return -ENOSYS;
}
static inline
-void lttng_uprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier)
+void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
{
}
static inline
-void lttng_uprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
+void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
{
}
#endif
const char *symbol_name,
uint64_t offset,
uint64_t addr,
- struct lttng_event *event_entry,
- struct lttng_event *event_exit);
-void lttng_kretprobes_unregister(struct lttng_event *event);
-void lttng_kretprobes_destroy_private(struct lttng_event *event);
-int lttng_kretprobes_event_enable_state(struct lttng_event *event,
+ struct lttng_kernel_event_recorder *event_entry,
+ struct lttng_kernel_event_recorder *event_exit);
+void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event);
+void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event);
+int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_recorder *event,
int enable);
#else
static inline
const char *symbol_name,
uint64_t offset,
uint64_t addr,
- struct lttng_event *event_entry,
- struct lttng_event *event_exit)
+ struct lttng_kernel_event_recorder *event_entry,
+ struct lttng_kernel_event_recorder *event_exit)
{
return -ENOSYS;
}
static inline
-void lttng_kretprobes_unregister(struct lttng_event *event)
+void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event)
{
}
static inline
-void lttng_kretprobes_destroy_private(struct lttng_event *event)
+void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event)
{
}
static inline
-int lttng_kretprobes_event_enable_state(struct lttng_event *event,
+int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_recorder *event,
int enable)
{
return -ENOSYS;
#include <lttng/types.h>
#include <lttng/probe-user.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h> /* TODO: remove this include after refactoring is done. */
#include <lttng/tracer-core.h>
#include <lttng/tp-mempool.h>
static void __event_probe__##_name(void *__data, _proto) \
{ \
struct probe_local_vars { _locvar }; \
- struct lttng_event *__event = __data; \
+ struct lttng_kernel_event_recorder *__event_recorder = __data; \
struct lttng_probe_ctx __lttng_probe_ctx = { \
- .event = __event, \
+ .event = __event_recorder, \
.event_notifier = NULL, \
.interruptible = !irqs_disabled(), \
}; \
- struct lttng_channel *__chan = __event->chan; \
+ struct lttng_channel *__chan = __event_recorder->chan; \
struct lttng_session *__session = __chan->session; \
struct lib_ring_buffer_ctx __ctx; \
ssize_t __event_len; \
return; \
if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \
return; \
- if (unlikely(!LTTNG_READ_ONCE(__event->enabled))) \
+ if (unlikely(!LTTNG_READ_ONCE(__event_recorder->parent.enabled))) \
return; \
__lf = lttng_rcu_dereference(__session->pid_tracker.p); \
if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \
__orig_dynamic_len_offset = this_cpu_ptr(<tng_dynamic_len_stack)->offset; \
__dynamic_len_idx = __orig_dynamic_len_offset; \
_code_pre \
- if (unlikely(!list_empty(&__event->filter_bytecode_runtime_head))) { \
+ if (unlikely(!list_empty(&__event_recorder->priv->parent.filter_bytecode_runtime_head))) { \
struct lttng_bytecode_runtime *bc_runtime; \
- int __filter_record = __event->has_enablers_without_bytecode; \
+ int __filter_record = __event_recorder->priv->parent.has_enablers_without_filter_bytecode; \
\
__event_prepare_interpreter_stack__##_name(__stackvar.__filter_stack_data, \
tp_locvar, _args); \
- lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
+ lttng_list_for_each_entry_rcu(bc_runtime, &__event_recorder->priv->parent.filter_bytecode_runtime_head, node) { \
if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
__stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
__filter_record = 1; \
__event_align = __event_get_align__##_name(tp_locvar, _args); \
lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_probe_ctx, __event_len, \
__event_align, -1); \
- __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
+ __ret = __chan->ops->event_reserve(&__ctx, __event_recorder->priv->id); \
if (__ret < 0) \
goto __post; \
_fields \
static void __event_probe__##_name(void *__data) \
{ \
struct probe_local_vars { _locvar }; \
- struct lttng_event *__event = __data; \
+ struct lttng_kernel_event_recorder *__event_recorder = __data; \
struct lttng_probe_ctx __lttng_probe_ctx = { \
- .event = __event, \
+ .event = __event_recorder, \
.event_notifier = NULL, \
.interruptible = !irqs_disabled(), \
}; \
- struct lttng_channel *__chan = __event->chan; \
+ struct lttng_channel *__chan = __event_recorder->chan; \
struct lttng_session *__session = __chan->session; \
struct lib_ring_buffer_ctx __ctx; \
ssize_t __event_len; \
return; \
if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \
return; \
- if (unlikely(!LTTNG_READ_ONCE(__event->enabled))) \
+ if (unlikely(!LTTNG_READ_ONCE(__event_recorder->parent.enabled))) \
return; \
__lf = lttng_rcu_dereference(__session->pid_tracker.p); \
if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \
__orig_dynamic_len_offset = this_cpu_ptr(<tng_dynamic_len_stack)->offset; \
__dynamic_len_idx = __orig_dynamic_len_offset; \
_code_pre \
- if (unlikely(!list_empty(&__event->filter_bytecode_runtime_head))) { \
+ if (unlikely(!list_empty(&__event_recorder->priv->parent.filter_bytecode_runtime_head))) { \
struct lttng_bytecode_runtime *bc_runtime; \
- int __filter_record = __event->has_enablers_without_bytecode; \
+ int __filter_record = __event_recorder->priv->parent.has_enablers_without_filter_bytecode; \
\
__event_prepare_interpreter_stack__##_name(__stackvar.__filter_stack_data, \
tp_locvar); \
- lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
+ lttng_list_for_each_entry_rcu(bc_runtime, &__event_recorder->priv->parent.filter_bytecode_runtime_head, node) { \
if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
__stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
__filter_record = 1; \
__event_align = __event_get_align__##_name(tp_locvar); \
lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_probe_ctx, __event_len, \
__event_align, -1); \
- __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
+ __ret = __chan->ops->event_reserve(&__ctx, __event_recorder->priv->id); \
if (__ret < 0) \
goto __post; \
_fields \
static void __event_notifier_probe__##_name(void *__data, _proto) \
{ \
struct probe_local_vars { _locvar }; \
- struct lttng_event_notifier *__event_notifier = __data; \
+ struct lttng_kernel_event_notifier *__event_notifier = __data; \
struct lttng_probe_ctx __lttng_probe_ctx = { \
.event = NULL, \
.event_notifier = __event_notifier, \
struct probe_local_vars __tp_locvar; \
struct probe_local_vars *tp_locvar __attribute__((unused)) = \
&__tp_locvar; \
- struct lttng_kernel_notifier_ctx __notif_ctx; \
+ struct lttng_kernel_notification_ctx __notif_ctx; \
bool __interpreter_stack_prepared = false; \
\
- if (unlikely(!READ_ONCE(__event_notifier->enabled))) \
+ if (unlikely(!READ_ONCE(__event_notifier->parent.enabled))) \
return; \
_code_pre \
- if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) { \
+ if (unlikely(!list_empty(&__event_notifier->priv->parent.filter_bytecode_runtime_head))) { \
struct lttng_bytecode_runtime *bc_runtime; \
- int __filter_record = __event_notifier->has_enablers_without_bytecode; \
+ int __filter_record = __event_notifier->priv->parent.has_enablers_without_filter_bytecode; \
\
__event_prepare_interpreter_stack__##_name(__stackvar.__interpreter_stack_data, \
tp_locvar, _args); \
__interpreter_stack_prepared = true; \
- lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
+ lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->priv->parent.filter_bytecode_runtime_head, node) { \
if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
__stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \
__filter_record = 1; \
__stackvar.__interpreter_stack_data, \
tp_locvar, _args); \
\
- __event_notifier->send_notification(__event_notifier, \
+ __event_notifier->notification_send(__event_notifier, \
&__lttng_probe_ctx, \
__stackvar.__interpreter_stack_data, \
&__notif_ctx); \
static void __event_notifier_probe__##_name(void *__data) \
{ \
struct probe_local_vars { _locvar }; \
- struct lttng_event_notifier *__event_notifier = __data; \
+ struct lttng_kernel_event_notifier *__event_notifier = __data; \
struct lttng_probe_ctx __lttng_probe_ctx = { \
.event = NULL, \
.event_notifier = __event_notifier, \
struct probe_local_vars __tp_locvar; \
struct probe_local_vars *tp_locvar __attribute__((unused)) = \
&__tp_locvar; \
- struct lttng_kernel_notifier_ctx __notif_ctx; \
+ struct lttng_kernel_notification_ctx __notif_ctx; \
bool __interpreter_stack_prepared = false; \
\
- if (unlikely(!READ_ONCE(__event_notifier->enabled))) \
+ if (unlikely(!READ_ONCE(__event_notifier->parent.enabled))) \
return; \
_code_pre \
- if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) { \
+ if (unlikely(!list_empty(&__event_notifier->priv->parent.filter_bytecode_runtime_head))) { \
struct lttng_bytecode_runtime *bc_runtime; \
- int __filter_record = __event_notifier->has_enablers_without_bytecode; \
+ int __filter_record = __event_notifier->priv->parent.has_enablers_without_filter_bytecode; \
\
__event_prepare_interpreter_stack__##_name(__stackvar.__interpreter_stack_data, \
tp_locvar); \
__interpreter_stack_prepared = true; \
- lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
+ lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->priv->parent.filter_bytecode_runtime_head, node) { \
if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
__stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \
__filter_record = 1; \
__stackvar.__interpreter_stack_data, \
tp_locvar); \
\
- __event_notifier->send_notification(__event_notifier, \
+ __event_notifier->notification_send(__event_notifier, \
&__lttng_probe_ctx, \
__stackvar.__interpreter_stack_data, \
&__notif_ctx); \
case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
case LTTNG_KERNEL_ABI_UPROBE:
{
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder *event;
/*
* We tolerate no failure path after event creation. It
* will stay invariant for the rest of the session.
*/
- event = lttng_event_create(channel, event_param,
- NULL, NULL,
- event_param->instrumentation);
+ event = lttng_kernel_event_recorder_create(channel, event_param,
+ NULL, event_param->instrumentation);
WARN_ON_ONCE(!event);
if (IS_ERR(event)) {
ret = PTR_ERR(event);
static
long lttng_event_notifier_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- struct lttng_event_notifier *event_notifier = file->private_data;
+ struct lttng_kernel_event_notifier *event_notifier = file->private_data;
switch (cmd) {
case LTTNG_KERNEL_ABI_ENABLE:
static
int lttng_event_notifier_event_release(struct inode *inode, struct file *file)
{
- struct lttng_event_notifier *event_notifier = file->private_data;
+ struct lttng_kernel_event_notifier *event_notifier = file->private_data;
if (event_notifier)
- fput(event_notifier->group->file);
+ fput(event_notifier->priv->group->file);
return 0;
}
case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */
case LTTNG_KERNEL_ABI_UPROBE:
{
- struct lttng_event_notifier *event_notifier;
+ struct lttng_kernel_event_notifier *event_notifier;
/*
* We tolerate no failure path after event notifier creation.
event_notifier_param->event.token,
event_notifier_param->error_counter_index,
event_notifier_group,
- event_notifier_param, NULL,
+ event_notifier_param,
event_notifier_param->event.instrumentation);
WARN_ON_ONCE(!event_notifier);
if (IS_ERR(event_notifier)) {
static
long lttng_event_recorder_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- struct lttng_event *event = file->private_data;
+ struct lttng_kernel_event_recorder *event = file->private_data;
switch (cmd) {
case LTTNG_KERNEL_ABI_OLD_CONTEXT:
static
int lttng_event_recorder_event_release(struct inode *inode, struct file *file)
{
- struct lttng_event *event = file->private_data;
+ struct lttng_kernel_event_recorder *event = file->private_data;
if (event)
fput(event->chan->file);
}
}
-void lttng_free_event_filter_runtime(struct lttng_event *event)
+void lttng_free_event_filter_runtime(struct lttng_kernel_event_recorder *event_recorder)
{
struct bytecode_runtime *runtime, *tmp;
list_for_each_entry_safe(runtime, tmp,
- &event->filter_bytecode_runtime_head, p.node) {
+ &event_recorder->priv->parent.filter_bytecode_runtime_head, p.node) {
kfree(runtime->data);
kfree(runtime);
}
}
-void lttng_free_event_notifier_filter_runtime(struct lttng_event_notifier *event_notifier)
+void lttng_free_event_notifier_filter_runtime(struct lttng_kernel_event_notifier *event_notifier)
{
struct bytecode_runtime *runtime, *tmp;
list_for_each_entry_safe(runtime, tmp,
- &event_notifier->filter_bytecode_runtime_head, p.node) {
+ &event_notifier->priv->parent.filter_bytecode_runtime_head, p.node) {
kfree(runtime->data);
kfree(runtime);
}
static
int notification_init(struct lttng_event_notifier_notification *notif,
- struct lttng_event_notifier *event_notifier)
+ struct lttng_kernel_event_notifier *event_notifier)
{
struct lttng_msgpack_writer *writer = ¬if->writer;
int ret = 0;
notif->has_captures = false;
- if (event_notifier->num_captures > 0) {
+ if (event_notifier->priv->num_captures > 0) {
lttng_msgpack_writer_init(writer, notif->capture_buf,
CAPTURE_BUFFER_SIZE);
- ret = lttng_msgpack_begin_array(writer, event_notifier->num_captures);
+ ret = lttng_msgpack_begin_array(writer, event_notifier->priv->num_captures);
if (ret) {
WARN_ON_ONCE(1);
goto end;
}
static
-void record_error(struct lttng_event_notifier *event_notifier)
+void record_error(struct lttng_kernel_event_notifier *event_notifier)
{
- struct lttng_event_notifier_group *event_notifier_group = event_notifier->group;
+ struct lttng_event_notifier_group *event_notifier_group = event_notifier->priv->group;
struct lttng_counter *error_counter;
size_t dimension_index[1];
int ret;
if (!error_counter)
return;
- dimension_index[0] = event_notifier->error_counter_index;
+ dimension_index[0] = event_notifier->priv->error_counter_index;
ret = error_counter->ops->counter_add(error_counter->counter,
dimension_index, 1);
static
void notification_send(struct lttng_event_notifier_notification *notif,
- struct lttng_event_notifier *event_notifier)
+ struct lttng_kernel_event_notifier *event_notifier)
{
- struct lttng_event_notifier_group *event_notifier_group = event_notifier->group;
+ struct lttng_event_notifier_group *event_notifier_group = event_notifier->priv->group;
struct lib_ring_buffer_ctx ctx;
struct lttng_kernel_abi_event_notifier_notification kernel_notif;
size_t capture_buffer_content_len, reserve_size;
int ret;
reserve_size = sizeof(kernel_notif);
- kernel_notif.token = event_notifier->user_token;
+ kernel_notif.token = event_notifier->priv->parent.user_token;
if (notif->has_captures) {
capture_buffer_content_len = notif->writer.write_pos - notif->writer.buffer;
irq_work_queue(&event_notifier_group->wakeup_pending);
}
-void lttng_event_notifier_notification_send(struct lttng_event_notifier *event_notifier,
- struct lttng_probe_ctx *lttng_probe_ctx,
+void lttng_event_notifier_notification_send(struct lttng_kernel_event_notifier *event_notifier,
+ struct lttng_probe_ctx *probe_ctx,
const char *stack_data,
- struct lttng_kernel_notifier_ctx *notif_ctx)
+ struct lttng_kernel_notification_ctx *notif_ctx)
{
struct lttng_event_notifier_notification notif = { 0 };
int ret;
- if (unlikely(!READ_ONCE(event_notifier->enabled)))
+ if (unlikely(!READ_ONCE(event_notifier->parent.enabled)))
return;
ret = notification_init(¬if, event_notifier);
* fails, append an empty capture to the buffer.
*/
list_for_each_entry_rcu(capture_bc_runtime,
- &event_notifier->capture_bytecode_runtime_head, node) {
+ &event_notifier->priv->capture_bytecode_runtime_head, node) {
struct lttng_interpreter_output output;
- if (capture_bc_runtime->interpreter_funcs.capture(capture_bc_runtime,
- lttng_probe_ctx, stack_data, &output) & LTTNG_INTERPRETER_RECORD_FLAG)
+ if (capture_bc_runtime->interpreter_funcs.capture(capture_bc_runtime, probe_ctx,
+ stack_data, &output) & LTTNG_INTERPRETER_RECORD_FLAG)
ret = notification_append_capture(¬if, &output);
else
ret = notification_append_empty_capture(¬if);
* Protect the sessions and metadata caches.
*/
static DEFINE_MUTEX(sessions_mutex);
-static struct kmem_cache *event_cache;
+static struct kmem_cache *event_recorder_cache;
+static struct kmem_cache *event_recorder_private_cache;
static struct kmem_cache *event_notifier_cache;
+static struct kmem_cache *event_notifier_private_cache;
static void lttng_session_lazy_sync_event_enablers(struct lttng_session *session);
static void lttng_session_sync_event_enablers(struct lttng_session *session);
static void lttng_event_notifier_enabler_destroy(struct lttng_event_notifier_enabler *event_notifier_enabler);
static void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group);
-static void _lttng_event_destroy(struct lttng_event *event);
-static void _lttng_event_notifier_destroy(struct lttng_event_notifier *event_notifier);
+static void _lttng_event_destroy(struct lttng_kernel_event_recorder *event);
+static void _lttng_event_notifier_destroy(struct lttng_kernel_event_notifier *event_notifier);
static void _lttng_channel_destroy(struct lttng_channel *chan);
-static int _lttng_event_unregister(struct lttng_event *event);
-static int _lttng_event_notifier_unregister(struct lttng_event_notifier *event_notifier);
+static int _lttng_event_unregister(struct lttng_kernel_event_recorder *event);
+static int _lttng_event_notifier_unregister(struct lttng_kernel_event_notifier *event_notifier);
static
int _lttng_event_metadata_statedump(struct lttng_session *session,
struct lttng_channel *chan,
- struct lttng_event *event);
+ struct lttng_kernel_event_recorder *event);
static
int _lttng_session_metadata_statedump(struct lttng_session *session);
static
void lttng_session_destroy(struct lttng_session *session)
{
struct lttng_channel *chan, *tmpchan;
- struct lttng_event *event, *tmpevent;
+ struct lttng_kernel_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv;
struct lttng_metadata_stream *metadata_stream;
struct lttng_event_enabler *event_enabler, *tmp_event_enabler;
int ret;
ret = lttng_syscalls_unregister_channel(chan);
WARN_ON(ret);
}
- list_for_each_entry(event, &session->events, list) {
- ret = _lttng_event_unregister(event);
+ list_for_each_entry(event_recorder_priv, &session->events, node) {
+ ret = _lttng_event_unregister(event_recorder_priv->pub);
WARN_ON(ret);
}
synchronize_trace(); /* Wait for in-flight events to complete */
list_for_each_entry_safe(event_enabler, tmp_event_enabler,
&session->enablers_head, node)
lttng_event_enabler_destroy(event_enabler);
- list_for_each_entry_safe(event, tmpevent, &session->events, list)
- _lttng_event_destroy(event);
+ list_for_each_entry_safe(event_recorder_priv, tmpevent_recorder_priv, &session->events, node)
+ _lttng_event_destroy(event_recorder_priv->pub);
list_for_each_entry_safe(chan, tmpchan, &session->chan, list) {
BUG_ON(chan->channel_type == METADATA_CHANNEL);
_lttng_channel_destroy(chan);
struct lttng_event_notifier_group *event_notifier_group)
{
struct lttng_event_notifier_enabler *event_notifier_enabler, *tmp_event_notifier_enabler;
- struct lttng_event_notifier *event_notifier, *tmpevent_notifier;
+ struct lttng_kernel_event_notifier_private *event_notifier_priv, *tmpevent_notifier_priv;
int ret;
if (!event_notifier_group)
ret = lttng_syscalls_unregister_event_notifier_group(event_notifier_group);
WARN_ON(ret);
- list_for_each_entry_safe(event_notifier, tmpevent_notifier,
- &event_notifier_group->event_notifiers_head, list) {
- ret = _lttng_event_notifier_unregister(event_notifier);
+ list_for_each_entry_safe(event_notifier_priv, tmpevent_notifier_priv,
+ &event_notifier_group->event_notifiers_head, node) {
+ ret = _lttng_event_notifier_unregister(event_notifier_priv->pub);
WARN_ON(ret);
}
&event_notifier_group->enablers_head, node)
lttng_event_notifier_enabler_destroy(event_notifier_enabler);
- list_for_each_entry_safe(event_notifier, tmpevent_notifier,
- &event_notifier_group->event_notifiers_head, list)
- _lttng_event_notifier_destroy(event_notifier);
+ list_for_each_entry_safe(event_notifier_priv, tmpevent_notifier_priv,
+ &event_notifier_group->event_notifiers_head, node)
+ _lttng_event_notifier_destroy(event_notifier_priv->pub);
if (event_notifier_group->error_counter) {
struct lttng_counter *error_counter = event_notifier_group->error_counter;
{
int ret = 0;
struct lttng_channel *chan;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder_private *event_recorder_priv;
struct lttng_metadata_cache *cache = session->metadata_cache;
struct lttng_metadata_stream *stream;
chan->metadata_dumped = 0;
}
- list_for_each_entry(event, &session->events, list) {
- event->metadata_dumped = 0;
+ list_for_each_entry(event_recorder_priv, &session->events, node) {
+ event_recorder_priv->metadata_dumped = 0;
}
ret = _lttng_session_metadata_statedump(session);
return ret;
}
-int lttng_event_enable(struct lttng_event *event)
+int lttng_event_enable(struct lttng_kernel_event_recorder *event_recorder)
{
+ struct lttng_kernel_event_common *event = &event_recorder->parent;
int ret = 0;
mutex_lock(&sessions_mutex);
- if (event->chan->channel_type == METADATA_CHANNEL) {
+ if (event_recorder->chan->channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
ret = -EEXIST;
goto end;
}
- switch (event->instrumentation) {
+ switch (event->priv->instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_ABI_SYSCALL:
ret = -EINVAL;
break;
case LTTNG_KERNEL_ABI_KRETPROBE:
- ret = lttng_kretprobes_event_enable_state(event, 1);
+ ret = lttng_kretprobes_event_enable_state(event_recorder, 1);
break;
case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
return ret;
}
-int lttng_event_disable(struct lttng_event *event)
+int lttng_event_disable(struct lttng_kernel_event_recorder *event_recorder)
{
+ struct lttng_kernel_event_common *event = &event_recorder->parent;
int ret = 0;
mutex_lock(&sessions_mutex);
- if (event->chan->channel_type == METADATA_CHANNEL) {
+ if (event_recorder->chan->channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
ret = -EEXIST;
goto end;
}
- switch (event->instrumentation) {
+ switch (event->priv->instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_ABI_SYSCALL:
ret = -EINVAL;
case LTTNG_KERNEL_ABI_KRETPROBE:
- ret = lttng_kretprobes_event_enable_state(event, 0);
+ ret = lttng_kretprobes_event_enable_state(event_recorder, 0);
break;
case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
return ret;
}
-int lttng_event_notifier_enable(struct lttng_event_notifier *event_notifier)
+int lttng_event_notifier_enable(struct lttng_kernel_event_notifier *event_notifier)
{
+ struct lttng_kernel_event_common *event = &event_notifier->parent;
int ret = 0;
mutex_lock(&sessions_mutex);
- if (event_notifier->enabled) {
+ if (event->enabled) {
ret = -EEXIST;
goto end;
}
- switch (event_notifier->instrumentation) {
+ switch (event->priv->instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_ABI_SYSCALL:
ret = -EINVAL;
case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
case LTTNG_KERNEL_ABI_UPROBE:
- WRITE_ONCE(event_notifier->enabled, 1);
+ WRITE_ONCE(event->enabled, 1);
break;
case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
return ret;
}
-int lttng_event_notifier_disable(struct lttng_event_notifier *event_notifier)
+int lttng_event_notifier_disable(struct lttng_kernel_event_notifier *event_notifier)
{
+ struct lttng_kernel_event_common *event = &event_notifier->parent;
int ret = 0;
mutex_lock(&sessions_mutex);
- if (!event_notifier->enabled) {
+ if (!event->enabled) {
ret = -EEXIST;
goto end;
}
- switch (event_notifier->instrumentation) {
+ switch (event->priv->instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_ABI_SYSCALL:
ret = -EINVAL;
case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
case LTTNG_KERNEL_ABI_UPROBE:
- WRITE_ONCE(event_notifier->enabled, 0);
+ WRITE_ONCE(event->enabled, 0);
break;
case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
* Supports event creation while tracing session is active.
* Needs to be called with sessions mutex held.
*/
-struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan,
struct lttng_kernel_abi_event *event_param,
- void *filter,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype)
{
struct lttng_session *session = chan->session;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder *event_recorder;
+ struct lttng_kernel_event_recorder_private *event_recorder_priv;
const char *event_name;
struct hlist_head *head;
int ret;
head = utils_borrow_hash_table_bucket(session->events_ht.table,
LTTNG_EVENT_HT_SIZE, event_name);
- lttng_hlist_for_each_entry(event, head, hlist) {
- WARN_ON_ONCE(!event->desc);
- if (!strncmp(event->desc->event_name, event_name,
+ lttng_hlist_for_each_entry(event_recorder_priv, head, hlist) {
+ WARN_ON_ONCE(!event_recorder_priv->parent.desc);
+ if (!strncmp(event_recorder_priv->parent.desc->event_name, event_name,
LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1)
- && chan == event->chan) {
+ && chan == event_recorder_priv->pub->chan) {
ret = -EEXIST;
goto exist;
}
}
- event = kmem_cache_zalloc(event_cache, GFP_KERNEL);
- if (!event) {
+ event_recorder = kmem_cache_zalloc(event_recorder_cache, GFP_KERNEL);
+ if (!event_recorder) {
ret = -ENOMEM;
goto cache_error;
}
- event->chan = chan;
- event->filter = filter;
- event->id = chan->free_event_id++;
- event->instrumentation = itype;
- INIT_LIST_HEAD(&event->filter_bytecode_runtime_head);
- INIT_LIST_HEAD(&event->enablers_ref_head);
+ event_recorder_priv = kmem_cache_zalloc(event_recorder_private_cache, GFP_KERNEL);
+ if (!event_recorder_priv) {
+ ret = -ENOMEM;
+ goto cache_private_error;
+ }
+ event_recorder_priv->pub = event_recorder;
+ event_recorder_priv->parent.pub = &event_recorder->parent;
+ event_recorder->priv = event_recorder_priv;
+ event_recorder->parent.priv = &event_recorder_priv->parent;
+ event_recorder->parent.type = LTTNG_KERNEL_EVENT_TYPE_RECORDER;
+
+ event_recorder->chan = chan;
+ event_recorder->priv->id = chan->free_event_id++;
+ event_recorder->priv->parent.instrumentation = itype;
+ INIT_LIST_HEAD(&event_recorder->priv->parent.filter_bytecode_runtime_head);
+ INIT_LIST_HEAD(&event_recorder->priv->parent.enablers_ref_head);
switch (itype) {
case LTTNG_KERNEL_ABI_TRACEPOINT:
/* Event will be enabled by enabler sync. */
- event->enabled = 0;
- event->registered = 0;
- event->desc = lttng_event_desc_get(event_name);
- if (!event->desc) {
+ event_recorder->parent.enabled = 0;
+ event_recorder->priv->parent.registered = 0;
+ event_recorder->priv->parent.desc = lttng_event_desc_get(event_name);
+ if (!event_recorder->priv->parent.desc) {
ret = -ENOENT;
goto register_error;
}
* Needs to be explicitly enabled after creation, since
* we may want to apply filters.
*/
- event->enabled = 0;
- event->registered = 1;
+ event_recorder->parent.enabled = 0;
+ event_recorder->priv->parent.registered = 1;
/*
* Populate lttng_event structure before event
* registration.
event_param->u.kprobe.symbol_name,
event_param->u.kprobe.offset,
event_param->u.kprobe.addr,
- event);
+ event_recorder);
if (ret) {
ret = -EINVAL;
goto register_error;
}
- ret = try_module_get(event->desc->owner);
+ ret = try_module_get(event_recorder->priv->parent.desc->owner);
WARN_ON_ONCE(!ret);
break;
case LTTNG_KERNEL_ABI_KRETPROBE:
{
- struct lttng_event *event_return;
+ struct lttng_kernel_event_recorder *event_recorder_return;
+ struct lttng_kernel_event_recorder_private *event_recorder_return_priv;
/* kretprobe defines 2 events */
/*
* Needs to be explicitly enabled after creation, since
* we may want to apply filters.
*/
- event->enabled = 0;
- event->registered = 1;
- event_return =
- kmem_cache_zalloc(event_cache, GFP_KERNEL);
- if (!event_return) {
+ event_recorder->parent.enabled = 0;
+ event_recorder->priv->parent.registered = 1;
+
+ event_recorder_return = kmem_cache_zalloc(event_recorder_cache, GFP_KERNEL);
+ if (!event_recorder_return) {
+ ret = -ENOMEM;
+ goto register_error;
+ }
+ event_recorder_return_priv = kmem_cache_zalloc(event_recorder_private_cache, GFP_KERNEL);
+ if (!event_recorder_return_priv) {
+ kmem_cache_free(event_recorder_cache, event_recorder_return);
ret = -ENOMEM;
goto register_error;
}
- event_return->chan = chan;
- event_return->filter = filter;
- event_return->id = chan->free_event_id++;
- event_return->enabled = 0;
- event_return->registered = 1;
- event_return->instrumentation = itype;
- INIT_LIST_HEAD(&event_return->filter_bytecode_runtime_head);
- INIT_LIST_HEAD(&event_return->enablers_ref_head);
+ event_recorder_return_priv->pub = event_recorder_return;
+ event_recorder_return_priv->parent.pub = &event_recorder_return->parent;
+ event_recorder_return->priv = event_recorder_return_priv;
+ event_recorder_return->parent.priv = &event_recorder_return_priv->parent;
+ event_recorder_return->parent.type = LTTNG_KERNEL_EVENT_TYPE_RECORDER;
+
+ event_recorder_return->chan = chan;
+ event_recorder_return->priv->id = chan->free_event_id++;
+ event_recorder_return->priv->parent.instrumentation = itype;
+ event_recorder_return->parent.enabled = 0;
+ event_recorder_return->priv->parent.registered = 1;
+ INIT_LIST_HEAD(&event_recorder_return->priv->parent.filter_bytecode_runtime_head);
+ INIT_LIST_HEAD(&event_recorder_return->priv->parent.enablers_ref_head);
/*
* Populate lttng_event structure before kretprobe registration.
*/
event_param->u.kretprobe.symbol_name,
event_param->u.kretprobe.offset,
event_param->u.kretprobe.addr,
- event, event_return);
+ event_recorder, event_recorder_return);
if (ret) {
- kmem_cache_free(event_cache, event_return);
+ kmem_cache_free(event_recorder_private_cache, event_recorder_return_priv);
+ kmem_cache_free(event_recorder_cache, event_recorder_return);
ret = -EINVAL;
goto register_error;
}
/* Take 2 refs on the module: one per event. */
- ret = try_module_get(event->desc->owner);
+ ret = try_module_get(event_recorder->priv->parent.desc->owner);
WARN_ON_ONCE(!ret);
- ret = try_module_get(event->desc->owner);
+ ret = try_module_get(event_recorder_return->priv->parent.desc->owner);
WARN_ON_ONCE(!ret);
ret = _lttng_event_metadata_statedump(chan->session, chan,
- event_return);
+ event_recorder_return);
WARN_ON_ONCE(ret > 0);
if (ret) {
- kmem_cache_free(event_cache, event_return);
- module_put(event->desc->owner);
- module_put(event->desc->owner);
+ kmem_cache_free(event_recorder_private_cache, event_recorder_return_priv);
+ kmem_cache_free(event_recorder_cache, event_recorder_return);
+ module_put(event_recorder_return->priv->parent.desc->owner);
+ module_put(event_recorder->priv->parent.desc->owner);
goto statedump_error;
}
- list_add(&event_return->list, &chan->session->events);
+ list_add(&event_recorder_return->priv->node, &chan->session->events);
break;
}
* Needs to be explicitly enabled after creation, since
* we may want to apply filters.
*/
- event->enabled = 0;
- event->registered = 0;
- event->desc = event_desc;
+ event_recorder->parent.enabled = 0;
+ event_recorder->priv->parent.registered = 0;
+ event_recorder->priv->parent.desc = event_desc;
switch (event_param->u.syscall.entryexit) {
case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
ret = -EINVAL;
goto register_error;
case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
- event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
+ event_recorder->priv->parent.u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
break;
case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
- event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
+ event_recorder->priv->parent.u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
break;
}
switch (event_param->u.syscall.abi) {
ret = -EINVAL;
goto register_error;
case LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE:
- event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
+ event_recorder->priv->parent.u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
break;
case LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT:
- event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
+ event_recorder->priv->parent.u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
break;
}
- if (!event->desc) {
+ if (!event_recorder->priv->parent.desc) {
ret = -EINVAL;
goto register_error;
}
* Needs to be explicitly enabled after creation, since
* we may want to apply filters.
*/
- event->enabled = 0;
- event->registered = 1;
+ event_recorder->parent.enabled = 0;
+ event_recorder->priv->parent.registered = 1;
/*
* Populate lttng_event structure before event
ret = lttng_uprobes_register_event(event_param->name,
event_param->u.uprobe.fd,
- event);
+ event_recorder);
if (ret)
goto register_error;
- ret = try_module_get(event->desc->owner);
+ ret = try_module_get(event_recorder->priv->parent.desc->owner);
WARN_ON_ONCE(!ret);
break;
ret = -EINVAL;
goto register_error;
}
- ret = _lttng_event_metadata_statedump(chan->session, chan, event);
+ ret = _lttng_event_metadata_statedump(chan->session, chan, event_recorder);
WARN_ON_ONCE(ret > 0);
if (ret) {
goto statedump_error;
}
- hlist_add_head(&event->hlist, head);
- list_add(&event->list, &chan->session->events);
- return event;
+ hlist_add_head(&event_recorder->priv->hlist, head);
+ list_add(&event_recorder->priv->node, &chan->session->events);
+ return event_recorder;
statedump_error:
/* If a statedump error occurs, events will not be readable. */
register_error:
- kmem_cache_free(event_cache, event);
+ kmem_cache_free(event_recorder_private_cache, event_recorder_priv);
+cache_private_error:
+ kmem_cache_free(event_recorder_cache, event_recorder);
cache_error:
exist:
type_error:
return ERR_PTR(ret);
}
-struct lttng_event_notifier *_lttng_event_notifier_create(
+struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
const struct lttng_kernel_event_desc *event_desc,
uint64_t token, uint64_t error_counter_index,
struct lttng_event_notifier_group *event_notifier_group,
struct lttng_kernel_abi_event_notifier *event_notifier_param,
- void *filter, enum lttng_kernel_abi_instrumentation itype)
+ enum lttng_kernel_abi_instrumentation itype)
{
- struct lttng_event_notifier *event_notifier;
+ struct lttng_kernel_event_notifier *event_notifier;
+ struct lttng_kernel_event_notifier_private *event_notifier_priv;
struct lttng_counter *error_counter;
const char *event_name;
struct hlist_head *head;
head = utils_borrow_hash_table_bucket(event_notifier_group->event_notifiers_ht.table,
LTTNG_EVENT_NOTIFIER_HT_SIZE, event_name);
- lttng_hlist_for_each_entry(event_notifier, head, hlist) {
- WARN_ON_ONCE(!event_notifier->desc);
- if (!strncmp(event_notifier->desc->event_name, event_name,
+ lttng_hlist_for_each_entry(event_notifier_priv, head, hlist) {
+ WARN_ON_ONCE(!event_notifier_priv->parent.desc);
+ if (!strncmp(event_notifier_priv->parent.desc->event_name, event_name,
LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1)
- && event_notifier_group == event_notifier->group
- && token == event_notifier->user_token) {
+ && event_notifier_group == event_notifier_priv->group
+ && token == event_notifier_priv->parent.user_token) {
ret = -EEXIST;
goto exist;
}
ret = -ENOMEM;
goto cache_error;
}
-
- event_notifier->group = event_notifier_group;
- event_notifier->user_token = token;
- event_notifier->error_counter_index = error_counter_index;
- event_notifier->num_captures = 0;
- event_notifier->filter = filter;
- event_notifier->instrumentation = itype;
- event_notifier->send_notification = lttng_event_notifier_notification_send;
- INIT_LIST_HEAD(&event_notifier->filter_bytecode_runtime_head);
- INIT_LIST_HEAD(&event_notifier->capture_bytecode_runtime_head);
- INIT_LIST_HEAD(&event_notifier->enablers_ref_head);
+ event_notifier_priv = kmem_cache_zalloc(event_notifier_private_cache, GFP_KERNEL);
+ if (!event_notifier_priv) {
+ ret = -ENOMEM;
+ goto cache_private_error;
+ }
+ event_notifier_priv->pub = event_notifier;
+ event_notifier_priv->parent.pub = &event_notifier->parent;
+ event_notifier->priv = event_notifier_priv;
+ event_notifier->parent.priv = &event_notifier_priv->parent;
+ event_notifier->parent.type = LTTNG_KERNEL_EVENT_TYPE_NOTIFIER;
+
+ event_notifier->priv->group = event_notifier_group;
+ event_notifier->priv->parent.user_token = token;
+ event_notifier->priv->error_counter_index = error_counter_index;
+ event_notifier->priv->num_captures = 0;
+ event_notifier->priv->parent.instrumentation = itype;
+ event_notifier->notification_send = lttng_event_notifier_notification_send;
+ INIT_LIST_HEAD(&event_notifier->priv->parent.filter_bytecode_runtime_head);
+ INIT_LIST_HEAD(&event_notifier->priv->parent.enablers_ref_head);
+ INIT_LIST_HEAD(&event_notifier->priv->capture_bytecode_runtime_head);
switch (itype) {
case LTTNG_KERNEL_ABI_TRACEPOINT:
/* Event will be enabled by enabler sync. */
- event_notifier->enabled = 0;
- event_notifier->registered = 0;
- event_notifier->desc = lttng_event_desc_get(event_name);
- if (!event_notifier->desc) {
+ event_notifier->parent.enabled = 0;
+ event_notifier->priv->parent.registered = 0;
+ event_notifier->priv->parent.desc = lttng_event_desc_get(event_name);
+ if (!event_notifier->priv->parent.desc) {
ret = -ENOENT;
goto register_error;
}
* Needs to be explicitly enabled after creation, since
* we may want to apply filters.
*/
- event_notifier->enabled = 0;
- event_notifier->registered = 1;
+ event_notifier->parent.enabled = 0;
+ event_notifier->priv->parent.registered = 1;
/*
* Populate lttng_event_notifier structure before event
* registration.
ret = -EINVAL;
goto register_error;
}
- ret = try_module_get(event_notifier->desc->owner);
+ ret = try_module_get(event_notifier->priv->parent.desc->owner);
WARN_ON_ONCE(!ret);
break;
* Needs to be explicitly enabled after creation, since
* we may want to apply filters.
*/
- event_notifier->enabled = 0;
- event_notifier->registered = 0;
- event_notifier->desc = event_desc;
+ event_notifier->parent.enabled = 0;
+ event_notifier->priv->parent.registered = 0;
+ event_notifier->priv->parent.desc = event_desc;
switch (event_notifier_param->event.u.syscall.entryexit) {
case LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT:
ret = -EINVAL;
goto register_error;
case LTTNG_KERNEL_ABI_SYSCALL_ENTRY:
- event_notifier->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
+ event_notifier->priv->parent.u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
break;
case LTTNG_KERNEL_ABI_SYSCALL_EXIT:
- event_notifier->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
+ event_notifier->priv->parent.u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
break;
}
switch (event_notifier_param->event.u.syscall.abi) {
ret = -EINVAL;
goto register_error;
case LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE:
- event_notifier->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
+ event_notifier->priv->parent.u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
break;
case LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT:
- event_notifier->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
+ event_notifier->priv->parent.u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
break;
}
- if (!event_notifier->desc) {
+ if (!event_notifier->priv->parent.desc) {
ret = -EINVAL;
goto register_error;
}
* Needs to be explicitly enabled after creation, since
* we may want to apply filters.
*/
- event_notifier->enabled = 0;
- event_notifier->registered = 1;
+ event_notifier->parent.enabled = 0;
+ event_notifier->priv->parent.registered = 1;
/*
* Populate lttng_event_notifier structure before
event_notifier);
if (ret)
goto register_error;
- ret = try_module_get(event_notifier->desc->owner);
+ ret = try_module_get(event_notifier->priv->parent.desc->owner);
WARN_ON_ONCE(!ret);
break;
goto register_error;
}
- list_add(&event_notifier->list, &event_notifier_group->event_notifiers_head);
- hlist_add_head(&event_notifier->hlist, head);
+ list_add(&event_notifier->priv->node, &event_notifier_group->event_notifiers_head);
+ hlist_add_head(&event_notifier->priv->hlist, head);
/*
* Clear the error counter bucket. The sessiond keeps track of which
/*
* Check that the index is within the boundary of the counter.
*/
- if (event_notifier->error_counter_index >= event_notifier_group->error_counter_len) {
+ if (event_notifier->priv->error_counter_index >= event_notifier_group->error_counter_len) {
printk(KERN_INFO "LTTng: event_notifier: Error counter index out-of-bound: counter-len=%zu, index=%llu\n",
- event_notifier_group->error_counter_len, event_notifier->error_counter_index);
+ event_notifier_group->error_counter_len, event_notifier->priv->error_counter_index);
ret = -EINVAL;
goto register_error;
}
- dimension_index[0] = event_notifier->error_counter_index;
+ dimension_index[0] = event_notifier->priv->error_counter_index;
ret = error_counter->ops->counter_clear(error_counter->counter, dimension_index);
if (ret) {
printk(KERN_INFO "LTTng: event_notifier: Unable to clear error counter bucket %llu\n",
- event_notifier->error_counter_index);
+ event_notifier->priv->error_counter_index);
goto register_error;
}
}
return event_notifier;
register_error:
+ kmem_cache_free(event_notifier_private_cache, event_notifier_priv);
+cache_private_error:
kmem_cache_free(event_notifier_cache, event_notifier);
cache_error:
exist:
return counter->ops->counter_clear(counter->counter, dim_indexes);
}
-struct lttng_event *lttng_event_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan,
struct lttng_kernel_abi_event *event_param,
- void *filter,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype)
{
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder *event;
mutex_lock(&sessions_mutex);
- event = _lttng_event_create(chan, event_param, filter, event_desc,
- itype);
+ event = _lttng_kernel_event_recorder_create(chan, event_param, event_desc, itype);
mutex_unlock(&sessions_mutex);
return event;
}
-struct lttng_event_notifier *lttng_event_notifier_create(
+struct lttng_kernel_event_notifier *lttng_event_notifier_create(
const struct lttng_kernel_event_desc *event_desc,
uint64_t id, uint64_t error_counter_index,
struct lttng_event_notifier_group *event_notifier_group,
struct lttng_kernel_abi_event_notifier *event_notifier_param,
- void *filter, enum lttng_kernel_abi_instrumentation itype)
+ enum lttng_kernel_abi_instrumentation itype)
{
- struct lttng_event_notifier *event_notifier;
+ struct lttng_kernel_event_notifier *event_notifier;
mutex_lock(&sessions_mutex);
event_notifier = _lttng_event_notifier_create(event_desc, id,
error_counter_index, event_notifier_group,
- event_notifier_param, filter, itype);
+ event_notifier_param, itype);
mutex_unlock(&sessions_mutex);
return event_notifier;
}
/* Only used for tracepoints for now. */
static
-void register_event(struct lttng_event *event)
+void register_event(struct lttng_kernel_event_recorder *event_recorder)
{
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
- if (event->registered)
+ if (event_recorder->priv->parent.registered)
return;
- desc = event->desc;
- switch (event->instrumentation) {
+ desc = event_recorder->priv->parent.desc;
+ switch (event_recorder->priv->parent.instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT:
ret = lttng_wrapper_tracepoint_probe_register(desc->event_kname,
desc->probe_callback,
- event);
+ event_recorder);
break;
case LTTNG_KERNEL_ABI_SYSCALL:
- ret = lttng_syscall_filter_enable_event(event->chan, event);
+ ret = lttng_syscall_filter_enable_event(event_recorder->chan, event_recorder);
break;
case LTTNG_KERNEL_ABI_KPROBE: /* Fall-through */
WARN_ON_ONCE(1);
}
if (!ret)
- event->registered = 1;
+ event_recorder->priv->parent.registered = 1;
}
/*
* Only used internally at session destruction.
*/
-int _lttng_event_unregister(struct lttng_event *event)
+int _lttng_event_unregister(struct lttng_kernel_event_recorder *event_recorder)
{
+ struct lttng_kernel_event_common_private *event_priv = &event_recorder->priv->parent;
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
- if (!event->registered)
+ if (!event_priv->registered)
return 0;
- desc = event->desc;
- switch (event->instrumentation) {
+ desc = event_priv->desc;
+ switch (event_priv->instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT:
- ret = lttng_wrapper_tracepoint_probe_unregister(event->desc->event_kname,
- event->desc->probe_callback,
- event);
+ ret = lttng_wrapper_tracepoint_probe_unregister(event_priv->desc->event_kname,
+ event_priv->desc->probe_callback,
+ event_recorder);
break;
case LTTNG_KERNEL_ABI_KPROBE:
- lttng_kprobes_unregister_event(event);
+ lttng_kprobes_unregister_event(event_recorder);
ret = 0;
break;
case LTTNG_KERNEL_ABI_KRETPROBE:
- lttng_kretprobes_unregister(event);
+ lttng_kretprobes_unregister(event_recorder);
ret = 0;
break;
case LTTNG_KERNEL_ABI_SYSCALL:
- ret = lttng_syscall_filter_disable_event(event->chan, event);
+ ret = lttng_syscall_filter_disable_event(event_recorder->chan, event_recorder);
break;
case LTTNG_KERNEL_ABI_NOOP:
break;
case LTTNG_KERNEL_ABI_UPROBE:
- lttng_uprobes_unregister_event(event);
+ lttng_uprobes_unregister_event(event_recorder);
ret = 0;
break;
WARN_ON_ONCE(1);
}
if (!ret)
- event->registered = 0;
+ event_priv->registered = 0;
return ret;
}
/* Only used for tracepoints for now. */
static
-void register_event_notifier(struct lttng_event_notifier *event_notifier)
+void register_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
{
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
- if (event_notifier->registered)
+ if (event_notifier->priv->parent.registered)
return;
- desc = event_notifier->desc;
- switch (event_notifier->instrumentation) {
+ desc = event_notifier->priv->parent.desc;
+ switch (event_notifier->priv->parent.instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT:
ret = lttng_wrapper_tracepoint_probe_register(desc->event_kname,
desc->event_notifier_callback,
WARN_ON_ONCE(1);
}
if (!ret)
- event_notifier->registered = 1;
+ event_notifier->priv->parent.registered = 1;
}
static
int _lttng_event_notifier_unregister(
- struct lttng_event_notifier *event_notifier)
+ struct lttng_kernel_event_notifier *event_notifier)
{
const struct lttng_kernel_event_desc *desc;
int ret = -EINVAL;
- if (!event_notifier->registered)
+ if (!event_notifier->priv->parent.registered)
return 0;
- desc = event_notifier->desc;
- switch (event_notifier->instrumentation) {
+ desc = event_notifier->priv->parent.desc;
+ switch (event_notifier->priv->parent.instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT:
- ret = lttng_wrapper_tracepoint_probe_unregister(event_notifier->desc->event_kname,
- event_notifier->desc->event_notifier_callback,
+ ret = lttng_wrapper_tracepoint_probe_unregister(event_notifier->priv->parent.desc->event_kname,
+ event_notifier->priv->parent.desc->event_notifier_callback,
event_notifier);
break;
WARN_ON_ONCE(1);
}
if (!ret)
- event_notifier->registered = 0;
+ event_notifier->priv->parent.registered = 0;
return ret;
}
* Only used internally at session destruction.
*/
static
-void _lttng_event_destroy(struct lttng_event *event)
+void _lttng_event_destroy(struct lttng_kernel_event_recorder *event_recorder)
{
+ struct lttng_kernel_event_common_private *event_priv = &event_recorder->priv->parent;
struct lttng_enabler_ref *enabler_ref, *tmp_enabler_ref;
- switch (event->instrumentation) {
+ switch (event_priv->instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT:
- lttng_event_desc_put(event->desc);
+ lttng_event_desc_put(event_priv->desc);
break;
case LTTNG_KERNEL_ABI_KPROBE:
- module_put(event->desc->owner);
- lttng_kprobes_destroy_event_private(event);
+ module_put(event_priv->desc->owner);
+ lttng_kprobes_destroy_event_private(event_recorder);
break;
case LTTNG_KERNEL_ABI_KRETPROBE:
- module_put(event->desc->owner);
- lttng_kretprobes_destroy_private(event);
+ module_put(event_priv->desc->owner);
+ lttng_kretprobes_destroy_private(event_recorder);
break;
case LTTNG_KERNEL_ABI_SYSCALL:
break;
case LTTNG_KERNEL_ABI_UPROBE:
- module_put(event->desc->owner);
- lttng_uprobes_destroy_event_private(event);
+ module_put(event_priv->desc->owner);
+ lttng_uprobes_destroy_event_private(event_recorder);
break;
case LTTNG_KERNEL_ABI_FUNCTION: /* Fall-through */
default:
WARN_ON_ONCE(1);
}
- list_del(&event->list);
- lttng_kernel_destroy_context(event->ctx);
- lttng_free_event_filter_runtime(event);
+ list_del(&event_recorder->priv->node);
+ lttng_free_event_filter_runtime(event_recorder);
/* Free event enabler refs */
list_for_each_entry_safe(enabler_ref, tmp_enabler_ref,
- &event->enablers_ref_head, node)
+ &event_priv->enablers_ref_head, node)
kfree(enabler_ref);
- kmem_cache_free(event_cache, event);
+ kmem_cache_free(event_recorder_private_cache, event_recorder->priv);
+ kmem_cache_free(event_recorder_cache, event_recorder);
}
/*
* Only used internally at session destruction.
*/
static
-void _lttng_event_notifier_destroy(struct lttng_event_notifier *event_notifier)
+void _lttng_event_notifier_destroy(struct lttng_kernel_event_notifier *event_notifier)
{
struct lttng_enabler_ref *enabler_ref, *tmp_enabler_ref;
- switch (event_notifier->instrumentation) {
+ switch (event_notifier->priv->parent.instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT:
- lttng_event_desc_put(event_notifier->desc);
+ lttng_event_desc_put(event_notifier->priv->parent.desc);
break;
case LTTNG_KERNEL_ABI_KPROBE:
- module_put(event_notifier->desc->owner);
+ module_put(event_notifier->priv->parent.desc->owner);
lttng_kprobes_destroy_event_notifier_private(event_notifier);
break;
break;
case LTTNG_KERNEL_ABI_UPROBE:
- module_put(event_notifier->desc->owner);
+ module_put(event_notifier->priv->parent.desc->owner);
lttng_uprobes_destroy_event_notifier_private(event_notifier);
break;
default:
WARN_ON_ONCE(1);
}
- list_del(&event_notifier->list);
+ list_del(&event_notifier->priv->node);
lttng_free_event_notifier_filter_runtime(event_notifier);
/* Free event enabler refs */
list_for_each_entry_safe(enabler_ref, tmp_enabler_ref,
- &event_notifier->enablers_ref_head, node)
+ &event_notifier->priv->parent.enablers_ref_head, node)
kfree(enabler_ref);
+ kmem_cache_free(event_notifier_private_cache, event_notifier->priv);
kmem_cache_free(event_notifier_cache, event_notifier);
}
static
int lttng_event_enabler_match_event(struct lttng_event_enabler *event_enabler,
- struct lttng_event *event)
+ struct lttng_kernel_event_recorder *event_recorder)
{
struct lttng_enabler *base_enabler = lttng_event_enabler_as_enabler(
event_enabler);
- if (base_enabler->event_param.instrumentation != event->instrumentation)
+ if (base_enabler->event_param.instrumentation != event_recorder->priv->parent.instrumentation)
return 0;
- if (lttng_desc_match_enabler(event->desc, base_enabler)
- && event->chan == event_enabler->chan)
+ if (lttng_desc_match_enabler(event_recorder->priv->parent.desc, base_enabler)
+ && event_recorder->chan == event_enabler->chan)
return 1;
else
return 0;
static
int lttng_event_notifier_enabler_match_event_notifier(struct lttng_event_notifier_enabler *event_notifier_enabler,
- struct lttng_event_notifier *event_notifier)
+ struct lttng_kernel_event_notifier *event_notifier)
{
struct lttng_enabler *base_enabler = lttng_event_notifier_enabler_as_enabler(
event_notifier_enabler);
- if (base_enabler->event_param.instrumentation != event_notifier->instrumentation)
+ if (base_enabler->event_param.instrumentation != event_notifier->priv->parent.instrumentation)
return 0;
- if (lttng_desc_match_enabler(event_notifier->desc, base_enabler)
- && event_notifier->group == event_notifier_enabler->group
- && event_notifier->user_token == event_notifier_enabler->base.user_token)
+ if (lttng_desc_match_enabler(event_notifier->priv->parent.desc, base_enabler)
+ && event_notifier->priv->group == event_notifier_enabler->group
+ && event_notifier->priv->parent.user_token == event_notifier_enabler->base.user_token)
return 1;
else
return 0;
for (i = 0; i < probe_desc->nr_events; i++) {
int found = 0;
struct hlist_head *head;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder_private *event_recorder_private;
+ struct lttng_kernel_event_recorder *event_recorder;
desc = probe_desc->event_desc[i];
if (!lttng_desc_match_enabler(desc,
head = utils_borrow_hash_table_bucket(
session->events_ht.table, LTTNG_EVENT_HT_SIZE,
desc->event_name);
- lttng_hlist_for_each_entry(event, head, hlist) {
- if (event->desc == desc
- && event->chan == event_enabler->chan)
+ lttng_hlist_for_each_entry(event_recorder_private, head, hlist) {
+ if (event_recorder_private->parent.desc == desc
+ && event_recorder_private->pub->chan == event_enabler->chan)
found = 1;
}
if (found)
* We need to create an event for this
* event probe.
*/
- event = _lttng_event_create(event_enabler->chan,
- NULL, NULL, desc,
- LTTNG_KERNEL_ABI_TRACEPOINT);
- if (!event) {
+ event_recorder = _lttng_kernel_event_recorder_create(event_enabler->chan,
+ NULL, desc, LTTNG_KERNEL_ABI_TRACEPOINT);
+ if (!event_recorder) {
printk(KERN_INFO "LTTng: Unable to create event %s\n",
probe_desc->event_desc[i]->event_name);
}
for (i = 0; i < probe_desc->nr_events; i++) {
int found = 0;
struct hlist_head *head;
- struct lttng_event_notifier *event_notifier;
+ struct lttng_kernel_event_notifier_private *event_notifier_priv;
+ struct lttng_kernel_event_notifier *event_notifier;
desc = probe_desc->event_desc[i];
if (!lttng_desc_match_enabler(desc,
head = utils_borrow_hash_table_bucket(
event_notifier_group->event_notifiers_ht.table,
LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->event_name);
- lttng_hlist_for_each_entry(event_notifier, head, hlist) {
- if (event_notifier->desc == desc
- && event_notifier->user_token == event_notifier_enabler->base.user_token)
+ lttng_hlist_for_each_entry(event_notifier_priv, head, hlist) {
+ if (event_notifier_priv->parent.desc == desc
+ && event_notifier_priv->parent.user_token == event_notifier_enabler->base.user_token)
found = 1;
}
if (found)
event_notifier = _lttng_event_notifier_create(desc,
event_notifier_enabler->base.user_token,
event_notifier_enabler->error_counter_index,
- event_notifier_group, NULL, NULL,
+ event_notifier_group, NULL,
LTTNG_KERNEL_ABI_TRACEPOINT);
if (IS_ERR(event_notifier)) {
printk(KERN_INFO "Unable to create event_notifier %s\n",
{
int ret;
- ret = lttng_syscalls_register_event(event_enabler, NULL);
+ ret = lttng_syscalls_register_event(event_enabler);
WARN_ON_ONCE(ret);
}
{
int ret;
- ret = lttng_syscalls_register_event_notifier(event_notifier_enabler, NULL);
+ ret = lttng_syscalls_register_event_notifier(event_notifier_enabler);
WARN_ON_ONCE(ret);
- ret = lttng_syscals_create_matching_event_notifiers(event_notifier_enabler, NULL);
+ ret = lttng_syscalls_create_matching_event_notifiers(event_notifier_enabler);
WARN_ON_ONCE(ret);
}
/*
- * Create struct lttng_event if it is missing and present in the list of
+ * Create struct lttng_kernel_event_recorder if it is missing and present in the list of
* tracepoint probes.
* Should be called with sessions mutex held.
*/
struct lttng_channel *chan = event_enabler->chan;
struct lttng_session *session = event_enabler->chan->session;
struct lttng_enabler *base_enabler = lttng_event_enabler_as_enabler(event_enabler);
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder_private *event_recorder_priv;
if (base_enabler->event_param.instrumentation == LTTNG_KERNEL_ABI_SYSCALL &&
base_enabler->event_param.u.syscall.abi == LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL &&
lttng_create_event_if_missing(event_enabler);
/* For each event matching event_enabler in session event list. */
- list_for_each_entry(event, &session->events, list) {
+ list_for_each_entry(event_recorder_priv, &session->events, node) {
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
struct lttng_enabler_ref *enabler_ref;
- if (!lttng_event_enabler_match_event(event_enabler, event))
+ if (!lttng_event_enabler_match_event(event_enabler, event_recorder))
continue;
- enabler_ref = lttng_enabler_ref(&event->enablers_ref_head,
+ enabler_ref = lttng_enabler_ref(&event_recorder_priv->parent.enablers_ref_head,
lttng_event_enabler_as_enabler(event_enabler));
if (!enabler_ref) {
/*
return -ENOMEM;
enabler_ref->ref = lttng_event_enabler_as_enabler(event_enabler);
list_add(&enabler_ref->node,
- &event->enablers_ref_head);
+ &event_recorder_priv->parent.enablers_ref_head);
}
/*
* Link filter bytecodes if not linked yet.
*/
- lttng_enabler_link_bytecode(event->desc,
+ lttng_enabler_link_bytecode(event_recorder_priv->parent.desc,
lttng_static_ctx,
- &event->filter_bytecode_runtime_head,
+ &event_recorder_priv->parent.filter_bytecode_runtime_head,
<tng_event_enabler_as_enabler(event_enabler)->filter_bytecode_head);
-
- /* TODO: merge event context. */
}
return 0;
}
/*
- * Create struct lttng_event_notifier if it is missing and present in the list of
+ * Create struct lttng_kernel_event_notifier if it is missing and present in the list of
* tracepoint probes.
* Should be called with sessions mutex held.
*/
{
struct lttng_event_notifier_group *event_notifier_group = event_notifier_enabler->group;
struct lttng_enabler *base_enabler = lttng_event_notifier_enabler_as_enabler(event_notifier_enabler);
- struct lttng_event_notifier *event_notifier;
+ struct lttng_kernel_event_notifier_private *event_notifier_priv;
if (base_enabler->event_param.instrumentation == LTTNG_KERNEL_ABI_SYSCALL &&
base_enabler->event_param.u.syscall.abi == LTTNG_KERNEL_ABI_SYSCALL_ABI_ALL &&
lttng_create_event_notifier_if_missing(event_notifier_enabler);
/* Link the created event_notifier with its associated enabler. */
- list_for_each_entry(event_notifier, &event_notifier_group->event_notifiers_head, list) {
+ list_for_each_entry(event_notifier_priv, &event_notifier_group->event_notifiers_head, node) {
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
struct lttng_enabler_ref *enabler_ref;
if (!lttng_event_notifier_enabler_match_event_notifier(event_notifier_enabler, event_notifier))
continue;
- enabler_ref = lttng_enabler_ref(&event_notifier->enablers_ref_head,
+ enabler_ref = lttng_enabler_ref(&event_notifier_priv->parent.enablers_ref_head,
lttng_event_notifier_enabler_as_enabler(event_notifier_enabler));
if (!enabler_ref) {
/*
enabler_ref->ref = lttng_event_notifier_enabler_as_enabler(
event_notifier_enabler);
list_add(&enabler_ref->node,
- &event_notifier->enablers_ref_head);
+ &event_notifier_priv->parent.enablers_ref_head);
}
/*
* Link filter bytecodes if not linked yet.
*/
- lttng_enabler_link_bytecode(event_notifier->desc,
- lttng_static_ctx, &event_notifier->filter_bytecode_runtime_head,
+ lttng_enabler_link_bytecode(event_notifier_priv->parent.desc,
+ lttng_static_ctx, &event_notifier_priv->parent.filter_bytecode_runtime_head,
<tng_event_notifier_enabler_as_enabler(event_notifier_enabler)->filter_bytecode_head);
/* Link capture bytecodes if not linked yet. */
- lttng_enabler_link_bytecode(event_notifier->desc,
- lttng_static_ctx, &event_notifier->capture_bytecode_runtime_head,
+ lttng_enabler_link_bytecode(event_notifier_priv->parent.desc,
+ lttng_static_ctx, &event_notifier_priv->capture_bytecode_runtime_head,
&event_notifier_enabler->capture_bytecode_head);
- event_notifier->num_captures = event_notifier_enabler->num_captures;
+ event_notifier_priv->num_captures = event_notifier_enabler->num_captures;
}
return 0;
}
return ret;
}
-int lttng_event_add_callsite(struct lttng_event *event,
+int lttng_event_add_callsite(struct lttng_kernel_event_recorder *event_recorder,
struct lttng_kernel_abi_event_callsite __user *callsite)
{
- switch (event->instrumentation) {
+ switch (event_recorder->priv->parent.instrumentation) {
case LTTNG_KERNEL_ABI_UPROBE:
- return lttng_uprobes_event_add_callsite(event, callsite);
+ return lttng_uprobes_event_add_callsite(event_recorder, callsite);
default:
return -EINVAL;
}
{
lttng_enabler_destroy(lttng_event_enabler_as_enabler(event_enabler));
- /* Destroy contexts */
- lttng_kernel_destroy_context(event_enabler->ctx);
-
list_del(&event_enabler->node);
kfree(event_enabler);
}
return ret;
}
-int lttng_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+int lttng_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
struct lttng_kernel_abi_event_callsite __user *callsite)
{
- switch (event_notifier->instrumentation) {
+ switch (event_notifier->priv->parent.instrumentation) {
case LTTNG_KERNEL_ABI_UPROBE:
return lttng_uprobes_event_notifier_add_callsite(event_notifier,
callsite);
void lttng_session_sync_event_enablers(struct lttng_session *session)
{
struct lttng_event_enabler *event_enabler;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder_private *event_recorder_priv;
list_for_each_entry(event_enabler, &session->enablers_head, node)
lttng_event_enabler_ref_events(event_enabler);
* and its channel and session transient states are enabled, we
* enable the event, else we disable it.
*/
- list_for_each_entry(event, &session->events, list) {
+ list_for_each_entry(event_recorder_priv, &session->events, node) {
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
struct lttng_enabler_ref *enabler_ref;
struct lttng_bytecode_runtime *runtime;
int enabled = 0, has_enablers_without_bytecode = 0;
- switch (event->instrumentation) {
+ switch (event_recorder_priv->parent.instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_ABI_SYSCALL:
/* Enable events */
list_for_each_entry(enabler_ref,
- &event->enablers_ref_head, node) {
+ &event_recorder_priv->parent.enablers_ref_head, node) {
if (enabler_ref->ref->enabled) {
enabled = 1;
break;
* intesection of session and channel transient enable
* states.
*/
- enabled = enabled && session->tstate && event->chan->tstate;
+ enabled = enabled && session->tstate && event_recorder->chan->tstate;
- WRITE_ONCE(event->enabled, enabled);
+ WRITE_ONCE(event_recorder->parent.enabled, enabled);
/*
* Sync tracepoint registration with event enabled
* state.
*/
if (enabled) {
- register_event(event);
+ register_event(event_recorder);
} else {
- _lttng_event_unregister(event);
+ _lttng_event_unregister(event_recorder);
}
/* Check if has enablers without bytecode enabled */
list_for_each_entry(enabler_ref,
- &event->enablers_ref_head, node) {
+ &event_recorder_priv->parent.enablers_ref_head, node) {
if (enabler_ref->ref->enabled
&& list_empty(&enabler_ref->ref->filter_bytecode_head)) {
has_enablers_without_bytecode = 1;
break;
}
}
- event->has_enablers_without_bytecode =
+ event_recorder_priv->parent.has_enablers_without_filter_bytecode =
has_enablers_without_bytecode;
/* Enable filters */
list_for_each_entry(runtime,
- &event->filter_bytecode_runtime_head, node)
+ &event_recorder_priv->parent.filter_bytecode_runtime_head, node)
lttng_bytecode_filter_sync_state(runtime);
}
}
void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group)
{
struct lttng_event_notifier_enabler *event_notifier_enabler;
- struct lttng_event_notifier *event_notifier;
+ struct lttng_kernel_event_notifier_private *event_notifier_priv;
list_for_each_entry(event_notifier_enabler, &event_notifier_group->enablers_head, node)
lttng_event_notifier_enabler_ref_event_notifiers(event_notifier_enabler);
* For each event_notifier, if at least one of its enablers is enabled,
* we enable the event_notifier, else we disable it.
*/
- list_for_each_entry(event_notifier, &event_notifier_group->event_notifiers_head, list) {
+ list_for_each_entry(event_notifier_priv, &event_notifier_group->event_notifiers_head, node) {
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
struct lttng_enabler_ref *enabler_ref;
struct lttng_bytecode_runtime *runtime;
int enabled = 0, has_enablers_without_bytecode = 0;
- switch (event_notifier->instrumentation) {
+ switch (event_notifier_priv->parent.instrumentation) {
case LTTNG_KERNEL_ABI_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_ABI_SYSCALL:
/* Enable event_notifiers */
list_for_each_entry(enabler_ref,
- &event_notifier->enablers_ref_head, node) {
+ &event_notifier_priv->parent.enablers_ref_head, node) {
if (enabler_ref->ref->enabled) {
enabled = 1;
break;
continue;
}
- WRITE_ONCE(event_notifier->enabled, enabled);
+ WRITE_ONCE(event_notifier->parent.enabled, enabled);
/*
* Sync tracepoint registration with event_notifier enabled
* state.
*/
if (enabled) {
- if (!event_notifier->registered)
+ if (!event_notifier_priv->parent.registered)
register_event_notifier(event_notifier);
} else {
- if (event_notifier->registered)
+ if (event_notifier_priv->parent.registered)
_lttng_event_notifier_unregister(event_notifier);
}
/* Check if has enablers without bytecode enabled */
list_for_each_entry(enabler_ref,
- &event_notifier->enablers_ref_head, node) {
+ &event_notifier_priv->parent.enablers_ref_head, node) {
if (enabler_ref->ref->enabled
&& list_empty(&enabler_ref->ref->filter_bytecode_head)) {
has_enablers_without_bytecode = 1;
break;
}
}
- event_notifier->has_enablers_without_bytecode =
+ event_notifier_priv->parent.has_enablers_without_filter_bytecode =
has_enablers_without_bytecode;
/* Enable filters */
list_for_each_entry(runtime,
- &event_notifier->filter_bytecode_runtime_head, node)
+ &event_notifier_priv->parent.filter_bytecode_runtime_head, node)
lttng_bytecode_filter_sync_state(runtime);
/* Enable captures */
list_for_each_entry(runtime,
- &event_notifier->capture_bytecode_runtime_head, node)
+ &event_notifier_priv->capture_bytecode_runtime_head, node)
lttng_bytecode_capture_sync_state(runtime);
- WRITE_ONCE(event_notifier->eval_capture, !!event_notifier->num_captures);
+ WRITE_ONCE(event_notifier->eval_capture, !!event_notifier_priv->num_captures);
}
}
static
int _lttng_fields_metadata_statedump(struct lttng_session *session,
- struct lttng_event *event)
+ struct lttng_kernel_event_recorder *event_recorder)
{
- const struct lttng_kernel_event_desc *desc = event->desc;
+ const struct lttng_kernel_event_desc *desc = event_recorder->priv->parent.desc;
int ret = 0;
int i;
static
int _lttng_event_metadata_statedump(struct lttng_session *session,
struct lttng_channel *chan,
- struct lttng_event *event)
+ struct lttng_kernel_event_recorder *event_recorder)
{
int ret = 0;
- if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
+ if (event_recorder->priv->metadata_dumped || !LTTNG_READ_ONCE(session->active))
return 0;
if (chan->channel_type == METADATA_CHANNEL)
return 0;
" name = \"%s\";\n"
" id = %u;\n"
" stream_id = %u;\n",
- event->desc->event_name,
- event->id,
- event->chan->id);
+ event_recorder->priv->parent.desc->event_name,
+ event_recorder->priv->id,
+ event_recorder->chan->id);
if (ret)
goto end;
- if (event->ctx) {
- ret = lttng_metadata_printf(session,
- " context := struct {\n");
- if (ret)
- goto end;
- }
- ret = _lttng_context_metadata_statedump(session, event->ctx);
- if (ret)
- goto end;
- if (event->ctx) {
- ret = lttng_metadata_printf(session,
- " };\n");
- if (ret)
- goto end;
- }
-
ret = lttng_metadata_printf(session,
" fields := struct {\n"
);
if (ret)
goto end;
- ret = _lttng_fields_metadata_statedump(session, event);
+ ret = _lttng_fields_metadata_statedump(session, event_recorder);
if (ret)
goto end;
if (ret)
goto end;
- event->metadata_dumped = 1;
+ event_recorder->priv->metadata_dumped = 1;
end:
lttng_metadata_end(session);
return ret;
unsigned char uuid_s[37], clock_uuid_s[BOOT_ID_LEN];
const char *product_uuid;
struct lttng_channel *chan;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder_private *event_recorder_priv;
int ret = 0;
if (!LTTNG_READ_ONCE(session->active))
goto end;
}
- list_for_each_entry(event, &session->events, list) {
- ret = _lttng_event_metadata_statedump(session, event->chan, event);
+ list_for_each_entry(event_recorder_priv, &session->events, node) {
+ ret = _lttng_event_metadata_statedump(session, event_recorder_priv->pub->chan,
+ event_recorder_priv->pub);
if (ret)
goto end;
}
ret = lttng_tracepoint_init();
if (ret)
goto error_tp;
- event_cache = KMEM_CACHE(lttng_event, 0);
- if (!event_cache) {
+ event_recorder_cache = KMEM_CACHE(lttng_kernel_event_recorder, 0);
+ if (!event_recorder_cache) {
ret = -ENOMEM;
- goto error_kmem_event;
+ goto error_kmem_event_recorder;
}
- event_notifier_cache = KMEM_CACHE(lttng_event_notifier, 0);
+ event_recorder_private_cache = KMEM_CACHE(lttng_kernel_event_recorder_private, 0);
+ if (!event_recorder_private_cache) {
+ ret = -ENOMEM;
+ goto error_kmem_event_recorder_private;
+ }
+ event_notifier_cache = KMEM_CACHE(lttng_kernel_event_notifier, 0);
if (!event_notifier_cache) {
ret = -ENOMEM;
goto error_kmem_event_notifier;
}
+ event_notifier_private_cache = KMEM_CACHE(lttng_kernel_event_notifier_private, 0);
+ if (!event_notifier_private_cache) {
+ ret = -ENOMEM;
+ goto error_kmem_event_notifier_private;
+ }
ret = lttng_abi_init();
if (ret)
goto error_abi;
error_logger:
lttng_abi_exit();
error_abi:
+ kmem_cache_destroy(event_notifier_private_cache);
+error_kmem_event_notifier_private:
kmem_cache_destroy(event_notifier_cache);
error_kmem_event_notifier:
- kmem_cache_destroy(event_cache);
-error_kmem_event:
+ kmem_cache_destroy(event_recorder_private_cache);
+error_kmem_event_recorder_private:
+ kmem_cache_destroy(event_recorder_cache);
+error_kmem_event_recorder:
lttng_tracepoint_exit();
error_tp:
lttng_context_exit();
lttng_abi_exit();
list_for_each_entry_safe(session, tmpsession, &sessions, list)
lttng_session_destroy(session);
- kmem_cache_destroy(event_cache);
+ kmem_cache_destroy(event_recorder_cache);
+ kmem_cache_destroy(event_recorder_private_cache);
kmem_cache_destroy(event_notifier_cache);
+ kmem_cache_destroy(event_notifier_private_cache);
lttng_tracepoint_exit();
lttng_context_exit();
printk(KERN_NOTICE "LTTng: Unloaded modules v%s.%s.%s%s (%s)%s%s\n",
struct lttng_client_ctx *client_ctx)
{
struct lttng_channel *lttng_chan = channel_get_private(chan);
- struct lttng_probe_ctx *lttng_probe_ctx = ctx->priv;
- struct lttng_event *event = lttng_probe_ctx->event;
size_t orig_offset = offset;
size_t padding;
}
offset += ctx_get_aligned_size(offset, lttng_chan->ctx,
client_ctx->packet_context_len);
- offset += ctx_get_aligned_size(offset, event->ctx,
- client_ctx->event_context_len);
-
*pre_header_padding = padding;
return offset - orig_offset;
}
uint32_t event_id)
{
struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
- struct lttng_probe_ctx *lttng_probe_ctx = ctx->priv;
- struct lttng_event *event = lttng_probe_ctx->event;
if (unlikely(ctx->rflags))
goto slow_path;
}
ctx_record(ctx, lttng_chan, lttng_chan->ctx);
- ctx_record(ctx, lttng_chan, event->ctx);
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
return;
uint32_t event_id)
{
struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
- struct lttng_probe_ctx *lttng_probe_ctx = ctx->priv;
- struct lttng_event *event = lttng_probe_ctx->event;
switch (lttng_chan->header_type) {
case 1: /* compact */
WARN_ON_ONCE(1);
}
ctx_record(ctx, lttng_chan, lttng_chan->ctx);
- ctx_record(ctx, lttng_chan, event->ctx);
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
}
uint32_t event_id)
{
struct lttng_channel *lttng_chan = channel_get_private(ctx->chan);
- struct lttng_probe_ctx *lttng_probe_ctx = ctx->priv;
- struct lttng_event *event = lttng_probe_ctx->event;
struct lttng_client_ctx client_ctx;
int ret, cpu;
/* Compute internal size of context structures. */
ctx_get_struct_size(lttng_chan->ctx, &client_ctx.packet_context_len, lttng_chan, ctx);
- ctx_get_struct_size(event->ctx, &client_ctx.event_context_len, lttng_chan, ctx);
switch (lttng_chan->header_type) {
case 1: /* compact */
struct pt_regs *regs, long id)
{
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- struct lttng_event *event;
+ struct lttng_kernel_event_common_private *event_priv;
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, unknown_action_list_head, u.syscall.node) {
+ lttng_hlist_for_each_entry_rcu(event_priv, unknown_action_list_head, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
if (unlikely(in_compat_syscall()))
- __event_probe__compat_syscall_entry_unknown(event, id, args);
+ __event_probe__compat_syscall_entry_unknown(event_recorder, id, args);
else
- __event_probe__syscall_entry_unknown(event, id, args);
+ __event_probe__syscall_entry_unknown(event_recorder, id, args);
}
}
struct pt_regs *regs, long id)
{
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- struct lttng_event_notifier *notifier;
+ struct lttng_kernel_event_common_private *event_priv;
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, unknown_dispatch_list_head, u.syscall.node) {
+ lttng_hlist_for_each_entry_rcu(event_priv, unknown_dispatch_list_head, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
if (unlikely(in_compat_syscall()))
- __event_notifier_probe__compat_syscall_entry_unknown(notifier, id, args);
+ __event_notifier_probe__compat_syscall_entry_unknown(event_notifier, id, args);
else
- __event_notifier_probe__syscall_entry_unknown(notifier, id, args);
+ __event_notifier_probe__syscall_entry_unknown(event_notifier, id, args);
}
}
struct pt_regs *regs, long id, long ret)
{
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- struct lttng_event_notifier *notifier;
+ struct lttng_kernel_event_common_private *event_priv;
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, unknown_dispatch_list_head, u.syscall.node) {
+ lttng_hlist_for_each_entry_rcu(event_priv, unknown_dispatch_list_head, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
if (unlikely(in_compat_syscall()))
- __event_notifier_probe__compat_syscall_exit_unknown(notifier, id, ret, args);
+ __event_notifier_probe__compat_syscall_exit_unknown(event_notifier, id, ret, args);
else
- __event_notifier_probe__syscall_exit_unknown(notifier, id, ret, args);
+ __event_notifier_probe__syscall_exit_unknown(event_notifier, id, ret, args);
}
}
void *func, unsigned int nrargs,
struct pt_regs *regs)
{
- struct lttng_event *event;
+ struct lttng_kernel_event_common_private *event_priv;
switch (nrargs) {
case 0:
{
void (*fptr)(void *__data) = func;
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder);
+ }
break;
}
case 1:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, args[0]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, args[0]);
+ }
break;
}
case 2:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, args[0], args[1]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, args[0], args[1]);
+ }
break;
}
case 3:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, args[0], args[1], args[2]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, args[0], args[1], args[2]);
+ }
break;
}
case 4:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, args[0], args[1], args[2], args[3]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, args[0], args[1], args[2], args[3]);
+ }
break;
}
case 5:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, args[0], args[1], args[2], args[3], args[4]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, args[0], args[1], args[2], args[3], args[4]);
+ }
break;
}
case 6:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, args[0], args[1], args[2],
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, args[0], args[1], args[2],
args[3], args[4], args[5]);
+ }
break;
}
default:
void syscall_entry_event_notifier_call_func(struct hlist_head *dispatch_list,
void *func, unsigned int nrargs, struct pt_regs *regs)
{
- struct lttng_event_notifier *notifier;
+ struct lttng_kernel_event_common_private *event_priv;
switch (nrargs) {
case 0:
{
void (*fptr)(void *__data) = func;
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier);
+ }
break;
}
case 1:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, args[0]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, args[0]);
+ }
break;
}
case 2:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, args[0], args[1]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, args[0], args[1]);
+ }
break;
}
case 3:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, args[0], args[1], args[2]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, args[0], args[1], args[2]);
+ }
break;
}
case 4:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, args[0], args[1], args[2], args[3]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, args[0], args[1], args[2], args[3]);
+ }
break;
}
case 5:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, args[0], args[1], args[2], args[3], args[4]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, args[0], args[1], args[2], args[3], args[4]);
+ }
break;
}
case 6:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, args[0], args[1], args[2], args[3], args[4], args[5]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, args[0], args[1], args[2], args[3], args[4], args[5]);
+ }
break;
}
default:
struct pt_regs *regs, long id, long ret)
{
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- struct lttng_event *event;
+ struct lttng_kernel_event_common_private *event_priv;
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, unknown_action_list_head, u.syscall.node) {
+ lttng_hlist_for_each_entry_rcu(event_priv, unknown_action_list_head, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
if (unlikely(in_compat_syscall()))
- __event_probe__compat_syscall_exit_unknown(event, id, ret,
+ __event_probe__compat_syscall_exit_unknown(event_recorder, id, ret,
args);
else
- __event_probe__syscall_exit_unknown(event, id, ret, args);
+ __event_probe__syscall_exit_unknown(event_recorder, id, ret, args);
}
}
void *func, unsigned int nrargs,
struct pt_regs *regs, long ret)
{
- struct lttng_event *event;
+ struct lttng_kernel_event_common_private *event_priv;
switch (nrargs) {
case 0:
{
void (*fptr)(void *__data, long ret) = func;
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, ret);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, ret);
+ }
break;
}
case 1:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, ret, args[0]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, ret, args[0]);
+ }
break;
}
case 2:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, ret, args[0], args[1]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, ret, args[0], args[1]);
+ }
break;
}
case 3:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, ret, args[0], args[1], args[2]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, ret, args[0], args[1], args[2]);
+ }
break;
}
case 4:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, ret, args[0], args[1], args[2], args[3]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, ret, args[0], args[1], args[2], args[3]);
+ }
break;
}
case 5:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, ret, args[0], args[1], args[2], args[3], args[4]);
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, ret, args[0], args[1], args[2], args[3], args[4]);
+ }
break;
}
case 6:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(event, action_list, u.syscall.node)
- fptr(event, ret, args[0], args[1], args[2],
+ lttng_hlist_for_each_entry_rcu(event_priv, action_list, u.syscall.node) {
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder = event_recorder_priv->pub;
+
+ fptr(event_recorder, ret, args[0], args[1], args[2],
args[3], args[4], args[5]);
+ }
break;
}
default:
void syscall_exit_event_notifier_call_func(struct hlist_head *dispatch_list,
void *func, unsigned int nrargs, struct pt_regs *regs, long ret)
{
- struct lttng_event_notifier *notifier;
+ struct lttng_kernel_event_common_private *event_priv;
switch (nrargs) {
case 0:
{
void (*fptr)(void *__data, long ret) = func;
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, ret);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, ret);
+ }
break;
}
case 1:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, ret, args[0]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, ret, args[0]);
+ }
break;
}
case 2:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, ret, args[0], args[1]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, ret, args[0], args[1]);
+ }
break;
}
case 3:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, ret, args[0], args[1], args[2]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, ret, args[0], args[1], args[2]);
+ }
break;
}
case 4:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, ret, args[0], args[1], args[2], args[3]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, ret, args[0], args[1], args[2], args[3]);
+ }
break;
}
case 5:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, ret, args[0], args[1], args[2], args[3], args[4]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, ret, args[0], args[1], args[2], args[3], args[4]);
+ }
break;
}
case 6:
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
lttng_syscall_get_arguments(current, regs, args);
- lttng_hlist_for_each_entry_rcu(notifier, dispatch_list, u.syscall.node)
- fptr(notifier, ret, args[0], args[1], args[2], args[3], args[4], args[5]);
+ lttng_hlist_for_each_entry_rcu(event_priv, dispatch_list, u.syscall.node) {
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier = event_notifier_priv->pub;
+
+ fptr(event_notifier, ret, args[0], args[1], args[2], args[3], args[4], args[5]);
+ }
break;
}
default:
static
int lttng_create_syscall_event_if_missing(const struct trace_syscall_entry *table, size_t table_len,
struct hlist_head *chan_table, struct lttng_event_enabler *event_enabler,
- void *filter, enum sc_type type)
+ enum sc_type type)
{
struct lttng_channel *chan = event_enabler->chan;
struct lttng_session *session = chan->session;
for (i = 0; i < table_len; i++) {
const struct lttng_kernel_event_desc *desc = table[i].desc;
struct lttng_kernel_abi_event ev;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder_private *event_recorder_priv;
+ struct lttng_kernel_event_recorder *event_recorder;
struct hlist_head *head;
bool found = false;
head = utils_borrow_hash_table_bucket(
session->events_ht.table, LTTNG_EVENT_HT_SIZE,
desc->event_name);
- lttng_hlist_for_each_entry(event, head, hlist) {
- if (event->desc == desc
- && event->chan == event_enabler->chan)
+ lttng_hlist_for_each_entry(event_recorder_priv, head, hlist) {
+ if (event_recorder_priv->parent.desc == desc
+ && event_recorder_priv->pub->chan == event_enabler->chan)
found = true;
}
if (found)
strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1);
ev.name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
- event = _lttng_event_create(chan, &ev, filter,
- desc, ev.instrumentation);
- WARN_ON_ONCE(!event);
- if (IS_ERR(event)) {
+ event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc, ev.instrumentation);
+ WARN_ON_ONCE(!event_recorder);
+ if (IS_ERR(event_recorder)) {
/*
* If something goes wrong in event registration
* after the first one, we have no choice but to
* leave the previous events in there, until
* deleted by session teardown.
*/
- return PTR_ERR(event);
+ return PTR_ERR(event_recorder);
}
- hlist_add_head(&event->u.syscall.node, &chan_table[i]);
+ hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan_table[i]);
}
return 0;
}
/*
* Should be called with sessions lock held.
*/
-int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler, void *filter)
+int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler)
{
struct lttng_channel *chan = event_enabler->chan;
struct lttng_kernel_abi_event ev;
if (!chan->sc_table) {
/* create syscall table mapping syscall to events */
- chan->sc_table = kzalloc(sizeof(struct lttng_event *)
+ chan->sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
* ARRAY_SIZE(sc_table), GFP_KERNEL);
if (!chan->sc_table)
return -ENOMEM;
}
if (!chan->sc_exit_table) {
/* create syscall table mapping syscall to events */
- chan->sc_exit_table = kzalloc(sizeof(struct lttng_event *)
+ chan->sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
* ARRAY_SIZE(sc_exit_table), GFP_KERNEL);
if (!chan->sc_exit_table)
return -ENOMEM;
#ifdef CONFIG_COMPAT
if (!chan->compat_sc_table) {
/* create syscall table mapping compat syscall to events */
- chan->compat_sc_table = kzalloc(sizeof(struct lttng_event *)
+ chan->compat_sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
* ARRAY_SIZE(compat_sc_table), GFP_KERNEL);
if (!chan->compat_sc_table)
return -ENOMEM;
if (!chan->compat_sc_exit_table) {
/* create syscall table mapping compat syscall to events */
- chan->compat_sc_exit_table = kzalloc(sizeof(struct lttng_event *)
+ chan->compat_sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
* ARRAY_SIZE(compat_sc_exit_table), GFP_KERNEL);
if (!chan->compat_sc_exit_table)
return -ENOMEM;
if (hlist_empty(&chan->sc_unknown)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___syscall_entry_unknown;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder *event_recorder;
memset(&ev, 0, sizeof(ev));
strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
ev.u.syscall.entryexit = LTTNG_KERNEL_ABI_SYSCALL_ENTRY;
ev.u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE;
- event = _lttng_event_create(chan, &ev, filter, desc,
+ event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc,
ev.instrumentation);
- WARN_ON_ONCE(!event);
- if (IS_ERR(event)) {
- return PTR_ERR(event);
+ WARN_ON_ONCE(!event_recorder);
+ if (IS_ERR(event_recorder)) {
+ return PTR_ERR(event_recorder);
}
- hlist_add_head(&event->u.syscall.node, &chan->sc_unknown);
+ hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_unknown);
}
if (hlist_empty(&chan->sc_compat_unknown)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___compat_syscall_entry_unknown;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder *event_recorder;
memset(&ev, 0, sizeof(ev));
strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
ev.u.syscall.entryexit = LTTNG_KERNEL_ABI_SYSCALL_ENTRY;
ev.u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT;
- event = _lttng_event_create(chan, &ev, filter, desc,
+ event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc,
ev.instrumentation);
- WARN_ON_ONCE(!event);
- if (IS_ERR(event)) {
- return PTR_ERR(event);
+ WARN_ON_ONCE(!event_recorder);
+ if (IS_ERR(event_recorder)) {
+ return PTR_ERR(event_recorder);
}
- hlist_add_head(&event->u.syscall.node, &chan->sc_compat_unknown);
+ hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_compat_unknown);
}
if (hlist_empty(&chan->compat_sc_exit_unknown)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___compat_syscall_exit_unknown;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder *event_recorder;
memset(&ev, 0, sizeof(ev));
strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
ev.u.syscall.entryexit = LTTNG_KERNEL_ABI_SYSCALL_EXIT;
ev.u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_COMPAT;
- event = _lttng_event_create(chan, &ev, filter, desc,
+ event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc,
ev.instrumentation);
- WARN_ON_ONCE(!event);
- if (IS_ERR(event)) {
- return PTR_ERR(event);
+ WARN_ON_ONCE(!event_recorder);
+ if (IS_ERR(event_recorder)) {
+ return PTR_ERR(event_recorder);
}
- hlist_add_head(&event->u.syscall.node, &chan->compat_sc_exit_unknown);
+ hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->compat_sc_exit_unknown);
}
if (hlist_empty(&chan->sc_exit_unknown)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___syscall_exit_unknown;
- struct lttng_event *event;
+ struct lttng_kernel_event_recorder *event_recorder;
memset(&ev, 0, sizeof(ev));
strncpy(ev.name, desc->event_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN);
ev.instrumentation = LTTNG_KERNEL_ABI_SYSCALL;
ev.u.syscall.entryexit = LTTNG_KERNEL_ABI_SYSCALL_EXIT;
ev.u.syscall.abi = LTTNG_KERNEL_ABI_SYSCALL_ABI_NATIVE;
- event = _lttng_event_create(chan, &ev, filter, desc,
+ event_recorder = _lttng_kernel_event_recorder_create(chan, &ev, desc,
ev.instrumentation);
- WARN_ON_ONCE(!event);
- if (IS_ERR(event)) {
- return PTR_ERR(event);
+ WARN_ON_ONCE(!event_recorder);
+ if (IS_ERR(event_recorder)) {
+ return PTR_ERR(event_recorder);
}
- hlist_add_head(&event->u.syscall.node, &chan->sc_exit_unknown);
+ hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_exit_unknown);
}
ret = lttng_create_syscall_event_if_missing(sc_table, ARRAY_SIZE(sc_table),
- chan->sc_table, event_enabler, filter, SC_TYPE_ENTRY);
+ chan->sc_table, event_enabler, SC_TYPE_ENTRY);
if (ret)
return ret;
ret = lttng_create_syscall_event_if_missing(sc_exit_table, ARRAY_SIZE(sc_exit_table),
- chan->sc_exit_table, event_enabler, filter, SC_TYPE_EXIT);
+ chan->sc_exit_table, event_enabler, SC_TYPE_EXIT);
if (ret)
return ret;
#ifdef CONFIG_COMPAT
ret = lttng_create_syscall_event_if_missing(compat_sc_table, ARRAY_SIZE(compat_sc_table),
- chan->compat_sc_table, event_enabler, filter,
- SC_TYPE_COMPAT_ENTRY);
+ chan->compat_sc_table, event_enabler, SC_TYPE_COMPAT_ENTRY);
if (ret)
return ret;
ret = lttng_create_syscall_event_if_missing(compat_sc_exit_table, ARRAY_SIZE(compat_sc_exit_table),
- chan->compat_sc_exit_table, event_enabler, filter,
- SC_TYPE_COMPAT_EXIT);
+ chan->compat_sc_exit_table, event_enabler, SC_TYPE_COMPAT_EXIT);
if (ret)
return ret;
#endif
* Should be called with sessions lock held.
*/
int lttng_syscalls_register_event_notifier(
- struct lttng_event_notifier_enabler *event_notifier_enabler,
- void *filter)
+ struct lttng_event_notifier_enabler *event_notifier_enabler)
{
struct lttng_event_notifier_group *group = event_notifier_enabler->group;
unsigned int i;
struct lttng_event_notifier_enabler *event_notifier_enabler,
enum sc_type type)
{
- struct lttng_event_notifier *notifier;
+ struct lttng_kernel_event_notifier_private *event_notifier_priv;
+ struct lttng_kernel_event_notifier *event_notifier;
const struct lttng_kernel_event_desc *desc;
struct lttng_event_notifier_group *group = event_notifier_enabler->group;
struct lttng_kernel_abi_event_notifier event_notifier_param;
*/
head = utils_borrow_hash_table_bucket(group->event_notifiers_ht.table,
LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->event_name);
- lttng_hlist_for_each_entry(notifier, head, hlist) {
- if (notifier->desc == desc &&
- notifier->user_token == base_enabler->user_token)
+ lttng_hlist_for_each_entry(event_notifier_priv, head, hlist) {
+ if (event_notifier_priv->parent.desc == desc &&
+ event_notifier_priv->parent.user_token == base_enabler->user_token)
found = true;
}
if (found)
event_notifier_param.event.u.syscall.abi = abi;
event_notifier_param.event.u.syscall.entryexit = entryexit;
- notifier = _lttng_event_notifier_create(desc, user_token,
- error_counter_index, group, &event_notifier_param, NULL,
+ event_notifier = _lttng_event_notifier_create(desc, user_token,
+ error_counter_index, group, &event_notifier_param,
event_notifier_param.event.instrumentation);
- if (IS_ERR(notifier)) {
+ if (IS_ERR(event_notifier)) {
printk(KERN_INFO "Unable to create unknown notifier %s\n",
desc->event_name);
ret = -ENOMEM;
goto end;
}
- hlist_add_head_rcu(¬ifier->u.syscall.node, unknown_dispatch_list);
+ hlist_add_head_rcu(&event_notifier->priv->parent.u.syscall.node, unknown_dispatch_list);
end:
return ret;
static int create_matching_event_notifiers(
struct lttng_event_notifier_enabler *event_notifier_enabler,
- void *filter, const struct trace_syscall_entry *table,
+ const struct trace_syscall_entry *table,
size_t table_len, enum sc_type type)
{
struct lttng_event_notifier_group *group = event_notifier_enabler->group;
/* iterate over all syscall and create event_notifier that match */
for (i = 0; i < table_len; i++) {
- struct lttng_event_notifier *event_notifier;
+ struct lttng_kernel_event_notifier_private *event_notifier_priv;
+ struct lttng_kernel_event_notifier *event_notifier;
struct lttng_kernel_abi_event_notifier event_notifier_param;
struct hlist_head *head;
int found = 0;
*/
head = utils_borrow_hash_table_bucket(group->event_notifiers_ht.table,
LTTNG_EVENT_NOTIFIER_HT_SIZE, desc->event_name);
- lttng_hlist_for_each_entry(event_notifier, head, hlist) {
- if (event_notifier->desc == desc
- && event_notifier->user_token == event_notifier_enabler->base.user_token)
+ lttng_hlist_for_each_entry(event_notifier_priv, head, hlist) {
+ if (event_notifier_priv->parent.desc == desc
+ && event_notifier_priv->parent.user_token == event_notifier_enabler->base.user_token)
found = 1;
}
if (found)
event_notifier = _lttng_event_notifier_create(desc, user_token,
error_counter_index, group, &event_notifier_param,
- filter, event_notifier_param.event.instrumentation);
+ event_notifier_param.event.instrumentation);
if (IS_ERR(event_notifier)) {
printk(KERN_INFO "Unable to create event_notifier %s\n",
desc->event_name);
goto end;
}
- event_notifier->u.syscall.syscall_id = i;
+ event_notifier->priv->parent.u.syscall.syscall_id = i;
}
end:
}
-int lttng_syscals_create_matching_event_notifiers(
- struct lttng_event_notifier_enabler *event_notifier_enabler,
- void *filter)
+int lttng_syscalls_create_matching_event_notifiers(
+ struct lttng_event_notifier_enabler *event_notifier_enabler)
{
int ret;
struct lttng_enabler *base_enabler =
if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRY || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT) {
ret = create_matching_event_notifiers(event_notifier_enabler,
- filter, sc_table, ARRAY_SIZE(sc_table), SC_TYPE_ENTRY);
+ sc_table, ARRAY_SIZE(sc_table), SC_TYPE_ENTRY);
if (ret)
goto end;
ret = create_matching_event_notifiers(event_notifier_enabler,
- filter, compat_sc_table, ARRAY_SIZE(compat_sc_table),
+ compat_sc_table, ARRAY_SIZE(compat_sc_table),
SC_TYPE_COMPAT_ENTRY);
if (ret)
goto end;
if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_EXIT || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT) {
ret = create_matching_event_notifiers(event_notifier_enabler,
- filter, sc_exit_table, ARRAY_SIZE(sc_exit_table),
+ sc_exit_table, ARRAY_SIZE(sc_exit_table),
SC_TYPE_EXIT);
if (ret)
goto end;
goto end;
ret = create_matching_event_notifiers(event_notifier_enabler,
- filter, compat_sc_exit_table, ARRAY_SIZE(compat_sc_exit_table),
+ compat_sc_exit_table, ARRAY_SIZE(compat_sc_exit_table),
SC_TYPE_COMPAT_EXIT);
if (ret)
goto end;
}
int lttng_syscall_filter_enable_event_notifier(
- struct lttng_event_notifier *notifier)
+ struct lttng_kernel_event_notifier *event_notifier)
{
- struct lttng_event_notifier_group *group = notifier->group;
- unsigned int syscall_id = notifier->u.syscall.syscall_id;
+ struct lttng_event_notifier_group *group = event_notifier->priv->group;
+ unsigned int syscall_id = event_notifier->priv->parent.u.syscall.syscall_id;
struct hlist_head *dispatch_list;
int ret = 0;
- WARN_ON_ONCE(notifier->instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
+ WARN_ON_ONCE(event_notifier->priv->parent.instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
ret = lttng_syscall_filter_enable(group->sc_filter,
- notifier->desc->event_name, notifier->u.syscall.abi,
- notifier->u.syscall.entryexit);
+ event_notifier->priv->parent.desc->event_name,
+ event_notifier->priv->parent.u.syscall.abi,
+ event_notifier->priv->parent.u.syscall.entryexit);
if (ret) {
goto end;
}
- switch (notifier->u.syscall.entryexit) {
+ switch (event_notifier->priv->parent.u.syscall.entryexit) {
case LTTNG_SYSCALL_ENTRY:
- switch (notifier->u.syscall.abi) {
+ switch (event_notifier->priv->parent.u.syscall.abi) {
case LTTNG_SYSCALL_ABI_NATIVE:
dispatch_list = &group->event_notifier_syscall_dispatch[syscall_id];
break;
}
break;
case LTTNG_SYSCALL_EXIT:
- switch (notifier->u.syscall.abi) {
+ switch (event_notifier->priv->parent.u.syscall.abi) {
case LTTNG_SYSCALL_ABI_NATIVE:
dispatch_list = &group->event_notifier_exit_syscall_dispatch[syscall_id];
break;
goto end;
}
- hlist_add_head_rcu(¬ifier->u.syscall.node, dispatch_list);
+ hlist_add_head_rcu(&event_notifier->priv->parent.u.syscall.node, dispatch_list);
end:
return ret ;
int lttng_syscall_filter_enable_event(
struct lttng_channel *channel,
- struct lttng_event *event)
+ struct lttng_kernel_event_recorder *event_recorder)
{
- WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
+ WARN_ON_ONCE(event_recorder->priv->parent.instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
return lttng_syscall_filter_enable(channel->sc_filter,
- event->desc->event_name, event->u.syscall.abi,
- event->u.syscall.entryexit);
+ event_recorder->priv->parent.desc->event_name,
+ event_recorder->priv->parent.u.syscall.abi,
+ event_recorder->priv->parent.u.syscall.entryexit);
}
static
}
int lttng_syscall_filter_disable_event_notifier(
- struct lttng_event_notifier *notifier)
+ struct lttng_kernel_event_notifier *event_notifier)
{
- struct lttng_event_notifier_group *group = notifier->group;
+ struct lttng_event_notifier_group *group = event_notifier->priv->group;
int ret;
- WARN_ON_ONCE(notifier->instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
+ WARN_ON_ONCE(event_notifier->priv->parent.instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
ret = lttng_syscall_filter_disable(group->sc_filter,
- notifier->desc->event_name, notifier->u.syscall.abi,
- notifier->u.syscall.entryexit);
+ event_notifier->priv->parent.desc->event_name,
+ event_notifier->priv->parent.u.syscall.abi,
+ event_notifier->priv->parent.u.syscall.entryexit);
WARN_ON_ONCE(ret != 0);
- hlist_del_rcu(¬ifier->u.syscall.node);
+ hlist_del_rcu(&event_notifier->priv->parent.u.syscall.node);
return 0;
}
int lttng_syscall_filter_disable_event(
struct lttng_channel *channel,
- struct lttng_event *event)
+ struct lttng_kernel_event_recorder *event_recorder)
{
return lttng_syscall_filter_disable(channel->sc_filter,
- event->desc->event_name, event->u.syscall.abi,
- event->u.syscall.entryexit);
+ event_recorder->priv->parent.desc->event_name,
+ event_recorder->priv->parent.u.syscall.abi,
+ event_recorder->priv->parent.u.syscall.entryexit);
}
static
#include <linux/kprobes.h>
#include <linux/slab.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/irqflags.h>
static
int lttng_kprobes_event_handler_pre(struct kprobe *p, struct pt_regs *regs)
{
- struct lttng_event *event =
- container_of(p, struct lttng_event, u.kprobe.kp);
+ struct lttng_kernel_event_common_private *event_priv =
+ container_of(p, struct lttng_kernel_event_common_private, u.kprobe.kp);
+ struct lttng_kernel_event_recorder_private *event_recorder_priv =
+ container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
+ struct lttng_kernel_event_recorder *event_recorder =
+ event_recorder_priv->pub;
struct lttng_probe_ctx lttng_probe_ctx = {
- .event = event,
+ .event = event_recorder,
.interruptible = !lttng_regs_irqs_disabled(regs),
};
- struct lttng_channel *chan = event->chan;
+ struct lttng_channel *chan = event_recorder->chan;
struct lib_ring_buffer_ctx ctx;
int ret;
unsigned long data = (unsigned long) p->addr;
return 0;
if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
return 0;
- if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
+ if (unlikely(!LTTNG_READ_ONCE(event_recorder->parent.enabled)))
return 0;
lib_ring_buffer_ctx_init(&ctx, chan->chan, <tng_probe_ctx, sizeof(data),
lttng_alignof(data), -1);
- ret = chan->ops->event_reserve(&ctx, event->id);
+ ret = chan->ops->event_reserve(&ctx, event_recorder->priv->id);
if (ret < 0)
return 0;
lib_ring_buffer_align_ctx(&ctx, lttng_alignof(data));
static
int lttng_kprobes_event_notifier_handler_pre(struct kprobe *p, struct pt_regs *regs)
{
- struct lttng_event_notifier *event_notifier =
- container_of(p, struct lttng_event_notifier, u.kprobe.kp);
- struct lttng_kernel_notifier_ctx notif_ctx;
-
- if (unlikely(!READ_ONCE(event_notifier->enabled)))
+ struct lttng_kernel_event_common_private *event_priv =
+ container_of(p, struct lttng_kernel_event_common_private, u.kprobe.kp);
+ struct lttng_kernel_event_notifier_private *event_notifier_priv =
+ container_of(event_priv, struct lttng_kernel_event_notifier_private, parent);
+ struct lttng_kernel_event_notifier *event_notifier =
+ event_notifier_priv->pub;
+ struct lttng_kernel_notification_ctx notif_ctx;
+
+ if (unlikely(!READ_ONCE(event_notifier->parent.enabled)))
return 0;
notif_ctx.eval_capture = LTTNG_READ_ONCE(event_notifier->eval_capture);
- event_notifier->send_notification(event_notifier, NULL, NULL, ¬if_ctx);
+ event_notifier->notification_send(event_notifier, NULL, NULL, ¬if_ctx);
return 0;
}
* Create event description
*/
static
-int lttng_create_kprobe_event(const char *name, struct lttng_event *event)
+int lttng_create_kprobe_event(const char *name, struct lttng_kernel_event_recorder *event_recorder)
{
const struct lttng_kernel_event_field **fieldp_array;
struct lttng_kernel_event_field *field;
field->name = "ip";
field->type = event_type;
desc->owner = THIS_MODULE;
- event->desc = desc;
+ event_recorder->priv->parent.desc = desc;
return 0;
* Create event_notifier description
*/
static
-int lttng_create_kprobe_event_notifier(const char *name, struct lttng_event_notifier *event_notifier)
+int lttng_create_kprobe_event_notifier(const char *name, struct lttng_kernel_event_notifier *event_notifier)
{
struct lttng_kernel_event_desc *desc;
int ret;
desc->nr_fields = 0;
desc->owner = THIS_MODULE;
- event_notifier->desc = desc;
+ event_notifier->priv->parent.desc = desc;
return 0;
const char *symbol_name,
uint64_t offset,
uint64_t addr,
- struct lttng_event *event)
+ struct lttng_kernel_event_recorder *event_recorder)
{
int ret;
- ret = lttng_create_kprobe_event(name, event);
+ ret = lttng_create_kprobe_event(name, event_recorder);
if (ret)
goto error;
ret = _lttng_kprobes_register(symbol_name, offset, addr,
- &event->u.kprobe, lttng_kprobes_event_handler_pre);
+ &event_recorder->priv->parent.u.kprobe, lttng_kprobes_event_handler_pre);
if (ret)
goto register_error;
return 0;
register_error:
- kfree(event->desc->fields);
- kfree(event->desc->event_name);
- kfree(event->desc);
+ kfree(event_recorder->priv->parent.desc->fields);
+ kfree(event_recorder->priv->parent.desc->event_name);
+ kfree(event_recorder->priv->parent.desc);
error:
return ret;
}
int lttng_kprobes_register_event_notifier(const char *symbol_name,
uint64_t offset,
uint64_t addr,
- struct lttng_event_notifier *event_notifier)
+ struct lttng_kernel_event_notifier *event_notifier)
{
int ret;
ret = lttng_create_kprobe_event_notifier(symbol_name, event_notifier);
goto error;
ret = _lttng_kprobes_register(symbol_name, offset, addr,
- &event_notifier->u.kprobe, lttng_kprobes_event_notifier_handler_pre);
+ &event_notifier->priv->parent.u.kprobe, lttng_kprobes_event_notifier_handler_pre);
if (ret)
goto register_error;
return 0;
register_error:
- kfree(event_notifier->desc->event_name);
- kfree(event_notifier->desc);
+ kfree(event_notifier->priv->parent.desc->event_name);
+ kfree(event_notifier->priv->parent.desc);
error:
return ret;
}
EXPORT_SYMBOL_GPL(lttng_kprobes_register_event_notifier);
-void lttng_kprobes_unregister_event(struct lttng_event *event)
+void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event_recorder)
{
- unregister_kprobe(&event->u.kprobe.kp);
+ unregister_kprobe(&event_recorder->priv->parent.u.kprobe.kp);
}
EXPORT_SYMBOL_GPL(lttng_kprobes_unregister_event);
-void lttng_kprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier)
+void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
{
- unregister_kprobe(&event_notifier->u.kprobe.kp);
+ unregister_kprobe(&event_notifier->priv->parent.u.kprobe.kp);
}
EXPORT_SYMBOL_GPL(lttng_kprobes_unregister_event_notifier);
-void lttng_kprobes_destroy_event_private(struct lttng_event *event)
+void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event_recorder)
{
- kfree(event->u.kprobe.symbol_name);
- kfree(event->desc->fields[0]);
- kfree(event->desc->fields);
- kfree(event->desc->event_name);
- kfree(event->desc);
+ kfree(event_recorder->priv->parent.u.kprobe.symbol_name);
+ kfree(event_recorder->priv->parent.desc->fields[0]);
+ kfree(event_recorder->priv->parent.desc->fields);
+ kfree(event_recorder->priv->parent.desc->event_name);
+ kfree(event_recorder->priv->parent.desc);
}
EXPORT_SYMBOL_GPL(lttng_kprobes_destroy_event_private);
-void lttng_kprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
+void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
{
- kfree(event_notifier->u.kprobe.symbol_name);
- kfree(event_notifier->desc->event_name);
- kfree(event_notifier->desc);
+ kfree(event_notifier->priv->parent.u.kprobe.symbol_name);
+ kfree(event_notifier->priv->parent.desc->event_name);
+ kfree(event_notifier->priv->parent.desc);
}
EXPORT_SYMBOL_GPL(lttng_kprobes_destroy_event_notifier_private);
#include <linux/slab.h>
#include <linux/kref.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <ringbuffer/frontend_types.h>
#include <wrapper/vmalloc.h>
#include <wrapper/irqflags.h>
struct lttng_krp {
struct kretprobe krp;
- struct lttng_event *event[2]; /* ENTRY and EXIT */
+ struct lttng_kernel_event_recorder *event[2]; /* ENTRY and EXIT */
struct kref kref_register;
struct kref kref_alloc;
};
{
struct lttng_krp *lttng_krp =
container_of(lttng_get_kretprobe(krpi), struct lttng_krp, krp);
- struct lttng_event *event =
+ struct lttng_kernel_event_recorder *event_recorder =
lttng_krp->event[type];
struct lttng_probe_ctx lttng_probe_ctx = {
- .event = event,
+ .event = event_recorder,
.interruptible = !lttng_regs_irqs_disabled(regs),
};
- struct lttng_channel *chan = event->chan;
+ struct lttng_channel *chan = event_recorder->chan;
struct lib_ring_buffer_ctx ctx;
int ret;
struct {
return 0;
if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
return 0;
- if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
+ if (unlikely(!LTTNG_READ_ONCE(event_recorder->parent.enabled)))
return 0;
payload.ip = (unsigned long) lttng_get_kretprobe(krpi)->kp.addr;
lib_ring_buffer_ctx_init(&ctx, chan->chan, <tng_probe_ctx, sizeof(payload),
lttng_alignof(payload), -1);
- ret = chan->ops->event_reserve(&ctx, event->id);
+ ret = chan->ops->event_reserve(&ctx, event_recorder->priv->id);
if (ret < 0)
return 0;
lib_ring_buffer_align_ctx(&ctx, lttng_alignof(payload));
* Create event description
*/
static
-int lttng_create_kprobe_event(const char *name, struct lttng_event *event,
+int lttng_create_kprobe_event(const char *name, struct lttng_kernel_event_recorder *event_recorder,
enum lttng_kretprobe_type type)
{
const struct lttng_kernel_event_field **fieldp_array;
desc->fields[1] = field;
desc->owner = THIS_MODULE;
- event->desc = desc;
+ event_recorder->priv->parent.desc = desc;
return 0;
const char *symbol_name,
uint64_t offset,
uint64_t addr,
- struct lttng_event *event_entry,
- struct lttng_event *event_exit)
+ struct lttng_kernel_event_recorder *event_recorder_entry,
+ struct lttng_kernel_event_recorder *event_recorder_exit)
{
int ret;
struct lttng_krp *lttng_krp;
if (symbol_name[0] == '\0')
symbol_name = NULL;
- ret = lttng_create_kprobe_event(name, event_entry, EVENT_ENTRY);
+ ret = lttng_create_kprobe_event(name, event_recorder_entry, EVENT_ENTRY);
if (ret)
goto error;
- ret = lttng_create_kprobe_event(name, event_exit, EVENT_EXIT);
+ ret = lttng_create_kprobe_event(name, event_recorder_exit, EVENT_EXIT);
if (ret)
goto event_exit_error;
lttng_krp = kzalloc(sizeof(*lttng_krp), GFP_KERNEL);
}
lttng_krp->krp.kp.symbol_name =
alloc_symbol;
- event_entry->u.kretprobe.symbol_name =
+ event_recorder_entry->priv->parent.u.kretprobe.symbol_name =
alloc_symbol;
- event_exit->u.kretprobe.symbol_name =
+ event_recorder_exit->priv->parent.u.kretprobe.symbol_name =
alloc_symbol;
}
lttng_krp->krp.kp.offset = offset;
lttng_krp->krp.kp.addr = (void *) (unsigned long) addr;
/* Allow probe handler to find event structures */
- lttng_krp->event[EVENT_ENTRY] = event_entry;
- lttng_krp->event[EVENT_EXIT] = event_exit;
- event_entry->u.kretprobe.lttng_krp = lttng_krp;
- event_exit->u.kretprobe.lttng_krp = lttng_krp;
+ lttng_krp->event[EVENT_ENTRY] = event_recorder_entry;
+ lttng_krp->event[EVENT_EXIT] = event_recorder_exit;
+ event_recorder_entry->priv->parent.u.kretprobe.lttng_krp = lttng_krp;
+ event_recorder_exit->priv->parent.u.kretprobe.lttng_krp = lttng_krp;
/*
* Both events must be unregistered before the kretprobe is
name_error:
kfree(lttng_krp);
krp_error:
- kfree(event_exit->desc->fields[0]);
- kfree(event_exit->desc->fields[1]);
- kfree(event_exit->desc->fields);
- kfree(event_exit->desc->event_name);
- kfree(event_exit->desc);
+ kfree(event_recorder_exit->priv->parent.desc->fields[0]);
+ kfree(event_recorder_exit->priv->parent.desc->fields[1]);
+ kfree(event_recorder_exit->priv->parent.desc->fields);
+ kfree(event_recorder_exit->priv->parent.desc->event_name);
+ kfree(event_recorder_exit->priv->parent.desc);
event_exit_error:
- kfree(event_entry->desc->fields[0]);
- kfree(event_entry->desc->fields[1]);
- kfree(event_entry->desc->fields);
- kfree(event_entry->desc->event_name);
- kfree(event_entry->desc);
+ kfree(event_recorder_entry->priv->parent.desc->fields[0]);
+ kfree(event_recorder_entry->priv->parent.desc->fields[1]);
+ kfree(event_recorder_entry->priv->parent.desc->fields);
+ kfree(event_recorder_entry->priv->parent.desc->event_name);
+ kfree(event_recorder_entry->priv->parent.desc);
error:
return ret;
}
unregister_kretprobe(<tng_krp->krp);
}
-void lttng_kretprobes_unregister(struct lttng_event *event)
+void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event_recorder)
{
- kref_put(&event->u.kretprobe.lttng_krp->kref_register,
+ kref_put(&event_recorder->priv->parent.u.kretprobe.lttng_krp->kref_register,
_lttng_kretprobes_unregister_release);
}
EXPORT_SYMBOL_GPL(lttng_kretprobes_unregister);
kfree(lttng_krp->krp.kp.symbol_name);
}
-void lttng_kretprobes_destroy_private(struct lttng_event *event)
+void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event_recorder)
{
- kfree(event->desc->fields[0]);
- kfree(event->desc->fields[1]);
- kfree(event->desc->fields);
- kfree(event->desc->event_name);
- kfree(event->desc);
- kref_put(&event->u.kretprobe.lttng_krp->kref_alloc,
+ kfree(event_recorder->priv->parent.desc->fields[0]);
+ kfree(event_recorder->priv->parent.desc->fields[1]);
+ kfree(event_recorder->priv->parent.desc->fields);
+ kfree(event_recorder->priv->parent.desc->event_name);
+ kfree(event_recorder->priv->parent.desc);
+ kref_put(&event_recorder->priv->parent.u.kretprobe.lttng_krp->kref_alloc,
_lttng_kretprobes_release);
}
EXPORT_SYMBOL_GPL(lttng_kretprobes_destroy_private);
-int lttng_kretprobes_event_enable_state(struct lttng_event *event,
+int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_recorder *event_recorder,
int enable)
{
- struct lttng_event *event_exit;
+ struct lttng_kernel_event_recorder *event_recorder_exit;
struct lttng_krp *lttng_krp;
- if (event->instrumentation != LTTNG_KERNEL_ABI_KRETPROBE) {
+ if (event_recorder->priv->parent.instrumentation != LTTNG_KERNEL_ABI_KRETPROBE) {
return -EINVAL;
}
- if (event->enabled == enable) {
+ if (event_recorder->parent.enabled == enable) {
return -EBUSY;
}
- lttng_krp = event->u.kretprobe.lttng_krp;
- event_exit = lttng_krp->event[EVENT_EXIT];
- WRITE_ONCE(event->enabled, enable);
- WRITE_ONCE(event_exit->enabled, enable);
+ lttng_krp = event_recorder->priv->parent.u.kretprobe.lttng_krp;
+ event_recorder_exit = lttng_krp->event[EVENT_EXIT];
+ WRITE_ONCE(event_recorder->parent.enabled, enable);
+ WRITE_ONCE(event_recorder_exit->parent.enabled, enable);
return 0;
}
EXPORT_SYMBOL_GPL(lttng_kretprobes_event_enable_state);
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <wrapper/irqflags.h>
#include <ringbuffer/frontend_types.h>
{
struct lttng_uprobe_handler *uprobe_handler =
container_of(uc, struct lttng_uprobe_handler, up_consumer);
- struct lttng_event *event = uprobe_handler->u.event;
+ struct lttng_kernel_event_recorder *event_recorder = uprobe_handler->u.event;
struct lttng_probe_ctx lttng_probe_ctx = {
- .event = event,
+ .event = event_recorder,
.interruptible = !lttng_regs_irqs_disabled(regs),
};
- struct lttng_channel *chan = event->chan;
+ struct lttng_channel *chan = event_recorder->chan;
struct lib_ring_buffer_ctx ctx;
int ret;
return 0;
if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
return 0;
- if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
+ if (unlikely(!LTTNG_READ_ONCE(event_recorder->parent.enabled)))
return 0;
lib_ring_buffer_ctx_init(&ctx, chan->chan, <tng_probe_ctx,
sizeof(payload), lttng_alignof(payload), -1);
- ret = chan->ops->event_reserve(&ctx, event->id);
+ ret = chan->ops->event_reserve(&ctx, event_recorder->priv->id);
if (ret < 0)
return 0;
{
struct lttng_uprobe_handler *uprobe_handler =
container_of(uc, struct lttng_uprobe_handler, up_consumer);
- struct lttng_event_notifier *event_notifier = uprobe_handler->u.event_notifier;
- struct lttng_kernel_notifier_ctx notif_ctx;
+ struct lttng_kernel_event_notifier *event_notifier = uprobe_handler->u.event_notifier;
+ struct lttng_kernel_notification_ctx notif_ctx;
- if (unlikely(!READ_ONCE(event_notifier->enabled)))
+ if (unlikely(!READ_ONCE(event_notifier->parent.enabled)))
return 0;
notif_ctx.eval_capture = LTTNG_READ_ONCE(event_notifier->eval_capture);
- event_notifier->send_notification(event_notifier, NULL, NULL, ¬if_ctx);
+ event_notifier->notification_send(event_notifier, NULL, NULL, ¬if_ctx);
return 0;
}
* Create event description.
*/
static
-int lttng_create_uprobe_event(const char *name, struct lttng_event *event)
+int lttng_create_uprobe_event(const char *name, struct lttng_kernel_event_recorder *event_recorder)
{
const struct lttng_kernel_event_field **fieldp_array;
struct lttng_kernel_event_field *field;
field->name = "ip";
field->type = event_type;
desc->owner = THIS_MODULE;
- event->desc = desc;
+ event_recorder->priv->parent.desc = desc;
return 0;
* Create event_notifier description.
*/
static
-int lttng_create_uprobe_event_notifier(const char *name, struct lttng_event_notifier *event_notifier)
+int lttng_create_uprobe_event_notifier(const char *name, struct lttng_kernel_event_notifier *event_notifier)
{
struct lttng_kernel_event_desc *desc;
int ret;
desc->nr_fields = 0;
desc->owner = THIS_MODULE;
- event_notifier->desc = desc;
+ event_notifier->priv->parent.desc = desc;
return 0;
return ret;
}
-int lttng_uprobes_event_add_callsite(struct lttng_event *event,
+int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_recorder *event_recorder,
struct lttng_kernel_abi_event_callsite __user *callsite)
{
- return lttng_uprobes_add_callsite(&event->u.uprobe, callsite,
- lttng_uprobes_event_handler_pre, event);
+ return lttng_uprobes_add_callsite(&event_recorder->priv->parent.u.uprobe, callsite,
+ lttng_uprobes_event_handler_pre, event_recorder);
}
EXPORT_SYMBOL_GPL(lttng_uprobes_event_add_callsite);
-int lttng_uprobes_event_notifier_add_callsite(struct lttng_event_notifier *event_notifier,
+int lttng_uprobes_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier,
struct lttng_kernel_abi_event_callsite __user *callsite)
{
- return lttng_uprobes_add_callsite(&event_notifier->u.uprobe, callsite,
+ return lttng_uprobes_add_callsite(&event_notifier->priv->parent.u.uprobe, callsite,
lttng_uprobes_event_notifier_handler_pre, event_notifier);
}
EXPORT_SYMBOL_GPL(lttng_uprobes_event_notifier_add_callsite);
return ret;
}
-int lttng_uprobes_register_event(const char *name, int fd, struct lttng_event *event)
+int lttng_uprobes_register_event(const char *name, int fd, struct lttng_kernel_event_recorder *event_recorder)
{
int ret = 0;
- ret = lttng_create_uprobe_event(name, event);
+ ret = lttng_create_uprobe_event(name, event_recorder);
if (ret)
goto error;
- ret = lttng_uprobes_register(&event->u.uprobe, fd);
+ ret = lttng_uprobes_register(&event_recorder->priv->parent.u.uprobe, fd);
if (ret)
goto register_error;
return 0;
register_error:
- kfree(event->desc->event_name);
- kfree(event->desc);
+ kfree(event_recorder->priv->parent.desc->event_name);
+ kfree(event_recorder->priv->parent.desc);
error:
return ret;
}
EXPORT_SYMBOL_GPL(lttng_uprobes_register_event);
int lttng_uprobes_register_event_notifier(const char *name, int fd,
- struct lttng_event_notifier *event_notifier)
+ struct lttng_kernel_event_notifier *event_notifier)
{
int ret = 0;
if (ret)
goto error;
- ret = lttng_uprobes_register(&event_notifier->u.uprobe, fd);
+ ret = lttng_uprobes_register(&event_notifier->priv->parent.u.uprobe, fd);
if (ret)
goto register_error;
return 0;
register_error:
- kfree(event_notifier->desc->event_name);
- kfree(event_notifier->desc);
+ kfree(event_notifier->priv->parent.desc->event_name);
+ kfree(event_notifier->priv->parent.desc);
error:
return ret;
}
}
-void lttng_uprobes_unregister_event(struct lttng_event *event)
+void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event_recorder)
{
- lttng_uprobes_unregister(event->u.uprobe.inode, &event->u.uprobe.head);
+ lttng_uprobes_unregister(event_recorder->priv->parent.u.uprobe.inode, &event_recorder->priv->parent.u.uprobe.head);
}
EXPORT_SYMBOL_GPL(lttng_uprobes_unregister_event);
-void lttng_uprobes_unregister_event_notifier(struct lttng_event_notifier *event_notifier)
+void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
{
- lttng_uprobes_unregister(event_notifier->u.uprobe.inode, &event_notifier->u.uprobe.head);
+ lttng_uprobes_unregister(event_notifier->priv->parent.u.uprobe.inode, &event_notifier->priv->parent.u.uprobe.head);
}
EXPORT_SYMBOL_GPL(lttng_uprobes_unregister_event_notifier);
-void lttng_uprobes_destroy_event_private(struct lttng_event *event)
+void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event_recorder)
{
- iput(event->u.uprobe.inode);
- kfree(event->desc->fields[0]);
- kfree(event->desc->fields);
- kfree(event->desc->event_name);
- kfree(event->desc);
+ iput(event_recorder->priv->parent.u.uprobe.inode);
+ kfree(event_recorder->priv->parent.desc->fields[0]);
+ kfree(event_recorder->priv->parent.desc->fields);
+ kfree(event_recorder->priv->parent.desc->event_name);
+ kfree(event_recorder->priv->parent.desc);
}
EXPORT_SYMBOL_GPL(lttng_uprobes_destroy_event_private);
-void lttng_uprobes_destroy_event_notifier_private(struct lttng_event_notifier *event_notifier)
+void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
{
- iput(event_notifier->u.uprobe.inode);
- kfree(event_notifier->desc->event_name);
- kfree(event_notifier->desc);
+ iput(event_notifier->priv->parent.u.uprobe.inode);
+ kfree(event_notifier->priv->parent.desc->event_name);
+ kfree(event_notifier->priv->parent.desc);
}
EXPORT_SYMBOL_GPL(lttng_uprobes_destroy_event_notifier_private);