Fix: keep metadata channel attr in UST session
authorDavid Goulet <dgoulet@efficios.com>
Wed, 26 Feb 2014 20:07:12 +0000 (15:07 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 26 Feb 2014 20:22:11 +0000 (15:22 -0500)
This is so that if we have NO application we can use the metadata
channel attributes once one appears.

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/channel.c
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/trace-ust.h
src/bin/lttng-sessiond/ust-app.c

index fc343f5910a8babab0737a90955284209438061f..1d04b1fcfffd057d3346a40fc3be9abcae29b694 100644 (file)
@@ -369,6 +369,14 @@ int channel_ust_create(struct ltt_ust_session *usess,
        if (strncmp(uchan->name, DEFAULT_METADATA_NAME,
                                sizeof(uchan->name))) {
                lttng_ht_add_unique_str(usess->domain_global.channels, &uchan->node);
+       } else {
+               /*
+                * Copy channel attribute to session if this is metadata so if NO
+                * application exists we can access that data in the shadow copy during
+                * the global update of newly registered application.
+                */
+               memcpy(&usess->metadata_attr, &uchan->attr,
+                               sizeof(usess->metadata_attr));
        }
        rcu_read_unlock();
 
index c08246a25a9f441360fb5ad4a1b6c5ef1a04d7e0..996916558f8b3a0d5fd1c3d5945fe11783368d53 100644 (file)
@@ -220,6 +220,14 @@ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id)
        lus->id = session_id;
        lus->start_trace = 0;
 
+       /* Set default metadata channel attribute. */
+       lus->metadata_attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
+       lus->metadata_attr.subbuf_size = default_get_metadata_subbuf_size();
+       lus->metadata_attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
+       lus->metadata_attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER;
+       lus->metadata_attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;
+       lus->metadata_attr.output = LTTNG_UST_MMAP;
+
        /*
         * Default buffer type. This can be changed through an enable channel
         * requesting a different type. Note that this can only be changed once
index 07af0f1eeb96ac74d57aa87b679989e6570d6572..6c6c6c454a53abba8dd480c40160848c8b84d4ac 100644 (file)
@@ -107,6 +107,9 @@ struct ltt_ust_session {
        unsigned int snapshot_mode;
        unsigned int has_non_default_channel;
        unsigned int live_timer_interval;       /* usec */
+
+       /* Metadata channel attributes. */
+       struct lttng_ust_channel_attr metadata_attr;
 };
 
 /*
index 5aad28bbc6d57b458935578f002c658db82ecede..00c6d9622678b63ef2a964fd7067eb4b5719d907 100644 (file)
@@ -825,16 +825,8 @@ struct ust_app_session *alloc_ust_app_session(struct ust_app *app)
 
        ua_sess->handle = -1;
        ua_sess->channels = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
-       pthread_mutex_init(&ua_sess->lock, NULL);
-
-       /* Set default metadata channel attribute. */
-       ua_sess->metadata_attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
-       ua_sess->metadata_attr.subbuf_size = default_get_metadata_subbuf_size();
-       ua_sess->metadata_attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
-       ua_sess->metadata_attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER;
-       ua_sess->metadata_attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;
-       ua_sess->metadata_attr.output = LTTNG_UST_MMAP;
        ua_sess->metadata_attr.type = LTTNG_UST_CHAN_METADATA;
+       pthread_mutex_init(&ua_sess->lock, NULL);
 
        return ua_sess;
 
@@ -1617,6 +1609,8 @@ static void shadow_copy_session(struct ust_app_session *ua_sess,
        ua_sess->consumer = usess->consumer;
        ua_sess->output_traces = usess->output_traces;
        ua_sess->live_timer_interval = usess->live_timer_interval;
+       copy_channel_attr_to_ustctl(&ua_sess->metadata_attr,
+                       &usess->metadata_attr);
 
        switch (ua_sess->buffer_type) {
        case LTTNG_BUFFER_PER_PID:
This page took 0.031859 seconds and 4 git commands to generate.