X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=libust%2Ftracectl.c;h=916b3548eee3de1f953713159c44794431c9874f;hb=d5adede06d9dc0c4675c4c4052eb98f74973f4a5;hp=c72d013d7535a5539960e4d111ad24b39bcc6e54;hpb=31d392f1a565abd0751302d8c52b9f9e695e051e;p=lttng-ust.git diff --git a/libust/tracectl.c b/libust/tracectl.c index c72d013d..916b3548 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; } } @@ -1455,6 +1460,10 @@ static void ust_fork(void) /* FIXME: technically, the locks could have been taken before the fork */ DBG("ust: forking"); + + /* break lock if necessary */ + ltt_unlock_traces(); + ltt_trace_stop("auto"); ltt_trace_destroy("auto", 1); /* Delete all active connections */ @@ -1470,8 +1479,8 @@ static void ust_fork(void) } have_listener = 0; - create_listener(); init_socket(); + create_listener(); ltt_trace_setup("auto"); result = ltt_trace_set_type("auto", "ustrelay"); if(result < 0) {