#define _LGPL_SOURCE
#include <algorithm>
-#include <common/common.h>
-#include <common/defaults.h>
-#include <common/fs-handle.h>
-#include <common/sessiond-comm/relayd.h>
-#include <common/utils.h>
+#include <common/common.hpp>
+#include <common/defaults.hpp>
+#include <common/fs-handle.hpp>
+#include <common/sessiond-comm/relayd.hpp>
+#include <common/utils.hpp>
#include <sys/stat.h>
#include <urcu/rculist.h>
-#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 <sys/types.h>
#include <fcntl.h>
/* 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);
}
}
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++;
}
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<uint64_t>(copy_bytes_left, sizeof(copy_buffer));
io_ret = fs_handle_read(previous_stream_file, copy_buffer,
copy_size_this_pass);
bool acquired_reference = false;
struct lttng_trace_chunk *current_trace_chunk;
- stream = (relay_stream *) zmalloc(sizeof(struct relay_stream));
+ stream = zmalloc<relay_stream>();
if (stream == NULL) {
PERROR("relay stream zmalloc");
goto error_no_alloc;