X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=liblttsessiondcomm%2Fliblttsessiondcomm.c;h=0e9c290fed0ca96453a8cbee96f00efd0e8c5203;hp=6bc853268d9958162a7c1bea4d4ba7771f4c28d7;hb=ca95a21633510288dbb18a3cd8825195e5cbb4f3;hpb=fac6795d6e2c60e79bdc7dab42da94d2025a57d3 diff --git a/liblttsessiondcomm/liblttsessiondcomm.c b/liblttsessiondcomm/liblttsessiondcomm.c index 6bc853268..0e9c290fe 100644 --- a/liblttsessiondcomm/liblttsessiondcomm.c +++ b/liblttsessiondcomm/liblttsessiondcomm.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2011 - David Goulet +/* + * Copyright (C) 2011 - David Goulet * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -13,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * */ #define _GNU_SOURCE @@ -38,6 +38,9 @@ static const char *lttcomm_readable_code[] = { [ LTTCOMM_ERR_INDEX(LTTCOMM_UND) ] = "Undefined command", [ LTTCOMM_ERR_INDEX(LTTCOMM_NO_SESSION) ] = "No session found", [ LTTCOMM_ERR_INDEX(LTTCOMM_LIST_FAIL) ] = "Unable to list traceable apps", + [ LTTCOMM_ERR_INDEX(LTTCOMM_NO_APPS) ] = "No traceable apps found", + [ LTTCOMM_ERR_INDEX(LTTCOMM_NO_SESS) ] = "No session found", + [ LTTCOMM_ERR_INDEX(LTTCOMM_FATAL) ] = "Fatal error of the session daemon", }; /* @@ -67,27 +70,27 @@ const char *lttcomm_get_readable_code(enum lttcomm_return_code code) */ int lttcomm_connect_unix_sock(const char *pathname) { - struct sockaddr_un sun; - int fd; + struct sockaddr_un sun; + int fd; int ret = 1; - fd = socket(PF_UNIX, SOCK_STREAM, 0); + fd = socket(PF_UNIX, SOCK_STREAM, 0); if (fd < 0) { perror("socket"); goto error; } - memset(&sun, 0, sizeof(sun)); - sun.sun_family = AF_UNIX; - strncpy(sun.sun_path, pathname, sizeof(sun.sun_path)); + memset(&sun, 0, sizeof(sun)); + sun.sun_family = AF_UNIX; + strncpy(sun.sun_path, pathname, sizeof(sun.sun_path)); - ret = connect(fd, (struct sockaddr *) &sun, sizeof(sun)); - if (ret < 0) { - perror("connect"); + ret = connect(fd, (struct sockaddr *) &sun, sizeof(sun)); + if (ret < 0) { + perror("connect"); goto error; - } + } - return fd; + return fd; error: return -1;