X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-consumerd%2Flttng-consumerd.cpp;h=a8bda52ba7bdccf74ccea7e5339a0b7855bfc7c8;hb=d84afb7e356b5e8c93fdfcd66217fdf36e0f1fd3;hp=91617a11a061813b3ded9e40b3767f89dfa8a561;hpb=21cf9b6b1843774306a76f4dccddddd706b64f79;p=lttng-tools.git diff --git a/src/bin/lttng-consumerd/lttng-consumerd.cpp b/src/bin/lttng-consumerd/lttng-consumerd.cpp index 91617a11a..a8bda52ba 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.cpp +++ b/src/bin/lttng-consumerd/lttng-consumerd.cpp @@ -29,17 +29,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "lttng-consumerd.h" -#include "health-consumerd.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lttng-consumerd.hpp" +#include "health-consumerd.hpp" /* threads (channel handling, poll, metadata, sessiond) */ @@ -62,7 +62,7 @@ static char error_sock_path[PATH_MAX]; /* Global error path */ static enum lttng_consumer_type opt_type = LTTNG_CONSUMER_KERNEL; /* the liblttngconsumerd context */ -static struct lttng_consumer_local_data *ctx; +static struct lttng_consumer_local_data *the_consumer_context; /* Consumerd health monitoring */ struct health_app *health_consumerd; @@ -73,16 +73,17 @@ int lttng_consumer_ready = NR_LTTNG_CONSUMER_READY; enum lttng_consumer_type lttng_consumer_get_type(void) { - if (!ctx) { + if (!the_consumer_context) { return LTTNG_CONSUMER_UNKNOWN; } - return ctx->type; + return the_consumer_context->type; } /* * Signal handler for the daemon */ -static void sighandler(int sig, siginfo_t *siginfo, void *arg) +static void sighandler(int sig, siginfo_t *siginfo, + void *arg __attribute__((unused))) { if (sig == SIGINT && sigintcount++ == 0) { DBG("ignoring first SIGINT"); @@ -106,8 +107,8 @@ static void sighandler(int sig, siginfo_t *siginfo, void *arg) abort(); } - if (ctx) { - lttng_consumer_should_exit(ctx); + if (the_consumer_context) { + lttng_consumer_should_exit(the_consumer_context); } } @@ -428,14 +429,14 @@ int main(int argc, char **argv) } /* create the consumer instance with and assign the callbacks */ - ctx = lttng_consumer_create(opt_type, lttng_consumer_read_subbuffer, + the_consumer_context = lttng_consumer_create(opt_type, lttng_consumer_read_subbuffer, NULL, lttng_consumer_on_recv_stream, NULL); - if (!ctx) { + if (!the_consumer_context) { retval = -1; goto exit_init_data; } - lttng_consumer_set_command_sock_path(ctx, command_sock_path); + lttng_consumer_set_command_sock_path(the_consumer_context, command_sock_path); if (*error_sock_path == '\0') { switch (opt_type) { case LTTNG_CONSUMER_KERNEL: @@ -482,7 +483,7 @@ int main(int argc, char **argv) if (ret < 0) { WARN("Cannot connect to error socket (is lttng-sessiond started?)"); } - lttng_consumer_set_error_sock(ctx, ret); + lttng_consumer_set_error_sock(the_consumer_context, ret); /* * Block RT signals used for UST periodical metadata flush and the live @@ -493,7 +494,7 @@ int main(int argc, char **argv) goto exit_init_data; } - ctx->type = opt_type; + the_consumer_context->type = opt_type; if (utils_create_pipe(health_quit_pipe)) { retval = -1; @@ -502,7 +503,7 @@ int main(int argc, char **argv) /* Create thread to manage the client socket */ ret = pthread_create(&health_thread, default_pthread_attr(), - thread_manage_health, (void *) NULL); + thread_manage_health_consumerd, (void *) NULL); if (ret) { errno = ret; PERROR("pthread_create health"); @@ -524,7 +525,7 @@ int main(int argc, char **argv) * live timer. */ ret = pthread_create(&metadata_timer_thread, NULL, - consumer_timer_thread, (void *) ctx); + consumer_timer_thread, (void *) the_consumer_context); if (ret) { errno = ret; PERROR("pthread_create"); @@ -536,7 +537,7 @@ int main(int argc, char **argv) /* Create thread to manage channels */ ret = pthread_create(&channel_thread, default_pthread_attr(), consumer_thread_channel_poll, - (void *) ctx); + (void *) the_consumer_context); if (ret) { errno = ret; PERROR("pthread_create"); @@ -547,7 +548,7 @@ int main(int argc, char **argv) /* Create thread to manage the polling/writing of trace metadata */ ret = pthread_create(&metadata_thread, default_pthread_attr(), consumer_thread_metadata_poll, - (void *) ctx); + (void *) the_consumer_context); if (ret) { errno = ret; PERROR("pthread_create"); @@ -557,7 +558,7 @@ int main(int argc, char **argv) /* Create thread to manage the polling/writing of trace data */ ret = pthread_create(&data_thread, default_pthread_attr(), - consumer_thread_data_poll, (void *) ctx); + consumer_thread_data_poll, (void *) the_consumer_context); if (ret) { errno = ret; PERROR("pthread_create"); @@ -568,7 +569,7 @@ int main(int argc, char **argv) /* Create the thread to manage the reception of fds */ ret = pthread_create(&sessiond_thread, default_pthread_attr(), consumer_thread_sessiond_poll, - (void *) ctx); + (void *) the_consumer_context); if (ret) { errno = ret; PERROR("pthread_create"); @@ -663,8 +664,8 @@ exit_init_data: } metadata_timer_thread_online = false; } - tmp_ctx = ctx; - ctx = NULL; + tmp_ctx = the_consumer_context; + the_consumer_context = NULL; cmm_barrier(); /* Clear ctx for signal handler. */ lttng_consumer_destroy(tmp_ctx);