Fix UST tests if lttng-ust is not available
[lttng-tools.git] / lttng / utils.c
1 /*
2 * Copyright (c) 2011 David Goulet <david.goulet@polymtl.ca>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; only version 2
7 * of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #include <stdlib.h>
20
21 #include <lttng/lttng.h>
22
23 #include "conf.h"
24 #include "lttngerr.h"
25
26 /*
27 * get_session_name
28 *
29 * Return allocated string with the session name found in the config
30 * directory.
31 */
32 char *get_session_name(void)
33 {
34 char *path, *session_name = NULL;
35
36 /* Get path to config file */
37 path = config_get_default_path();
38 if (path == NULL) {
39 goto error;
40 }
41
42 /* Get session name from config */
43 session_name = config_read_session_name(path);
44 if (session_name == NULL) {
45 goto error;
46 }
47
48 error:
49 DBG("Session name found: %s", session_name);
50 return session_name;
51 }
This page took 0.031005 seconds and 4 git commands to generate.