struct lttng_dynamic_pointer_array actions;
struct argpar_state *argpar_state = NULL;
struct argpar_item *argpar_item = NULL;
- struct lttng_action *action_group = NULL;
+ struct lttng_action *action_list = NULL;
struct lttng_action *action = NULL;
struct lttng_trigger *trigger = NULL;
char *error = NULL;
char *name = NULL;
int i;
char *owner_uid = NULL;
+ enum lttng_error_code ret_code;
lttng_dynamic_pointer_array_init(&actions, lttng_actions_destructor);
goto error;
}
- action_group = lttng_action_group_create();
- if (!action_group) {
+ action_list = lttng_action_list_create();
+ if (!action_list) {
goto error;
}
action = lttng_dynamic_pointer_array_steal_pointer(&actions, i);
- status = lttng_action_group_add_action(action_group, action);
+ status = lttng_action_list_add_action(action_list, action);
if (status != LTTNG_ACTION_STATUS_OK) {
goto error;
}
/*
- * The `lttng_action_group_add_action()` takes a reference to
+ * The `lttng_action_list_add_action()` takes a reference to
* the action. We can destroy ours.
*/
lttng_action_destroy(action);
action = NULL;
}
- trigger = lttng_trigger_create(condition, action_group);
+ trigger = lttng_trigger_create(condition, action_list);
if (!trigger) {
goto error;
}
- if (name) {
- enum lttng_trigger_status trigger_status =
- lttng_trigger_set_name(trigger, name);
-
- if (trigger_status != LTTNG_TRIGGER_STATUS_OK) {
- ERR("Failed to set trigger name.");
- goto error;
- }
- }
-
if (owner_uid) {
enum lttng_trigger_status trigger_status;
char *end;
}
}
- ret = lttng_register_trigger(trigger);
- if (ret) {
- ERR("Failed to register trigger: %s.", lttng_strerror(ret));
+ if (name) {
+ ret_code = lttng_register_trigger_with_name(trigger, name);
+ } else {
+ ret_code = lttng_register_trigger_with_automatic_name(trigger);
+ }
+
+ if (ret_code != LTTNG_OK) {
+ ERR("Failed to register trigger: %s.",
+ lttng_strerror(-ret_code));
goto error;
}
MSG("Trigger registered successfully.");
+ ret = 0;
goto end;
argpar_item_destroy(argpar_item);
lttng_dynamic_pointer_array_reset(&actions);
lttng_condition_destroy(condition);
- lttng_action_destroy(action_group);
+ lttng_action_destroy(action_list);
lttng_action_destroy(action);
lttng_trigger_destroy(trigger);
free(error);