+ return ret;
+}
+
+/*
+ * Returns the session name from the config file.
+ *
+ * The caller is responsible for freeing the returned string.
+ * On error, NULL is returned.
+ */
+char *config_read_session_name(char *path)
+{
+ int ret;
+ char *name = NULL;
+
+ ret = _config_read_session_name(path, &name);
+ if (ret == -ENOENT) {
+ const char *home_dir = utils_get_home_dir();
+
+ ERR("Can't find valid lttng config %s/.lttngrc", home_dir);
+ MSG("Did you create a session? (lttng create <my_session>)");
+ }
+
+ return name;
+}
+
+/*
+ * Returns the session name from the config file. (no warnings/errors emitted)
+ *
+ * The caller is responsible for freeing the returned string.
+ * On error, NULL is returned.
+ */
+char *config_read_session_name_quiet(char *path)
+{
+ char *name = NULL;