Remove lttng_event_rule_tracepoint
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 12 May 2021 07:20:51 +0000 (03:20 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 3 Jun 2021 20:06:02 +0000 (16:06 -0400)
lttng_event_rule_tracepoint is "exploded" in:
   lttng_event_rule_user_tracepoint
   lttng_event_rule_kernel_tracepoint
   lttng_event_rule_jul_logging
   lttng_event_rule_python_logging
   lttng_event_rule_log4j_logging

On the CLI front, the `--domain` option for the add-trigger is removed
since for each event rule type the domain is implicit based on the type.

`--type` accepts the following:
   kernel
   kernel:tracepoint
   kernel:kprobe
   kernel:uprobe
   syscall
     syscall:entry
     syscall:exit
     syscall:entry+exit
     syscall:*
   kernel:syscall
     kernel:syscall:entry
     kernel:syscall:exit
     kernel:syscall:entry+exit
     kernel:syscall:*
   user
   user:tracepoint
   python
   python:logging
   jul
   jul:logging
   log4j
   log4j:logging
   kprobe
   function

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I4a0489f8f2a79a2c967f5d69461bed10f40b8278

25 files changed:
include/Makefile.am
include/lttng/event-rule/event-rule.h
include/lttng/event-rule/tracepoint-internal.h [deleted file]
include/lttng/event-rule/tracepoint.h [deleted file]
include/lttng/lttng.h
src/bin/lttng-sessiond/agent.c
src/bin/lttng-sessiond/event.c
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng/commands/add_trigger.c
src/bin/lttng/commands/list_triggers.c
src/common/Makefile.am
src/common/conditions/event-rule-matches.c
src/common/event-rule/event-rule.c
src/common/event-rule/tracepoint.c [deleted file]
tests/regression/tools/notification/notification.c
tests/regression/tools/notification/test_notification_notifier_discarded_count
tests/regression/tools/trigger/rate-policy/test_ust_rate_policy
tests/regression/tools/trigger/start-stop/test_start_stop
tests/regression/tools/trigger/test_add_trigger_cli
tests/regression/tools/trigger/test_list_triggers_cli
tests/regression/tools/trigger/test_remove_trigger_cli
tests/regression/ust/python-logging/test_python_logging.in
tests/unit/test_condition.c
tests/unit/test_event_rule.c

index ca539766fa4724d7f959fb77add1fcb904e60f11..12c5f883c396caefccda7d936148e53827865c20 100644 (file)
@@ -155,7 +155,6 @@ lttngeventruleinclude_HEADERS= \
        lttng/event-rule/jul-logging.h \
        lttng/event-rule/kernel-kprobe.h \
        lttng/event-rule/kernel-syscall.h \
-       lttng/event-rule/tracepoint.h \
        lttng/event-rule/kernel-tracepoint.h \
        lttng/event-rule/kernel-uprobe.h \
        lttng/event-rule/log4j-logging.h \
@@ -189,7 +188,6 @@ noinst_HEADERS = \
        lttng/event-rule/jul-logging-internal.h \
        lttng/event-rule/kernel-kprobe-internal.h \
        lttng/event-rule/kernel-syscall-internal.h \
-       lttng/event-rule/tracepoint-internal.h \
        lttng/event-rule/kernel-tracepoint-internal.h \
        lttng/event-rule/kernel-uprobe-internal.h \
        lttng/event-rule/log4j-logging-internal.h \
index c1a49b705593b339e0eae1c6239e7d34a940da7e..0aac04c848970a885c6e311e36d40207e153314d 100644 (file)
@@ -16,16 +16,15 @@ struct lttng_event_rule;
 
 enum lttng_event_rule_type {
        LTTNG_EVENT_RULE_TYPE_UNKNOWN = -1,
-       LTTNG_EVENT_RULE_TYPE_TRACEPOINT = 0,
-       LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL = 1,
-       LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE = 2,
-       LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION = 3,
-       LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT = 4,
-       LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE = 5,
-       LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT = 6,
-       LTTNG_EVENT_RULE_TYPE_JUL_LOGGING = 7,
-       LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING = 8,
-       LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING = 9,
+       LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL = 0,
+       LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE = 1,
+       LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION = 2,
+       LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT = 3,
+       LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE = 4,
+       LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT = 5,
+       LTTNG_EVENT_RULE_TYPE_JUL_LOGGING = 6,
+       LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING = 7,
+       LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING = 8,
 };
 
 enum lttng_event_rule_status {
diff --git a/include/lttng/event-rule/tracepoint-internal.h b/include/lttng/event-rule/tracepoint-internal.h
deleted file mode 100644 (file)
index 6c4d438..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- */
-
-#ifndef LTTNG_EVENT_RULE_TRACEPOINT_INTERNAL_H
-#define LTTNG_EVENT_RULE_TRACEPOINT_INTERNAL_H
-
-#include <common/payload-view.h>
-#include <common/macros.h>
-#include <common/optional.h>
-#include <lttng/domain.h>
-#include <lttng/event-rule/event-rule-internal.h>
-#include <lttng/event-rule/tracepoint.h>
-#include <lttng/event.h>
-#include <lttng/log-level-rule-internal.h>
-
-struct lttng_event_rule_tracepoint {
-       struct lttng_event_rule parent;
-
-       /* Domain. */
-       enum lttng_domain_type domain;
-
-       /* Name pattern. */
-       char *pattern;
-
-       /* Filter. */
-       char *filter_expression;
-
-       /* Log level. */
-       struct lttng_log_level_rule *log_level_rule;
-
-       /* Exclusions. */
-       struct lttng_dynamic_pointer_array exclusions;
-
-       /* internal use only. */
-       struct {
-               char *filter;
-               struct lttng_bytecode *bytecode;
-       } internal_filter;
-};
-
-struct lttng_event_rule_tracepoint_comm {
-       /* enum lttng_domain_type. */
-       int8_t domain_type;
-       /* Includes terminator `\0`. */
-       uint32_t pattern_len;
-       /* Includes terminator `\0`. */
-       uint32_t filter_expression_len;
-       /*  enum lttng_log_level_rule_comm + payload if any */
-       uint32_t log_level_rule_len;
-       uint32_t exclusions_count;
-       uint32_t exclusions_len;
-       /*
-        * Payload is composed of, in that order:
-        *   - pattern (null terminated),
-        *   - filter expression (null terminated),
-        *   - log level rule serialized object,
-        *   - exclusions (32 bit length + null terminated string).
-        */
-       char payload[];
-} LTTNG_PACKED;
-
-LTTNG_HIDDEN
-ssize_t lttng_event_rule_tracepoint_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **rule);
-
-#endif /* LTTNG_EVENT_RULE_TRACEPOINT_INTERNAL_H */
diff --git a/include/lttng/event-rule/tracepoint.h b/include/lttng/event-rule/tracepoint.h
deleted file mode 100644 (file)
index f6e8d81..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- */
-
-#ifndef LTTNG_EVENT_RULE_TRACEPOINT_H
-#define LTTNG_EVENT_RULE_TRACEPOINT_H
-
-#include <lttng/domain.h>
-#include <lttng/event-rule/event-rule.h>
-#include <lttng/log-level-rule.h>
-#include <lttng/event.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Create a newly allocated tracepoint event rule.
- *
- * The default pattern is '*'.
- *
- * Returns a new event rule on success, NULL on failure. This event rule must be
- * destroyed using lttng_event_rule_destroy().
- */
-extern struct lttng_event_rule *lttng_event_rule_tracepoint_create(
-               enum lttng_domain_type domain);
-
-/*
- * Set the name pattern of a tracepoint event rule.
- *
- * Pattern can contain wildcard '*'. See man lttng-enable-event.
- *
- * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
- * if invalid parameters are passed.
- */
-extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_name_pattern(
-               struct lttng_event_rule *rule, const char *pattern);
-
-/*
- * Get the name pattern of a tracepoint event rule.
- *
- * The caller does not assume the ownership of the returned pattern. The
- * pattern shall only only be used for the duration of the event rule's
- * lifetime, or before a different pattern is set.
- *
- * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's pattern
- * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
- * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern
- * was not set prior to this call.
- */
-extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_name_pattern(
-               const struct lttng_event_rule *rule, const char **pattern);
-
-/*
- * Get the domain type of a tracepoint event rule.
- *
- * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the domain type output parameter
- * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
- * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a pattern was not set prior to
- * this call.
- */
-extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_domain_type(
-               const struct lttng_event_rule *rule,
-               enum lttng_domain_type *type);
-
-/*
- * Set the filter expression of a tracepoint event rule.
- *
- * The expression is copied internally.
- *
- * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
- * if invalid parameters are passed.
- */
-extern enum lttng_event_rule_status lttng_event_rule_tracepoint_set_filter(
-               struct lttng_event_rule *rule, const char *expression);
-
-/*
- * Get the filter expression of a tracepoint event rule.
- *
- * The caller does not assume the ownership of the returned filter expression.
- * The filter expression shall only only be used for the duration of the event
- * rule's lifetime, or before a different filter expression is set.
- *
- * Returns LTTNG_EVENT_RULE_STATUS_OK and a pointer to the event rule's filter
- * expression on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid
- * parameter is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a filter expression
- * was not set prior to this call.
- */
-extern enum lttng_event_rule_status lttng_event_rule_tracepoint_get_filter(
-               const struct lttng_event_rule *rule, const char **expression);
-
-/*
- * Set the log level rule of a tracepoint event rule.
- *
- * The log level rule is copied internally.
- *
- * Return LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID
- * if invalid parameters are passed.
- */
-extern 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);
-
-/*
- * Get the log level rule of a tracepoint event rule.
- *
- * The caller does not assume the ownership of the returned log level rule. The
- * log level rule shall only only be used for the duration of the event rule's
- * lifetime, or before a different log level rule is set.
- *
- * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the log level rule output
- * parameter on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter
- * is passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a log level rule was not set prior
- * to this call.
- */
-extern enum lttng_event_rule_status
-lttng_event_rule_tracepoint_get_log_level_rule(
-               const struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule **log_level_rule);
-
-/*
- * Add a name pattern exclusion to the set of name pattern exclusion of an event rule.
- *
- * The passed exclusion will be copied to the event_rule.
- *
- * Returns LTTNG_EVENT_RULE_STATUS_OK on success,
- * LTTNG_EVENT_RULE_STATUS_INVALID if invalid parameters are passed, or
- * LTTNG_EVENT_RULE_STATUS_UNSUPPORTED if this property is not supported by the
- * domain.
- */
-extern enum lttng_event_rule_status lttng_event_rule_tracepoint_add_name_pattern_exclusion(
-               struct lttng_event_rule *rule,
-               const char *exclusion);
-
-/*
- * Get the name pattern exclusions property count of an event rule.
- *
- * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the count output parameter
- * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
- * passed.
- */
-extern enum lttng_event_rule_status
-lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(
-               const struct lttng_event_rule *rule, unsigned int *count);
-
-/*
- * Get the pattern name exclusion at the given index.
- *
- * Returns LTTNG_EVENT_RULE_STATUS_OK and sets the exclusion output parameter
- * on success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is
- * passed.
- */
-extern enum lttng_event_rule_status
-lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(
-               const struct lttng_event_rule *rule,
-               unsigned int index,
-               const char **exclusion);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* LTTNG_EVENT_RULE_TRACEPOINT_H */
index 1a11b3a514ed62bf0769ff8c7936095693a9b4af..5f3df911369f4b4c736bb4cd1528ca493a135c69 100644 (file)
@@ -47,7 +47,6 @@
 #include <lttng/event-rule/kernel-kprobe.h>
 #include <lttng/event-rule/kernel-syscall.h>
 #include <lttng/event-rule/python-logging.h>
-#include <lttng/event-rule/tracepoint.h>
 #include <lttng/event-rule/kernel-tracepoint.h>
 #include <lttng/event-rule/kernel-uprobe.h>
 #include <lttng/event-rule/user-tracepoint.h>
index 8250b8c9e70711ab8014ccbf1528fcef59e26269..3815491157a9c9c08cee588c364dcb643fc7d216 100644 (file)
@@ -13,7 +13,9 @@
 
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/event-rule/event-rule-internal.h>
-#include <lttng/event-rule/tracepoint.h>
+#include <lttng/event-rule/jul-logging.h>
+#include <lttng/event-rule/log4j-logging.h>
+#include <lttng/event-rule/python-logging.h>
 #include <lttng/condition/condition.h>
 #include <lttng/condition/event-rule-matches.h>
 #include <lttng/domain-internal.h>
 
 #define AGENT_RET_CODE_INDEX(code) (code - AGENT_RET_CODE_SUCCESS)
 
+typedef enum lttng_event_rule_status (*event_rule_logging_get_name_pattern)(
+               const struct lttng_event_rule *rule, const char **pattern);
+typedef enum lttng_event_rule_status (*event_rule_logging_get_log_level_rule)(
+               const struct lttng_event_rule *rule,
+               const struct lttng_log_level_rule **log_level_rule);
+
 /*
  * Agent application context representation.
  */
@@ -1249,6 +1257,8 @@ struct agent_event *agent_find_event_by_trigger(
        /* Unused when loglevel_type is 'ALL'. */
        int loglevel_value = 0;
        enum lttng_loglevel_type loglevel_type;
+       event_rule_logging_get_name_pattern logging_get_name_pattern;
+       event_rule_logging_get_log_level_rule logging_get_log_level_rule;
 
        assert(agt);
        assert(agt->events);
@@ -1262,23 +1272,43 @@ struct agent_event *agent_find_event_by_trigger(
                        condition, &rule);
        assert(c_status == LTTNG_CONDITION_STATUS_OK);
 
-       assert(lttng_event_rule_get_type(rule) ==
-                       LTTNG_EVENT_RULE_TYPE_TRACEPOINT);
+       switch (lttng_event_rule_get_type(rule)) {
+       case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+               logging_get_name_pattern =
+                               lttng_event_rule_jul_logging_get_name_pattern;
+               logging_get_log_level_rule =
+                               lttng_event_rule_jul_logging_get_log_level_rule;
+               break;
+       case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+               logging_get_name_pattern =
+                               lttng_event_rule_log4j_logging_get_name_pattern;
+               logging_get_log_level_rule =
+                               lttng_event_rule_log4j_logging_get_log_level_rule;
+               break;
+       case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
+               logging_get_name_pattern =
+                               lttng_event_rule_python_logging_get_name_pattern;
+               logging_get_log_level_rule =
+                               lttng_event_rule_python_logging_get_log_level_rule;
+               break;
+       default:
+               abort();
+               break;
+       }
 
        domain = lttng_event_rule_get_domain_type(rule);
        assert(domain == LTTNG_DOMAIN_JUL || domain == LTTNG_DOMAIN_LOG4J ||
                        domain == LTTNG_DOMAIN_PYTHON);
 
        /* Get the event's pattern name ('name' in the legacy terminology). */
-       er_status = lttng_event_rule_tracepoint_get_name_pattern(rule, &name);
+       er_status = logging_get_name_pattern(rule, &name);
        assert(er_status == LTTNG_EVENT_RULE_STATUS_OK);
 
        /* Get the internal filter expression. */
        filter_expression = lttng_event_rule_get_filter(rule);
 
        /* Map log_level_rule to loglevel value. */
-       er_status = lttng_event_rule_tracepoint_get_log_level_rule(
-                       rule, &log_level_rule);
+       er_status = logging_get_log_level_rule(rule, &log_level_rule);
        if (er_status == LTTNG_EVENT_RULE_STATUS_UNSET) {
                loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
                loglevel_value = 0;
index 60aa2cde85e9817492b54e3d559d36c73b709277..ab39ca65a1cf2b1d92ffdffc44618a4e5d131307 100644 (file)
@@ -607,8 +607,15 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt)
                        condition, &rule);
        assert(c_status == LTTNG_CONDITION_STATUS_OK);
 
-       assert(lttng_event_rule_get_type(rule) ==
-                       LTTNG_EVENT_RULE_TYPE_TRACEPOINT);
+       switch (lttng_event_rule_get_type(rule)) {
+       case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+       case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+       case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
+               break;
+       default:
+               abort();
+               break;
+       }
 
        d_type = lttng_event_rule_get_domain_type(rule);
        assert(d_type == agt->domain);
index 952342e5424dd4e8b08de6379808137c1ab61ea5..bd06ba4ec5dc4f587486b855b5bcb9bd739d7205 100644 (file)
@@ -22,8 +22,9 @@
 #include <lttng/event-rule/kernel-kprobe-internal.h>
 #include <lttng/event-rule/kernel-syscall.h>
 #include <lttng/event-rule/kernel-syscall-internal.h>
-#include <lttng/event-rule/tracepoint.h>
-#include <lttng/event-rule/tracepoint-internal.h>
+#include <lttng/event-rule/kernel-tracepoint.h>
+#include <lttng/event-rule/kernel-tracepoint-internal.h>
+#include <lttng/event-rule/kernel-uprobe.h>
 #include <lttng/event-rule/kernel-uprobe-internal.h>
 #include <common/common.h>
 #include <common/defaults.h>
@@ -655,15 +656,12 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                ret_code = LTTNG_OK;
                break;
        }
-       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
        {
-               const enum lttng_domain_type domain =
-                               lttng_event_rule_get_domain_type(rule);
                const enum lttng_event_rule_status status =
-                               lttng_event_rule_tracepoint_get_name_pattern(
+                               lttng_event_rule_kernel_tracepoint_get_name_pattern(
                                                rule, &name);
 
-               assert(domain == LTTNG_DOMAIN_KERNEL);
                assert(status == LTTNG_EVENT_RULE_STATUS_OK);
                kernel_event_notifier->event.instrumentation =
                                LTTNG_KERNEL_ABI_TRACEPOINT;
index f1beaef532802accc890e6495a30cb639b31923e..f222ebdb6215cd14c7d05cf983e214a2cce63664 100644 (file)
@@ -27,7 +27,7 @@
 #include <common/hashtable/utils.h>
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/event-rule/event-rule-internal.h>
-#include <lttng/event-rule/tracepoint.h>
+#include <lttng/event-rule/user-tracepoint.h>
 #include <lttng/condition/condition.h>
 #include <lttng/condition/event-rule-matches-internal.h>
 #include <lttng/condition/event-rule-matches.h>
@@ -2022,9 +2022,6 @@ static int init_ust_event_notifier_from_event_rule(
        int loglevel = -1, ret = 0;
        const char *pattern;
 
-       /* For now only LTTNG_EVENT_RULE_TYPE_TRACEPOINT are supported. */
-       assert(lttng_event_rule_get_type(rule) ==
-                       LTTNG_EVENT_RULE_TYPE_TRACEPOINT);
 
        memset(event_notifier, 0, sizeof(*event_notifier));
 
@@ -2042,13 +2039,16 @@ static int init_ust_event_notifier_from_event_rule(
        } else {
                const struct lttng_log_level_rule *log_level_rule;
 
-               status = lttng_event_rule_tracepoint_get_name_pattern(rule, &pattern);
+               assert(lttng_event_rule_get_type(rule) ==
+                               LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT);
+
+               status = lttng_event_rule_user_tracepoint_get_name_pattern(rule, &pattern);
                if (status != LTTNG_EVENT_RULE_STATUS_OK) {
                        /* At this point, this is a fatal error. */
                        abort();
                }
 
-               status = lttng_event_rule_tracepoint_get_log_level_rule(
+               status = lttng_event_rule_user_tracepoint_get_log_level_rule(
                                rule, &log_level_rule);
                if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
                        ust_loglevel_type = LTTNG_UST_ABI_LOGLEVEL_ALL;
@@ -2106,6 +2106,7 @@ static int create_ust_event_notifier(struct ust_app *app,
        const struct lttng_event_rule *event_rule = NULL;
        unsigned int capture_bytecode_count = 0, i;
        enum lttng_condition_status cond_status;
+       enum lttng_event_rule_type event_rule_type;
 
        health_code_update();
        assert(app->event_notifier_group.object);
@@ -2121,7 +2122,14 @@ static int create_ust_event_notifier(struct ust_app *app,
        assert(condition_status == LTTNG_CONDITION_STATUS_OK);
 
        assert(event_rule);
-       assert(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_TRACEPOINT);
+
+       event_rule_type = lttng_event_rule_get_type(event_rule);
+       assert(event_rule_type == LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT ||
+                       event_rule_type == LTTNG_EVENT_RULE_TYPE_JUL_LOGGING ||
+                       event_rule_type ==
+                                       LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING ||
+                       event_rule_type ==
+                                       LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING);
 
        init_ust_event_notifier_from_event_rule(event_rule, &event_notifier);
        event_notifier.event.token = ua_event_notifier_rule->token;
index 8b0754bd2a216987bf022b6df7719dfbe953454d..863e8fe1d629b765d43a0214b9e2760213f5ba97 100644 (file)
@@ -50,7 +50,6 @@ enum {
        OPT_EVENT_NAME,
        OPT_LOG_LEVEL,
 
-       OPT_DOMAIN,
        OPT_TYPE,
        OPT_LOCATION,
 
@@ -70,7 +69,6 @@ static const struct argpar_opt_descr event_rule_opt_descrs[] = {
        { OPT_LOG_LEVEL, 'l', "log-level", true },
        { OPT_EVENT_NAME, 'E', "event-name", true },
 
-       { OPT_DOMAIN, 'd', "domain", true },
        { OPT_TYPE, 't', "type", true },
        { OPT_LOCATION, 'L', "location", true },
 
@@ -81,38 +79,27 @@ static const struct argpar_opt_descr event_rule_opt_descrs[] = {
 };
 
 static
-bool assign_domain_type(enum lttng_domain_type *dest, const char *arg)
+bool has_syscall_prefix(const char *arg)
 {
-       bool ret;
-
-       if (*dest != LTTNG_DOMAIN_NONE) {
-               ERR("More than one `--domain` was specified.");
-               goto error;
-       }
-
-       if (strcmp(arg, "kernel") == 0) {
-               *dest = LTTNG_DOMAIN_KERNEL;
-       } else if (strcmp(arg, "user") == 0 || strcmp(arg, "userspace") == 0) {
-               *dest = LTTNG_DOMAIN_UST;
-       } else if (strcmp(arg, "jul") == 0) {
-               *dest = LTTNG_DOMAIN_JUL;
-       } else if (strcmp(arg, "log4j") == 0) {
-               *dest = LTTNG_DOMAIN_LOG4J;
-       } else if (strcmp(arg, "python") == 0) {
-               *dest = LTTNG_DOMAIN_PYTHON;
+       bool matches = false;
+       const char kernel_syscall_type_opt_prefix[] = "kernel:syscall";
+       const size_t kernel_syscall_type_opt_prefix_len =
+                       sizeof(kernel_syscall_type_opt_prefix) - 1;
+       const char syscall_type_opt_prefix[] = "syscall";
+       const size_t syscall_type_opt_prefix_len =
+                       sizeof(syscall_type_opt_prefix) - 1;
+
+       if (strncmp(arg, syscall_type_opt_prefix,
+                           syscall_type_opt_prefix_len) == 0) {
+               matches = true;
+       } else if (strncmp(arg, kernel_syscall_type_opt_prefix,
+                                  kernel_syscall_type_opt_prefix_len) == 0) {
+               matches = true;
        } else {
-               ERR("Invalid `--domain` value: %s", arg);
-               goto error;
+               matches = false;
        }
 
-       ret = true;
-       goto end;
-
-error:
-       ret = false;
-
-end:
-       return ret;
+       return matches;
 }
 
 static
@@ -125,8 +112,19 @@ bool assign_event_rule_type(enum lttng_event_rule_type *dest, const char *arg)
                goto error;
        }
 
-       if (strcmp(arg, "tracepoint") == 0 || strcmp(arg, "logging") == 0) {
-               *dest = LTTNG_EVENT_RULE_TYPE_TRACEPOINT;
+       if (strcmp(arg, "user") == 0 || strcmp(arg, "user:tracepoint") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT;
+       } else if (strcmp(arg, "kernel") == 0 ||
+                       strcmp(arg, "kernel:tracepoint") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT;
+       } else if (strcmp(arg, "jul") == 0 || strcmp(arg, "jul:logging") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_JUL_LOGGING;
+       } else if (strcmp(arg, "log4j") == 0 ||
+                       strcmp(arg, "log4j:logging") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING;
+       } else if (strcmp(arg, "python") == 0 ||
+                       strcmp(arg, "python:logging") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING;
        } else if (strcmp(arg, "kprobe") == 0 ||
                        strcmp(arg, "kernel:kprobe") == 0) {
                *dest = LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE;
@@ -134,9 +132,7 @@ bool assign_event_rule_type(enum lttng_event_rule_type *dest, const char *arg)
                *dest = LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE;
        } else if (strcmp(arg, "function") == 0) {
                *dest = LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION;
-       } else if (strncmp(arg, "syscall", strlen("syscall")) == 0 ||
-                       strncmp(arg, "kernel:syscall",
-                                       strlen("kernel:syscall")) == 0) {
+       } else if (has_syscall_prefix(arg)) {
                /*
                 * Matches the following:
                 *   - syscall
@@ -227,7 +223,7 @@ error:
 }
 
 /*
- * Parse `str` as a log level in domain `domain_type`.
+ * Parse `str` as a log level against the passed event rule type.
  *
  * Return the log level in `*log_level`.  Return true in `*log_level_only` if
  * the string specifies exactly this log level, false if it specifies at least
@@ -236,14 +232,14 @@ error:
  * Return true if the string was successfully parsed as a log level string.
  */
 static bool parse_log_level_string(const char *str,
-               enum lttng_domain_type domain_type,
+               enum lttng_event_rule_type event_rule_type,
                int *log_level,
                bool *log_level_only)
 {
        bool ret;
 
-       switch (domain_type) {
-       case LTTNG_DOMAIN_UST:
+       switch (event_rule_type) {
+       case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
        {
                enum lttng_loglevel log_level_min, log_level_max;
                if (!loglevel_parse_range_string(
@@ -261,7 +257,7 @@ static bool parse_log_level_string(const char *str,
                *log_level_only = log_level_min == log_level_max;
                break;
        }
-       case LTTNG_DOMAIN_LOG4J:
+       case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
        {
                enum lttng_loglevel_log4j log_level_min, log_level_max;
                if (!loglevel_log4j_parse_range_string(
@@ -279,7 +275,7 @@ static bool parse_log_level_string(const char *str,
                *log_level_only = log_level_min == log_level_max;
                break;
        }
-       case LTTNG_DOMAIN_JUL:
+       case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
        {
                enum lttng_loglevel_jul log_level_min, log_level_max;
                if (!loglevel_jul_parse_range_string(
@@ -297,7 +293,7 @@ static bool parse_log_level_string(const char *str,
                *log_level_only = log_level_min == log_level_max;
                break;
        }
-       case LTTNG_DOMAIN_PYTHON:
+       case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
        {
                enum lttng_loglevel_python log_level_min, log_level_max;
                if (!loglevel_python_parse_range_string(
@@ -653,7 +649,6 @@ struct parse_event_rule_res {
 static
 struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
 {
-       enum lttng_domain_type domain_type = LTTNG_DOMAIN_NONE;
        enum lttng_event_rule_type event_rule_type =
                        LTTNG_EVENT_RULE_TYPE_UNKNOWN;
        struct argpar_state *state;
@@ -718,14 +713,6 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                                        (const struct argpar_item_opt *) item;
 
                        switch (item_opt->descr->id) {
-                       /* Domains. */
-                       case OPT_DOMAIN:
-                               if (!assign_domain_type(&domain_type,
-                                               item_opt->arg)) {
-                                       goto error;
-                               }
-
-                               break;
                        case OPT_TYPE:
                                if (!assign_event_rule_type(&event_rule_type,
                                                item_opt->arg)) {
@@ -845,16 +832,20 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
        }
 
        if (event_rule_type == LTTNG_EVENT_RULE_TYPE_UNKNOWN) {
-               event_rule_type = LTTNG_EVENT_RULE_TYPE_TRACEPOINT;
+               event_rule_type = LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT;
        }
 
        /*
-        * Option --name is applicable to event rules of type tracepoint
-        * and syscall.  For tracepoint and syscall rules, if --name is
-        * omitted, it is implicitly "*".
+        * Option --name is applicable to event rules of type kernel, user, jul,
+        * log4j,python and syscall.  If --name is omitted, it is implicitly
+        * "*".
         */
        switch (event_rule_type) {
-       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+       case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+       case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
        case LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL:
                if (!name) {
                        name = strdup("*");
@@ -923,39 +914,18 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
        *argc -= consumed_args;
        *argv += consumed_args;
 
-       /* Need to specify a domain. */
-       if (domain_type == LTTNG_DOMAIN_NONE) {
-               ERR("Please specify a domain (--domain=(kernel,user,jul,log4j,python)).");
-               goto error;
-       }
-
-       /* Validate event rule type against domain. */
-       switch (event_rule_type) {
-       case LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE:
-       case LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION:
-       case LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE:
-       case LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL:
-               if (domain_type != LTTNG_DOMAIN_KERNEL) {
-                       ERR("Event type not available for user-space tracing.");
-                       goto error;
-               }
-               break;
-
-       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
-               break;
-
-       default:
-               abort();
-       }
-
        /*
         * Adding a filter to a probe, function or userspace-probe would be
         * denied by the kernel tracer as it's not supported at the moment. We
         * do an early check here to warn the user.
         */
-       if (filter && domain_type == LTTNG_DOMAIN_KERNEL) {
+       if (filter) {
                switch (event_rule_type) {
-               case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
+               case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
+               case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
+               case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+               case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+               case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
                case LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL:
                        break;
                default:
@@ -965,11 +935,15 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                }
        }
 
-       /* If --exclude-name/-x was passed, split it into an exclusion list. */
+       /*
+        * If --exclude-name/-x was passed, split it into an exclusion list.
+        * Exclusions are only supported by
+        * LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT for now.
+        */
        if (lttng_dynamic_pointer_array_get_count(&exclude_names) > 0) {
-               if (domain_type != LTTNG_DOMAIN_UST) {
+               if (event_rule_type != LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT) {
                        ERR("Event name exclusions are not yet implemented for %s event rules.",
-                                       get_domain_str(domain_type));
+                                       lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
 
@@ -983,44 +957,76 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
        }
 
        if (log_level_str) {
-               if (event_rule_type != LTTNG_EVENT_RULE_TYPE_TRACEPOINT) {
-                       ERR("Log levels are only applicable to tracepoint event rules.");
-                       goto error;
-               }
+               switch (event_rule_type) {
+               case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
+               case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+               case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+               case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
+               {
+                       int log_level;
+                       bool log_level_only;
+
+                       if (strcmp(log_level_str, "..") == 0) {
+                               /*
+                                * ".." is the same as passing no log level
+                                * option and correspond to the "ANY" case.
+                                */
+                               break;
+                       }
 
-               if (domain_type == LTTNG_DOMAIN_KERNEL) {
-                       ERR("Log levels are not supported by the kernel tracer.");
+                       if (!parse_log_level_string(log_level_str, event_rule_type,
+                                           &log_level, &log_level_only)) {
+                               ERR("Failed to parse log level string `%s`.",
+                                               log_level_str);
+                               goto error;
+                       }
+
+                       if (log_level_only) {
+                               log_level_rule = lttng_log_level_rule_exactly_create(log_level);
+                       } else {
+                               log_level_rule = lttng_log_level_rule_at_least_as_severe_as_create(log_level);
+                       }
+
+                       if (log_level_rule == NULL) {
+                               ERR("Failed to create log level rule object.");
+                               goto error;
+                       }
+                       break;
+               }
+               default:
+                       ERR("Log levels are not supported for %s event rules.",
+                                       lttng_event_rule_type_str(event_rule_type));
                        goto error;
                }
        }
 
        /* Finally, create the event rule object. */
        switch (event_rule_type) {
-       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
        {
                enum lttng_event_rule_status event_rule_status;
 
-               res.er = lttng_event_rule_tracepoint_create(domain_type);
+               res.er = lttng_event_rule_user_tracepoint_create();
                if (!res.er) {
-                       ERR("Failed to create tracepoint event rule.");
+                       ERR("Failed to create user_tracepoint event rule.");
                        goto error;
                }
 
                /* Set pattern. */
-               event_rule_status = lttng_event_rule_tracepoint_set_name_pattern(
+               event_rule_status = lttng_event_rule_user_tracepoint_set_name_pattern(
                                res.er, name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set tracepoint event rule's pattern to '%s'.",
+                       ERR("Failed to set user_tracepoint event rule's pattern to '%s'.",
                                        name);
                        goto error;
                }
 
                /* Set filter. */
                if (filter) {
-                       event_rule_status = lttng_event_rule_tracepoint_set_filter(
+                       event_rule_status = lttng_event_rule_user_tracepoint_set_filter(
                                        res.er, filter);
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                               ERR("Failed to set tracepoint event rule's filter to '%s'.",
+                               ERR("Failed to set user_tracepoint event rule's filter to '%s'.",
                                                filter);
                                goto error;
                        }
@@ -1039,46 +1045,95 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                                                                n);
 
                                event_rule_status =
-                                               lttng_event_rule_tracepoint_add_name_pattern_exclusion(
+                                               lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(
                                                                res.er,
                                                                exclude_name);
                                if (event_rule_status !=
                                                LTTNG_EVENT_RULE_STATUS_OK) {
-                                       ERR("Failed to set tracepoint exclusion list element '%s'",
+                                       ERR("Failed to set user_tracepoint exclusion list element '%s'",
                                                        exclude_name);
                                        goto error;
                                }
                        }
                }
 
-               /*
-                * ".." is the same as passing no log level option and
-                * correspond the the "ANY" case.
-                */
-               if (log_level_str && strcmp(log_level_str, "..") != 0) {
-                       int log_level;
-                       bool log_level_only;
+               if (log_level_rule) {
+                       event_rule_status =
+                                       lttng_event_rule_user_tracepoint_set_log_level_rule(
+                                                       res.er, log_level_rule);
 
-                       if (!parse_log_level_string(log_level_str, domain_type,
-                                           &log_level, &log_level_only)) {
-                               ERR("Failed to parse log level string `%s`.",
-                                               log_level_str);
+                       if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                               ERR("Failed to set log level on event fule.");
                                goto error;
                        }
+               }
 
-                       if (log_level_only) {
-                               log_level_rule = lttng_log_level_rule_exactly_create(log_level);
-                       } else {
-                               log_level_rule = lttng_log_level_rule_at_least_as_severe_as_create(log_level);
+               break;
+       }
+       case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
+       {
+               enum lttng_event_rule_status event_rule_status;
+
+               res.er = lttng_event_rule_kernel_tracepoint_create();
+               if (!res.er) {
+                       ERR("Failed to create kernel_tracepoint event rule.");
+                       goto error;
+               }
+
+               /* Set pattern. */
+               event_rule_status = lttng_event_rule_kernel_tracepoint_set_name_pattern(
+                               res.er, name);
+               if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                       ERR("Failed to set kernel_tracepoint event rule's pattern to '%s'.",
+                                       name);
+                       goto error;
+               }
+
+               /* Set filter. */
+               if (filter) {
+                       event_rule_status = lttng_event_rule_kernel_tracepoint_set_filter(
+                                       res.er, filter);
+                       if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                               ERR("Failed to set kernel_tracepoint event rule's filter to '%s'.",
+                                               filter);
+                               goto error;
                        }
+               }
+               break;
+       }
+       case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+       {
+               enum lttng_event_rule_status event_rule_status;
 
-                       if (log_level_rule == NULL) {
-                               ERR("Failed to create log level rule object.");
+               res.er = lttng_event_rule_jul_logging_create();
+               if (!res.er) {
+                       ERR("Failed to create jul_logging event rule.");
+                       goto error;
+               }
+
+               /* Set pattern. */
+               event_rule_status = lttng_event_rule_jul_logging_set_name_pattern(
+                               res.er, name);
+               if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                       ERR("Failed to set jul_logging event rule's pattern to '%s'.",
+                                       name);
+                       goto error;
+               }
+
+               /* Set filter. */
+               if (filter) {
+                       event_rule_status = lttng_event_rule_jul_logging_set_filter(
+                                       res.er, filter);
+                       if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                               ERR("Failed to set jul_logging event rule's filter to '%s'.",
+                                               filter);
                                goto error;
                        }
+               }
 
+               if (log_level_rule) {
                        event_rule_status =
-                                       lttng_event_rule_tracepoint_set_log_level_rule(
+                                       lttng_event_rule_jul_logging_set_log_level_rule(
                                                        res.er, log_level_rule);
 
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
@@ -1086,7 +1141,90 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                                goto error;
                        }
                }
+               break;
+       }
+       case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+       {
+               enum lttng_event_rule_status event_rule_status;
 
+               res.er = lttng_event_rule_log4j_logging_create();
+               if (!res.er) {
+                       ERR("Failed to create jul_logging event rule.");
+                       goto error;
+               }
+
+               /* Set pattern. */
+               event_rule_status = lttng_event_rule_log4j_logging_set_name_pattern(
+                               res.er, name);
+               if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                       ERR("Failed to set jul_logging event rule's pattern to '%s'.",
+                                       name);
+                       goto error;
+               }
+
+               /* Set filter. */
+               if (filter) {
+                       event_rule_status = lttng_event_rule_log4j_logging_set_filter(
+                                       res.er, filter);
+                       if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                               ERR("Failed to set jul_logging event rule's filter to '%s'.",
+                                               filter);
+                               goto error;
+                       }
+               }
+
+               if (log_level_rule) {
+                       event_rule_status =
+                                       lttng_event_rule_log4j_logging_set_log_level_rule(
+                                                       res.er, log_level_rule);
+
+                       if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                               ERR("Failed to set log level on event fule.");
+                               goto error;
+                       }
+               }
+               break;
+       }
+       case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
+       {
+               enum lttng_event_rule_status event_rule_status;
+
+               res.er = lttng_event_rule_python_logging_create();
+               if (!res.er) {
+                       ERR("Failed to create jul_logging event rule.");
+                       goto error;
+               }
+
+               /* Set pattern. */
+               event_rule_status = lttng_event_rule_python_logging_set_name_pattern(
+                               res.er, name);
+               if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                       ERR("Failed to set jul_logging event rule's pattern to '%s'.",
+                                       name);
+                       goto error;
+               }
+
+               /* Set filter. */
+               if (filter) {
+                       event_rule_status = lttng_event_rule_python_logging_set_filter(
+                                       res.er, filter);
+                       if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                               ERR("Failed to set jul_logging event rule's filter to '%s'.",
+                                               filter);
+                               goto error;
+                       }
+               }
+
+               if (log_level_rule) {
+                       event_rule_status =
+                                       lttng_event_rule_python_logging_set_log_level_rule(
+                                                       res.er, log_level_rule);
+
+                       if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
+                               ERR("Failed to set log level on event fule.");
+                               goto error;
+                       }
+               }
                break;
        }
        case LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE:
index 9c2cf0909ed61bf06d093578d57d1e44cde0e23c..929d9a46b442e01b26679906972253c0d9d50a85 100644 (file)
@@ -29,6 +29,14 @@ static const char help_msg[] =
 ;
 #endif
 
+typedef enum lttng_event_rule_status (*event_rule_logging_get_name_pattern)(
+               const struct lttng_event_rule *rule, const char **pattern);
+typedef enum lttng_event_rule_status (*event_rule_logging_get_filter)(
+               const struct lttng_event_rule *rule, const char **expression);
+typedef enum lttng_event_rule_status (*event_rule_logging_get_log_level_rule)(
+               const struct lttng_event_rule *rule,
+               const struct lttng_log_level_rule **log_level_rule);
+
 enum {
        OPT_HELP,
        OPT_LIST_OPTIONS,
@@ -118,26 +126,26 @@ static void print_condition_session_rotation(
 
 /*
  * Returns the human-readable log level name associated with a numerical value
- * if there is one. The Log4j and JUL domains have discontinuous log level
+ * if there is one. The Log4j and JUL event rule have discontinuous log level
  * values (a value can fall between two labels). In those cases, NULL is
  * returned.
  */
 static const char *get_pretty_loglevel_name(
-               enum lttng_domain_type domain, int loglevel)
+               enum lttng_event_rule_type event_rule_type, int loglevel)
 {
        const char *name = NULL;
 
-       switch (domain) {
-       case LTTNG_DOMAIN_UST:
+       switch (event_rule_type) {
+       case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
                name = loglevel_value_to_name(loglevel);
                break;
-       case LTTNG_DOMAIN_LOG4J:
+       case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
                name = loglevel_log4j_value_to_name(loglevel);
                break;
-       case LTTNG_DOMAIN_JUL:
+       case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
                name = loglevel_jul_value_to_name(loglevel);
                break;
-       case LTTNG_DOMAIN_PYTHON:
+       case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
                name = loglevel_python_value_to_name(loglevel);
                break;
        default:
@@ -148,10 +156,9 @@ static const char *get_pretty_loglevel_name(
 }
 
 static
-void print_event_rule_tracepoint(const struct lttng_event_rule *event_rule)
+void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
 {
        enum lttng_event_rule_status event_rule_status;
-       enum lttng_domain_type domain_type;
        const char *pattern;
        const char *filter;
        int log_level;
@@ -159,18 +166,13 @@ void print_event_rule_tracepoint(const struct lttng_event_rule *event_rule)
        unsigned int exclusions_count;
        int i;
 
-       event_rule_status = lttng_event_rule_tracepoint_get_name_pattern(
+       event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern(
                        event_rule, &pattern);
        assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
 
-       event_rule_status = lttng_event_rule_tracepoint_get_domain_type(
-                       event_rule, &domain_type);
-       assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
-
-       _MSG("    rule: %s (type: tracepoint, domain: %s", pattern,
-                       lttng_domain_type_str(domain_type));
+       _MSG("    rule: %s (type: user tracepoint", pattern);
 
-       event_rule_status = lttng_event_rule_tracepoint_get_filter(
+       event_rule_status = lttng_event_rule_user_tracepoint_get_filter(
                        event_rule, &filter);
        if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
                _MSG(", filter: %s", filter);
@@ -178,7 +180,7 @@ void print_event_rule_tracepoint(const struct lttng_event_rule *event_rule)
                assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
        }
 
-       event_rule_status = lttng_event_rule_tracepoint_get_log_level_rule(
+       event_rule_status = lttng_event_rule_user_tracepoint_get_log_level_rule(
                        event_rule, &log_level_rule);
        if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
                enum lttng_log_level_rule_status llr_status;
@@ -203,7 +205,7 @@ void print_event_rule_tracepoint(const struct lttng_event_rule *event_rule)
                assert(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
 
                pretty_loglevel_name = get_pretty_loglevel_name(
-                               domain_type, log_level);
+                               LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT, log_level);
                if (pretty_loglevel_name) {
                        _MSG(", log level %s %s", log_level_op,
                                        pretty_loglevel_name);
@@ -214,7 +216,7 @@ void print_event_rule_tracepoint(const struct lttng_event_rule *event_rule)
                assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
        }
 
-       event_rule_status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(
+       event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
                        event_rule, &exclusions_count);
        assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
        if (exclusions_count > 0) {
@@ -222,7 +224,7 @@ void print_event_rule_tracepoint(const struct lttng_event_rule *event_rule)
                for (i = 0; i < exclusions_count; i++) {
                        const char *exclusion;
 
-                       event_rule_status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(
+                       event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
                                        event_rule, i, &exclusion);
                        assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
 
@@ -233,6 +235,128 @@ void print_event_rule_tracepoint(const struct lttng_event_rule *event_rule)
        MSG(")");
 }
 
+static
+void print_event_rule_kernel_tracepoint(const struct lttng_event_rule *event_rule)
+{
+       enum lttng_event_rule_status event_rule_status;
+       const char *pattern;
+       const char *filter;
+
+       event_rule_status = lttng_event_rule_kernel_tracepoint_get_name_pattern(
+                       event_rule, &pattern);
+       assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+
+       _MSG("    rule: %s (type: kernel tracepoint", pattern);
+
+       event_rule_status = lttng_event_rule_kernel_tracepoint_get_filter(
+                       event_rule, &filter);
+       if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
+               _MSG(", filter: %s", filter);
+       } else {
+               assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
+       }
+
+       MSG(")");
+}
+
+static
+void print_event_rule_logging(const struct lttng_event_rule *event_rule)
+{
+       enum lttng_event_rule_status event_rule_status;
+       enum lttng_event_rule_type event_rule_type = lttng_event_rule_get_type(event_rule);
+       const char *pattern;
+       const char *filter;
+       int log_level;
+       const struct lttng_log_level_rule *log_level_rule = NULL;
+       const char *type_str = NULL;
+
+       event_rule_logging_get_name_pattern logging_get_name_pattern;
+       event_rule_logging_get_filter logging_get_filter;
+       event_rule_logging_get_log_level_rule logging_get_log_level_rule;
+
+       switch (event_rule_type) {
+       case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+               logging_get_name_pattern =
+                               lttng_event_rule_jul_logging_get_name_pattern;
+               logging_get_filter = lttng_event_rule_jul_logging_get_filter;
+               logging_get_log_level_rule =
+                               lttng_event_rule_jul_logging_get_log_level_rule;
+               type_str = "jul";
+               break;
+       case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+               logging_get_name_pattern =
+                               lttng_event_rule_log4j_logging_get_name_pattern;
+               logging_get_filter = lttng_event_rule_log4j_logging_get_filter;
+               logging_get_log_level_rule =
+                               lttng_event_rule_log4j_logging_get_log_level_rule;
+               type_str = "log4j";
+               break;
+       case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
+               logging_get_name_pattern =
+                               lttng_event_rule_python_logging_get_name_pattern;
+               logging_get_filter = lttng_event_rule_python_logging_get_filter;
+               logging_get_log_level_rule =
+                               lttng_event_rule_python_logging_get_log_level_rule;
+               type_str = "python";
+               break;
+       default:
+               abort();
+               break;
+       }
+
+       event_rule_status = logging_get_name_pattern(
+                       event_rule, &pattern);
+       assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+
+       _MSG("    rule: %s (type: %s:logging", pattern, type_str);
+
+       event_rule_status = logging_get_filter(
+                       event_rule, &filter);
+       if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
+               _MSG(", filter: %s", filter);
+       } else {
+               assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
+       }
+
+       event_rule_status = logging_get_log_level_rule(
+                       event_rule, &log_level_rule);
+       if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
+               enum lttng_log_level_rule_status llr_status;
+               const char *log_level_op;
+               const char *pretty_loglevel_name;
+
+               switch (lttng_log_level_rule_get_type(log_level_rule)) {
+               case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
+                       log_level_op = "is";
+                       llr_status = lttng_log_level_rule_exactly_get_level(
+                                       log_level_rule, &log_level);
+                       break;
+               case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
+                       log_level_op = "at least";
+                       llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
+                                       log_level_rule, &log_level);
+                       break;
+               default:
+                       abort();
+               }
+
+               assert(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
+
+               pretty_loglevel_name = get_pretty_loglevel_name(
+                               event_rule_type, log_level);
+               if (pretty_loglevel_name) {
+                       _MSG(", log level %s %s", log_level_op,
+                                       pretty_loglevel_name);
+               } else {
+                       _MSG(", log level %s %d", log_level_op, log_level);
+               }
+       } else {
+               assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
+       }
+
+       MSG(")");
+}
+
 static void print_kernel_probe_location(
                const struct lttng_kernel_probe_location *location)
 {
@@ -422,8 +546,16 @@ void print_event_rule(const struct lttng_event_rule *event_rule)
                        lttng_event_rule_get_type(event_rule);
 
        switch (event_rule_type) {
-       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
-               print_event_rule_tracepoint(event_rule);
+       case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
+               print_event_rule_user_tracepoint(event_rule);
+               break;
+       case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
+               print_event_rule_kernel_tracepoint(event_rule);
+               break;
+       case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+       case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+       case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
+               print_event_rule_logging(event_rule);
                break;
        case LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE:
                print_event_rule_kernel_probe(event_rule);
index d95d84d1d33b86f9753caab3cc222e0800cbaeab..e9bc3d96508d8860a78229deda7498f1bb0482b0 100644 (file)
@@ -68,7 +68,6 @@ libcommon_la_SOURCES = \
        event-rule/kernel-kprobe.c \
        event-rule/kernel-syscall.c \
        event-rule/kernel-uprobe.c \
-       event-rule/tracepoint.c \
        event-rule/kernel-tracepoint.c \
        event-rule/user-tracepoint.c \
        event-rule/log4j-logging.c \
index b2abcc7648e072f2225a5cf50b472278d2f84989..8877966421996f86661a375f6320e3bfe319cb00 100644 (file)
@@ -797,7 +797,11 @@ lttng_condition_event_rule_matches_append_capture_descriptor(
        }
 
        switch(lttng_event_rule_get_type(rule)) {
-       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
+       case LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING:
+       case LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING:
        case LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL:
                /* Supported. */
                status = LTTNG_CONDITION_STATUS_OK;
index 51d0b622039454f7f8575c282fc9fdb0b622aabe..e02a1c320d05fc6f25c5ad3d265b2d74a37bd12f 100644 (file)
@@ -19,7 +19,6 @@
 #include <lttng/event-rule/log4j-logging-internal.h>
 #include <lttng/event-rule/jul-logging-internal.h>
 #include <lttng/event-rule/python-logging-internal.h>
-#include <lttng/event-rule/tracepoint-internal.h>
 #include <lttng/event-rule/kernel-tracepoint-internal.h>
 #include <lttng/event-rule/kernel-uprobe-internal.h>
 #include <lttng/event-rule/user-tracepoint-internal.h>
@@ -38,13 +37,6 @@ enum lttng_domain_type lttng_event_rule_get_domain_type(
        enum lttng_domain_type domain_type = LTTNG_DOMAIN_NONE;
 
        switch (lttng_event_rule_get_type(event_rule)) {
-       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
-       {
-               enum lttng_event_rule_status status;
-               status = lttng_event_rule_tracepoint_get_domain_type(event_rule, &domain_type);
-               assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-               break;
-       }
        case LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT:
                domain_type = LTTNG_DOMAIN_UST;
                break;
@@ -186,10 +178,6 @@ ssize_t lttng_event_rule_create_from_payload(
        consumed += sizeof(*event_rule_comm);
 
        switch ((enum lttng_event_rule_type) event_rule_comm->event_rule_type) {
-       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
-               create_from_payload =
-                               lttng_event_rule_tracepoint_create_from_payload;
-               break;
        case LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE:
                create_from_payload = lttng_event_rule_kernel_kprobe_create_from_payload;
                break;
@@ -349,8 +337,6 @@ const char *lttng_event_rule_type_str(enum lttng_event_rule_type type)
        switch (type) {
        case LTTNG_EVENT_RULE_TYPE_UNKNOWN:
                return "unknown";
-       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
-               return "tracepoint";
        case LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL:
                return "kernel syscall";
        case LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE:
diff --git a/src/common/event-rule/tracepoint.c b/src/common/event-rule/tracepoint.c
deleted file mode 100644 (file)
index 58757bb..0000000
+++ /dev/null
@@ -1,1322 +0,0 @@
-/*
- * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- */
-
-#include <assert.h>
-#include <common/credentials.h>
-#include <common/error.h>
-#include <common/macros.h>
-#include <common/optional.h>
-#include <common/payload.h>
-#include <common/payload-view.h>
-#include <common/runas.h>
-#include <common/hashtable/hashtable.h>
-#include <common/hashtable/utils.h>
-#include <common/string-utils/string-utils.h>
-#include <lttng/event-rule/event-rule-internal.h>
-#include <lttng/event-rule/tracepoint-internal.h>
-#include <lttng/log-level-rule.h>
-#include <lttng/event.h>
-
-#define IS_TRACEPOINT_EVENT_RULE(rule) \
-       (lttng_event_rule_get_type(rule) == LTTNG_EVENT_RULE_TYPE_TRACEPOINT)
-
-static void lttng_event_rule_tracepoint_destroy(struct lttng_event_rule *rule)
-{
-       struct lttng_event_rule_tracepoint *tracepoint;
-
-       if (rule == NULL) {
-               return;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-
-       lttng_dynamic_pointer_array_reset(&tracepoint->exclusions);
-       free(tracepoint->pattern);
-       free(tracepoint->filter_expression);
-       free(tracepoint->internal_filter.filter);
-       free(tracepoint->internal_filter.bytecode);
-       free(tracepoint);
-}
-
-static bool lttng_event_rule_tracepoint_validate(
-               const struct lttng_event_rule *rule)
-{
-       bool valid = false;
-       struct lttng_event_rule_tracepoint *tracepoint;
-
-       if (!rule) {
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-
-       /* Required field. */
-       if (!tracepoint->pattern) {
-               ERR("Invalid tracepoint event rule: a pattern must be set.");
-               goto end;
-       }
-
-       /* Required field. */
-       if (tracepoint->domain == LTTNG_DOMAIN_NONE) {
-               ERR("Invalid tracepoint event rule: a domain must be set.");
-               goto end;
-       }
-
-       valid = true;
-end:
-       return valid;
-}
-
-static int lttng_event_rule_tracepoint_serialize(
-               const struct lttng_event_rule *rule,
-               struct lttng_payload *payload)
-{
-       int ret, i;
-       size_t pattern_len, filter_expression_len, exclusions_len, header_offset;
-       size_t size_before_log_level_rule;
-       struct lttng_event_rule_tracepoint *tracepoint;
-       struct lttng_event_rule_tracepoint_comm tracepoint_comm;
-       enum lttng_event_rule_status status;
-       unsigned int exclusion_count;
-       size_t exclusions_appended_len = 0;
-       struct lttng_event_rule_tracepoint_comm *header;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule)) {
-               ret = -1;
-               goto end;
-       }
-
-       header_offset = payload->buffer.size;
-
-       DBG("Serializing tracepoint event rule.");
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-
-       status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(rule, &exclusion_count);
-       assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-
-       pattern_len = strlen(tracepoint->pattern) + 1;
-
-       if (tracepoint->filter_expression != NULL) {
-               filter_expression_len =
-                               strlen(tracepoint->filter_expression) + 1;
-       } else {
-               filter_expression_len = 0;
-       }
-
-       exclusions_len = 0;
-       for (i = 0; i < exclusion_count; i++) {
-               const char *exclusion;
-
-               status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(
-                               rule, i, &exclusion);
-               assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-
-               /* Length field. */
-               exclusions_len += sizeof(uint32_t);
-               /* Payload (null terminated). */
-               exclusions_len += strlen(exclusion) + 1;
-       }
-
-       tracepoint_comm.domain_type = (int8_t) tracepoint->domain;
-       tracepoint_comm.pattern_len = pattern_len;
-       tracepoint_comm.filter_expression_len = filter_expression_len;
-       tracepoint_comm.exclusions_count = exclusion_count;
-       tracepoint_comm.exclusions_len = exclusions_len;
-
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &tracepoint_comm,
-                       sizeof(tracepoint_comm));
-       if (ret) {
-               goto end;
-       }
-
-       ret = lttng_dynamic_buffer_append(
-                       &payload->buffer, tracepoint->pattern, pattern_len);
-       if (ret) {
-               goto end;
-       }
-
-       ret = lttng_dynamic_buffer_append(&payload->buffer, tracepoint->filter_expression,
-                       filter_expression_len);
-       if (ret) {
-               goto end;
-       }
-
-       size_before_log_level_rule = payload->buffer.size;
-
-       ret = lttng_log_level_rule_serialize(tracepoint->log_level_rule, payload);
-       if (ret < 0) {
-               goto end;
-       }
-
-       header = (typeof(header)) ((char *) payload->buffer.data + header_offset);
-       header->log_level_rule_len =
-                       payload->buffer.size - size_before_log_level_rule;
-
-       for (i = 0; i < exclusion_count; i++) {
-               size_t len;
-               const char *exclusion;
-
-               status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(
-                               rule, i, &exclusion);
-               assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-
-               len = strlen(exclusion) + 1;
-               /* Append exclusion length, includes the null terminator. */
-               ret = lttng_dynamic_buffer_append(
-                               &payload->buffer, &len, sizeof(uint32_t));
-               if (ret) {
-                       goto end;
-               }
-
-               exclusions_appended_len += sizeof(uint32_t);
-
-               /* Include the '\0' in the payload. */
-               ret = lttng_dynamic_buffer_append(
-                               &payload->buffer, exclusion, len);
-               if (ret) {
-                       goto end;
-               }
-
-               exclusions_appended_len += len;
-       }
-
-       assert(exclusions_len == exclusions_appended_len);
-
-end:
-       return ret;
-}
-
-static bool lttng_event_rule_tracepoint_is_equal(
-               const struct lttng_event_rule *_a,
-               const struct lttng_event_rule *_b)
-{
-       int i;
-       bool is_equal = false;
-       struct lttng_event_rule_tracepoint *a, *b;
-       unsigned int count_a, count_b;
-       enum lttng_event_rule_status status;
-
-       a = container_of(_a, struct lttng_event_rule_tracepoint, parent);
-       b = container_of(_b, struct lttng_event_rule_tracepoint, parent);
-
-       status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(_a, &count_a);
-       assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-       status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(_b, &count_b);
-       assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-
-       /* Quick checks. */
-       if (a->domain != b->domain) {
-               goto end;
-       }
-
-       if (count_a != count_b) {
-               goto end;
-       }
-
-       if (!!a->filter_expression != !!b->filter_expression) {
-               goto end;
-       }
-
-       /* Long check. */
-       assert(a->pattern);
-       assert(b->pattern);
-       if (strcmp(a->pattern, b->pattern)) {
-               goto end;
-       }
-
-       if (a->filter_expression && b->filter_expression) {
-               if (strcmp(a->filter_expression, b->filter_expression)) {
-                       goto end;
-               }
-       } else if (!!a->filter_expression != !!b->filter_expression) {
-               /* One is set; not the other. */
-               goto end;
-       }
-
-       if (!lttng_log_level_rule_is_equal(
-                               a->log_level_rule, b->log_level_rule)) {
-               goto end;
-       }
-
-       for (i = 0; i < count_a; i++) {
-               const char *exclusion_a, *exclusion_b;
-
-               status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(
-                               _a, i, &exclusion_a);
-               assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-               status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(
-                               _b, i, &exclusion_b);
-               assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-               if (strcmp(exclusion_a, exclusion_b)) {
-                       goto end;
-               }
-       }
-
-       is_equal = true;
-end:
-       return is_equal;
-}
-
-/*
- * On success ret is 0;
- *
- * On error ret is negative.
- *
- * An event with NO loglevel and the name is * will return NULL.
- */
-static int generate_agent_filter(
-               const struct lttng_event_rule *rule, char **_agent_filter)
-{
-       int err;
-       int ret = 0;
-       char *agent_filter = NULL;
-       const char *pattern;
-       const char *filter;
-       const struct lttng_log_level_rule *log_level_rule = NULL;
-       enum lttng_event_rule_status status;
-
-       assert(rule);
-       assert(_agent_filter);
-
-       status = lttng_event_rule_tracepoint_get_name_pattern(rule, &pattern);
-       if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-               ret = -1;
-               goto end;
-       }
-
-       status = lttng_event_rule_tracepoint_get_filter(rule, &filter);
-       if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
-       } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-               ret = -1;
-               goto end;
-       }
-
-
-       /* Don't add filter for the '*' event. */
-       if (strcmp(pattern, "*") != 0) {
-               if (filter) {
-                       err = asprintf(&agent_filter,
-                                       "(%s) && (logger_name == \"%s\")",
-                                       filter, pattern);
-               } else {
-                       err = asprintf(&agent_filter, "logger_name == \"%s\"",
-                                       pattern);
-               }
-
-               if (err < 0) {
-                       PERROR("Failed to format agent filter string");
-                       ret = -1;
-                       goto end;
-               }
-       }
-
-       status = lttng_event_rule_tracepoint_get_log_level_rule(
-                       rule, &log_level_rule);
-       if (status == LTTNG_EVENT_RULE_STATUS_OK) {
-               enum lttng_log_level_rule_status llr_status;
-               const char *op;
-               int level;
-
-               switch (lttng_log_level_rule_get_type(log_level_rule))
-               {
-               case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &level);
-                       op = "==";
-                       break;
-               case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
-                       llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &level);
-                       op = ">=";
-                       break;
-               default:
-                       abort();
-               }
-
-               if (llr_status != LTTNG_LOG_LEVEL_RULE_STATUS_OK) {
-                       ret = -1;
-                       goto end;
-               }
-
-               if (filter || agent_filter) {
-                       char *new_filter;
-
-                       err = asprintf(&new_filter,
-                                       "(%s) && (int_loglevel %s %d)",
-                                       agent_filter ? agent_filter : filter,
-                                       op, level);
-                       if (agent_filter) {
-                               free(agent_filter);
-                       }
-                       agent_filter = new_filter;
-               } else {
-                       err = asprintf(&agent_filter, "int_loglevel %s %d", op,
-                                       level);
-               }
-
-               if (err < 0) {
-                       PERROR("Failed to format agent filter string");
-                       ret = -1;
-                       goto end;
-               }
-       }
-
-       *_agent_filter = agent_filter;
-       agent_filter = NULL;
-
-end:
-       free(agent_filter);
-       return ret;
-}
-
-static enum lttng_error_code
-lttng_event_rule_tracepoint_generate_filter_bytecode(
-               struct lttng_event_rule *rule,
-               const struct lttng_credentials *creds)
-{
-       int ret;
-       enum lttng_error_code ret_code;
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_domain_type domain_type;
-       enum lttng_event_rule_status status;
-       const char *filter;
-       struct lttng_bytecode *bytecode = NULL;
-
-       assert(rule);
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-
-       status = lttng_event_rule_tracepoint_get_filter(rule, &filter);
-       if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               filter = NULL;
-       } else if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-               ret_code = LTTNG_ERR_FILTER_INVAL;
-               goto end;
-       }
-
-       if (filter && filter[0] == '\0') {
-               ret_code = LTTNG_ERR_FILTER_INVAL;
-               goto error;
-       }
-
-       status = lttng_event_rule_tracepoint_get_domain_type(
-                       rule, &domain_type);
-       if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-               ret_code = LTTNG_ERR_UNK;
-               goto error;
-       }
-
-       switch (domain_type) {
-       case LTTNG_DOMAIN_LOG4J:
-       case LTTNG_DOMAIN_JUL:
-       case LTTNG_DOMAIN_PYTHON:
-       {
-               char *agent_filter;
-
-               ret = generate_agent_filter(rule, &agent_filter);
-               if (ret) {
-                       ret_code = LTTNG_ERR_FILTER_INVAL;
-                       goto error;
-               }
-
-               tracepoint->internal_filter.filter = agent_filter;
-               break;
-       }
-       default:
-       {
-               if (filter) {
-                       tracepoint->internal_filter.filter = strdup(filter);
-                       if (tracepoint->internal_filter.filter == NULL) {
-                               ret_code = LTTNG_ERR_NOMEM;
-                               goto error;
-                       }
-               } else {
-                       tracepoint->internal_filter.filter = NULL;
-               }
-               break;
-       }
-       }
-
-       if (tracepoint->internal_filter.filter == NULL) {
-               ret_code = LTTNG_OK;
-               goto end;
-       }
-
-       ret = run_as_generate_filter_bytecode(
-                       tracepoint->internal_filter.filter, creds,
-                       &bytecode);
-       if (ret) {
-               ret_code = LTTNG_ERR_FILTER_INVAL;
-               goto end;
-       }
-
-       tracepoint->internal_filter.bytecode = bytecode;
-       bytecode = NULL;
-       ret_code = LTTNG_OK;
-
-error:
-end:
-       free(bytecode);
-       return ret_code;
-}
-
-static const char *lttng_event_rule_tracepoint_get_internal_filter(
-               const struct lttng_event_rule *rule)
-{
-       struct lttng_event_rule_tracepoint *tracepoint;
-
-       assert(rule);
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       return tracepoint->internal_filter.filter;
-}
-
-static const struct lttng_bytecode *
-lttng_event_rule_tracepoint_get_internal_filter_bytecode(
-               const struct lttng_event_rule *rule)
-{
-       struct lttng_event_rule_tracepoint *tracepoint;
-
-       assert(rule);
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       return tracepoint->internal_filter.bytecode;
-}
-
-static enum lttng_event_rule_generate_exclusions_status
-lttng_event_rule_tracepoint_generate_exclusions(
-               const struct lttng_event_rule *rule,
-               struct lttng_event_exclusion **_exclusions)
-{
-       unsigned int nb_exclusions = 0, i;
-       enum lttng_domain_type domain_type;
-       struct lttng_event_exclusion *exclusions;
-       enum lttng_event_rule_status event_rule_status;
-       enum lttng_event_rule_generate_exclusions_status ret_status;
-
-       assert(_exclusions);
-
-       event_rule_status = lttng_event_rule_tracepoint_get_domain_type(
-                       rule, &domain_type);
-       assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
-
-       switch (domain_type) {
-       case LTTNG_DOMAIN_KERNEL:
-       case LTTNG_DOMAIN_JUL:
-       case LTTNG_DOMAIN_LOG4J:
-       case LTTNG_DOMAIN_PYTHON:
-               /* Not supported. */
-               exclusions = NULL;
-               ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
-               goto end;
-       case LTTNG_DOMAIN_UST:
-               /* Exclusions supported. */
-               break;
-       default:
-               /* Unknown domain. */
-               abort();
-       }
-
-       event_rule_status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(
-                       rule, &nb_exclusions);
-       assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
-       if (nb_exclusions == 0) {
-               /* Nothing to do. */
-               exclusions = NULL;
-               ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
-               goto end;
-       }
-
-       exclusions = zmalloc(sizeof(struct lttng_event_exclusion) +
-                       (LTTNG_SYMBOL_NAME_LEN * nb_exclusions));
-       if (!exclusions) {
-               PERROR("Failed to allocate exclusions buffer");
-               ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_OUT_OF_MEMORY;
-               goto end;
-       }
-
-       exclusions->count = nb_exclusions;
-       for (i = 0; i < nb_exclusions; i++) {
-               int copy_ret;
-               const char *exclusion_str;
-
-               event_rule_status =
-                               lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(
-                                               rule, i, &exclusion_str);
-               assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
-
-               copy_ret = lttng_strncpy(exclusions->names[i], exclusion_str,
-                               LTTNG_SYMBOL_NAME_LEN);
-               if (copy_ret) {
-                       free(exclusions);
-                       exclusions = NULL;
-                       ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_ERROR;
-                       goto end;
-               }
-       }
-
-       ret_status = LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_OK;
-
-end:
-       *_exclusions = exclusions;
-       return ret_status;
-}
-
-static void destroy_lttng_exclusions_element(void *ptr)
-{
-       free(ptr);
-}
-
-static unsigned long lttng_event_rule_tracepoint_hash(
-               const struct lttng_event_rule *rule)
-{
-       unsigned long hash;
-       unsigned int i, exclusion_count;
-       enum lttng_event_rule_status status;
-       struct lttng_event_rule_tracepoint *tp_rule =
-                       container_of(rule, typeof(*tp_rule), parent);
-
-       hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_TRACEPOINT,
-                       lttng_ht_seed);
-       hash ^= hash_key_ulong((void *) tp_rule->domain, lttng_ht_seed);
-       hash ^= hash_key_str(tp_rule->pattern, lttng_ht_seed);
-
-       if (tp_rule->filter_expression) {
-               hash ^= hash_key_str(tp_rule->filter_expression, lttng_ht_seed);
-       }
-
-       if (tp_rule->log_level_rule) {
-               hash ^= lttng_log_level_rule_hash(tp_rule->log_level_rule);
-       }
-
-       status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(rule,
-                       &exclusion_count);
-       assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-
-       for (i = 0; i < exclusion_count; i++) {
-               const char *exclusion;
-
-               status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(
-                               rule, i, &exclusion);
-               assert(status == LTTNG_EVENT_RULE_STATUS_OK);
-               hash ^= hash_key_str(exclusion, lttng_ht_seed);
-       }
-
-       return hash;
-}
-
-static struct lttng_event *lttng_event_rule_tracepoint_generate_lttng_event(
-               const struct lttng_event_rule *rule)
-{
-       int ret;
-       const struct lttng_event_rule_tracepoint *tracepoint;
-       struct lttng_event *local_event = NULL;
-       struct lttng_event *event = NULL;
-       enum lttng_loglevel_type loglevel_type;
-       int loglevel_value = 0;
-       enum lttng_event_rule_status status;
-       const struct lttng_log_level_rule *log_level_rule;
-
-       tracepoint = container_of(
-                       rule, const struct lttng_event_rule_tracepoint, parent);
-
-       local_event = zmalloc(sizeof(*local_event));
-       if (!local_event) {
-               goto error;
-       }
-
-       local_event->type = LTTNG_EVENT_TRACEPOINT;
-       ret = lttng_strncpy(local_event->name, tracepoint->pattern,
-                           sizeof(local_event->name));
-       if (ret) {
-               ERR("Truncation occurred when copying event rule pattern to `lttng_event` structure: pattern = '%s'",
-                               tracepoint->pattern);
-               goto error;
-       }
-
-
-       /* Map the log level rule to an equivalent lttng_loglevel. */
-       status = lttng_event_rule_tracepoint_get_log_level_rule(
-                       rule, &log_level_rule);
-       if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
-               loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL;
-               loglevel_value = 0;
-       } else if (status == LTTNG_EVENT_RULE_STATUS_OK) {
-               enum lttng_log_level_rule_status llr_status;
-
-               switch (lttng_log_level_rule_get_type(log_level_rule)) {
-               case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-                       llr_status = lttng_log_level_rule_exactly_get_level(
-                                       log_level_rule, &loglevel_value);
-                       loglevel_type = LTTNG_EVENT_LOGLEVEL_SINGLE;
-                       break;
-               case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
-                       llr_status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                                       log_level_rule, &loglevel_value);
-                       loglevel_type = LTTNG_EVENT_LOGLEVEL_RANGE;
-                       break;
-               default:
-                       abort();
-                       break;
-               }
-
-               if (llr_status != LTTNG_LOG_LEVEL_RULE_STATUS_OK) {
-                       goto error;
-               }
-       } else {
-               goto error;
-       }
-
-       local_event->loglevel_type = loglevel_type;
-       local_event->loglevel = loglevel_value;
-
-       event = local_event;
-       local_event = NULL;
-error:
-       free(local_event);
-       return event;
-}
-
-struct lttng_event_rule *lttng_event_rule_tracepoint_create(
-               enum lttng_domain_type domain_type)
-{
-       struct lttng_event_rule *rule = NULL;
-       struct lttng_event_rule_tracepoint *tp_rule;
-       enum lttng_event_rule_status status;
-
-       if (domain_type == LTTNG_DOMAIN_NONE) {
-               goto end;
-       }
-
-       tp_rule = zmalloc(sizeof(struct lttng_event_rule_tracepoint));
-       if (!tp_rule) {
-               goto end;
-       }
-
-       rule = &tp_rule->parent;
-       lttng_event_rule_init(&tp_rule->parent, LTTNG_EVENT_RULE_TYPE_TRACEPOINT);
-       tp_rule->parent.validate = lttng_event_rule_tracepoint_validate;
-       tp_rule->parent.serialize = lttng_event_rule_tracepoint_serialize;
-       tp_rule->parent.equal = lttng_event_rule_tracepoint_is_equal;
-       tp_rule->parent.destroy = lttng_event_rule_tracepoint_destroy;
-       tp_rule->parent.generate_filter_bytecode =
-                       lttng_event_rule_tracepoint_generate_filter_bytecode;
-       tp_rule->parent.get_filter =
-                       lttng_event_rule_tracepoint_get_internal_filter;
-       tp_rule->parent.get_filter_bytecode =
-                       lttng_event_rule_tracepoint_get_internal_filter_bytecode;
-       tp_rule->parent.generate_exclusions =
-                       lttng_event_rule_tracepoint_generate_exclusions;
-       tp_rule->parent.hash = lttng_event_rule_tracepoint_hash;
-       tp_rule->parent.generate_lttng_event =
-                       lttng_event_rule_tracepoint_generate_lttng_event;
-
-       tp_rule->domain = domain_type;
-       tp_rule->log_level_rule = NULL;
-
-       lttng_dynamic_pointer_array_init(&tp_rule->exclusions,
-                       destroy_lttng_exclusions_element);
-
-       /* Default pattern is '*'. */
-       status = lttng_event_rule_tracepoint_set_name_pattern(rule, "*");
-       if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-               lttng_event_rule_destroy(rule);
-               rule = NULL;
-       }
-
-end:
-       return rule;
-}
-
-LTTNG_HIDDEN
-ssize_t lttng_event_rule_tracepoint_create_from_payload(
-               struct lttng_payload_view *view,
-               struct lttng_event_rule **_event_rule)
-{
-       ssize_t ret, offset = 0;
-       int i;
-       enum lttng_event_rule_status status;
-       enum lttng_domain_type domain_type;
-       const struct lttng_event_rule_tracepoint_comm *tracepoint_comm;
-       const char *pattern;
-       const char *filter_expression = NULL;
-       const char **exclusions = NULL;
-       const uint32_t *exclusion_len;
-       const char *exclusion;
-       struct lttng_buffer_view current_buffer_view;
-       struct lttng_event_rule *rule = NULL;
-       struct lttng_log_level_rule *log_level_rule = NULL;
-
-       if (!_event_rule) {
-               ret = -1;
-               goto end;
-       }
-
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, sizeof(*tracepoint_comm));
-       if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
-               ERR("Failed to initialize from malformed event rule tracepoint: buffer too short to contain header.");
-               ret = -1;
-               goto end;
-       }
-
-       tracepoint_comm = (typeof(tracepoint_comm)) current_buffer_view.data;
-
-       if (tracepoint_comm->domain_type <= LTTNG_DOMAIN_NONE ||
-                       tracepoint_comm->domain_type > LTTNG_DOMAIN_PYTHON) {
-               /* Invalid domain value. */
-               ERR("Invalid domain type value (%i) found in tracepoint_comm buffer.",
-                               (int) tracepoint_comm->domain_type);
-               ret = -1;
-               goto end;
-       }
-
-       domain_type = (enum lttng_domain_type) tracepoint_comm->domain_type;
-       rule = lttng_event_rule_tracepoint_create(domain_type);
-       if (!rule) {
-               ERR("Failed to create event rule tracepoint.");
-               ret = -1;
-               goto end;
-       }
-
-       /* Skip to payload. */
-       offset += current_buffer_view.size;
-
-       /* Map the pattern. */
-       current_buffer_view = lttng_buffer_view_from_view(
-                       &view->buffer, offset, tracepoint_comm->pattern_len);
-
-       if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
-               ret = -1;
-               goto end;
-       }
-
-       pattern = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view, pattern,
-                       tracepoint_comm->pattern_len)) {
-               ret = -1;
-               goto end;
-       }
-
-       /* Skip after the pattern. */
-       offset += tracepoint_comm->pattern_len;
-
-       if (!tracepoint_comm->filter_expression_len) {
-               goto skip_filter_expression;
-       }
-
-       /* Map the filter_expression. */
-       current_buffer_view = lttng_buffer_view_from_view(&view->buffer, offset,
-                       tracepoint_comm->filter_expression_len);
-       if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
-               ret = -1;
-               goto end;
-       }
-
-       filter_expression = current_buffer_view.data;
-       if (!lttng_buffer_view_contains_string(&current_buffer_view,
-                       filter_expression,
-                       tracepoint_comm->filter_expression_len)) {
-               ret = -1;
-               goto end;
-       }
-
-       /* Skip after the pattern. */
-       offset += tracepoint_comm->filter_expression_len;
-
-skip_filter_expression:
-       if (!tracepoint_comm->log_level_rule_len) {
-               goto skip_log_level_rule;
-       }
-
-       {
-               /* Map the log level rule. */
-               struct lttng_payload_view current_payload_view =
-                               lttng_payload_view_from_view(view, offset,
-                                               tracepoint_comm->log_level_rule_len);
-
-               ret = lttng_log_level_rule_create_from_payload(
-                               &current_payload_view, &log_level_rule);
-               if (ret < 0) {
-                       ret = -1;
-                       goto end;
-               }
-
-               assert(ret == tracepoint_comm->log_level_rule_len);
-       }
-
-       /* Skip after the log level rule. */
-       offset += tracepoint_comm->log_level_rule_len;
-
-skip_log_level_rule:
-       for (i = 0; i < tracepoint_comm->exclusions_count; i++) {
-               current_buffer_view = lttng_buffer_view_from_view(
-                               &view->buffer, offset, sizeof(*exclusion_len));
-               if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
-                       ret = -1;
-                       goto end;
-               }
-
-               exclusion_len = (typeof(exclusion_len)) current_buffer_view.data;
-               offset += sizeof(*exclusion_len);
-
-               current_buffer_view = lttng_buffer_view_from_view(
-                               &view->buffer, offset, *exclusion_len);
-               if (!lttng_buffer_view_is_valid(&current_buffer_view)) {
-                       ret = -1;
-                       goto end;
-               }
-
-               exclusion = current_buffer_view.data;
-               if (!lttng_buffer_view_contains_string(&current_buffer_view,
-                               exclusion, *exclusion_len)) {
-                       ret = -1;
-                       goto end;
-               }
-
-               status = lttng_event_rule_tracepoint_add_name_pattern_exclusion(rule, exclusion);
-               if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to add event rule tracepoint exclusion \"%s\".",
-                                       exclusion);
-                       ret = -1;
-                       goto end;
-               }
-
-               /* Skip to next exclusion. */
-               offset += *exclusion_len;
-       }
-
-       status = lttng_event_rule_tracepoint_set_name_pattern(rule, pattern);
-       if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-               ERR("Failed to set event rule tracepoint pattern.");
-               ret = -1;
-               goto end;
-       }
-
-       if (filter_expression) {
-               status = lttng_event_rule_tracepoint_set_filter(
-                               rule, filter_expression);
-               if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set event rule tracepoint pattern.");
-                       ret = -1;
-                       goto end;
-               }
-       }
-
-       if (log_level_rule) {
-               status = lttng_event_rule_tracepoint_set_log_level_rule(
-                               rule, log_level_rule);
-               if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set event rule tracepoint log level rule.");
-                       ret = -1;
-                       goto end;
-               }
-       }
-
-       *_event_rule = rule;
-       rule = NULL;
-       ret = offset;
-end:
-       free(exclusions);
-       lttng_log_level_rule_destroy(log_level_rule);
-       lttng_event_rule_destroy(rule);
-       return ret;
-}
-
-enum lttng_event_rule_status lttng_event_rule_tracepoint_set_name_pattern(
-               struct lttng_event_rule *rule, const char *pattern)
-{
-       char *pattern_copy = NULL;
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule) || !pattern ||
-                       strlen(pattern) == 0) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       pattern_copy = strdup(pattern);
-       if (!pattern_copy) {
-               status = LTTNG_EVENT_RULE_STATUS_ERROR;
-               goto end;
-       }
-
-       /* Normalize the pattern. */
-       strutils_normalize_star_glob_pattern(pattern_copy);
-
-       free(tracepoint->pattern);
-
-       tracepoint->pattern = pattern_copy;
-       pattern_copy = NULL;
-end:
-       return status;
-}
-
-enum lttng_event_rule_status lttng_event_rule_tracepoint_get_name_pattern(
-               const struct lttng_event_rule *rule, const char **pattern)
-{
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule) || !pattern) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       if (!tracepoint->pattern) {
-               status = LTTNG_EVENT_RULE_STATUS_UNSET;
-               goto end;
-       }
-
-       *pattern = tracepoint->pattern;
-end:
-       return status;
-}
-
-enum lttng_event_rule_status lttng_event_rule_tracepoint_get_domain_type(
-               const struct lttng_event_rule *rule,
-               enum lttng_domain_type *type)
-{
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule) || !type) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       *type = tracepoint->domain;
-end:
-       return status;
-}
-
-enum lttng_event_rule_status lttng_event_rule_tracepoint_set_filter(
-               struct lttng_event_rule *rule, const char *expression)
-{
-       char *expression_copy = NULL;
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule) || !expression ||
-                       strlen(expression) == 0) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       expression_copy = strdup(expression);
-       if (!expression_copy) {
-               PERROR("Failed to copy filter expression");
-               status = LTTNG_EVENT_RULE_STATUS_ERROR;
-               goto end;
-       }
-
-       if (tracepoint->filter_expression) {
-               free(tracepoint->filter_expression);
-       }
-
-       tracepoint->filter_expression = expression_copy;
-       expression_copy = NULL;
-end:
-       return status;
-}
-
-enum lttng_event_rule_status lttng_event_rule_tracepoint_get_filter(
-               const struct lttng_event_rule *rule, const char **expression)
-{
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule) || !expression) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       if (!tracepoint->filter_expression) {
-               status = LTTNG_EVENT_RULE_STATUS_UNSET;
-               goto end;
-       }
-
-       *expression = tracepoint->filter_expression;
-end:
-       return status;
-}
-
-static bool log_level_rule_valid(const struct lttng_log_level_rule *rule,
-               enum lttng_domain_type domain)
-{
-       bool valid = false;
-       enum lttng_log_level_rule_status status;
-       int level;
-
-       switch (lttng_log_level_rule_get_type(rule)) {
-       case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
-               status = lttng_log_level_rule_exactly_get_level(rule, &level);
-               break;
-       case LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS:
-               status = lttng_log_level_rule_at_least_as_severe_as_get_level(
-                               rule, &level);
-               break;
-       default:
-               abort();
-       }
-
-       assert(status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
-
-       switch (domain) {
-       case LTTNG_DOMAIN_KERNEL:
-               valid = false;
-               break;
-       case LTTNG_DOMAIN_UST:
-               if (level < LTTNG_LOGLEVEL_EMERG) {
-                       /* Invalid. */
-                       goto end;
-               }
-               if (level > LTTNG_LOGLEVEL_DEBUG) {
-                       /* Invalid. */
-                       goto end;
-               }
-
-               valid = true;
-               break;
-       case LTTNG_DOMAIN_JUL:
-       case LTTNG_DOMAIN_LOG4J:
-       case LTTNG_DOMAIN_PYTHON:
-               /*
-                * For both JUL and LOG4J custom log level are possible and can
-                * span the entire int32 range.
-                *
-                * For python, custom log level are possible, it is not clear if
-                * negative value are accepted (NOTSET == 0) but the source code
-                * validates against the int type implying that negative values
-                * are accepted.
-                */
-               valid = true;
-               goto end;
-       case LTTNG_DOMAIN_NONE:
-       default:
-               abort();
-       }
-
-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)
-{
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-       struct lttng_log_level_rule *copy = NULL;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule)) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       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;
-       }
-
-       copy = lttng_log_level_rule_copy(log_level_rule);
-       if (copy == NULL) {
-               status = LTTNG_EVENT_RULE_STATUS_ERROR;
-               goto end;
-       }
-
-       if (tracepoint->log_level_rule) {
-               lttng_log_level_rule_destroy(tracepoint->log_level_rule);
-       }
-
-       tracepoint->log_level_rule = copy;
-
-end:
-       return status;
-}
-
-enum lttng_event_rule_status lttng_event_rule_tracepoint_get_log_level_rule(
-               const struct lttng_event_rule *rule,
-               const struct lttng_log_level_rule **log_level_rule
-               )
-{
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule) || !log_level_rule) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       if (tracepoint->log_level_rule == NULL) {
-               status = LTTNG_EVENT_RULE_STATUS_UNSET;
-               goto end;
-       }
-
-       *log_level_rule = tracepoint->log_level_rule;
-end:
-       return status;
-}
-
-enum lttng_event_rule_status lttng_event_rule_tracepoint_add_name_pattern_exclusion(
-               struct lttng_event_rule *rule,
-               const char *exclusion)
-{
-       int ret;
-       char *exclusion_copy = NULL;
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-       enum lttng_domain_type domain_type;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule) ||
-                       !exclusion) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-
-       status = lttng_event_rule_tracepoint_get_domain_type(
-                       rule, &domain_type);
-       if (status != LTTNG_EVENT_RULE_STATUS_OK) {
-               goto end;
-       }
-
-       switch (domain_type) {
-       case LTTNG_DOMAIN_KERNEL:
-       case LTTNG_DOMAIN_JUL:
-       case LTTNG_DOMAIN_LOG4J:
-       case LTTNG_DOMAIN_PYTHON:
-               status = LTTNG_EVENT_RULE_STATUS_UNSUPPORTED;
-               goto end;
-       case LTTNG_DOMAIN_UST:
-               /* Exclusions supported. */
-               break;
-       default:
-               abort();
-       }
-
-       if (strlen(exclusion) >= LTTNG_SYMBOL_NAME_LEN) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       exclusion_copy = strdup(exclusion);
-       if (!exclusion_copy) {
-               status = LTTNG_EVENT_RULE_STATUS_ERROR;
-               goto end;
-       }
-
-       ret = lttng_dynamic_pointer_array_add_pointer(&tracepoint->exclusions,
-                       exclusion_copy);
-       if (ret < 0) {
-               status = LTTNG_EVENT_RULE_STATUS_ERROR;
-               goto end;
-       }
-
-       exclusion_copy = NULL;
-end:
-       free(exclusion_copy);
-       return status;
-}
-
-enum lttng_event_rule_status lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(
-               const struct lttng_event_rule *rule, unsigned int *count)
-{
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule) || !count) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       *count = lttng_dynamic_pointer_array_get_count(&tracepoint->exclusions);
-end:
-       return status;
-}
-
-enum lttng_event_rule_status lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(
-               const struct lttng_event_rule *rule,
-               unsigned int index,
-               const char **exclusion)
-{
-       unsigned int count;
-       struct lttng_event_rule_tracepoint *tracepoint;
-       enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-
-       if (!rule || !IS_TRACEPOINT_EVENT_RULE(rule) || !exclusion) {
-               status = LTTNG_EVENT_RULE_STATUS_INVALID;
-               goto end;
-       }
-
-       tracepoint = container_of(
-                       rule, struct lttng_event_rule_tracepoint, parent);
-       if (lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(rule, &count) !=
-                       LTTNG_EVENT_RULE_STATUS_OK) {
-               goto end;
-       }
-
-       if (index >= count) {
-               goto end;
-       }
-
-       *exclusion = lttng_dynamic_pointer_array_get_pointer(
-                       &tracepoint->exclusions, index);
-end:
-       return status;
-}
index 1b657663c9816361022e9118efde5b6bac7d967a..556a0e0b1b8807618f2bd7bb02ac5a330d7f0772 100644 (file)
@@ -1453,6 +1453,18 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
                struct lttng_condition **condition,
                struct lttng_trigger **trigger)
 {
+       typedef struct lttng_event_rule *(*event_rule_create)(void);
+       typedef enum lttng_event_rule_status (
+                       *event_rule_set_name_pattern)(
+                       struct lttng_event_rule *rule,
+                       const char *pattern);
+       typedef enum lttng_event_rule_status (*event_rule_set_filter)(
+                       struct lttng_event_rule *rule,
+                       const char *expression);
+       typedef enum lttng_event_rule_status (
+                       *event_rule_add_name_pattern_exclusion)(
+                       struct lttng_event_rule * rule, const char *exclusion);
+
        enum lttng_event_rule_status event_rule_status;
        struct lttng_action *tmp_action = NULL;
        struct lttng_event_rule *event_rule = NULL;
@@ -1460,24 +1472,45 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
        struct lttng_trigger *tmp_trigger = NULL;
        int ret;
        enum lttng_error_code ret_code;
+       event_rule_create create;
+       event_rule_set_name_pattern set_name_pattern;
+       event_rule_set_filter set_filter;
+       event_rule_add_name_pattern_exclusion add_name_pattern_exclusion;
 
        assert(event_pattern);
        assert(trigger_name);
        assert(condition);
        assert(trigger);
 
-       event_rule = lttng_event_rule_tracepoint_create(domain_type);
+       /* Set the function pointers based on the domain type. */
+       switch (domain_type) {
+       case LTTNG_DOMAIN_UST:
+               create = lttng_event_rule_user_tracepoint_create;
+               set_name_pattern = lttng_event_rule_user_tracepoint_set_name_pattern;
+               set_filter = lttng_event_rule_user_tracepoint_set_filter;
+               add_name_pattern_exclusion = lttng_event_rule_user_tracepoint_add_name_pattern_exclusion;
+               break;
+       case LTTNG_DOMAIN_KERNEL:
+               create = lttng_event_rule_kernel_tracepoint_create;
+               set_name_pattern = lttng_event_rule_kernel_tracepoint_set_name_pattern;
+               set_filter = lttng_event_rule_kernel_tracepoint_set_filter;
+               add_name_pattern_exclusion = NULL;
+               break;
+       default:
+               abort();
+               break;
+       }
+
+       event_rule = create();
        ok(event_rule, "Tracepoint event rule object creation");
 
-       event_rule_status = lttng_event_rule_tracepoint_set_name_pattern(
-                       event_rule, event_pattern);
+       event_rule_status = set_name_pattern(event_rule, event_pattern);
        ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
                        "Setting tracepoint event rule pattern: '%s'",
                        event_pattern);
 
        if (filter) {
-               event_rule_status = lttng_event_rule_tracepoint_set_filter(
-                               event_rule, filter);
+               event_rule_status = set_filter(event_rule, filter);
                ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK,
                                "Setting tracepoint event rule filter: '%s'",
                                filter);
@@ -1488,13 +1521,12 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
                bool success = true;
 
                assert(domain_type == LTTNG_DOMAIN_UST);
+               assert(add_name_pattern_exclusion != NULL);
                assert(exclusion_count > 0);
 
                for (i = 0; i < exclusion_count; i++) {
-                       event_rule_status =
-                                       lttng_event_rule_tracepoint_add_name_pattern_exclusion(
-                                                       event_rule,
-                                                       exclusions[i]);
+                       event_rule_status = add_name_pattern_exclusion(
+                                       event_rule, exclusions[i]);
                        if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                                fail("Setting tracepoint event rule exclusion '%s'.",
                                                exclusions[i]);
index 3e25d169f41515487624ce1a94f459a6ca0cfe73..fa7ad1e40ff680163997a003ffe7966a508e6bbe 100755 (executable)
@@ -78,7 +78,7 @@ function test_kernel_notifier_discarded_count
        done
 
        lttng_add_trigger_ok "$trigger_name" \
-               --condition event-rule-matches --domain=kernel --name=lttng_test_filter_event \
+               --condition event-rule-matches --type=kernel --name=lttng_test_filter_event \
                --action notify
 
        trigger_discarded_nb=$(trigger_get_discarded_notif_number "$trigger_name")
@@ -107,7 +107,7 @@ function test_kernel_notifier_discarded_count
 
        # Enable another notifier and list it to confirm the counter was cleared.
        lttng_add_trigger_ok "$trigger_name" \
-               --condition event-rule-matches --domain=kernel --name=lttng_test_filter_event \
+               --condition event-rule-matches --type=kernel --name=lttng_test_filter_event \
                --action notify
 
        trigger_discarded_nb=$(trigger_get_discarded_notif_number "$trigger_name")
@@ -129,13 +129,13 @@ function test_kernel_notifier_discarded_count_max_bucket
        diag "Kernel event notifer error counter bucket limit"
        for i in $(seq 3); do
                lttng_add_trigger_ok "$i" \
-                       --condition event-rule-matches --domain=kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --type=kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
                        --action notify
        done
 
        for i in $(seq 4 5); do
                lttng_add_trigger_fail "$i" \
-                       --condition event-rule-matches --domain=kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --type=kernel --name=my_event_that_doesnt_need_to_really_exist_$i \
                        --action notify
        done
 
@@ -180,7 +180,7 @@ function test_ust_notifier_discarded_count
        done
 
        lttng_add_trigger_ok "$trigger_name" \
-               --condition event-rule-matches --domain=user --name=tp:tptest \
+               --condition event-rule-matches --type=user --name=tp:tptest \
                --action notify
 
        trigger_discarded_nb=$(trigger_get_discarded_notif_number "$trigger_name")
@@ -206,7 +206,7 @@ function test_ust_notifier_discarded_count
 
        # Enable another notifier and list it to confirm the counter was cleared.
        lttng_add_trigger_ok "$trigger_name" \
-               --condition event-rule-matches --domain=user --name=tp:tptest \
+               --condition event-rule-matches --type=user --name=tp:tptest \
                --action notify
 
        trigger_discarded_nb=$(trigger_get_discarded_notif_number "$trigger_name")
@@ -226,13 +226,13 @@ function test_ust_notifier_discarded_count_max_bucket
        diag "UST event notifer error counter bucket limit"
        for i in $(seq 3); do
                lttng_add_trigger_ok "$i" \
-                       --condition event-rule-matches --domain=user --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --type=user --name=my_event_that_doesnt_need_to_really_exist_$i \
                        --action notify
        done
 
        for i in $(seq 4 5); do
                lttng_add_trigger_fail "$i" \
-                       --condition event-rule-matches --domain=user --name=my_event_that_doesnt_need_to_really_exist_$i \
+                       --condition event-rule-matches --type=user --name=my_event_that_doesnt_need_to_really_exist_$i \
                        --action notify
        done
 
@@ -284,11 +284,11 @@ function test_ust_notifier_discarded_count_multi_uid
        done
 
        lttng_add_trigger_ok "$root_trigger_name" \
-               --condition event-rule-matches --domain=user --name tp:tptest \
+               --condition event-rule-matches --type=user --name tp:tptest \
                --action notify
 
        lttng_add_trigger_ok "$user_trigger_name" --owner-uid "$new_uid" \
-               --condition event-rule-matches --domain=user --name tp:tptest \
+               --condition event-rule-matches --type=user --name tp:tptest \
                --action notify
 
        # Stop consumption of notifier tracer notifications.
@@ -364,7 +364,7 @@ function test_ust_notifier_discarded_regardless_trigger_owner
        done
 
        lttng_add_trigger_ok "$root_trigger_name" \
-               --condition event-rule-matches --domain=user --name tp:tptest \
+               --condition event-rule-matches --type=user --name tp:tptest \
                --action notify
 
        # Stop consumption of notifier tracer notifications.
index 91a571c13226dc59f6346d71eca79007e38df4ce..ee5b590bd710a150a952bb7b08789b15632e8d48 100755 (executable)
@@ -36,7 +36,7 @@ function test_rate_policy_every_n()
        # time the condition is met.
        lttng_add_trigger_ok \
                $TRIGGER_NAME \
-               --condition event-rule-matches --domain=user --name="tp:tptest" \
+               --condition event-rule-matches --type=user --name="tp:tptest" \
                --action notify \
                --rate-policy=every:5
 
@@ -46,7 +46,7 @@ function test_rate_policy_every_n()
        # the notification subsystem. 
        lttng_add_trigger_ok \
                $END_TRIGGER_NAME \
-               --condition event-rule-matches --domain=user --name="tp:end" \
+               --condition event-rule-matches --type=user --name="tp:end" \
                --action notify
 
        for i in $(seq 1 4); do
@@ -122,7 +122,7 @@ function test_rate_policy_once_after_n()
        # time the condition is met.
        lttng_add_trigger_ok \
                $TRIGGER_NAME \
-               --condition event-rule-matches --domain=user --name="tp:tptest" \
+               --condition event-rule-matches --type=user --name="tp:tptest" \
                --action notify \
                --rate-policy=once-after:5
 
@@ -132,7 +132,7 @@ function test_rate_policy_once_after_n()
        # the notification subsystem. 
        lttng_add_trigger_ok \
                $END_TRIGGER_NAME \
-               --condition event-rule-matches --domain=user --name="tp:end" \
+               --condition event-rule-matches --type=user --name="tp:end" \
                --action notify
 
        ## Phase 1
index f302d17d6617599c15fe43d0658d116ff37dc8de..102e7ac1d32957cf9de431ebbdab274ba9b2daf6 100755 (executable)
@@ -57,7 +57,7 @@ function test_start_session_action()
        # a `notify` action.
        lttng_add_trigger_ok \
                $TRIGGER_NAME \
-               --condition event-rule-matches --domain=user --name=tp:tptest \
+               --condition event-rule-matches --type=user --name=tp:tptest \
                --action start-session $SESSION_NAME \
                --action notify
 
@@ -111,7 +111,7 @@ function test_stop_session_action()
        # a `notify` action.
        lttng_add_trigger_ok \
                $TRIGGER_NAME \
-               --condition event-rule-matches --domain=user --name=tp:tptest \
+               --condition event-rule-matches --type=user --name=tp:tptest \
                --action stop-session $SESSION_NAME \
                --action notify
 
index 01859ee74f7ac520fccd641389e7a1e55797e57d..a55406c1a80760c735c3b6208fbdca7214467b55 100755 (executable)
@@ -23,7 +23,7 @@ TESTDIR="$CURDIR/../../.."
 # shellcheck source=../../../utils/utils.sh
 source "$TESTDIR/utils/utils.sh"
 
-plan_tests 288
+plan_tests 282
 
 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}"
 
@@ -79,77 +79,77 @@ function test_failure ()
 # top-level options
 test_success "explicit name" \
        --name hohoho \
-       --condition event-rule-matches --name=some-event-id --domain=user \
+       --condition event-rule-matches --name=some-event-id --type=user \
        --action notify
 
 # `--condition event-rule-matches` successes
-test_success "--condition event-rule-matches some-event --domain=user" \
-       --condition event-rule-matches --name=some-event --domain=user \
+test_success "--condition event-rule-matches some-event --type=user" \
+       --condition event-rule-matches --name=some-event --type=user \
        --action notify
 
-test_success "--condition event-rule-matches --domain=user" \
-       --condition event-rule-matches --domain=user \
+test_success "--condition event-rule-matches --type=user" \
+       --condition event-rule-matches --type=user \
        --action notify
 
 test_success "notify action polices" \
-       --condition event-rule-matches --domain=user --name=test-rate-policy \
+       --condition event-rule-matches --type=user --name=test-rate-policy \
        --action notify \
        --rate-policy=every:55 \
        --action notify \
        --rate-policy=once-after:55
 
 test_success "start session action polices" \
-       --condition event-rule-matches --domain=user --name=test-rate-policy \
+       --condition event-rule-matches --type=user --name=test-rate-policy \
        --action start-session my_session \
        --rate-policy=every:55 \
        --action start-session my_session \
        --rate-policy=once-after:55
 
 test_success "stop session action polices" \
-       --condition event-rule-matches --domain=user --name=test-rate-policy \
+       --condition event-rule-matches --type=user --name=test-rate-policy \
        --action stop-session my_session \
        --rate-policy=every:55 \
        --action stop-session my_session \
        --rate-policy=once-after:55
 
 test_success "snapshot session action polices" \
-       --condition event-rule-matches --domain=user --name=test-rate-policy \
+       --condition event-rule-matches --type=user --name=test-rate-policy \
        --action snapshot-session my_session \
        --rate-policy=every:55 \
        --action snapshot-session my_session \
        --rate-policy=once-after:55
 
 test_success "rotate session action polices" \
-       --condition event-rule-matches --domain=user --name=test-rate-policy \
+       --condition event-rule-matches --type=user --name=test-rate-policy \
        --action rotate-session my_session \
        --rate-policy=every:55 \
        --action rotate-session my_session \
        --rate-policy=once-after:55
 
 test_success "--log-level single level" \
-       --condition event-rule-matches --domain=user --log-level=INFO \
+       --condition event-rule-matches --type=user --log-level=INFO \
        --action notify
 
 test_success "--log-level range open max" \
-       --condition event-rule-matches --domain=user --log-level=INFO.. \
+       --condition event-rule-matches --type=user --log-level=INFO.. \
        --action notify
 
 test_success "--log-level range any" \
-       --condition event-rule-matches --domain=user --log-level=.. \
+       --condition event-rule-matches --type=user --log-level=.. \
        --action notify
 
 test_success "--exclude-name one" \
-       --condition event-rule-matches --domain=user --name='bernard*' --exclude-name=bernard-lermite \
+       --condition event-rule-matches --type=user --name='bernard*' --exclude-name=bernard-lermite \
        --action notify
 
 test_success "--exclude-name two" \
-       --condition event-rule-matches --domain=user --name='jean-*' --exclude-name jean-chretien -x jean-charest \
+       --condition event-rule-matches --type=user --name='jean-*' --exclude-name jean-chretien -x jean-charest \
        --action notify
 
 skip $ist_root "non-root user: skipping kprobe tests" 18 || {
        for type in kprobe kernel:kprobe; do
                test_success "--condition event-rule-matches probe by symbol" \
-                       --condition event-rule-matches --domain=kernel --type=$type --location=lttng_channel_enable --event-name=my_channel_enable \
+                       --condition event-rule-matches --type=$type --location=lttng_channel_enable --event-name=my_channel_enable \
                        --action notify
 
                channel_enable_addr=$(grep ' t lttng_channel_enable\s\[lttng_tracer\]$' /proc/kallsyms | cut -f 1 -d ' ')
@@ -169,127 +169,127 @@ skip $ist_root "non-root user: skipping kprobe tests" 18 || {
                offset_hex="0x$(printf '%x' $offset)"
 
                test_success "--condition event-rule-matches probe by symbol with offset" \
-                       --condition event-rule-matches --domain=kernel --type=$type --location="${base_symbol}+${offset_hex}" --event-name=my_$base_symbol \
+                       --condition event-rule-matches --type=$type --location="${base_symbol}+${offset_hex}" --event-name=my_$base_symbol \
                        --action notify
 
                test_success "--condition event-rule-matches probe by address" \
-                       --condition event-rule-matches --domain=kernel --type=$type --location="0x${channel_enable_addr}" --event-name=my_channel_enable \
+                       --condition event-rule-matches --type=$type --location="0x${channel_enable_addr}" --event-name=my_channel_enable \
                        --action notify
        done
 }
 
 skip $ist_root "non-root user: skipping uprobe tests" 6 || {
        test_success "--condition event-rule-matches uprobe" \
-               --condition event-rule-matches --domain=kernel --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe \
+               --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe \
                --action notify
 
        test_success "--condition event-rule-matches uprobe with elf prefix" \
-               --condition event-rule-matches --domain=kernel --type=kernel:uprobe --location=elf:${uprobe_elf_binary}:test_function --event-name=ma-probe-2 \
+               --condition event-rule-matches --type=kernel:uprobe --location=elf:${uprobe_elf_binary}:test_function --event-name=ma-probe-2 \
                --action notify
 }
 
 skip $ist_root "non-root user: skipping syscall tests" 30 || {
        test_success "--condition event-rule-matches one syscall" \
-               --condition event-rule-matches --domain=kernel --type=syscall --name=open \
+               --condition event-rule-matches --type=syscall --name=open \
                --action notify
 
        test_success "--condition event-rule-matches all syscalls" \
-               --condition event-rule-matches --domain=kernel --type=syscall \
+               --condition event-rule-matches --type=syscall \
                --action notify
 
        test_success "--condition event-rule-matches one syscall with filter" \
-               --condition event-rule-matches --domain=kernel --type=syscall --filter 'a > 2' --name=open \
+               --condition event-rule-matches --type=syscall --filter 'a > 2' --name=open \
                --action notify
        test_success "--condition event-rule-matches one syscall:entry" \
-               --condition event-rule-matches --domain=kernel --type=syscall:entry --name=open \
+               --condition event-rule-matches --type=syscall:entry --name=open \
                --action notify
        test_success "--condition event-rule-matches one syscall:exit" \
-               --condition event-rule-matches --domain=kernel --type=syscall:exit --name=open \
+               --condition event-rule-matches --type=syscall:exit --name=open \
                --action notify
        test_success "--condition event-rule-matches one syscall:entry-exit" \
-               --condition event-rule-matches --domain=kernel --type=syscall:entry+exit --name=open \
+               --condition event-rule-matches --type=syscall:entry+exit --name=open \
                --action notify
 
        # Same thing but with "kernel:syscall" type instead:
        test_success "--condition event-rule-matches one syscall" \
-               --condition event-rule-matches --domain=kernel --type=kernel:syscall --name=open \
+               --condition event-rule-matches --type=kernel:syscall --name=open \
                --action notify
 
        test_success "--condition event-rule-matches one kernel:syscall:entry" \
-               --condition event-rule-matches --domain=kernel --type=kernel:syscall:entry --name=open \
+               --condition event-rule-matches --type=kernel:syscall:entry --name=open \
                --action notify
        test_success "--condition event-rule-matches one kernel:syscall:exit" \
-               --condition event-rule-matches --domain=kernel --type=kernel:syscall:exit --name=open \
+               --condition event-rule-matches --type=kernel:syscall:exit --name=open \
                --action notify
        test_success "--condition event-rule-matches one kernel:syscall:entry-exit" \
-               --condition event-rule-matches --domain=kernel --type=kernel:syscall:entry+exit --name=open \
+               --condition event-rule-matches --type=kernel:syscall:entry+exit --name=open \
                --action notify
 
 }
 
 # `--action notify` successes
 test_success "--action notify" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action notify
 
 test_success "--action notify --capture foo" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture foo --action notify
 
 test_success "--action notify --capture foo[2]" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture 'foo[2]' --action notify
 
 test_success '--action notify --capture $ctx.foo' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture '$ctx.foo' --action notify
 
 test_success '--action notify --capture $ctx.foo[2]' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture '$ctx.foo[2]' --action notify
 
 test_success '--action notify --capture $app.prov:type' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture '$app.prov:type' --action notify
 
 test_success '--action notify --capture $app.prov:type[2]' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture '$app.prov:type[2]' --action notify
 
 test_success '--action notify multiple captures' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture foo --capture '$app.hello:world' --action notify
 
 # `--action start-session` successes
 test_success "--action start-session" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action start-session ze-session
 
 # `--action stop-session` successes
 test_success "--action stop-session foo" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action stop-session ze-session
 
 # `--action rotate-session` successes
 test_success "--action rotate-session foo" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action rotate-session ze-session
 
 # `--action snapshot-session` successes
 test_success "--action snapshot-session foo" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session ze-session
 
 test_success "--action snapshot-session with file URI" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session ze-session --path /hello
 
 test_success "--action snapshot-session with net URI" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session ze-session --url net://1.2.3.4
 
 test_success "--action snapshot-session with ctrl/data URIs" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session ze-session --ctrl-url=tcp://1.2.3.4:1234 --data-url=tcp://1.2.3.4:1235
 
 # top-level failures
@@ -301,12 +301,12 @@ test_failure "unknown option" \
 
 test_failure "missing --action" \
        "Error: Need at least one --action." \
-       --condition event-rule-matches --domain=user
+       --condition event-rule-matches --type=user
 
 test_failure "two --condition" \
        "Error: A --condition was already given." \
-       --condition event-rule-matches --name=aaa --domain=user \
-       --condition event-rule-matches --name=bbb --domain=user \
+       --condition event-rule-matches --name=aaa --type=user \
+       --condition event-rule-matches --name=bbb --type=user \
        --action notify
 
 test_failure "missing argument to --name" \
@@ -316,23 +316,23 @@ test_failure "missing argument to --name" \
 for cmd in rate-policy=once-after rate-policy=every; do
        test_failure "missing argument to --${cmd}" \
                "Error: Rate policy format is invalid." \
-               --condition event-rule-matches --domain=user --action notify \
+               --condition event-rule-matches --type=user --action notify \
                --${cmd}
 
        test_failure "invalid argument to --${cmd}: non-digit character" \
                "Error: Failed to parse rate policy value \`123bob\` as an integer." \
-               --condition event-rule-matches --domain=user --action notify \
+               --condition event-rule-matches --type=user --action notify \
                --${cmd}:123bob
 
        test_failure "invalid argument to --${cmd}: empty string" \
                "Error: Failed to parse rate policy value \`\` as an integer." \
-               --condition event-rule-matches --domain=user --action notify \
+               --condition event-rule-matches --type=user --action notify \
                --${cmd}":"
 done
 
 test_failure "invalid argument to --rate-policy: unknown policy type" \
        "Error: Rate policy type \`bob\` unknown." \
-       --condition event-rule-matches --domain=user --action notify \
+       --condition event-rule-matches --type=user --action notify \
        --rate-policy=bob:123
 
 # `--condition` failures
@@ -345,24 +345,16 @@ test_failure "unknown --condition" \
 
 # `--condition event-rule-matches` failures
 test_failure "missing args after --condition event-rule-matches" \
-       "Error: Please specify a domain (--domain=(kernel,user,jul,log4j,python))." \
+       "Error: Need at least one --action." \
        --condition event-rule-matches
 
 test_failure "extra args after --condition event-rule-matches" \
        "Error: Unexpected argument 'bozo'" \
-       --condition event-rule-matches --domain=user bozo
+       --condition event-rule-matches --type=user bozo
 
 test_failure "--log-level unknown level" \
        "Error: Failed to parse log level string \`FOO\`." \
-       --condition event-rule-matches --domain=user --log-level=FOO
-
-test_failure "two same --domain" \
-       "Error: More than one \`--domain\` was specified." \
-       --condition event-rule-matches --domain=user --domain=user
-
-test_failure "two different --domain" \
-       "Error: More than one \`--domain\` was specified." \
-       --condition event-rule-matches --domain=user --domain=kernel
+       --condition event-rule-matches --type=user --log-level=FOO
 
 for type in kprobe kernel:kprobe; do
        test_failure "--condition event-rule-matches: --name with --type=$type" \
@@ -370,143 +362,143 @@ for type in kprobe kernel:kprobe; do
                --condition event-rule-matches --type=$type --location=do_sys_open --name='hello'
 done
 
-test_failure "--condition event-rule-matches: --location with tracepoint event rule" \
-       "Error: Can't use --location with tracepoint event rules." \
-       --condition event-rule-matches --domain=user --location='hello'
+test_failure "--condition event-rule-matches: --location with user tracepoint event rule" \
+       "Error: Can't use --location with user tracepoint event rules." \
+       --condition event-rule-matches --type=user --location='hello'
 
-test_failure "--condition event-rule-matches: --event-name with tracepoint event rule" \
-       "Error: Can't use --event-name with tracepoint event rules." \
-       --condition event-rule-matches --domain=user --event-name='hello'
+test_failure "--condition event-rule-matches: --event-name with user tracepoint event rule" \
+       "Error: Can't use --event-name with user tracepoint event rules." \
+       --condition event-rule-matches --type=user --event-name='hello'
 
 test_failure "--condition event-rule-matches: extra argument with --type=kernel:uprobe" \
        "Error: Unexpected argument 'hello'" \
-       --condition event-rule-matches --domain=kernel --type=$type --location=${uprobe_elf_binary}:test_failure hello
+       --condition event-rule-matches --type=$type --location=${uprobe_elf_binary}:test_failure hello
 
 test_failure "--condition event-rule-matches: extra argument with --type=syscall" \
        "Error: Unexpected argument 'open'" \
-       --condition event-rule-matches --domain=kernel --type=syscall open
+       --condition event-rule-matches --type=syscall open
 
 test_failure "--condition event-rule-matches: --type=syscall:nope" \
        "Error: Failed to parse syscall type 'syscall:nope'." \
-       --condition event-rule-matches --domain=kernel --type=syscall:nope \
+       --condition event-rule-matches --type=syscall:nope \
        --name=open
 
 test_failure "--exclude-name with non-glob name" \
        "Error: Event jean: Exclusions can only be used with a globbing pattern" \
-       --condition event-rule-matches --domain=user --name='jean' --exclude-name jean-chretien \
+       --condition event-rule-matches --type=user --name='jean' --exclude-name jean-chretien \
        --action notify
 
 test_failure "--condition event-rule-matches --capture: missing argument (end of arg list)" \
        'Error: While parsing argument #2 (`--capture`): Missing required argument for option `--capture`' \
        --action notify \
-       --condition event-rule-matches --domain=user --capture
+       --condition event-rule-matches --type=user --capture
 
 test_failure "--condition event-rule-matches --capture: missing argument (before another option)" \
        'Error: While parsing expression `--action`: Unary operators are not allowed in capture expressions.' \
-       --condition event-rule-matches --domain=user --capture \
+       --condition event-rule-matches --type=user --capture \
        --action notify \
 
 test_failure "--condition event-rule-matches --capture: binary operator" \
        'Error: While parsing expression `foo == 2`: Binary operators are not allowed in capture expressions.' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture 'foo == 2' --action notify
 
 test_failure "--condition event-rule-matches --capture: unary operator" \
        'Error: While parsing expression `!foo`: Unary operators are not allowed in capture expressions.' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture '!foo' --action notify
 
 test_failure "--condition event-rule-matches --capture: logical operator" \
        'Error: While parsing expression `foo || bar`: Logical operators are not allowed in capture expressions.' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture 'foo || bar' --action notify
 
 test_failure "--condition event-rule-matches --capture: accessing a sub-field" \
        'Error: While parsing expression `foo.bar`: Capturing subfields is not supported.' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture 'foo.bar' --action notify
 
 test_failure "--condition event-rule-matches --capture: accessing the sub-field of an array element" \
        'Error: While parsing expression `foo[3].bar`: Capturing subfields is not supported.' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture 'foo[3].bar' --action notify
 
 test_failure "--condition event-rule-matches --capture: missing colon in app-specific context field" \
        'Error: Invalid app-specific context field name: missing colon in `foo`.' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture '$app.foo' --action notify
 
 test_failure "--condition event-rule-matches --capture: missing colon in app-specific context field" \
        'Error: Invalid app-specific context field name: missing type name after colon in `foo:`.' \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --capture '$app.foo:' --action notify
 
 # `--action` failures
 test_failure "missing args after --action" \
        "Error: While parsing argument #1 (\`--action\`): Missing required argument for option \`--action\`" \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action
 
 # `--action notify` failures
 test_failure "extra arg after --action notify" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action notify bob
 
 # `--action start-session` failures
 test_failure "missing arg after --action start-session" \
        "Error: Missing session name." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action start-session
 test_failure "extra arg after --action start-session" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action start-session ze-session bob
 
 # `--action stop-session` failures
 test_failure "missing arg after --action stop-session" \
        "Error: Missing session name." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action stop-session
 test_failure "extra arg after --action stop-session" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action stop-session ze-session bob
 
 # `--action rotate-session` failures
 test_failure "missing arg after --action rotate-session" \
        "Error: Missing session name." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action rotate-session
 test_failure "extra arg after --action rotate-session" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action rotate-session ze-session bob
 
 # `--action snapshot-session` failures
 test_failure "missing arg after --action snapshot-session" \
        "Error: Missing session name." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session
 test_failure "extra arg after --action snapshot-session" \
        "Error: Unexpected argument \`bob\`." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session ze-session bob
 test_failure "snapshot-session action, --max-size without destination" \
        "Error: Can't provide a snapshot output max size without a snapshot output destination." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session ze-session --max-size 10M
 test_failure "snapshot-session action, --name without destination" \
        "Error: Can't provide a snapshot output name without a snapshot output destination." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session ze-session --name hallo
 test_failure "snapshot-session action, --name with-local-path-instead-of-url" \
        "Error: Failed to parse '/something/that/looks/like/a/path' as an URL." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session ze-session --name hallo --url /something/that/looks/like/a/path
 test_failure "snapshot-session action, --name with-net-url-instead-of-path" \
        "Error: Failed to parse 'net://8.8.8.8/' as a local path." \
-       --condition event-rule-matches --domain=user \
+       --condition event-rule-matches --type=user \
        --action snapshot-session ze-session --name hallo --path net://8.8.8.8/
 
 # Cleanup
index 5366a030ccc1434347a05aab15dff6c6a7da9176..c55cbcc38238a55d0b75422900e83f44bce080ed 100755 (executable)
@@ -55,13 +55,13 @@ test_top_level_options ()
 {
        diag "Listing top level options"
 
-       lttng_add_trigger_ok "hello" --condition event-rule-matches --domain=user --name=test-name --action notify
+       lttng_add_trigger_ok "hello" --condition event-rule-matches --type=user --name=test-name --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: hello
          owner uid: ${uid}
          condition: event rule matches
-           rule: test-name (type: tracepoint, domain: ust)
+           rule: test-name (type: user tracepoint)
          actions:
            notify
              errors: none
@@ -77,22 +77,22 @@ test_event_rule_matches_tracepoint ()
 {
        diag "Listing event-rule-matches tracepoint"
 
-       lttng_add_trigger_ok "C" --condition event-rule-matches --domain=user --action notify
-       lttng_add_trigger_ok "A" --condition event-rule-matches --name=aaa --domain=user --filter 'p == 2' --action notify
-       lttng_add_trigger_ok "D" --condition event-rule-matches --name='hello*' --domain=user -x hello2 --exclude-name  hello3 -x hello4 --action notify
-       lttng_add_trigger_ok "B" --condition event-rule-matches --domain=user --name=gerboise --log-level INFO.. --action notify
-       lttng_add_trigger_ok "E" --condition event-rule-matches --domain=user --name=lemming --log-level WARNING --action notify
-       lttng_add_trigger_ok "J" --condition event-rule-matches --domain=user --name=lemming --log-level .. --action notify
-       lttng_add_trigger_ok "F" --condition event-rule-matches --domain=user --name=capture-payload-field --capture a --action notify
-       lttng_add_trigger_ok "G" --condition event-rule-matches --domain=user --name=capture-array --capture 'a[2]' --capture '$ctx.tourlou[18]' --action notify
-       lttng_add_trigger_ok "H" --condition event-rule-matches --domain=user --name=capture-chan-ctx --capture '$ctx.vpid' --action notify
-       lttng_add_trigger_ok "I" --condition event-rule-matches --domain=user --name=capture-app-ctx --capture '$app.iga:active_clients' --action notify
+       lttng_add_trigger_ok "C" --condition event-rule-matches --type=user --action notify
+       lttng_add_trigger_ok "A" --condition event-rule-matches --name=aaa --type=user --filter 'p == 2' --action notify
+       lttng_add_trigger_ok "D" --condition event-rule-matches --name='hello*' --type=user -x hello2 --exclude-name  hello3 -x hello4 --action notify
+       lttng_add_trigger_ok "B" --condition event-rule-matches --type=user --name=gerboise --log-level INFO.. --action notify
+       lttng_add_trigger_ok "E" --condition event-rule-matches --type=user --name=lemming --log-level WARNING --action notify
+       lttng_add_trigger_ok "J" --condition event-rule-matches --type=user --name=lemming --log-level .. --action notify
+       lttng_add_trigger_ok "F" --condition event-rule-matches --type=user --name=capture-payload-field --capture a --action notify
+       lttng_add_trigger_ok "G" --condition event-rule-matches --type=user --name=capture-array --capture 'a[2]' --capture '$ctx.tourlou[18]' --action notify
+       lttng_add_trigger_ok "H" --condition event-rule-matches --type=user --name=capture-chan-ctx --capture '$ctx.vpid' --action notify
+       lttng_add_trigger_ok "I" --condition event-rule-matches --type=user --name=capture-app-ctx --capture '$app.iga:active_clients' --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: A
          owner uid: ${uid}
          condition: event rule matches
-           rule: aaa (type: tracepoint, domain: ust, filter: p == 2)
+           rule: aaa (type: user tracepoint, filter: p == 2)
          actions:
            notify
              errors: none
@@ -100,7 +100,7 @@ test_event_rule_matches_tracepoint ()
        - name: B
          owner uid: ${uid}
          condition: event rule matches
-           rule: gerboise (type: tracepoint, domain: ust, log level at least INFO)
+           rule: gerboise (type: user tracepoint, log level at least INFO)
          actions:
            notify
              errors: none
@@ -108,7 +108,7 @@ test_event_rule_matches_tracepoint ()
        - name: C
          owner uid: ${uid}
          condition: event rule matches
-           rule: * (type: tracepoint, domain: ust)
+           rule: * (type: user tracepoint)
          actions:
            notify
              errors: none
@@ -116,7 +116,7 @@ test_event_rule_matches_tracepoint ()
        - name: D
          owner uid: ${uid}
          condition: event rule matches
-           rule: hello* (type: tracepoint, domain: ust, exclusions: hello2,hello3,hello4)
+           rule: hello* (type: user tracepoint, exclusions: hello2,hello3,hello4)
          actions:
            notify
              errors: none
@@ -124,7 +124,7 @@ test_event_rule_matches_tracepoint ()
        - name: E
          owner uid: ${uid}
          condition: event rule matches
-           rule: lemming (type: tracepoint, domain: ust, log level is WARNING)
+           rule: lemming (type: user tracepoint, log level is WARNING)
          actions:
            notify
              errors: none
@@ -132,7 +132,7 @@ test_event_rule_matches_tracepoint ()
        - name: F
          owner uid: ${uid}
          condition: event rule matches
-           rule: capture-payload-field (type: tracepoint, domain: ust)
+           rule: capture-payload-field (type: user tracepoint)
            captures:
              - a
          actions:
@@ -142,7 +142,7 @@ test_event_rule_matches_tracepoint ()
        - name: G
          owner uid: ${uid}
          condition: event rule matches
-           rule: capture-array (type: tracepoint, domain: ust)
+           rule: capture-array (type: user tracepoint)
            captures:
              - a[2]
              - \$ctx.tourlou[18]
@@ -153,7 +153,7 @@ test_event_rule_matches_tracepoint ()
        - name: H
          owner uid: ${uid}
          condition: event rule matches
-           rule: capture-chan-ctx (type: tracepoint, domain: ust)
+           rule: capture-chan-ctx (type: user tracepoint)
            captures:
              - \$ctx.vpid
          actions:
@@ -163,7 +163,7 @@ test_event_rule_matches_tracepoint ()
        - name: I
          owner uid: ${uid}
          condition: event rule matches
-           rule: capture-app-ctx (type: tracepoint, domain: ust)
+           rule: capture-app-ctx (type: user tracepoint)
            captures:
              - \$app.iga:active_clients
          actions:
@@ -173,7 +173,7 @@ test_event_rule_matches_tracepoint ()
        - name: J
          owner uid: ${uid}
          condition: event rule matches
-           rule: lemming (type: tracepoint, domain: ust)
+           rule: lemming (type: user tracepoint)
          actions:
            notify
              errors: none
@@ -217,9 +217,9 @@ test_event_rule_matches_probe ()
 
        offset_hex="0x$(printf '%x' $offset)"
 
-       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --type=kprobe --location=lttng_channel_enable --event-name=my_channel_enable --action notify
-       lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=kernel --type=kprobe --location="${base_symbol}+${offset_hex}" --event-name=my_channel_enable --action notify
-       lttng_add_trigger_ok "T2" --condition event-rule-matches --domain=kernel --type=kprobe --location="0x${channel_enable_addr}" --event-name=my_channel_enable --action notify
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --type=kprobe --location=lttng_channel_enable --event-name=my_channel_enable --action notify
+       lttng_add_trigger_ok "T1" --condition event-rule-matches --type=kprobe --location="${base_symbol}+${offset_hex}" --event-name=my_channel_enable --action notify
+       lttng_add_trigger_ok "T2" --condition event-rule-matches --type=kprobe --location="0x${channel_enable_addr}" --event-name=my_channel_enable --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
@@ -261,7 +261,7 @@ test_event_rule_matches_userspace_probe_elf ()
 
        diag "Listing event-rule-matches userspace-probe elf"
 
-       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe-elf --action notify
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --type=kernel:uprobe --location=${uprobe_elf_binary}:test_function --event-name=ma-probe-elf --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
@@ -286,7 +286,7 @@ test_event_rule_matches_userspace_probe_sdt ()
 
        diag "Listing event-rule-matches userspace-probe sdt"
 
-       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --type=kernel:uprobe --location=sdt:${uprobe_sdt_binary}:${sdt_provider_name}:${sdt_probe_name} --event-name=ma-probe-sdt --action notify
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --type=kernel:uprobe --location=sdt:${uprobe_sdt_binary}:${sdt_provider_name}:${sdt_probe_name} --event-name=ma-probe-sdt --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
@@ -308,11 +308,11 @@ test_event_rule_matches_syscall ()
 {
        diag "Listing event-rule-matches syscall"
 
-       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=kernel --type=syscall --name=open --action notify
-       lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=kernel --type=syscall:entry --name=open --action notify
-       lttng_add_trigger_ok "T2" --condition event-rule-matches --domain=kernel --type=syscall:exit --name=open --action notify
-       lttng_add_trigger_ok "T3" --condition event-rule-matches --domain=kernel --type=syscall:entry+exit --name=open --action notify
-       lttng_add_trigger_ok "T4" --condition event-rule-matches --domain=kernel --type=syscall --name=ptrace --filter 'a > 2' --action notify
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --type=syscall --name=open --action notify
+       lttng_add_trigger_ok "T1" --condition event-rule-matches --type=syscall:entry --name=open --action notify
+       lttng_add_trigger_ok "T2" --condition event-rule-matches --type=syscall:exit --name=open --action notify
+       lttng_add_trigger_ok "T3" --condition event-rule-matches --type=syscall:entry+exit --name=open --action notify
+       lttng_add_trigger_ok "T4" --condition event-rule-matches --type=syscall --name=ptrace --filter 'a > 2' --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
@@ -479,22 +479,22 @@ test_snapshot_action ()
 {
        diag "Listing snapshot actions"
 
-       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session
-       lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --path /some/path
-       lttng_add_trigger_ok "T2" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --url file:///some/other/path
-       lttng_add_trigger_ok "T3" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4
-       lttng_add_trigger_ok "T4" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4:1234:1235
-       lttng_add_trigger_ok "T5" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --ctrl-url=tcp://1.2.3.4:1111 --data-url=tcp://1.2.3.4:1112
-       lttng_add_trigger_ok "T6" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --path /some/path --max-size=1234
-       lttng_add_trigger_ok "T7" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --path /some/path --name=meh
-       lttng_add_trigger_ok "T8" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --rate-policy=every:10
-       lttng_add_trigger_ok "T9" --condition event-rule-matches --domain=user --name=some-event --action snapshot-session ze-session --rate-policy=once-after:10
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session
+       lttng_add_trigger_ok "T1" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --path /some/path
+       lttng_add_trigger_ok "T2" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --url file:///some/other/path
+       lttng_add_trigger_ok "T3" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4
+       lttng_add_trigger_ok "T4" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --url net://1.2.3.4:1234:1235
+       lttng_add_trigger_ok "T5" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --ctrl-url=tcp://1.2.3.4:1111 --data-url=tcp://1.2.3.4:1112
+       lttng_add_trigger_ok "T6" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --path /some/path --max-size=1234
+       lttng_add_trigger_ok "T7" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --path /some/path --name=meh
+       lttng_add_trigger_ok "T8" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --rate-policy=every:10
+       lttng_add_trigger_ok "T9" --condition event-rule-matches --type=user --name=some-event --action snapshot-session ze-session --rate-policy=once-after:10
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`
              errors: none
@@ -502,7 +502,7 @@ test_snapshot_action ()
        - name: T1
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`, path: /some/path
              errors: none
@@ -510,7 +510,7 @@ test_snapshot_action ()
        - name: T2
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`, path: /some/other/path
              errors: none
@@ -518,7 +518,7 @@ test_snapshot_action ()
        - name: T3
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`, url: net://1.2.3.4
              errors: none
@@ -526,7 +526,7 @@ test_snapshot_action ()
        - name: T4
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`, url: net://1.2.3.4:1234:1235
              errors: none
@@ -534,7 +534,7 @@ test_snapshot_action ()
        - name: T5
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`, control url: tcp://1.2.3.4:1111, data url: tcp://1.2.3.4:1112
              errors: none
@@ -542,7 +542,7 @@ test_snapshot_action ()
        - name: T6
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`, path: /some/path, max size: 1234
              errors: none
@@ -550,7 +550,7 @@ test_snapshot_action ()
        - name: T7
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`, path: /some/path, name: meh
              errors: none
@@ -558,7 +558,7 @@ test_snapshot_action ()
        - name: T8
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`, rate policy: every 10 occurrences
              errors: none
@@ -566,7 +566,7 @@ test_snapshot_action ()
        - name: T9
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            snapshot session \`ze-session\`, rate policy: once after 10 occurrences
              errors: none
@@ -589,14 +589,14 @@ test_snapshot_action ()
 
 test_notify_action ()
 {
-       lttng_add_trigger_ok "T0" --condition event-rule-matches --domain=user --name=some-event --action notify --rate-policy=once-after:5
-       lttng_add_trigger_ok "T1" --condition event-rule-matches --domain=user --name=some-event --action notify --rate-policy=every:10
+       lttng_add_trigger_ok "T0" --condition event-rule-matches --type=user --name=some-event --action notify --rate-policy=once-after:5
+       lttng_add_trigger_ok "T1" --condition event-rule-matches --type=user --name=some-event --action notify --rate-policy=every:10
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: T0
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            notify, rate policy: once after 5 occurrences
              errors: none
@@ -604,7 +604,7 @@ test_notify_action ()
        - name: T1
          owner uid: ${uid}
          condition: event rule matches
-           rule: some-event (type: tracepoint, domain: ust)
+           rule: some-event (type: user tracepoint)
          actions:
            notify, rate policy: every 10 occurrences
              errors: none
index e42d0743cc40bc66dfee6b809f52d70082b6584a..7bbdae226c1d38a4d89df2aa9b1cf317bb7b957c 100755 (executable)
@@ -27,9 +27,9 @@ plan_tests 17
 
 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}"
 
-tmp_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_stdout.XXXXXX)
-tmp_stderr=$(mktemp --tmpdir -t test_list_triggers_cli_stderr.XXXXXX)
-tmp_expected_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_expected_stdout.XXXXXX)
+tmp_stdout=$(mktemp --tmpdir -t test_remove_triggers_cli_stdout.XXXXXX)
+tmp_stderr=$(mktemp --tmpdir -t test_remove_triggers_cli_stderr.XXXXXX)
+tmp_expected_stdout=$(mktemp --tmpdir -t test_remove_triggers_cli_expected_stdout.XXXXXX)
 
 uid=$(id --user)
 gid=$(id --group)
@@ -68,14 +68,14 @@ function remove_trigger ()
 start_lttng_sessiond_notap
 
 # Add a few triggers
-lttng_add_trigger_ok "ABC" --condition event-rule-matches --name=aaa --domain=user --filter 'p == 2' --action notify
-lttng_add_trigger_ok "DEF" --condition event-rule-matches --domain=user --action notify
+lttng_add_trigger_ok "ABC" --condition event-rule-matches --name=aaa --type=user --filter 'p == 2' --action notify
+lttng_add_trigger_ok "DEF" --condition event-rule-matches --type=user --action notify
 
 cat > "${tmp_expected_stdout}" <<- EOF
 - name: ABC
   owner uid: ${uid}
   condition: event rule matches
-    rule: aaa (type: tracepoint, domain: ust, filter: p == 2)
+    rule: aaa (type: user tracepoint, filter: p == 2)
   actions:
     notify
       errors: none
@@ -83,7 +83,7 @@ cat > "${tmp_expected_stdout}" <<- EOF
 - name: DEF
   owner uid: ${uid}
   condition: event rule matches
-    rule: * (type: tracepoint, domain: ust)
+    rule: * (type: user tracepoint)
   actions:
     notify
       errors: none
@@ -97,7 +97,7 @@ cat > "${tmp_expected_stdout}" <<- EOF
 - name: DEF
   owner uid: ${uid}
   condition: event rule matches
-    rule: * (type: tracepoint, domain: ust)
+    rule: * (type: user tracepoint)
   actions:
     notify
       errors: none
index 5de8dd72f72e489e75f55f0959871b0e5db3ffbd..be0422cf037884533e8716ee3a065aac3f5b0da8 100755 (executable)
@@ -693,13 +693,13 @@ function test_python_trigger_notify_action
        diag "Test Python trigger with notify action"
 
        lttng_add_trigger_ok "my_python_trigger" \
-               --condition event-rule-matches --domain=python --action notify
+               --condition event-rule-matches --type=python --action notify
 
        cat > "${tmp_expected_stdout}" <<- EOF
        - name: my_python_trigger
          owner uid: ${uid}
          condition: event rule matches
-           rule: * (type: tracepoint, domain: python)
+           rule: * (type: python:logging)
          actions:
            notify
              errors: none
index cc3659572f600907c40e01d5875db2435b77e1d2..6183cd744e2d5bec0f7317f898920499b2d45227 100644 (file)
@@ -18,7 +18,7 @@
 #include <tap/tap.h>
 
 #include <lttng/event.h>
-#include <lttng/event-rule/tracepoint.h>
+#include <lttng/event-rule/user-tracepoint.h>
 #include <lttng/condition/condition-internal.h>
 #include <lttng/condition/event-rule-matches.h>
 #include <lttng/condition/event-rule-matches-internal.h>
@@ -58,21 +58,21 @@ void test_condition_event_rule(void)
                                        LTTNG_LOGLEVEL_WARNING);
        assert(log_level_rule_at_least_as_severe);
 
-       tracepoint = lttng_event_rule_tracepoint_create(LTTNG_DOMAIN_UST);
-       ok(tracepoint, "tracepoint UST_DOMAIN");
+       tracepoint = lttng_event_rule_user_tracepoint_create();
+       ok(tracepoint, "user tracepoint");
 
-       status = lttng_event_rule_tracepoint_set_name_pattern(tracepoint, pattern);
+       status = lttng_event_rule_user_tracepoint_set_name_pattern(tracepoint, pattern);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting pattern");
 
-       status = lttng_event_rule_tracepoint_set_filter(tracepoint, filter);
+       status = lttng_event_rule_user_tracepoint_set_filter(tracepoint, filter);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting filter");
 
-       status = lttng_event_rule_tracepoint_set_log_level_rule(
+       status = lttng_event_rule_user_tracepoint_set_log_level_rule(
                        tracepoint, log_level_rule_at_least_as_severe);
        ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting log level range");
 
        for (i = 0; i < 3; i++) {
-               status = lttng_event_rule_tracepoint_add_name_pattern_exclusion(
+               status = lttng_event_rule_user_tracepoint_add_name_pattern_exclusion(
                                tracepoint, exclusions[i]);
                ok(status == LTTNG_EVENT_RULE_STATUS_OK,
                                "Setting exclusion pattern");
index dc69f8da30326998625ebd06fc3032820dcb5c7a..f2514e158a5c956060e6663bc3558077aca3d69f 100644 (file)
@@ -26,8 +26,6 @@
 #include <lttng/event-rule/kernel-syscall.h>
 #include <lttng/event-rule/python-logging-internal.h>
 #include <lttng/event-rule/python-logging.h>
-#include <lttng/event-rule/tracepoint-internal.h>
-#include <lttng/event-rule/tracepoint.h>
 #include <lttng/event-rule/kernel-tracepoint-internal.h>
 #include <lttng/event-rule/kernel-tracepoint.h>
 #include <lttng/event-rule/kernel-uprobe-internal.h>
@@ -46,7 +44,7 @@ int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
 int lttng_opt_mi;
 
-#define NUM_TESTS 317
+#define NUM_TESTS 212
 
 struct tracepoint_test {
        enum lttng_domain_type type;
@@ -60,129 +58,6 @@ typedef enum lttng_event_rule_status (*event_rule_set_log_level)(
                struct lttng_event_rule *rule,
                const struct lttng_log_level_rule *log_level_rule);
 
-static
-void test_event_rule_tracepoint_by_domain(const struct tracepoint_test *test)
-{
-       unsigned int count;
-       struct lttng_event_rule *tracepoint = NULL;
-       struct lttng_event_rule *tracepoint_from_buffer = NULL;
-       enum lttng_event_rule_status status;
-       enum lttng_domain_type domain_type, type;
-       const char *pattern="my_event_*";
-       const char *filter="msg_id == 23 && size >= 2048";
-       const char *tmp;
-       const char *name_pattern_exclusions[] = {"my_event_test1", "my_event_test2" ,"my_event_test3"};
-       struct lttng_log_level_rule *log_level_rule = NULL;
-       const struct lttng_log_level_rule *log_level_rule_return = NULL;
-       struct lttng_payload payload;
-
-       type = test->type;
-       diag("Testing domain %d.", type);
-
-       lttng_payload_init(&payload);
-
-       log_level_rule = lttng_log_level_rule_exactly_create(LTTNG_LOGLEVEL_INFO);
-       assert(log_level_rule);
-
-       tracepoint = lttng_event_rule_tracepoint_create(type);
-       ok(tracepoint, "tracepoint object.");
-
-       status = lttng_event_rule_tracepoint_get_domain_type(tracepoint, &domain_type);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "get tracepoint domain.");
-       ok(domain_type == type, "domain type got %d expected %d.", domain_type, type);
-
-       status = lttng_event_rule_tracepoint_set_name_pattern(tracepoint, pattern);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "setting pattern.");
-       status = lttng_event_rule_tracepoint_get_name_pattern(tracepoint, &tmp);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting pattern.");
-       ok(!strncmp(pattern, tmp, strlen(pattern)), "pattern is equal.");
-
-       status = lttng_event_rule_tracepoint_set_filter(tracepoint, filter);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "setting filter.");
-       status = lttng_event_rule_tracepoint_get_filter(tracepoint, &tmp);
-       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting filter.");
-       ok(!strncmp(filter, tmp, strlen(filter)), "filter is equal.");
-
-       status = lttng_event_rule_tracepoint_get_log_level_rule(tracepoint, &log_level_rule_return);
-       ok(status == LTTNG_EVENT_RULE_STATUS_UNSET, "get unset log level rule.");
-
-       if (type != LTTNG_DOMAIN_KERNEL) {
-               status = lttng_event_rule_tracepoint_set_log_level_rule(tracepoint, log_level_rule);
-               ok(status == LTTNG_EVENT_RULE_STATUS_OK, "setting log level rule.");
-               status = lttng_event_rule_tracepoint_get_log_level_rule(tracepoint, &log_level_rule_return);
-               ok(status == LTTNG_EVENT_RULE_STATUS_OK, "get log level rule.");
-       }
-
-       if (test->support_name_pattern_exclusion) {
-               int i;
-
-               for (i = 0; i < 3; i++) {
-                       status = lttng_event_rule_tracepoint_add_name_pattern_exclusion(tracepoint, name_pattern_exclusions[i]);
-                       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "setting name pattern exclusions \"%s\"", name_pattern_exclusions[i]);
-               }
-
-               status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(tracepoint, &count);
-               ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting name pattern exclusion count.");
-               ok(count == 3, "count is %d/3", count);
-
-               for (i = 0; i < count; i++) {
-                       status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_at_index(tracepoint, i, &tmp);
-                       ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting name pattern exclusion at index %d.", i);
-                       ok(!strncmp(name_pattern_exclusions[i], tmp, strlen(name_pattern_exclusions[i])), "%s == %s.", tmp, name_pattern_exclusions[i]);
-               }
-       } else {
-               int i;
-
-               for (i = 0; i < 3; i++) {
-                       status = lttng_event_rule_tracepoint_add_name_pattern_exclusion(tracepoint, name_pattern_exclusions[i]);
-                       ok(status == LTTNG_EVENT_RULE_STATUS_UNSUPPORTED, "setting name pattern exclusions unsupported \"%s\".", name_pattern_exclusions[i]);
-               }
-
-               status = lttng_event_rule_tracepoint_get_name_pattern_exclusion_count(tracepoint, &count);
-               ok(status == LTTNG_EVENT_RULE_STATUS_OK, "getting name pattern exclusion count.");
-               ok(count == 0, "count is %d/0", count);
-       }
-
-       ok(lttng_event_rule_serialize(tracepoint, &payload) == 0, "Serializing.");
-
-       {
-               struct lttng_payload_view view =
-                               lttng_payload_view_from_payload(
-                                               &payload, 0, -1);
-
-               ok(lttng_event_rule_create_from_payload(
-                               &view, &tracepoint_from_buffer) > 0,
-                               "Deserializing.");
-       }
-
-       ok(lttng_event_rule_is_equal(tracepoint, tracepoint_from_buffer), "serialized and from buffer are equal.");
-
-       lttng_payload_reset(&payload);
-       lttng_event_rule_destroy(tracepoint);
-       lttng_event_rule_destroy(tracepoint_from_buffer);
-       lttng_log_level_rule_destroy(log_level_rule);
-}
-
-static
-void test_event_rule_tracepoint(void)
-{
-       int i;
-       struct lttng_event_rule *tracepoint = NULL;
-       struct tracepoint_test tests[] = {{LTTNG_DOMAIN_JUL, false},
-                       {LTTNG_DOMAIN_KERNEL, false},
-                       {LTTNG_DOMAIN_LOG4J, false},
-                       {LTTNG_DOMAIN_PYTHON, false},
-                       {LTTNG_DOMAIN_UST, true}};
-
-       diag("Testing lttng_event_rule_tracepoint.");
-       tracepoint = lttng_event_rule_tracepoint_create(LTTNG_DOMAIN_NONE);
-       ok(!tracepoint, "Domain type restriction on create.");
-
-       for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
-               test_event_rule_tracepoint_by_domain(&tests[i]);
-       }
-}
-
 static
 void test_event_rule_kernel_tracepoint(void)
 {
@@ -940,7 +815,6 @@ static void test_event_rule_log_level_python(void)
 int main(int argc, const char *argv[])
 {
        plan_tests(NUM_TESTS);
-       test_event_rule_tracepoint();
        test_event_rule_kernel_tracepoint();
        test_event_rule_user_tracepoint();
        test_event_rule_syscall();
This page took 0.084054 seconds and 4 git commands to generate.