Add CTF enum type support to tracepoint event
[lttng-ust.git] / liblttng-ust / ust-core.c
index f9c00ff07bda1d72bea3f42d1ad5d999023ca908..60751dc32a9aa56058e1452f3e9ddec4a395981b 100644 (file)
 #include <stdlib.h>
 #include <lttng/ust-events.h>
 #include <usterr-signal-safe.h>
+#include "jhash.h"
 
 static CDS_LIST_HEAD(lttng_transport_list);
 
-void init_usterr(void)
-{
-       char *ust_debug;
-
-       if (ust_loglevel == UST_LOGLEVEL_UNKNOWN) {
-               ust_debug = getenv("LTTNG_UST_DEBUG");
-               if (ust_debug)
-                       ust_loglevel = UST_LOGLEVEL_DEBUG;
-               else
-                       ust_loglevel = UST_LOGLEVEL_NORMAL;
-       }
-}
-
 struct lttng_transport *lttng_transport_find(const char *name)
 {
        struct lttng_transport *transport;
@@ -69,3 +57,26 @@ void lttng_transport_unregister(struct lttng_transport *transport)
 {
        cds_list_del(&transport->node);
 }
+
+/*
+ * Needed by comm layer.
+ */
+struct lttng_enum *lttng_ust_enum_get(struct lttng_session *session,
+               const char *enum_name)
+{
+       struct lttng_enum *_enum;
+       struct cds_hlist_head *head;
+       struct cds_hlist_node *node;
+       size_t name_len = strlen(enum_name);
+       uint32_t hash;
+
+       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, enum_name,
+                               LTTNG_UST_SYM_NAME_LEN - 1))
+                       return _enum;
+       }
+       return NULL;
+}
This page took 0.024514 seconds and 4 git commands to generate.