X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=ustd%2Fustd.c;h=b38593b36b0d65cc9f89b2eea565aed612d97c58;hb=c970a26f3e184f41495602b8028f6e163d7b5b9f;hp=21da4ebb8785d620018b75e5736ee27cc2265e18;hpb=e2b815a9b15bf6eb940aaa0b336327a1702c3576;p=ust.git diff --git a/ustd/ustd.c b/ustd/ustd.c index 21da4eb..b38593b 100644 --- a/ustd/ustd.c +++ b/ustd/ustd.c @@ -48,6 +48,7 @@ #define PUT_SUBBUF_OK 1 #define PUT_SUBBUF_DIED 0 #define PUT_SUBBUF_PUSHED 2 +#define PUT_SUBBUF_DONE 3 char *sock_path=NULL; char *trace_path=NULL; @@ -98,6 +99,11 @@ int get_subbuffer(struct buffer_info *buf) retval = GET_SUBBUF_DONE; goto end_rep; } + else if(!strcmp(received_msg, "NOTFOUND")) { + WARN("For buffer %s, the trace was not found. This likely means it was destroyed by the user.", buf->name); + retval = GET_SUBBUF_DONE; + goto end_rep; + } else { DBG("error getting subbuffer %s", buf->name); retval = -1; @@ -130,11 +136,18 @@ int put_subbuffer(struct buffer_info *buf) retval = PUT_SUBBUF_DIED; goto end; } - if(result < 0) { + else if(result < 0) { ERR("put_subbuffer: send_message failed"); retval = -1; goto end; } + else if(result == 0) { + /* Program seems finished. However this might not be + * the last subbuffer that has to be collected. + */ + retval = PUT_SUBBUF_DIED; + goto end; + } result = sscanf(received_msg, "%as", &rep_code); if(result != 1) { @@ -420,6 +433,15 @@ int consumer_loop(struct buffer_info *buf) finish_consuming_dead_subbuffer(buf); break; } + else if(result == PUT_SUBBUF_DONE) { + /* Done with this subbuffer */ + /* FIXME: add a case where this branch is used? Upon + * normal trace termination, at put_subbuf time, a + * special last-subbuffer code could be returned by + * the listener. + */ + break; + } else if(result == PUT_SUBBUF_OK) { } }