Rename kernel and ust trace variable for clarity
authorDavid Goulet <dgoulet@efficios.com>
Tue, 25 Mar 2014 17:19:57 +0000 (13:19 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 25 Mar 2014 17:21:25 +0000 (13:21 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/trace-kernel.h
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/trace-ust.h
src/bin/lttng-sessiond/ust-app.c
tests/unit/test_ust_data.c

index 161680a6cdbda4ae27397efee2d6f4d694946083..ea25a5e470a690182a2e0daed6f4777d511e4f47 100644 (file)
@@ -823,7 +823,7 @@ static int start_kernel_session(struct ltt_kernel_session *ksess, int wpipe)
        /* Quiescent wait after starting trace */
        kernel_wait_quiescent(kernel_tracer_fd);
 
-       ksess->started = 1;
+       ksess->active = 1;
 
        ret = LTTNG_OK;
 
@@ -1819,7 +1819,11 @@ int cmd_start_trace(struct ltt_session *session)
 
        /* Flag session that trace should start automatically */
        if (usess) {
-               usess->start_trace = 1;
+               /*
+                * Even though the start trace might fail, flag this session active so
+                * other application coming in are started by default.
+                */
+               usess->active = 1;
 
                ret = ust_app_start_trace_all(usess);
                if (ret < 0) {
@@ -1861,7 +1865,7 @@ int cmd_stop_trace(struct ltt_session *session)
        }
 
        /* Kernel tracer */
-       if (ksession && ksession->started) {
+       if (ksession && ksession->active) {
                DBG("Stop kernel tracing");
 
                /* Flush metadata if exist */
@@ -1888,11 +1892,15 @@ int cmd_stop_trace(struct ltt_session *session)
 
                kernel_wait_quiescent(kernel_tracer_fd);
 
-               ksession->started = 0;
+               ksession->active = 0;
        }
 
-       if (usess && usess->start_trace) {
-               usess->start_trace = 0;
+       if (usess && usess->active) {
+               /*
+                * Even though the stop trace might fail, flag this session inactive so
+                * other application coming in are not started by default.
+                */
+               usess->active = 0;
 
                ret = ust_app_stop_trace_all(usess);
                if (ret < 0) {
index 934aaffe89f5174015a3fe4d9637eeeabbd818bc..f576e3a60c6dd76a63104dc4f8803911ec4538b9 100644 (file)
@@ -109,8 +109,8 @@ struct ltt_kernel_session {
        struct consumer_output *tmp_consumer;
        /* Tracing session id */
        uint64_t id;
-       /* Session is started and active */
-       unsigned int started;
+       /* Session is active or not meaning it has been started or stopped. */
+       unsigned int active:1;
        /* Tell or not if the session has to output the traces. */
        unsigned int output_traces;
        unsigned int snapshot_mode;
index 8d3c7dcf8e8e59f3962c991225b67174a5414d22..dfbbcd777a264d0bcccc39253dbecc344f3f5abf 100644 (file)
@@ -218,7 +218,7 @@ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id)
 
        /* Init data structure */
        lus->id = session_id;
-       lus->start_trace = 0;
+       lus->active = 0;
 
        /* Set default metadata channel attribute. */
        lus->metadata_attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
index 6a41f0f9fbcdf6994c9807d153e37051b513bcdc..bac5c328bf4f9169256d413723f0083144a6fc88 100644 (file)
@@ -77,12 +77,13 @@ struct ltt_ust_domain_global {
 /* UST session */
 struct ltt_ust_session {
        uint64_t id;    /* Unique identifier of session */
-       int start_trace;
        struct ltt_ust_domain_global domain_global;
        struct jul_domain domain_jul;
        /* UID/GID of the user owning the session */
        uid_t uid;
        gid_t gid;
+       /* Is the session active meaning has is been started or stopped. */
+       unsigned int active:1;
        /*
         * Two consumer_output object are needed where one is for the current
         * output object and the second one is the temporary object used to store
index 00c6d9622678b63ef2a964fd7067eb4b5719d907..7f27eae078a45abd28535db63760e3aaecc1cf64 100644 (file)
@@ -4238,7 +4238,7 @@ void ust_app_global_update(struct ltt_ust_session *usess, int sock)
 
        pthread_mutex_unlock(&ua_sess->lock);
 
-       if (usess->start_trace) {
+       if (usess->active) {
                ret = ust_app_start_trace(usess, app);
                if (ret < 0) {
                        goto error;
index bc3154c288662f149e0409361392239d10fd85f1..150d5dafb70b785cd63cf6c5442b53584f1c0b97 100644 (file)
@@ -82,7 +82,7 @@ static void test_create_one_ust_session(void)
        ok(usess != NULL, "Create UST session");
 
        ok(usess->id == 42 &&
-          usess->start_trace == 0 &&
+          usess->active == 0 &&
           usess->domain_global.channels != NULL &&
           usess->uid == 0 &&
           usess->gid == 0,
This page took 0.030834 seconds and 5 git commands to generate.