From: Pierre-Marc Fournier Date: Tue, 17 Mar 2009 18:10:38 +0000 (-0400) Subject: ustd: convert to new ustcomm api X-Git-Tag: v1.9.1~1034 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3bb568630e172fd8d2a05f85b6f44218c18ce139;p=lttng-ust.git ustd: convert to new ustcomm api --- diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index f2aeb61f..5468ad4f 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -59,6 +59,7 @@ static void signal_process(pid_t pid) return; } + /* FIXME: should wait in a better way */ sleep(1); } diff --git a/libustcomm/ustcomm.h b/libustcomm/ustcomm.h index 7d22694c..052c896a 100644 --- a/libustcomm/ustcomm.h +++ b/libustcomm/ustcomm.h @@ -36,7 +36,7 @@ struct ustcomm_source { char *strdup_malloc(const char *s); -int send_message_pid(pid_t pid, const char *msg, char **reply); +//int send_message_pid(pid_t pid, const char *msg, char **reply); int ustcomm_ustd_recv_message(struct ustcomm_ustd *ustd, char **msg, struct ustcomm_source *src, int timeout); int ustcomm_app_recv_message(struct ustcomm_app *app, char **msg, struct ustcomm_source *src, int timeout); @@ -45,6 +45,9 @@ int ustcomm_init_app(pid_t pid, struct ustcomm_app *handle); int ustcomm_init_ustd(struct ustcomm_ustd *handle); +int ustcomm_connect_app(pid_t pid, struct ustcomm_connection *conn); +int ustcomm_send_request(struct ustcomm_connection *conn, char *req, char **reply); + int nth_token_is(char *str, char *token, int tok_no); char *nth_token(char *str, int tok_no); diff --git a/ustd/ustd.c b/ustd/ustd.c index b66f1ced..d5884dfe 100644 --- a/ustd/ustd.c +++ b/ustd/ustd.c @@ -65,9 +65,9 @@ int get_subbuffer(struct buffer_info *buf) int result; asprintf(&send_msg, "get_subbuffer %s", buf->name); - result = send_message(buf->pid, send_msg, &received_msg); + result = ustcomm_send_request(&buf->conn, send_msg, &received_msg); if(result < 0) { - ERR("get_subbuffer: send_message failed"); + ERR("get_subbuffer: ustcomm_send_request failed"); return -1; } free(send_msg); @@ -107,7 +107,7 @@ int put_subbuffer(struct buffer_info *buf) int result; asprintf(&send_msg, "put_subbuffer %s %ld", buf->name, buf->consumed_old); - result = send_message(buf->pid, send_msg, &received_msg); + result = ustcomm_send_request(&buf->conn, send_msg, &received_msg); if(result < 0) { ERR("put_subbuffer: send_message failed"); return -1;