X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fstream.cpp;h=aba160bfa473c5ac401f9e62a55482839e3c837d;hb=c9e313bc594f40a86eed237dce222c0fc99c957f;hp=15800929552fe56242628a7e51a7b79bbc727920;hpb=ac497a37018f3c253d2e50397294f58d33f7f24f;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/stream.cpp b/src/bin/lttng-relayd/stream.cpp index 158009295..aba160bfa 100644 --- a/src/bin/lttng-relayd/stream.cpp +++ b/src/bin/lttng-relayd/stream.cpp @@ -10,18 +10,18 @@ #define _LGPL_SOURCE #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include -#include "lttng-relayd.h" -#include "index.h" -#include "stream.h" -#include "viewer-stream.h" +#include "lttng-relayd.hpp" +#include "index.hpp" +#include "stream.hpp" +#include "viewer-stream.hpp" #include #include @@ -31,6 +31,8 @@ /* Should be called with RCU read-side lock held. */ bool stream_get(struct relay_stream *stream) { + ASSERT_RCU_READ_LOCKED(); + return urcu_ref_get_unless_zero(&stream->ref); } @@ -71,7 +73,7 @@ static void stream_complete_rotation(struct relay_stream *stream) } lttng_trace_chunk_put(stream->trace_chunk); stream->trace_chunk = stream->ongoing_rotation.value.next_trace_chunk; - stream->ongoing_rotation = (typeof(stream->ongoing_rotation)) {}; + stream->ongoing_rotation = LTTNG_OPTIONAL_INIT_UNSET; stream->completed_rotation_count++; } @@ -261,7 +263,7 @@ static int rotate_truncate_stream(struct relay_stream *stream) while (copy_bytes_left) { ssize_t io_ret; char copy_buffer[FILE_IO_STACK_BUFFER_SIZE]; - const off_t copy_size_this_pass = std::min(copy_bytes_left, sizeof(copy_buffer)); + const off_t copy_size_this_pass = std::min(copy_bytes_left, sizeof(copy_buffer)); io_ret = fs_handle_read(previous_stream_file, copy_buffer, copy_size_this_pass);