X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fagent-thread.cpp;h=23a26a8063b777a64a03f1892a6e61d66dc9fd6f;hb=HEAD;hp=6abcb8fb34669587d8e091d47fb24b8f05bc5267;hpb=cd9adb8b829564212158943a0d279bb35322ab30;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/agent-thread.cpp b/src/bin/lttng-sessiond/agent-thread.cpp index 6abcb8fb3..9b5a5b569 100644 --- a/src/bin/lttng-sessiond/agent-thread.cpp +++ b/src/bin/lttng-sessiond/agent-thread.cpp @@ -18,9 +18,12 @@ #include #include #include +#include #include #include +#include + namespace { struct thread_notifiers { struct lttng_pipe *quit_pipe; @@ -56,15 +59,13 @@ const char *default_reg_uri = "tcp://" DEFAULT_NETWORK_VIEWER_BIND_ADDRESS; */ static void update_agent_app(const struct agent_app *app) { - struct ltt_session *session, *stmp; struct ltt_session_list *list; - struct agent *trigger_agent; - struct lttng_ht_iter iter; list = session_get_list(); LTTNG_ASSERT(list); - cds_list_for_each_entry_safe (session, stmp, &list->head, list) { + for (auto *session : + lttng::urcu::list_iteration_adapter(list->head)) { if (!session_get(session)) { continue; } @@ -73,27 +74,25 @@ static void update_agent_app(const struct agent_app *app) if (session->ust_session) { const struct agent *agt; - rcu_read_lock(); + const lttng::urcu::read_lock_guard read_lock; agt = trace_ust_find_agent(session->ust_session, app->domain); if (agt) { agent_update(agt, app); } - rcu_read_unlock(); } session_unlock(session); session_put(session); } - rcu_read_lock(); /* * We are protected against the addition of new events by the session * list lock being held. */ - cds_lfht_for_each_entry ( - the_trigger_agents_ht_by_domain->ht, &iter.iter, trigger_agent, node.node) { + for (auto *trigger_agent : + lttng::urcu::lfht_iteration_adapter( + *the_trigger_agents_ht_by_domain->ht)) { agent_update(trigger_agent, app); } - rcu_read_unlock(); } /* @@ -217,6 +216,8 @@ static const char *domain_type_str(enum lttng_domain_type domain_type) return "jul"; case LTTNG_DOMAIN_LOG4J: return "log4j"; + case LTTNG_DOMAIN_LOG4J2: + return "log4j2"; case LTTNG_DOMAIN_PYTHON: return "python"; default: @@ -482,7 +483,7 @@ static void *thread_agent_management(void *data) * the agent application's configuration is * updated. */ - session_lock_list(); + const auto list_lock = lttng::sessiond::lock_session_list(); /* * Update the newly registered applications's @@ -496,7 +497,6 @@ static void *thread_agent_management(void *data) /* Removing from the poll set. */ ret = lttng_poll_del(&events, new_app_socket_fd); if (ret < 0) { - session_unlock_list(); goto error; } continue; @@ -504,8 +504,6 @@ static void *thread_agent_management(void *data) /* Publish the new agent app. */ agent_add_app(new_app); - - session_unlock_list(); } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) { /* Removing from the poll set */ ret = lttng_poll_del(&events, pollfd);