Consumer: implement LTTNG_CONSUMER_CLEAR_CHANNEL
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 11 Feb 2019 15:24:35 +0000 (10:24 -0500)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 18 Feb 2019 19:25:02 +0000 (14:25 -0500)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
src/common/consumer/consumer.h
src/common/kernel-consumer/kernel-consumer.c
src/common/sessiond-comm/sessiond-comm.h
src/common/ust-consumer/ust-consumer.c

index 0195e688404f36b3b7c22e71b116068e0a11e2a5..568ba8c6f7fab7cc80cc754c1b671c6f842b5716 100644 (file)
@@ -68,6 +68,7 @@ enum lttng_consumer_command {
        LTTNG_CONSUMER_CHECK_ROTATION_PENDING_LOCAL,
        LTTNG_CONSUMER_CHECK_ROTATION_PENDING_RELAY,
        LTTNG_CONSUMER_MKDIR,
+       LTTNG_CONSUMER_CLEAR_CHANNEL,
 };
 
 /* State of each fd in consumer */
index b2822721bf6001f87a1845a1dea6bb2dcb81dfd4..507a25e12b95bd27cedaa0d297287ee29866c855 100644 (file)
@@ -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;
        }
index f40db1fddcd402d4569a2d596d2820b521ce9312..78b94532d096a2d0adb884b734b595b32660e1f5 100644 (file)
@@ -624,6 +624,9 @@ struct lttcomm_consumer_msg {
                        uint32_t uid;
                        uint32_t gid;
                } LTTNG_PACKED mkdir;
+               struct {
+                       uint64_t key;
+               } LTTNG_PACKED clear_channel;
        } u;
 } LTTNG_PACKED;
 
index 8916daefa1a1b3f93769a46082c2c8cf5b8682f2..4fcdd392b10face24821621bd70f3ff65c057089 100644 (file)
@@ -2109,6 +2109,31 @@ int lttng_ustconsumer_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:
                break;
        }
This page took 0.029474 seconds and 5 git commands to generate.