Remove useless arg from kernel consumer send stream
authorDavid Goulet <dgoulet@efficios.com>
Tue, 19 Jun 2012 19:13:16 +0000 (15:13 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 19 Jun 2012 19:13:16 +0000 (15:13 -0400)
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 <dgoulet@efficios.com>
src/bin/lttng-sessiond/kernel-consumer.c
src/bin/lttng-sessiond/kernel-consumer.h
src/bin/lttng-sessiond/main.c

index f589c2a0b7cac77ae256feabd3c562abeed3c3a1..bbf50d57b594544f62ffb26f9d7c8a3f23f5a832 100644 (file)
  * 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;
index b7b163141e473c5c6eb277dfa96cc994165a0745..cf4ef256eeb5b34a1a40fc52a1d7af0ecad7c81e 100644 (file)
@@ -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);
 
index 452b7ba7eff94e1254775a12ae7f99d4add40108..6ea615e10bd67435866598632c592d4f3562dc68 100644 (file)
@@ -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;
                                        }
This page took 0.029718 seconds and 4 git commands to generate.