From: David Goulet Date: Wed, 19 Dec 2012 23:11:12 +0000 (-0500) Subject: Fix: change perror to debug statement X-Git-Tag: v2.1.0~12 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3448e2667be7445ae7630a18c2ab32cb2bcdd174;p=lttng-tools.git Fix: change perror to debug statement Most of the changes here remove a double PERROR which is done by the transport layer. So we notify in the debug message to understand where the transport error was. Also, don't print an error if the relayd is not found. This is possible if the relayd dies so an error here is useless to the common user but useful as a debug statement. Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index ff55b57df..26ff56eff 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -46,7 +46,8 @@ int consumer_recv_status_reply(struct consumer_socket *sock) ret = lttcomm_recv_unix_sock(sock->fd, &reply, sizeof(reply)); if (ret < 0) { - PERROR("recv consumer status msg"); + /* The above call will print a PERROR on error. */ + DBG("Fail to receive status reply on sock %d", sock->fd); goto end; } @@ -55,7 +56,7 @@ int consumer_recv_status_reply(struct consumer_socket *sock) ret = 0; } else { ret = -reply.ret_code; - ERR("Consumer ret code %d", reply.ret_code); + DBG("Consumer ret code %d", reply.ret_code); } end: @@ -492,7 +493,8 @@ int consumer_send_fds(struct consumer_socket *sock, int *fds, size_t nb_fd) ret = lttcomm_send_fds_unix_sock(sock->fd, fds, nb_fd); if (ret < 0) { - PERROR("send consumer fds"); + /* The above call will print a PERROR on error. */ + DBG("Error when sending consumer fds on sock %d", sock->fd); goto error; } @@ -517,7 +519,8 @@ int consumer_send_channel(struct consumer_socket *sock, ret = lttcomm_send_unix_sock(sock->fd, msg, sizeof(struct lttcomm_consumer_msg)); if (ret < 0) { - PERROR("send consumer channel"); + /* The above call will print a PERROR on error. */ + DBG("Error when sending consumer channel on sock %d", sock->fd); goto error; } @@ -635,7 +638,8 @@ int consumer_send_stream(struct consumer_socket *sock, ret = lttcomm_send_unix_sock(sock->fd, msg, sizeof(struct lttcomm_consumer_msg)); if (ret < 0) { - PERROR("send consumer stream"); + /* The above call will print a PERROR on error. */ + DBG("Error when sending consumer stream on sock %d", sock->fd); goto error; } @@ -690,7 +694,8 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock, DBG3("Sending relayd sock info to consumer on %d", consumer_sock->fd); ret = lttcomm_send_unix_sock(consumer_sock->fd, &msg, sizeof(msg)); if (ret < 0) { - PERROR("send consumer relayd socket info"); + /* The above call will print a PERROR on error. */ + DBG("Error when sending relayd sockets on sock %d", sock->fd); goto error; } @@ -793,7 +798,8 @@ int consumer_is_data_pending(unsigned int id, ret = lttcomm_send_unix_sock(socket->fd, &msg, sizeof(msg)); if (ret < 0) { - PERROR("send consumer data pending command"); + /* The above call will print a PERROR on error. */ + DBG("Error on consumer is data pending on sock %d", socket->fd); pthread_mutex_unlock(socket->lock); goto error; } @@ -805,7 +811,8 @@ int consumer_is_data_pending(unsigned int id, ret = lttcomm_recv_unix_sock(socket->fd, &ret_code, sizeof(ret_code)); if (ret < 0) { - PERROR("recv consumer data pending status"); + /* The above call will print a PERROR on error. */ + DBG("Error on recv consumer is data pending on sock %d", socket->fd); pthread_mutex_unlock(socket->lock); goto error; } @@ -817,7 +824,8 @@ int consumer_is_data_pending(unsigned int id, } } - DBG("Consumer data pending ret %d", ret_code); + DBG("Consumer data is %s pending for session id %u", + ret_code == 1 ? "" : "NOT", id); return ret_code; error: diff --git a/src/common/kernel-consumer/kernel-consumer.c b/src/common/kernel-consumer/kernel-consumer.c index bc4f59716..21e1f41c5 100644 --- a/src/common/kernel-consumer/kernel-consumer.c +++ b/src/common/kernel-consumer/kernel-consumer.c @@ -297,7 +297,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, /* Get relayd reference if exists. */ relayd = consumer_find_relayd(index); if (relayd == NULL) { - ERR("Unable to find relayd %" PRIu64, index); + DBG("Unable to find relayd %" PRIu64, index); ret_code = LTTNG_ERR_NO_CONSUMER; } diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index 1d8f6e81f..3047aec41 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -333,7 +333,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, /* Get relayd reference if exists. */ relayd = consumer_find_relayd(index); if (relayd == NULL) { - ERR("Unable to find relayd %" PRIu64, index); + DBG("Unable to find relayd %" PRIu64, index); ret_code = LTTNG_ERR_NO_CONSUMER; }