unsigned int read_timer_interval);
void lttng_metadata_channel_destroy(struct lttng_kernel_channel_buffer *chan);
-struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_event_recorder_enabler *event_enabler,
+struct lttng_kernel_event_common *_lttng_kernel_event_create(struct lttng_event_enabler_common *event_enabler,
const struct lttng_kernel_event_desc *event_desc);
-struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_event_recorder_enabler *event_enabler,
+struct lttng_kernel_event_common *lttng_kernel_event_create(struct lttng_event_enabler_common *event_enabler,
const struct lttng_kernel_event_desc *event_desc);
-struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_kernel_channel_buffer *chan,
- struct lttng_kernel_abi_old_event *old_event_param,
- const struct lttng_kernel_event_desc *internal_desc);
-
-struct lttng_kernel_event_notifier *lttng_event_notifier_create(struct lttng_event_notifier_enabler *event_enabler,
- const struct lttng_kernel_event_desc *event_notifier_desc);
-struct lttng_kernel_event_notifier *_lttng_event_notifier_create(struct lttng_event_notifier_enabler *event_enabler,
- const struct lttng_kernel_event_desc *event_notifier_desc);
int lttng_channel_enable(struct lttng_kernel_channel_common *channel);
int lttng_channel_disable(struct lttng_kernel_channel_common *channel);
lttng_fallthrough;
case LTTNG_KERNEL_ABI_UPROBE:
{
- struct lttng_kernel_event_recorder *event;
+ struct lttng_kernel_event_common *event;
struct lttng_event_recorder_enabler *event_enabler;
event_enabler = lttng_event_recorder_enabler_create(LTTNG_ENABLER_FORMAT_NAME,
* We tolerate no failure path after event creation. It
* will stay invariant for the rest of the session.
*/
- event = lttng_kernel_event_recorder_create(event_enabler, NULL);
+ event = lttng_kernel_event_create(&event_enabler->parent, NULL);
WARN_ON_ONCE(!event);
lttng_event_enabler_destroy(&event_enabler->parent);
if (IS_ERR(event)) {
ret = PTR_ERR(event);
goto event_error;
}
- priv = event;
+ priv = container_of(event, struct lttng_kernel_event_recorder, parent);
break;
}
lttng_fallthrough;
case LTTNG_KERNEL_ABI_UPROBE:
{
- struct lttng_kernel_event_notifier *event_notifier;
+ struct lttng_kernel_event_common *event;
struct lttng_event_notifier_enabler *event_notifier_enabler;
event_notifier_enabler = lttng_event_notifier_enabler_create(LTTNG_ENABLER_FORMAT_NAME,
ret = -ENOMEM;
goto event_notifier_error;
}
- event_notifier = lttng_event_notifier_create(event_notifier_enabler, NULL);
- WARN_ON_ONCE(!event_notifier);
+ event = lttng_kernel_event_create(&event_notifier_enabler->parent, NULL);
+ WARN_ON_ONCE(!event);
lttng_event_enabler_destroy(&event_notifier_enabler->parent);
- if (IS_ERR(event_notifier)) {
- ret = PTR_ERR(event_notifier);
+ if (IS_ERR(event)) {
+ ret = PTR_ERR(event);
goto event_notifier_error;
}
- priv = event_notifier;
+ priv = container_of(event, struct lttng_kernel_event_notifier, parent);
break;
}
* Supports event creation while tracing session is active.
* Needs to be called with sessions mutex held.
*/
+static
struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_event_recorder_enabler *event_enabler,
const struct lttng_kernel_event_desc *event_desc)
{
return ERR_PTR(ret);
}
-struct lttng_kernel_event_notifier *_lttng_event_notifier_create(struct lttng_event_notifier_enabler *event_enabler,
+static
+struct lttng_kernel_event_notifier *_lttng_kernel_event_notifier_create(struct lttng_event_notifier_enabler *event_enabler,
const struct lttng_kernel_event_desc *event_desc)
{
struct lttng_event_ht *events_ht = lttng_get_event_ht_from_enabler(&event_enabler->parent);
return ERR_PTR(ret);
}
+struct lttng_kernel_event_common *_lttng_kernel_event_create(struct lttng_event_enabler_common *event_enabler,
+ const struct lttng_kernel_event_desc *event_desc)
+{
+ switch (event_enabler->enabler_type) {
+ case LTTNG_EVENT_ENABLER_TYPE_RECORDER:
+ {
+ struct lttng_event_recorder_enabler *event_recorder_enabler =
+ container_of(event_enabler, struct lttng_event_recorder_enabler, parent);
+ struct lttng_kernel_event_recorder *event_recorder;
+
+ event_recorder = _lttng_kernel_event_recorder_create(event_recorder_enabler, event_desc);
+ if (!event_recorder)
+ return NULL;
+ return &event_recorder->parent;
+ }
+ case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER:
+ {
+ struct lttng_event_notifier_enabler *event_notifier_enabler =
+ container_of(event_enabler, struct lttng_event_notifier_enabler, parent);
+ struct lttng_kernel_event_notifier *event_notifier;
+
+ event_notifier = _lttng_kernel_event_notifier_create(event_notifier_enabler, event_desc);
+ if (!event_notifier)
+ return NULL;
+ return &event_notifier->parent;
+ }
+ default:
+ return NULL;
+ }
+}
+
+struct lttng_kernel_event_common *lttng_kernel_event_create(struct lttng_event_enabler_common *event_enabler,
+ const struct lttng_kernel_event_desc *event_desc)
+{
+ struct lttng_kernel_event_common *event;
+
+ mutex_lock(&sessions_mutex);
+ event = _lttng_kernel_event_create(event_enabler, event_desc);
+ mutex_unlock(&sessions_mutex);
+ return event;
+}
+
+
+
int lttng_kernel_counter_read(struct lttng_counter *counter,
const size_t *dim_indexes, int32_t cpu,
int64_t *val, bool *overflow, bool *underflow)
return counter->ops->counter_clear(counter->counter, dim_indexes);
}
-struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_event_recorder_enabler *event_enabler,
- const struct lttng_kernel_event_desc *event_desc)
-{
- struct lttng_kernel_event_recorder *event;
-
- mutex_lock(&sessions_mutex);
- event = _lttng_kernel_event_recorder_create(event_enabler, event_desc);
- mutex_unlock(&sessions_mutex);
- return event;
-}
-
-struct lttng_kernel_event_notifier *lttng_event_notifier_create(struct lttng_event_notifier_enabler *event_enabler,
- const struct lttng_kernel_event_desc *event_desc)
-{
- struct lttng_kernel_event_notifier *event_notifier;
-
- mutex_lock(&sessions_mutex);
- event_notifier = _lttng_event_notifier_create(event_enabler, event_desc);
- mutex_unlock(&sessions_mutex);
- return event_notifier;
-}
-
/* Only used for tracepoints for now. */
static
void register_event(struct lttng_kernel_event_common *event)
for (i = 0; i < probe_desc->nr_events; i++) {
int found = 0;
struct hlist_head *head;
- struct lttng_kernel_event_recorder *event_recorder;
+ struct lttng_kernel_event_common *event;
struct lttng_kernel_event_common_private *event_priv;
desc = probe_desc->event_desc[i];
continue;
/*
- * We need to create an event for this
- * event probe.
+ * We need to create an event for this event probe.
*/
- event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
- if (!event_recorder) {
+ event = _lttng_kernel_event_create(&event_enabler->parent, desc);
+ if (!event) {
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_kernel_event_notifier *event_notifier;
+ struct lttng_kernel_event_common *event;
struct lttng_kernel_event_common_private *event_priv;
desc = probe_desc->event_desc[i];
/*
* We need to create a event_notifier for this event probe.
*/
- event_notifier = _lttng_event_notifier_create(event_notifier_enabler, desc);
- if (IS_ERR(event_notifier)) {
+ event = _lttng_kernel_event_create(&event_notifier_enabler->parent, desc);
+ if (IS_ERR(event)) {
printk(KERN_INFO "Unable to create event_notifier %s\n",
probe_desc->event_desc[i]->event_name);
}
const struct lttng_kernel_event_desc *desc = table[i].desc;
struct lttng_event_recorder_enabler *event_enabler;
struct lttng_kernel_abi_event ev;
- struct lttng_kernel_event_recorder *event_recorder;
+ struct lttng_kernel_event_common *event;
struct lttng_kernel_event_common_private *event_priv;
struct hlist_head *head;
bool found = false;
if (!event_enabler) {
return -ENOMEM;
}
- event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
- WARN_ON_ONCE(!event_recorder);
+ event = _lttng_kernel_event_create(&event_enabler->parent, desc);
+ WARN_ON_ONCE(!event);
lttng_event_enabler_destroy(&event_enabler->parent);
- if (IS_ERR(event_recorder)) {
+ if (IS_ERR(event)) {
/*
* 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_recorder);
+ return PTR_ERR(event);
}
- hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan_table[i]);
+ hlist_add_head(&event->priv->u.syscall.node, &chan_table[i]);
}
return 0;
}
if (hlist_empty(&syscall_table->unknown_syscall_dispatch)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___syscall_entry_unknown;
- struct lttng_kernel_event_recorder *event_recorder;
+ struct lttng_kernel_event_common *event;
struct lttng_event_recorder_enabler *event_enabler;
memset(&ev, 0, sizeof(ev));
if (!event_enabler) {
return -ENOMEM;
}
- event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
+ event = _lttng_kernel_event_create(&event_enabler->parent, desc);
lttng_event_enabler_destroy(&event_enabler->parent);
- WARN_ON_ONCE(!event_recorder);
- if (IS_ERR(event_recorder)) {
- return PTR_ERR(event_recorder);
+ WARN_ON_ONCE(!event);
+ if (IS_ERR(event)) {
+ return PTR_ERR(event);
}
- hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &syscall_table->unknown_syscall_dispatch);
+ hlist_add_head(&event->priv->u.syscall.node, &syscall_table->unknown_syscall_dispatch);
}
if (hlist_empty(&syscall_table->compat_unknown_syscall_dispatch)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___compat_syscall_entry_unknown;
- struct lttng_kernel_event_recorder *event_recorder;
+ struct lttng_kernel_event_common *event;
struct lttng_event_recorder_enabler *event_enabler;
memset(&ev, 0, sizeof(ev));
if (!event_enabler) {
return -ENOMEM;
}
- event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
- WARN_ON_ONCE(!event_recorder);
+ event = _lttng_kernel_event_create(&event_enabler->parent, desc);
+ WARN_ON_ONCE(!event);
lttng_event_enabler_destroy(&event_enabler->parent);
- if (IS_ERR(event_recorder)) {
- return PTR_ERR(event_recorder);
+ if (IS_ERR(event)) {
+ return PTR_ERR(event);
}
- hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &syscall_table->compat_unknown_syscall_dispatch);
+ hlist_add_head(&event->priv->u.syscall.node, &syscall_table->compat_unknown_syscall_dispatch);
}
if (hlist_empty(&syscall_table->compat_unknown_syscall_exit_dispatch)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___compat_syscall_exit_unknown;
- struct lttng_kernel_event_recorder *event_recorder;
+ struct lttng_kernel_event_common *event;
struct lttng_event_recorder_enabler *event_enabler;
memset(&ev, 0, sizeof(ev));
if (!event_enabler) {
return -ENOMEM;
}
- event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
- WARN_ON_ONCE(!event_recorder);
+ event = _lttng_kernel_event_create(&event_enabler->parent, desc);
+ WARN_ON_ONCE(!event);
lttng_event_enabler_destroy(&event_enabler->parent);
- if (IS_ERR(event_recorder)) {
- return PTR_ERR(event_recorder);
+ if (IS_ERR(event)) {
+ return PTR_ERR(event);
}
- hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &syscall_table->compat_unknown_syscall_exit_dispatch);
+ hlist_add_head(&event->priv->u.syscall.node, &syscall_table->compat_unknown_syscall_exit_dispatch);
}
if (hlist_empty(&syscall_table->unknown_syscall_exit_dispatch)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___syscall_exit_unknown;
- struct lttng_kernel_event_recorder *event_recorder;
+ struct lttng_kernel_event_common *event;
struct lttng_event_recorder_enabler *event_enabler;
memset(&ev, 0, sizeof(ev));
if (!event_enabler) {
return -ENOMEM;
}
- event_recorder = _lttng_kernel_event_recorder_create(event_enabler, desc);
- WARN_ON_ONCE(!event_recorder);
+ event = _lttng_kernel_event_create(&event_enabler->parent, desc);
+ WARN_ON_ONCE(!event);
lttng_event_enabler_destroy(&event_enabler->parent);
- if (IS_ERR(event_recorder)) {
- return PTR_ERR(event_recorder);
+ if (IS_ERR(event)) {
+ return PTR_ERR(event);
}
- hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &syscall_table->unknown_syscall_exit_dispatch);
+ hlist_add_head(&event->priv->u.syscall.node, &syscall_table->unknown_syscall_exit_dispatch);
}
ret = lttng_create_syscall_event_if_missing(sc_table.table, sc_table.len,
{
struct lttng_event_ht *events_ht = lttng_get_event_ht_from_enabler(&event_notifier_enabler->parent);
struct lttng_kernel_event_common_private *event_priv;
- struct lttng_kernel_event_notifier *event_notifier;
+ struct lttng_kernel_event_common *event;
const struct lttng_kernel_event_desc *desc;
struct lttng_event_notifier_group *group = event_notifier_enabler->group;
struct lttng_kernel_syscall_table *syscall_table = &group->syscall_table;
event_notifier_enabler = lttng_event_notifier_enabler_create(LTTNG_ENABLER_FORMAT_NAME,
&event_notifier_param, group);
WARN_ON_ONCE(!event_notifier_enabler);
- event_notifier = _lttng_event_notifier_create(event_notifier_enabler, desc);
+ event = _lttng_kernel_event_create(&event_notifier_enabler->parent, desc);
lttng_event_enabler_destroy(&event_notifier_enabler->parent);
- if (IS_ERR(event_notifier)) {
+ if (IS_ERR(event)) {
printk(KERN_INFO "Unable to create unknown notifier %s\n",
desc->event_name);
ret = -ENOMEM;
goto end;
}
- hlist_add_head_rcu(&event_notifier->priv->parent.u.syscall.node, unknown_dispatch_list);
+ hlist_add_head_rcu(&event->priv->u.syscall.node, unknown_dispatch_list);
end:
return ret;
for (i = 0; i < table_len; i++) {
struct lttng_event_notifier_enabler *event_notifier_enabler;
struct lttng_kernel_event_common_private *event_priv;
- struct lttng_kernel_event_notifier *event_notifier;
+ struct lttng_kernel_event_common *event;
struct lttng_kernel_abi_event_notifier event_notifier_param;
struct hlist_head *head;
int found = 0;
event_notifier_enabler = lttng_event_notifier_enabler_create(LTTNG_ENABLER_FORMAT_NAME,
&event_notifier_param, group);
WARN_ON_ONCE(!event_notifier_enabler);
- event_notifier = _lttng_event_notifier_create(event_notifier_enabler, desc);
+ event = _lttng_kernel_event_create(&event_notifier_enabler->parent, desc);
lttng_event_enabler_destroy(&event_notifier_enabler->parent);
- if (IS_ERR(event_notifier)) {
+ if (IS_ERR(event)) {
printk(KERN_INFO "Unable to create event_notifier %s\n",
desc->event_name);
ret = -ENOMEM;
goto end;
}
- event_notifier->priv->parent.u.syscall.syscall_id = i;
+ event->priv->u.syscall.syscall_id = i;
}
end: