X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Futils.c;h=f1e0148cb9cb9cd28159846141a99fc108b95a58;hb=d73bf3d793ee0b0c5b56cb47cb50c27d1789d3bd;hp=4d49728c0f47a23cce6eba1bc2f72f11c2c14836;hpb=db5be0a3dcf30edeca9c3143682454bab9523f71;p=lttng-tools.git diff --git a/src/common/utils.c b/src/common/utils.c index 4d49728c0..f1e0148cb 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -528,7 +528,7 @@ int utils_create_lock_file(const char *filepath) S_IRGRP | S_IWGRP); if (fd < 0) { PERROR("open lock file %s", filepath); - ret = -1; + fd = -1; goto error; } @@ -785,7 +785,11 @@ int utils_create_stream_file(const char *path_name, char *file_name, uint64_t si goto error; } - flags = O_WRONLY | O_CREAT | O_TRUNC; + /* + * With the session rotation feature on the relay, we might need to seek + * and truncate a tracefile, so we need read and write access. + */ + flags = O_RDWR | O_CREAT | O_TRUNC; /* Open with 660 mode */ mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; @@ -1202,26 +1206,6 @@ end: return home_dir; } -/* - * Obtain the value of LTTNG_KMOD_PROBES environment variable, if exists. - * Otherwise returns NULL. - */ -LTTNG_HIDDEN -char *utils_get_kmod_probes_list(void) -{ - return lttng_secure_getenv(DEFAULT_LTTNG_KMOD_PROBES); -} - -/* - * Obtain the value of LTTNG_EXTRA_KMOD_PROBES environment variable, if - * exists. Otherwise returns NULL. - */ -LTTNG_HIDDEN -char *utils_get_extra_kmod_probes_list(void) -{ - return lttng_secure_getenv(DEFAULT_LTTNG_EXTRA_KMOD_PROBES); -} - /* * With the given format, fill dst with the time of len maximum siz. * @@ -1429,11 +1413,17 @@ static const char *get_man_bin_path(void) } LTTNG_HIDDEN -int utils_show_man_page(int section, const char *page_name) +int utils_show_help(int section, const char *page_name, + const char *help_msg) { char section_string[8]; const char *man_bin_path = get_man_bin_path(); - int ret; + int ret = 0; + + if (help_msg) { + printf("%s", help_msg); + goto end; + } /* Section integer -> section string */ ret = sprintf(section_string, "%d", section); @@ -1448,5 +1438,7 @@ int utils_show_man_page(int section, const char *page_name) */ ret = execlp(man_bin_path, "man", "-M", MANPATH, section_string, page_name, NULL); + +end: return ret; }