Commit | Line | Data |
---|---|---|
e6142f2e | 1 | /* |
ab5be9fa | 2 | * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
e6142f2e | 3 | * |
ab5be9fa | 4 | * SPDX-License-Identifier: GPL-2.0-only |
e6142f2e | 5 | * |
e6142f2e JG |
6 | */ |
7 | ||
c9e313bc | 8 | #include "lttng-ust-ctl.hpp" |
28ab034a JG |
9 | #include "sessiond-config.hpp" |
10 | #include "version.hpp" | |
11 | ||
12 | #include <common/compat/errno.hpp> | |
13 | #include <common/compat/getenv.hpp> | |
c9e313bc | 14 | #include <common/defaults.hpp> |
c9e313bc | 15 | #include <common/error.hpp> |
c9e313bc | 16 | #include <common/path.hpp> |
28ab034a | 17 | #include <common/utils.hpp> |
e6142f2e | 18 | |
28ab034a JG |
19 | #include <ctype.h> |
20 | #include <limits.h> | |
7966af57 | 21 | |
28ab034a JG |
22 | static struct sessiond_config sessiond_config_build_defaults = { |
23 | .verbose = 0, | |
24 | .verbose_consumer = 0, | |
25 | .agent_tcp_port = { .begin = DEFAULT_AGENT_TCP_PORT_RANGE_BEGIN, | |
26 | .end = DEFAULT_AGENT_TCP_PORT_RANGE_END }, | |
e6142f2e | 27 | |
28ab034a JG |
28 | .event_notifier_buffer_size_kernel = DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE, |
29 | .event_notifier_buffer_size_userspace = DEFAULT_EVENT_NOTIFIER_ERROR_COUNT_MAP_SIZE, | |
30 | .app_socket_timeout = DEFAULT_APP_SOCKET_RW_TIMEOUT, | |
7966af57 | 31 | |
28ab034a | 32 | .quiet = false, |
7966af57 | 33 | |
28ab034a JG |
34 | .no_kernel = false, |
35 | .background = false, | |
36 | .daemonize = false, | |
37 | .sig_parent = false, | |
e6142f2e | 38 | |
1c9a0b0e | 39 | .tracing_group_name = { (char *) DEFAULT_TRACING_GROUP, false }, |
e6142f2e | 40 | |
1c9a0b0e MJ |
41 | .kmod_probes_list = { nullptr, false }, |
42 | .kmod_extra_probes_list = { nullptr, false }, | |
e6142f2e | 43 | |
1c9a0b0e | 44 | .rundir = { nullptr, false }, |
e6142f2e | 45 | |
1c9a0b0e MJ |
46 | .apps_unix_sock_path = { nullptr, false }, |
47 | .client_unix_sock_path = { nullptr, false }, | |
48 | .wait_shm_path = { nullptr, false }, | |
49 | .health_unix_sock_path = { nullptr, false }, | |
50 | .lttng_ust_clock_plugin = { nullptr, false }, | |
51 | .pid_file_path = { nullptr, false }, | |
52 | .lock_file_path = { nullptr, false }, | |
53 | .load_session_path = { nullptr, false }, | |
54 | .agent_port_file_path = { nullptr, false }, | |
e6142f2e | 55 | |
1c9a0b0e MJ |
56 | .consumerd32_path = { nullptr, false }, |
57 | .consumerd32_bin_path = { nullptr, false }, | |
58 | .consumerd32_lib_dir = { nullptr, false }, | |
59 | .consumerd32_err_unix_sock_path = { nullptr, false }, | |
60 | .consumerd32_cmd_unix_sock_path = { nullptr, false }, | |
e6142f2e | 61 | |
1c9a0b0e MJ |
62 | .consumerd64_path = { nullptr, false }, |
63 | .consumerd64_bin_path = { nullptr, false }, | |
64 | .consumerd64_lib_dir = { nullptr, false }, | |
65 | .consumerd64_err_unix_sock_path = { nullptr, false }, | |
66 | .consumerd64_cmd_unix_sock_path = { nullptr, false }, | |
67 | ||
68 | .kconsumerd_path = { nullptr, false }, | |
69 | .kconsumerd_err_unix_sock_path = { nullptr, false }, | |
70 | .kconsumerd_cmd_unix_sock_path = { nullptr, false }, | |
e6142f2e JG |
71 | }; |
72 | ||
28ab034a | 73 | static void config_string_fini(struct config_string *str) |
e6142f2e | 74 | { |
cd9adb8b | 75 | config_string_set(str, nullptr); |
e6142f2e JG |
76 | } |
77 | ||
28ab034a | 78 | static void config_string_set_static(struct config_string *config_str, const char *value) |
e6142f2e JG |
79 | { |
80 | config_string_set(config_str, (char *) value); | |
81 | config_str->should_free = false; | |
82 | } | |
83 | ||
84 | /* Only use for dynamically-allocated strings. */ | |
e6142f2e JG |
85 | void config_string_set(struct config_string *config_str, char *value) |
86 | { | |
a0377dfe | 87 | LTTNG_ASSERT(config_str); |
e6142f2e JG |
88 | if (config_str->should_free) { |
89 | free(config_str->value); | |
90 | config_str->should_free = false; | |
91 | } | |
92 | ||
93 | config_str->should_free = !!value; | |
94 | config_str->value = value; | |
95 | } | |
96 | ||
e6142f2e JG |
97 | int sessiond_config_apply_env_config(struct sessiond_config *config) |
98 | { | |
99 | int ret = 0; | |
100 | const char *env_value; | |
101 | ||
102 | env_value = getenv(DEFAULT_APP_SOCKET_TIMEOUT_ENV); | |
103 | if (env_value) { | |
104 | char *endptr; | |
105 | long int_val; | |
106 | ||
107 | errno = 0; | |
108 | int_val = strtoul(env_value, &endptr, 0); | |
28ab034a | 109 | if (errno != 0 || int_val > INT_MAX || (int_val < 0 && int_val != -1)) { |
e6142f2e | 110 | ERR("Invalid value \"%s\" used for \"%s\" environment variable", |
28ab034a JG |
111 | env_value, |
112 | DEFAULT_APP_SOCKET_TIMEOUT_ENV); | |
e6142f2e JG |
113 | ret = -1; |
114 | goto end; | |
115 | } | |
116 | ||
117 | config->app_socket_timeout = int_val; | |
118 | } | |
119 | ||
120 | env_value = lttng_secure_getenv("LTTNG_CONSUMERD32_BIN"); | |
121 | if (env_value) { | |
28ab034a | 122 | config_string_set_static(&config->consumerd32_bin_path, env_value); |
e6142f2e JG |
123 | } |
124 | env_value = lttng_secure_getenv("LTTNG_CONSUMERD64_BIN"); | |
125 | if (env_value) { | |
28ab034a | 126 | config_string_set_static(&config->consumerd64_bin_path, env_value); |
e6142f2e JG |
127 | } |
128 | ||
129 | env_value = lttng_secure_getenv("LTTNG_CONSUMERD32_LIBDIR"); | |
130 | if (env_value) { | |
28ab034a | 131 | config_string_set_static(&config->consumerd32_lib_dir, env_value); |
e6142f2e JG |
132 | } |
133 | env_value = lttng_secure_getenv("LTTNG_CONSUMERD64_LIBDIR"); | |
134 | if (env_value) { | |
28ab034a | 135 | config_string_set_static(&config->consumerd64_lib_dir, env_value); |
e6142f2e JG |
136 | } |
137 | ||
138 | env_value = lttng_secure_getenv("LTTNG_UST_CLOCK_PLUGIN"); | |
139 | if (env_value) { | |
28ab034a | 140 | config_string_set_static(&config->lttng_ust_clock_plugin, env_value); |
e6142f2e JG |
141 | } |
142 | ||
143 | env_value = lttng_secure_getenv(DEFAULT_LTTNG_KMOD_PROBES); | |
144 | if (env_value) { | |
28ab034a | 145 | config_string_set_static(&config->kmod_probes_list, env_value); |
e6142f2e JG |
146 | } |
147 | ||
148 | env_value = lttng_secure_getenv(DEFAULT_LTTNG_EXTRA_KMOD_PROBES); | |
149 | if (env_value) { | |
28ab034a | 150 | config_string_set_static(&config->kmod_extra_probes_list, env_value); |
e6142f2e JG |
151 | } |
152 | end: | |
153 | return ret; | |
154 | } | |
155 | ||
28ab034a | 156 | static int config_set_paths_root(struct sessiond_config *config) |
e6142f2e JG |
157 | { |
158 | int ret = 0; | |
159 | ||
160 | config_string_set(&config->rundir, strdup(DEFAULT_LTTNG_RUNDIR)); | |
161 | if (!config->rundir.value) { | |
162 | ERR("Failed to set rundir"); | |
163 | ret = -1; | |
164 | goto end; | |
165 | } | |
166 | ||
28ab034a JG |
167 | config_string_set_static(&config->apps_unix_sock_path, DEFAULT_GLOBAL_APPS_UNIX_SOCK); |
168 | config_string_set_static(&config->client_unix_sock_path, DEFAULT_GLOBAL_CLIENT_UNIX_SOCK); | |
169 | config_string_set_static(&config->wait_shm_path, DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH); | |
170 | config_string_set_static(&config->health_unix_sock_path, DEFAULT_GLOBAL_HEALTH_UNIX_SOCK); | |
e6142f2e JG |
171 | end: |
172 | return ret; | |
173 | } | |
174 | ||
28ab034a | 175 | static int config_set_paths_non_root(struct sessiond_config *config) |
e6142f2e JG |
176 | { |
177 | int ret = 0; | |
178 | const char *home_path = utils_get_home_dir(); | |
179 | char *str; | |
180 | ||
cd9adb8b | 181 | if (home_path == nullptr) { |
e6142f2e JG |
182 | ERR("Can't get HOME directory for sockets creation."); |
183 | ret = -1; | |
184 | goto end; | |
185 | } | |
186 | ||
187 | /* | |
188 | * Create rundir from home path. This will create something like | |
189 | * $HOME/.lttng | |
190 | */ | |
191 | ret = asprintf(&str, DEFAULT_LTTNG_HOME_RUNDIR, home_path); | |
192 | if (ret < 0) { | |
193 | ERR("Failed to set rundir"); | |
194 | goto end; | |
195 | } | |
196 | config_string_set(&config->rundir, str); | |
cd9adb8b | 197 | str = nullptr; |
e6142f2e JG |
198 | |
199 | ret = asprintf(&str, DEFAULT_HOME_APPS_UNIX_SOCK, home_path); | |
200 | if (ret < 0) { | |
201 | ERR("Failed to set default home apps unix socket path"); | |
202 | goto end; | |
203 | } | |
204 | config_string_set(&config->apps_unix_sock_path, str); | |
cd9adb8b | 205 | str = nullptr; |
e6142f2e JG |
206 | |
207 | ret = asprintf(&str, DEFAULT_HOME_CLIENT_UNIX_SOCK, home_path); | |
208 | if (ret < 0) { | |
209 | ERR("Failed to set default home client unix socket path"); | |
210 | goto end; | |
211 | } | |
212 | config_string_set(&config->client_unix_sock_path, str); | |
cd9adb8b | 213 | str = nullptr; |
e6142f2e JG |
214 | |
215 | ret = asprintf(&str, DEFAULT_HOME_APPS_WAIT_SHM_PATH, getuid()); | |
216 | if (ret < 0) { | |
217 | ERR("Failed to set default home apps wait shm path"); | |
218 | goto end; | |
219 | } | |
220 | config_string_set(&config->wait_shm_path, str); | |
cd9adb8b | 221 | str = nullptr; |
e6142f2e JG |
222 | |
223 | ret = asprintf(&str, DEFAULT_HOME_HEALTH_UNIX_SOCK, home_path); | |
224 | if (ret < 0) { | |
225 | ERR("Failed to set default home health UNIX socket path"); | |
226 | goto end; | |
227 | } | |
228 | config_string_set(&config->health_unix_sock_path, str); | |
cd9adb8b | 229 | str = nullptr; |
e6142f2e JG |
230 | |
231 | ret = 0; | |
232 | end: | |
233 | return ret; | |
234 | } | |
235 | ||
e6142f2e JG |
236 | int sessiond_config_init(struct sessiond_config *config) |
237 | { | |
238 | int ret; | |
239 | bool is_root = (getuid() == 0); | |
240 | char *str; | |
241 | ||
a0377dfe | 242 | LTTNG_ASSERT(config); |
e6142f2e JG |
243 | memcpy(config, &sessiond_config_build_defaults, sizeof(*config)); |
244 | ||
245 | if (is_root) { | |
246 | ret = config_set_paths_root(config); | |
247 | } else { | |
248 | ret = config_set_paths_non_root(config); | |
249 | } | |
2a9f757b | 250 | if (ret < 0) { |
c9a2957d | 251 | goto error; |
2a9f757b | 252 | } |
e6142f2e JG |
253 | |
254 | /* 32 bits consumerd path setup */ | |
28ab034a | 255 | ret = asprintf(&str, DEFAULT_USTCONSUMERD32_PATH, config->rundir.value); |
e6142f2e JG |
256 | if (ret < 0) { |
257 | ERR("Failed to set 32-bit consumer path"); | |
c9a2957d | 258 | goto error; |
e6142f2e JG |
259 | } |
260 | config_string_set(&config->consumerd32_path, str); | |
cd9adb8b | 261 | str = nullptr; |
e6142f2e | 262 | |
28ab034a | 263 | ret = asprintf(&str, DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH, config->rundir.value); |
e6142f2e JG |
264 | if (ret < 0) { |
265 | ERR("Failed to set 32-bit consumer error socket path"); | |
c9a2957d | 266 | goto error; |
e6142f2e JG |
267 | } |
268 | config_string_set(&config->consumerd32_err_unix_sock_path, str); | |
cd9adb8b | 269 | str = nullptr; |
e6142f2e | 270 | |
28ab034a | 271 | ret = asprintf(&str, DEFAULT_USTCONSUMERD32_CMD_SOCK_PATH, config->rundir.value); |
e6142f2e JG |
272 | if (ret < 0) { |
273 | ERR("Failed to set 32-bit consumer command socket path"); | |
c9a2957d | 274 | goto error; |
e6142f2e JG |
275 | } |
276 | config_string_set(&config->consumerd32_cmd_unix_sock_path, str); | |
cd9adb8b | 277 | str = nullptr; |
e6142f2e JG |
278 | |
279 | /* 64 bits consumerd path setup */ | |
28ab034a | 280 | ret = asprintf(&str, DEFAULT_USTCONSUMERD64_PATH, config->rundir.value); |
e6142f2e JG |
281 | if (ret < 0) { |
282 | ERR("Failed to set 64-bit consumer path"); | |
c9a2957d | 283 | goto error; |
e6142f2e JG |
284 | } |
285 | config_string_set(&config->consumerd64_path, str); | |
cd9adb8b | 286 | str = nullptr; |
e6142f2e | 287 | |
28ab034a | 288 | ret = asprintf(&str, DEFAULT_USTCONSUMERD64_ERR_SOCK_PATH, config->rundir.value); |
e6142f2e JG |
289 | if (ret < 0) { |
290 | ERR("Failed to set 64-bit consumer error socket path"); | |
c9a2957d | 291 | goto error; |
e6142f2e JG |
292 | } |
293 | config_string_set(&config->consumerd64_err_unix_sock_path, str); | |
cd9adb8b | 294 | str = nullptr; |
e6142f2e | 295 | |
28ab034a | 296 | ret = asprintf(&str, DEFAULT_USTCONSUMERD64_CMD_SOCK_PATH, config->rundir.value); |
e6142f2e JG |
297 | if (ret < 0) { |
298 | ERR("Failed to set 64-bit consumer command socket path"); | |
c9a2957d | 299 | goto error; |
e6142f2e JG |
300 | } |
301 | config_string_set(&config->consumerd64_cmd_unix_sock_path, str); | |
cd9adb8b | 302 | str = nullptr; |
e6142f2e JG |
303 | |
304 | /* kconsumerd consumerd path setup */ | |
28ab034a | 305 | ret = asprintf(&str, DEFAULT_KCONSUMERD_PATH, config->rundir.value); |
e6142f2e JG |
306 | if (ret < 0) { |
307 | ERR("Failed to set kernel consumer path"); | |
c9a2957d | 308 | goto error; |
e6142f2e JG |
309 | } |
310 | config_string_set(&config->kconsumerd_path, str); | |
cd9adb8b | 311 | str = nullptr; |
e6142f2e | 312 | |
28ab034a | 313 | ret = asprintf(&str, DEFAULT_KCONSUMERD_ERR_SOCK_PATH, config->rundir.value); |
4a08b740 JG |
314 | if (ret < 0) { |
315 | ERR("Failed to set kernel consumer error socket path"); | |
c9a2957d | 316 | goto error; |
4a08b740 JG |
317 | } |
318 | config_string_set(&config->kconsumerd_err_unix_sock_path, str); | |
cd9adb8b | 319 | str = nullptr; |
4a08b740 | 320 | |
28ab034a | 321 | ret = asprintf(&str, DEFAULT_KCONSUMERD_CMD_SOCK_PATH, config->rundir.value); |
4a08b740 JG |
322 | if (ret < 0) { |
323 | ERR("Failed to set kernel consumer command socket path"); | |
c9a2957d | 324 | goto error; |
4a08b740 JG |
325 | } |
326 | config_string_set(&config->kconsumerd_cmd_unix_sock_path, str); | |
cd9adb8b | 327 | str = nullptr; |
4a08b740 | 328 | |
28ab034a | 329 | ret = asprintf(&str, "%s/%s", config->rundir.value, DEFAULT_LTTNG_SESSIOND_PIDFILE); |
e6142f2e JG |
330 | if (ret < 0) { |
331 | ERR("Failed to set PID file path"); | |
c9a2957d | 332 | goto error; |
e6142f2e JG |
333 | } |
334 | config_string_set(&config->pid_file_path, str); | |
cd9adb8b | 335 | str = nullptr; |
e6142f2e | 336 | |
28ab034a | 337 | ret = asprintf(&str, "%s/%s", config->rundir.value, DEFAULT_LTTNG_SESSIOND_LOCKFILE); |
e6142f2e JG |
338 | if (ret < 0) { |
339 | ERR("Failed to set lock file path"); | |
c9a2957d | 340 | goto error; |
e6142f2e JG |
341 | } |
342 | config_string_set(&config->lock_file_path, str); | |
cd9adb8b | 343 | str = nullptr; |
e6142f2e | 344 | |
28ab034a | 345 | ret = asprintf(&str, "%s/%s", config->rundir.value, DEFAULT_LTTNG_SESSIOND_AGENTPORT_FILE); |
e6142f2e JG |
346 | if (ret < 0) { |
347 | ERR("Failed to set agent port file path"); | |
c9a2957d | 348 | goto error; |
e6142f2e JG |
349 | } |
350 | config_string_set(&config->agent_port_file_path, str); | |
cd9adb8b | 351 | str = nullptr; |
e6142f2e JG |
352 | |
353 | /* | |
354 | * Allow INSTALL_BIN_PATH to be used as a target path for the | |
355 | * native architecture size consumer if CONFIG_CONSUMER*_PATH | |
356 | * has not been defined. | |
357 | */ | |
358 | #if (CAA_BITS_PER_LONG == 32) | |
359 | config_string_set_static(&config->consumerd32_bin_path, | |
28ab034a JG |
360 | INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE); |
361 | config_string_set_static(&config->consumerd32_lib_dir, INSTALL_LIB_PATH); | |
e6142f2e JG |
362 | #elif (CAA_BITS_PER_LONG == 64) |
363 | config_string_set_static(&config->consumerd64_bin_path, | |
28ab034a JG |
364 | INSTALL_BIN_PATH "/" DEFAULT_CONSUMERD_FILE); |
365 | config_string_set_static(&config->consumerd64_lib_dir, INSTALL_LIB_PATH); | |
e6142f2e JG |
366 | #else |
367 | #error "Unknown bitness" | |
368 | #endif | |
369 | ret = 0; | |
c9a2957d JG |
370 | return ret; |
371 | error: | |
372 | sessiond_config_fini(config); | |
e6142f2e JG |
373 | return ret; |
374 | } | |
375 | ||
e6142f2e JG |
376 | void sessiond_config_fini(struct sessiond_config *config) |
377 | { | |
378 | config_string_fini(&config->tracing_group_name); | |
379 | config_string_fini(&config->kmod_probes_list); | |
380 | config_string_fini(&config->kmod_extra_probes_list); | |
16ffecdb | 381 | config_string_fini(&config->rundir); |
e6142f2e JG |
382 | config_string_fini(&config->apps_unix_sock_path); |
383 | config_string_fini(&config->client_unix_sock_path); | |
384 | config_string_fini(&config->wait_shm_path); | |
385 | config_string_fini(&config->health_unix_sock_path); | |
386 | config_string_fini(&config->lttng_ust_clock_plugin); | |
387 | config_string_fini(&config->pid_file_path); | |
388 | config_string_fini(&config->lock_file_path); | |
389 | config_string_fini(&config->load_session_path); | |
390 | config_string_fini(&config->agent_port_file_path); | |
391 | config_string_fini(&config->consumerd32_path); | |
392 | config_string_fini(&config->consumerd32_bin_path); | |
393 | config_string_fini(&config->consumerd32_lib_dir); | |
394 | config_string_fini(&config->consumerd32_err_unix_sock_path); | |
395 | config_string_fini(&config->consumerd32_cmd_unix_sock_path); | |
396 | config_string_fini(&config->consumerd64_path); | |
397 | config_string_fini(&config->consumerd64_bin_path); | |
398 | config_string_fini(&config->consumerd64_lib_dir); | |
399 | config_string_fini(&config->consumerd64_err_unix_sock_path); | |
400 | config_string_fini(&config->consumerd64_cmd_unix_sock_path); | |
401 | config_string_fini(&config->kconsumerd_path); | |
402 | config_string_fini(&config->kconsumerd_err_unix_sock_path); | |
403 | config_string_fini(&config->kconsumerd_cmd_unix_sock_path); | |
404 | } | |
405 | ||
28ab034a | 406 | static int resolve_path(struct config_string *path) |
e6142f2e JG |
407 | { |
408 | int ret = 0; | |
409 | char *absolute_path; | |
410 | ||
411 | if (!path->value || path->value[0] == '/') { | |
412 | goto end; | |
413 | } | |
414 | ||
415 | absolute_path = utils_expand_path(path->value); | |
416 | if (!absolute_path) { | |
417 | ret = -1; | |
418 | goto end; | |
419 | } | |
420 | ||
421 | config_string_set(path, absolute_path); | |
422 | end: | |
423 | return ret; | |
424 | } | |
425 | ||
28ab034a JG |
426 | #define RESOLVE_CHECK(path_config_str) \ |
427 | if (resolve_path(path_config_str)) \ | |
428 | return -1 | |
e6142f2e | 429 | |
e6142f2e JG |
430 | int sessiond_config_resolve_paths(struct sessiond_config *config) |
431 | { | |
432 | RESOLVE_CHECK(&config->apps_unix_sock_path); | |
433 | RESOLVE_CHECK(&config->client_unix_sock_path); | |
434 | RESOLVE_CHECK(&config->wait_shm_path); | |
435 | RESOLVE_CHECK(&config->health_unix_sock_path); | |
436 | RESOLVE_CHECK(&config->lttng_ust_clock_plugin); | |
437 | RESOLVE_CHECK(&config->pid_file_path); | |
438 | RESOLVE_CHECK(&config->lock_file_path); | |
439 | RESOLVE_CHECK(&config->load_session_path); | |
440 | RESOLVE_CHECK(&config->agent_port_file_path); | |
441 | RESOLVE_CHECK(&config->consumerd32_path); | |
442 | RESOLVE_CHECK(&config->consumerd32_bin_path); | |
443 | RESOLVE_CHECK(&config->consumerd32_lib_dir); | |
444 | RESOLVE_CHECK(&config->consumerd32_err_unix_sock_path); | |
445 | RESOLVE_CHECK(&config->consumerd32_cmd_unix_sock_path); | |
446 | RESOLVE_CHECK(&config->consumerd64_path); | |
447 | RESOLVE_CHECK(&config->consumerd64_bin_path); | |
448 | RESOLVE_CHECK(&config->consumerd64_lib_dir); | |
449 | RESOLVE_CHECK(&config->consumerd64_err_unix_sock_path); | |
450 | RESOLVE_CHECK(&config->consumerd64_cmd_unix_sock_path); | |
451 | RESOLVE_CHECK(&config->kconsumerd_path); | |
452 | RESOLVE_CHECK(&config->kconsumerd_err_unix_sock_path); | |
453 | RESOLVE_CHECK(&config->kconsumerd_cmd_unix_sock_path); | |
454 | return 0; | |
455 | } | |
456 | ||
e6142f2e JG |
457 | void sessiond_config_log(struct sessiond_config *config) |
458 | { | |
459 | DBG_NO_LOC("[sessiond configuration]"); | |
a3bc3918 JR |
460 | DBG_NO_LOC("\tversion %s", VERSION); |
461 | if (GIT_VERSION[0] != '\0') { | |
462 | DBG_NO_LOC("\tgit version %s", GIT_VERSION); | |
463 | } | |
464 | if (EXTRA_VERSION_NAME[0] != '\0') { | |
465 | DBG_NO_LOC("\textra version name %s", EXTRA_VERSION_NAME); | |
466 | } | |
467 | if (EXTRA_VERSION_DESCRIPTION[0] != '\0') { | |
468 | DBG_NO_LOC("\textra version description:\n\t%s", EXTRA_VERSION_DESCRIPTION); | |
469 | } | |
7f5ed73a JR |
470 | if (EXTRA_VERSION_PATCHES[0] != '\0') { |
471 | DBG_NO_LOC("\textra version patches:\n\t%s", EXTRA_VERSION_PATCHES); | |
472 | } | |
2ca43cb1 JR |
473 | DBG_NO_LOC("\tverbose: %i", config->verbose); |
474 | DBG_NO_LOC("\tverbose consumer: %i", config->verbose_consumer); | |
475 | DBG_NO_LOC("\tquiet mode: %s", config->quiet ? "True" : "False"); | |
2288467f | 476 | if (config->agent_tcp_port.begin == config->agent_tcp_port.end) { |
2ca43cb1 | 477 | DBG_NO_LOC("\tagent_tcp_port: %i", config->agent_tcp_port.begin); |
2288467f | 478 | } else { |
2ca43cb1 | 479 | DBG_NO_LOC("\tagent_tcp_port: [%i, %i]", |
28ab034a JG |
480 | config->agent_tcp_port.begin, |
481 | config->agent_tcp_port.end); | |
2288467f | 482 | } |
2ca43cb1 JR |
483 | DBG_NO_LOC("\tapplication socket timeout: %i", config->app_socket_timeout); |
484 | DBG_NO_LOC("\tno-kernel: %s", config->no_kernel ? "True" : "False"); | |
485 | DBG_NO_LOC("\tbackground: %s", config->background ? "True" : "False"); | |
486 | DBG_NO_LOC("\tdaemonize: %s", config->daemonize ? "True" : "False"); | |
487 | DBG_NO_LOC("\tsignal parent on start: %s", config->sig_parent ? "True" : "False"); | |
28ab034a JG |
488 | DBG_NO_LOC("\ttracing group name: %s", |
489 | config->tracing_group_name.value ?: "Unknown"); | |
490 | DBG_NO_LOC("\tkmod_probe_list: %s", config->kmod_probes_list.value ?: "None"); | |
491 | DBG_NO_LOC("\tkmod_extra_probe_list: %s", | |
492 | config->kmod_extra_probes_list.value ?: "None"); | |
493 | DBG_NO_LOC("\trundir: %s", config->rundir.value ?: "Unknown"); | |
494 | DBG_NO_LOC("\tapplication socket path: %s", | |
495 | config->apps_unix_sock_path.value ?: "Unknown"); | |
496 | DBG_NO_LOC("\tclient socket path: %s", | |
497 | config->client_unix_sock_path.value ?: "Unknown"); | |
498 | DBG_NO_LOC("\twait shm path: %s", config->wait_shm_path.value ?: "Unknown"); | |
499 | DBG_NO_LOC("\thealth socket path: %s", | |
500 | config->health_unix_sock_path.value ?: "Unknown"); | |
501 | DBG_NO_LOC("\tLTTNG_UST_CLOCK_PLUGIN: %s", | |
502 | config->lttng_ust_clock_plugin.value ?: "None"); | |
503 | DBG_NO_LOC("\tpid file path: %s", config->pid_file_path.value ?: "Unknown"); | |
504 | DBG_NO_LOC("\tlock file path: %s", | |
505 | config->lock_file_path.value ?: "Unknown"); | |
506 | DBG_NO_LOC("\tsession load path: %s", | |
507 | config->load_session_path.value ?: "None"); | |
508 | DBG_NO_LOC("\tagent port file path: %s", | |
509 | config->agent_port_file_path.value ?: "Unknown"); | |
510 | DBG_NO_LOC("\tconsumerd32 path: %s", | |
511 | config->consumerd32_path.value ?: "Unknown"); | |
512 | DBG_NO_LOC("\tconsumerd32 bin path: %s", | |
513 | config->consumerd32_bin_path.value ?: "Unknown"); | |
514 | DBG_NO_LOC("\tconsumerd32 lib dir: %s", | |
515 | config->consumerd32_lib_dir.value ?: "Unknown"); | |
516 | DBG_NO_LOC("\tconsumerd32 err unix sock path:%s", | |
517 | config->consumerd32_err_unix_sock_path.value ?: "Unknown"); | |
518 | DBG_NO_LOC("\tconsumerd32 cmd unix sock path:%s", | |
519 | config->consumerd32_cmd_unix_sock_path.value ?: "Unknown"); | |
520 | DBG_NO_LOC("\tconsumerd64 path: %s", | |
521 | config->consumerd64_path.value ?: "Unknown"); | |
522 | DBG_NO_LOC("\tconsumerd64 bin path: %s", | |
523 | config->consumerd64_bin_path.value ?: "Unknown"); | |
524 | DBG_NO_LOC("\tconsumerd64 lib dir: %s", | |
525 | config->consumerd64_lib_dir.value ?: "Unknown"); | |
526 | DBG_NO_LOC("\tconsumerd64 err unix sock path:%s", | |
527 | config->consumerd64_err_unix_sock_path.value ?: "Unknown"); | |
528 | DBG_NO_LOC("\tconsumerd64 cmd unix sock path:%s", | |
529 | config->consumerd64_cmd_unix_sock_path.value ?: "Unknown"); | |
530 | DBG_NO_LOC("\tkconsumerd path: %s", | |
531 | config->kconsumerd_path.value ?: "Unknown"); | |
532 | DBG_NO_LOC("\tkconsumerd err unix sock path: %s", | |
533 | config->kconsumerd_err_unix_sock_path.value ?: "Unknown"); | |
534 | DBG_NO_LOC("\tkconsumerd cmd unix sock path: %s", | |
535 | config->kconsumerd_cmd_unix_sock_path.value ?: "Unknown"); | |
e6142f2e | 536 | } |