07f29adedcebc0570c81bc153fe07769991b4e69
[lttng-tools.git] / src / bin / lttng-sessiond / utils.c
1 /*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, version 2 only,
7 * as published by the Free Software Foundation.
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 #define _GNU_SOURCE
20 #include <stdlib.h>
21 #include <unistd.h>
22
23 #include <common/error.h>
24
25 #include "utils.h"
26
27 /*
28 * Write to writable pipe used to notify a thread.
29 */
30 int notify_thread_pipe(int wpipe)
31 {
32 int ret;
33
34 ret = write(wpipe, "!", 1);
35 if (ret < 0) {
36 PERROR("write poll pipe");
37 }
38
39 return ret;
40 }
41
42 /*
43 * Return pointer to home directory path using the env variable HOME.
44 *
45 * No home, NULL is returned.
46 */
47 const char *get_home_dir(void)
48 {
49 return ((const char *) getenv("HOME"));
50 }
This page took 0.028837 seconds and 3 git commands to generate.