X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=libust%2Fbuffers.c;h=801a878cce5dd4c863ed6866fa4c2cbd3a90a0e5;hb=b9318b35947bbd6d3b2998b28d974c5e5bfabcf6;hp=ac34e5fa5f3102de5fc93dd7c1833d586c578b6a;hpb=518d7abb8e3720433c611499f704c3bd9d554102;p=ust.git diff --git a/libust/buffers.c b/libust/buffers.c index ac34e5f..801a878 100644 --- a/libust/buffers.c +++ b/libust/buffers.c @@ -242,14 +242,14 @@ int ust_buffers_channel_open(struct ust_channel *chan, size_t subbuf_size, size_ kref_init(&chan->kref); - mutex_lock(&ust_buffers_channels_mutex); + pthread_mutex_lock(&ust_buffers_channels_mutex); for(i=0; in_cpus; i++) { result = ust_buffers_open_buf(chan, i); if (result == -1) goto error; } list_add(&chan->list, &ust_buffers_channels); - mutex_unlock(&ust_buffers_channels_mutex); + pthread_mutex_unlock(&ust_buffers_channels_mutex); return 0; @@ -262,7 +262,7 @@ error: } kref_put(&chan->kref, ust_buffers_destroy_channel); - mutex_unlock(&ust_buffers_channels_mutex); + pthread_mutex_unlock(&ust_buffers_channels_mutex); return -1; } @@ -272,7 +272,7 @@ void ust_buffers_channel_close(struct ust_channel *chan) if(!chan) return; - mutex_lock(&ust_buffers_channels_mutex); + pthread_mutex_lock(&ust_buffers_channels_mutex); for(i=0; in_cpus; i++) { /* FIXME: if we make it here, then all buffers were necessarily allocated. Moreover, we don't * initialize to NULL so we cannot use this check. Should we? */ @@ -282,7 +282,7 @@ void ust_buffers_channel_close(struct ust_channel *chan) list_del(&chan->list); kref_put(&chan->kref, ust_buffers_destroy_channel); - mutex_unlock(&ust_buffers_channels_mutex); + pthread_mutex_unlock(&ust_buffers_channels_mutex); } /* @@ -771,26 +771,6 @@ error: return -1; } -/* - * LTTng channel flush function. - * - * Must be called when no tracing is active in the channel, because of - * accesses across CPUs. - */ -static notrace void ltt_relay_buffer_flush(struct ust_buffer *buf) -{ - int result; - -//ust// buf->finalized = 1; - ltt_force_switch(buf, FORCE_FLUSH); - - result = write(buf->data_ready_fd_write, "1", 1); - if(result == -1) { - PERROR("write (in ltt_relay_buffer_flush)"); - ERR("this should never happen!"); - } -} - static void ltt_relay_async_wakeup_chan(struct ust_channel *ltt_channel) { //ust// unsigned int i; @@ -813,7 +793,7 @@ static void ltt_relay_finish_buffer(struct ust_channel *channel, unsigned int cp if (channel->buf[cpu]) { struct ust_buffer *buf = channel->buf[cpu]; - ltt_relay_buffer_flush(buf); + ltt_force_switch(buf, FORCE_FLUSH); //ust// ltt_relay_wake_writers(ltt_buf); /* closing the pipe tells the consumer the buffer is finished */