char *utils_get_home_dir(void)
{
char *val = NULL;
+ struct passwd *pwd;
+
val = getenv(DEFAULT_LTTNG_HOME_ENV_VAR);
if (val != NULL) {
- return val;
+ goto end;
+ }
+ val = getenv(DEFAULT_LTTNG_FALLBACK_HOME_ENV_VAR);
+ if (val != NULL) {
+ goto end;
}
- return getenv(DEFAULT_LTTNG_FALLBACK_HOME_ENV_VAR);
+
+ /* Fallback on the password file entry. */
+ pwd = getpwuid(getuid());
+ if (!pwd) {
+ goto end;
+ }
+ val = pwd->pw_dir;
+
+ DBG3("Home directory is '%s'", val);
+
+end:
+ return val;
}
/**
return home_dir;
}
+/*
+ * Obtain the value of LTTNG_KMOD_PROBES environment variable, if exists.
+ * Otherwise returns an empty string.
+ */
+LTTNG_HIDDEN
+char *utils_get_kmod_probes_list(void)
+{
+ return getenv(DEFAULT_LTTNG_KMOD_PROBES);
+}
+
/*
* With the given format, fill dst with the time of len maximum siz.
*