X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=liblttng-ust%2Flttng-events.c;h=7aa288c75210d1da75d84cfef08f82cdbcc292bf;hb=793d29c9367a58c2a368bc1ccb11b01c2d2bdac2;hp=57eb6f7f3a2c745e77191f7ba9b00d1234383f71;hpb=35ac38cb4cc188253c600766882b7a833f5a81ee;p=lttng-ust.git diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index 57eb6f7f..7aa288c7 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -257,21 +257,19 @@ int lttng_enum_create(const struct lttng_enum_desc *desc, const char *enum_name = desc->name; struct lttng_enum *_enum; struct cds_hlist_head *head; - struct cds_hlist_node *node; int ret = 0; size_t name_len = strlen(enum_name); uint32_t hash; int notify_socket; + /* Check if this enum is already registered for this session. */ hash = jhash(enum_name, name_len, 0); head = &session->enums_ht.table[hash & (LTTNG_UST_ENUM_HT_SIZE - 1)]; - cds_hlist_for_each_entry(_enum, node, head, hlist) { - assert(_enum->desc); - if (!strncmp(_enum->desc->name, desc->name, - LTTNG_UST_SYM_NAME_LEN - 1)) { - ret = -EEXIST; - goto exist; - } + + _enum = lttng_ust_enum_get_from_desc(session, desc); + if (_enum) { + ret = -EEXIST; + goto exist; } notify_socket = lttng_get_notify_socket(session->owner); @@ -417,6 +415,9 @@ int lttng_session_enable(struct lttng_session *session) /* Set transient enabler state to "enabled" */ session->tstate = 1; + /* We need to sync enablers with session before activation. */ + lttng_session_sync_enablers(session); + /* * Snapshot the number of events per channel to know the type of header * we need to use. @@ -460,9 +461,6 @@ int lttng_session_enable(struct lttng_session *session) } } - /* We need to sync enablers with session before activation. */ - lttng_session_sync_enablers(session); - /* Set atomically the state to "active" */ CMM_ACCESS_ONCE(session->active) = 1; CMM_ACCESS_ONCE(session->been_active) = 1; @@ -800,7 +798,7 @@ void lttng_probe_provider_unregister_events(struct lttng_probe_desc *provider_de struct lttng_session *session; struct cds_hlist_head *head; struct lttng_event *event; - int i; + unsigned int i, j; /* Get handle on list of sessions. */ sessionsp = _lttng_get_sessions();