- if (lttng_strncpy(msg->new_pathname, new_pathname, len)) {
- ret = -1;
- ERR("Failed to copy relayd rotate stream command's new path name");
- goto error;
+ ret = lttng_dynamic_buffer_append(&payload, &msg, sizeof(msg));
+ if (ret) {
+ ERR("Failed to allocate \"rotate streams\" command payload");
+ goto error;
+ }
+
+ for (i = 0; i < stream_count; i++) {
+ const struct relayd_stream_rotation_position *position =
+ &positions[i];
+ const struct lttcomm_relayd_stream_rotation_position comm_position = {
+ .stream_id = htobe64(position->stream_id),
+ .rotate_at_seq_num = htobe64(
+ position->rotate_at_seq_num),
+ };
+
+ DBG("Rotate stream %" PRIu64 " at sequence number %" PRIu64,
+ position->stream_id,
+ position->rotate_at_seq_num);
+ ret = lttng_dynamic_buffer_append(&payload, &comm_position,
+ sizeof(comm_position));
+ if (ret) {
+ ERR("Failed to allocate \"rotate streams\" command payload");
+ goto error;
+ }