char padding[LTTNG_UST_CTX_PADDING];
};
-#define LTTNG_UST_EVENT_DESC_PADDING 40
-struct lttng_event_desc {
+/*
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+struct lttng_ust_event_desc {
+ uint32_t struct_size; /* Size of this structure. */
const char *name;
void (*probe_callback)(void);
const struct lttng_event_ctx *ctx; /* context */
const struct lttng_event_field *fields; /* event payload */
unsigned int nr_fields;
const int **loglevel;
- const char *signature; /* Argument types/names received */
- union {
- struct {
- const char **model_emf_uri;
- } ext;
- char padding[LTTNG_UST_EVENT_DESC_PADDING];
- } u;
+ const char *signature; /* Argument types/names received */
+ const char **model_emf_uri;
+
+ /* End of base ABI. Fields below should be used after checking struct_size. */
};
-#define LTTNG_UST_PROBE_DESC_PADDING 12
-struct lttng_probe_desc {
+/*
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ *
+ * The field @struct_size should be used to determine the size of the
+ * structure. It should be queried before using additional fields added
+ * at the end of the structure.
+ */
+struct lttng_ust_probe_desc {
+ uint32_t struct_size; /* Size of this structure. */
+
const char *provider;
- const struct lttng_event_desc **event_desc;
+ const struct lttng_ust_event_desc **event_desc;
unsigned int nr_events;
struct cds_list_head head; /* chain registered probes */
struct cds_list_head lazy_init_head;
int lazy; /* lazy registration */
uint32_t major;
uint32_t minor;
- char padding[LTTNG_UST_PROBE_DESC_PADDING];
+
+ /* End of base ABI. Fields below should be used after checking struct_size. */
};
/* Data structures used by the tracer. */
/* End of base ABI. Fields below should be used after checking struct_size. */
};
-int lttng_probe_register(struct lttng_probe_desc *desc);
-void lttng_probe_unregister(struct lttng_probe_desc *desc);
+int lttng_ust_probe_register(struct lttng_ust_probe_desc *desc);
+void lttng_ust_probe_unregister(struct lttng_ust_probe_desc *desc);
/*
* Can be used by applications that change their procname to clear the ust cached value.
static const char * \
__ref_model_emf_uri___##_provider##___##_name \
__attribute__((weakref ("_model_emf_uri___" #_provider "___" #_name)));\
-static const struct lttng_event_desc __event_desc___##_provider##_##_name = { \
+static const struct lttng_ust_event_desc __event_desc___##_provider##_##_name = { \
+ .struct_size = sizeof(struct lttng_ust_event_desc), \
.name = #_provider ":" #_name, \
- .probe_callback = (void (*)(void)) &__event_probe__##_provider##___##_template,\
+ .probe_callback = (void (*)(void)) &__event_probe__##_provider##___##_template, \
.ctx = NULL, \
.fields = __event_fields___##_provider##___##_template, \
.nr_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_template) - 1, \
.loglevel = &__ref_loglevel___##_provider##___##_name, \
.signature = __tp_event_signature___##_provider##___##_template, \
- .u = { \
- .ext = { \
- .model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name, \
- }, \
- }, \
+ .model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name, \
};
#include TRACEPOINT_INCLUDE
#define _TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
&__event_desc___##_provider##_##_name,
-static const struct lttng_event_desc *_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = {
+static const struct lttng_ust_event_desc *_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = {
#include TRACEPOINT_INCLUDE
NULL, /* Dummy, C99 forbids 0-len array. */
};
*/
/* non-const because list head will be modified when registered. */
-static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER) = {
+static struct lttng_ust_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER) = {
+ .struct_size = sizeof(struct lttng_ust_probe_desc),
.provider = __tp_stringify(TRACEPOINT_PROVIDER),
.event_desc = _TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER),
.nr_events = _TP_ARRAY_SIZE(_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)) - 1,
* error will appear.
*/
_TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)();
- ret = lttng_probe_register(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
+ ret = lttng_ust_probe_register(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
if (ret) {
fprintf(stderr, "LTTng-UST: Error (%d) while registering tracepoint probe.\n", ret);
abort();
TRACEPOINT_PROVIDER)) {
return;
}
- lttng_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
+ lttng_ust_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
}
int _TP_COMBINE_TOKENS(__tracepoint_provider_, TRACEPOINT_PROVIDER)
return ret;
}
-static int specialize_payload_lookup(const struct lttng_event_desc *event_desc,
+static int specialize_payload_lookup(const struct lttng_ust_event_desc *event_desc,
struct bytecode_runtime *runtime,
struct load_op *insn,
struct vstack_load *load)
return ret;
}
-int lttng_bytecode_specialize(const struct lttng_event_desc *event_desc,
+int lttng_bytecode_specialize(const struct lttng_ust_event_desc *event_desc,
struct bytecode_runtime *bytecode)
{
void *pc, *next_pc, *start_pc;
}
static
-int apply_field_reloc(const struct lttng_event_desc *event_desc,
+int apply_field_reloc(const struct lttng_ust_event_desc *event_desc,
struct bytecode_runtime *runtime,
uint32_t runtime_len,
uint32_t reloc_offset,
}
static
-int apply_reloc(const struct lttng_event_desc *event_desc,
+int apply_reloc(const struct lttng_ust_event_desc *event_desc,
struct bytecode_runtime *runtime,
uint32_t runtime_len,
uint32_t reloc_offset,
* bytecode runtime.
*/
static
-int link_bytecode(const struct lttng_event_desc *event_desc,
+int link_bytecode(const struct lttng_ust_event_desc *event_desc,
struct lttng_ctx **ctx,
struct lttng_ust_bytecode_node *bytecode,
struct cds_list_head *bytecode_runtime_head,
* This function is called after we confirmed that name enabler and the
* instance are name matching (or glob pattern matching).
*/
-void lttng_enabler_link_bytecode(const struct lttng_event_desc *event_desc,
+void lttng_enabler_link_bytecode(const struct lttng_ust_event_desc *event_desc,
struct lttng_ctx **ctx,
struct cds_list_head *instance_bytecode_head,
struct cds_list_head *enabler_bytecode_head)
LTTNG_HIDDEN
int lttng_bytecode_validate(struct bytecode_runtime *bytecode);
LTTNG_HIDDEN
-int lttng_bytecode_specialize(const struct lttng_event_desc *event_desc,
+int lttng_bytecode_specialize(const struct lttng_ust_event_desc *event_desc,
struct bytecode_runtime *bytecode);
LTTNG_HIDDEN
void register_event(struct lttng_ust_event_common *event)
{
int ret;
- const struct lttng_event_desc *desc;
+ const struct lttng_ust_event_desc *desc;
assert(event->priv->registered == 0);
desc = event->priv->desc;
void unregister_event(struct lttng_ust_event_common *event)
{
int ret;
- const struct lttng_event_desc *desc;
+ const struct lttng_ust_event_desc *desc;
assert(event->priv->registered == 1);
desc = event->priv->desc;
struct cds_hlist_head *borrow_hash_table_bucket(
struct cds_hlist_head *hash_table,
unsigned int hash_table_size,
- const struct lttng_event_desc *desc)
+ const struct lttng_ust_event_desc *desc)
{
const char *event_name;
size_t name_len;
* Supports event creation while tracing session is active.
*/
static
-int lttng_event_recorder_create(const struct lttng_event_desc *desc,
+int lttng_event_recorder_create(const struct lttng_ust_event_desc *desc,
struct lttng_channel *chan)
{
struct lttng_ust_event_recorder *event_recorder;
loglevel = *(*event_recorder->parent->priv->desc->loglevel);
else
loglevel = TRACE_DEFAULT;
- if (desc->u.ext.model_emf_uri)
- uri = *(desc->u.ext.model_emf_uri);
+ if (desc->model_emf_uri)
+ uri = *(desc->model_emf_uri);
else
uri = NULL;
}
static
-int lttng_event_notifier_create(const struct lttng_event_desc *desc,
+int lttng_event_notifier_create(const struct lttng_ust_event_desc *desc,
uint64_t token, uint64_t error_counter_index,
struct lttng_event_notifier_group *event_notifier_group)
{
}
static
-int lttng_desc_match_star_glob_enabler(const struct lttng_event_desc *desc,
+int lttng_desc_match_star_glob_enabler(const struct lttng_ust_event_desc *desc,
struct lttng_enabler *enabler)
{
int loglevel = 0;
}
static
-int lttng_desc_match_event_enabler(const struct lttng_event_desc *desc,
+int lttng_desc_match_event_enabler(const struct lttng_ust_event_desc *desc,
struct lttng_enabler *enabler)
{
int loglevel = 0;
}
static
-int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
+int lttng_desc_match_enabler(const struct lttng_ust_event_desc *desc,
struct lttng_enabler *enabler)
{
switch (enabler->format_type) {
void lttng_create_event_recorder_if_missing(struct lttng_event_enabler *event_enabler)
{
struct lttng_session *session = event_enabler->chan->session;
- struct lttng_probe_desc *probe_desc;
- const struct lttng_event_desc *desc;
+ struct lttng_ust_probe_desc *probe_desc;
+ const struct lttng_ust_event_desc *desc;
struct lttng_ust_event_recorder_private *event_recorder_priv;
int i;
struct cds_list_head *probe_list;
}
static
-void probe_provider_event_for_each(struct lttng_probe_desc *provider_desc,
+void probe_provider_event_for_each(struct lttng_ust_probe_desc *provider_desc,
void (*event_func)(struct lttng_ust_event_common *event))
{
struct cds_hlist_node *node, *tmp_node;
* sessions to queue the unregistration of the events.
*/
for (i = 0; i < provider_desc->nr_events; i++) {
- const struct lttng_event_desc *event_desc;
+ const struct lttng_ust_event_desc *event_desc;
struct lttng_event_notifier_group *event_notifier_group;
struct lttng_ust_event_recorder_private *event_recorder_priv;
struct lttng_ust_event_notifier_private *event_notifier_priv;
* ust_lock held.
*/
void lttng_probe_provider_unregister_events(
- struct lttng_probe_desc *provider_desc)
+ struct lttng_ust_probe_desc *provider_desc)
{
/*
* Iterate over all events in the probe provider descriptions and sessions
/* Support for event notifier is introduced by probe provider major version 2. */
static
-bool lttng_ust_probe_supports_event_notifier(struct lttng_probe_desc *probe_desc)
+bool lttng_ust_probe_supports_event_notifier(struct lttng_ust_probe_desc *probe_desc)
{
return probe_desc->major >= 2;
}
struct lttng_event_notifier_enabler *event_notifier_enabler)
{
struct lttng_event_notifier_group *event_notifier_group = event_notifier_enabler->group;
- struct lttng_probe_desc *probe_desc;
+ struct lttng_ust_probe_desc *probe_desc;
struct cds_list_head *probe_list;
int i;
for (i = 0; i < probe_desc->nr_events; i++) {
int ret;
bool found = false;
- const struct lttng_event_desc *desc;
+ const struct lttng_ust_event_desc *desc;
struct lttng_ust_event_notifier_private *event_notifier_priv;
struct cds_hlist_head *head;
struct cds_hlist_node *node;
* Called under ust lock.
*/
static
-int check_event_provider(struct lttng_probe_desc *desc)
+int check_event_provider(struct lttng_ust_probe_desc *desc)
{
int i;
size_t provider_name_len;
* Called under ust lock.
*/
static
-void lttng_lazy_probe_register(struct lttng_probe_desc *desc)
+void lttng_lazy_probe_register(struct lttng_ust_probe_desc *desc)
{
- struct lttng_probe_desc *iter;
+ struct lttng_ust_probe_desc *iter;
struct cds_list_head *probe_list;
/*
*/
/*
- * We sort the providers by struct lttng_probe_desc pointer
+ * We sort the providers by struct lttng_ust_probe_desc pointer
* address.
*/
probe_list = &_probe_list;
static
void fixup_lazy_probes(void)
{
- struct lttng_probe_desc *iter, *tmp;
+ struct lttng_ust_probe_desc *iter, *tmp;
int ret;
lazy_nesting++;
}
static
-int check_provider_version(struct lttng_probe_desc *desc)
+int check_provider_version(struct lttng_ust_probe_desc *desc)
{
/*
* Check tracepoint provider version compatibility.
}
-int lttng_probe_register(struct lttng_probe_desc *desc)
+int lttng_ust_probe_register(struct lttng_ust_probe_desc *desc)
{
int ret = 0;
return ret;
}
-void lttng_probe_unregister(struct lttng_probe_desc *desc)
+void lttng_ust_probe_unregister(struct lttng_ust_probe_desc *desc)
{
lttng_ust_fixup_tls();
*/
int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list)
{
- struct lttng_probe_desc *probe_desc;
+ struct lttng_ust_probe_desc *probe_desc;
int i;
struct cds_list_head *probe_list;
*/
int lttng_probes_get_field_list(struct lttng_ust_field_list *list)
{
- struct lttng_probe_desc *probe_desc;
+ struct lttng_ust_probe_desc *probe_desc;
int i;
struct cds_list_head *probe_list;
CDS_INIT_LIST_HEAD(&list->head);
cds_list_for_each_entry(probe_desc, probe_list, head) {
for (i = 0; i < probe_desc->nr_events; i++) {
- const struct lttng_event_desc *event_desc =
+ const struct lttng_ust_event_desc *event_desc =
probe_desc->event_desc[i];
int j;
struct lttng_ust_event_common_private {
struct lttng_ust_event_common *pub; /* Public event interface */
- const struct lttng_event_desc *desc;
+ const struct lttng_ust_event_desc *desc;
/* Backward references: list of lttng_enabler_ref (ref to enablers) */
struct cds_list_head enablers_ref_head;
int registered; /* has reg'd tracepoint probe */
* event_notifier enabler) to ensure each is linked to the provided instance.
*/
LTTNG_HIDDEN
-void lttng_enabler_link_bytecode(const struct lttng_event_desc *event_desc,
+void lttng_enabler_link_bytecode(const struct lttng_ust_event_desc *event_desc,
struct lttng_ctx **ctx,
struct cds_list_head *instance_bytecode_runtime_head,
struct cds_list_head *enabler_bytecode_runtime_head);
void lttng_transport_unregister(struct lttng_transport *transport);
LTTNG_HIDDEN
-void lttng_probe_provider_unregister_events(struct lttng_probe_desc *desc);
+void lttng_probe_provider_unregister_events(struct lttng_ust_probe_desc *desc);
LTTNG_HIDDEN
int lttng_fix_pending_events(void);