X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fagent-thread.c;h=720639efd0b50d0433992c22b113a6be8693b439;hb=c0e2990d32d1e55c783c7eb3299f23a7ce062270;hp=06ef377a3a181c1b7528df89b076340f789c0f70;hpb=733c916573fb96d14ff36cc0a034c5b1ef7ef167;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/agent-thread.c b/src/bin/lttng-sessiond/agent-thread.c index 06ef377a3..720639efd 100644 --- a/src/bin/lttng-sessiond/agent-thread.c +++ b/src/bin/lttng-sessiond/agent-thread.c @@ -59,6 +59,8 @@ 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(); assert(list); @@ -82,6 +84,17 @@ static void update_agent_app(const struct agent_app *app) 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) { + agent_update(trigger_agent, app); + } + rcu_read_unlock(); } /* @@ -101,8 +114,8 @@ static struct lttcomm_sock *init_tcp_socket(void) */ ret = uri_parse(default_reg_uri, &uri); assert(ret); - assert(config.agent_tcp_port.begin > 0); - uri->port = config.agent_tcp_port.begin; + assert(the_config.agent_tcp_port.begin > 0); + uri->port = the_config.agent_tcp_port.begin; sock = lttcomm_alloc_sock_from_uri(uri); uri_free(uri); @@ -116,8 +129,8 @@ static struct lttcomm_sock *init_tcp_socket(void) goto error; } - for (port = config.agent_tcp_port.begin; - port <= config.agent_tcp_port.end; port++) { + for (port = the_config.agent_tcp_port.begin; + port <= the_config.agent_tcp_port.end; port++) { ret = lttcomm_sock_set_port(sock, (uint16_t) port); if (ret) { ERR("[agent-thread] Failed to set port %u on socket", @@ -141,16 +154,17 @@ static struct lttcomm_sock *init_tcp_socket(void) } if (!bind_succeeded) { - if (config.agent_tcp_port.begin == config.agent_tcp_port.end) { + if (the_config.agent_tcp_port.begin == + the_config.agent_tcp_port.end) { WARN("Another process is already using the agent port %i. " - "Agent support will be deactivated.", - config.agent_tcp_port.begin); + "Agent support will be deactivated.", + the_config.agent_tcp_port.begin); goto error; } else { WARN("All ports in the range [%i, %i] are already in use. " - "Agent support will be deactivated.", - config.agent_tcp_port.begin, - config.agent_tcp_port.end); + "Agent support will be deactivated.", + the_config.agent_tcp_port.begin, + the_config.agent_tcp_port.end); goto error; } } @@ -317,8 +331,8 @@ bool agent_tracing_is_enabled(void) */ static int write_agent_port(uint16_t port) { - return utils_create_pid_file((pid_t) port, - config.agent_port_file_path.value); + return utils_create_pid_file( + (pid_t) port, the_config.agent_port_file_path.value); } static @@ -355,7 +369,7 @@ static void *thread_agent_management(void *data) rcu_thread_online(); /* Agent initialization call MUST be called before starting the thread. */ - assert(agent_apps_ht_by_sock); + assert(the_agent_apps_ht_by_sock); /* Create pollset with size 2, quit pipe and registration socket. */ ret = lttng_poll_create(&events, 2, LTTNG_CLOEXEC);