X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Futils.h;h=6e478b39eb3609f90aa3ad1ab3b5a4200754411c;hb=48a4000561343808724f7cb5fa8c131877489ccd;hp=b6e5c97db345769c53408e0261989c35f3d71db3;hpb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;p=lttng-tools.git diff --git a/src/common/utils.h b/src/common/utils.h index b6e5c97db..6e478b39e 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -8,21 +8,23 @@ #ifndef _COMMON_UTILS_H #define _COMMON_UTILS_H -#include -#include -#include #include +#include #include +#include #include +#include #include +#if defined(__cplusplus) +extern "C" { +#endif + #define KIBI_LOG2 10 #define MEBI_LOG2 20 #define GIBI_LOG2 30 -char *utils_partial_realpath(const char *path, char *resolved_path, - size_t size); char *utils_expand_path(const char *path); char *utils_expand_path_keep_symlink(const char *path); int utils_create_pipe(int *dst); @@ -54,5 +56,24 @@ int utils_show_help(int section, const char *page_name, const char *help_msg); int utils_get_memory_available(size_t *value); int utils_get_memory_total(size_t *value); int utils_change_working_directory(const char *path); +enum lttng_error_code utils_user_id_from_name( + const char *user_name, uid_t *user_id); +enum lttng_error_code utils_group_id_from_name( + const char *group_name, gid_t *group_id); + +/* + * Parse `str` as an unsigned long long value. + * + * Return 0 on success. Return -1 on failure which can be because: + * + * - `str` is zero length + * - `str` contains invalid + */ +int utils_parse_unsigned_long_long(const char *str, + unsigned long long *value); + +#if defined(__cplusplus) +} +#endif #endif /* _COMMON_UTILS_H */