X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ust%2Flttng-events.c;h=320d459e1c4397a1c19bbf03eca448d46c1ba514;hb=21d04cc41c966d687aab6e0ba60b2cb1466356ca;hp=445a3c398b279c0271f25af7869b1acda7c2559a;hpb=3d33ca1d93088e049c36fc0f417d130bc66b2231;p=lttng-ust.git diff --git a/src/lib/lttng-ust/lttng-events.c b/src/lib/lttng-ust/lttng-events.c index 445a3c39..320d459e 100644 --- a/src/lib/lttng-ust/lttng-events.c +++ b/src/lib/lttng-ust/lttng-events.c @@ -39,12 +39,11 @@ #include "common/ust-fd.h" #include "common/dynamic-type.h" #include "common/ust-context-provider.h" -#include "lttng-ust-uuid.h" #include "common/tracepoint.h" #include "common/strutils.h" #include "lttng-bytecode.h" -#include "lttng-tracer.h" +#include "common/tracer.h" #include "lttng-tracer-core.h" #include "lttng-ust-statedump.h" #include "context-internal.h" @@ -120,23 +119,23 @@ int lttng_loglevel_match(int loglevel, int req_loglevel) { if (!has_loglevel) - loglevel = TRACE_DEFAULT; + loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT; switch (req_type) { case LTTNG_UST_ABI_LOGLEVEL_RANGE: if (loglevel <= req_loglevel - || (req_loglevel == -1 && loglevel <= TRACE_DEBUG)) + || (req_loglevel == -1 && loglevel <= LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG)) return 1; else return 0; case LTTNG_UST_ABI_LOGLEVEL_SINGLE: if (loglevel == req_loglevel - || (req_loglevel == -1 && loglevel <= TRACE_DEBUG)) + || (req_loglevel == -1 && loglevel <= LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG)) return 1; else return 0; case LTTNG_UST_ABI_LOGLEVEL_ALL: default: - if (loglevel <= TRACE_DEBUG) + if (loglevel <= LTTNG_UST_TRACEPOINT_LOGLEVEL_DEBUG) return 1; else return 0; @@ -266,14 +265,13 @@ void register_event(struct lttng_ust_event_common *event) { int ret; const struct lttng_ust_event_desc *desc; - char name[LTTNG_UST_ABI_SYM_NAME_LEN]; assert(event->priv->registered == 0); desc = event->priv->desc; - lttng_ust_format_event_name(desc, name); - ret = lttng_ust_tp_probe_register_queue_release(name, - desc->probe_callback, - event, desc->signature); + ret = lttng_ust_tp_probe_register_queue_release(desc->probe_desc->provider_name, + desc->event_name, + desc->tp_class->probe_callback, + event, desc->tp_class->signature); WARN_ON_ONCE(ret); if (!ret) event->priv->registered = 1; @@ -284,13 +282,12 @@ void unregister_event(struct lttng_ust_event_common *event) { int ret; const struct lttng_ust_event_desc *desc; - char name[LTTNG_UST_ABI_SYM_NAME_LEN]; assert(event->priv->registered == 1); desc = event->priv->desc; - lttng_ust_format_event_name(desc, name); - ret = lttng_ust_tp_probe_unregister_queue_release(name, - desc->probe_callback, + ret = lttng_ust_tp_probe_unregister_queue_release(desc->probe_desc->provider_name, + desc->event_name, + desc->tp_class->probe_callback, event); WARN_ON_ONCE(ret); if (!ret) @@ -732,7 +729,7 @@ int lttng_event_recorder_create(const struct lttng_ust_event_desc *desc, goto socket_error; } - ret = lttng_create_all_event_enums(desc->nr_fields, desc->fields, + ret = lttng_create_all_event_enums(desc->tp_class->nr_fields, desc->tp_class->fields, session); if (ret < 0) { DBG("Error (%d) adding enum to session", ret); @@ -781,7 +778,7 @@ int lttng_event_recorder_create(const struct lttng_ust_event_desc *desc, if (desc->loglevel) loglevel = *(*desc->loglevel); else - loglevel = TRACE_DEFAULT; + loglevel = LTTNG_UST_TRACEPOINT_LOGLEVEL_DEFAULT; if (desc->model_emf_uri) uri = *(desc->model_emf_uri); else @@ -796,9 +793,9 @@ int lttng_event_recorder_create(const struct lttng_ust_event_desc *desc, chan->priv->parent.objd, name, loglevel, - desc->signature, - desc->nr_fields, - desc->fields, + desc->tp_class->signature, + desc->tp_class->nr_fields, + desc->tp_class->fields, uri, &event_recorder->priv->id); if (ret < 0) { @@ -1176,12 +1173,12 @@ void _event_enum_destroy(struct lttng_ust_event_common *event) unsigned int i; /* Destroy enums of the current event. */ - for (i = 0; i < event_recorder->parent->priv->desc->nr_fields; i++) { + for (i = 0; i < event_recorder->parent->priv->desc->tp_class->nr_fields; i++) { const struct lttng_ust_enum_desc *enum_desc; const struct lttng_ust_event_field *field; struct lttng_enum *curr_enum; - field = event_recorder->parent->priv->desc->fields[i]; + field = event_recorder->parent->priv->desc->tp_class->fields[i]; switch (field->type->type) { case lttng_ust_type_enum: enum_desc = lttng_ust_get_type_enum(field->type)->desc; @@ -1748,13 +1745,6 @@ void lttng_session_sync_event_enablers(struct lttng_ust_session *session) lttng_ust_tp_probe_prune_release_queue(); } -/* Support for event notifier is introduced by probe provider major version 2. */ -static -bool lttng_ust_probe_supports_event_notifier(const struct lttng_ust_probe_desc *probe_desc) -{ - return probe_desc->major >= 2; -} - static void lttng_create_event_notifier_if_missing( struct lttng_event_notifier_enabler *event_notifier_enabler) @@ -1808,18 +1798,6 @@ void lttng_create_event_notifier_if_missing( if (found) continue; - /* Check that the probe supports event notifiers, else report the error. */ - if (!lttng_ust_probe_supports_event_notifier(probe_desc)) { - ERR("Probe \"%s\" contains event \"%s:%s\" which matches an enabled event notifier, " - "but its version (%u.%u) is too old and does not implement event notifiers. " - "It needs to be recompiled against a newer version of LTTng-UST, otherwise " - "this event will not generate any notification.", - probe_desc->provider_name, - probe_desc->provider_name, desc->event_name, - probe_desc->major, - probe_desc->minor); - continue; - } /* * We need to create a event_notifier for this event probe. */ @@ -1999,11 +1977,13 @@ void lttng_session_lazy_sync_event_enablers(struct lttng_ust_session *session) * context (either app context callbacks, or dummy callbacks). */ void lttng_ust_context_set_session_provider(const char *name, - size_t (*get_size)(void *priv, size_t offset), - void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, + size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx, + size_t offset), + void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan), - void (*get_value)(void *priv, struct lttng_ust_ctx_value *value), - void *priv) + void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx, + struct lttng_ust_ctx_value *value)) { struct lttng_ust_session_private *session_priv; @@ -2013,18 +1993,18 @@ void lttng_ust_context_set_session_provider(const char *name, int ret; ret = lttng_ust_context_set_provider_rcu(&session_priv->ctx, - name, get_size, record, get_value, priv); + name, get_size, record, get_value); if (ret) abort(); cds_list_for_each_entry(chan, &session_priv->chan_head, node) { ret = lttng_ust_context_set_provider_rcu(&chan->ctx, - name, get_size, record, get_value, priv); + name, get_size, record, get_value); if (ret) abort(); } cds_list_for_each_entry(event_recorder_priv, &session_priv->events_head, node) { ret = lttng_ust_context_set_provider_rcu(&event_recorder_priv->ctx, - name, get_size, record, get_value, priv); + name, get_size, record, get_value); if (ret) abort(); } @@ -2039,11 +2019,13 @@ void lttng_ust_context_set_session_provider(const char *name, * context (either app context callbacks, or dummy callbacks). */ void lttng_ust_context_set_event_notifier_group_provider(const char *name, - size_t (*get_size)(void *priv, size_t offset), - void (*record)(void *priv, struct lttng_ust_ring_buffer_ctx *ctx, + size_t (*get_size)(void *priv, struct lttng_ust_probe_ctx *probe_ctx, + size_t offset), + void (*record)(void *priv, struct lttng_ust_probe_ctx *probe_ctx, + struct lttng_ust_ring_buffer_ctx *ctx, struct lttng_ust_channel_buffer *chan), - void (*get_value)(void *priv, struct lttng_ust_ctx_value *value), - void *priv) + void (*get_value)(void *priv, struct lttng_ust_probe_ctx *probe_ctx, + struct lttng_ust_ctx_value *value)) { struct lttng_event_notifier_group *event_notifier_group; @@ -2052,7 +2034,7 @@ void lttng_ust_context_set_event_notifier_group_provider(const char *name, ret = lttng_ust_context_set_provider_rcu( &event_notifier_group->ctx, - name, get_size, record, get_value, priv); + name, get_size, record, get_value); if (ret) abort(); }