2 * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <common/common.h>
27 #include <common/defaults.h>
28 #include <common/compat/endian.h>
29 #include <common/sessiond-comm/relayd.h>
30 #include <common/index/ctf-index.h>
35 * Send command. Fill up the header and append the data.
37 static int send_command(struct lttcomm_relayd_sock
*rsock
,
38 enum lttcomm_relayd_command cmd
, void *data
, size_t size
,
42 struct lttcomm_relayd_hdr header
;
44 uint64_t buf_size
= sizeof(header
);
46 if (rsock
->sock
.fd
< 0) {
54 buf
= zmalloc(buf_size
);
56 PERROR("zmalloc relayd send command buf");
61 memset(&header
, 0, sizeof(header
));
62 header
.cmd
= htobe32(cmd
);
63 header
.data_size
= htobe64(size
);
65 /* Zeroed for now since not used. */
66 header
.cmd_version
= 0;
67 header
.circuit_id
= 0;
69 /* Prepare buffer to send. */
70 memcpy(buf
, &header
, sizeof(header
));
72 memcpy(buf
+ sizeof(header
), data
, size
);
75 ret
= rsock
->sock
.ops
->sendmsg(&rsock
->sock
, buf
, buf_size
, flags
);
81 DBG3("Relayd sending command %d of size %" PRIu64
, cmd
, buf_size
);
90 * Receive reply data on socket. This MUST be call after send_command or else
91 * could result in unexpected behavior(s).
93 static int recv_reply(struct lttcomm_relayd_sock
*rsock
, void *data
, size_t size
)
97 if (rsock
->sock
.fd
< 0) {
101 DBG3("Relayd waiting for reply of size %zu", size
);
103 ret
= rsock
->sock
.ops
->recvmsg(&rsock
->sock
, data
, size
, 0);
104 if (ret
<= 0 || ret
!= size
) {
106 /* Orderly shutdown. */
107 DBG("Socket %d has performed an orderly shutdown", rsock
->sock
.fd
);
109 DBG("Receiving reply failed on sock %d for size %zu with ret %d",
110 rsock
->sock
.fd
, size
, ret
);
112 /* Always return -1 here and the caller can use errno. */
122 * Starting at 2.4, RELAYD_CREATE_SESSION takes additional parameters to
123 * support the live reading capability.
125 static int relayd_create_session_2_4(struct lttcomm_relayd_sock
*rsock
,
126 uint64_t *session_id
, char *session_name
, char *hostname
,
127 int session_live_timer
, unsigned int snapshot
)
130 struct lttcomm_relayd_create_session_2_4 msg
;
132 if (lttng_strncpy(msg
.session_name
, session_name
,
133 sizeof(msg
.session_name
))) {
137 if (lttng_strncpy(msg
.hostname
, hostname
, sizeof(msg
.hostname
))) {
141 msg
.live_timer
= htobe32(session_live_timer
);
142 msg
.snapshot
= htobe32(snapshot
);
145 ret
= send_command(rsock
, RELAYD_CREATE_SESSION
, &msg
, sizeof(msg
), 0);
155 * RELAYD_CREATE_SESSION from 2.1 to 2.3.
157 static int relayd_create_session_2_1(struct lttcomm_relayd_sock
*rsock
,
158 uint64_t *session_id
)
163 ret
= send_command(rsock
, RELAYD_CREATE_SESSION
, NULL
, 0, 0);
173 * Send a RELAYD_CREATE_SESSION command to the relayd with the given socket and
174 * set session_id of the relayd if we have a successful reply from the relayd.
176 * On success, return 0 else a negative value which is either an errno error or
177 * a lttng error code from the relayd.
179 int relayd_create_session(struct lttcomm_relayd_sock
*rsock
, uint64_t *session_id
,
180 char *session_name
, char *hostname
, int session_live_timer
,
181 unsigned int snapshot
)
184 struct lttcomm_relayd_status_session reply
;
189 DBG("Relayd create session");
191 switch(rsock
->minor
) {
195 ret
= relayd_create_session_2_1(rsock
, session_id
);
199 ret
= relayd_create_session_2_4(rsock
, session_id
, session_name
,
200 hostname
, session_live_timer
, snapshot
);
208 /* Receive response */
209 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
214 reply
.session_id
= be64toh(reply
.session_id
);
215 reply
.ret_code
= be32toh(reply
.ret_code
);
217 /* Return session id or negative ret code. */
218 if (reply
.ret_code
!= LTTNG_OK
) {
220 ERR("Relayd create session replied error %d", reply
.ret_code
);
224 *session_id
= reply
.session_id
;
227 DBG("Relayd session created with id %" PRIu64
, reply
.session_id
);
234 * Add stream on the relayd and assign stream handle to the stream_id argument.
236 * On success return 0 else return ret_code negative value.
238 int relayd_add_stream(struct lttcomm_relayd_sock
*rsock
, const char *channel_name
,
239 const char *pathname
, uint64_t *stream_id
,
240 uint64_t tracefile_size
, uint64_t tracefile_count
,
241 enum lttng_domain_type domain
)
244 struct lttcomm_relayd_add_stream msg
;
245 struct lttcomm_relayd_add_stream_2_2 msg_2_2
;
246 struct lttcomm_relayd_add_stream_2_11 msg_2_11
;
247 struct lttcomm_relayd_status_stream reply
;
249 /* Code flow error. Safety net. */
251 assert(channel_name
);
254 DBG("Relayd adding stream for channel name %s", channel_name
);
256 /* Compat with relayd 2.1 */
257 switch (rsock
->minor
) {
259 memset(&msg
, 0, sizeof(msg
));
260 if (lttng_strncpy(msg
.channel_name
, channel_name
,
261 sizeof(msg
.channel_name
))) {
265 if (lttng_strncpy(msg
.pathname
, pathname
,
266 sizeof(msg
.pathname
))) {
272 ret
= send_command(rsock
, RELAYD_ADD_STREAM
, (void *) &msg
, sizeof(msg
), 0);
286 memset(&msg_2_2
, 0, sizeof(msg_2_2
));
287 /* Compat with relayd 2.2+ */
288 if (lttng_strncpy(msg_2_2
.channel_name
, channel_name
,
289 sizeof(msg_2_2
.channel_name
))) {
293 if (lttng_strncpy(msg_2_2
.pathname
, pathname
,
294 sizeof(msg_2_2
.pathname
))) {
298 msg_2_2
.tracefile_size
= htobe64(tracefile_size
);
299 msg_2_2
.tracefile_count
= htobe64(tracefile_count
);
302 ret
= send_command(rsock
, RELAYD_ADD_STREAM
, (void *) &msg_2_2
, sizeof(msg_2_2
), 0);
309 memset(&msg_2_11
, 0, sizeof(msg_2_11
));
310 /* Compat with relayd 2.11+ */
311 if (lttng_strncpy(msg_2_11
.channel_name
, channel_name
,
312 sizeof(msg_2_11
.channel_name
))) {
316 if (lttng_strncpy(msg_2_11
.pathname
, pathname
,
317 sizeof(msg_2_11
.pathname
))) {
321 msg_2_11
.tracefile_size
= htobe64(tracefile_size
);
322 msg_2_11
.tracefile_count
= htobe64(tracefile_count
);
323 msg_2_11
.domain
= htobe32(domain
);
326 ret
= send_command(rsock
, RELAYD_ADD_STREAM
, (void *) &msg_2_11
, sizeof(msg_2_11
), 0);
333 /* Waiting for reply */
334 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
339 /* Back to host bytes order. */
340 reply
.handle
= be64toh(reply
.handle
);
341 reply
.ret_code
= be32toh(reply
.ret_code
);
343 /* Return session id or negative ret code. */
344 if (reply
.ret_code
!= LTTNG_OK
) {
346 ERR("Relayd add stream replied error %d", reply
.ret_code
);
350 *stream_id
= reply
.handle
;
353 DBG("Relayd stream added successfully with handle %" PRIu64
,
361 * Inform the relay that all the streams for the current channel has been sent.
363 * On success return 0 else return ret_code negative value.
365 int relayd_streams_sent(struct lttcomm_relayd_sock
*rsock
)
368 struct lttcomm_relayd_generic_reply reply
;
370 /* Code flow error. Safety net. */
373 DBG("Relayd sending streams sent.");
375 /* This feature was introduced in 2.4, ignore it for earlier versions. */
376 if (rsock
->minor
< 4) {
382 ret
= send_command(rsock
, RELAYD_STREAMS_SENT
, NULL
, 0, 0);
387 /* Waiting for reply */
388 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
393 /* Back to host bytes order. */
394 reply
.ret_code
= be32toh(reply
.ret_code
);
396 /* Return session id or negative ret code. */
397 if (reply
.ret_code
!= LTTNG_OK
) {
399 ERR("Relayd streams sent replied error %d", reply
.ret_code
);
406 DBG("Relayd streams sent success");
414 * Check version numbers on the relayd.
415 * If major versions are compatible, we assign minor_to_use to the
416 * minor version of the procotol we are going to use for this session.
418 * Return 0 if compatible else negative value.
420 int relayd_version_check(struct lttcomm_relayd_sock
*rsock
)
423 struct lttcomm_relayd_version msg
;
425 /* Code flow error. Safety net. */
428 DBG("Relayd version check for major.minor %u.%u", rsock
->major
,
431 memset(&msg
, 0, sizeof(msg
));
432 /* Prepare network byte order before transmission. */
433 msg
.major
= htobe32(rsock
->major
);
434 msg
.minor
= htobe32(rsock
->minor
);
437 ret
= send_command(rsock
, RELAYD_VERSION
, (void *) &msg
, sizeof(msg
), 0);
442 /* Receive response */
443 ret
= recv_reply(rsock
, (void *) &msg
, sizeof(msg
));
448 /* Set back to host bytes order */
449 msg
.major
= be32toh(msg
.major
);
450 msg
.minor
= be32toh(msg
.minor
);
453 * Only validate the major version. If the other side is higher,
454 * communication is not possible. Only major version equal can talk to each
455 * other. If the minor version differs, the lowest version is used by both
458 if (msg
.major
!= rsock
->major
) {
461 DBG2("Relayd version is NOT compatible. Relayd version %u != %u (us)",
462 msg
.major
, rsock
->major
);
467 * If the relayd's minor version is higher, it will adapt to our version so
468 * we can continue to use the latest relayd communication data structure.
469 * If the received minor version is higher, the relayd should adapt to us.
471 if (rsock
->minor
> msg
.minor
) {
472 rsock
->minor
= msg
.minor
;
475 /* Version number compatible */
476 DBG2("Relayd version is compatible, using protocol version %u.%u",
477 rsock
->major
, rsock
->minor
);
485 * Add stream on the relayd and assign stream handle to the stream_id argument.
487 * On success return 0 else return ret_code negative value.
489 int relayd_send_metadata(struct lttcomm_relayd_sock
*rsock
, size_t len
)
493 /* Code flow error. Safety net. */
496 DBG("Relayd sending metadata of size %zu", len
);
499 ret
= send_command(rsock
, RELAYD_SEND_METADATA
, NULL
, len
, 0);
504 DBG2("Relayd metadata added successfully");
507 * After that call, the metadata data MUST be sent to the relayd so the
508 * receive size on the other end matches the len of the metadata packet
509 * header. This is why we don't wait for a reply here.
517 * Connect to relay daemon with an allocated lttcomm_relayd_sock.
519 int relayd_connect(struct lttcomm_relayd_sock
*rsock
)
521 /* Code flow error. Safety net. */
524 if (!rsock
->sock
.ops
) {
526 * Attempting a connect on a non-initialized socket.
531 DBG3("Relayd connect ...");
533 return rsock
->sock
.ops
->connect(&rsock
->sock
);
537 * Close relayd socket with an allocated lttcomm_relayd_sock.
539 * If no socket operations are found, simply return 0 meaning that everything
540 * is fine. Without operations, the socket can not possibly be opened or used.
541 * This is possible if the socket was allocated but not created. However, the
542 * caller could simply use it to store a valid file descriptor for instance
543 * passed over a Unix socket and call this to cleanup but still without a valid
546 * Return the close returned value. On error, a negative value is usually
547 * returned back from close(2).
549 int relayd_close(struct lttcomm_relayd_sock
*rsock
)
553 /* Code flow error. Safety net. */
556 /* An invalid fd is fine, return success. */
557 if (rsock
->sock
.fd
< 0) {
562 DBG3("Relayd closing socket %d", rsock
->sock
.fd
);
564 if (rsock
->sock
.ops
) {
565 ret
= rsock
->sock
.ops
->close(&rsock
->sock
);
567 /* Default call if no specific ops found. */
568 ret
= close(rsock
->sock
.fd
);
570 PERROR("relayd_close default close");
580 * Send data header structure to the relayd.
582 int relayd_send_data_hdr(struct lttcomm_relayd_sock
*rsock
,
583 struct lttcomm_relayd_data_hdr
*hdr
, size_t size
)
587 /* Code flow error. Safety net. */
591 if (rsock
->sock
.fd
< 0) {
595 DBG3("Relayd sending data header of size %zu", size
);
597 /* Again, safety net */
599 size
= sizeof(struct lttcomm_relayd_data_hdr
);
602 /* Only send data header. */
603 ret
= rsock
->sock
.ops
->sendmsg(&rsock
->sock
, hdr
, size
, 0);
610 * The data MUST be sent right after that command for the receive on the
611 * other end to match the size in the header.
619 * Send close stream command to the relayd.
621 int relayd_send_close_stream(struct lttcomm_relayd_sock
*rsock
, uint64_t stream_id
,
622 uint64_t last_net_seq_num
)
625 struct lttcomm_relayd_close_stream msg
;
626 struct lttcomm_relayd_generic_reply reply
;
628 /* Code flow error. Safety net. */
631 DBG("Relayd closing stream id %" PRIu64
, stream_id
);
633 memset(&msg
, 0, sizeof(msg
));
634 msg
.stream_id
= htobe64(stream_id
);
635 msg
.last_net_seq_num
= htobe64(last_net_seq_num
);
638 ret
= send_command(rsock
, RELAYD_CLOSE_STREAM
, (void *) &msg
, sizeof(msg
), 0);
643 /* Receive response */
644 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
649 reply
.ret_code
= be32toh(reply
.ret_code
);
651 /* Return session id or negative ret code. */
652 if (reply
.ret_code
!= LTTNG_OK
) {
654 ERR("Relayd close stream replied error %d", reply
.ret_code
);
660 DBG("Relayd close stream id %" PRIu64
" successfully", stream_id
);
667 * Check for data availability for a given stream id.
669 * Return 0 if NOT pending, 1 if so and a negative value on error.
671 int relayd_data_pending(struct lttcomm_relayd_sock
*rsock
, uint64_t stream_id
,
672 uint64_t last_net_seq_num
)
675 struct lttcomm_relayd_data_pending msg
;
676 struct lttcomm_relayd_generic_reply reply
;
678 /* Code flow error. Safety net. */
681 DBG("Relayd data pending for stream id %" PRIu64
, stream_id
);
683 memset(&msg
, 0, sizeof(msg
));
684 msg
.stream_id
= htobe64(stream_id
);
685 msg
.last_net_seq_num
= htobe64(last_net_seq_num
);
688 ret
= send_command(rsock
, RELAYD_DATA_PENDING
, (void *) &msg
,
694 /* Receive response */
695 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
700 reply
.ret_code
= be32toh(reply
.ret_code
);
702 /* Return session id or negative ret code. */
703 if (reply
.ret_code
>= LTTNG_OK
) {
704 ERR("Relayd data pending replied error %d", reply
.ret_code
);
707 /* At this point, the ret code is either 1 or 0 */
708 ret
= reply
.ret_code
;
710 DBG("Relayd data is %s pending for stream id %" PRIu64
,
711 ret
== 1 ? "" : "NOT", stream_id
);
718 * Check on the relayd side for a quiescent state on the control socket.
720 int relayd_quiescent_control(struct lttcomm_relayd_sock
*rsock
,
721 uint64_t metadata_stream_id
)
724 struct lttcomm_relayd_quiescent_control msg
;
725 struct lttcomm_relayd_generic_reply reply
;
727 /* Code flow error. Safety net. */
730 DBG("Relayd checking quiescent control state");
732 memset(&msg
, 0, sizeof(msg
));
733 msg
.stream_id
= htobe64(metadata_stream_id
);
736 ret
= send_command(rsock
, RELAYD_QUIESCENT_CONTROL
, &msg
, sizeof(msg
), 0);
741 /* Receive response */
742 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
747 reply
.ret_code
= be32toh(reply
.ret_code
);
749 /* Return session id or negative ret code. */
750 if (reply
.ret_code
!= LTTNG_OK
) {
752 ERR("Relayd quiescent control replied error %d", reply
.ret_code
);
756 /* Control socket is quiescent */
764 * Begin a data pending command for a specific session id.
766 int relayd_begin_data_pending(struct lttcomm_relayd_sock
*rsock
, uint64_t id
)
769 struct lttcomm_relayd_begin_data_pending msg
;
770 struct lttcomm_relayd_generic_reply reply
;
772 /* Code flow error. Safety net. */
775 DBG("Relayd begin data pending");
777 memset(&msg
, 0, sizeof(msg
));
778 msg
.session_id
= htobe64(id
);
781 ret
= send_command(rsock
, RELAYD_BEGIN_DATA_PENDING
, &msg
, sizeof(msg
), 0);
786 /* Receive response */
787 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
792 reply
.ret_code
= be32toh(reply
.ret_code
);
794 /* Return session id or negative ret code. */
795 if (reply
.ret_code
!= LTTNG_OK
) {
797 ERR("Relayd begin data pending replied error %d", reply
.ret_code
);
808 * End a data pending command for a specific session id.
810 * Return 0 on success and set is_data_inflight to 0 if no data is being
811 * streamed or 1 if it is the case.
813 int relayd_end_data_pending(struct lttcomm_relayd_sock
*rsock
, uint64_t id
,
814 unsigned int *is_data_inflight
)
817 struct lttcomm_relayd_end_data_pending msg
;
818 struct lttcomm_relayd_generic_reply reply
;
820 /* Code flow error. Safety net. */
823 DBG("Relayd end data pending");
825 memset(&msg
, 0, sizeof(msg
));
826 msg
.session_id
= htobe64(id
);
829 ret
= send_command(rsock
, RELAYD_END_DATA_PENDING
, &msg
, sizeof(msg
), 0);
834 /* Receive response */
835 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
840 recv_ret
= be32toh(reply
.ret_code
);
846 *is_data_inflight
= recv_ret
;
848 DBG("Relayd end data pending is data inflight: %d", recv_ret
);
857 * Send index to the relayd.
859 int relayd_send_index(struct lttcomm_relayd_sock
*rsock
,
860 struct ctf_packet_index
*index
, uint64_t relay_stream_id
,
861 uint64_t net_seq_num
)
864 struct lttcomm_relayd_index msg
;
865 struct lttcomm_relayd_generic_reply reply
;
867 /* Code flow error. Safety net. */
870 if (rsock
->minor
< 4) {
871 DBG("Not sending indexes before protocol 2.4");
876 DBG("Relayd sending index for stream ID %" PRIu64
, relay_stream_id
);
878 memset(&msg
, 0, sizeof(msg
));
879 msg
.relay_stream_id
= htobe64(relay_stream_id
);
880 msg
.net_seq_num
= htobe64(net_seq_num
);
882 /* The index is already in big endian. */
883 msg
.packet_size
= index
->packet_size
;
884 msg
.content_size
= index
->content_size
;
885 msg
.timestamp_begin
= index
->timestamp_begin
;
886 msg
.timestamp_end
= index
->timestamp_end
;
887 msg
.events_discarded
= index
->events_discarded
;
888 msg
.stream_id
= index
->stream_id
;
890 if (rsock
->minor
>= 8) {
891 msg
.stream_instance_id
= index
->stream_instance_id
;
892 msg
.packet_seq_num
= index
->packet_seq_num
;
896 ret
= send_command(rsock
, RELAYD_SEND_INDEX
, &msg
,
897 lttcomm_relayd_index_len(lttng_to_index_major(rsock
->major
,
899 lttng_to_index_minor(rsock
->major
, rsock
->minor
)),
905 /* Receive response */
906 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
911 reply
.ret_code
= be32toh(reply
.ret_code
);
913 /* Return session id or negative ret code. */
914 if (reply
.ret_code
!= LTTNG_OK
) {
916 ERR("Relayd send index replied error %d", reply
.ret_code
);
927 * Ask the relay to reset the metadata trace file (regeneration).
929 int relayd_reset_metadata(struct lttcomm_relayd_sock
*rsock
,
930 uint64_t stream_id
, uint64_t version
)
933 struct lttcomm_relayd_reset_metadata msg
;
934 struct lttcomm_relayd_generic_reply reply
;
936 /* Code flow error. Safety net. */
939 /* Should have been prevented by the sessiond. */
940 if (rsock
->minor
< 8) {
941 ERR("Metadata regeneration unsupported before 2.8");
946 DBG("Relayd reset metadata stream id %" PRIu64
, stream_id
);
948 memset(&msg
, 0, sizeof(msg
));
949 msg
.stream_id
= htobe64(stream_id
);
950 msg
.version
= htobe64(version
);
953 ret
= send_command(rsock
, RELAYD_RESET_METADATA
, (void *) &msg
, sizeof(msg
), 0);
958 /* Receive response */
959 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
964 reply
.ret_code
= be32toh(reply
.ret_code
);
966 /* Return session id or negative ret code. */
967 if (reply
.ret_code
!= LTTNG_OK
) {
969 ERR("Relayd reset metadata replied error %d", reply
.ret_code
);
975 DBG("Relayd reset metadata stream id %" PRIu64
" successfully", stream_id
);
981 int relayd_rotate_stream(struct lttcomm_relayd_sock
*rsock
, uint64_t stream_id
,
982 const char *new_pathname
, uint64_t new_chunk_id
,
986 struct lttcomm_relayd_rotate_stream msg
;
987 struct lttcomm_relayd_generic_reply reply
;
989 /* Code flow error. Safety net. */
992 DBG("Relayd rotating stream id %" PRIu64
, stream_id
);
994 memset(&msg
, 0, sizeof(msg
));
995 msg
.stream_id
= htobe64(stream_id
);
996 msg
.rotate_at_seq_num
= htobe64(seq_num
);
997 msg
.new_chunk_id
= htobe64(new_chunk_id
);
998 if (lttng_strncpy(msg
.new_pathname
, new_pathname
,
999 sizeof(msg
.new_pathname
))) {
1005 ret
= send_command(rsock
, RELAYD_ROTATE_STREAM
, (void *) &msg
, sizeof(msg
), 0);
1010 /* Receive response */
1011 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
1016 reply
.ret_code
= be32toh(reply
.ret_code
);
1018 /* Return session id or negative ret code. */
1019 if (reply
.ret_code
!= LTTNG_OK
) {
1021 ERR("Relayd rotate stream replied error %d", reply
.ret_code
);
1027 DBG("Relayd rotated stream id %" PRIu64
" successfully", stream_id
);
1033 int relayd_rotate_rename(struct lttcomm_relayd_sock
*rsock
,
1034 const char *current_path
, const char *new_path
)
1037 struct lttcomm_relayd_rotate_rename msg
;
1038 struct lttcomm_relayd_generic_reply reply
;
1040 /* Code flow error. Safety net. */
1043 DBG("Relayd rename chunk %s to %s", current_path
, new_path
);
1045 memset(&msg
, 0, sizeof(msg
));
1046 if (lttng_strncpy(msg
.current_path
, current_path
,
1047 sizeof(msg
.current_path
))) {
1051 if (lttng_strncpy(msg
.new_path
, new_path
,
1052 sizeof(msg
.new_path
))) {
1058 ret
= send_command(rsock
, RELAYD_ROTATE_RENAME
, (void *) &msg
, sizeof(msg
), 0);
1063 /* Receive response */
1064 ret
= recv_reply(rsock
, (void *) &reply
, sizeof(reply
));
1069 reply
.ret_code
= be32toh(reply
.ret_code
);
1071 /* Return session id or negative ret code. */
1072 if (reply
.ret_code
!= LTTNG_OK
) {
1074 ERR("Relayd rotate rename replied error %d", reply
.ret_code
);
1080 DBG("Relayd rotate rename completed successfully");