SoW-2020-0002: Trace Hit Counters: trigger error reporting integration
[lttng-tools.git] / src / common / utils.h
index 27a6f4849aced6cac50ea2e9ce7e4b0e36ee1693..570216d53c9709dddcfaf480f68a465bc0a8f294 100644 (file)
@@ -1,29 +1,19 @@
 /*
- * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
+ * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
  *
- * 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 <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>
 
@@ -64,5 +54,21 @@ 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 */
This page took 0.024041 seconds and 5 git commands to generate.