X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=libust%2Ftracectl.c;h=848b272f77c5167de00828e88b67652472ada7f7;hb=9692fa182535c55f0a03f79f26211aed9906da82;hp=c34a3ce4ad3f673393ef3df9da5f89baa965d7e8;hpb=9fb49d0eb803eec381fcdc340fff3c7fe9c33742;p=ust.git diff --git a/libust/tracectl.c b/libust/tracectl.c index c34a3ce..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,6 +1478,9 @@ static void ust_fork(void) list_del(&bc->list); } + ustcomm_free_app(&ustcomm_app); + + buffers_to_export = 0; have_listener = 0; init_socket(); create_listener();