Fix: event-rule: report log level rules as unsupported for kernel domain
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Mar 2021 23:11:32 +0000 (19:11 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 19 Mar 2021 17:38:22 +0000 (13:38 -0400)
Log levels are not supported for by tracepoints for the kernel domain.
Return `LTTNG_EVENT_RULE_STATUS_UNSUPPORTED` when setting a log level
rule on a kernel-domain tracepoint.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I73b6067ec0a11ae1f83098a6966dc956e1772224

src/common/event-rule/tracepoint.c

index fbe1fc4bc8e1e7e62fc5534f40d18a47b5e1f61a..62a53f9783de0626a150e13a9529120fa6fa02fe 100644 (file)
@@ -1117,6 +1117,27 @@ end:
        return valid;
 }
 
+static bool domain_supports_log_levels(enum lttng_domain_type domain)
+{
+       bool supported;
+
+       switch (domain) {
+       case LTTNG_DOMAIN_KERNEL:
+               supported = false;
+               break;
+       case LTTNG_DOMAIN_UST:
+       case LTTNG_DOMAIN_JUL:
+       case LTTNG_DOMAIN_LOG4J:
+       case LTTNG_DOMAIN_PYTHON:
+               supported = true;
+               break;
+       default:
+               abort();
+       }
+
+       return supported;
+}
+
 enum lttng_event_rule_status lttng_event_rule_tracepoint_set_log_level_rule(
                struct lttng_event_rule *rule,
                const struct lttng_log_level_rule *log_level_rule)
@@ -1133,6 +1154,11 @@ enum lttng_event_rule_status lttng_event_rule_tracepoint_set_log_level_rule(
        tracepoint = container_of(
                        rule, struct lttng_event_rule_tracepoint, parent);
 
+       if (!domain_supports_log_levels(tracepoint->domain)) {
+               status = LTTNG_EVENT_RULE_STATUS_UNSUPPORTED;
+               goto end;
+       }
+
        if (!log_level_rule_valid(log_level_rule, tracepoint->domain)) {
                status = LTTNG_EVENT_RULE_STATUS_INVALID;
                goto end;
This page took 0.026756 seconds and 4 git commands to generate.