From aff3dd5c0a0de4be28db5ac7d1f8b03d5c867497 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 3 Sep 2021 17:31:29 -0400 Subject: [PATCH] common: compile libkernel-ctl as C++ MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: If0c92341d8efea2d093d404d25399bd8d75fc059 Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- src/common/kernel-ctl/Makefile.am | 5 ++++- src/common/kernel-ctl/{kernel-ctl.c => kernel-ctl.cpp} | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) rename src/common/kernel-ctl/{kernel-ctl.c => kernel-ctl.cpp} (98%) diff --git a/src/common/kernel-ctl/Makefile.am b/src/common/kernel-ctl/Makefile.am index 904a566ae..976cfdbc8 100644 --- a/src/common/kernel-ctl/Makefile.am +++ b/src/common/kernel-ctl/Makefile.am @@ -2,4 +2,7 @@ noinst_LTLIBRARIES = libkernel-ctl.la -libkernel_ctl_la_SOURCES = kernel-ctl.c kernel-ctl.h kernel-ioctl.h +libkernel_ctl_la_SOURCES = \ + kernel-ctl.cpp \ + kernel-ctl.h \ + kernel-ioctl.h diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.cpp similarity index 98% rename from src/common/kernel-ctl/kernel-ctl.c rename to src/common/kernel-ctl/kernel-ctl.cpp index c535054cc..4d59bdf29 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.cpp @@ -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 = zmalloc(sizeof(*kmask) + array_alloc_len); + kmask = (lttng_kernel_abi_syscall_mask *) zmalloc(sizeof(*kmask) + array_alloc_len); if (!kmask) { ret = -1; goto end; @@ -193,7 +193,7 @@ int kernctl_syscall_mask(int fd, char **syscall_mask, uint32_t *nr_bits) goto end; } - new_mask = realloc(*syscall_mask, array_alloc_len); + new_mask = (char *) realloc(*syscall_mask, array_alloc_len); if (!new_mask) { 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 = zmalloc(sizeof(*kb) + capture->len); + kb = (lttng_kernel_abi_capture_bytecode *) zmalloc(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 = zmalloc(sizeof(*kb) + filter->len); + kb = (lttng_kernel_abi_filter_bytecode *) zmalloc(sizeof(*kb) + filter->len); if (!kb) return -ENOMEM; kb->len = len = filter->len; -- 2.34.1