X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=libustcomm%2Fustcomm.c;h=e8199b3aaf5c6b70eadb2bd2fb01083684ae9c36;hb=772030fed323e388da467735cf4b5e8781acb710;hp=004cdb001f340e355574c87679f5f82bedf81b41;hpb=52c51a47e4b002d741c89de8dc786da59e894a1a;p=ust.git diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index 004cdb0..e8199b3 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 @@ -16,8 +33,6 @@ #include "localerr.h" #define UNIX_PATH_MAX 108 -#define SOCK_DIR "/tmp/socks" -#define UST_SIGNAL SIGIO #define MSG_MAX 1000 @@ -65,6 +80,10 @@ static int signal_process(pid_t pid) return 0; } +int pid_is_online(pid_t pid) { + return kill(pid, UST_SIGNAL) != -1; +} + static int send_message_fd(int fd, const char *msg) { int result; @@ -255,7 +274,8 @@ int ustcomm_recv_message(struct ustcomm_server *server, char **msg, struct ustco idx++; } - result = poll(fds, n_fds, timeout); + while((result = poll(fds, n_fds, timeout)) == -1 && errno == EINTR) + /* nothing */; if(result == -1) { PERROR("poll"); return -1; @@ -397,7 +417,7 @@ static int init_named_socket(char *name, char **path_out) return -1; } -int ustcomm_send_request(struct ustcomm_connection *conn, char *req, char **reply) +int ustcomm_send_request(struct ustcomm_connection *conn, const char *req, char **reply) { int result;