Add kernel snapshot support
[lttng-tools.git] / src / common / utils.c
index 3e659a1c81079d74b52aab9993c555fcaba6b62d..ecac5381f061fb65c89bda64de0ad86e5be37f6f 100644 (file)
@@ -32,6 +32,7 @@
 #include <common/runas.h>
 
 #include "utils.h"
+#include "defaults.h"
 
 /*
  * Return the realpath(3) of the path even if the last directory token does not
@@ -307,7 +308,7 @@ error:
  * Return 0 on success or else a negative value.
  */
 LTTNG_HIDDEN
-int utils_create_stream_file(char *path_name, char *file_name, uint64_t size,
+int utils_create_stream_file(const char *path_name, char *file_name, uint64_t size,
                uint64_t count, int uid, int gid)
 {
        int ret, out_fd, flags, mode;
@@ -580,3 +581,17 @@ int utils_get_count_order_u32(uint32_t x)
 
        return fls_u32(x - 1);
 }
+
+/**
+ * Obtain the value of LTTNG_HOME environment variable, if exists.
+ * Otherwise returns the value of HOME.
+ */
+char *utils_get_home_dir(void)
+{
+       char *val = NULL;
+       val = getenv(DEFAULT_LTTNG_HOME_ENV_VAR);
+       if (val != NULL) {
+               return val;
+       }
+       return getenv(DEFAULT_LTTNG_FALLBACK_HOME_ENV_VAR);
+}
This page took 0.024281 seconds and 5 git commands to generate.