X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fmain.c;h=f5f1ad3b488ac91c5cd3eecddfd3c3799bbebaef;hb=2288467f63826a06d25ac361fa04ea92ec7ddfa3;hp=45b7de8c657f9b43a426057fc07f7a299689dc75;hpb=4f5fb4c3d8752aae822ed0066784cc77e6f0f508;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 45b7de8c6..f5f1ad3b4 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -751,6 +751,7 @@ static struct lttcomm_sock *relay_socket_create(struct lttng_uri *uri) ret = sock->ops->bind(sock); if (ret < 0) { + PERROR("Failed to bind socket"); goto error; } @@ -1588,6 +1589,7 @@ static int rotate_truncate_stream(struct relay_stream *stream) { int ret, new_fd; + off_t lseek_ret; uint64_t diff, pos = 0; char buf[FILE_COPY_BUFFER_SIZE]; @@ -1614,10 +1616,11 @@ int rotate_truncate_stream(struct relay_stream *stream) * Rewind the current tracefile to the position at which the rotation * should have occured. */ - ret = lseek(stream->stream_fd->fd, + lseek_ret = lseek(stream->stream_fd->fd, stream->pos_after_last_complete_data_index, SEEK_SET); - if (ret < 0) { + if (lseek_ret < 0) { PERROR("seek truncate stream"); + ret = -1; goto end; } @@ -1722,7 +1725,8 @@ int try_rotate_stream(struct relay_stream *stream) goto end; } - if (stream->prev_seq < stream->rotate_at_seq_num) { + if (stream->prev_seq < stream->rotate_at_seq_num || + stream->prev_seq == -1ULL) { DBG("Stream %" PRIu64 " no yet ready for rotation", stream->stream_handle); goto end; @@ -2803,7 +2807,7 @@ int relay_rotate_pending(struct lttcomm_relayd_hdr *recv_hdr, { struct relay_session *session = conn->session; struct lttcomm_relayd_rotate_pending msg; - struct lttcomm_relayd_generic_reply reply; + struct lttcomm_relayd_rotate_pending_reply reply; struct lttng_ht_iter iter; struct relay_stream *stream; int ret = 0; @@ -2883,7 +2887,8 @@ int relay_rotate_pending(struct lttcomm_relayd_hdr *recv_hdr, send_reply: rcu_read_unlock(); memset(&reply, 0, sizeof(reply)); - reply.ret_code = htobe32(rotate_pending ? 1 : 0); + reply.generic.ret_code = htobe32((uint32_t) LTTNG_OK); + reply.is_pending = (uint8_t) !!rotate_pending; network_ret = conn->sock->ops->sendmsg(conn->sock, &reply, sizeof(reply), 0); if (network_ret < (ssize_t) sizeof(reply)) {