X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsnapshot.cpp;h=e0ffe69c0b1a5303cebfe908ab99cee7eb2220d1;hb=042670db60ac672661e1bbc8de4da1d8590e20b4;hp=44928edb06aaa78b13198fd7f4811fb3870155f3;hpb=3c3390532736cfb5198f863d0d2b218e21fcf76d;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/snapshot.cpp b/src/bin/lttng-sessiond/snapshot.cpp index 44928edb0..e0ffe69c0 100644 --- a/src/bin/lttng-sessiond/snapshot.cpp +++ b/src/bin/lttng-sessiond/snapshot.cpp @@ -10,10 +10,10 @@ #include #include -#include +#include -#include "snapshot.h" -#include "utils.h" +#include "snapshot.hpp" +#include "utils.hpp" /* * Return the atomically incremented value of next_output_id. @@ -165,7 +165,7 @@ error: struct snapshot_output *snapshot_output_alloc(void) { - return (snapshot_output *) zmalloc(sizeof(struct snapshot_output)); + return zmalloc(); } /* @@ -241,6 +241,7 @@ struct snapshot_output *snapshot_find_output_by_name(const char *name, LTTNG_ASSERT(snapshot); LTTNG_ASSERT(name); + ASSERT_RCU_READ_LOCKED(); cds_lfht_for_each_entry(snapshot->output_ht->ht, &iter.iter, output, node.node) { @@ -267,6 +268,7 @@ struct snapshot_output *snapshot_find_output_by_id(uint32_t id, struct snapshot_output *output = NULL; LTTNG_ASSERT(snapshot); + ASSERT_RCU_READ_LOCKED(); lttng_ht_lookup(snapshot->output_ht, (void *)((unsigned long) id), &iter); node = lttng_ht_iter_get_node_ulong(&iter); @@ -274,7 +276,7 @@ struct snapshot_output *snapshot_find_output_by_id(uint32_t id, DBG3("Snapshot output not found with id %" PRId32, id); goto error; } - output = caa_container_of(node, struct snapshot_output, node); + output = lttng::utils::container_of(node, &snapshot_output::node); error: return output;