X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftrace-kernel.cpp;h=23d808ce8852f155e82bcbf7dc6cd65f41f48703;hb=139a8d250fb18f8ffc95b0936f7285f7b484b72f;hp=cbe4c3c89e072f1cda7185b4607a23d19228ddce;hpb=ff9fe3137fc1aec6e18ebbf7c218907698206e7d;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/trace-kernel.cpp b/src/bin/lttng-sessiond/trace-kernel.cpp index cbe4c3c89..23d808ce8 100644 --- a/src/bin/lttng-sessiond/trace-kernel.cpp +++ b/src/bin/lttng-sessiond/trace-kernel.cpp @@ -15,26 +15,26 @@ #include #include #include -#include +#include #include -#include +#include #include -#include +#include #include -#include +#include #include -#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -#include "consumer.h" -#include "trace-kernel.h" -#include "lttng-sessiond.h" -#include "notification-thread-commands.h" +#include "consumer.hpp" +#include "trace-kernel.hpp" +#include "lttng-sessiond.hpp" +#include "notification-thread-commands.hpp" /* * Find the channel name for the given kernel session. @@ -151,7 +151,7 @@ struct ltt_kernel_session *trace_kernel_create_session(void) struct ltt_kernel_session *lks = NULL; /* Allocate a new ltt kernel session */ - lks = (ltt_kernel_session *) zmalloc(sizeof(struct ltt_kernel_session)); + lks = zmalloc(); if (lks == NULL) { PERROR("create kernel session zmalloc"); goto alloc_error; @@ -222,19 +222,19 @@ struct ltt_kernel_channel *trace_kernel_create_channel( LTTNG_ASSERT(chan); - lkc = (ltt_kernel_channel *) zmalloc(sizeof(struct ltt_kernel_channel)); + lkc = zmalloc(); if (lkc == NULL) { PERROR("ltt_kernel_channel zmalloc"); goto error; } - lkc->channel = (lttng_channel *) zmalloc(sizeof(struct lttng_channel)); + lkc->channel = zmalloc(); if (lkc->channel == NULL) { PERROR("lttng_channel zmalloc"); goto error; } - extended = (lttng_channel_extended *) zmalloc(sizeof(struct lttng_channel_extended)); + extended = zmalloc(); if (!extended) { PERROR("lttng_channel_channel zmalloc"); goto error; @@ -285,7 +285,7 @@ struct ltt_kernel_context *trace_kernel_create_context( { struct ltt_kernel_context *kctx; - kctx = (ltt_kernel_context *) zmalloc(sizeof(*kctx)); + kctx = zmalloc(); if (!kctx) { PERROR("zmalloc kernel context"); goto error; @@ -310,7 +310,7 @@ struct ltt_kernel_context *trace_kernel_copy_context( struct ltt_kernel_context *kctx_copy; LTTNG_ASSERT(kctx); - kctx_copy = (ltt_kernel_context *) zmalloc(sizeof(*kctx_copy)); + kctx_copy = zmalloc(); if (!kctx_copy) { PERROR("zmalloc ltt_kernel_context"); goto error; @@ -341,8 +341,8 @@ enum lttng_error_code trace_kernel_create_event( LTTNG_ASSERT(ev); - local_kernel_event = (ltt_kernel_event *) zmalloc(sizeof(struct ltt_kernel_event)); - attr = (lttng_kernel_abi_event *) zmalloc(sizeof(struct lttng_kernel_abi_event)); + local_kernel_event = zmalloc(); + attr = zmalloc(); if (local_kernel_event == NULL || attr == NULL) { PERROR("kernel event zmalloc"); ret = LTTNG_ERR_NOMEM; @@ -514,7 +514,7 @@ enum lttng_error_code trace_kernel_create_event_notifier_rule( LTTNG_ASSERT(event_rule_type != LTTNG_EVENT_RULE_TYPE_UNKNOWN); local_kernel_token_event_rule = - (ltt_kernel_event_notifier_rule *) zmalloc(sizeof(struct ltt_kernel_event_notifier_rule)); + zmalloc(); if (local_kernel_token_event_rule == NULL) { PERROR("Failed to allocate ltt_kernel_token_event_rule structure"); ret = LTTNG_ERR_NOMEM; @@ -594,7 +594,8 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( if (symbol_name) { strncpy_ret = lttng_strncpy( kernel_event_notifier->event.u.kprobe.symbol_name, - symbol_name, LTTNG_KERNEL_ABI_SYM_NAME_LEN); + symbol_name, + sizeof(kernel_event_notifier->event.u.kprobe.symbol_name)); if (strncpy_ret) { ret_code = LTTNG_ERR_INVALID; @@ -734,8 +735,8 @@ struct ltt_kernel_metadata *trace_kernel_create_metadata(void) struct ltt_kernel_metadata *lkm; struct lttng_channel *chan; - lkm = (ltt_kernel_metadata *) zmalloc(sizeof(struct ltt_kernel_metadata)); - chan = (lttng_channel *) zmalloc(sizeof(struct lttng_channel)); + lkm = zmalloc(); + chan = zmalloc(); if (lkm == NULL || chan == NULL) { PERROR("kernel metadata zmalloc"); goto error; @@ -800,7 +801,7 @@ struct ltt_kernel_stream *trace_kernel_create_stream(const char *name, LTTNG_ASSERT(name); - lks = (ltt_kernel_stream *) zmalloc(sizeof(struct ltt_kernel_stream)); + lks = zmalloc(); if (lks == NULL) { PERROR("kernel stream zmalloc"); goto error;