X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Futils.h;h=52dcd01facc1144d3216132248c4925bfa63af58;hp=11388c9031bfdaabffd9b1dad596410af43e5e9f;hb=440bede9ee59598b9ea8a3a3ff3191b8c84bd4f7;hpb=2530e68bb73b6ed32df6c5b4a5031bca3f5f3015 diff --git a/src/common/utils.h b/src/common/utils.h index 11388c903..52dcd01fa 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -1,29 +1,19 @@ /* - * Copyright (C) 2012 - David Goulet + * Copyright (C) 2012 David Goulet * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License, version 2 only, as - * published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _COMMON_UTILS_H #define _COMMON_UTILS_H -#include -#include -#include #include +#include #include +#include #include +#include #include @@ -31,8 +21,6 @@ #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); @@ -63,5 +51,22 @@ int utils_truncate_stream_file(int fd, off_t length); 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 + */ +LTTNG_HIDDEN +int utils_parse_unsigned_long_long(const char *str, + unsigned long long *value); #endif /* _COMMON_UTILS_H */