X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=libustcomm%2Fustcomm.c;h=004cdb001f340e355574c87679f5f82bedf81b41;hb=34fb6da728588e2292361fa29341289165940b14;hp=f2aeb61fc423d2d818e89190fae44312d92f3658;hpb=4e2a88089f60f56b118bbfcbac65f74e79166436;p=lttng-ust.git diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index f2aeb61f..004cdb00 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -49,17 +49,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; } - sleep(1); + /* FIXME: should wait in a better way */ + //sleep(1); + + return 0; } static int send_message_fd(int fd, const char *msg) @@ -112,8 +115,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) { @@ -398,9 +406,6 @@ int ustcomm_send_request(struct ustcomm_connection *conn, char *req, char **repl PERROR("send"); return -1; } - else if(result == 0) { - return 0; - } if(!reply) return 1; @@ -440,8 +445,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) { @@ -520,7 +530,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);