Fix: relayd: don't call lttng_ht_destroy in RCU read-side C.S.
[lttng-tools.git] / src / common / kernel-ctl / kernel-ctl.c
index 51d01341338441bc3faffbf5f3d9fb5c52b29486..18cd95529cfef620d1e6305de0d88e2572fe147f 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/ioctl.h>
 #include <string.h>
 #include <common/align.h>
+#include <errno.h>
 
 #include "kernel-ctl.h"
 #include "kernel-ioctl.h"
@@ -111,6 +112,7 @@ int kernctl_create_channel(int fd, struct lttng_channel_attr *chops)
 {
        struct lttng_kernel_channel channel;
 
+       memset(&channel, 0, sizeof(channel));
        if (lttng_kernel_use_old_abi) {
                struct lttng_kernel_old_channel old_channel;
 
@@ -298,6 +300,25 @@ int kernctl_stop_session(int fd)
                        LTTNG_KERNEL_SESSION_STOP);
 }
 
+int kernctl_filter(int fd, struct lttng_filter_bytecode *filter)
+{
+       struct lttng_kernel_filter_bytecode *kb;
+       uint32_t len;
+       int ret;
+
+       /* Translate bytecode to kernel bytecode */
+       kb = zmalloc(sizeof(*kb) + filter->len);
+       if (!kb)
+               return -ENOMEM;
+       kb->len = len = filter->len;
+       kb->reloc_offset = filter->reloc_table_offset;
+       kb->seqnum = filter->seqnum;
+       memcpy(kb->data, filter->data, len);
+       ret = ioctl(fd, LTTNG_KERNEL_FILTER, kb);
+       free(kb);
+       return ret;
+}
+
 int kernctl_tracepoint_list(int fd)
 {
        return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_TRACEPOINT_LIST,
This page took 0.024164 seconds and 4 git commands to generate.