#include <common/macros.h>
#include <common/optional.h>
#include <lttng/action/action-internal.h>
-#include <lttng/action/group-internal.h>
-#include <lttng/action/group.h>
+#include <lttng/action/list-internal.h>
+#include <lttng/action/list.h>
#include <lttng/action/notify-internal.h>
#include <lttng/action/notify.h>
#include <lttng/action/rotate-session.h>
#include <lttng/action/start-session.h>
#include <lttng/action/stop-session.h>
#include <lttng/condition/evaluation.h>
-#include <lttng/condition/on-event-internal.h>
+#include <lttng/condition/event-rule-matches-internal.h>
#include <lttng/lttng-error.h>
#include <lttng/trigger/trigger-internal.h>
#include <pthread.h>
struct action_executor *executor,
const struct action_work_item *,
struct action_work_subitem *);
-static int action_executor_group_handler(struct action_executor *executor,
+static int action_executor_list_handler(struct action_executor *executor,
const struct action_work_item *,
struct action_work_subitem *);
static int action_executor_generic_handler(struct action_executor *executor,
[LTTNG_ACTION_TYPE_STOP_SESSION] = action_executor_stop_session_handler,
[LTTNG_ACTION_TYPE_ROTATE_SESSION] = action_executor_rotate_session_handler,
[LTTNG_ACTION_TYPE_SNAPSHOT_SESSION] = action_executor_snapshot_session_handler,
- [LTTNG_ACTION_TYPE_GROUP] = action_executor_group_handler,
+ [LTTNG_ACTION_TYPE_LIST] = action_executor_list_handler,
};
/* Forward declaration */
enum lttng_trigger_status trigger_status;
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ switch (trigger_status) {
+ case LTTNG_TRIGGER_STATUS_OK:
+ break;
+ case LTTNG_TRIGGER_STATUS_UNSET:
+ trigger_name = "(anonymous)";
+ break;
+ default:
+ trigger_name = "(failed to get name)";
+ break;
+ }
return trigger_name;
}
return ret;
}
-static int action_executor_group_handler(struct action_executor *executor,
+static int action_executor_list_handler(struct action_executor *executor,
const struct action_work_item *work_item,
struct action_work_subitem *item)
{
- ERR("Execution of a group action by the action executor should never occur");
+ ERR("Execution of a list action by the action executor should never occur");
abort();
}
uid_t trigger_owner_uid;
enum lttng_trigger_status trigger_status;
- trigger_status = lttng_trigger_get_name(
- work_item->trigger, &trigger_name);
- switch (trigger_status) {
- case LTTNG_TRIGGER_STATUS_OK:
- break;
- case LTTNG_TRIGGER_STATUS_UNSET:
- trigger_name = "(unset)";
- break;
- default:
- abort();
- }
+ trigger_name = get_trigger_name(work_item->trigger);
trigger_status = lttng_trigger_get_owner_uid(
work_item->trigger, &trigger_owner_uid);
assert(action);
assert(subitems);
- if (type == LTTNG_ACTION_TYPE_GROUP) {
+ if (type == LTTNG_ACTION_TYPE_LIST) {
unsigned int count, i;
- status = lttng_action_group_get_count(action, &count);
+ status = lttng_action_list_get_count(action, &count);
assert(status == LTTNG_ACTION_STATUS_OK);
for (i = 0; i < count; i++) {
struct lttng_action *inner_action = NULL;
- inner_action = lttng_action_group_borrow_mutable_at_index(
+ inner_action = lttng_action_list_borrow_mutable_at_index(
action, i);
assert(inner_action);
ret = add_action_to_subitem_array(
/*
* Go directly to the end since there is no need to add the
- * group action by itself to the subitems array.
+ * list action by itself to the subitems array.
*/
goto end;
}
action, &session_name);
assert(status == LTTNG_ACTION_STATUS_OK);
break;
- case LTTNG_ACTION_TYPE_GROUP:
+ case LTTNG_ACTION_TYPE_LIST:
case LTTNG_ACTION_TYPE_UNKNOWN:
/* Fallthrough */
default:
* simplicity and consistency.
*/
if (session_name != NULL) {
- struct ltt_session *session = NULL;
+ uint64_t session_id;
- session_lock_list();
- session = session_find_by_name(session_name);
- if (session) {
+ /*
+ * Instantaneous sampling of the session id if present.
+ *
+ * This method is preferred over `sessiond_find_by_name` then
+ * fetching the session'd id since `sessiond_find_by_name`
+ * requires the session list lock to be taken.
+ *
+ * Taking the session list lock can lead to a deadlock
+ * between the action executor and the notification thread
+ * (caller of add_action_to_subitem_array). It is okay if the
+ * session state changes between the enqueuing time and the
+ * execution time. The execution context is validated at
+ * execution time.
+ */
+ if (sample_session_id_by_name(session_name, &session_id)) {
LTTNG_OPTIONAL_SET(&subitem.context.session_id,
- session->id);
- session_put(session);
+ session_id);
}
-
- session_unlock_list();
}
/* Get a reference to the action. */