X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=16f4849bc7c7a4b888ee0e788c42c7443b8a0bda;hb=d8f48b249f7b05de04eada78d28b630d3783f827;hp=9d742536852b4880f30d7245f71d32567a94bc5e;hpb=84a1ef69143f198278fb8fc2cf66dcd1da82a70e;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 9d7425368..16f4849bc 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -51,6 +51,7 @@ #include "buffer-registry.h" #include "notification-thread.h" #include "notification-thread-commands.h" +#include "agent-thread.h" #include "cmd.h" @@ -1380,9 +1381,15 @@ int cmd_enable_channel(struct ltt_session *session, break; } case LTTNG_DOMAIN_UST: + break; case LTTNG_DOMAIN_JUL: case LTTNG_DOMAIN_LOG4J: case LTTNG_DOMAIN_PYTHON: + if (!agent_tracing_is_enabled()) { + DBG("Attempted to enable a channel in an agent domain but the agent thread is not running"); + ret = LTTNG_ERR_AGENT_TRACING_DISABLED; + goto error; + } break; default: ret = LTTNG_ERR_UNKNOWN_DOMAIN; @@ -2090,6 +2097,12 @@ static int _cmd_enable_event(struct ltt_session *session, assert(usess); + if (!agent_tracing_is_enabled()) { + DBG("Attempted to enable an event in an agent domain but the agent thread is not running"); + ret = LTTNG_ERR_AGENT_TRACING_DISABLED; + goto error; + } + agt = trace_ust_find_agent(usess, domain->type); if (!agt) { agt = agent_create(domain->type); @@ -3420,10 +3433,12 @@ static int clear_metadata_file(int fd) { int ret; + off_t lseek_ret; - ret = lseek(fd, 0, SEEK_SET); - if (ret < 0) { + lseek_ret = lseek(fd, 0, SEEK_SET); + if (lseek_ret < 0) { PERROR("lseek"); + ret = -1; goto end; } @@ -3831,11 +3846,13 @@ static int record_ust_snapshot(struct ltt_ust_session *usess, } ret = LTTNG_OK; + goto end; error_snapshot: /* Clean up copied sockets so this output can use some other later on. */ consumer_destroy_output_sockets(output->consumer); error: +end: return ret; }