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);
140 * For this event, we need to lookup the loglevel. If active (in
141 * the active loglevels hash table), we must create the event.
143 if (desc
->loglevel
) {
144 const struct tracepoint_loglevel_entry
*ev_ll
;
145 struct loglevel_entry
*loglevel
;
147 ev_ll
= *desc
->loglevel
;
148 loglevel
= get_loglevel(ev_ll
->identifier
);
150 struct session_loglevel
*sl
;
152 cds_list_for_each_entry(sl
, &loglevel
->session_list
,
154 struct ltt_event
*ev
;
158 ret
= ltt_event_create(sl
->chan
,
159 &sl
->event_param
, NULL
,
162 * TODO: report error.
166 cds_list_add(&ev
->loglevel_list
,
172 head
= &pending_probe_table
[hash
& (PENDING_PROBE_HASH_SIZE
- 1)];
173 cds_hlist_for_each_entry_safe(e
, node
, p
, head
, node
) {
174 struct ltt_event
*event
;
175 struct ltt_channel
*chan
;
177 if (strcmp(name
, e
->name
))
181 assert(!event
->desc
);
183 event
->pending_probe
= NULL
;
184 remove_pending_probe(e
);
185 ret
|= __tracepoint_probe_register(name
,
186 event
->desc
->probe_callback
,
190 event
->id
= chan
->free_event_id
++;
191 ret
|= _ltt_event_metadata_statedump(chan
->session
, chan
,
197 void synchronize_trace(void)
202 struct ltt_session
*ltt_session_create(void)
204 struct ltt_session
*session
;
206 session
= zmalloc(sizeof(struct ltt_session
));
209 CDS_INIT_LIST_HEAD(&session
->chan
);
210 CDS_INIT_LIST_HEAD(&session
->events
);
211 CDS_INIT_LIST_HEAD(&session
->loglevels
);
212 uuid_generate(session
->uuid
);
213 cds_list_add(&session
->list
, &sessions
);
217 void ltt_session_destroy(struct ltt_session
*session
)
219 struct ltt_channel
*chan
, *tmpchan
;
220 struct ltt_event
*event
, *tmpevent
;
221 struct session_loglevel
*loglevel
, *tmploglevel
;
224 CMM_ACCESS_ONCE(session
->active
) = 0;
225 cds_list_for_each_entry(event
, &session
->events
, list
) {
226 ret
= _ltt_event_unregister(event
);
229 synchronize_trace(); /* Wait for in-flight events to complete */
230 cds_list_for_each_entry_safe(loglevel
, tmploglevel
, &session
->loglevels
, list
)
231 _ltt_loglevel_destroy(loglevel
);
232 cds_list_for_each_entry_safe(event
, tmpevent
, &session
->events
, list
)
233 _ltt_event_destroy(event
);
234 cds_list_for_each_entry_safe(chan
, tmpchan
, &session
->chan
, list
)
235 _ltt_channel_destroy(chan
);
236 cds_list_del(&session
->list
);
240 int ltt_session_enable(struct ltt_session
*session
)
243 struct ltt_channel
*chan
;
245 if (session
->active
) {
251 * Snapshot the number of events per channel to know the type of header
254 cds_list_for_each_entry(chan
, &session
->chan
, list
) {
255 if (chan
->header_type
)
256 continue; /* don't change it if session stop/restart */
257 if (chan
->free_event_id
< 31)
258 chan
->header_type
= 1; /* compact */
260 chan
->header_type
= 2; /* large */
263 CMM_ACCESS_ONCE(session
->active
) = 1;
264 CMM_ACCESS_ONCE(session
->been_active
) = 1;
265 ret
= _ltt_session_metadata_statedump(session
);
267 CMM_ACCESS_ONCE(session
->active
) = 0;
272 int ltt_session_disable(struct ltt_session
*session
)
276 if (!session
->active
) {
280 CMM_ACCESS_ONCE(session
->active
) = 0;
285 int ltt_channel_enable(struct ltt_channel
*channel
)
289 if (channel
== channel
->session
->metadata
)
291 old
= uatomic_xchg(&channel
->enabled
, 1);
297 int ltt_channel_disable(struct ltt_channel
*channel
)
301 if (channel
== channel
->session
->metadata
)
303 old
= uatomic_xchg(&channel
->enabled
, 0);
309 int ltt_event_enable(struct ltt_event
*event
)
313 if (event
->chan
== event
->chan
->session
->metadata
)
315 old
= uatomic_xchg(&event
->enabled
, 1);
321 int ltt_event_disable(struct ltt_event
*event
)
325 if (event
->chan
== event
->chan
->session
->metadata
)
327 old
= uatomic_xchg(&event
->enabled
, 0);
333 struct ltt_channel
*ltt_channel_create(struct ltt_session
*session
,
334 const char *transport_name
,
336 size_t subbuf_size
, size_t num_subbuf
,
337 unsigned int switch_timer_interval
,
338 unsigned int read_timer_interval
,
339 int *shm_fd
, int *wait_fd
,
340 uint64_t *memory_map_size
,
341 struct ltt_channel
*chan_priv_init
)
343 struct ltt_channel
*chan
= NULL
;
344 struct ltt_transport
*transport
;
346 if (session
->been_active
)
347 goto active
; /* Refuse to add channel to active session */
348 transport
= ltt_transport_find(transport_name
);
350 DBG("LTTng transport %s not found\n",
354 chan_priv_init
->id
= session
->free_chan_id
++;
355 chan_priv_init
->session
= session
;
357 * Note: the channel creation op already writes into the packet
358 * headers. Therefore the "chan" information used as input
359 * should be already accessible.
361 chan
= transport
->ops
.channel_create("[lttng]", buf_addr
,
362 subbuf_size
, num_subbuf
, switch_timer_interval
,
363 read_timer_interval
, shm_fd
, wait_fd
,
364 memory_map_size
, chan_priv_init
);
368 chan
->ops
= &transport
->ops
;
369 cds_list_add(&chan
->list
, &session
->chan
);
379 * Only used internally at session destruction.
382 void _ltt_channel_destroy(struct ltt_channel
*chan
)
384 cds_list_del(&chan
->list
);
385 lttng_destroy_context(chan
->ctx
);
386 chan
->ops
->channel_destroy(chan
);
389 int ltt_loglevel_create(struct ltt_channel
*chan
,
390 struct lttng_ust_event
*event_param
,
391 struct session_loglevel
**_sl
)
393 struct session_loglevel
*sl
;
395 sl
= add_loglevel(event_param
->name
, chan
, event_param
);
396 if (!sl
|| IS_ERR(sl
)) {
404 void _ltt_loglevel_destroy(struct session_loglevel
*sl
)
406 _remove_loglevel(sl
);
410 * Supports event creation while tracing session is active.
412 int ltt_event_create(struct ltt_channel
*chan
,
413 struct lttng_ust_event
*event_param
,
415 struct ltt_event
**_event
)
417 struct ltt_event
*event
;
420 if (chan
->used_event_id
== -1UL) {
425 * This is O(n^2) (for each event, the loop is called at event
426 * creation). Might require a hash if we have lots of events.
428 cds_list_for_each_entry(event
, &chan
->session
->events
, list
) {
429 if (event
->desc
&& !strcmp(event
->desc
->name
, event_param
->name
)) {
434 event
= zmalloc(sizeof(struct ltt_event
));
440 event
->filter
= filter
;
442 * used_event_id counts the maximum number of event IDs that can
443 * register if all probes register.
445 chan
->used_event_id
++;
447 event
->instrumentation
= event_param
->instrumentation
;
448 /* Populate ltt_event structure before tracepoint registration. */
450 switch (event_param
->instrumentation
) {
451 case LTTNG_UST_TRACEPOINT
:
452 event
->desc
= ltt_event_get(event_param
->name
);
454 ret
= __tracepoint_probe_register(event_param
->name
,
455 event
->desc
->probe_callback
,
459 event
->id
= chan
->free_event_id
++;
462 * If the probe is not present, event->desc stays NULL,
463 * waiting for the probe to register, and the event->id
466 ret
= add_pending_probe(event
, event_param
->name
);
468 goto add_pending_error
;
471 case LTTNG_UST_TRACEPOINT_LOGLEVEL
:
478 ret
= _ltt_event_metadata_statedump(chan
->session
, chan
, event
);
480 goto statedump_error
;
482 cds_list_add(&event
->list
, &chan
->session
->events
);
488 WARN_ON_ONCE(__tracepoint_probe_unregister(event_param
->name
,
489 event
->desc
->probe_callback
,
491 ltt_event_put(event
->desc
);
503 * Only used internally at session destruction.
505 int _ltt_event_unregister(struct ltt_event
*event
)
509 switch (event
->instrumentation
) {
510 case LTTNG_UST_TRACEPOINT
:
512 ret
= __tracepoint_probe_unregister(event
->desc
->name
,
513 event
->desc
->probe_callback
,
518 remove_pending_probe(event
->pending_probe
);
529 * Only used internally at session destruction.
532 void _ltt_event_destroy(struct ltt_event
*event
)
534 switch (event
->instrumentation
) {
535 case LTTNG_UST_TRACEPOINT
:
537 ltt_event_put(event
->desc
);
543 cds_list_del(&event
->list
);
544 lttng_destroy_context(event
->ctx
);
549 * We have exclusive access to our metadata buffer (protected by the
550 * ust_lock), so we can do racy operations such as looking for
551 * remaining space left in packet and write, since mutual exclusion
552 * protects us from concurrent writes.
554 int lttng_metadata_printf(struct ltt_session
*session
,
555 const char *fmt
, ...)
557 struct lttng_ust_lib_ring_buffer_ctx ctx
;
558 struct ltt_channel
*chan
= session
->metadata
;
560 int ret
= 0, waitret
;
561 size_t len
, reserve_len
, pos
;
564 WARN_ON_ONCE(!CMM_ACCESS_ONCE(session
->active
));
567 ret
= vasprintf(&str
, fmt
, ap
);
575 for (pos
= 0; pos
< len
; pos
+= reserve_len
) {
576 reserve_len
= min_t(size_t,
577 chan
->ops
->packet_avail_size(chan
->chan
, chan
->handle
),
579 lib_ring_buffer_ctx_init(&ctx
, chan
->chan
, NULL
, reserve_len
,
580 sizeof(char), -1, chan
->handle
);
582 * We don't care about metadata buffer's records lost
583 * count, because we always retry here. Report error if
584 * we need to bail out after timeout or being
587 waitret
= wait_cond_interruptible_timeout(
589 ret
= chan
->ops
->event_reserve(&ctx
, 0);
590 ret
!= -ENOBUFS
|| !ret
;
592 LTTNG_METADATA_TIMEOUT_MSEC
);
593 if (waitret
== -ETIMEDOUT
|| waitret
== -EINTR
|| ret
) {
594 DBG("LTTng: Failure to write metadata to buffers (%s)\n",
595 waitret
== -EINTR
? "interrupted" :
596 (ret
== -ENOBUFS
? "timeout" : "I/O error"));
597 if (waitret
== -EINTR
)
601 chan
->ops
->event_write(&ctx
, &str
[pos
], reserve_len
);
602 chan
->ops
->event_commit(&ctx
);
610 int _ltt_field_statedump(struct ltt_session
*session
,
611 const struct lttng_event_field
*field
)
615 switch (field
->type
.atype
) {
617 ret
= lttng_metadata_printf(session
,
618 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s;\n",
619 field
->type
.u
.basic
.integer
.size
,
620 field
->type
.u
.basic
.integer
.alignment
,
621 field
->type
.u
.basic
.integer
.signedness
,
622 (field
->type
.u
.basic
.integer
.encoding
== lttng_encode_none
)
624 : (field
->type
.u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
627 field
->type
.u
.basic
.integer
.base
,
628 #if (BYTE_ORDER == BIG_ENDIAN)
629 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
631 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
636 ret
= lttng_metadata_printf(session
,
637 " floating_point { exp_dig = %u; mant_dig = %u; align = %u;%s } _%s;\n",
638 field
->type
.u
.basic
._float
.exp_dig
,
639 field
->type
.u
.basic
._float
.mant_dig
,
640 field
->type
.u
.basic
._float
.alignment
,
641 #if (BYTE_ORDER == BIG_ENDIAN)
642 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
644 field
->type
.u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
649 ret
= lttng_metadata_printf(session
,
651 field
->type
.u
.basic
.enumeration
.name
,
656 const struct lttng_basic_type
*elem_type
;
658 elem_type
= &field
->type
.u
.array
.elem_type
;
659 ret
= lttng_metadata_printf(session
,
660 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[%u];\n",
661 elem_type
->u
.basic
.integer
.size
,
662 elem_type
->u
.basic
.integer
.alignment
,
663 elem_type
->u
.basic
.integer
.signedness
,
664 (elem_type
->u
.basic
.integer
.encoding
== lttng_encode_none
)
666 : (elem_type
->u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
669 elem_type
->u
.basic
.integer
.base
,
670 #if (BYTE_ORDER == BIG_ENDIAN)
671 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
673 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
675 field
->name
, field
->type
.u
.array
.length
);
680 const struct lttng_basic_type
*elem_type
;
681 const struct lttng_basic_type
*length_type
;
683 elem_type
= &field
->type
.u
.sequence
.elem_type
;
684 length_type
= &field
->type
.u
.sequence
.length_type
;
685 ret
= lttng_metadata_printf(session
,
686 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } __%s_length;\n",
687 length_type
->u
.basic
.integer
.size
,
688 (unsigned int) length_type
->u
.basic
.integer
.alignment
,
689 length_type
->u
.basic
.integer
.signedness
,
690 (length_type
->u
.basic
.integer
.encoding
== lttng_encode_none
)
692 : ((length_type
->u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
695 length_type
->u
.basic
.integer
.base
,
696 #if (BYTE_ORDER == BIG_ENDIAN)
697 length_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
699 length_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
705 ret
= lttng_metadata_printf(session
,
706 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[ __%s_length ];\n",
707 elem_type
->u
.basic
.integer
.size
,
708 (unsigned int) elem_type
->u
.basic
.integer
.alignment
,
709 elem_type
->u
.basic
.integer
.signedness
,
710 (elem_type
->u
.basic
.integer
.encoding
== lttng_encode_none
)
712 : ((elem_type
->u
.basic
.integer
.encoding
== lttng_encode_UTF8
)
715 elem_type
->u
.basic
.integer
.base
,
716 #if (BYTE_ORDER == BIG_ENDIAN)
717 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = le;" : "",
719 elem_type
->u
.basic
.integer
.reverse_byte_order
? " byte_order = be;" : "",
727 /* Default encoding is UTF8 */
728 ret
= lttng_metadata_printf(session
,
730 field
->type
.u
.basic
.string
.encoding
== lttng_encode_ASCII
?
731 " { encoding = ASCII; }" : "",
742 int _ltt_context_metadata_statedump(struct ltt_session
*session
,
743 struct lttng_ctx
*ctx
)
750 for (i
= 0; i
< ctx
->nr_fields
; i
++) {
751 const struct lttng_ctx_field
*field
= &ctx
->fields
[i
];
753 ret
= _ltt_field_statedump(session
, &field
->event_field
);
761 int _ltt_fields_metadata_statedump(struct ltt_session
*session
,
762 struct ltt_event
*event
)
764 const struct lttng_event_desc
*desc
= event
->desc
;
768 for (i
= 0; i
< desc
->nr_fields
; i
++) {
769 const struct lttng_event_field
*field
= &desc
->fields
[i
];
771 ret
= _ltt_field_statedump(session
, field
);
779 int _ltt_event_metadata_statedump(struct ltt_session
*session
,
780 struct ltt_channel
*chan
,
781 struct ltt_event
*event
)
785 if (event
->metadata_dumped
|| !CMM_ACCESS_ONCE(session
->active
))
787 if (chan
== session
->metadata
)
790 * Don't print events for which probe load is pending.
795 ret
= lttng_metadata_printf(session
,
799 " stream_id = %u;\n",
807 ret
= lttng_metadata_printf(session
,
808 " context := struct {\n");
812 ret
= _ltt_context_metadata_statedump(session
, event
->ctx
);
816 ret
= lttng_metadata_printf(session
,
822 ret
= lttng_metadata_printf(session
,
823 " fields := struct {\n"
828 ret
= _ltt_fields_metadata_statedump(session
, event
);
833 * LTTng space reservation can only reserve multiples of the
836 ret
= lttng_metadata_printf(session
,
842 event
->metadata_dumped
= 1;
849 int _ltt_channel_metadata_statedump(struct ltt_session
*session
,
850 struct ltt_channel
*chan
)
854 if (chan
->metadata_dumped
|| !CMM_ACCESS_ONCE(session
->active
))
856 if (chan
== session
->metadata
)
859 WARN_ON_ONCE(!chan
->header_type
);
860 ret
= lttng_metadata_printf(session
,
863 " event.header := %s;\n"
864 " packet.context := struct packet_context;\n",
866 chan
->header_type
== 1 ? "struct event_header_compact" :
867 "struct event_header_large");
872 ret
= lttng_metadata_printf(session
,
873 " event.context := struct {\n");
877 ret
= _ltt_context_metadata_statedump(session
, chan
->ctx
);
881 ret
= lttng_metadata_printf(session
,
887 ret
= lttng_metadata_printf(session
,
890 chan
->metadata_dumped
= 1;
896 int _ltt_stream_packet_context_declare(struct ltt_session
*session
)
898 return lttng_metadata_printf(session
,
899 "struct packet_context {\n"
900 " uint64_t timestamp_begin;\n"
901 " uint64_t timestamp_end;\n"
902 " uint32_t events_discarded;\n"
903 " uint32_t content_size;\n"
904 " uint32_t packet_size;\n"
905 " uint32_t cpu_id;\n"
913 * id 31 is reserved to indicate an extended header.
916 * id: range: 0 - 65534.
917 * id 65535 is reserved to indicate an extended header.
920 int _ltt_event_header_declare(struct ltt_session
*session
)
922 return lttng_metadata_printf(session
,
923 "struct event_header_compact {\n"
924 " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n"
927 " uint27_t timestamp;\n"
931 " uint64_t timestamp;\n"
936 "struct event_header_large {\n"
937 " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n"
940 " uint32_t timestamp;\n"
944 " uint64_t timestamp;\n"
948 lttng_alignof(uint32_t) * CHAR_BIT
,
949 lttng_alignof(uint16_t) * CHAR_BIT
954 * Output metadata into this session's metadata buffers.
957 int _ltt_session_metadata_statedump(struct ltt_session
*session
)
959 unsigned char *uuid_c
= session
->uuid
;
961 struct ltt_channel
*chan
;
962 struct ltt_event
*event
;
965 if (!CMM_ACCESS_ONCE(session
->active
))
967 if (session
->metadata_dumped
)
969 if (!session
->metadata
) {
970 DBG("LTTng: attempt to start tracing, but metadata channel is not found. Operation abort.\n");
974 snprintf(uuid_s
, sizeof(uuid_s
),
975 "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
976 uuid_c
[0], uuid_c
[1], uuid_c
[2], uuid_c
[3],
977 uuid_c
[4], uuid_c
[5], uuid_c
[6], uuid_c
[7],
978 uuid_c
[8], uuid_c
[9], uuid_c
[10], uuid_c
[11],
979 uuid_c
[12], uuid_c
[13], uuid_c
[14], uuid_c
[15]);
981 ret
= lttng_metadata_printf(session
,
982 "typealias integer { size = 8; align = %u; signed = false; } := uint8_t;\n"
983 "typealias integer { size = 16; align = %u; signed = false; } := uint16_t;\n"
984 "typealias integer { size = 32; align = %u; signed = false; } := uint32_t;\n"
985 "typealias integer { size = 64; align = %u; signed = false; } := uint64_t;\n"
986 "typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n"
987 "typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n"
993 " byte_order = %s;\n"
994 " packet.header := struct {\n"
996 " uint8_t uuid[16];\n"
997 " uint32_t stream_id;\n"
1000 lttng_alignof(uint8_t) * CHAR_BIT
,
1001 lttng_alignof(uint16_t) * CHAR_BIT
,
1002 lttng_alignof(uint32_t) * CHAR_BIT
,
1003 lttng_alignof(uint64_t) * CHAR_BIT
,
1007 #if (BYTE_ORDER == BIG_ENDIAN)
1016 ret
= _ltt_stream_packet_context_declare(session
);
1020 ret
= _ltt_event_header_declare(session
);
1025 cds_list_for_each_entry(chan
, &session
->chan
, list
) {
1026 ret
= _ltt_channel_metadata_statedump(session
, chan
);
1031 cds_list_for_each_entry(event
, &session
->events
, list
) {
1032 ret
= _ltt_event_metadata_statedump(session
, event
->chan
, event
);
1036 session
->metadata_dumped
= 1;
1041 void lttng_ust_events_exit(void)
1043 struct ltt_session
*session
, *tmpsession
;
1045 cds_list_for_each_entry_safe(session
, tmpsession
, &sessions
, list
)
1046 ltt_session_destroy(session
);