Remove m4_ifdef for AC_PROG_LIBTOOL (deprecated)
[lttng-tools.git] / lttng / utils.c
index b05fd2283f43798c781da4635121356826d2a57a..db7fd38fe6ee297fc2ec8b123a3fba1e3e52a3f3 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * Copyright (c)  2011 David Goulet <david.goulet@polymtl.ca>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; only version 2
+ * of the License.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 #include <lttng/lttng.h>
 
-#include "config.h"
-
-/*
- *  get_config_file_path
- *
- *  Return absolute path to the configuration file.
- */
-char *get_config_file_path(void)
-{
-       char *alloc_path, *path = NULL;
-
-       /* Get path to config directory */
-       alloc_path = config_get_default_path();
-       if (alloc_path == NULL) {
-               goto error;
-       }
-
-       /* Get path to config file */
-       path = config_generate_dir_path(alloc_path);
-       if (path == NULL) {
-               goto free_alloc_path;
-       }
-
-free_alloc_path:
-       free(alloc_path);
-error:
-       return path;
-}
+#include "conf.h"
+#include "lttngerr.h"
 
 /*
  *  get_session_name
@@ -60,7 +34,7 @@ char *get_session_name(void)
        char *path, *session_name = NULL;
 
        /* Get path to config file */
-       path = get_config_file_path();
+       path = config_get_default_path();
        if (path == NULL) {
                goto error;
        }
@@ -68,36 +42,10 @@ char *get_session_name(void)
        /* Get session name from config */
        session_name = config_read_session_name(path);
        if (session_name == NULL) {
-               goto free_path;
-       }
-
-free_path:
-       free(path);
-error:
-       return session_name;
-}
-
-/*
- *  set_session_name
- *
- *  Get session name and set it for the lttng control lib.
- */
-int set_session_name(void)
-{
-       int ret;
-       char *session_name;
-
-       session_name = get_session_name();
-       if (session_name == NULL) {
-               ret = -1;
                goto error;
        }
 
-       lttng_set_session_name(session_name);
-       free(session_name);
-
-       ret = 0;
-
 error:
-       return ret;
+       DBG("Session name found: %s", session_name);
+       return session_name;
 }
This page took 0.024042 seconds and 4 git commands to generate.