4 * Copyright 2010 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * Holds LTTng per-session event registry.
8 * Dual LGPL v2.1/GPL v2 license.
14 #include <urcu/list.h>
15 #include <urcu/hlist.h>
17 #include <uuid/uuid.h>
25 #include <urcu/compiler.h>
26 #include <urcu/uatomic.h>
27 #include <urcu/arch.h>
29 #include <lttng/tracepoint.h>
30 #include <lttng/ust-events.h>
32 #include <usterr-signal-safe.h>
36 #include "ltt-tracer.h"
37 #include "ltt-tracer-core.h"
39 #include "../libringbuffer/shm.h"
43 * The sessions mutex is the centralized mutex across UST tracing
44 * control and probe registration. All operations within this file are
45 * called by the communication thread, under ust_lock protection.
47 static pthread_mutex_t sessions_mutex
= PTHREAD_MUTEX_INITIALIZER
;
51 pthread_mutex_lock(&sessions_mutex
);
56 pthread_mutex_unlock(&sessions_mutex
);
59 static CDS_LIST_HEAD(sessions
);
62 * Pending probes hash table, containing the registered ltt events for
63 * which tracepoint probes are still missing. Protected by the sessions
66 #define PENDING_PROBE_HASH_BITS 6
67 #define PENDING_PROBE_HASH_SIZE (1 << PENDING_PROBE_HASH_BITS)
68 static struct cds_hlist_head pending_probe_table
[PENDING_PROBE_HASH_SIZE
];
70 struct ust_pending_probe
{
71 struct ltt_event
*event
;
72 struct cds_hlist_node node
;
76 static void _ltt_event_destroy(struct ltt_event
*event
);
77 static void _ltt_loglevel_destroy(struct session_loglevel
*sl
);
78 static void _ltt_channel_destroy(struct ltt_channel
*chan
);
79 static int _ltt_event_unregister(struct ltt_event
*event
);
81 int _ltt_event_metadata_statedump(struct ltt_session
*session
,
82 struct ltt_channel
*chan
,
83 struct ltt_event
*event
);
85 int _ltt_session_metadata_statedump(struct ltt_session
*session
);
88 * called at event creation if probe is missing.
89 * called with session mutex held.
92 int add_pending_probe(struct ltt_event
*event
, const char *name
)
94 struct cds_hlist_head
*head
;
95 struct ust_pending_probe
*e
;
96 size_t name_len
= strlen(name
) + 1;
97 uint32_t hash
= jhash(name
, name_len
- 1, 0);
99 head
= &pending_probe_table
[hash
& (PENDING_PROBE_HASH_SIZE
- 1)];
100 e
= zmalloc(sizeof(struct ust_pending_probe
) + name_len
);
103 memcpy(&e
->name
[0], name
, name_len
);
104 cds_hlist_add_head(&e
->node
, head
);
106 event
->pending_probe
= e
;
111 * remove a pending probe. called when at event teardown and when an
112 * event is fixed (probe is loaded).
113 * called with session mutex held.
116 void remove_pending_probe(struct ust_pending_probe
*e
)
120 cds_hlist_del(&e
->node
);
125 * Called at library load: connect the probe on the events pending on
127 * called with session mutex held.
129 int pending_probe_fix_events(const struct lttng_event_desc
*desc
)
131 struct cds_hlist_head
*head
;
132 struct cds_hlist_node
*node
, *p
;
133 struct ust_pending_probe
*e
;
134 const char *name
= desc
->name
;
135 size_t name_len
= strlen(name
) + 1;
136 uint32_t hash
= jhash(name
, name_len
- 1, 0);
138 struct lttng_ust_event event_param
;
141 * For this event, we need to lookup the loglevel. If active (in
142 * the active loglevels hash table), we must create the event.
144 if (desc
->loglevel
) {
145 const struct tracepoint_loglevel_entry
*ev_ll
;
146 struct loglevel_entry
*loglevel
;
148 ev_ll
= *desc
->loglevel
;
149 loglevel
= get_loglevel(ev_ll
->identifier
);
151 struct session_loglevel
*sl
;
153 cds_list_for_each_entry(sl
, &loglevel
->session_list
,
155 struct ltt_event
*ev
;
158 memcpy(&event_param
, &sl
->event_param
,
159 sizeof(event_param
));
160 memcpy(event_param
.name
,
162 sizeof(event_param
.name
));
164 ret
= ltt_event_create(sl
->chan
,
168 DBG("Error creating event");
171 cds_list_add(&ev
->loglevel_list
,
177 head
= &pending_probe_table
[hash
& (PENDING_PROBE_HASH_SIZE
- 1)];
178 cds_hlist_for_each_entry_safe(e
, node
, p
, head
, node
) {
179 struct ltt_event
*event
;
180 struct ltt_channel
*chan
;
182 if (strcmp(name
, e
->name
))
186 assert(!event
->desc
);
188 event
->pending_probe
= NULL
;
189 remove_pending_probe(e
);
190 ret
|= __tracepoint_probe_register(name
,
191 event
->desc
->probe_callback
,
195 event
->id
= chan
->free_event_id
++;
196 ret
|= _ltt_event_metadata_statedump(chan
->session
, chan
,
202 void synchronize_trace(void)
207 struct ltt_session
*ltt_session_create(void)
209 struct ltt_session
*session
;
211 session
= zmalloc(sizeof(struct ltt_session
));
214 CDS_INIT_LIST_HEAD(&session
->chan
);
215 CDS_INIT_LIST_HEAD(&session
->events
);
216 CDS_INIT_LIST_HEAD(&session
->loglevels
);
217 uuid_generate(session
->uuid
);
218 cds_list_add(&session
->list
, &sessions
);
222 void ltt_session_destroy(struct ltt_session
*session
)
224 struct ltt_channel
*chan
, *tmpchan
;
225 struct ltt_event
*event
, *tmpevent
;
226 struct session_loglevel
*loglevel
, *tmploglevel
;
229 CMM_ACCESS_ONCE(session
->active
) = 0;
230 cds_list_for_each_entry(event
, &session
->events
, list
) {
231 ret
= _ltt_event_unregister(event
);
234 synchronize_trace(); /* Wait for in-flight events to complete */
235 cds_list_for_each_entry_safe(loglevel
, tmploglevel
, &session
->loglevels
, list
)
236 _ltt_loglevel_destroy(loglevel
);
237 cds_list_for_each_entry_safe(event
, tmpevent
, &session
->events
, list
)
238 _ltt_event_destroy(event
);
239 cds_list_for_each_entry_safe(chan
, tmpchan
, &session
->chan
, list
)
240 _ltt_channel_destroy(chan
);
241 cds_list_del(&session
->list
);
245 int ltt_session_enable(struct ltt_session
*session
)
248 struct ltt_channel
*chan
;
250 if (session
->active
) {
256 * Snapshot the number of events per channel to know the type of header
259 cds_list_for_each_entry(chan
, &session
->chan
, list
) {
260 if (chan
->header_type
)
261 continue; /* don't change it if session stop/restart */
262 if (chan
->free_event_id
< 31)
263 chan
->header_type
= 1; /* compact */
265 chan
->header_type
= 2; /* large */
268 CMM_ACCESS_ONCE(session
->active
) = 1;
269 CMM_ACCESS_ONCE(session
->been_active
) = 1;
270 ret
= _ltt_session_metadata_statedump(session
);
272 CMM_ACCESS_ONCE(session
->active
) = 0;
277 int ltt_session_disable(struct ltt_session
*session
)
281 if (!session
->active
) {
285 CMM_ACCESS_ONCE(session
->active
) = 0;
290 int ltt_channel_enable(struct ltt_channel
*channel
)
294 if (channel
== channel
->session
->metadata
)
296 old
= uatomic_xchg(&channel
->enabled
, 1);
302 int ltt_channel_disable(struct ltt_channel
*channel
)
306 if (channel
== channel
->session
->metadata
)
308 old
= uatomic_xchg(&channel
->enabled
, 0);
314 int ltt_event_enable(struct ltt_event
*event
)
318 if (event
->chan
== event
->chan
->session
->metadata
)
320 old
= uatomic_xchg(&event
->enabled
, 1);
326 int ltt_event_disable(struct ltt_event
*event
)
330 if (event
->chan
== event
->chan
->session
->metadata
)
332 old
= uatomic_xchg(&event
->enabled
, 0);
338 struct ltt_channel
*ltt_channel_create(struct ltt_session
*session
,
339 const char *transport_name
,
341 size_t subbuf_size
, size_t num_subbuf
,
342 unsigned int switch_timer_interval
,
343 unsigned int read_timer_interval
,
344 int *shm_fd
, int *wait_fd
,
345 uint64_t *memory_map_size
,
346 struct ltt_channel
*chan_priv_init
)
348 struct ltt_channel
*chan
= NULL
;
349 struct ltt_transport
*transport
;
351 if (session
->been_active
)
352 goto active
; /* Refuse to add channel to active session */
353 transport
= ltt_transport_find(transport_name
);
355 DBG("LTTng transport %s not found\n",
359 chan_priv_init
->id
= session
->free_chan_id
++;
360 chan_priv_init
->session
= session
;
362 * Note: the channel creation op already writes into the packet
363 * headers. Therefore the "chan" information used as input
364 * should be already accessible.
366 chan
= transport
->ops
.channel_create("[lttng]", buf_addr
,
367 subbuf_size
, num_subbuf
, switch_timer_interval
,
368 read_timer_interval
, shm_fd
, wait_fd
,
369 memory_map_size
, chan_priv_init
);
373 chan
->ops
= &transport
->ops
;
374 cds_list_add(&chan
->list
, &session
->chan
);
384 * Only used internally at session destruction.
387 void _ltt_channel_destroy(struct ltt_channel
*chan
)
389 cds_list_del(&chan
->list
);
390 lttng_destroy_context(chan
->ctx
);
391 chan
->ops
->channel_destroy(chan
);
394 int ltt_loglevel_create(struct ltt_channel
*chan
,
395 struct lttng_ust_event
*event_param
,
396 struct session_loglevel
**_sl
)
398 struct session_loglevel
*sl
;
400 sl
= add_loglevel(event_param
->name
, chan
, event_param
);
401 if (!sl
|| IS_ERR(sl
)) {
409 void _ltt_loglevel_destroy(struct session_loglevel
*sl
)
411 _remove_loglevel(sl
);
415 * Supports event creation while tracing session is active.
417 int ltt_event_create(struct ltt_channel
*chan
,
418 struct lttng_ust_event
*event_param
,
420 struct ltt_event
**_event
)
422 struct ltt_event
*event
;
425 if (chan
->used_event_id
== -1UL) {
430 * This is O(n^2) (for each event, the loop is called at event
431 * creation). Might require a hash if we have lots of events.
433 cds_list_for_each_entry(event
, &chan
->session
->events
, list
) {
434 if (event
->desc
&& !strcmp(event
->desc
->name
, event_param
->name
)) {
439 event
= zmalloc(sizeof(struct ltt_event
));
445 event
->filter
= filter
;
447 * used_event_id counts the maximum number of event IDs that can
448 * register if all probes register.
450 chan
->used_event_id
++;
452 event
->instrumentation
= event_param
->instrumentation
;
453 /* Populate ltt_event structure before tracepoint registration. */
455 switch (event_param
->instrumentation
) {
456 case LTTNG_UST_TRACEPOINT
:
457 event
->desc
= ltt_event_get(event_param
->name
);
459 ret
= __tracepoint_probe_register(event_param
->name
,
460 event
->desc
->probe_callback
,
464 event
->id
= chan
->free_event_id
++;
467 * If the probe is not present, event->desc stays NULL,
468 * waiting for the probe to register, and the event->id
471 ret
= add_pending_probe(event
, event_param
->name
);
473 goto add_pending_error
;
476 case LTTNG_UST_TRACEPOINT_LOGLEVEL
:
483 ret
= _ltt_event_metadata_statedump(chan
->session
, chan
, event
);
485 goto statedump_error
;
487 cds_list_add(&event
->list
, &chan
->session
->events
);
493 WARN_ON_ONCE(__tracepoint_probe_unregister(event_param
->name
,
494 event
->desc
->probe_callback
,
496 ltt_event_put(event
->desc
);
508 * Only used internally at session destruction.
510 int _ltt_event_unregister(struct ltt_event
*event
)
514 switch (event
->instrumentation
) {
515 case LTTNG_UST_TRACEPOINT
:
517 ret
= __tracepoint_probe_unregister(event
->desc
->name
,
518 event
->desc
->probe_callback
,
523 remove_pending_probe(event
->pending_probe
);
534 * Only used internally at session destruction.
537 void _ltt_event_destroy(struct ltt_event
*event
)
539 switch (event
->instrumentation
) {
540 case LTTNG_UST_TRACEPOINT
:
542 ltt_event_put(event
->desc
);
548 cds_list_del(&event
->list
);
549 lttng_destroy_context(event
->ctx
);
554 * We have exclusive access to our metadata buffer (protected by the
555 * ust_lock), so we can do racy operations such as looking for
556 * remaining space left in packet and write, since mutual exclusion
557 * protects us from concurrent writes.
559 int lttng_metadata_printf(struct ltt_session
*session
,
560 const char *fmt
, ...)
562 struct lttng_ust_lib_ring_buffer_ctx ctx
;
563 struct ltt_channel
*chan
= session
->metadata
;
565 int ret
= 0, waitret
;
566 size_t len
, reserve_len
, pos
;
569 WARN_ON_ONCE(!CMM_ACCESS_ONCE(session
->active
));
572 ret
= vasprintf(&str
, fmt
, ap
);
580 for (pos
= 0; pos
< len
; pos
+= reserve_len
) {
581 reserve_len
= min_t(size_t,
582 chan
->ops
->packet_avail_size(chan
->chan
, chan
->handle
),
584 lib_ring_buffer_ctx_init(&ctx
, chan
->chan
, NULL
, reserve_len
,
585 sizeof(char), -1, chan
->handle
);
587 * We don't care about metadata buffer's records lost
588 * count, because we always retry here. Report error if
589 * we need to bail out after timeout or being
592 waitret
= wait_cond_interruptible_timeout(
594 ret
= chan
->ops
->event_reserve(&ctx
, 0);
595 ret
!= -ENOBUFS
|| !ret
;
597 LTTNG_METADATA_TIMEOUT_MSEC
);
598 if (waitret
== -ETIMEDOUT
|| waitret
== -EINTR
|| ret
) {
599 DBG("LTTng: Failure to write metadata to buffers (%s)\n",
600 waitret
== -EINTR
? "interrupted" :
601 (ret
== -ENOBUFS
? "timeout" : "I/O error"));
602 if (waitret
== -EINTR
)
606 chan
->ops
->event_write(&ctx
, &str
[pos
], reserve_len
);
607 chan
->ops
->event_commit(&ctx
);
615 int _ltt_field_statedump(struct ltt_session
*session
,
616 const struct lttng_event_field
*field
)
620 switch (field
->type
.atype
) {
622 ret
= lttng_metadata_printf(session
,
623 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s;\n",
624 field
->type
.u
.basic
.integer
.size
,
625 field
->type
.u
.basic
.integer
.alignment
,
626 field
->type
.u
.basic
.integer
.signedness
,
627 (field
->type
.u
.basic
.integer
.encoding
== lttng_encode_none
)
629 : (field
->type
.u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
632 field
->type
.u
.basic
.integer
.base
,
633 #if (BYTE_ORDER == BIG_ENDIAN)
634 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
636 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
641 ret
= lttng_metadata_printf(session
,
642 " floating_point { exp_dig = %u; mant_dig = %u; align = %u;%s } _%s;\n",
643 field
->type
.u
.basic
._float
.exp_dig
,
644 field
->type
.u
.basic
._float
.mant_dig
,
645 field
->type
.u
.basic
._float
.alignment
,
646 #if (BYTE_ORDER == BIG_ENDIAN)
647 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
649 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
654 ret
= lttng_metadata_printf(session
,
656 field
->type
.u
.basic
.enumeration
.name
,
661 const struct lttng_basic_type
*elem_type
;
663 elem_type
= &field
->type
.u
.array
.elem_type
;
664 ret
= lttng_metadata_printf(session
,
665 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[%u];\n",
666 elem_type
->u
.basic
.integer
.size
,
667 elem_type
->u
.basic
.integer
.alignment
,
668 elem_type
->u
.basic
.integer
.signedness
,
669 (elem_type
->u
.basic
.integer
.encoding
== lttng_encode_none
)
671 : (elem_type
->u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
674 elem_type
->u
.basic
.integer
.base
,
675 #if (BYTE_ORDER == BIG_ENDIAN)
676 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
678 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
680 field
->name
, field
->type
.u
.array
.length
);
685 const struct lttng_basic_type
*elem_type
;
686 const struct lttng_basic_type
*length_type
;
688 elem_type
= &field
->type
.u
.sequence
.elem_type
;
689 length_type
= &field
->type
.u
.sequence
.length_type
;
690 ret
= lttng_metadata_printf(session
,
691 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } __%s_length;\n",
692 length_type
->u
.basic
.integer
.size
,
693 (unsigned int) length_type
->u
.basic
.integer
.alignment
,
694 length_type
->u
.basic
.integer
.signedness
,
695 (length_type
->u
.basic
.integer
.encoding
== lttng_encode_none
)
697 : ((length_type
->u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
700 length_type
->u
.basic
.integer
.base
,
701 #if (BYTE_ORDER == BIG_ENDIAN)
702 length_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
704 length_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
710 ret
= lttng_metadata_printf(session
,
711 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[ __%s_length ];\n",
712 elem_type
->u
.basic
.integer
.size
,
713 (unsigned int) elem_type
->u
.basic
.integer
.alignment
,
714 elem_type
->u
.basic
.integer
.signedness
,
715 (elem_type
->u
.basic
.integer
.encoding
== lttng_encode_none
)
717 : ((elem_type
->u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
720 elem_type
->u
.basic
.integer
.base
,
721 #if (BYTE_ORDER == BIG_ENDIAN)
722 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
724 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
732 /* Default encoding is UTF8 */
733 ret
= lttng_metadata_printf(session
,
735 field
->type
.u
.basic
.string
.encoding
== lttng_encode_ASCII
?
736 " { encoding = ASCII; }" : "",
747 int _ltt_context_metadata_statedump(struct ltt_session
*session
,
748 struct lttng_ctx
*ctx
)
755 for (i
= 0; i
< ctx
->nr_fields
; i
++) {
756 const struct lttng_ctx_field
*field
= &ctx
->fields
[i
];
758 ret
= _ltt_field_statedump(session
, &field
->event_field
);
766 int _ltt_fields_metadata_statedump(struct ltt_session
*session
,
767 struct ltt_event
*event
)
769 const struct lttng_event_desc
*desc
= event
->desc
;
773 for (i
= 0; i
< desc
->nr_fields
; i
++) {
774 const struct lttng_event_field
*field
= &desc
->fields
[i
];
776 ret
= _ltt_field_statedump(session
, field
);
784 int _ltt_event_metadata_statedump(struct ltt_session
*session
,
785 struct ltt_channel
*chan
,
786 struct ltt_event
*event
)
790 if (event
->metadata_dumped
|| !CMM_ACCESS_ONCE(session
->active
))
792 if (chan
== session
->metadata
)
795 * Don't print events for which probe load is pending.
800 ret
= lttng_metadata_printf(session
,
804 " stream_id = %u;\n",
812 ret
= lttng_metadata_printf(session
,
813 " context := struct {\n");
817 ret
= _ltt_context_metadata_statedump(session
, event
->ctx
);
821 ret
= lttng_metadata_printf(session
,
827 ret
= lttng_metadata_printf(session
,
828 " fields := struct {\n"
833 ret
= _ltt_fields_metadata_statedump(session
, event
);
838 * LTTng space reservation can only reserve multiples of the
841 ret
= lttng_metadata_printf(session
,
847 event
->metadata_dumped
= 1;
854 int _ltt_channel_metadata_statedump(struct ltt_session
*session
,
855 struct ltt_channel
*chan
)
859 if (chan
->metadata_dumped
|| !CMM_ACCESS_ONCE(session
->active
))
861 if (chan
== session
->metadata
)
864 WARN_ON_ONCE(!chan
->header_type
);
865 ret
= lttng_metadata_printf(session
,
868 " event.header := %s;\n"
869 " packet.context := struct packet_context;\n",
871 chan
->header_type
== 1 ? "struct event_header_compact" :
872 "struct event_header_large");
877 ret
= lttng_metadata_printf(session
,
878 " event.context := struct {\n");
882 ret
= _ltt_context_metadata_statedump(session
, chan
->ctx
);
886 ret
= lttng_metadata_printf(session
,
892 ret
= lttng_metadata_printf(session
,
895 chan
->metadata_dumped
= 1;
901 int _ltt_stream_packet_context_declare(struct ltt_session
*session
)
903 return lttng_metadata_printf(session
,
904 "struct packet_context {\n"
905 " uint64_t timestamp_begin;\n"
906 " uint64_t timestamp_end;\n"
907 " uint32_t events_discarded;\n"
908 " uint32_t content_size;\n"
909 " uint32_t packet_size;\n"
910 " uint32_t cpu_id;\n"
918 * id 31 is reserved to indicate an extended header.
921 * id: range: 0 - 65534.
922 * id 65535 is reserved to indicate an extended header.
925 int _ltt_event_header_declare(struct ltt_session
*session
)
927 return lttng_metadata_printf(session
,
928 "struct event_header_compact {\n"
929 " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n"
932 " uint27_t timestamp;\n"
936 " uint64_t timestamp;\n"
941 "struct event_header_large {\n"
942 " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n"
945 " uint32_t timestamp;\n"
949 " uint64_t timestamp;\n"
953 lttng_alignof(uint32_t) * CHAR_BIT
,
954 lttng_alignof(uint16_t) * CHAR_BIT
959 * Output metadata into this session's metadata buffers.
962 int _ltt_session_metadata_statedump(struct ltt_session
*session
)
964 unsigned char *uuid_c
= session
->uuid
;
966 struct ltt_channel
*chan
;
967 struct ltt_event
*event
;
970 if (!CMM_ACCESS_ONCE(session
->active
))
972 if (session
->metadata_dumped
)
974 if (!session
->metadata
) {
975 DBG("LTTng: attempt to start tracing, but metadata channel is not found. Operation abort.\n");
979 snprintf(uuid_s
, sizeof(uuid_s
),
980 "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
981 uuid_c
[0], uuid_c
[1], uuid_c
[2], uuid_c
[3],
982 uuid_c
[4], uuid_c
[5], uuid_c
[6], uuid_c
[7],
983 uuid_c
[8], uuid_c
[9], uuid_c
[10], uuid_c
[11],
984 uuid_c
[12], uuid_c
[13], uuid_c
[14], uuid_c
[15]);
986 ret
= lttng_metadata_printf(session
,
987 "typealias integer { size = 8; align = %u; signed = false; } := uint8_t;\n"
988 "typealias integer { size = 16; align = %u; signed = false; } := uint16_t;\n"
989 "typealias integer { size = 32; align = %u; signed = false; } := uint32_t;\n"
990 "typealias integer { size = 64; align = %u; signed = false; } := uint64_t;\n"
991 "typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n"
992 "typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n"
998 " byte_order = %s;\n"
999 " packet.header := struct {\n"
1000 " uint32_t magic;\n"
1001 " uint8_t uuid[16];\n"
1002 " uint32_t stream_id;\n"
1005 lttng_alignof(uint8_t) * CHAR_BIT
,
1006 lttng_alignof(uint16_t) * CHAR_BIT
,
1007 lttng_alignof(uint32_t) * CHAR_BIT
,
1008 lttng_alignof(uint64_t) * CHAR_BIT
,
1012 #if (BYTE_ORDER == BIG_ENDIAN)
1021 ret
= _ltt_stream_packet_context_declare(session
);
1025 ret
= _ltt_event_header_declare(session
);
1030 cds_list_for_each_entry(chan
, &session
->chan
, list
) {
1031 ret
= _ltt_channel_metadata_statedump(session
, chan
);
1036 cds_list_for_each_entry(event
, &session
->events
, list
) {
1037 ret
= _ltt_event_metadata_statedump(session
, event
->chan
, event
);
1041 session
->metadata_dumped
= 1;
1046 void lttng_ust_events_exit(void)
1048 struct ltt_session
*session
, *tmpsession
;
1050 cds_list_for_each_entry_safe(session
, tmpsession
, &sessions
, list
)
1051 ltt_session_destroy(session
);