From 51a4828f21385847870ec2b2499e2f3e3842c26e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 12 Dec 2019 11:31:34 -0500 Subject: [PATCH] sessiond: implement consumer clear channel MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Mathieu Desnoyers Change-Id: I1c17a34c23e4c03f94acb99fb822c3bc42faccf5 Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/consumer.c | 28 ++++++++++++++++++++++++++++ src/bin/lttng-sessiond/consumer.h | 3 +++ 2 files changed, 31 insertions(+) diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 2e3127924..e745702f8 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -1727,6 +1727,34 @@ error: return ret; } +int consumer_clear_channel(struct consumer_socket *socket, uint64_t key) +{ + int ret; + struct lttcomm_consumer_msg msg; + + assert(socket); + + DBG("Consumer clear channel %" PRIu64, key); + + memset(&msg, 0, sizeof(msg)); + msg.cmd_type = LTTNG_CONSUMER_CLEAR_CHANNEL; + msg.u.clear_channel.key = key; + + health_code_update(); + + pthread_mutex_lock(socket->lock); + ret = consumer_send_msg(socket, &msg); + if (ret < 0) { + goto error_socket; + } + +error_socket: + pthread_mutex_unlock(socket->lock); + + health_code_update(); + return ret; +} + int consumer_init(struct consumer_socket *socket, const lttng_uuid sessiond_uuid) { diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index 8ebbe00e2..1844a1c69 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -332,4 +332,7 @@ int consumer_trace_chunk_exists(struct consumer_socket *socket, char *setup_channel_trace_path(struct consumer_output *consumer, const char *session_path, size_t *consumer_path_offset); +/* Clear command */ +int consumer_clear_channel(struct consumer_socket *socket, uint64_t key); + #endif /* _CONSUMER_H */ -- 2.34.1