X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=liblttng-ust%2Flttng-events.c;h=527aa69ce4cc256defe582b971e5ea79ceb9f4b3;hb=e450e3396b0bfe998e3bde6aef7dc3b4232f8edb;hp=855f8d8739d1ff0ecb07d6779957c4f11153f9db;hpb=735bef4705cc42f25d26f25be09ba98f1efb8511;p=lttng-ust.git diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index 855f8d87..527aa69c 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#define _GNU_SOURCE #define _LGPL_SOURCE #include #include @@ -318,7 +317,20 @@ int lttng_create_enum_check(const struct lttng_type *type, const struct lttng_enum_desc *enum_desc; int ret; - enum_desc = type->u.basic.enumeration.desc; + enum_desc = type->u.legacy.basic.enumeration.desc; + ret = lttng_enum_create(enum_desc, session); + if (ret && ret != -EEXIST) { + DBG("Unable to create enum error: (%d)", ret); + return ret; + } + break; + } + case atype_enum_nestable: + { + const struct lttng_enum_desc *enum_desc; + int ret; + + enum_desc = type->u.enum_nestable.desc; ret = lttng_enum_create(enum_desc, session); if (ret && ret != -EEXIST) { DBG("Unable to create enum error: (%d)", ret); @@ -333,7 +345,7 @@ int lttng_create_enum_check(const struct lttng_type *type, int ret; tag_field_generic = lttng_ust_dynamic_type_tag_field(); - enum_desc = tag_field_generic->type.u.basic.enumeration.desc; + enum_desc = tag_field_generic->type.u.enum_nestable.desc; ret = lttng_enum_create(enum_desc, session); if (ret && ret != -EEXIST) { DBG("Unable to create enum error: (%d)", ret); @@ -600,8 +612,6 @@ int lttng_event_create(const struct lttng_event_desc *desc, goto sessiond_register_error; } - /* Populate lttng_event structure before tracepoint registration. */ - cmm_smp_wmb(); cds_list_add(&event->node, &chan->session->events_head); cds_hlist_add_head(&event->hlist, head); return 0; @@ -621,7 +631,7 @@ int lttng_desc_match_star_glob_enabler(const struct lttng_event_desc *desc, int loglevel = 0; unsigned int has_loglevel = 0; - assert(enabler->type == LTTNG_ENABLER_STAR_GLOB); + assert(enabler->format_type == LTTNG_ENABLER_FORMAT_STAR_GLOB); if (!strutils_star_glob_match(enabler->event_param.name, SIZE_MAX, desc->name, SIZE_MAX)) return 0; @@ -644,7 +654,7 @@ int lttng_desc_match_event_enabler(const struct lttng_event_desc *desc, int loglevel = 0; unsigned int has_loglevel = 0; - assert(enabler->type == LTTNG_ENABLER_EVENT); + assert(enabler->format_type == LTTNG_ENABLER_FORMAT_EVENT); if (strcmp(desc->name, enabler->event_param.name)) return 0; if (desc->loglevel) { @@ -663,8 +673,8 @@ static int lttng_desc_match_enabler(const struct lttng_event_desc *desc, struct lttng_enabler *enabler) { - switch (enabler->type) { - case LTTNG_ENABLER_STAR_GLOB: + switch (enabler->format_type) { + case LTTNG_ENABLER_FORMAT_STAR_GLOB: { struct lttng_ust_excluder_node *excluder; @@ -692,7 +702,7 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc, } return 1; } - case LTTNG_ENABLER_EVENT: + case LTTNG_ENABLER_FORMAT_EVENT: return lttng_desc_match_event_enabler(desc, enabler); default: return -EINVAL; @@ -746,7 +756,8 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler) */ cds_list_for_each_entry(probe_desc, probe_list, head) { for (i = 0; i < probe_desc->nr_events; i++) { - int found = 0, ret; + int ret; + bool found = false; struct cds_hlist_head *head; struct cds_hlist_node *node; const char *event_name; @@ -766,8 +777,10 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler) head = &session->events_ht.table[hash & (LTTNG_UST_EVENT_HT_SIZE - 1)]; cds_hlist_for_each_entry(event, node, head, hlist) { if (event->desc == desc - && event->chan == enabler->chan) - found = 1; + && event->chan == enabler->chan) { + found = true; + break; + } } if (found) continue; @@ -871,11 +884,16 @@ void lttng_probe_provider_unregister_events(struct lttng_probe_desc *provider_de struct lttng_enum *curr_enum; field = &(event->desc->fields[j]); - if (field->type.atype != atype_enum) { + switch (field->type.atype) { + case atype_enum: + enum_desc = field->type.u.legacy.basic.enumeration.desc; + break; + case atype_enum_nestable: + enum_desc = field->type.u.enum_nestable.desc; + break; + default: continue; } - - enum_desc = field->type.u.basic.enumeration.desc; curr_enum = lttng_ust_enum_get_from_desc(session, enum_desc); if (curr_enum) { _lttng_enum_destroy(curr_enum); @@ -901,6 +919,9 @@ int lttng_enabler_ref_events(struct lttng_enabler *enabler) struct lttng_session *session = enabler->chan->session; struct lttng_event *event; + if (!enabler->enabled) + goto end; + /* First ensure that probe events are created for this enabler. */ lttng_create_event_if_missing(enabler); @@ -932,6 +953,7 @@ int lttng_enabler_ref_events(struct lttng_enabler *enabler) /* TODO: merge event context. */ } +end: return 0; } @@ -1019,7 +1041,7 @@ void lttng_ust_events_exit(void) /* * Enabler management. */ -struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_type type, +struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_format_type format_type, struct lttng_ust_event *event_param, struct lttng_channel *chan) { @@ -1028,7 +1050,7 @@ struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_type type, enabler = zmalloc(sizeof(*enabler)); if (!enabler) return NULL; - enabler->type = type; + enabler->format_type = format_type; CDS_INIT_LIST_HEAD(&enabler->filter_bytecode_head); CDS_INIT_LIST_HEAD(&enabler->excluder_head); memcpy(&enabler->event_param, event_param, @@ -1122,10 +1144,24 @@ int lttng_attach_context(struct lttng_ust_context *context_param, return lttng_add_net_ns_to_ctx(ctx); case LTTNG_UST_CONTEXT_PID_NS: return lttng_add_pid_ns_to_ctx(ctx); + case LTTNG_UST_CONTEXT_TIME_NS: + return lttng_add_time_ns_to_ctx(ctx); case LTTNG_UST_CONTEXT_USER_NS: return lttng_add_user_ns_to_ctx(ctx); case LTTNG_UST_CONTEXT_UTS_NS: return lttng_add_uts_ns_to_ctx(ctx); + case LTTNG_UST_CONTEXT_VUID: + return lttng_add_vuid_to_ctx(ctx); + case LTTNG_UST_CONTEXT_VEUID: + return lttng_add_veuid_to_ctx(ctx); + case LTTNG_UST_CONTEXT_VSUID: + return lttng_add_vsuid_to_ctx(ctx); + case LTTNG_UST_CONTEXT_VGID: + return lttng_add_vgid_to_ctx(ctx); + case LTTNG_UST_CONTEXT_VEGID: + return lttng_add_vegid_to_ctx(ctx); + case LTTNG_UST_CONTEXT_VSGID: + return lttng_add_vsgid_to_ctx(ctx); default: return -EINVAL; }