Consumer: implement LTTNG_CONSUMER_CLEAR_CHANNEL
[lttng-tools.git] / src / common / kernel-consumer / kernel-consumer.c
index b890416cac1d96db4fe481c27f9f395e4a14707d..507a25e12b95bd27cedaa0d297287ee29866c855 100644 (file)
@@ -1093,7 +1093,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                        /*
                         * Sample the rotate position of all the streams in this channel.
                         */
-                       ret = lttng_consumer_rotate_channel(channel, key,
+                       ret = lttng_consumer_rotate_sample_channel(channel, key,
                                        msg.u.rotate_channel.pathname,
                                        msg.u.rotate_channel.relayd_id,
                                        msg.u.rotate_channel.metadata,
@@ -1174,7 +1174,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                if (pending < 0) {
                        /*
-                        * An error occured while running the command;
+                        * An error occurred while running the command;
                         * don't send the 'pending' flag as the sessiond
                         * will not read it.
                         */
@@ -1218,7 +1218,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                if (pending < 0) {
                        /*
-                        * An error occured while running the command;
+                        * An error occurred while running the command;
                         * don't send the 'pending' flag as the sessiond
                         * will not read it.
                         */
@@ -1257,6 +1257,31 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                }
                break;
        }
+       case LTTNG_CONSUMER_CLEAR_CHANNEL:
+       {
+               struct lttng_consumer_channel *channel;
+               uint64_t key = msg.u.clear_channel.key;
+
+               channel = consumer_find_channel(key);
+               if (!channel) {
+                       DBG("Channel %" PRIu64 " not found", key);
+                       ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
+               } else {
+                       ret = lttng_consumer_clear_channel(channel);
+                       if (ret) {
+                               ERR("Clear channel failed");
+                               ret_code = ret;
+                       }
+
+                       health_code_update();
+               }
+               ret = consumer_send_status_msg(sock, ret_code);
+               if (ret < 0) {
+                       /* Somehow, the session daemon is not responding anymore. */
+                       goto end_nosignal;
+               }
+               break;
+       }
        default:
                goto end_nosignal;
        }
This page took 0.025509 seconds and 5 git commands to generate.