X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsave.c;h=c6fc33e7bb83c5b02b6fdc7c4c8b38517d5f9aea;hp=908e5f8fd2924d67223ffbdcbf8a04dfc158a502;hb=90e7d72ff2b93752b8c81c49e9251a83b01703c6;hpb=2aa6405248e70affbc6f131a1e5e77b6141ec2d7 diff --git a/src/bin/lttng-sessiond/save.c b/src/bin/lttng-sessiond/save.c index 908e5f8fd..c6fc33e7b 100644 --- a/src/bin/lttng-sessiond/save.c +++ b/src/bin/lttng-sessiond/save.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -1161,7 +1162,8 @@ int save_ust_session(struct config_writer *writer, ust_chan = caa_container_of(node, struct ltt_ust_channel, node); agent_channel = !strcmp(DEFAULT_JUL_CHANNEL_NAME, ust_chan->name) || - !strcmp(DEFAULT_LOG4J_CHANNEL_NAME, ust_chan->name); + !strcmp(DEFAULT_LOG4J_CHANNEL_NAME, ust_chan->name) || + !strcmp(DEFAULT_PYTHON_CHANNEL_NAME, ust_chan->name); if (!(save_agent ^ agent_channel)) { ret = save_ust_channel(writer, ust_chan, session->ust_session); if (ret) { @@ -1223,6 +1225,8 @@ int save_domains(struct config_writer *writer, struct ltt_session *session) } if (session->ust_session) { + unsigned long agent_count; + ret = config_writer_open_element(writer, config_element_domain); if (ret) { @@ -1241,30 +1245,37 @@ int save_domains(struct config_writer *writer, struct ltt_session *session) ret = LTTNG_ERR_SAVE_IO_FAIL; goto end; } - } - if (session->ust_session && - lttng_ht_get_count(session->ust_session->agents) > 0) { - ret = config_writer_open_element(writer, - config_element_domain); - if (ret) { - ret = LTTNG_ERR_SAVE_IO_FAIL; - goto end; - } + rcu_read_lock(); + agent_count = + lttng_ht_get_count(session->ust_session->agents); + rcu_read_unlock(); - ret = save_ust_session(writer, session, 1); - if (ret) { - goto end; - } + if (agent_count > 0) { + ret = config_writer_open_element(writer, + config_element_domain); + if (ret) { + ret = LTTNG_ERR_SAVE_IO_FAIL; + goto end; + } - /* /domain */ - ret = config_writer_close_element(writer); - if (ret) { - ret = LTTNG_ERR_SAVE_IO_FAIL; - goto end; + ret = save_ust_session(writer, session, 1); + if (ret) { + goto end; + } + + /* /domain */ + ret = config_writer_close_element(writer); + if (ret) { + ret = LTTNG_ERR_SAVE_IO_FAIL; + goto end; + } } } + if (session->ust_session) { + } + /* /domains */ ret = config_writer_close_element(writer); if (ret) {