From: Jérémie Galarneau Date: Thu, 18 Mar 2021 23:11:32 +0000 (-0400) Subject: Fix: event-rule: report log level rules as unsupported for kernel domain X-Git-Tag: v2.13.0-rc1~203 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2222db742ae4bde755b2327e46a99dd0bfaed411;p=lttng-tools.git Fix: event-rule: report log level rules as unsupported for kernel domain 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 Change-Id: I73b6067ec0a11ae1f83098a6966dc956e1772224 --- diff --git a/src/common/event-rule/tracepoint.c b/src/common/event-rule/tracepoint.c index fbe1fc4bc..62a53f978 100644 --- a/src/common/event-rule/tracepoint.c +++ b/src/common/event-rule/tracepoint.c @@ -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;