Cleanup: ust start/stop trace
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 19 Nov 2018 21:12:17 +0000 (16:12 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 12 Dec 2018 19:17:02 +0000 (14:17 -0500)
Move setting/clearing the session "active" state from cmd.c to
cmd_start_trace()/cmd_stop_trace() for better encapsulation of
behavior.

Reduces the amount of code to maintain in the catch-all cmd.c.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/ust-app.c

index 507274f35568bc421887ebfb88674d476297af1d..d3c8376be1a01cf691f4a02be1ffe93c09c4a6b0 100644 (file)
@@ -2684,12 +2684,6 @@ int cmd_start_trace(struct ltt_session *session)
 
        /* Flag session that trace should start automatically */
        if (usess) {
 
        /* Flag session that trace should start automatically */
        if (usess) {
-               /*
-                * 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) {
                        ret = LTTNG_ERR_UST_START_FAIL;
                ret = ust_app_start_trace_all(usess);
                if (ret < 0) {
                        ret = LTTNG_ERR_UST_START_FAIL;
@@ -2781,12 +2775,6 @@ int cmd_stop_trace(struct ltt_session *session)
        }
 
        if (usess && usess->active) {
        }
 
        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) {
                        ret = LTTNG_ERR_UST_STOP_FAIL;
                ret = ust_app_stop_trace_all(usess);
                if (ret < 0) {
                        ret = LTTNG_ERR_UST_STOP_FAIL;
index 8c5f3f6afc0e3dfdb7ad225f2963bce7bd526624..f88df7406ea567049321b6c508fdc5b249a4ff35 100644 (file)
@@ -4996,6 +4996,12 @@ int ust_app_start_trace_all(struct ltt_ust_session *usess)
 
        DBG("Starting all UST traces");
 
 
        DBG("Starting all UST traces");
 
+       /*
+        * Even though the start trace might fail, flag this session active so
+        * other application coming in are started by default.
+        */
+       usess->active = 1;
+
        rcu_read_lock();
 
        /*
        rcu_read_lock();
 
        /*
@@ -5031,6 +5037,12 @@ int ust_app_stop_trace_all(struct ltt_ust_session *usess)
 
        DBG("Stopping all UST traces");
 
 
        DBG("Stopping all UST traces");
 
+       /*
+        * Even though the stop trace might fail, flag this session inactive so
+        * other application coming in are not started by default.
+        */
+       usess->active = 0;
+
        rcu_read_lock();
 
        cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
        rcu_read_lock();
 
        cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
This page took 0.030529 seconds and 5 git commands to generate.