Fix kconsumerd number of fd expected
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 27 Oct 2011 12:02:40 +0000 (08:02 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Thu, 27 Oct 2011 12:02:40 +0000 (08:02 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng-sessiond-comm.h
liblttng-kconsumer/lttng-kconsumer.c
liblttng-sessiond-comm/lttng-sessiond-comm.c

index 68d8b910914c053dcaf90f345b25e575ce749dc9..7da343a9d899a2509db98cb6caee827523541c39 100644 (file)
@@ -119,6 +119,7 @@ enum lttcomm_return_code {
        CONSUMERD_COMMAND_SOCK_READY,           /* when consumerd command socket ready */
        CONSUMERD_SUCCESS_RECV_FD,              /* success on receiving fds */
        CONSUMERD_ERROR_RECV_FD,                /* error on receiving fds */
+       CONSUMERD_ERROR_RECV_CMD,               /* error on receiving command */
        CONSUMERD_POLL_ERROR,                   /* Error in polling thread in kconsumerd */
        CONSUMERD_POLL_NVAL,                    /* Poll on closed fd */
        CONSUMERD_POLL_HUP,                     /* All fds have hungup */
index 40745178134ab89b4db597ad1ed4ef45e8151dff..778dd1631520d61c6c8eab2ae7a525d8c9a5660e 100644 (file)
@@ -200,7 +200,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
        ret = lttcomm_recv_unix_sock(sock, &msg, sizeof(msg));
        if (ret != sizeof(msg)) {
-               lttng_consumer_send_error(ctx, CONSUMERD_ERROR_RECV_FD);
+               lttng_consumer_send_error(ctx, CONSUMERD_ERROR_RECV_CMD);
                return ret;
        }
        if (msg.cmd_type == LTTNG_CONSUMER_STOP) {
@@ -236,26 +236,23 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        case LTTNG_CONSUMER_ADD_STREAM:
        {
                struct lttng_consumer_stream *new_stream;
-               int fds[2];
-               size_t nb_fd = 1;
+               int fd;
 
                /* block */
                if (lttng_consumer_poll_socket(consumer_sockpoll) < 0) {
                        return -EINTR;
                }
-               ret = lttcomm_recv_fds_unix_sock(sock, fds, nb_fd);
-               if (ret != sizeof(fds)) {
+               ret = lttcomm_recv_fds_unix_sock(sock, &fd, 1);
+               if (ret != sizeof(fd)) {
                        lttng_consumer_send_error(ctx, CONSUMERD_ERROR_RECV_FD);
                        return ret;
                }
-               if (nb_fd < 2)
-                       fds[1] = fds[0];        /* duplicate same fd if recv only one */
 
-               DBG("consumer_add_stream %s (%d,%d)", msg.u.stream.path_name,
-                       fds[0], fds[1]);
+               DBG("consumer_add_stream %s (%d)", msg.u.stream.path_name,
+                       fd);
                new_stream = consumer_allocate_stream(msg.u.stream.channel_key,
                                msg.u.stream.stream_key,
-                               fds[0], fds[1],
+                               fd, fd,
                                msg.u.stream.state,
                                msg.u.stream.mmap_len,
                                msg.u.stream.output,
index 5ba609e5aa098545d44035a47d7a84aca422d638..6e0e83b792cf64e5d2746ee81789c7ea95d9b3ae 100644 (file)
@@ -79,6 +79,7 @@ static const char *lttcomm_readable_code[] = {
        [ LTTCOMM_ERR_INDEX(CONSUMERD_COMMAND_SOCK_READY) ] = "consumerd command socket ready",
        [ LTTCOMM_ERR_INDEX(CONSUMERD_SUCCESS_RECV_FD) ] = "consumerd success on receiving fds",
        [ LTTCOMM_ERR_INDEX(CONSUMERD_ERROR_RECV_FD) ] = "consumerd error on receiving fds",
+       [ LTTCOMM_ERR_INDEX(CONSUMERD_ERROR_RECV_CMD) ] = "consumerd error on receiving command",
        [ LTTCOMM_ERR_INDEX(CONSUMERD_POLL_ERROR) ] = "consumerd error in polling thread",
        [ LTTCOMM_ERR_INDEX(CONSUMERD_POLL_NVAL) ] = "consumerd polling on closed fd",
        [ LTTCOMM_ERR_INDEX(CONSUMERD_POLL_HUP) ] = "consumerd all fd hung up",
This page took 0.035967 seconds and 4 git commands to generate.