X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Futils.h;h=b6e5c97db345769c53408e0261989c35f3d71db3;hp=5f95d4aab8db1456291ccdc166331dc93a3a0285;hb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;hpb=28ab59d0baef178a8629ec9fb517ba75efb46ea8 diff --git a/src/common/utils.h b/src/common/utils.h index 5f95d4aab..b6e5c97db 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -1,18 +1,8 @@ /* - * 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 @@ -44,18 +34,14 @@ int utils_set_fd_cloexec(int fd); int utils_create_pid_file(pid_t pid, const char *filepath); int utils_mkdir(const char *path, mode_t mode, int uid, int gid); int utils_mkdir_recursive(const char *path, mode_t mode, int uid, int gid); -int utils_create_stream_file(const char *path_name, char *file_name, uint64_t size, - uint64_t count, int uid, int gid, char *suffix); -int utils_unlink_stream_file(const char *path_name, char *file_name, uint64_t size, - uint64_t count, int uid, int gid, char *suffix); -int utils_rotate_stream_file(char *path_name, char *file_name, uint64_t size, - uint64_t count, int uid, int gid, int out_fd, uint64_t *new_count, - int *stream_fd); +int utils_stream_file_path(const char *path_name, const char *file_name, + uint64_t size, uint64_t count, const char *suffix, + char *out_stream_path, size_t stream_path_len); int utils_parse_size_suffix(char const * const str, uint64_t * const size); int utils_parse_time_suffix(char const * const str, uint64_t * const time_us); int utils_get_count_order_u32(uint32_t x); int utils_get_count_order_u64(uint64_t x); -char *utils_get_home_dir(void); +const char *utils_get_home_dir(void); char *utils_get_user_home_dir(uid_t uid); size_t utils_get_current_time_str(const char *format, char *dst, size_t len); int utils_get_group_id(const char *name, bool warn, gid_t *gid); @@ -67,5 +53,6 @@ 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); #endif /* _COMMON_UTILS_H */