Support capture for kernel tracer
[lttng-tools.git] / src / common / kernel-ctl / kernel-ctl.c
index 10e281d69315a638a24b96102b601415eeb18801..94e22ff0691170ad5db2f856b4bd512cd9f7e9d7 100644 (file)
@@ -14,7 +14,7 @@
 #include <string.h>
 #include <common/align.h>
 #include <common/macros.h>
-#include <errno.h>
+#include <common/compat/errno.h>
 #include <stdarg.h>
 #include <assert.h>
 #include <common/time.h>
@@ -418,7 +418,48 @@ int kernctl_stop_session(int fd)
                        LTTNG_KERNEL_SESSION_STOP);
 }
 
-int kernctl_filter(int fd, struct lttng_filter_bytecode *filter)
+int kernctl_create_event_notifier_group(int fd)
+{
+       return LTTNG_IOCTL_NO_CHECK(fd,
+                       LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_CREATE);
+}
+
+int kernctl_create_event_notifier_group_notification_fd(int group_fd)
+{
+       return LTTNG_IOCTL_NO_CHECK(group_fd,
+                       LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD);
+}
+
+int kernctl_create_event_notifier(int group_fd,
+               const struct lttng_kernel_event_notifier *event_notifier)
+{
+       return LTTNG_IOCTL_NO_CHECK(group_fd,
+                       LTTNG_KERNEL_EVENT_NOTIFIER_CREATE, event_notifier);
+}
+
+int kernctl_capture(int fd, const struct lttng_bytecode *capture)
+{
+       int ret;
+       struct lttng_kernel_capture_bytecode *kb;
+
+       /* Translate bytecode to kernel bytecode. */
+       kb = zmalloc(sizeof(*kb) + capture->len);
+       if (!kb) {
+               ret = -ENOMEM;
+               goto end;
+       }
+
+       kb->len = capture->len;
+       kb->reloc_offset = capture->reloc_table_offset;
+       kb->seqnum = capture->seqnum;
+       memcpy(kb->data, capture->data, capture->len);
+       ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_CAPTURE, kb);
+       free(kb);
+end:
+       return ret;
+}
+
+int kernctl_filter(int fd, const struct lttng_bytecode *filter)
 {
        struct lttng_kernel_filter_bytecode *kb;
        uint32_t len;
This page took 0.024185 seconds and 4 git commands to generate.