#include <lttng/abi.h>
#include <lttng/abi-old.h>
#include <lttng/events.h>
+#include <lttng/events-internal.h>
#include <lttng/tracer.h>
#include <lttng/tp-mempool.h>
#include <ringbuffer/frontend_types.h>
static
long lttng_abi_add_context(struct file *file,
struct lttng_kernel_context *context_param,
- struct lttng_ctx **ctx, struct lttng_session *session)
+ struct lttng_kernel_ctx **ctx, struct lttng_session *session)
{
if (session->been_active)
switch (event_param->instrumentation) {
case LTTNG_KERNEL_SYSCALL:
switch (event_param->u.syscall.entryexit) {
- case LTTNG_KERNEL_SYSCALL_ENTRY:
- case LTTNG_KERNEL_SYSCALL_EXIT:
+ case LTTNG_KERNEL_SYSCALL_ENTRY: /* Fall-through */
+ case LTTNG_KERNEL_SYSCALL_EXIT: /* Fall-through */
case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
break;
default:
}
break;
+ case LTTNG_KERNEL_KRETPROBE:
+ switch (event_param->u.kretprobe.entryexit) {
+ case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
+ break;
+ case LTTNG_KERNEL_SYSCALL_ENTRY: /* Fall-through */
+ case LTTNG_KERNEL_SYSCALL_EXIT: /* Fall-through */
+ default:
+ return -EINVAL;
+ }
+ break;
+
case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */
case LTTNG_KERNEL_KPROBE: /* Fall-through */
- case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
case LTTNG_KERNEL_UPROBE:
break;
ret = lttng_abi_validate_event_param(event_param);
if (ret)
goto event_error;
- if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
- || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
+
+ switch (event_param->instrumentation) {
+ case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */
+ case LTTNG_KERNEL_SYSCALL:
+ {
struct lttng_event_enabler *event_enabler;
if (strutils_is_star_glob_pattern(event_param->name)) {
event_param, channel);
}
priv = event_enabler;
- } else {
+ break;
+ }
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_UPROBE:
+ {
struct lttng_event *event;
/*
goto event_error;
}
priv = event;
+ break;
+ }
+
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
+ default:
+ ret = -EINVAL;
+ goto event_error;
}
event_file->private_data = priv;
fd_install(event_fd, event_file);
goto refcount_error;
}
- if (event_notifier_param->event.instrumentation == LTTNG_KERNEL_TRACEPOINT
- || event_notifier_param->event.instrumentation == LTTNG_KERNEL_SYSCALL) {
+ ret = lttng_abi_validate_event_param(&event_notifier_param->event);
+ if (ret)
+ goto event_notifier_error;
+
+ switch (event_notifier_param->event.instrumentation) {
+ case LTTNG_KERNEL_TRACEPOINT: /* Fall-through */
+ case LTTNG_KERNEL_SYSCALL:
+ {
struct lttng_event_notifier_enabler *enabler;
if (strutils_is_star_glob_pattern(event_notifier_param->event.name)) {
event_notifier_param);
}
priv = enabler;
- } else {
+ break;
+ }
+
+ case LTTNG_KERNEL_KPROBE: /* Fall-through */
+ case LTTNG_KERNEL_KRETPROBE: /* Fall-through */
+ case LTTNG_KERNEL_UPROBE:
+ {
struct lttng_event_notifier *event_notifier;
/*
goto event_notifier_error;
}
priv = event_notifier;
+ break;
+ }
+
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
+ case LTTNG_KERNEL_NOOP: /* Fall-through */
+ default:
+ ret = -EINVAL;
+ goto event_notifier_error;
}
event_notifier_file->private_data = priv;
fd_install(event_notifier_fd, event_notifier_file);