X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=libustcomm%2Fustcomm.c;h=225d1990be042a18cf0cde7c297e92c61b48c386;hb=c39c72ee5890c7727ae2697f321ba1b3d6c862f5;hp=d6e5346d26e468a73addc6b6fc8eca369d6e58b3;hpb=8cefc1450e2d929de5d2878518e7b8b2b77ff755;p=ust.git diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index d6e5346..225d199 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -1,3 +1,20 @@ +/* Copyright (C) 2009 Pierre-Marc Fournier + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + #define _GNU_SOURCE #include #include @@ -49,18 +66,20 @@ char *strdup_malloc(const char *s) return retval; } -static void signal_process(pid_t pid) +static int signal_process(pid_t pid) { int result; result = kill(pid, UST_SIGNAL); if(result == -1) { PERROR("kill"); - return; + return -1; } /* FIXME: should wait in a better way */ - sleep(1); + //sleep(1); + + return 0; } static int send_message_fd(int fd, const char *msg) @@ -113,8 +132,13 @@ static int send_message_path(const char *path, const char *msg, int signalpid) return -1; } - if(signalpid >= 0) - signal_process(signalpid); + if(signalpid >= 0) { + result = signal_process(signalpid); + if(result == -1) { + ERR("could not signal process"); + return -1; + } + } result = connect(fd, (struct sockaddr *)&addr, sizeof(addr)); if(result == -1) { @@ -438,8 +462,13 @@ int ustcomm_connect_path(char *path, struct ustcomm_connection *conn, pid_t sign return -1; } - if(signalpid >= 0) - signal_process(signalpid); + if(signalpid >= 0) { + result = signal_process(signalpid); + if(result == -1) { + ERR("could not signal process"); + return -1; + } + } result = connect(fd, (struct sockaddr *)&addr, sizeof(addr)); if(result == -1) { @@ -518,7 +547,7 @@ int ustcomm_init_ustd(struct ustcomm_ustd *handle) handle->server.listen_fd = init_named_socket(name, &handle->server.socketpath); if(handle->server.listen_fd < 0) { - ERR("error initializing named socket"); + ERR("error initializing named socket at %s", name); goto free_name; } free(name);