X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fmain.c;h=3c2d2a756b71b704666b3d5b81792d9c02c50708;hb=db58870b8a78ae1a466949318f1a7c9ef1ba3b3e;hp=80ca3d7c04e42704a325bb8b2aedfee1db0d7837;hpb=5b49a21f8fcf7a179a86c76669c405b82b6439fb;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 80ca3d7c0..3c2d2a756 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -2623,7 +2623,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) break; } default: - PERROR("unknown consumer type"); + ERR("unknown consumer type"); exit(EXIT_FAILURE); } if (errno != 0) { @@ -2716,7 +2716,6 @@ static int init_kernel_tracer(void) kernel_tracer_fd = open(module_proc_lttng, O_RDWR); if (kernel_tracer_fd < 0) { DBG("Failed to open %s", module_proc_lttng); - ret = -1; goto error_open; } @@ -5526,6 +5525,44 @@ error: return ret; } +static int set_clock_plugin_env(void) +{ + int ret = 0; + const char *original_env_value; + char *full_path = NULL; + char *new_env_value = NULL; + + original_env_value = getenv("LTTNG_UST_CLOCK_PLUGIN"); + if (!original_env_value) { + goto end; + } + + full_path = utils_expand_path(original_env_value); + if (!full_path) { + ERR("Failed to expand LTTNG_UST_CLOCK_PLUGIN path \"%s\"", + original_env_value); + ret = -1; + goto end; + } + ret = asprintf(&new_env_value, "LTTNG_UST_CLOCK_PLUGIN=%s", + full_path); + free(full_path); + if (ret < 0) { + PERROR("asprintf"); + goto end; + } + + DBG("Updating environment: %s", new_env_value); + ret = putenv(new_env_value); + if (ret) { + free(new_env_value); + PERROR("putenv of LTTNG_UST_CLOCK_PLUGIN"); + goto end; + } +end: + return ret; +} + /* * main */ @@ -5567,6 +5604,12 @@ int main(int argc, char **argv) goto exit_options; } + ret = set_clock_plugin_env(); + if (ret) { + retval = -1; + goto exit_options; + } + /* Daemonize */ if (opt_daemon || opt_background) { int i;