Implement capturing payload on event notifier
[lttng-modules.git] / src / lttng-abi.c
index c62e295e5fdea2f9ebb320fd8340cfb51e52314e..344f18c25acf3d0fa18fd318c907d7bc4a942524 100644 (file)
@@ -1584,6 +1584,8 @@ int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
        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_ENTRYEXIT:
                        break;
                default:
@@ -1596,7 +1598,7 @@ int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
                        return -EINVAL;
                }
                switch (event_param->u.syscall.match) {
-               case LTTNG_SYSCALL_MATCH_NAME:
+               case LTTNG_KERNEL_SYSCALL_MATCH_NAME:
                        break;
                default:
                        return -EINVAL;
@@ -1711,6 +1713,7 @@ fd_error:
 static
 long lttng_event_notifier_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
+       struct lttng_event_notifier *event_notifier;
        struct lttng_event_notifier_enabler *event_notifier_enabler;
        enum lttng_event_type *evtype = file->private_data;
 
@@ -1718,7 +1721,8 @@ long lttng_event_notifier_ioctl(struct file *file, unsigned int cmd, unsigned lo
        case LTTNG_KERNEL_ENABLE:
                switch (*evtype) {
                case LTTNG_TYPE_EVENT:
-                       return -EINVAL;
+                       event_notifier = file->private_data;
+                       return lttng_event_notifier_enable(event_notifier);
                case LTTNG_TYPE_ENABLER:
                        event_notifier_enabler = file->private_data;
                        return lttng_event_notifier_enabler_enable(event_notifier_enabler);
@@ -1729,7 +1733,8 @@ long lttng_event_notifier_ioctl(struct file *file, unsigned int cmd, unsigned lo
        case LTTNG_KERNEL_DISABLE:
                switch (*evtype) {
                case LTTNG_TYPE_EVENT:
-                       return -EINVAL;
+                       event_notifier = file->private_data;
+                       return lttng_event_notifier_disable(event_notifier);
                case LTTNG_TYPE_ENABLER:
                        event_notifier_enabler = file->private_data;
                        return lttng_event_notifier_enabler_disable(event_notifier_enabler);
@@ -1743,12 +1748,39 @@ long lttng_event_notifier_ioctl(struct file *file, unsigned int cmd, unsigned lo
                        return -EINVAL;
                case LTTNG_TYPE_ENABLER:
                        event_notifier_enabler = file->private_data;
-                       return lttng_event_notifier_enabler_attach_bytecode(event_notifier_enabler,
+                       return lttng_event_notifier_enabler_attach_filter_bytecode(
+                                       event_notifier_enabler,
                                (struct lttng_kernel_filter_bytecode __user *) arg);
                default:
                        WARN_ON_ONCE(1);
                        return -ENOSYS;
                }
+
+       case LTTNG_KERNEL_CAPTURE:
+               switch (*evtype) {
+               case LTTNG_TYPE_EVENT:
+                       return -EINVAL;
+               case LTTNG_TYPE_ENABLER:
+                       event_notifier_enabler = file->private_data;
+                       return lttng_event_notifier_enabler_attach_capture_bytecode(
+                               event_notifier_enabler,
+                               (struct lttng_kernel_capture_bytecode __user *) arg);
+               default:
+                       WARN_ON_ONCE(1);
+                       return -ENOSYS;
+               }
+       case LTTNG_KERNEL_ADD_CALLSITE:
+               switch (*evtype) {
+               case LTTNG_TYPE_EVENT:
+                       event_notifier = file->private_data;
+                       return lttng_event_notifier_add_callsite(event_notifier,
+                               (struct lttng_kernel_event_callsite __user *) arg);
+               case LTTNG_TYPE_ENABLER:
+                       return -EINVAL;
+               default:
+                       WARN_ON_ONCE(1);
+                       return -ENOSYS;
+               }
        default:
                return -ENOIOCTLCMD;
        }
@@ -1804,12 +1836,17 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
 
        switch (event_notifier_param->event.instrumentation) {
        case LTTNG_KERNEL_TRACEPOINT:
-       case LTTNG_KERNEL_KPROBE:
        case LTTNG_KERNEL_UPROBE:
+               break;
+       case LTTNG_KERNEL_KPROBE:
+               event_notifier_param->event.u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
+               break;
+       case LTTNG_KERNEL_SYSCALL:
+               break;
        case LTTNG_KERNEL_KRETPROBE:
+               /* Placing an event notifier on kretprobe is not supported. */
        case LTTNG_KERNEL_FUNCTION:
        case LTTNG_KERNEL_NOOP:
-       case LTTNG_KERNEL_SYSCALL:
        default:
                ret = -EINVAL;
                goto inval_instr;
@@ -2279,7 +2316,8 @@ long lttng_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                case LTTNG_TYPE_ENABLER:
                {
                        event_enabler = file->private_data;
-                       return lttng_event_enabler_attach_bytecode(event_enabler,
+                       return lttng_event_enabler_attach_filter_bytecode(
+                               event_enabler,
                                (struct lttng_kernel_filter_bytecode __user *) arg);
                }
                default:
This page took 0.024654 seconds and 4 git commands to generate.