Sessiond: Implement cmd_clear_session
[lttng-tools.git] / src / bin / lttng-sessiond / consumer.c
index 5cbd42f6301d327abefdb159541dc7f651983e9d..382815e6b3665ecb76cde7ce1edf5fbc37c4fe3f 100644 (file)
@@ -1573,3 +1573,38 @@ end:
        rcu_read_unlock();
        return ret;
 }
+
+int consumer_clear_channel(struct consumer_socket *socket, uint64_t key,
+               struct consumer_output *output)
+{
+       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;
+
+       if (output->type == CONSUMER_DST_NET) {
+               ERR("Relayd clear is not supported for now");
+               ret = -LTTNG_ERR_INVALID;
+               goto error;
+       }
+       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);
+
+error:
+       health_code_update();
+       return ret;
+}
This page took 0.024415 seconds and 5 git commands to generate.