unsigned int exclusions_count;
int i;
- event_rule_status = lttng_event_rule_tracepoint_get_pattern(
+ event_rule_status = lttng_event_rule_tracepoint_get_name_pattern(
event_rule, &pattern);
assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
}
}
-static
-void print_action_errors(const struct lttng_trigger *trigger,
- const struct lttng_action *action)
+static void print_action_errors(const struct lttng_trigger *trigger,
+ const struct lttng_action *action,
+ const uint64_t *action_path_indexes,
+ size_t action_path_length)
{
unsigned int i, count, printed_errors_count = 0;
enum lttng_error_code error_query_ret;
const char *trigger_name;
uid_t trigger_uid;
enum lttng_trigger_status trigger_status;
- struct lttng_error_query *query =
- lttng_error_query_action_create(trigger, action);
+ struct lttng_error_query *query;
+ struct lttng_action_path *action_path = lttng_action_path_create(
+ action_path_indexes, action_path_length);
+ assert(action_path);
+
+ query = lttng_error_query_action_create(trigger, action_path);
assert(query);
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
+ /*
+ * Anonymous triggers are not listed; this would be an internal error.
+ */
assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
MSG("");
lttng_error_query_destroy(query);
lttng_error_query_results_destroy(results);
+ lttng_action_path_destroy(action_path);
}
static
void print_one_action(const struct lttng_trigger *trigger,
- const struct lttng_action *action)
+ const struct lttng_action *action,
+ const uint64_t *action_path_indexes,
+ size_t action_path_length)
{
enum lttng_action_type action_type;
enum lttng_action_status action_status;
const char *value;
action_type = lttng_action_get_type(action);
- assert(action_type != LTTNG_ACTION_TYPE_GROUP);
+ assert(action_type != LTTNG_ACTION_TYPE_LIST);
switch (action_type) {
case LTTNG_ACTION_TYPE_NOTIFY:
/* The default is 1 so print only when it is a
* special case.
*/
- _MSG(", rate policy: after every %" PRIu64
+ _MSG(", rate policy: every %" PRIu64
" occurrences",
policy_value);
}
}
MSG("");
- print_action_errors(trigger, action);
+ print_action_errors(trigger, action, action_path_indexes,
+ action_path_length);
end:
return;
lttng_error_query_trigger_create(trigger);
assert(query);
-
+ /*
+ * Anonymous triggers are not listed; this would be an internal error.
+ */
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
const char *name;
uid_t trigger_uid;
+ /*
+ * Anonymous triggers are not listed since they can't be specified nor
+ * referenced through the CLI.
+ */
trigger_status = lttng_trigger_get_name(trigger, &name);
+ if (trigger_status == LTTNG_TRIGGER_STATUS_UNSET) {
+ goto end;
+ }
+
assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
action = lttng_trigger_get_const_action(trigger);
action_type = lttng_action_get_type(action);
- if (action_type == LTTNG_ACTION_TYPE_GROUP) {
+ if (action_type == LTTNG_ACTION_TYPE_LIST) {
unsigned int count, i;
enum lttng_action_status action_status;
assert(action_status == LTTNG_ACTION_STATUS_OK);
for (i = 0; i < count; i++) {
+ const uint64_t action_path_index = i;
const struct lttng_action *subaction =
lttng_action_list_get_at_index(
action, i);
_MSG(" ");
- print_one_action(trigger, subaction);
+ print_one_action(trigger, subaction, &action_path_index,
+ 1);
}
} else {
_MSG(" action:");
- print_one_action(trigger, action);
+ print_one_action(trigger, action, NULL, 0);
}
print_trigger_errors(trigger);
+end:
+ return;
}
static
const char *name_a, *name_b;
enum lttng_trigger_status trigger_status;
+ /* Anonymous triggers are not reachable here. */
trigger_status = lttng_trigger_get_name(trigger_a, &name_a);
assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
}
for (i = 0; i < num_triggers; i++) {
- const int add_ret = lttng_dynamic_pointer_array_add_pointer(
- &sorted_triggers,
- (void *) lttng_triggers_get_at_index(triggers, i));
+ int add_ret;
+ const char *unused_name;
+ const struct lttng_trigger *trigger =
+ lttng_triggers_get_at_index(triggers, i);
+
+ trigger_status = lttng_trigger_get_name(trigger, &unused_name);
+ switch (trigger_status) {
+ case LTTNG_TRIGGER_STATUS_OK:
+ break;
+ case LTTNG_TRIGGER_STATUS_UNSET:
+ /* Don't list anonymous triggers. */
+ continue;
+ default:
+ abort();
+ }
+
+ add_ret = lttng_dynamic_pointer_array_add_pointer(
+ &sorted_triggers, (void *) trigger);
if (add_ret) {
ERR("Failed to allocate array of struct lttng_trigger *.");