X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fkernel-ctl%2Fkernel-ctl.c;h=a387b93bf87f0334365c3217c95537cf1487e29b;hp=078d8528057efa6afa2d3484a1bb25ec28b9a327;hb=834978fd9e2392f20867351ca99bf7bdf31b4f56;hpb=562ab9a8448207679ce90cbe43f97976dcf25671 diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c index 078d85280..a387b93bf 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.c @@ -19,6 +19,7 @@ #define __USE_LINUX_IOCTL_DEFS #include #include +#include #include "kernel-ctl.h" #include "kernel-ioctl.h" @@ -163,6 +164,57 @@ int kernctl_disable_syscall(int fd, const char *syscall_name) return ioctl(fd, LTTNG_KERNEL_EVENT, &event); } +int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits) +{ + struct lttng_kernel_syscall_mask kmask_len, *kmask = NULL; + size_t array_alloc_len; + char *new_mask; + int ret = 0; + + if (!syscall_mask) { + ret = -1; + goto end; + } + + if (!nr_bits) { + ret = -1; + goto end; + } + + kmask_len.len = 0; + ret = ioctl(fd, LTTNG_KERNEL_SYSCALL_MASK, &kmask_len); + if (ret) { + goto end; + } + + array_alloc_len = ALIGN(kmask_len.len, 8) >> 3; + + kmask = zmalloc(sizeof(*kmask) + array_alloc_len); + if (!kmask) { + ret = -1; + goto end; + } + + kmask->len = kmask_len.len; + ret = ioctl(fd, LTTNG_KERNEL_SYSCALL_MASK, kmask); + if (ret) { + goto end; + } + + new_mask = realloc(*syscall_mask, array_alloc_len); + if (!new_mask) { + ret = -1; + goto end; + } + memcpy(new_mask, kmask->mask, array_alloc_len); + *syscall_mask = new_mask; + *nr_bits = kmask->len; + +end: + free(kmask); + return ret; +} + int kernctl_create_stream(int fd) { return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_STREAM,