goto end;
}
switch (event->instrumentation) {
- case LTTNG_KERNEL_TRACEPOINT:
+ case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_SYSCALL:
ret = -EINVAL;
break;
- case LTTNG_KERNEL_KPROBE:
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
case LTTNG_KERNEL_UPROBE:
- case LTTNG_KERNEL_NOOP:
WRITE_ONCE(event->enabled, 1);
break;
+
case LTTNG_KERNEL_KRETPROBE:
ret = lttng_kretprobes_event_enable_state(event, 1);
break;
- case LTTNG_KERNEL_FUNCTION: /* Fall-through. */
+
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
goto end;
}
switch (event->instrumentation) {
- case LTTNG_KERNEL_TRACEPOINT:
+ case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_SYSCALL:
ret = -EINVAL;
break;
- case LTTNG_KERNEL_KPROBE:
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
case LTTNG_KERNEL_UPROBE:
- case LTTNG_KERNEL_NOOP:
WRITE_ONCE(event->enabled, 0);
break;
+
case LTTNG_KERNEL_KRETPROBE:
+
ret = lttng_kretprobes_event_enable_state(event, 0);
break;
- case LTTNG_KERNEL_FUNCTION: /* Fall-through. */
+
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
goto end;
}
switch (event_notifier->instrumentation) {
- case LTTNG_KERNEL_TRACEPOINT:
+ case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_SYSCALL:
ret = -EINVAL;
break;
- case LTTNG_KERNEL_KPROBE:
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
case LTTNG_KERNEL_UPROBE:
WRITE_ONCE(event_notifier->enabled, 1);
break;
- case LTTNG_KERNEL_FUNCTION:
- case LTTNG_KERNEL_NOOP:
- case LTTNG_KERNEL_KRETPROBE:
+
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
goto end;
}
switch (event_notifier->instrumentation) {
- case LTTNG_KERNEL_TRACEPOINT:
+ case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_SYSCALL:
ret = -EINVAL;
break;
- case LTTNG_KERNEL_KPROBE:
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
case LTTNG_KERNEL_UPROBE:
WRITE_ONCE(event_notifier->enabled, 0);
break;
- case LTTNG_KERNEL_FUNCTION:
- case LTTNG_KERNEL_NOOP:
- case LTTNG_KERNEL_KRETPROBE:
+
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
case LTTNG_KERNEL_TRACEPOINT:
event_name = event_desc->name;
break;
- case LTTNG_KERNEL_KPROBE:
- case LTTNG_KERNEL_UPROBE:
- case LTTNG_KERNEL_KRETPROBE:
- case LTTNG_KERNEL_NOOP:
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
+ case LTTNG_KERNEL_UPROBE: /* Fall-through */
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
case LTTNG_KERNEL_SYSCALL:
event_name = event_param->name;
break;
- case LTTNG_KERNEL_FUNCTION: /* Fall-through. */
+
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
/* Populate lttng_event structure before event registration. */
smp_wmb();
break;
+
case LTTNG_KERNEL_KPROBE:
/*
* Needs to be explicitly enabled after creation, since
ret = try_module_get(event->desc->owner);
WARN_ON_ONCE(!ret);
break;
+
case LTTNG_KERNEL_KRETPROBE:
{
struct lttng_event *event_return;
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);
/*
* Populate lttng_event structure before kretprobe registration.
*/
list_add(&event_return->list, &chan->session->events);
break;
}
- case LTTNG_KERNEL_NOOP:
+
case LTTNG_KERNEL_SYSCALL:
/*
* Needs to be explicitly enabled after creation, since
goto register_error;
}
break;
+
case LTTNG_KERNEL_UPROBE:
/*
* Needs to be explicitly enabled after creation, since
ret = try_module_get(event->desc->owner);
WARN_ON_ONCE(!ret);
break;
+
case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
case LTTNG_KERNEL_TRACEPOINT:
event_name = event_desc->name;
break;
- case LTTNG_KERNEL_KPROBE:
- case LTTNG_KERNEL_UPROBE:
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
+ case LTTNG_KERNEL_UPROBE: /* Fall-through */
case LTTNG_KERNEL_SYSCALL:
event_name = event_notifier_param->event.name;
break;
- case LTTNG_KERNEL_KRETPROBE:
- case LTTNG_KERNEL_FUNCTION:
- case LTTNG_KERNEL_NOOP:
+
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
/* Populate lttng_event_notifier structure before event registration. */
smp_wmb();
break;
+
case LTTNG_KERNEL_KPROBE:
/*
* Needs to be explicitly enabled after creation, since
ret = try_module_get(event_notifier->desc->owner);
WARN_ON_ONCE(!ret);
break;
- case LTTNG_KERNEL_NOOP:
+
case LTTNG_KERNEL_SYSCALL:
/*
* Needs to be explicitly enabled after creation, since
goto register_error;
}
break;
+
case LTTNG_KERNEL_UPROBE:
/*
* Needs to be explicitly enabled after creation, since
ret = try_module_get(event_notifier->desc->owner);
WARN_ON_ONCE(!ret);
break;
- case LTTNG_KERNEL_KRETPROBE:
- case LTTNG_KERNEL_FUNCTION:
+
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
desc->probe_callback,
event);
break;
+
case LTTNG_KERNEL_SYSCALL:
ret = lttng_syscall_filter_enable_event(event->chan, event);
break;
- case LTTNG_KERNEL_KPROBE:
- case LTTNG_KERNEL_UPROBE:
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
+ case LTTNG_KERNEL_UPROBE: /* Fall-through */
case LTTNG_KERNEL_KRETPROBE:
- case LTTNG_KERNEL_NOOP:
ret = 0;
break;
+
case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
}
event->desc->probe_callback,
event);
break;
+
case LTTNG_KERNEL_KPROBE:
lttng_kprobes_unregister_event(event);
ret = 0;
break;
+
case LTTNG_KERNEL_KRETPROBE:
lttng_kretprobes_unregister(event);
ret = 0;
break;
+
case LTTNG_KERNEL_SYSCALL:
ret = lttng_syscall_filter_disable_event(event->chan, event);
break;
+
case LTTNG_KERNEL_NOOP:
ret = 0;
break;
+
case LTTNG_KERNEL_UPROBE:
lttng_uprobes_unregister_event(event);
ret = 0;
break;
+
case LTTNG_KERNEL_FUNCTION: /* Fall-through */
default:
WARN_ON_ONCE(1);
desc->event_notifier_callback,
event_notifier);
break;
+
case LTTNG_KERNEL_SYSCALL:
ret = lttng_syscall_filter_enable_event_notifier(event_notifier);
break;
- case LTTNG_KERNEL_KPROBE:
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
case LTTNG_KERNEL_UPROBE:
ret = 0;
break;
- case LTTNG_KERNEL_KRETPROBE:
- case LTTNG_KERNEL_FUNCTION:
- case LTTNG_KERNEL_NOOP:
+
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
}
event_notifier->desc->event_notifier_callback,
event_notifier);
break;
+
case LTTNG_KERNEL_KPROBE:
lttng_kprobes_unregister_event_notifier(event_notifier);
ret = 0;
break;
+
case LTTNG_KERNEL_UPROBE:
lttng_uprobes_unregister_event_notifier(event_notifier);
ret = 0;
break;
+
case LTTNG_KERNEL_SYSCALL:
ret = lttng_syscall_filter_disable_event_notifier(event_notifier);
break;
- case LTTNG_KERNEL_KRETPROBE:
- case LTTNG_KERNEL_FUNCTION:
- case LTTNG_KERNEL_NOOP:
+
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
}
case LTTNG_KERNEL_TRACEPOINT:
lttng_event_desc_put(event->desc);
break;
+
case LTTNG_KERNEL_KPROBE:
module_put(event->desc->owner);
lttng_kprobes_destroy_event_private(event);
break;
+
case LTTNG_KERNEL_KRETPROBE:
module_put(event->desc->owner);
lttng_kretprobes_destroy_private(event);
break;
- case LTTNG_KERNEL_NOOP:
+
case LTTNG_KERNEL_SYSCALL:
break;
+
case LTTNG_KERNEL_UPROBE:
module_put(event->desc->owner);
lttng_uprobes_destroy_event_private(event);
break;
+
case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
}
static
void _lttng_event_notifier_destroy(struct lttng_event_notifier *event_notifier)
{
+ struct lttng_enabler_ref *enabler_ref, *tmp_enabler_ref;
+
switch (event_notifier->instrumentation) {
case LTTNG_KERNEL_TRACEPOINT:
lttng_event_desc_put(event_notifier->desc);
break;
+
case LTTNG_KERNEL_KPROBE:
module_put(event_notifier->desc->owner);
lttng_kprobes_destroy_event_notifier_private(event_notifier);
break;
- case LTTNG_KERNEL_NOOP:
+
case LTTNG_KERNEL_SYSCALL:
break;
+
case LTTNG_KERNEL_UPROBE:
module_put(event_notifier->desc->owner);
lttng_uprobes_destroy_event_notifier_private(event_notifier);
break;
- case LTTNG_KERNEL_KRETPROBE:
- case LTTNG_KERNEL_FUNCTION:
+
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
default:
WARN_ON_ONCE(1);
}
list_del(&event_notifier->list);
+ 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)
+ kfree(enabler_ref);
kmem_cache_free(event_notifier_cache, event_notifier);
}
return -EINVAL;
}
break;
+
case LTTNG_KERNEL_SYSCALL:
desc_name = desc->name;
if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
return -EINVAL;
}
break;
+
default:
WARN_ON_ONCE(1);
return -EINVAL;
case LTTNG_KERNEL_TRACEPOINT:
lttng_create_tracepoint_event_if_missing(event_enabler);
break;
+
case LTTNG_KERNEL_SYSCALL:
lttng_create_syscall_event_if_missing(event_enabler);
break;
+
default:
WARN_ON_ONCE(1);
break;
case LTTNG_KERNEL_TRACEPOINT:
lttng_create_tracepoint_event_notifier_if_missing(event_notifier_enabler);
break;
+
case LTTNG_KERNEL_SYSCALL:
lttng_create_syscall_event_notifier_if_missing(event_notifier_enabler);
break;
+
default:
WARN_ON_ONCE(1);
break;
int enabled = 0, has_enablers_without_bytecode = 0;
switch (event->instrumentation) {
- case LTTNG_KERNEL_TRACEPOINT:
+ case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_SYSCALL:
/* Enable events */
list_for_each_entry(enabler_ref,
}
}
break;
+
default:
/* Not handled with lazy sync. */
continue;
int enabled = 0, has_enablers_without_bytecode = 0;
switch (event_notifier->instrumentation) {
- case LTTNG_KERNEL_TRACEPOINT:
+ case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_SYSCALL:
/* Enable event_notifiers */
list_for_each_entry(enabler_ref,
}
}
break;
+
default:
/* Not handled with sync. */
continue;
list_for_each_entry(runtime,
&event_notifier->capture_bytecode_runtime_head, node)
lttng_bytecode_capture_sync_state(runtime);
+
+ WRITE_ONCE(event_notifier->eval_capture, !!event_notifier->num_captures);
}
}
{
int ret;
- WARN_ON_ONCE(type->atype != atype_integer);
+ WARN_ON_ONCE(type->type != lttng_kernel_type_integer);
ret = print_tabs(session, nesting);
if (ret)
return ret;
uint32_t i, nr_fields;
unsigned int alignment;
- WARN_ON_ONCE(type->atype != atype_struct_nestable);
+ WARN_ON_ONCE(type->type != lttng_kernel_type_struct_nestable);
ret = print_tabs(session, nesting);
if (ret)
int ret;
uint32_t i, nr_choices;
- WARN_ON_ONCE(type->atype != atype_variant_nestable);
+ WARN_ON_ONCE(type->type != lttng_kernel_type_variant_nestable);
/*
* CTF 1.8 does not allow expressing nonzero variant alignment in a nestable way.
*/
int ret;
const struct lttng_type *elem_type;
- WARN_ON_ONCE(field->type.atype != atype_array_nestable);
+ WARN_ON_ONCE(field->type.type != lttng_kernel_type_array_nestable);
if (field->type.u.array_nestable.alignment) {
ret = print_tabs(session, nesting);
* currently supported.
*/
elem_type = field->type.u.array_nestable.elem_type;
- switch (elem_type->atype) {
- case atype_integer:
- case atype_struct_nestable:
- case atype_variant_nestable:
+ switch (elem_type->type) {
+ case lttng_kernel_type_integer:
+ case lttng_kernel_type_struct_nestable:
+ case lttng_kernel_type_variant_nestable:
ret = _lttng_type_statedump(session, elem_type, nesting);
if (ret)
return ret;
const char *length_name;
const struct lttng_type *elem_type;
- WARN_ON_ONCE(field->type.atype != atype_sequence_nestable);
+ WARN_ON_ONCE(field->type.type != lttng_kernel_type_sequence_nestable);
length_name = field->type.u.sequence_nestable.length_name;
* currently supported.
*/
elem_type = field->type.u.sequence_nestable.elem_type;
- switch (elem_type->atype) {
- case atype_integer:
- case atype_struct_nestable:
- case atype_variant_nestable:
+ switch (elem_type->type) {
+ case lttng_kernel_type_integer:
+ case lttng_kernel_type_struct_nestable:
+ case lttng_kernel_type_variant_nestable:
ret = _lttng_type_statedump(session, elem_type, nesting);
if (ret)
return ret;
unsigned int i, nr_entries;
container_type = type->u.enum_nestable.container_type;
- if (container_type->atype != atype_integer) {
+ if (container_type->type != lttng_kernel_type_integer) {
ret = -EINVAL;
goto end;
}
{
int ret;
- WARN_ON_ONCE(type->atype != atype_string);
+ WARN_ON_ONCE(type->type != lttng_kernel_type_string);
/* Default encoding is UTF8 */
ret = print_tabs(session, nesting);
if (ret)
{
int ret;
- WARN_ON_ONCE(field->type.atype != atype_string);
+ WARN_ON_ONCE(field->type.type != lttng_kernel_type_string);
ret = _lttng_string_type_statedump(session, &field->type, nesting);
if (ret)
return ret;
{
int ret = 0;
- switch (type->atype) {
- case atype_integer:
+ switch (type->type) {
+ case lttng_kernel_type_integer:
ret = _lttng_integer_type_statedump(session, type, nesting);
break;
- case atype_enum_nestable:
+ case lttng_kernel_type_enum_nestable:
ret = _lttng_enum_type_statedump(session, type, nesting);
break;
- case atype_string:
+ case lttng_kernel_type_string:
ret = _lttng_string_type_statedump(session, type, nesting);
break;
- case atype_struct_nestable:
+ case lttng_kernel_type_struct_nestable:
ret = _lttng_struct_type_statedump(session, type, nesting);
break;
- case atype_variant_nestable:
+ case lttng_kernel_type_variant_nestable:
ret = _lttng_variant_type_statedump(session, type, nesting);
break;
/* Nested arrays and sequences are not supported yet. */
- case atype_array_nestable:
- case atype_sequence_nestable:
+ case lttng_kernel_type_array_nestable:
+ case lttng_kernel_type_sequence_nestable:
default:
WARN_ON_ONCE(1);
return -EINVAL;
{
int ret = 0;
- switch (field->type.atype) {
- case atype_integer:
+ switch (field->type.type) {
+ case lttng_kernel_type_integer:
ret = _lttng_integer_field_statedump(session, field, nesting);
break;
- case atype_enum_nestable:
+ case lttng_kernel_type_enum_nestable:
ret = _lttng_enum_field_statedump(session, field, nesting);
break;
- case atype_string:
+ case lttng_kernel_type_string:
ret = _lttng_string_field_statedump(session, field, nesting);
break;
- case atype_struct_nestable:
+ case lttng_kernel_type_struct_nestable:
ret = _lttng_struct_field_statedump(session, field, nesting);
break;
- case atype_array_nestable:
+ case lttng_kernel_type_array_nestable:
ret = _lttng_array_field_statedump(session, field, nesting);
break;
- case atype_sequence_nestable:
+ case lttng_kernel_type_sequence_nestable:
ret = _lttng_sequence_field_statedump(session, field, nesting);
break;
- case atype_variant_nestable:
+ case lttng_kernel_type_variant_nestable:
ret = _lttng_variant_field_statedump(session, field, nesting);
break;