X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fkernel-ctl%2Fkernel-ctl.c;h=18cd95529cfef620d1e6305de0d88e2572fe147f;hb=81527d36f84a02110360f0332f3b35f2d3024d17;hp=51d01341338441bc3faffbf5f3d9fb5c52b29486;hpb=d0ae4ea864f84fa2456563abb20fe42e5cc29625;p=lttng-tools.git diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c index 51d013413..18cd95529 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.c @@ -22,6 +22,7 @@ #include #include #include +#include #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,