X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=libust%2Ftracectl.c;h=848b272f77c5167de00828e88b67652472ada7f7;hb=1518fa0fad67101416c2def6b1c88ec767e8b5eb;hp=af0149a5cb82a9d41c59c253ff6343a5d7f2d028;hpb=73850001f047388d242925d14d2493cfa11916fb;p=ust.git diff --git a/libust/tracectl.c b/libust/tracectl.c index af0149a..848b272 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -357,10 +357,7 @@ static int do_cmd_get_shmid(const char *recvbuf, struct ustcomm_source *src) } } - if(found) { - buffers_to_export--; - } - else { + if(!found) { ERR("channel not found (%s)", channel_and_cpu); } @@ -695,6 +692,14 @@ static int do_cmd_get_subbuffer(const char *recvbuf, struct ustcomm_source *src) list_add(&bc->list, &blocked_consumers); + /* Being here is the proof the daemon has mapped the buffer in its + * memory. We may now decrement buffers_to_export. + */ + if(atomic_long_read(&buf->consumed) == 0) { + DBG("decrementing buffers_to_export"); + buffers_to_export--; + } + break; } } @@ -1473,9 +1478,12 @@ static void ust_fork(void) list_del(&bc->list); } + ustcomm_free_app(&ustcomm_app); + + buffers_to_export = 0; have_listener = 0; - create_listener(); init_socket(); + create_listener(); ltt_trace_setup("auto"); result = ltt_trace_set_type("auto", "ustrelay"); if(result < 0) {