From: David Goulet Date: Tue, 19 Jun 2012 19:13:16 +0000 (-0400) Subject: Remove useless arg from kernel consumer send stream X-Git-Tag: v2.1.0-rc1~106 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=97b6ffd01e16cbb0871722ee605bf02794031859;p=lttng-tools.git Remove useless arg from kernel consumer send stream The consumer_data structure was not used when sending kernel channel streams to the consumer. Now the function uses the consumer_data structure to get the consumer socket and the sock argument was removed. Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-sessiond/kernel-consumer.c b/src/bin/lttng-sessiond/kernel-consumer.c index f589c2a0b..bbf50d57b 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.c +++ b/src/bin/lttng-sessiond/kernel-consumer.c @@ -32,22 +32,24 @@ * Send all stream fds of kernel channel to the consumer. */ int kernel_consumer_send_channel_stream(struct consumer_data *consumer_data, - int sock, struct ltt_kernel_channel *channel, uid_t uid, gid_t gid) + struct ltt_kernel_channel *channel, uid_t uid, gid_t gid) { - int ret, count = 0; + int ret, count = 0, consumer_sock; struct ltt_kernel_stream *stream; struct lttcomm_consumer_msg lkm; DBG("Sending streams of channel %s to kernel consumer", channel->channel->name); + consumer_sock = consumer_data->cmd_sock; + /* Send channel */ lkm.cmd_type = LTTNG_CONSUMER_ADD_CHANNEL; lkm.u.channel.channel_key = channel->fd; lkm.u.channel.max_sb_size = channel->channel->attr.subbuf_size; lkm.u.channel.mmap_len = 0; /* for kernel */ DBG("Sending channel %d to consumer", lkm.u.channel.channel_key); - ret = lttcomm_send_unix_sock(sock, &lkm, sizeof(lkm)); + ret = lttcomm_send_unix_sock(consumer_sock, &lkm, sizeof(lkm)); if (ret < 0) { PERROR("send consumer channel"); goto error; @@ -73,12 +75,12 @@ int kernel_consumer_send_channel_stream(struct consumer_data *consumer_data, count++; DBG("Sending stream %d to consumer", lkm.u.stream.stream_key); - ret = lttcomm_send_unix_sock(sock, &lkm, sizeof(lkm)); + ret = lttcomm_send_unix_sock(consumer_sock, &lkm, sizeof(lkm)); if (ret < 0) { PERROR("send consumer stream"); goto error; } - ret = lttcomm_send_fds_unix_sock(sock, &stream->fd, 1); + ret = lttcomm_send_fds_unix_sock(consumer_sock, &stream->fd, 1); if (ret < 0) { PERROR("send consumer stream ancillary data"); goto error; @@ -151,7 +153,7 @@ int kernel_consumer_send_session(struct consumer_data *consumer_data, } cds_list_for_each_entry(chan, &session->channel_list.head, list) { - ret = kernel_consumer_send_channel_stream(consumer_data, sock, chan, + ret = kernel_consumer_send_channel_stream(consumer_data, chan, session->uid, session->gid); if (ret < 0) { goto error; diff --git a/src/bin/lttng-sessiond/kernel-consumer.h b/src/bin/lttng-sessiond/kernel-consumer.h index b7b163141..cf4ef256e 100644 --- a/src/bin/lttng-sessiond/kernel-consumer.h +++ b/src/bin/lttng-sessiond/kernel-consumer.h @@ -24,7 +24,7 @@ #include "trace-kernel.h" int kernel_consumer_send_channel_stream(struct consumer_data *consumer_data, - int sock, struct ltt_kernel_channel *channel, uid_t uid, gid_t gid); + struct ltt_kernel_channel *channel, uid_t uid, gid_t gid); int kernel_consumer_send_session(struct consumer_data *consumer_data, struct ltt_kernel_session *session); diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 452b7ba7e..6ea615e10 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -643,8 +643,7 @@ static int update_kernel_stream(struct consumer_data *consumer_data, int fd) */ if (session->kernel_session->consumer_fds_sent == 1) { ret = kernel_consumer_send_channel_stream(consumer_data, - session->kernel_session->consumer_fd, channel, - session->uid, session->gid); + channel, session->uid, session->gid); if (ret < 0) { goto error; }