Move metadata creation into lttng-sessiond and lttng-consumed
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 26 Feb 2013 19:32:52 +0000 (14:32 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 1 Mar 2013 18:06:48 +0000 (13:06 -0500)
Includes fixes in type serialization. Also stop sending metadata channel
events.

Need to be applied in locked-step with lttng-tools commit:

"Move metadata creation into lttng-sessiond and lttng-consumed"

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-comm/lttng-ust-comm.c
liblttng-ust/lttng-events.c

index 1395eee2f22ea6bb19f56e496d30853e1aee6168..23de8c0949d46a1fdb140a9dc72bcc93ec5e66a0 100644 (file)
@@ -631,7 +631,8 @@ int ustcomm_send_reg_msg(int sock,
 }
 
 static
-int serialize_basic_type(enum lttng_abstract_types atype,
+int serialize_basic_type(enum ustctl_abstract_types *uatype,
+               enum lttng_abstract_types atype,
                union _ustctl_basic_type *ubt,
                const union _lttng_basic_type *lbt)
 {
@@ -649,11 +650,13 @@ int serialize_basic_type(enum lttng_abstract_types atype,
                uit->base = lit->base;
                uit->encoding = lit->encoding;
                uit->alignment = lit->alignment;
+               *uatype = ustctl_atype_integer;
                break;
        }
        case atype_string:
        {
                ubt->string.encoding = lbt->string.encoding;
+               *uatype = ustctl_atype_string;
                break;
        }
        case atype_float:
@@ -667,6 +670,7 @@ int serialize_basic_type(enum lttng_abstract_types atype,
                uft->mant_dig = lft->mant_dig;
                uft->alignment = lft->alignment;
                uft->reverse_byte_order = lft->reverse_byte_order;
+               *uatype = ustctl_atype_float;
                break;
        }
        case atype_enum:
@@ -676,7 +680,6 @@ int serialize_basic_type(enum lttng_abstract_types atype,
                return -EINVAL;
        }
        return 0;
-
 }
 
 static
@@ -688,7 +691,7 @@ int serialize_one_type(struct ustctl_type *ut, const struct lttng_type *lt)
        case atype_integer:
        case atype_float:
        case atype_string:
-               ret = serialize_basic_type(lt->atype,
+               ret = serialize_basic_type(&ut->atype, lt->atype,
                        &ut->u.basic, &lt->u.basic);
                if (ret)
                        return ret;
@@ -702,10 +705,11 @@ int serialize_one_type(struct ustctl_type *ut, const struct lttng_type *lt)
                ubt = &ut->u.array.elem_type;
                lbt = &lt->u.array.elem_type;
                ut->u.array.length = lt->u.array.length;
-               ret = serialize_basic_type(lbt->atype,
+               ret = serialize_basic_type(&ubt->atype, lbt->atype,
                        &ubt->u.basic, &lbt->u.basic);
                if (ret)
                        return -EINVAL;
+               ut->atype = ustctl_atype_array;
                break;
        }
        case atype_sequence:
@@ -716,16 +720,17 @@ int serialize_one_type(struct ustctl_type *ut, const struct lttng_type *lt)
 
                ubt = &ut->u.sequence.length_type;
                lbt = &lt->u.sequence.length_type;
-               ret = serialize_basic_type(lbt->atype,
+               ret = serialize_basic_type(&ubt->atype, lbt->atype,
                        &ubt->u.basic, &lbt->u.basic);
                if (ret)
                        return -EINVAL;
                ubt = &ut->u.sequence.elem_type;
                lbt = &lt->u.sequence.elem_type;
-               ret = serialize_basic_type(lbt->atype,
+               ret = serialize_basic_type(&ubt->atype, lbt->atype,
                        &ubt->u.basic, &lbt->u.basic);
                if (ret)
                        return -EINVAL;
+               ut->atype = ustctl_atype_sequence;
                break;
        }
        case atype_enum:
index f77db60c512f7d3d1f7a5d6bdef970d307368a4e..05728853eb526cdae80bd5a32d50952a1fbb287b 100644 (file)
@@ -249,9 +249,6 @@ int lttng_session_enable(struct lttng_session *session)
 
        CMM_ACCESS_ONCE(session->active) = 1;
        CMM_ACCESS_ONCE(session->been_active) = 1;
-       ret = _lttng_session_metadata_statedump(session);
-       if (ret)
-               CMM_ACCESS_ONCE(session->active) = 0;
 end:
        return ret;
 }
@@ -377,20 +374,26 @@ int lttng_event_create(const struct lttng_event_desc *desc,
        else
                uri = NULL;
 
-       /* Fetch event ID from sessiond */
-       ret = ustcomm_register_event(notify_socket,
-               session->objd,
-               chan->objd,
-               event_name,
-               loglevel,
-               desc->signature,
-               desc->nr_fields,
-               desc->fields,
-               uri,
-               &event->id);
-       if (ret < 0) {
-               goto sessiond_register_error;
+       /* Don't register metadata events */
+       if (session->metadata == chan) {
+               event->id = -1U;
+       } else {
+               /* Fetch event ID from sessiond */
+               ret = ustcomm_register_event(notify_socket,
+                       session->objd,
+                       chan->objd,
+                       event_name,
+                       loglevel,
+                       desc->signature,
+                       desc->nr_fields,
+                       desc->fields,
+                       uri,
+                       &event->id);
+               if (ret < 0) {
+                       goto sessiond_register_error;
+               }
        }
+
        /* Populate lttng_event structure before tracepoint registration. */
        cmm_smp_wmb();
        ret = __tracepoint_probe_register(event_name,
@@ -399,17 +402,10 @@ int lttng_event_create(const struct lttng_event_desc *desc,
        if (ret)
                goto tracepoint_register_error;
 
-       ret = _lttng_event_metadata_statedump(chan->session, chan, event);
-       if (ret)
-               goto statedump_error;
        cds_list_add(&event->node, &chan->session->events_head);
        cds_hlist_add_head(&event->hlist, head);
        return 0;
 
-statedump_error:
-       WARN_ON_ONCE(__tracepoint_probe_unregister(event_name,
-                               desc->probe_callback,
-                               event));
 tracepoint_register_error:
 sessiond_register_error:
        free(event);
This page took 0.028031 seconds and 4 git commands to generate.