X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsessiond-config.c;h=3a9b7725d41d630bf4771021e75a8e5f8d69b0f0;hp=0b540865667ec526f51001687b254a9d67c6e3a3;hb=2463b7879c00298daa79744cdaae82ac061a4ed8;hpb=2ca43cb136c284426ca9f59201dce7e8fd081275 diff --git a/src/bin/lttng-sessiond/sessiond-config.c b/src/bin/lttng-sessiond/sessiond-config.c index 0b5408656..3a9b7725d 100644 --- a/src/bin/lttng-sessiond/sessiond-config.c +++ b/src/bin/lttng-sessiond/sessiond-config.c @@ -1,20 +1,11 @@ /* - * Copyright (C) 2017 - Jérémie Galarneau + * Copyright (C) 2017 Jérémie Galarneau * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "version.h" #include "sessiond-config.h" #include #include "lttng-ust-ctl.h" @@ -33,6 +24,7 @@ struct sessiond_config sessiond_config_build_defaults = { .verbose_consumer = 0, .agent_tcp_port = { .begin = DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN, .end = DEFAULT_AGENT_TCP_PORT_RANGE_END }, + .trigger_error_counter_bucket = 4096, .app_socket_timeout = DEFAULT_APP_SOCKET_RW_TIMEOUT, .no_kernel = false, @@ -40,7 +32,7 @@ struct sessiond_config sessiond_config_build_defaults = { .daemonize = false, .sig_parent = false, - .tracing_group_name.value = DEFAULT_TRACING_GROUP, + .tracing_group_name.value = (char *) DEFAULT_TRACING_GROUP, .kmod_probes_list.value = NULL, .kmod_extra_probes_list.value = NULL, @@ -269,13 +261,16 @@ int sessiond_config_init(struct sessiond_config *config) } else { ret = config_set_paths_non_root(config); } + if (ret < 0) { + goto error; + } /* 32 bits consumerd path setup */ ret = asprintf(&str, DEFAULT_USTCONSUMERD32_PATH, config->rundir.value); if (ret < 0) { ERR("Failed to set 32-bit consumer path"); - goto end; + goto error; } config_string_set(&config->consumerd32_path, str); str = NULL; @@ -284,7 +279,7 @@ int sessiond_config_init(struct sessiond_config *config) config->rundir.value); if (ret < 0) { ERR("Failed to set 32-bit consumer error socket path"); - goto end; + goto error; } config_string_set(&config->consumerd32_err_unix_sock_path, str); str = NULL; @@ -293,7 +288,7 @@ int sessiond_config_init(struct sessiond_config *config) config->rundir.value); if (ret < 0) { ERR("Failed to set 32-bit consumer command socket path"); - goto end; + goto error; } config_string_set(&config->consumerd32_cmd_unix_sock_path, str); str = NULL; @@ -303,7 +298,7 @@ int sessiond_config_init(struct sessiond_config *config) config->rundir.value); if (ret < 0) { ERR("Failed to set 64-bit consumer path"); - goto end; + goto error; } config_string_set(&config->consumerd64_path, str); str = NULL; @@ -312,7 +307,7 @@ int sessiond_config_init(struct sessiond_config *config) config->rundir.value); if (ret < 0) { ERR("Failed to set 64-bit consumer error socket path"); - goto end; + goto error; } config_string_set(&config->consumerd64_err_unix_sock_path, str); str = NULL; @@ -321,7 +316,7 @@ int sessiond_config_init(struct sessiond_config *config) config->rundir.value); if (ret < 0) { ERR("Failed to set 64-bit consumer command socket path"); - goto end; + goto error; } config_string_set(&config->consumerd64_cmd_unix_sock_path, str); str = NULL; @@ -331,7 +326,7 @@ int sessiond_config_init(struct sessiond_config *config) config->rundir.value); if (ret < 0) { ERR("Failed to set kernel consumer path"); - goto end; + goto error; } config_string_set(&config->kconsumerd_path, str); str = NULL; @@ -340,7 +335,7 @@ int sessiond_config_init(struct sessiond_config *config) config->rundir.value); if (ret < 0) { ERR("Failed to set kernel consumer error socket path"); - goto end; + goto error; } config_string_set(&config->kconsumerd_err_unix_sock_path, str); str = NULL; @@ -349,7 +344,7 @@ int sessiond_config_init(struct sessiond_config *config) config->rundir.value); if (ret < 0) { ERR("Failed to set kernel consumer command socket path"); - goto end; + goto error; } config_string_set(&config->kconsumerd_cmd_unix_sock_path, str); str = NULL; @@ -358,7 +353,7 @@ int sessiond_config_init(struct sessiond_config *config) DEFAULT_LTTNG_SESSIOND_PIDFILE); if (ret < 0) { ERR("Failed to set PID file path"); - goto end; + goto error; } config_string_set(&config->pid_file_path, str); str = NULL; @@ -367,7 +362,7 @@ int sessiond_config_init(struct sessiond_config *config) DEFAULT_LTTNG_SESSIOND_LOCKFILE); if (ret < 0) { ERR("Failed to set lock file path"); - goto end; + goto error; } config_string_set(&config->lock_file_path, str); str = NULL; @@ -376,7 +371,7 @@ int sessiond_config_init(struct sessiond_config *config) DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE); if (ret < 0) { ERR("Failed to set agent port file path"); - goto end; + goto error; } config_string_set(&config->agent_port_file_path, str); str = NULL; @@ -400,7 +395,9 @@ int sessiond_config_init(struct sessiond_config *config) #error "Unknown bitness" #endif ret = 0; -end: + return ret; +error: + sessiond_config_fini(config); return ret; } @@ -410,6 +407,7 @@ void sessiond_config_fini(struct sessiond_config *config) config_string_fini(&config->tracing_group_name); config_string_fini(&config->kmod_probes_list); config_string_fini(&config->kmod_extra_probes_list); + config_string_fini(&config->rundir); config_string_fini(&config->apps_unix_sock_path); config_string_fini(&config->client_unix_sock_path); config_string_fini(&config->wait_shm_path); @@ -491,6 +489,19 @@ LTTNG_HIDDEN void sessiond_config_log(struct sessiond_config *config) { DBG_NO_LOC("[sessiond configuration]"); + DBG_NO_LOC("\tversion %s", VERSION); + if (GIT_VERSION[0] != '\0') { + DBG_NO_LOC("\tgit version %s", GIT_VERSION); + } + if (EXTRA_VERSION_NAME[0] != '\0') { + DBG_NO_LOC("\textra version name %s", EXTRA_VERSION_NAME); + } + if (EXTRA_VERSION_DESCRIPTION[0] != '\0') { + DBG_NO_LOC("\textra version description:\n\t%s", EXTRA_VERSION_DESCRIPTION); + } + if (EXTRA_VERSION_PATCHES[0] != '\0') { + DBG_NO_LOC("\textra version patches:\n\t%s", EXTRA_VERSION_PATCHES); + } DBG_NO_LOC("\tverbose: %i", config->verbose); DBG_NO_LOC("\tverbose consumer: %i", config->verbose_consumer); DBG_NO_LOC("\tquiet mode: %s", config->quiet ? "True" : "False");