Add type-checked versions of allocation and deallocations functions
[lttng-tools.git] / src / common / kernel-ctl / kernel-ctl.cpp
index 8a43239ef5f76037c9c9bfe4fd93b5ca8c95f8e2..76960307c80abe7924011c22f2f3a3ebccfc626d 100644 (file)
 #define __USE_LINUX_IOCTL_DEFS
 #include <sys/ioctl.h>
 #include <string.h>
-#include <common/align.h>
-#include <common/macros.h>
-#include <common/compat/errno.h>
+#include <common/align.hpp>
+#include <common/macros.hpp>
+#include <common/compat/errno.hpp>
 #include <stdarg.h>
-#include <common/time.h>
+#include <common/time.hpp>
 
-#include "kernel-ctl.h"
-#include "kernel-ioctl.h"
+#include "kernel-ctl.hpp"
+#include "kernel-ioctl.hpp"
 
 #define LTTNG_IOCTL_CHECK(fildes, request, ...)                         \
        ({                                                              \
@@ -181,7 +181,7 @@ int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits)
 
        array_alloc_len = lttng_align_ceil(kmask_len.len, 8) >> 3;
 
-       kmask = (lttng_kernel_abi_syscall_mask *) zmalloc(sizeof(*kmask) + array_alloc_len);
+       kmask = zmalloc<lttng_kernel_abi_syscall_mask>(sizeof(*kmask) + array_alloc_len);
        if (!kmask) {
                ret = -1;
                goto end;
@@ -519,7 +519,7 @@ int kernctl_capture(int fd, const struct lttng_bytecode *capture)
        struct lttng_kernel_abi_capture_bytecode *kb;
 
        /* Translate bytecode to kernel bytecode. */
-       kb = (lttng_kernel_abi_capture_bytecode *) zmalloc(sizeof(*kb) + capture->len);
+       kb = zmalloc<lttng_kernel_abi_capture_bytecode>(sizeof(*kb) + capture->len);
        if (!kb) {
                ret = -ENOMEM;
                goto end;
@@ -542,7 +542,7 @@ int kernctl_filter(int fd, const struct lttng_bytecode *filter)
        int ret;
 
        /* Translate bytecode to kernel bytecode */
-       kb = (lttng_kernel_abi_filter_bytecode *) zmalloc(sizeof(*kb) + filter->len);
+       kb = zmalloc<lttng_kernel_abi_filter_bytecode>(sizeof(*kb) + filter->len);
        if (!kb)
                return -ENOMEM;
        kb->len = len = filter->len;
This page took 0.0251 seconds and 4 git commands to generate.