#include "session.h"
#include "utils.h"
+static int agent_tracing_enabled = -1;
+
/*
* Note that there is not port here. It's set after this URI is parsed so we
* can let the user define a custom one. However, localhost is ALWAYS the
return ret;
}
+bool agent_tracing_is_enabled(void)
+{
+ int enabled;
+
+ enabled = uatomic_read(&agent_tracing_enabled);
+ assert(enabled != -1);
+ return enabled == 1;
+}
+
/*
* This thread manage application notify communication.
*/
}
reg_sock = init_tcp_socket();
+ uatomic_set(&agent_tracing_enabled, !!reg_sock);
+
+ /*
+ * Signal that the agent thread is ready. The command thread
+ * may start to query whether or not agent tracing is enabled.
+ */
+ sessiond_notify_ready();
if (!reg_sock) {
goto error_tcp_socket;
}
}
exit:
+ uatomic_set(&agent_tracing_enabled, 0);
/* Whatever happens, try to delete it and exit. */
(void) lttng_poll_del(&events, reg_sock->fd);
error: