Use free running metadata channel key between sessiond and kernel consumer
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 2 Mar 2018 15:41:34 +0000 (10:41 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 5 Mar 2018 19:52:11 +0000 (14:52 -0500)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/kernel-consumer.c
src/bin/lttng-sessiond/kernel.c
src/bin/lttng-sessiond/trace-kernel.h

index 10011f4cd109b4b630abd615ca4d8256b36ccd03..160c19f598329ec03c6d82023ad55f09bc38db03 100644 (file)
@@ -218,7 +218,7 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock,
        /* Prep channel message structure */
        consumer_init_channel_comm_msg(&lkm,
                        LTTNG_CONSUMER_ADD_CHANNEL,
-                       session->metadata->fd,
+                       session->metadata->key,
                        session->id,
                        pathname,
                        session->uid,
@@ -243,7 +243,7 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock,
        /* Prep stream message structure */
        consumer_init_stream_comm_msg(&lkm,
                        LTTNG_CONSUMER_ADD_STREAM,
-                       session->metadata->fd,
+                       session->metadata->key,
                        session->metadata_stream_fd,
                        0); /* CPU: 0 for metadata. */
 
@@ -497,11 +497,11 @@ int kernel_consumer_destroy_metadata(struct consumer_socket *socket,
        assert(metadata);
        assert(socket);
 
-       DBG("Sending kernel consumer destroy channel key %d", metadata->fd);
+       DBG("Sending kernel consumer destroy channel key %" PRIu64, metadata->key);
 
        memset(&msg, 0, sizeof(msg));
        msg.cmd_type = LTTNG_CONSUMER_DESTROY_CHANNEL;
-       msg.u.destroy_channel.key = metadata->fd;
+       msg.u.destroy_channel.key = metadata->key;
 
        pthread_mutex_lock(socket->lock);
        health_code_update();
index 158a12a3633fa54100c81d0f5179b6c2c9d9c68e..e5f068a0cd9515408a34b4621201e8b75f714a81 100644 (file)
@@ -535,6 +535,7 @@ int kernel_open_metadata(struct ltt_kernel_session *session)
        }
 
        lkm->fd = ret;
+       lkm->key = ++next_kernel_channel_key;
        /* Prevent fd duplication after execlp() */
        ret = fcntl(lkm->fd, F_SETFD, FD_CLOEXEC);
        if (ret < 0) {
@@ -1052,7 +1053,7 @@ int kernel_snapshot_record(struct ltt_kernel_session *ksess,
                }
 
                /* Snapshot metadata, */
-               ret = consumer_snapshot_channel(socket, ksess->metadata->fd, output,
+               ret = consumer_snapshot_channel(socket, ksess->metadata->key, output,
                                1, ksess->uid, ksess->gid,
                                DEFAULT_KERNEL_TRACE_DIR, wait, 0);
                if (ret < 0) {
index 9c52cee0994944df07da6bcbe436a4233a39a550..3210d4b33bd58418f221257b9d39542479226ed3 100644 (file)
@@ -81,6 +81,7 @@ struct ltt_kernel_channel {
 /* Metadata */
 struct ltt_kernel_metadata {
        int fd;
+       uint64_t key; /* Key to reference this channel with the consumer. */
        struct lttng_channel *conf;
 };
 
This page took 0.027874 seconds and 4 git commands to generate.