Assign a unique tracer token to a trigger.
This token will be used as the unique id that will be communicated back
to the sessiond by the tracers for tracer notification.
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2033dcaa4c5536b29dd4d7c57933e1aa686082cd
char *name;
/* For now only the uid portion of the credentials is used. */
struct lttng_credentials creds;
+ /*
+ * Internal use only.
+ * The unique token passed to the tracer to identify an event-rule
+ * notification.
+ */
+ LTTNG_OPTIONAL(uint64_t) tracer_token;
};
struct lttng_trigger_comm {
int lttng_trigger_assign_name(
struct lttng_trigger *dst, const struct lttng_trigger *src);
+LTTNG_HIDDEN
+void lttng_trigger_set_tracer_token(
+ struct lttng_trigger *trigger, uint64_t token);
+
+LTTNG_HIDDEN
+uint64_t lttng_trigger_get_tracer_token(const struct lttng_trigger *trigger);
+
LTTNG_HIDDEN
int lttng_trigger_generate_name(struct lttng_trigger *trigger,
uint64_t unique_id);
uid_t object_uid;
gid_t object_gid;
enum action_executor_status executor_status;
+ const uint64_t trigger_tracer_token =
+ state->trigger_id.next_tracer_token++;
rcu_read_lock();
+ /* Set the trigger's tracer token. */
+ lttng_trigger_set_tracer_token(trigger, trigger_tracer_token);
+
if (lttng_trigger_get_name(trigger, &trigger_name) ==
LTTNG_TRIGGER_STATUS_UNSET) {
const enum lttng_error_code ret_code = generate_trigger_name(
end:
*cmd_result = LTTNG_OK;
+ DBG("Registered trigger: name = `%s`, tracer token = %" PRIu64,
+ trigger_name, trigger_tracer_token);
error_put_client_list:
notification_client_list_put(client_list);
memset(state, 0, sizeof(*state));
state->notification_channel_socket = -1;
+ state->trigger_id.next_tracer_token = 1;
lttng_poll_init(&state->events);
ret = notification_channel_socket_create();
struct cds_lfht *triggers_ht;
struct cds_lfht *triggers_by_name_uid_ht;
struct {
+ uint64_t next_tracer_token;
uint64_t name_offset;
} trigger_id;
notification_client_id next_notification_client_id;
return ret;
}
+LTTNG_HIDDEN
+void lttng_trigger_set_tracer_token(struct lttng_trigger *trigger,
+ uint64_t token)
+{
+ assert(trigger);
+ LTTNG_OPTIONAL_SET(&trigger->tracer_token, token);
+}
+
+LTTNG_HIDDEN
+uint64_t lttng_trigger_get_tracer_token(const struct lttng_trigger *trigger)
+{
+ assert(trigger);
+
+ return LTTNG_OPTIONAL_GET(trigger->tracer_token);
+}
+
LTTNG_HIDDEN
int lttng_trigger_generate_name(struct lttng_trigger *trigger,
uint64_t unique_id)