X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=27c32e4d8b6bc34d9ec64fc754cd20633be8a41a;hb=4852cdb954cd0d685bd4be7e69abfeb3e5388cc6;hp=cb9e16ec506e8ffbae652ba4dda670af27a0917d;hpb=37317960b40f5c473cff5d6dfad1f667e0109ff1;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index cb9e16ec5..27c32e4d8 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -77,6 +77,7 @@ #include "agent.h" #include "ht-cleanup.h" #include "sessiond-config.h" +#include "clear.h" static const char *help_msg = #ifdef LTTNG_EMBED_HELP @@ -547,15 +548,9 @@ static void sessiond_cleanup(void) */ utils_close_pipe(thread_quit_pipe); - /* - * If config.pid_file_path.value is undefined, the default file will be - * wiped when removing the rundir. - */ - if (config.pid_file_path.value) { - ret = remove(config.pid_file_path.value); - if (ret < 0) { - PERROR("remove pidfile %s", config.pid_file_path.value); - } + ret = remove(config.pid_file_path.value); + if (ret < 0) { + PERROR("remove pidfile %s", config.pid_file_path.value); } DBG("Removing sessiond and consumerd content of directory %s", @@ -2442,7 +2437,8 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) } else if (stat(INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE, &st) == 0) { DBG3("Found location #2"); consumer_to_use = INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE; - } else if (stat(config.consumerd32_bin_path.value, &st) == 0) { + } else if (config.consumerd32_bin_path.value && + stat(config.consumerd32_bin_path.value, &st) == 0) { DBG3("Found location #3"); consumer_to_use = config.consumerd32_bin_path.value; } else { @@ -2934,6 +2930,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int sock, case LTTNG_REGENERATE_STATEDUMP: case LTTNG_REGISTER_TRIGGER: case LTTNG_UNREGISTER_TRIGGER: + case LTTNG_CLEAR_SESSION: need_domain = 0; break; default: @@ -4064,6 +4061,11 @@ error_add_context: notification_thread_handle); break; } + case LTTNG_CLEAR_SESSION: + { + ret = cmd_clear_session(cmd_ctx->session); + break; + } default: ret = LTTNG_ERR_UND; break; @@ -5552,6 +5554,12 @@ int main(int argc, char **argv) goto exit_set_signal_handler; } + /* + * Init config from environment variables. + * Command line option override env configuration per-doc. Do env first. + */ + sessiond_config_apply_env_config(&config); + /* * Parse arguments and load the daemon configuration file. * @@ -5566,9 +5574,6 @@ int main(int argc, char **argv) goto exit_options; } - /* Init config from environment variables. */ - sessiond_config_apply_env_config(&config); - /* * Resolve all paths received as arguments, configuration option, or * through environment variable as absolute paths. This is necessary