From: Mathieu Desnoyers Date: Thu, 12 Dec 2019 18:07:18 +0000 (-0500) Subject: Fix: consumer: honor "active" flush flag X-Git-Tag: v2.11.1~12 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=68272f3627318e1fa946ae472308a75a0fe7427c;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 c36d6c437..e27161e43 100644 --- a/src/common/consumer/consumer.c +++ b/src/common/consumer/consumer.c @@ -3944,15 +3944,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");