#ifndef _COMMON_UTILS_H
#define _COMMON_UTILS_H
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdint.h>
#include <getopt.h>
+#include <lttng/lttng-error.h>
#include <stdbool.h>
+#include <stdint.h>
#include <sys/types.h>
+#include <unistd.h>
#include <common/compat/directory-handle.h>
#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);
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
+ */
+LTTNG_HIDDEN
+int utils_parse_unsigned_long_long(const char *str,
+ unsigned long long *value);
#endif /* _COMMON_UTILS_H */