lttng {add,list,remove}-trigger: rename user id to owner uid
[lttng-tools.git] / src / bin / lttng / commands / add_trigger.c
index 9ae8263c64a3a396e1b385d459ba996bf93474f1..b1ec6dd4780b11008a9583765b7ade979207e7d0 100644 (file)
@@ -40,29 +40,19 @@ enum {
        OPT_CONDITION,
        OPT_ACTION,
        OPT_ID,
-       OPT_FIRE_ONCE_AFTER,
-       OPT_FIRE_EVERY,
-       OPT_USER_ID,
+       OPT_OWNER_UID,
+       OPT_RATE_POLICY,
 
-       OPT_ALL,
+       OPT_NAME,
        OPT_FILTER,
-       OPT_EXCLUDE,
-       OPT_LOGLEVEL,
-       OPT_LOGLEVEL_ONLY,
-
-       OPT_USERSPACE,
-       OPT_KERNEL,
-       OPT_LOG4J,
-       OPT_JUL,
-       OPT_PYTHON,
-
-       OPT_FUNCTION,
-       OPT_PROBE,
-       OPT_USERSPACE_PROBE,
-       OPT_SYSCALL,
-       OPT_TRACEPOINT,
+       OPT_EXCLUDE_NAMES,
+       OPT_EVENT_NAME,
+       OPT_LOG_LEVEL,
+
+       OPT_DOMAIN,
+       OPT_TYPE,
+       OPT_LOCATION,
 
-       OPT_NAME,
        OPT_MAX_SIZE,
        OPT_DATA_URL,
        OPT_CTRL_URL,
@@ -73,25 +63,15 @@ enum {
 };
 
 static const struct argpar_opt_descr event_rule_opt_descrs[] = {
-       { OPT_ALL, 'a', "all", false },
        { OPT_FILTER, 'f', "filter", true },
-       { OPT_EXCLUDE, 'x', "exclude", true },
-       { OPT_LOGLEVEL, '\0', "loglevel", true },
-       { OPT_LOGLEVEL_ONLY, '\0', "loglevel-only", true },
-
-       /* Domains */
-       { OPT_USERSPACE, 'u', "userspace", false },
-       { OPT_KERNEL, 'k', "kernel", false },
-       { OPT_LOG4J, 'l', "log4j", false },
-       { OPT_JUL, 'j', "jul", false },
-       { OPT_PYTHON, 'p', "python", false },
-
-       /* Event rule types */
-       { OPT_FUNCTION, '\0', "function", true },
-       { OPT_PROBE, '\0', "probe", true },
-       { OPT_USERSPACE_PROBE, '\0', "userspace-probe", true },
-       { OPT_SYSCALL, '\0', "syscall" },
-       { OPT_TRACEPOINT, '\0', "tracepoint" },
+       { OPT_NAME, 'n', "name", true },
+       { OPT_EXCLUDE_NAMES, 'x', "exclude-names", true },
+       { 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 },
 
        /* Capture descriptor */
        { OPT_CAPTURE, '\0', "capture", true },
@@ -100,36 +80,72 @@ static const struct argpar_opt_descr event_rule_opt_descrs[] = {
 };
 
 static
-bool assign_domain_type(enum lttng_domain_type *dest,
-               enum lttng_domain_type src)
+bool assign_domain_type(enum lttng_domain_type *dest, const char *arg)
 {
        bool ret;
 
-       if (*dest == LTTNG_DOMAIN_NONE || *dest == src) {
-               *dest = src;
-               ret = true;
+       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;
        } else {
-               ERR("Multiple domains specified.");
-               ret = false;
+               ERR("Invalid `--domain` value: %s", arg);
+               goto error;
        }
 
+       ret = true;
+       goto end;
+
+error:
+       ret = false;
+
+end:
        return ret;
 }
 
 static
-bool assign_event_rule_type(enum lttng_event_rule_type *dest,
-               enum lttng_event_rule_type src)
+bool assign_event_rule_type(enum lttng_event_rule_type *dest, const char *arg)
 {
        bool ret;
 
-       if (*dest == LTTNG_EVENT_RULE_TYPE_UNKNOWN || *dest == src) {
-               *dest = src;
-               ret = true;
+       if (*dest != LTTNG_EVENT_RULE_TYPE_UNKNOWN) {
+               ERR("More than one `--type` was specified.");
+               goto error;
+       }
+
+       if (strcmp(arg, "tracepoint") == 0 || strcmp(arg, "logging") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_TRACEPOINT;
+       } else if (strcmp (arg, "kprobe") == 0 || strcmp(arg, "kernel-probe") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE;
+       } else if (strcmp (arg, "uprobe") == 0 || strcmp(arg, "userspace-probe") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_USERSPACE_PROBE;
+       } else if (strcmp (arg, "function") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION;
+       } else if (strcmp (arg, "syscall") == 0) {
+               *dest = LTTNG_EVENT_RULE_TYPE_SYSCALL;
        } else {
-               ERR("Multiple event types specified.");
-               ret = false;
+               ERR("Invalid `--type` value: %s", arg);
+               goto error;
        }
 
+       ret = true;
+       goto end;
+
+error:
+       ret = false;
+
+end:
        return ret;
 }
 
@@ -166,45 +182,108 @@ int create_exclusion_list_and_validate(const char *event_name,
                char ***exclusion_list);
 
 /*
- * Parse `str` as a log level in domain `domain_type`. Return -1 if the string
- * is not recognized as a valid log level.
+ * Parse `str` as a log level in domain `domain_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
+ * this log level.
+ *
+ * Return true if the string was successfully parsed as a log level string.
  */
-static
-int parse_loglevel_string(const char *str, enum lttng_domain_type domain_type)
+static bool parse_log_level_string(const char *str,
+               enum lttng_domain_type domain_type,
+               int *log_level,
+               bool *log_level_only)
 {
+       bool ret;
+
        switch (domain_type) {
        case LTTNG_DOMAIN_UST:
        {
-               enum lttng_loglevel loglevel;
-               const int ret = loglevel_name_to_value(str, &loglevel);
+               enum lttng_loglevel log_level_min, log_level_max;
+               if (!loglevel_parse_range_string(
+                                   str, &log_level_min, &log_level_max)) {
+                       goto error;
+               }
+
+               /* Only support VAL and VAL.. for now. */
+               if (log_level_min != log_level_max &&
+                               log_level_max != LTTNG_LOGLEVEL_EMERG) {
+                       goto error;
+               }
 
-               return ret == -1 ? ret : (int) loglevel;
+               *log_level = (int) log_level_min;
+               *log_level_only = log_level_min == log_level_max;
+               break;
        }
        case LTTNG_DOMAIN_LOG4J:
        {
-               enum lttng_loglevel_log4j loglevel;
-               const int ret = loglevel_log4j_name_to_value(str, &loglevel);
+               enum lttng_loglevel_log4j log_level_min, log_level_max;
+               if (!loglevel_log4j_parse_range_string(
+                                   str, &log_level_min, &log_level_max)) {
+                       goto error;
+               }
+
+               /* Only support VAL and VAL.. for now. */
+               if (log_level_min != log_level_max &&
+                               log_level_max != LTTNG_LOGLEVEL_LOG4J_FATAL) {
+                       goto error;
+               }
 
-               return ret == -1 ? ret : (int) loglevel;
+               *log_level = (int) log_level_min;
+               *log_level_only = log_level_min == log_level_max;
+               break;
        }
        case LTTNG_DOMAIN_JUL:
        {
-               enum lttng_loglevel_jul loglevel;
-               const int ret = loglevel_jul_name_to_value(str, &loglevel);
+               enum lttng_loglevel_jul log_level_min, log_level_max;
+               if (!loglevel_jul_parse_range_string(
+                                   str, &log_level_min, &log_level_max)) {
+                       goto error;
+               }
+
+               /* Only support VAL and VAL.. for now. */
+               if (log_level_min != log_level_max &&
+                               log_level_max != LTTNG_LOGLEVEL_JUL_SEVERE) {
+                       goto error;
+               }
 
-               return ret == -1 ? ret : (int) loglevel;
+               *log_level = (int) log_level_min;
+               *log_level_only = log_level_min == log_level_max;
+               break;
        }
        case LTTNG_DOMAIN_PYTHON:
        {
-               enum lttng_loglevel_python loglevel;
-               const int ret = loglevel_python_name_to_value(str, &loglevel);
+               enum lttng_loglevel_python log_level_min, log_level_max;
+               if (!loglevel_python_parse_range_string(
+                                   str, &log_level_min, &log_level_max)) {
+                       goto error;
+               }
+
+               /* Only support VAL and VAL.. for now. */
+               if (log_level_min != log_level_max &&
+                               log_level_max !=
+                                               LTTNG_LOGLEVEL_PYTHON_CRITICAL) {
+                       goto error;
+               }
 
-               return ret == -1 ? ret : (int) loglevel;
+               *log_level = (int) log_level_min;
+               *log_level_only = log_level_min == log_level_max;
+               break;
        }
        default:
                /* Invalid domain type. */
                abort();
        }
+
+       ret = true;
+       goto end;
+
+error:
+       ret = false;
+
+end:
+       return ret;
 }
 
 static int parse_kernel_probe_opts(const char *source,
@@ -541,26 +620,22 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
        struct parse_event_rule_res res = { 0 };
        struct lttng_event_expr *event_expr = NULL;
        struct filter_parser_ctx *parser_ctx = NULL;
+       struct lttng_log_level_rule *log_level_rule = NULL;
 
-       /* Was the -a/--all flag provided? */
-       bool all_events = false;
-
-       /* Tracepoint name (non-option argument). */
-       const char *tracepoint_name = NULL;
+       /* Tracepoint and syscall options. */
+       char *name = NULL;
+       char *exclude_names = NULL;
+       char **exclusion_list = NULL;
 
-       /* Holds the argument of --probe / --userspace-probe. */
-       char *source = NULL;
+       /* For userspace / kernel probe and function. */
+       char *location = NULL;
+       char *event_name = NULL;
 
        /* Filter. */
        char *filter = NULL;
 
-       /* Exclude. */
-       char *exclude = NULL;
-       char **exclusion_list = NULL;
-
        /* Log level. */
-       char *loglevel_str = NULL;
-       bool loglevel_only = false;
+       char *log_level_str = NULL;
 
        lttng_dynamic_pointer_array_init(&res.capture_descriptors,
                                destroy_event_expr);
@@ -593,107 +668,64 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
 
                        switch (item_opt->descr->id) {
                        /* Domains. */
-                       case OPT_USERSPACE:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_UST)) {
-                                       goto error;
-                               }
-
-                               break;
-                       case OPT_KERNEL:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_KERNEL)) {
+                       case OPT_DOMAIN:
+                               if (!assign_domain_type(&domain_type,
+                                               item_opt->arg)) {
                                        goto error;
                                }
 
                                break;
-                       case OPT_LOG4J:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_LOG4J)) {
-                                       goto error;
-                               }
-
-                               break;
-                       case OPT_JUL:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_JUL)) {
-                                       goto error;
-                               }
-
-                               break;
-                       case OPT_PYTHON:
-                               if (!assign_domain_type(&domain_type, LTTNG_DOMAIN_PYTHON)) {
-                                       goto error;
-                               }
-
-                               break;
-
-                       /* Event rule types */
-                       case OPT_FUNCTION:
-                               if (!assign_event_rule_type(&event_rule_type,
-                                               LTTNG_EVENT_RULE_TYPE_KRETPROBE)) {
-                                       goto error;
-                               }
-
-                               break;
-                       case OPT_PROBE:
+                       case OPT_TYPE:
                                if (!assign_event_rule_type(&event_rule_type,
-                                               LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE)) {
-                                       goto error;
-                               }
-
-                               if (!assign_string(&source, item_opt->arg, "source")) {
+                                               item_opt->arg)) {
                                        goto error;
                                }
 
                                break;
-                       case OPT_USERSPACE_PROBE:
-                               if (!assign_event_rule_type(&event_rule_type,
-                                               LTTNG_EVENT_RULE_TYPE_UPROBE)) {
+                       case OPT_LOCATION:
+                               if (!assign_string(&location,
+                                               item_opt->arg,
+                                               "--location/-L")) {
                                        goto error;
                                }
 
-                               if (!assign_string(&source, item_opt->arg, "source")) {
-                                               goto error;
-                               }
-
                                break;
-                       case OPT_SYSCALL:
-                               if (!assign_event_rule_type(&event_rule_type,
-                                               LTTNG_EVENT_RULE_TYPE_SYSCALL)) {
+                       case OPT_EVENT_NAME:
+                               if (!assign_string(&event_name,
+                                                   item_opt->arg,
+                                                   "--event-name/-E")) {
                                        goto error;
                                }
 
                                break;
-                       case OPT_TRACEPOINT:
-                               if (!assign_event_rule_type(&event_rule_type,
-                                               LTTNG_EVENT_RULE_TYPE_TRACEPOINT)) {
+                       case OPT_FILTER:
+                               if (!assign_string(&filter, item_opt->arg,
+                                                   "--filter/-f")) {
                                        goto error;
                                }
 
                                break;
-                       case OPT_ALL:
-                               all_events = true;
-                               break;
-                       case OPT_FILTER:
-                               if (!assign_string(&filter, item_opt->arg,
-                                                   "--filter/-f")) {
+                       case OPT_NAME:
+                               if (!assign_string(&name, item_opt->arg,
+                                                   "--name/-n")) {
                                        goto error;
                                }
 
                                break;
-                       case OPT_EXCLUDE:
-                               if (!assign_string(&exclude, item_opt->arg,
-                                                   "--exclude/-x")) {
+                       case OPT_EXCLUDE_NAMES:
+                               if (!assign_string(&exclude_names,
+                                                   item_opt->arg,
+                                                   "--exclude-names/-x")) {
                                        goto error;
                                }
 
                                break;
-                       case OPT_LOGLEVEL:
-                       case OPT_LOGLEVEL_ONLY:
-                               if (!assign_string(&loglevel_str, item_opt->arg,
-                                                   "--loglevel/--loglevel-only")) {
+                       case OPT_LOG_LEVEL:
+                               if (!assign_string(&log_level_str,
+                                                   item_opt->arg, "--log-level/-l")) {
                                        goto error;
                                }
 
-                               loglevel_only = item_opt->descr->id ==
-                                               OPT_LOGLEVEL_ONLY;
                                break;
                        case OPT_CAPTURE:
                        {
@@ -742,17 +774,9 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                                        (const struct argpar_item_non_opt *)
                                                        item;
 
-                       /*
-                        * Don't accept two non-option arguments/tracepoint
-                        * names.
-                        */
-                       if (tracepoint_name) {
-                               ERR("Unexpected argument '%s'",
-                                               item_non_opt->arg);
-                               goto error;
-                       }
-
-                       tracepoint_name = item_non_opt->arg;
+                       /* Don't accept non-option arguments. */
+                       ERR("Unexpected argument '%s'", item_non_opt->arg);
+                       goto error;
                }
        }
 
@@ -761,44 +785,70 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
        }
 
        /*
-        * Option -a is applicable to event rules of type tracepoint and
-        * syscall, and it is equivalent to using "*" as the tracepoint name.
+        * Option --name is applicable to event rules of type tracepoint
+        * and syscall.  For tracepoint and syscall rules, if --name is
+        * omitted, it is implicitly "*".
         */
-       if (all_events) {
-               switch (event_rule_type) {
-               case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
-               case LTTNG_EVENT_RULE_TYPE_SYSCALL:
-                       break;
-               default:
-                       ERR("Can't use -a/--all with %s event rules.",
-                                       lttng_event_rule_type_str(event_rule_type));
-                       goto error;
+       switch (event_rule_type) {
+       case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
+       case LTTNG_EVENT_RULE_TYPE_SYSCALL:
+               if (!name) {
+                       name = strdup("*");
                }
+               break;
 
-               if (tracepoint_name) {
-                       ERR("Can't provide a tracepoint name with -a/--all.");
+       default:
+               if (name) {
+                       ERR("Can't use --name with %s event rules.",
+                                       lttng_event_rule_type_str(
+                                                       event_rule_type));
                        goto error;
                }
 
-               /* In which case, it's equivalent to tracepoint name "*". */
-               tracepoint_name = "*";
+               if (exclude_names) {
+                       ERR("Can't use --exclude-names/-x with %s event rules.",
+                                       lttng_event_rule_type_str(
+                                                       event_rule_type));
+                       goto error;
+               }
        }
 
        /*
-        * A tracepoint name (or -a, for the event rule types that accept it)
-        * is required.
+        * Option --location is only applicable to (and mandatory for) event
+        * rules of type {k,u}probe and function.
+        *
+        * Option --event-name is only applicable to event rules of type probe.
+        * If omitted, it defaults to the location.
         */
-       if (!tracepoint_name) {
-               ERR("Need to provide either a tracepoint name or -a/--all.");
-               goto error;
-       }
+       switch (event_rule_type) {
+       case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE:
+       case LTTNG_EVENT_RULE_TYPE_USERSPACE_PROBE:
+       case LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION:
+               if (!location) {
+                       ERR("Event rule of type %s requires a --location.",
+                       lttng_event_rule_type_str(event_rule_type));
+                       goto error;
+               }
 
-       /*
-        * We don't support multiple tracepoint names for now.
-        */
-       if (strchr(tracepoint_name, ',')) {
-               ERR("Comma separated tracepoint names are not supported.");
-               goto error;
+               if (!event_name) {
+                       event_name = strdup(location);
+               }
+
+               break;
+
+       default:
+               if (location) {
+                       ERR("Can't use --location with %s event rules.",
+                       lttng_event_rule_type_str(event_rule_type));
+                       goto error;
+               }
+
+               if (event_name) {
+                       ERR("Can't use --event-name with %s event rules.",
+                                       lttng_event_rule_type_str(
+                                                       event_rule_type));
+                       goto error;
+               }
        }
 
        /*
@@ -811,15 +861,15 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
 
        /* Need to specify a domain. */
        if (domain_type == LTTNG_DOMAIN_NONE) {
-               ERR("Please specify a domain (--kernel/--userspace/--jul/--log4j/--python).");
+               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_PROBE:
-       case LTTNG_EVENT_RULE_TYPE_KRETPROBE:
-       case LTTNG_EVENT_RULE_TYPE_UPROBE:
+       case LTTNG_EVENT_RULE_TYPE_KERNEL_FUNCTION:
+       case LTTNG_EVENT_RULE_TYPE_USERSPACE_PROBE:
        case LTTNG_EVENT_RULE_TYPE_SYSCALL:
                if (domain_type != LTTNG_DOMAIN_KERNEL) {
                        ERR("Event type not available for user-space tracing.");
@@ -852,24 +902,30 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
        }
 
        /* If --exclude/-x was passed, split it into an exclusion list. */
-       if (exclude) {
+       if (exclude_names) {
                if (domain_type != LTTNG_DOMAIN_UST) {
                        ERR("Event name exclusions are not yet implemented for %s event rules.",
                                        get_domain_str(domain_type));
                        goto error;
                }
 
-
-               if (create_exclusion_list_and_validate(tracepoint_name, exclude,
-                               &exclusion_list) != 0) {
+               if (create_exclusion_list_and_validate(name,
+                                   exclude_names, &exclusion_list) != 0) {
                        ERR("Failed to create exclusion list.");
                        goto error;
                }
        }
 
-       if (loglevel_str && event_rule_type != LTTNG_EVENT_RULE_TYPE_TRACEPOINT) {
-               ERR("Log levels are only applicable to tracepoint event rules.");
-               goto error;
+       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;
+               }
+
+               if (domain_type == LTTNG_DOMAIN_KERNEL) {
+                       ERR("Log levels are not supported by the kernel tracer.");
+                       goto error;
+               }
        }
 
        /* Finally, create the event rule object. */
@@ -886,10 +942,10 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
 
                /* Set pattern. */
                event_rule_status = lttng_event_rule_tracepoint_set_pattern(
-                               res.er, tracepoint_name);
+                               res.er, name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set tracepoint event rule's pattern to '%s'.",
-                                       tracepoint_name);
+                                       name);
                        goto error;
                }
 
@@ -921,32 +977,36 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                        }
                }
 
-               if (loglevel_str) {
-                       int loglevel;
-
-                       if (domain_type == LTTNG_DOMAIN_KERNEL) {
-                               ERR("Log levels are not supported by the kernel tracer.");
+               /*
+                * ".." 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 (!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);
                                goto error;
                        }
 
-                       loglevel = parse_loglevel_string(
-                                       loglevel_str, domain_type);
-                       if (loglevel < 0) {
-                               ERR("Failed to parse `%s` as a log level.",
-                                               loglevel_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 (loglevel_only) {
-                               event_rule_status = lttng_event_rule_tracepoint_set_log_level(
-                                               res.er,
-                                               loglevel);
-                       } else {
-                               event_rule_status = lttng_event_rule_tracepoint_set_log_level_range_lower_bound(
-                                               res.er,
-                                               loglevel);
+                       if (log_level_rule == NULL) {
+                               ERR("Failed to create log level rule object.");
+                               goto error;
                        }
 
+                       event_rule_status =
+                                       lttng_event_rule_tracepoint_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;
@@ -960,63 +1020,55 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                int ret;
                enum lttng_event_rule_status event_rule_status;
 
-               res.er = lttng_event_rule_kernel_probe_create();
-               if (!res.er) {
-                       ERR("Failed to create kprobe event rule.");
-                       goto error;
-               }
-
-               ret = parse_kernel_probe_opts(source, &kernel_probe_location);
+               ret = parse_kernel_probe_opts(
+                               location, &kernel_probe_location);
                if (ret) {
                        ERR("Failed to parse kernel probe location.");
                        goto error;
                }
 
-               event_rule_status = lttng_event_rule_kernel_probe_set_name(res.er, tracepoint_name);
-               if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set kprobe event rule's name to '%s'.", tracepoint_name);
+               assert(kernel_probe_location);
+               res.er = lttng_event_rule_kernel_probe_create(kernel_probe_location);
+               if (!res.er) {
+                       ERR("Failed to create kprobe event rule.");
                        goto error;
                }
 
-               assert(kernel_probe_location);
-               event_rule_status = lttng_event_rule_kernel_probe_set_location(res.er, kernel_probe_location);
+               event_rule_status =
+                               lttng_event_rule_kernel_probe_set_event_name(
+                                               res.er, event_name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set kprobe event rule's location.");
+                       ERR("Failed to set kprobe event rule's name to '%s'.",
+                                       event_name);
                        goto error;
                }
 
                break;
        }
-       case LTTNG_EVENT_RULE_TYPE_UPROBE:
+       case LTTNG_EVENT_RULE_TYPE_USERSPACE_PROBE:
        {
                int ret;
                enum lttng_event_rule_status event_rule_status;
 
                ret = parse_userspace_probe_opts(
-                               source, &userspace_probe_location);
+                               location, &userspace_probe_location);
                if (ret) {
                        ERR("Failed to parse user space probe location.");
                        goto error;
                }
 
-               res.er = lttng_event_rule_uprobe_create();
+               res.er = lttng_event_rule_userspace_probe_create(userspace_probe_location);
                if (!res.er) {
                        ERR("Failed to create userspace probe event rule.");
                        goto error;
                }
 
-               event_rule_status = lttng_event_rule_uprobe_set_location(
-                               res.er, userspace_probe_location);
-               if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
-                       ERR("Failed to set user space probe event rule's location.");
-                       goto error;
-               }
-
-               event_rule_status = lttng_event_rule_uprobe_set_name(
-                               res.er, tracepoint_name);
+               event_rule_status =
+                               lttng_event_rule_userspace_probe_set_event_name(
+                                               res.er, event_name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set user space probe event rule's name to '%s'.",
-                                       tracepoint_name);
+                                       event_name);
                        goto error;
                }
 
@@ -1033,10 +1085,10 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                }
 
                event_rule_status = lttng_event_rule_syscall_set_pattern(
-                               res.er, tracepoint_name);
+                               res.er, name);
                if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
                        ERR("Failed to set syscall event rule's pattern to '%s'.",
-                                       tracepoint_name);
+                                       name);
                        goto error;
                }
 
@@ -1074,12 +1126,16 @@ end:
        free(error);
        argpar_state_destroy(state);
        free(filter);
-       free(exclude);
-       free(loglevel_str);
-       free(source);
+       free(name);
+       free(exclude_names);
+       free(log_level_str);
+       free(location);
+       free(event_name);
+
        strutils_free_null_terminated_array_of_strings(exclusion_list);
        lttng_kernel_probe_location_destroy(kernel_probe_location);
        lttng_userspace_probe_location_destroy(userspace_probe_location);
+       lttng_log_level_rule_destroy(log_level_rule);
        return res;
 }
 
@@ -1096,7 +1152,7 @@ struct lttng_condition *handle_condition_event(int *argc, const char ***argv)
                goto error;
        }
 
-       c = lttng_condition_event_rule_create(res.er);
+       c = lttng_condition_on_event_create(res.er);
        lttng_event_rule_destroy(res.er);
        res.er = NULL;
        if (!c) {
@@ -1112,7 +1168,7 @@ struct lttng_condition *handle_condition_event(int *argc, const char ***argv)
 
                assert(expr);
                assert(*expr);
-               status = lttng_condition_event_rule_append_capture_descriptor(
+               status = lttng_condition_on_event_append_capture_descriptor(
                                c, *expr);
                if (status != LTTNG_CONDITION_STATUS_OK) {
                        if (status == LTTNG_CONDITION_STATUS_UNSUPPORTED) {
@@ -1290,7 +1346,7 @@ struct condition_descr {
 
 static const
 struct condition_descr condition_descrs[] = {
-       { "on-event", handle_condition_event },
+       { "event-rule-matches", handle_condition_event },
        { "on-session-consumed-size", handle_condition_session_consumed_size },
        { "on-buffer-usage-high", handle_condition_buffer_usage_high },
        { "on-buffer-usage-low", handle_condition_buffer_usage_low },
@@ -1299,23 +1355,13 @@ struct condition_descr condition_descrs[] = {
 };
 
 static
-struct lttng_condition *parse_condition(int *argc, const char ***argv)
+struct lttng_condition *parse_condition(const char *condition_name, int *argc,
+               const char ***argv)
 {
        int i;
        struct lttng_condition *cond;
-       const char *condition_name;
        const struct condition_descr *descr = NULL;
 
-       if (*argc == 0) {
-               ERR("Missing condition name.");
-               goto error;
-       }
-
-       condition_name = (*argv)[0];
-
-       (*argc)--;
-       (*argv)++;
-
        for (i = 0; i < ARRAY_SIZE(condition_descrs); i++) {
                if (strcmp(condition_name, condition_descrs[i].name) == 0) {
                        descr = &condition_descrs[i];
@@ -1341,27 +1387,191 @@ end:
        return cond;
 }
 
-
-static
-struct lttng_action *handle_action_notify(int *argc, const char ***argv)
+static struct lttng_rate_policy *parse_rate_policy(const char *policy_str)
 {
-       return lttng_action_notify_create();
+       int num_token;
+       char **tokens = NULL;
+       struct lttng_rate_policy *policy = NULL;
+       enum lttng_rate_policy_type policy_type;
+       unsigned long long value;
+       char *policy_type_str;
+       char *policy_value_str;
+
+       assert(policy_str);
+
+       /*
+        * rate policy fields are separated by ':'.
+        */
+       tokens = strutils_split(policy_str, ':', 1);
+       num_token = strutils_array_of_strings_len(tokens);
+
+       /*
+        * Early sanity check that the number of parameter is exactly 2.
+        * i.e : type:value
+        */
+       if (num_token != 2) {
+               ERR("Rate policy format is invalid.");
+               goto end;
+       }
+
+       policy_type_str = tokens[0];
+       policy_value_str = tokens[1];
+
+       /* Parse the type. */
+       if (strcmp(policy_type_str, "once-after") == 0) {
+               policy_type = LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N;
+       } else if (strcmp(policy_type_str, "every") == 0) {
+               policy_type = LTTNG_RATE_POLICY_TYPE_EVERY_N;
+       } else {
+               ERR("Rate policy type `%s` unknown.", policy_type_str);
+               goto end;
+       }
+
+       /* Parse the value. */
+       if (utils_parse_unsigned_long_long(policy_value_str, &value) != 0) {
+               ERR("Failed to parse rate policy value `%s` as an integer.",
+                               policy_value_str);
+               goto end;
+       }
+
+       if (value == 0) {
+               ERR("Rate policy value `%s` must be > 0.", policy_value_str);
+               goto end;
+       }
+
+       switch (policy_type) {
+       case LTTNG_RATE_POLICY_TYPE_EVERY_N:
+               policy = lttng_rate_policy_every_n_create(value);
+               break;
+       case LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N:
+               policy = lttng_rate_policy_once_after_n_create(value);
+               break;
+       default:
+               abort();
+       }
+
+       if (policy == NULL) {
+               ERR("Failed to create rate policy `%s`.", policy_str);
+       }
+
+end:
+       strutils_free_null_terminated_array_of_strings(tokens);
+       return policy;
 }
 
-static const struct argpar_opt_descr no_opt_descrs[] = {
+static const struct argpar_opt_descr notify_action_opt_descrs[] = {
+       { OPT_RATE_POLICY, '\0', "rate-policy", true },
        ARGPAR_OPT_DESCR_SENTINEL
 };
 
+static
+struct lttng_action *handle_action_notify(int *argc, const char ***argv)
+{
+       struct lttng_action *action = NULL;
+       struct argpar_state *state = NULL;
+       struct argpar_item *item = NULL;
+       char *error = NULL;
+       struct lttng_rate_policy *policy = NULL;
+
+       state = argpar_state_create(*argc, *argv, notify_action_opt_descrs);
+       if (!state) {
+               ERR("Failed to allocate an argpar state.");
+               goto error;
+       }
+
+       while (true) {
+               enum argpar_state_parse_next_status status;
+
+               ARGPAR_ITEM_DESTROY_AND_RESET(item);
+               status = argpar_state_parse_next(state, &item, &error);
+               if (status == ARGPAR_STATE_PARSE_NEXT_STATUS_ERROR) {
+                       ERR("%s", error);
+                       goto error;
+               } else if (status == ARGPAR_STATE_PARSE_NEXT_STATUS_ERROR_UNKNOWN_OPT) {
+                       /* Just stop parsing here. */
+                       break;
+               } else if (status == ARGPAR_STATE_PARSE_NEXT_STATUS_END) {
+                       break;
+               }
+
+               assert(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
+
+               if (item->type == ARGPAR_ITEM_TYPE_OPT) {
+                       const struct argpar_item_opt *item_opt =
+                                       (const struct argpar_item_opt *) item;
+
+                       switch (item_opt->descr->id) {
+                       case OPT_RATE_POLICY:
+                       {
+                               policy = parse_rate_policy(item_opt->arg);
+                               if (!policy) {
+                                       goto error;
+                               }
+                               break;
+                       }
+                       default:
+                               abort();
+                       }
+               } else {
+                       const struct argpar_item_non_opt *item_non_opt;
+
+                       assert(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
+
+                       item_non_opt = (const struct argpar_item_non_opt *) item;
+
+                       switch (item_non_opt->non_opt_index) {
+                       default:
+                               ERR("Unexpected argument `%s`.",
+                                               item_non_opt->arg);
+                               goto error;
+                       }
+               }
+       }
+
+       *argc -= argpar_state_get_ingested_orig_args(state);
+       *argv += argpar_state_get_ingested_orig_args(state);
+
+       action = lttng_action_notify_create();
+       if (!action) {
+               ERR("Failed to create notify action");
+               goto error;
+       }
+
+       if (policy) {
+               enum lttng_action_status status;
+               status = lttng_action_notify_set_rate_policy(action, policy);
+               if (status != LTTNG_ACTION_STATUS_OK) {
+                       ERR("Failed to set rate policy");
+                       goto error;
+               }
+       }
+
+       goto end;
+
+error:
+       lttng_action_destroy(action);
+       action = NULL;
+end:
+       free(error);
+       lttng_rate_policy_destroy(policy);
+       argpar_state_destroy(state);
+       argpar_item_destroy(item);
+       return action;
+}
+
 /*
- * Generic handler for a kind of action that takes a session name as its sole
- * argument.
+ * Generic handler for a kind of action that takes a session name and an
+ * optional rate policy.
  */
 
-static
-struct lttng_action *handle_action_simple_session(
-               int *argc, const char ***argv,
+static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
+               const char ***argv,
                struct lttng_action *(*create_action_cb)(void),
-               enum lttng_action_status (*set_session_name_cb)(struct lttng_action *, const char *),
+               enum lttng_action_status (*set_session_name_cb)(
+                               struct lttng_action *, const char *),
+               enum lttng_action_status (*set_rate_policy_cb)(
+                               struct lttng_action *,
+                               const struct lttng_rate_policy *),
                const char *action_name)
 {
        struct lttng_action *action = NULL;
@@ -1370,8 +1580,17 @@ struct lttng_action *handle_action_simple_session(
        const char *session_name_arg = NULL;
        char *error = NULL;
        enum lttng_action_status action_status;
+       struct lttng_rate_policy *policy = NULL;
+
+       assert(set_session_name_cb);
+       assert(set_rate_policy_cb);
 
-       state = argpar_state_create(*argc, *argv, no_opt_descrs);
+       const struct argpar_opt_descr rate_policy_opt_descrs[] = {
+               { OPT_RATE_POLICY, '\0', "rate-policy", true },
+               ARGPAR_OPT_DESCR_SENTINEL
+       };
+       
+       state = argpar_state_create(*argc, *argv, rate_policy_opt_descrs);
        if (!state) {
                ERR("Failed to allocate an argpar state.");
                goto error;
@@ -1379,14 +1598,14 @@ struct lttng_action *handle_action_simple_session(
 
        while (true) {
                enum argpar_state_parse_next_status status;
-               const struct argpar_item_non_opt *item_non_opt;
 
                ARGPAR_ITEM_DESTROY_AND_RESET(item);
                status = argpar_state_parse_next(state, &item, &error);
                if (status == ARGPAR_STATE_PARSE_NEXT_STATUS_ERROR) {
                        ERR("%s", error);
                        goto error;
-               } else if (status == ARGPAR_STATE_PARSE_NEXT_STATUS_ERROR_UNKNOWN_OPT) {
+               } else if (status ==
+                               ARGPAR_STATE_PARSE_NEXT_STATUS_ERROR_UNKNOWN_OPT) {
                        /* Just stop parsing here. */
                        break;
                } else if (status == ARGPAR_STATE_PARSE_NEXT_STATUS_END) {
@@ -1394,17 +1613,35 @@ struct lttng_action *handle_action_simple_session(
                }
 
                assert(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
-               assert(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
+               if (item->type == ARGPAR_ITEM_TYPE_OPT) {
+                       const struct argpar_item_opt *item_opt =
+                                       (const struct argpar_item_opt *) item;
 
-               item_non_opt = (const struct argpar_item_non_opt *) item;
+                       switch (item_opt->descr->id) {
+                       case OPT_RATE_POLICY:
+                       {
+                               policy = parse_rate_policy(item_opt->arg);
+                               if (!policy) {
+                                       goto error;
+                               }
+                               break;
+                       }
+                       default:
+                               abort();
+                       }
+               } else {
+                       const struct argpar_item_non_opt *item_non_opt;
+                       item_non_opt = (const struct argpar_item_non_opt *) item;
 
-               switch (item_non_opt->non_opt_index) {
-               case 0:
-                       session_name_arg = item_non_opt->arg;
-                       break;
-               default:
-                       ERR("Unexpected argument `%s`.", item_non_opt->arg);
-                       goto error;
+                       switch (item_non_opt->non_opt_index) {
+                       case 0:
+                               session_name_arg = item_non_opt->arg;
+                               break;
+                       default:
+                               ERR("Unexpected argument `%s`.",
+                                               item_non_opt->arg);
+                               goto error;
+                       }
                }
        }
 
@@ -1429,6 +1666,14 @@ struct lttng_action *handle_action_simple_session(
                goto error;
        }
 
+       if (policy) {
+               action_status = set_rate_policy_cb(action, policy);
+               if (action_status != LTTNG_ACTION_STATUS_OK) {
+                       ERR("Failed to set rate policy");
+                       goto error;
+               }
+       }
+
        goto end;
 
 error:
@@ -1436,6 +1681,7 @@ error:
        action = NULL;
        argpar_item_destroy(item);
 end:
+       lttng_rate_policy_destroy(policy);
        free(error);
        argpar_state_destroy(state);
        return action;
@@ -1445,29 +1691,30 @@ static
 struct lttng_action *handle_action_start_session(int *argc,
                const char ***argv)
 {
-       return handle_action_simple_session(argc, argv,
-               lttng_action_start_session_create,
-               lttng_action_start_session_set_session_name,
-               "start");
+       return handle_action_simple_session_with_policy(argc, argv,
+                       lttng_action_start_session_create,
+                       lttng_action_start_session_set_session_name,
+                       lttng_action_start_session_set_rate_policy, "start");
 }
 
 static
 struct lttng_action *handle_action_stop_session(int *argc,
                const char ***argv)
 {
-       return handle_action_simple_session(argc, argv,
-               lttng_action_stop_session_create,
-               lttng_action_stop_session_set_session_name,
-               "stop");
+       return handle_action_simple_session_with_policy(argc, argv,
+                       lttng_action_stop_session_create,
+                       lttng_action_stop_session_set_session_name,
+                       lttng_action_stop_session_set_rate_policy, "stop");
 }
 
 static
 struct lttng_action *handle_action_rotate_session(int *argc,
                const char ***argv)
 {
-       return handle_action_simple_session(argc, argv,
+       return handle_action_simple_session_with_policy(argc, argv,
                lttng_action_rotate_session_create,
                lttng_action_rotate_session_set_session_name,
+               lttng_action_rotate_session_set_rate_policy,
                "rotate");
 }
 
@@ -1478,6 +1725,7 @@ static const struct argpar_opt_descr snapshot_action_opt_descrs[] = {
        { OPT_DATA_URL, '\0', "data-url", true },
        { OPT_URL, '\0', "url", true },
        { OPT_PATH, '\0', "path", true },
+       { OPT_RATE_POLICY, '\0', "rate-policy", true },
        ARGPAR_OPT_DESCR_SENTINEL
 };
 
@@ -1498,6 +1746,7 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
        char *error = NULL;
        enum lttng_action_status action_status;
        struct lttng_snapshot_output *snapshot_output = NULL;
+       struct lttng_rate_policy *policy = NULL;
        int ret;
        unsigned int locations_specified = 0;
 
@@ -1565,6 +1814,14 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                                }
 
                                break;
+                       case OPT_RATE_POLICY:
+                       {
+                               policy = parse_rate_policy(item_opt->arg);
+                               if (!policy) {
+                                       goto error;
+                               }
+                               break;
+                       }
                        default:
                                abort();
                        }
@@ -1749,6 +2006,16 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                snapshot_output = NULL;
        }
 
+       if (policy) {
+               enum lttng_action_status status;
+               status = lttng_action_snapshot_session_set_rate_policy(
+                               action, policy);
+               if (status != LTTNG_ACTION_STATUS_OK) {
+                       ERR("Failed to set rate policy");
+                       goto error;
+               }
+       }
+
        goto end;
 
 error:
@@ -1763,6 +2030,7 @@ end:
        free(data_url_arg);
        free(snapshot_output);
        free(max_size_arg);
+       lttng_rate_policy_destroy(policy);
        argpar_state_destroy(state);
        argpar_item_destroy(item);
        return action;
@@ -1783,23 +2051,12 @@ struct action_descr action_descrs[] = {
 };
 
 static
-struct lttng_action *parse_action(int *argc, const char ***argv)
+struct lttng_action *parse_action(const char *action_name, int *argc, const char ***argv)
 {
        int i;
        struct lttng_action *action;
-       const char *action_name;
        const struct action_descr *descr = NULL;
 
-       if (*argc == 0) {
-               ERR("Missing action name.");
-               goto error;
-       }
-
-       action_name = (*argv)[0];
-
-       (*argc)--;
-       (*argv)++;
-
        for (i = 0; i < ARRAY_SIZE(action_descrs); i++) {
                if (strcmp(action_name, action_descrs[i].name) == 0) {
                        descr = &action_descrs[i];
@@ -1829,12 +2086,10 @@ static const
 struct argpar_opt_descr add_trigger_options[] = {
        { OPT_HELP, 'h', "help", false },
        { OPT_LIST_OPTIONS, '\0', "list-options", false },
-       { OPT_CONDITION, '\0', "condition", false },
-       { OPT_ACTION, '\0', "action", false },
-       { OPT_ID, '\0', "id", true },
-       { OPT_FIRE_ONCE_AFTER, '\0', "fire-once-after", true },
-       { OPT_FIRE_EVERY, '\0', "fire-every", true },
-       { OPT_USER_ID, '\0', "user-id", true },
+       { OPT_CONDITION, '\0', "condition", true },
+       { OPT_ACTION, '\0', "action", true },
+       { OPT_NAME, '\0', "name", true },
+       { OPT_OWNER_UID, '\0', "owner-uid", true },
        ARGPAR_OPT_DESCR_SENTINEL,
 };
 
@@ -1859,11 +2114,9 @@ int cmd_add_trigger(int argc, const char **argv)
        struct lttng_action *action = NULL;
        struct lttng_trigger *trigger = NULL;
        char *error = NULL;
-       char *id = NULL;
+       char *name = NULL;
        int i;
-       char *fire_once_after_str = NULL;
-       char *fire_every_str = NULL;
-       char *user_id = NULL;
+       char *owner_uid = NULL;
 
        lttng_dynamic_pointer_array_init(&actions, lttng_actions_destructor);
 
@@ -1927,7 +2180,7 @@ int cmd_add_trigger(int argc, const char **argv)
                                goto error;
                        }
 
-                       condition = parse_condition(&my_argc, &my_argv);
+                       condition = parse_condition(item_opt->arg, &my_argc, &my_argv);
                        if (!condition) {
                                /*
                                 * An error message was already printed by
@@ -1940,7 +2193,7 @@ int cmd_add_trigger(int argc, const char **argv)
                }
                case OPT_ACTION:
                {
-                       action = parse_action(&my_argc, &my_argv);
+                       action = parse_action(item_opt->arg, &my_argc, &my_argv);
                        if (!action) {
                                /*
                                 * An error message was already printed by
@@ -1961,36 +2214,18 @@ int cmd_add_trigger(int argc, const char **argv)
 
                        break;
                }
-               case OPT_ID:
-               {
-                       if (!assign_string(&id, item_opt->arg, "--id")) {
-                               goto error;
-                       }
-
-                       break;
-               }
-               case OPT_FIRE_ONCE_AFTER:
-               {
-                       if (!assign_string(&fire_once_after_str, item_opt->arg,
-                                       "--fire-once-after")) {
-                               goto error;
-                       }
-
-                       break;
-               }
-               case OPT_FIRE_EVERY:
+               case OPT_NAME:
                {
-                       if (!assign_string(&fire_every_str, item_opt->arg,
-                                       "--fire-every")) {
+                       if (!assign_string(&name, item_opt->arg, "--name")) {
                                goto error;
                        }
 
                        break;
                }
-               case OPT_USER_ID:
+               case OPT_OWNER_UID:
                {
-                       if (!assign_string(&user_id, item_opt->arg,
-                                       "--user-id")) {
+                       if (!assign_string(&owner_uid, item_opt->arg,
+                                       "--owner-uid")) {
                                goto error;
                        }
 
@@ -2011,11 +2246,6 @@ int cmd_add_trigger(int argc, const char **argv)
                goto error;
        }
 
-       if (fire_every_str && fire_once_after_str) {
-               ERR("Can't specify both --fire-once-after and --fire-every.");
-               goto error;
-       }
-
        action_group = lttng_action_group_create();
        if (!action_group) {
                goto error;
@@ -2044,60 +2274,25 @@ int cmd_add_trigger(int argc, const char **argv)
                goto error;
        }
 
-       if (id) {
+       if (name) {
                enum lttng_trigger_status trigger_status =
-                               lttng_trigger_set_name(trigger, id);
-
-               if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
-                       ERR("Failed to set trigger id.");
-                       goto error;
-               }
-       }
-
-       if (fire_once_after_str) {
-               unsigned long long threshold;
-               enum lttng_trigger_status trigger_status;
-
-               if (utils_parse_unsigned_long_long(fire_once_after_str, &threshold) != 0) {
-                       ERR("Failed to parse `%s` as an integer.", fire_once_after_str);
-                       goto error;
-               }
-
-               trigger_status = lttng_trigger_set_firing_policy(trigger,
-                               LTTNG_TRIGGER_FIRING_POLICY_ONCE_AFTER_N,
-                               threshold);
-               if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
-                       ERR("Failed to set trigger's policy to `fire once after N`.");
-                       goto error;
-               }
-       }
-
-       if (fire_every_str) {
-               unsigned long long threshold;
-               enum lttng_trigger_status trigger_status;
-
-               if (utils_parse_unsigned_long_long(fire_every_str, &threshold) != 0) {
-                       ERR("Failed to parse `%s` as an integer.", fire_every_str);
-                       goto error;
-               }
+                               lttng_trigger_set_name(trigger, name);
 
-               trigger_status = lttng_trigger_set_firing_policy(trigger,
-                               LTTNG_TRIGGER_FIRING_POLICY_EVERY_N, threshold);
                if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
-                       ERR("Failed to set trigger's policy to `fire every N`.");
+                       ERR("Failed to set trigger name.");
                        goto error;
                }
        }
 
-       if (user_id) {
+       if (owner_uid) {
                enum lttng_trigger_status trigger_status;
                char *end;
                long long uid;
 
                errno = 0;
-               uid = strtol(user_id, &end, 10);
-               if (end == user_id || *end != '\0' || errno != 0) {
-                       ERR("Failed to parse `%s` as a user id.", user_id);
+               uid = strtol(owner_uid, &end, 10);
+               if (end == owner_uid || *end != '\0' || errno != 0) {
+                       ERR("Failed to parse `%s` as a user id.", owner_uid);
                }
 
                trigger_status = lttng_trigger_set_owner_uid(trigger, uid);
@@ -2129,9 +2324,7 @@ end:
        lttng_action_destroy(action);
        lttng_trigger_destroy(trigger);
        free(error);
-       free(id);
-       free(fire_once_after_str);
-       free(fire_every_str);
-       free(user_id);
+       free(name);
+       free(owner_uid);
        return ret;
 }
This page took 0.04091 seconds and 4 git commands to generate.