X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=lttng-sessiond%2Fmain.c;h=2f80e2cee5fce189453736f49d39b5d78ef3cd4f;hp=9464c2c1b8e0f4f3d17ef300cf15975d2174c6ec;hb=3ff2ecac2dec345eacceb0e350c08c5c657c0a30;hpb=8be98f9a4419d360bce0678981ba3f4b891b0a19 diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 9464c2c1b..2f80e2cee 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -159,6 +159,24 @@ static struct ltt_session_list *session_list_ptr; int ust_consumer_fd; +static const char *compat32_consumer_bindir = + __stringify(CONFIG_COMPAT_BIN_DIR); +static const char *compat32_consumer_prog = "lttng-consumerd"; + +static +void setup_compat32_consumer(void) +{ + const char *bindir; + + /* + * runtime env. var. overrides the build default. + */ + bindir = getenv("LTTNG_TOOLS_COMPAT_BIN_DIR"); + if (bindir) { + compat32_consumer_bindir = bindir; + } +} + /* * Create a poll set with O_CLOEXEC and add the thread quit pipe to the set. */ @@ -305,8 +323,14 @@ static void teardown_kernel_session(struct ltt_session *session) */ static void teardown_ust_session(struct ltt_session *session) { + int ret; + DBG("Tearing down UST session(s)"); + ret = ust_app_destroy_trace_all(session->ust_session); + if (ret) { + ERR("Error in ust_app_destroy_trace_all"); + } trace_ust_destroy_session(session->ust_session); } @@ -1054,9 +1078,10 @@ static void *thread_manage_apps(void *data) /* Register applicaton to the session daemon */ ret = ust_app_register(&ust_cmd.reg_msg, ust_cmd.sock); - if (ret < 0) { - /* Only critical ENOMEM error can be returned here */ + if (ret == -ENOMEM) { goto error; + } else if (ret < 0) { + break; } /* @@ -2676,6 +2701,8 @@ static int cmd_destroy_session(struct ltt_session *session, char *name) /* Clean kernel session teardown */ teardown_kernel_session(session); + /* UST session teardown */ + teardown_ust_session(session); /* * Must notify the kernel thread here to update it's poll setin order @@ -2814,14 +2841,14 @@ static ssize_t cmd_list_channels(int domain, struct ltt_session *session, if (session->kernel_session != NULL) { nb_chan = session->kernel_session->channel_count; } - DBG3("Number of kernel channels %ld", nb_chan); + DBG3("Number of kernel channels %zd", nb_chan); break; case LTTNG_DOMAIN_UST: if (session->ust_session != NULL) { nb_chan = hashtable_get_count( session->ust_session->domain_global.channels); } - DBG3("Number of UST global channels %ld", nb_chan); + DBG3("Number of UST global channels %zd", nb_chan); break; default: *channels = NULL; @@ -2980,8 +3007,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx) ret = LTTCOMM_KERN_CONSUMER_FAIL; goto error; } + } else { + pthread_mutex_unlock(&kconsumer_data.pid_mutex); } - pthread_mutex_unlock(&kconsumer_data.pid_mutex); } break; case LTTNG_DOMAIN_UST: @@ -3006,8 +3034,9 @@ static int process_client_msg(struct command_ctx *cmd_ctx) } ust_consumer_fd = ustconsumer_data.cmd_sock; + } else { + pthread_mutex_unlock(&ustconsumer_data.pid_mutex); } - pthread_mutex_unlock(&ustconsumer_data.pid_mutex); } break; } @@ -3432,6 +3461,7 @@ static void usage(void) fprintf(stderr, " --kconsumerd-cmd-sock PATH Specify path for the kernel consumer command socket\n"); fprintf(stderr, " --ustconsumerd-err-sock PATH Specify path for the UST consumer error socket\n"); fprintf(stderr, " --ustconsumerd-cmd-sock PATH Specify path for the UST consumer command socket\n"); + fprintf(stderr, " --ustconsumerd-compat32 PATH Specify path for the 32-bit UST consumer daemon binary\n"); fprintf(stderr, " -d, --daemonize Start as a daemon.\n"); fprintf(stderr, " -g, --group NAME Specify the tracing group name. (default: tracing)\n"); fprintf(stderr, " -V, --version Show version number.\n"); @@ -3455,6 +3485,7 @@ static int parse_args(int argc, char **argv) { "kconsumerd-err-sock", 1, 0, 'E' }, { "ustconsumerd-cmd-sock", 1, 0, 'D' }, { "ustconsumerd-err-sock", 1, 0, 'F' }, + { "ustconsumerd-compat32", 1, 0, 'u' }, { "daemonize", 0, 0, 'd' }, { "sig-parent", 0, 0, 'S' }, { "help", 0, 0, 'h' }, @@ -3468,7 +3499,7 @@ static int parse_args(int argc, char **argv) while (1) { int option_index = 0; - c = getopt_long(argc, argv, "dhqvVS" "a:c:g:s:C:E:D:F:Z", + c = getopt_long(argc, argv, "dhqvVS" "a:c:g:s:C:E:D:F:Z:u", long_options, &option_index); if (c == -1) { break; @@ -3491,7 +3522,7 @@ static int parse_args(int argc, char **argv) opt_daemon = 1; break; case 'g': - opt_tracing_group = strdup(optarg); + opt_tracing_group = optarg; break; case 'h': usage(); @@ -3524,6 +3555,9 @@ static int parse_args(int argc, char **argv) case 'Z': opt_verbose_consumer += 1; break; + case 'u': + compat32_consumer_bindir = optarg; + break; default: /* Unknown option or other error. * Error is printed by getopt, just return */ @@ -3850,6 +3884,8 @@ int main(int argc, char **argv) goto error; } + setup_compat32_consumer(); + /* Parse arguments */ progname = argv[0]; if ((ret = parse_args(argc, argv) < 0)) {