projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: failure to launch agent thread is not reported
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
agent-thread.c
diff --git
a/src/bin/lttng-sessiond/agent-thread.c
b/src/bin/lttng-sessiond/agent-thread.c
index 39d2ec4a05bd1297c31e2ac7036600772ea38ffa..d53e0b1c749e9c8291e5b6630ec4f55dde718257 100644
(file)
--- a/
src/bin/lttng-sessiond/agent-thread.c
+++ b/
src/bin/lttng-sessiond/agent-thread.c
@@
-32,6
+32,8
@@
#include "session.h"
#include "utils.h"
#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
/*
* 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
@@
-88,8
+90,8
@@
static struct lttcomm_sock *init_tcp_socket(void)
*/
ret = uri_parse(default_reg_uri, &uri);
assert(ret);
*/
ret = uri_parse(default_reg_uri, &uri);
assert(ret);
- assert(agent_tcp_port);
- uri->port = agent_tcp_port;
+ assert(
config.
agent_tcp_port);
+ uri->port =
config.
agent_tcp_port;
sock = lttcomm_alloc_sock_from_uri(uri);
uri_free(uri);
sock = lttcomm_alloc_sock_from_uri(uri);
uri_free(uri);
@@
-116,7
+118,7
@@
static struct lttcomm_sock *init_tcp_socket(void)
}
DBG("[agent-thread] Listening on TCP port %u and socket %d",
}
DBG("[agent-thread] Listening on TCP port %u and socket %d",
- agent_tcp_port, sock->fd);
+
config.
agent_tcp_port, sock->fd);
return sock;
return sock;
@@
-134,7
+136,7
@@
static void destroy_tcp_socket(struct lttcomm_sock *sock)
{
assert(sock);
{
assert(sock);
- DBG3("[agent-thread] Destroy TCP socket on port %u", agent_tcp_port);
+ DBG3("[agent-thread] Destroy TCP socket on port %u",
config.
agent_tcp_port);
/* This will return gracefully if fd is invalid. */
sock->ops->close(sock);
/* This will return gracefully if fd is invalid. */
sock->ops->close(sock);
@@
-223,6
+225,15
@@
error:
return ret;
}
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.
*/
/*
* This thread manage application notify communication.
*/
@@
-248,11
+259,18
@@
void *agent_thread_manage_registration(void *data)
}
reg_sock = init_tcp_socket();
}
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;
}
if (!reg_sock) {
goto error_tcp_socket;
}
- /* Add
create valid
TCP socket to poll set. */
+ /* Add TCP socket to poll set. */
ret = lttng_poll_add(&events, reg_sock->fd,
LPOLLIN | LPOLLERR | LPOLLHUP | LPOLLRDHUP);
if (ret < 0) {
ret = lttng_poll_add(&events, reg_sock->fd,
LPOLLIN | LPOLLERR | LPOLLHUP | LPOLLRDHUP);
if (ret < 0) {
@@
-347,6
+365,7
@@
restart:
}
exit:
}
exit:
+ uatomic_set(&agent_tracing_enabled, 0);
/* Whatever happens, try to delete it and exit. */
(void) lttng_poll_del(&events, reg_sock->fd);
error:
/* Whatever happens, try to delete it and exit. */
(void) lttng_poll_del(&events, reg_sock->fd);
error:
This page took
0.026354 seconds
and
4
git commands to generate.