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>
/* 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;
}
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;
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();
/*
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) {