X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Flttng-syscall.cpp;h=8a4ce39ea8e6bcd6b9fbf71d9cd39f02d2f99ad1;hb=36962e16797b5ca590c54a385ca594e2859ef8c2;hp=42e902b5e2eccb3c964f8cd033a1d0306fd49d93;hpb=48b7cdc221a445188d6d9bd08fc1686837e71224;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/lttng-syscall.cpp b/src/bin/lttng-sessiond/lttng-syscall.cpp index 42e902b5e..8a4ce39ea 100644 --- a/src/bin/lttng-sessiond/lttng-syscall.cpp +++ b/src/bin/lttng-sessiond/lttng-syscall.cpp @@ -8,13 +8,13 @@ #define _LGPL_SOURCE #include -#include -#include +#include +#include -#include "lttng-sessiond.h" -#include "kernel.h" -#include "lttng-syscall.h" -#include "utils.h" +#include "lttng-sessiond.hpp" +#include "kernel.hpp" +#include "lttng-syscall.hpp" +#include "utils.hpp" /* Global syscall table. */ struct syscall *syscall_table; @@ -60,7 +60,7 @@ int syscall_init_table(int tracer_fd) } nbmem = SYSCALL_TABLE_INIT_SIZE; - syscall_table = (struct syscall *) zmalloc(sizeof(struct syscall) * nbmem); + syscall_table = calloc(nbmem); if (!syscall_table) { ret = -errno; PERROR("syscall list zmalloc"); @@ -210,7 +210,7 @@ static struct syscall *lookup_syscall(struct lttng_ht *ht, const char *name) lttng_ht_lookup(ht, (void *) name, &iter); node = lttng_ht_iter_get_node_str(&iter); if (node) { - ksyscall = caa_container_of(node, struct syscall, node); + ksyscall = lttng::utils::container_of(node, &syscall::node); } return ksyscall; @@ -245,7 +245,7 @@ static int add_syscall_to_ht(struct lttng_ht *ht, unsigned int index, LTTNG_ASSERT(ht); - ksyscall = (struct syscall *) zmalloc(sizeof(*ksyscall)); + ksyscall = zmalloc(); if (!ksyscall) { ret = -LTTNG_ERR_NOMEM; goto error; @@ -288,7 +288,7 @@ ssize_t syscall_table_list(struct lttng_event **_events) * them might not be valid. The count below will make sure to return the * right size of the events array. */ - events = (lttng_event *) zmalloc(syscall_table_nb_entry * sizeof(*events)); + events = calloc(syscall_table_nb_entry); if (!events) { PERROR("syscall table list zmalloc"); ret = -LTTNG_ERR_NOMEM;