From: Mathieu Desnoyers Date: Thu, 12 Dec 2019 18:07:18 +0000 (-0500) Subject: Fix: consumer: honor "active" flush flag X-Git-Tag: v2.12.0-rc1~159 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5416a504a1ff9f2444e594084836dc8b59739526;p=lttng-tools.git Fix: consumer: honor "active" flush flag Honor "active" flush flag in both kernel and ust consumers. A flush "active" does a flush which will not generate empty packets (no event), whereas an "inactive" flush will generate empty packets if flushing a current packet which has no event. Signed-off-by: Mathieu Desnoyers Change-Id: Icc9772ba3ae18e96f24354ac6eb9223f343c3458 Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c index d81d0fc7a..5a39a0cc7 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -3940,15 +3940,23 @@ int consumer_flush_buffer(struct lttng_consumer_stream *stream, int producer_act switch (consumer_data.type) { case LTTNG_CONSUMER_KERNEL: - ret = kernctl_buffer_flush(stream->wait_fd); - if (ret < 0) { - ERR("Failed to flush kernel stream"); - goto end; + if (producer_active) { + ret = kernctl_buffer_flush(stream->wait_fd); + if (ret < 0) { + ERR("Failed to flush kernel stream"); + goto end; + } + } else { + ret = kernctl_buffer_flush_empty(stream->wait_fd); + if (ret < 0) { + ERR("Failed to flush kernel stream"); + goto end; + } } break; case LTTNG_CONSUMER32_UST: case LTTNG_CONSUMER64_UST: - lttng_ustctl_flush_buffer(stream, producer_active); + lttng_ustconsumer_flush_buffer(stream, producer_active); break; default: ERR("Unknown consumer_data type");