Add channel ID field to attr
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Mar 2013 15:08:14 +0000 (11:08 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Mar 2013 15:08:14 +0000 (11:08 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-ctl.h
include/lttng/ust-events.h
liblttng-ust-ctl/ustctl.c
liblttng-ust/lttng-events.c
liblttng-ust/lttng-ring-buffer-client.h
liblttng-ust/lttng-ring-buffer-metadata-client.h

index 2cf537a32c41a85fb0a12be2fbb24585345a35b6..f9315a6144c672a06006b0c06bb849fa3bc53af9 100644 (file)
@@ -50,6 +50,7 @@ struct ustctl_consumer_channel_attr {
        unsigned int switch_timer_interval;     /* usec */
        unsigned int read_timer_interval;       /* usec */
        enum lttng_ust_output output;           /* splice, mmap */
+       uint32_t chan_id;                       /* channel ID */
        unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
 } LTTNG_PACKED;
 
index 2ffadde1c82b38b82c51a240db213a53949c6905..2b9603051975d480fd2e3687572149781c154e5a 100644 (file)
@@ -384,7 +384,8 @@ struct lttng_channel_ops {
                        size_t subbuf_size, size_t num_subbuf,
                        unsigned int switch_timer_interval,
                        unsigned int read_timer_interval,
-                       unsigned char *uuid);
+                       unsigned char *uuid,
+                       uint32_t chan_id);
        void (*channel_destroy)(struct lttng_channel *chan);
        int (*event_reserve)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
                             uint32_t event_id);
index 4056221d3fe59dc8c22dcb8367045f43bc3d6bd4..375b4db5c14b64876a0912987d87b121fe4f4839 100644 (file)
@@ -960,7 +960,7 @@ struct ustctl_consumer_channel *
                        attr->subbuf_size, attr->num_subbuf,
                        attr->switch_timer_interval,
                        attr->read_timer_interval,
-                       attr->uuid);
+                       attr->uuid, attr->chan_id);
        if (!chan->chan) {
                goto chan_error;
        }
index 78a4f7603de5003fc6af44f47feafdc9d887b669..d5597ca6d787ac4470538231e4a355649ac7e564 100644 (file)
@@ -262,6 +262,7 @@ int lttng_session_enable(struct lttng_session *session)
                const struct lttng_ctx *ctx;
                const struct lttng_event_field *fields = NULL;
                size_t nr_fields = 0;
+               uint32_t chan_id;
 
                /* don't change it if session stop/restart */
                if (chan->header_type)
@@ -276,12 +277,17 @@ int lttng_session_enable(struct lttng_session *session)
                        chan->objd,
                        nr_fields,
                        fields,
-                       &chan->id,
+                       &chan_id,
                        &chan->header_type);
                if (ret) {
                        DBG("Error (%d) registering channel to sessiond", ret);
                        return ret;
                }
+               if (chan_id != chan->id) {
+                       DBG("Error: channel registration id (%u) does not match id assigned at creation (%u)",
+                               chan_id, chan->id);
+                       return -EINVAL;
+               }
        }
 
        /* Set atomically the state to "active" */
index a67c65ae3a3cb87d37831d9e5e86e5fb1090d327..c65a50ef57964d92568e1ae49dfe239f6154b03a 100644 (file)
@@ -414,7 +414,8 @@ struct lttng_channel *_channel_create(const char *name,
                                size_t subbuf_size, size_t num_subbuf,
                                unsigned int switch_timer_interval,
                                unsigned int read_timer_interval,
-                               unsigned char *uuid)
+                               unsigned char *uuid,
+                               uint32_t chan_id)
 {
        struct lttng_channel chan_priv_init;
        struct lttng_ust_shm_handle *handle;
@@ -423,6 +424,7 @@ struct lttng_channel *_channel_create(const char *name,
 
        memset(&chan_priv_init, 0, sizeof(chan_priv_init));
        memcpy(chan_priv_init.uuid, uuid, LTTNG_UST_UUID_LEN);
+       chan_priv_init.id = chan_id;
        handle = channel_create(&client_config, name,
                        &priv, __alignof__(*lttng_chan), sizeof(*lttng_chan),
                        &chan_priv_init,
index 5c82187d4311d9f496b188d6e54c735dbbbf86f0..7dbdb821095c2554d26ad839a30f4d0fdbbcb52c 100644 (file)
@@ -182,7 +182,8 @@ struct lttng_channel *_channel_create(const char *name,
                                size_t subbuf_size, size_t num_subbuf,
                                unsigned int switch_timer_interval,
                                unsigned int read_timer_interval,
-                               unsigned char *uuid)
+                               unsigned char *uuid,
+                               uint32_t chan_id)
 {
        struct lttng_channel chan_priv_init;
        struct lttng_ust_shm_handle *handle;
@@ -191,6 +192,7 @@ struct lttng_channel *_channel_create(const char *name,
 
        memset(&chan_priv_init, 0, sizeof(chan_priv_init));
        memcpy(chan_priv_init.uuid, uuid, LTTNG_UST_UUID_LEN);
+       chan_priv_init.id = chan_id;
        handle = channel_create(&client_config, name,
                        &priv, __alignof__(*lttng_chan), sizeof(*lttng_chan),
                        &chan_priv_init,
This page took 0.028888 seconds and 4 git commands to generate.