lttng: Capture is only supported by tracepoint and syscall event-rules
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 13 May 2020 20:24:23 +0000 (16:24 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 16 Mar 2021 20:40:01 +0000 (16:40 -0400)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Idfe07be4e12e0531dfdb778cdb4c011780af7a26
Depends-on: lttng-ust: I8423c510bf6af2f9bf85256e8d6f931d36f7054b

include/lttng/condition/condition.h
include/lttng/condition/event-rule.h
src/bin/lttng/commands/add_trigger.c
src/common/conditions/event-rule.c

index 78a206df3180fd929d3c0b4225ac4f1810cf117f..6681cf76fe693e68479dc6037b6c5fcad541a148 100644 (file)
@@ -30,6 +30,7 @@ enum lttng_condition_status {
        LTTNG_CONDITION_STATUS_UNKNOWN = -2,
        LTTNG_CONDITION_STATUS_INVALID = -3,
        LTTNG_CONDITION_STATUS_UNSET = -4,
+       LTTNG_CONDITION_STATUS_UNSUPPORTED = -5,
 };
 
 /*
index 02e7a20e78a5ee99ffa5ab7a86af85bfb1436a9c..170f381609c99495000355cf1e6c87512b255525 100644 (file)
@@ -123,6 +123,9 @@ lttng_evaluation_event_rule_get_captured_values(
  *       * `LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD`
  *       * `LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD`
  *       * `LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT`
+ *
+ * `LTTNG_CONDITION_STATUS_UNSUPPORTED`:
+ *     * The associated event-rule does not support runtime capture.
  */
 extern enum lttng_condition_status
 lttng_condition_event_rule_append_capture_descriptor(
index b3b1dade11174d7b1481c4d599f6658267bead79..feba92f6fb9c33c2ab0600a6698277c9716b3c6e 100644 (file)
@@ -1115,6 +1115,10 @@ struct lttng_condition *handle_condition_event(int *argc, const char ***argv)
                status = lttng_condition_event_rule_append_capture_descriptor(
                                c, *expr);
                if (status != LTTNG_CONDITION_STATUS_OK) {
+                       if (status == LTTNG_CONDITION_STATUS_UNSUPPORTED) {
+                               ERR("The capture feature is unsupported by the event-rule condition type");
+                       }
+
                        goto error;
                }
 
index 3f6b96015de81d9df9b7c4cdef084d26cfff349a..a8fd7c91282a93f12ed4601ec74061dbcdfc8285 100644 (file)
@@ -751,6 +751,7 @@ lttng_condition_event_rule_append_capture_descriptor(
                        container_of(condition,
                                struct lttng_condition_event_rule, parent);
        struct lttng_capture_descriptor *descriptor = NULL;
+       const struct lttng_event_rule *rule = NULL;
 
        /* Only accept l-values. */
        if (!condition || !IS_EVENT_RULE_CONDITION(condition) || !expr ||
@@ -759,6 +760,29 @@ lttng_condition_event_rule_append_capture_descriptor(
                goto end;
        }
 
+       status = lttng_condition_event_rule_get_rule(condition, &rule);
+       if (status != LTTNG_CONDITION_STATUS_OK) {
+               goto end;
+       }
+
+       switch(lttng_event_rule_get_type(rule)) {
+       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_SYSCALL:
+               /* Supported. */
+               status = LTTNG_CONDITION_STATUS_OK;
+               break;
+       case LTTNG_EVENT_RULE_TYPE_UNKNOWN:
+               status = LTTNG_CONDITION_STATUS_INVALID;
+               break;
+       default:
+               status = LTTNG_CONDITION_STATUS_UNSUPPORTED;
+               break;
+       }
+
+       if (status != LTTNG_CONDITION_STATUS_OK) {
+               goto end;
+       }
+
        descriptor = malloc(sizeof(*descriptor));
        if (descriptor == NULL) {
                status = LTTNG_CONDITION_STATUS_ERROR;
This page took 0.037387 seconds and 4 git commands to generate.