Cygwin: Pass file paths instead of file descriptors over UNIX sockets
[lttng-ust.git] / liblttng-ust / ltt-events.c
1 /*
2 * ltt-events.c
3 *
4 * Holds LTTng per-session event registry.
5 *
6 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; only
11 * version 2.1 of the License.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 #define _GNU_SOURCE
24 #include <stdio.h>
25 #include <urcu/list.h>
26 #include <urcu/hlist.h>
27 #include <pthread.h>
28 #include <errno.h>
29 #include <sys/shm.h>
30 #include <sys/ipc.h>
31 #include <stdint.h>
32 #include <stddef.h>
33 #include <inttypes.h>
34 #include <time.h>
35 #include <lttng/ust-endian.h>
36 #include "clock.h"
37
38 #include <urcu-bp.h>
39 #include <urcu/compiler.h>
40 #include <urcu/uatomic.h>
41 #include <urcu/arch.h>
42
43 #include <lttng/tracepoint.h>
44 #include <lttng/ust-events.h>
45
46 #include <usterr-signal-safe.h>
47 #include <helper.h>
48 #include "error.h"
49 #include "compat.h"
50 #include "lttng-ust-uuid.h"
51
52 #include "tracepoint-internal.h"
53 #include "ltt-tracer.h"
54 #include "ltt-tracer-core.h"
55 #include "wait.h"
56 #include "../libringbuffer/shm.h"
57 #include "jhash.h"
58
59 /*
60 * The sessions mutex is the centralized mutex across UST tracing
61 * control and probe registration. All operations within this file are
62 * called by the communication thread, under ust_lock protection.
63 */
64 static pthread_mutex_t sessions_mutex = PTHREAD_MUTEX_INITIALIZER;
65
66 void ust_lock(void)
67 {
68 pthread_mutex_lock(&sessions_mutex);
69 }
70
71 void ust_unlock(void)
72 {
73 pthread_mutex_unlock(&sessions_mutex);
74 }
75
76 static CDS_LIST_HEAD(sessions);
77
78 /*
79 * Wildcard list, containing the active wildcards.
80 * Protected by ust lock.
81 */
82 static CDS_LIST_HEAD(wildcard_list);
83
84 /*
85 * Pending probes hash table, containing the registered ltt events for
86 * which tracepoint probes are still missing. Protected by the sessions
87 * mutex.
88 */
89 #define PENDING_PROBE_HASH_BITS 6
90 #define PENDING_PROBE_HASH_SIZE (1 << PENDING_PROBE_HASH_BITS)
91 static struct cds_hlist_head pending_probe_table[PENDING_PROBE_HASH_SIZE];
92
93 struct ust_pending_probe {
94 struct ltt_event *event;
95 struct cds_hlist_node node;
96 enum lttng_ust_loglevel_type loglevel_type;
97 int loglevel;
98 char name[];
99 };
100
101 static void _ltt_event_destroy(struct ltt_event *event);
102 static void _ltt_wildcard_destroy(struct session_wildcard *sw);
103 static void _ltt_channel_destroy(struct ltt_channel *chan);
104 static int _ltt_event_unregister(struct ltt_event *event);
105 static
106 int _ltt_event_metadata_statedump(struct ltt_session *session,
107 struct ltt_channel *chan,
108 struct ltt_event *event);
109 static
110 int _ltt_session_metadata_statedump(struct ltt_session *session);
111
112 int ltt_loglevel_match(const struct lttng_event_desc *desc,
113 enum lttng_ust_loglevel_type req_type,
114 int req_loglevel)
115 {
116 int ev_loglevel;
117
118 if (req_type == LTTNG_UST_LOGLEVEL_ALL)
119 return 1;
120 if (!desc->loglevel)
121 ev_loglevel = TRACE_DEFAULT;
122 else
123 ev_loglevel = *(*desc->loglevel);
124 switch (req_type) {
125 case LTTNG_UST_LOGLEVEL_RANGE:
126 if (ev_loglevel <= req_loglevel || req_loglevel == -1)
127 return 1;
128 else
129 return 0;
130 case LTTNG_UST_LOGLEVEL_SINGLE:
131 if (ev_loglevel == req_loglevel || req_loglevel == -1)
132 return 1;
133 else
134 return 0;
135 case LTTNG_UST_LOGLEVEL_ALL:
136 default:
137 return 1;
138 }
139 }
140
141 /*
142 * Return wildcard for a given event name if the event name match the
143 * one of the wildcards.
144 * Must be called with ust lock held.
145 * Returns NULL if not present.
146 */
147 static
148 struct wildcard_entry *match_wildcard(const struct lttng_event_desc *desc)
149 {
150 struct wildcard_entry *e;
151
152 cds_list_for_each_entry(e, &wildcard_list, list) {
153 /* If only contain '*' */
154 if (strlen(e->name) == 1)
155 goto possible_match;
156 /* Compare excluding final '*' */
157 if (!strncmp(desc->name, e->name, strlen(e->name) - 1))
158 goto possible_match;
159 continue; /* goto next, no match */
160 possible_match:
161 if (ltt_loglevel_match(desc,
162 e->loglevel_type,
163 e->loglevel)) {
164 return e;
165 }
166 /* no match, loop to next */
167 }
168 return NULL;
169 }
170
171 /*
172 * called at event creation if probe is missing.
173 * called with session mutex held.
174 */
175 static
176 int add_pending_probe(struct ltt_event *event, const char *name,
177 enum lttng_ust_loglevel_type loglevel_type,
178 int loglevel)
179 {
180 struct cds_hlist_head *head;
181 struct ust_pending_probe *e;
182 size_t name_len = strlen(name) + 1;
183 uint32_t hash;
184
185 if (name_len > LTTNG_UST_SYM_NAME_LEN) {
186 WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name, LTTNG_UST_SYM_NAME_LEN);
187 name_len = LTTNG_UST_SYM_NAME_LEN;
188 }
189 hash = jhash(name, name_len - 1, 0);
190 head = &pending_probe_table[hash & (PENDING_PROBE_HASH_SIZE - 1)];
191 e = zmalloc(sizeof(struct ust_pending_probe) + name_len);
192 if (!e)
193 return -ENOMEM;
194 memcpy(&e->name[0], name, name_len);
195 e->name[name_len - 1] = '\0';
196 e->loglevel_type = loglevel_type;
197 e->loglevel = loglevel;
198 cds_hlist_add_head(&e->node, head);
199 e->event = event;
200 event->pending_probe = e;
201 return 0;
202 }
203
204 /*
205 * remove a pending probe. called when at event teardown and when an
206 * event is fixed (probe is loaded).
207 * called with session mutex held.
208 */
209 static
210 void remove_pending_probe(struct ust_pending_probe *e)
211 {
212 if (!e)
213 return;
214 cds_hlist_del(&e->node);
215 free(e);
216 }
217
218 /*
219 * Called at library load: connect the probe on the events pending on
220 * probe load.
221 * called with session mutex held.
222 */
223 int pending_probe_fix_events(const struct lttng_event_desc *desc)
224 {
225 struct cds_hlist_head *head;
226 struct cds_hlist_node *node, *p;
227 struct ust_pending_probe *e;
228 const char *name = desc->name;
229 int ret = 0;
230 struct lttng_ust_event event_param;
231 size_t name_len = strlen(name) + 1;
232 uint32_t hash;
233
234 /* Wildcard */
235 {
236 struct wildcard_entry *wildcard;
237
238 wildcard = match_wildcard(desc);
239 if (strcmp(desc->name, "lttng_ust:metadata") && wildcard) {
240 struct session_wildcard *sw;
241
242 cds_list_for_each_entry(sw, &wildcard->session_list,
243 session_list) {
244 struct ltt_event *ev;
245 int ret;
246
247 memcpy(&event_param, &sw->event_param,
248 sizeof(event_param));
249 strncpy(event_param.name,
250 desc->name,
251 sizeof(event_param.name));
252 event_param.name[sizeof(event_param.name) - 1] = '\0';
253 /* create event */
254 ret = ltt_event_create(sw->chan,
255 &event_param, NULL,
256 &ev);
257 if (ret) {
258 DBG("Error creating event");
259 continue;
260 }
261 cds_list_add(&ev->wildcard_list,
262 &sw->events);
263 }
264 }
265 }
266
267 if (name_len > LTTNG_UST_SYM_NAME_LEN) {
268 WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name, LTTNG_UST_SYM_NAME_LEN);
269 name_len = LTTNG_UST_SYM_NAME_LEN;
270 }
271 hash = jhash(name, name_len - 1, 0);
272 head = &pending_probe_table[hash & (PENDING_PROBE_HASH_SIZE - 1)];
273 cds_hlist_for_each_entry_safe(e, node, p, head, node) {
274 struct ltt_event *event;
275 struct ltt_channel *chan;
276
277 if (!ltt_loglevel_match(desc,
278 e->loglevel_type,
279 e->loglevel)) {
280 continue;
281 }
282 if (strncmp(name, e->name, LTTNG_UST_SYM_NAME_LEN - 1)) {
283 continue;
284 }
285 event = e->event;
286 chan = event->chan;
287 assert(!event->desc);
288 event->desc = desc;
289 event->pending_probe = NULL;
290 remove_pending_probe(e);
291 ret |= __tracepoint_probe_register(name,
292 event->desc->probe_callback,
293 event, event->desc->signature);
294 if (ret)
295 continue;
296 event->id = chan->free_event_id++;
297 ret |= _ltt_event_metadata_statedump(chan->session, chan,
298 event);
299 }
300 return ret;
301 }
302
303 void synchronize_trace(void)
304 {
305 synchronize_rcu();
306 }
307
308 struct ltt_session *ltt_session_create(void)
309 {
310 struct ltt_session *session;
311 int ret;
312
313 session = zmalloc(sizeof(struct ltt_session));
314 if (!session)
315 return NULL;
316 CDS_INIT_LIST_HEAD(&session->chan);
317 CDS_INIT_LIST_HEAD(&session->events);
318 CDS_INIT_LIST_HEAD(&session->wildcards);
319 ret = lttng_ust_uuid_generate(session->uuid);
320 if (ret != 0) {
321 session->uuid[0] = '\0';
322 }
323 cds_list_add(&session->list, &sessions);
324 return session;
325 }
326
327 void ltt_session_destroy(struct ltt_session *session)
328 {
329 struct ltt_channel *chan, *tmpchan;
330 struct ltt_event *event, *tmpevent;
331 struct session_wildcard *wildcard, *tmpwildcard;
332 int ret;
333
334 CMM_ACCESS_ONCE(session->active) = 0;
335 cds_list_for_each_entry(event, &session->events, list) {
336 ret = _ltt_event_unregister(event);
337 WARN_ON(ret);
338 }
339 synchronize_trace(); /* Wait for in-flight events to complete */
340 cds_list_for_each_entry_safe(wildcard, tmpwildcard, &session->wildcards, list)
341 _ltt_wildcard_destroy(wildcard);
342 cds_list_for_each_entry_safe(event, tmpevent, &session->events, list)
343 _ltt_event_destroy(event);
344 cds_list_for_each_entry_safe(chan, tmpchan, &session->chan, list)
345 _ltt_channel_destroy(chan);
346 cds_list_del(&session->list);
347 free(session);
348 }
349
350 int ltt_session_enable(struct ltt_session *session)
351 {
352 int ret = 0;
353 struct ltt_channel *chan;
354
355 if (session->active) {
356 ret = -EBUSY;
357 goto end;
358 }
359
360 /*
361 * Snapshot the number of events per channel to know the type of header
362 * we need to use.
363 */
364 cds_list_for_each_entry(chan, &session->chan, list) {
365 if (chan->header_type)
366 continue; /* don't change it if session stop/restart */
367 if (chan->free_event_id < 31)
368 chan->header_type = 1; /* compact */
369 else
370 chan->header_type = 2; /* large */
371 }
372
373 CMM_ACCESS_ONCE(session->active) = 1;
374 CMM_ACCESS_ONCE(session->been_active) = 1;
375 ret = _ltt_session_metadata_statedump(session);
376 if (ret)
377 CMM_ACCESS_ONCE(session->active) = 0;
378 end:
379 return ret;
380 }
381
382 int ltt_session_disable(struct ltt_session *session)
383 {
384 int ret = 0;
385
386 if (!session->active) {
387 ret = -EBUSY;
388 goto end;
389 }
390 CMM_ACCESS_ONCE(session->active) = 0;
391 end:
392 return ret;
393 }
394
395 int ltt_channel_enable(struct ltt_channel *channel)
396 {
397 int old;
398
399 if (channel == channel->session->metadata)
400 return -EPERM;
401 old = uatomic_xchg(&channel->enabled, 1);
402 if (old)
403 return -EEXIST;
404 return 0;
405 }
406
407 int ltt_channel_disable(struct ltt_channel *channel)
408 {
409 int old;
410
411 if (channel == channel->session->metadata)
412 return -EPERM;
413 old = uatomic_xchg(&channel->enabled, 0);
414 if (!old)
415 return -EEXIST;
416 return 0;
417 }
418
419 int ltt_event_enable(struct ltt_event *event)
420 {
421 int old;
422
423 if (event->chan == event->chan->session->metadata)
424 return -EPERM;
425 old = uatomic_xchg(&event->enabled, 1);
426 if (old)
427 return -EEXIST;
428 return 0;
429 }
430
431 int ltt_event_disable(struct ltt_event *event)
432 {
433 int old;
434
435 if (event->chan == event->chan->session->metadata)
436 return -EPERM;
437 old = uatomic_xchg(&event->enabled, 0);
438 if (!old)
439 return -EEXIST;
440 return 0;
441 }
442
443 struct ltt_channel *ltt_channel_create(struct ltt_session *session,
444 const char *transport_name,
445 void *buf_addr,
446 size_t subbuf_size, size_t num_subbuf,
447 unsigned int switch_timer_interval,
448 unsigned int read_timer_interval,
449 int **shm_fd, char **shm_path,
450 int **wait_fd, char **wait_pipe_path,
451 uint64_t **memory_map_size,
452 struct ltt_channel *chan_priv_init)
453 {
454 struct ltt_channel *chan = NULL;
455 struct ltt_transport *transport;
456
457 if (session->been_active)
458 goto active; /* Refuse to add channel to active session */
459 transport = ltt_transport_find(transport_name);
460 if (!transport) {
461 DBG("LTTng transport %s not found\n",
462 transport_name);
463 goto notransport;
464 }
465 chan_priv_init->id = session->free_chan_id++;
466 chan_priv_init->session = session;
467 /*
468 * Note: the channel creation op already writes into the packet
469 * headers. Therefore the "chan" information used as input
470 * should be already accessible.
471 */
472 chan = transport->ops.channel_create(transport_name, buf_addr,
473 subbuf_size, num_subbuf, switch_timer_interval,
474 read_timer_interval, shm_fd, shm_path,
475 wait_fd, wait_pipe_path, memory_map_size,
476 chan_priv_init);
477 if (!chan)
478 goto create_error;
479 chan->enabled = 1;
480 chan->ops = &transport->ops;
481 cds_list_add(&chan->list, &session->chan);
482 return chan;
483
484 create_error:
485 notransport:
486 active:
487 return NULL;
488 }
489
490 /*
491 * Only used internally at session destruction.
492 */
493 static
494 void _ltt_channel_destroy(struct ltt_channel *chan)
495 {
496 cds_list_del(&chan->list);
497 lttng_destroy_context(chan->ctx);
498 chan->ops->channel_destroy(chan);
499 }
500
501 /*
502 * Supports event creation while tracing session is active.
503 */
504 int ltt_event_create(struct ltt_channel *chan,
505 struct lttng_ust_event *event_param,
506 void (*filter)(struct ltt_event *event),
507 struct ltt_event **_event)
508 {
509 const struct lttng_event_desc *desc = NULL; /* silence gcc */
510 struct ltt_event *event;
511 int ret = 0;
512
513 if (chan->used_event_id == -1U) {
514 ret = -ENOMEM;
515 goto full;
516 }
517 /*
518 * This is O(n^2) (for each event, the loop is called at event
519 * creation). Might require a hash if we have lots of events.
520 */
521 cds_list_for_each_entry(event, &chan->session->events, list) {
522 if (event->desc && !strncmp(event->desc->name,
523 event_param->name,
524 LTTNG_UST_SYM_NAME_LEN - 1)) {
525 ret = -EEXIST;
526 goto exist;
527 }
528 }
529
530 /*
531 * Check if loglevel match. Refuse to connect event if not.
532 */
533 if (event_param->instrumentation == LTTNG_UST_TRACEPOINT) {
534 desc = ltt_event_get(event_param->name);
535 if (desc) {
536 if (!ltt_loglevel_match(desc,
537 event_param->loglevel_type,
538 event_param->loglevel)) {
539 ret = -EPERM;
540 goto no_loglevel_match;
541 }
542 }
543 /*
544 * If descriptor is not there, it will be added to
545 * pending probes.
546 */
547 }
548 event = zmalloc(sizeof(struct ltt_event));
549 if (!event) {
550 ret = -ENOMEM;
551 goto cache_error;
552 }
553 event->chan = chan;
554 event->filter = filter;
555 /*
556 * used_event_id counts the maximum number of event IDs that can
557 * register if all probes register.
558 */
559 chan->used_event_id++;
560 event->enabled = 1;
561 event->instrumentation = event_param->instrumentation;
562 /* Populate ltt_event structure before tracepoint registration. */
563 cmm_smp_wmb();
564 switch (event_param->instrumentation) {
565 case LTTNG_UST_TRACEPOINT:
566 event->desc = desc;
567 if (event->desc) {
568 ret = __tracepoint_probe_register(event_param->name,
569 event->desc->probe_callback,
570 event, event->desc->signature);
571 if (ret)
572 goto register_error;
573 event->id = chan->free_event_id++;
574 } else {
575 /*
576 * If the probe is not present, event->desc stays NULL,
577 * waiting for the probe to register, and the event->id
578 * stays unallocated.
579 */
580 ret = add_pending_probe(event, event_param->name,
581 event_param->loglevel_type,
582 event_param->loglevel);
583 if (ret)
584 goto add_pending_error;
585 }
586 break;
587 default:
588 WARN_ON_ONCE(1);
589 }
590 if (event->desc) {
591 ret = _ltt_event_metadata_statedump(chan->session, chan, event);
592 if (ret)
593 goto statedump_error;
594 }
595 cds_list_add(&event->list, &chan->session->events);
596 *_event = event;
597 return 0;
598
599 statedump_error:
600 if (event->desc) {
601 WARN_ON_ONCE(__tracepoint_probe_unregister(event_param->name,
602 event->desc->probe_callback,
603 event));
604 ltt_event_put(event->desc);
605 }
606 add_pending_error:
607 register_error:
608 free(event);
609 cache_error:
610 no_loglevel_match:
611 exist:
612 full:
613 return ret;
614 }
615
616 /*
617 * Only used internally at session destruction.
618 */
619 int _ltt_event_unregister(struct ltt_event *event)
620 {
621 int ret = -EINVAL;
622
623 switch (event->instrumentation) {
624 case LTTNG_UST_TRACEPOINT:
625 if (event->desc) {
626 ret = __tracepoint_probe_unregister(event->desc->name,
627 event->desc->probe_callback,
628 event);
629 if (ret)
630 return ret;
631 } else {
632 remove_pending_probe(event->pending_probe);
633 ret = 0;
634 }
635 break;
636 default:
637 WARN_ON_ONCE(1);
638 }
639 return ret;
640 }
641
642 /*
643 * Only used internally at session destruction.
644 */
645 static
646 void _ltt_event_destroy(struct ltt_event *event)
647 {
648 switch (event->instrumentation) {
649 case LTTNG_UST_TRACEPOINT:
650 if (event->desc) {
651 ltt_event_put(event->desc);
652 }
653 break;
654 default:
655 WARN_ON_ONCE(1);
656 }
657 cds_list_del(&event->list);
658 lttng_destroy_context(event->ctx);
659 free(event);
660 }
661
662 /*
663 * We have exclusive access to our metadata buffer (protected by the
664 * ust_lock), so we can do racy operations such as looking for
665 * remaining space left in packet and write, since mutual exclusion
666 * protects us from concurrent writes.
667 */
668 int lttng_metadata_printf(struct ltt_session *session,
669 const char *fmt, ...)
670 {
671 struct lttng_ust_lib_ring_buffer_ctx ctx;
672 struct ltt_channel *chan = session->metadata;
673 char *str = NULL;
674 int ret = 0, waitret;
675 size_t len, reserve_len, pos;
676 va_list ap;
677
678 WARN_ON_ONCE(!CMM_ACCESS_ONCE(session->active));
679
680 va_start(ap, fmt);
681 ret = vasprintf(&str, fmt, ap);
682 va_end(ap);
683 if (ret < 0)
684 return -ENOMEM;
685
686 len = strlen(str);
687 pos = 0;
688
689 for (pos = 0; pos < len; pos += reserve_len) {
690 reserve_len = min_t(size_t,
691 chan->ops->packet_avail_size(chan->chan, chan->handle),
692 len - pos);
693 lib_ring_buffer_ctx_init(&ctx, chan->chan, NULL, reserve_len,
694 sizeof(char), -1, chan->handle);
695 /*
696 * We don't care about metadata buffer's records lost
697 * count, because we always retry here. Report error if
698 * we need to bail out after timeout or being
699 * interrupted.
700 */
701 waitret = wait_cond_interruptible_timeout(
702 ({
703 ret = chan->ops->event_reserve(&ctx, 0);
704 ret != -ENOBUFS || !ret;
705 }),
706 LTTNG_METADATA_TIMEOUT_MSEC);
707 if (waitret == -ETIMEDOUT || waitret == -EINTR || ret) {
708 DBG("LTTng: Failure to write metadata to buffers (%s)\n",
709 waitret == -EINTR ? "interrupted" :
710 (ret == -ENOBUFS ? "timeout" : "I/O error"));
711 if (waitret == -EINTR)
712 ret = waitret;
713 goto end;
714 }
715 chan->ops->event_write(&ctx, &str[pos], reserve_len);
716 chan->ops->event_commit(&ctx);
717 }
718 end:
719 free(str);
720 return ret;
721 }
722
723 static
724 int _ltt_field_statedump(struct ltt_session *session,
725 const struct lttng_event_field *field)
726 {
727 int ret = 0;
728
729 switch (field->type.atype) {
730 case atype_integer:
731 ret = lttng_metadata_printf(session,
732 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s;\n",
733 field->type.u.basic.integer.size,
734 field->type.u.basic.integer.alignment,
735 field->type.u.basic.integer.signedness,
736 (field->type.u.basic.integer.encoding == lttng_encode_none)
737 ? "none"
738 : (field->type.u.basic.integer.encoding == lttng_encode_UTF8)
739 ? "UTF8"
740 : "ASCII",
741 field->type.u.basic.integer.base,
742 #if (BYTE_ORDER == BIG_ENDIAN)
743 field->type.u.basic.integer.reverse_byte_order ? " byte_order = le;" : "",
744 #else
745 field->type.u.basic.integer.reverse_byte_order ? " byte_order = be;" : "",
746 #endif
747 field->name);
748 break;
749 case atype_float:
750 ret = lttng_metadata_printf(session,
751 " floating_point { exp_dig = %u; mant_dig = %u; align = %u;%s } _%s;\n",
752 field->type.u.basic._float.exp_dig,
753 field->type.u.basic._float.mant_dig,
754 field->type.u.basic._float.alignment,
755 #if (BYTE_ORDER == BIG_ENDIAN)
756 field->type.u.basic.integer.reverse_byte_order ? " byte_order = le;" : "",
757 #else
758 field->type.u.basic.integer.reverse_byte_order ? " byte_order = be;" : "",
759 #endif
760 field->name);
761 break;
762 case atype_enum:
763 ret = lttng_metadata_printf(session,
764 " %s %s;\n",
765 field->type.u.basic.enumeration.name,
766 field->name);
767 break;
768 case atype_array:
769 {
770 const struct lttng_basic_type *elem_type;
771
772 elem_type = &field->type.u.array.elem_type;
773 ret = lttng_metadata_printf(session,
774 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[%u];\n",
775 elem_type->u.basic.integer.size,
776 elem_type->u.basic.integer.alignment,
777 elem_type->u.basic.integer.signedness,
778 (elem_type->u.basic.integer.encoding == lttng_encode_none)
779 ? "none"
780 : (elem_type->u.basic.integer.encoding == lttng_encode_UTF8)
781 ? "UTF8"
782 : "ASCII",
783 elem_type->u.basic.integer.base,
784 #if (BYTE_ORDER == BIG_ENDIAN)
785 elem_type->u.basic.integer.reverse_byte_order ? " byte_order = le;" : "",
786 #else
787 elem_type->u.basic.integer.reverse_byte_order ? " byte_order = be;" : "",
788 #endif
789 field->name, field->type.u.array.length);
790 break;
791 }
792 case atype_sequence:
793 {
794 const struct lttng_basic_type *elem_type;
795 const struct lttng_basic_type *length_type;
796
797 elem_type = &field->type.u.sequence.elem_type;
798 length_type = &field->type.u.sequence.length_type;
799 ret = lttng_metadata_printf(session,
800 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } __%s_length;\n",
801 length_type->u.basic.integer.size,
802 (unsigned int) length_type->u.basic.integer.alignment,
803 length_type->u.basic.integer.signedness,
804 (length_type->u.basic.integer.encoding == lttng_encode_none)
805 ? "none"
806 : ((length_type->u.basic.integer.encoding == lttng_encode_UTF8)
807 ? "UTF8"
808 : "ASCII"),
809 length_type->u.basic.integer.base,
810 #if (BYTE_ORDER == BIG_ENDIAN)
811 length_type->u.basic.integer.reverse_byte_order ? " byte_order = le;" : "",
812 #else
813 length_type->u.basic.integer.reverse_byte_order ? " byte_order = be;" : "",
814 #endif
815 field->name);
816 if (ret)
817 return ret;
818
819 ret = lttng_metadata_printf(session,
820 " integer { size = %u; align = %u; signed = %u; encoding = %s; base = %u;%s } _%s[ __%s_length ];\n",
821 elem_type->u.basic.integer.size,
822 (unsigned int) elem_type->u.basic.integer.alignment,
823 elem_type->u.basic.integer.signedness,
824 (elem_type->u.basic.integer.encoding == lttng_encode_none)
825 ? "none"
826 : ((elem_type->u.basic.integer.encoding == lttng_encode_UTF8)
827 ? "UTF8"
828 : "ASCII"),
829 elem_type->u.basic.integer.base,
830 #if (BYTE_ORDER == BIG_ENDIAN)
831 elem_type->u.basic.integer.reverse_byte_order ? " byte_order = le;" : "",
832 #else
833 elem_type->u.basic.integer.reverse_byte_order ? " byte_order = be;" : "",
834 #endif
835 field->name,
836 field->name);
837 break;
838 }
839
840 case atype_string:
841 /* Default encoding is UTF8 */
842 ret = lttng_metadata_printf(session,
843 " string%s _%s;\n",
844 field->type.u.basic.string.encoding == lttng_encode_ASCII ?
845 " { encoding = ASCII; }" : "",
846 field->name);
847 break;
848 default:
849 WARN_ON_ONCE(1);
850 return -EINVAL;
851 }
852 return ret;
853 }
854
855 static
856 int _ltt_context_metadata_statedump(struct ltt_session *session,
857 struct lttng_ctx *ctx)
858 {
859 int ret = 0;
860 int i;
861
862 if (!ctx)
863 return 0;
864 for (i = 0; i < ctx->nr_fields; i++) {
865 const struct lttng_ctx_field *field = &ctx->fields[i];
866
867 ret = _ltt_field_statedump(session, &field->event_field);
868 if (ret)
869 return ret;
870 }
871 return ret;
872 }
873
874 static
875 int _ltt_fields_metadata_statedump(struct ltt_session *session,
876 struct ltt_event *event)
877 {
878 const struct lttng_event_desc *desc = event->desc;
879 int ret = 0;
880 int i;
881
882 for (i = 0; i < desc->nr_fields; i++) {
883 const struct lttng_event_field *field = &desc->fields[i];
884
885 ret = _ltt_field_statedump(session, field);
886 if (ret)
887 return ret;
888 }
889 return ret;
890 }
891
892 static
893 int _ltt_event_metadata_statedump(struct ltt_session *session,
894 struct ltt_channel *chan,
895 struct ltt_event *event)
896 {
897 int ret = 0;
898 int loglevel = TRACE_DEFAULT;
899
900 if (event->metadata_dumped || !CMM_ACCESS_ONCE(session->active))
901 return 0;
902 if (chan == session->metadata)
903 return 0;
904 /*
905 * Don't print events for which probe load is pending.
906 */
907 if (!event->desc)
908 return 0;
909
910 ret = lttng_metadata_printf(session,
911 "event {\n"
912 " name = \"%s\";\n"
913 " id = %u;\n"
914 " stream_id = %u;\n",
915 event->desc->name,
916 event->id,
917 event->chan->id);
918 if (ret)
919 goto end;
920
921 if (event->desc->loglevel)
922 loglevel = *(*event->desc->loglevel);
923
924 ret = lttng_metadata_printf(session,
925 " loglevel = %d;\n",
926 loglevel);
927 if (ret)
928 goto end;
929
930 if (event->ctx) {
931 ret = lttng_metadata_printf(session,
932 " context := struct {\n");
933 if (ret)
934 goto end;
935 }
936 ret = _ltt_context_metadata_statedump(session, event->ctx);
937 if (ret)
938 goto end;
939 if (event->ctx) {
940 ret = lttng_metadata_printf(session,
941 " };\n");
942 if (ret)
943 goto end;
944 }
945
946 ret = lttng_metadata_printf(session,
947 " fields := struct {\n"
948 );
949 if (ret)
950 goto end;
951
952 ret = _ltt_fields_metadata_statedump(session, event);
953 if (ret)
954 goto end;
955
956 /*
957 * LTTng space reservation can only reserve multiples of the
958 * byte size.
959 */
960 ret = lttng_metadata_printf(session,
961 " };\n"
962 "};\n\n");
963 if (ret)
964 goto end;
965
966 event->metadata_dumped = 1;
967 end:
968 return ret;
969
970 }
971
972 static
973 int _ltt_channel_metadata_statedump(struct ltt_session *session,
974 struct ltt_channel *chan)
975 {
976 int ret = 0;
977
978 if (chan->metadata_dumped || !CMM_ACCESS_ONCE(session->active))
979 return 0;
980 if (chan == session->metadata)
981 return 0;
982
983 WARN_ON_ONCE(!chan->header_type);
984 ret = lttng_metadata_printf(session,
985 "stream {\n"
986 " id = %u;\n"
987 " event.header := %s;\n"
988 " packet.context := struct packet_context;\n",
989 chan->id,
990 chan->header_type == 1 ? "struct event_header_compact" :
991 "struct event_header_large");
992 if (ret)
993 goto end;
994
995 if (chan->ctx) {
996 ret = lttng_metadata_printf(session,
997 " event.context := struct {\n");
998 if (ret)
999 goto end;
1000 }
1001 ret = _ltt_context_metadata_statedump(session, chan->ctx);
1002 if (ret)
1003 goto end;
1004 if (chan->ctx) {
1005 ret = lttng_metadata_printf(session,
1006 " };\n");
1007 if (ret)
1008 goto end;
1009 }
1010
1011 ret = lttng_metadata_printf(session,
1012 "};\n\n");
1013
1014 chan->metadata_dumped = 1;
1015 end:
1016 return ret;
1017 }
1018
1019 static
1020 int _ltt_stream_packet_context_declare(struct ltt_session *session)
1021 {
1022 return lttng_metadata_printf(session,
1023 "struct packet_context {\n"
1024 " uint64_clock_monotonic_t timestamp_begin;\n"
1025 " uint64_clock_monotonic_t timestamp_end;\n"
1026 " uint32_t events_discarded;\n"
1027 " uint32_t content_size;\n"
1028 " uint32_t packet_size;\n"
1029 " uint32_t cpu_id;\n"
1030 "};\n\n"
1031 );
1032 }
1033
1034 /*
1035 * Compact header:
1036 * id: range: 0 - 30.
1037 * id 31 is reserved to indicate an extended header.
1038 *
1039 * Large header:
1040 * id: range: 0 - 65534.
1041 * id 65535 is reserved to indicate an extended header.
1042 */
1043 static
1044 int _ltt_event_header_declare(struct ltt_session *session)
1045 {
1046 return lttng_metadata_printf(session,
1047 "struct event_header_compact {\n"
1048 " enum : uint5_t { compact = 0 ... 30, extended = 31 } id;\n"
1049 " variant <id> {\n"
1050 " struct {\n"
1051 " uint27_clock_monotonic_t timestamp;\n"
1052 " } compact;\n"
1053 " struct {\n"
1054 " uint32_t id;\n"
1055 " uint64_clock_monotonic_t timestamp;\n"
1056 " } extended;\n"
1057 " } v;\n"
1058 "} align(%u);\n"
1059 "\n"
1060 "struct event_header_large {\n"
1061 " enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id;\n"
1062 " variant <id> {\n"
1063 " struct {\n"
1064 " uint32_clock_monotonic_t timestamp;\n"
1065 " } compact;\n"
1066 " struct {\n"
1067 " uint32_t id;\n"
1068 " uint64_clock_monotonic_t timestamp;\n"
1069 " } extended;\n"
1070 " } v;\n"
1071 "} align(%u);\n\n",
1072 lttng_alignof(uint32_t) * CHAR_BIT,
1073 lttng_alignof(uint16_t) * CHAR_BIT
1074 );
1075 }
1076
1077 /*
1078 * Approximation of NTP time of day to clock monotonic correlation,
1079 * taken at start of trace.
1080 * Yes, this is only an approximation. Yes, we can (and will) do better
1081 * in future versions.
1082 */
1083 static
1084 uint64_t measure_clock_offset(void)
1085 {
1086 uint64_t offset, monotonic[2], realtime;
1087 struct timespec rts = { 0, 0 };
1088 int ret;
1089
1090 monotonic[0] = trace_clock_read64();
1091 ret = clock_gettime(CLOCK_REALTIME, &rts);
1092 if (ret < 0)
1093 return 0;
1094 monotonic[1] = trace_clock_read64();
1095 offset = (monotonic[0] + monotonic[1]) >> 1;
1096 realtime = (uint64_t) rts.tv_sec * 1000000000ULL;
1097 realtime += rts.tv_nsec;
1098 offset = realtime - offset;
1099 return offset;
1100 }
1101
1102 /*
1103 * Output metadata into this session's metadata buffers.
1104 */
1105 static
1106 int _ltt_session_metadata_statedump(struct ltt_session *session)
1107 {
1108 unsigned char *uuid_c = session->uuid;
1109 char uuid_s[LTTNG_UST_UUID_STR_LEN],
1110 clock_uuid_s[LTTNG_UST_UUID_STR_LEN];
1111 struct ltt_channel *chan;
1112 struct ltt_event *event;
1113 int ret = 0;
1114 char procname[LTTNG_UST_PROCNAME_LEN] = "";
1115
1116 if (!CMM_ACCESS_ONCE(session->active))
1117 return 0;
1118 if (session->metadata_dumped)
1119 goto skip_session;
1120 if (!session->metadata) {
1121 DBG("LTTng: attempt to start tracing, but metadata channel is not found. Operation abort.\n");
1122 return -EPERM;
1123 }
1124
1125 snprintf(uuid_s, sizeof(uuid_s),
1126 "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
1127 uuid_c[0], uuid_c[1], uuid_c[2], uuid_c[3],
1128 uuid_c[4], uuid_c[5], uuid_c[6], uuid_c[7],
1129 uuid_c[8], uuid_c[9], uuid_c[10], uuid_c[11],
1130 uuid_c[12], uuid_c[13], uuid_c[14], uuid_c[15]);
1131
1132 ret = lttng_metadata_printf(session,
1133 "typealias integer { size = 8; align = %u; signed = false; } := uint8_t;\n"
1134 "typealias integer { size = 16; align = %u; signed = false; } := uint16_t;\n"
1135 "typealias integer { size = 32; align = %u; signed = false; } := uint32_t;\n"
1136 "typealias integer { size = 64; align = %u; signed = false; } := uint64_t;\n"
1137 "typealias integer { size = 5; align = 1; signed = false; } := uint5_t;\n"
1138 "typealias integer { size = 27; align = 1; signed = false; } := uint27_t;\n"
1139 "\n"
1140 "trace {\n"
1141 " major = %u;\n"
1142 " minor = %u;\n"
1143 " uuid = \"%s\";\n"
1144 " byte_order = %s;\n"
1145 " packet.header := struct {\n"
1146 " uint32_t magic;\n"
1147 " uint8_t uuid[16];\n"
1148 " uint32_t stream_id;\n"
1149 " };\n"
1150 "};\n\n",
1151 lttng_alignof(uint8_t) * CHAR_BIT,
1152 lttng_alignof(uint16_t) * CHAR_BIT,
1153 lttng_alignof(uint32_t) * CHAR_BIT,
1154 lttng_alignof(uint64_t) * CHAR_BIT,
1155 CTF_SPEC_MAJOR,
1156 CTF_SPEC_MINOR,
1157 uuid_s,
1158 #if (BYTE_ORDER == BIG_ENDIAN)
1159 "be"
1160 #else
1161 "le"
1162 #endif
1163 );
1164 if (ret)
1165 goto end;
1166
1167 /* ignore error, just use empty string if error. */
1168 lttng_ust_getprocname(procname);
1169 procname[LTTNG_UST_PROCNAME_LEN - 1] = '\0';
1170 ret = lttng_metadata_printf(session,
1171 "env {\n"
1172 " vpid = %d;\n"
1173 " procname = \"%s\";\n"
1174 " domain = \"ust\";\n"
1175 " tracer_name = \"lttng-ust\";\n"
1176 " tracer_major = %u;\n"
1177 " tracer_minor = %u;\n"
1178 " tracer_patchlevel = %u;\n"
1179 "};\n\n",
1180 (int) getpid(),
1181 procname,
1182 LTTNG_UST_MAJOR_VERSION,
1183 LTTNG_UST_MINOR_VERSION,
1184 LTTNG_UST_PATCHLEVEL_VERSION
1185 );
1186 if (ret)
1187 goto end;
1188
1189 ret = lttng_metadata_printf(session,
1190 "clock {\n"
1191 " name = %s;\n",
1192 "monotonic"
1193 );
1194 if (ret)
1195 goto end;
1196
1197 if (!trace_clock_uuid(clock_uuid_s)) {
1198 ret = lttng_metadata_printf(session,
1199 " uuid = \"%s\";\n",
1200 clock_uuid_s
1201 );
1202 if (ret)
1203 goto end;
1204 }
1205
1206 ret = lttng_metadata_printf(session,
1207 " description = \"Monotonic Clock\";\n"
1208 " freq = %" PRIu64 "; /* Frequency, in Hz */\n"
1209 " /* clock value offset from Epoch is: offset * (1/freq) */\n"
1210 " offset = %" PRIu64 ";\n"
1211 "};\n\n",
1212 trace_clock_freq(),
1213 measure_clock_offset()
1214 );
1215 if (ret)
1216 goto end;
1217
1218 ret = lttng_metadata_printf(session,
1219 "typealias integer {\n"
1220 " size = 27; align = 1; signed = false;\n"
1221 " map = clock.monotonic.value;\n"
1222 "} := uint27_clock_monotonic_t;\n"
1223 "\n"
1224 "typealias integer {\n"
1225 " size = 32; align = %u; signed = false;\n"
1226 " map = clock.monotonic.value;\n"
1227 "} := uint32_clock_monotonic_t;\n"
1228 "\n"
1229 "typealias integer {\n"
1230 " size = 64; align = %u; signed = false;\n"
1231 " map = clock.monotonic.value;\n"
1232 "} := uint64_clock_monotonic_t;\n\n",
1233 lttng_alignof(uint32_t) * CHAR_BIT,
1234 lttng_alignof(uint64_t) * CHAR_BIT
1235 );
1236 if (ret)
1237 goto end;
1238
1239 ret = _ltt_stream_packet_context_declare(session);
1240 if (ret)
1241 goto end;
1242
1243 ret = _ltt_event_header_declare(session);
1244 if (ret)
1245 goto end;
1246
1247 skip_session:
1248 cds_list_for_each_entry(chan, &session->chan, list) {
1249 ret = _ltt_channel_metadata_statedump(session, chan);
1250 if (ret)
1251 goto end;
1252 }
1253
1254 cds_list_for_each_entry(event, &session->events, list) {
1255 ret = _ltt_event_metadata_statedump(session, event->chan, event);
1256 if (ret)
1257 goto end;
1258 }
1259 session->metadata_dumped = 1;
1260 end:
1261 return ret;
1262 }
1263
1264 void lttng_ust_events_exit(void)
1265 {
1266 struct ltt_session *session, *tmpsession;
1267
1268 cds_list_for_each_entry_safe(session, tmpsession, &sessions, list)
1269 ltt_session_destroy(session);
1270 }
1271
1272 /* WILDCARDS */
1273
1274 static
1275 int wildcard_same_loglevel(struct wildcard_entry *e,
1276 enum lttng_ust_loglevel_type loglevel_type,
1277 int loglevel)
1278 {
1279 if (e->loglevel_type == loglevel_type && e->loglevel == loglevel)
1280 return 1;
1281 else
1282 return 0;
1283 }
1284
1285 #if 0
1286 static
1287 int wildcard_is_within(struct wildcard_entry *e,
1288 enum lttng_ust_loglevel_type loglevel_type,
1289 int loglevel)
1290 {
1291 if (e->loglevel_type == LTTNG_UST_LOGLEVEL_ALL
1292 || e->loglevel == -1)
1293 return 1;
1294 switch (e->loglevel_type) {
1295 case LTTNG_UST_LOGLEVEL_RANGE:
1296 switch (loglevel_type) {
1297 case LTTNG_UST_LOGLEVEL_RANGE:
1298 if (e->loglevel >= loglevel)
1299 return 1;
1300 else
1301 return 0;
1302 case LTTNG_UST_LOGLEVEL_SINGLE:
1303 if (e->loglevel <= 0 && loglevel == 0)
1304 return 1;
1305 else
1306 return 0;
1307 }
1308 case LTTNG_UST_LOGLEVEL_SINGLE:
1309 switch (loglevel_type) {
1310 case LTTNG_UST_LOGLEVEL_RANGE:
1311 if (loglevel <= 0)
1312 return 1;
1313 else
1314 return 0;
1315 case LTTNG_UST_LOGLEVEL_SINGLE:
1316 if (e->loglevel == loglevel)
1317 return 1;
1318 else
1319 return 0;
1320 }
1321 }
1322 }
1323 #endif
1324
1325 /*
1326 * Add the wildcard to the wildcard list. Must be called with
1327 * ust lock held.
1328 */
1329 static
1330 struct session_wildcard *add_wildcard(struct ltt_channel *chan,
1331 struct lttng_ust_event *event_param)
1332 {
1333 struct wildcard_entry *e;
1334 struct session_wildcard *sw;
1335 size_t name_len = strlen(event_param->name) + 1;
1336 int found = 0;
1337
1338 /*
1339 * Try to find global wildcard entry. Given that this is shared
1340 * across all sessions, we need to check for exact loglevel
1341 * match, not just whether contained within the existing ones.
1342 */
1343 cds_list_for_each_entry(e, &wildcard_list, list) {
1344 if (!strncmp(event_param->name, e->name,
1345 LTTNG_UST_SYM_NAME_LEN - 1)) {
1346 if (wildcard_same_loglevel(e,
1347 event_param->loglevel_type,
1348 event_param->loglevel)) {
1349 found = 1;
1350 break;
1351 }
1352 }
1353 }
1354
1355 if (!found) {
1356 /*
1357 * Create global wildcard entry if not found. Using
1358 * zmalloc here to allocate a variable length element.
1359 * Could cause some memory fragmentation if overused.
1360 */
1361 e = zmalloc(sizeof(struct wildcard_entry) + name_len);
1362 if (!e)
1363 return ERR_PTR(-ENOMEM);
1364 memcpy(&e->name[0], event_param->name, name_len);
1365 e->loglevel_type = event_param->loglevel_type;
1366 e->loglevel = event_param->loglevel;
1367 cds_list_add(&e->list, &wildcard_list);
1368 CDS_INIT_LIST_HEAD(&e->session_list);
1369 }
1370
1371 /* session wildcard */
1372 cds_list_for_each_entry(sw, &e->session_list, session_list) {
1373 if (chan == sw->chan) {
1374 DBG("wildcard %s busy for this channel",
1375 event_param->name);
1376 return ERR_PTR(-EEXIST); /* Already there */
1377 }
1378 }
1379 sw = zmalloc(sizeof(struct session_wildcard));
1380 if (!sw)
1381 return ERR_PTR(-ENOMEM);
1382 sw->chan = chan;
1383 sw->enabled = 1;
1384 memcpy(&sw->event_param, event_param, sizeof(sw->event_param));
1385 sw->event_param.instrumentation = LTTNG_UST_TRACEPOINT;
1386 sw->event_param.loglevel_type = event_param->loglevel_type;
1387 sw->event_param.loglevel = event_param->loglevel;
1388 CDS_INIT_LIST_HEAD(&sw->events);
1389 cds_list_add(&sw->list, &chan->session->wildcards);
1390 cds_list_add(&sw->session_list, &e->session_list);
1391 sw->entry = e;
1392 ltt_probes_create_wildcard_events(e, sw);
1393 return sw;
1394 }
1395
1396 /*
1397 * Remove the wildcard from the wildcard list. Must be called with
1398 * ust_lock held. Only called at session teardown.
1399 */
1400 static
1401 void _remove_wildcard(struct session_wildcard *wildcard)
1402 {
1403 struct ltt_event *ev, *tmp;
1404
1405 /*
1406 * Just remove the events owned (for enable/disable) by this
1407 * wildcard from the list. The session teardown will take care
1408 * of freeing the event memory.
1409 */
1410 cds_list_for_each_entry_safe(ev, tmp, &wildcard->events,
1411 wildcard_list) {
1412 cds_list_del(&ev->wildcard_list);
1413 }
1414 cds_list_del(&wildcard->session_list);
1415 cds_list_del(&wildcard->list);
1416 if (cds_list_empty(&wildcard->entry->session_list)) {
1417 cds_list_del(&wildcard->entry->list);
1418 free(wildcard->entry);
1419 }
1420 free(wildcard);
1421 }
1422
1423 int ltt_wildcard_create(struct ltt_channel *chan,
1424 struct lttng_ust_event *event_param,
1425 struct session_wildcard **_sw)
1426 {
1427 struct session_wildcard *sw;
1428
1429 sw = add_wildcard(chan, event_param);
1430 if (!sw || IS_ERR(sw)) {
1431 return PTR_ERR(sw);
1432 }
1433 *_sw = sw;
1434 return 0;
1435 }
1436
1437 static
1438 void _ltt_wildcard_destroy(struct session_wildcard *sw)
1439 {
1440 _remove_wildcard(sw);
1441 }
1442
1443 int ltt_wildcard_enable(struct session_wildcard *wildcard)
1444 {
1445 struct ltt_event *ev;
1446 int ret;
1447
1448 if (wildcard->enabled)
1449 return -EEXIST;
1450 cds_list_for_each_entry(ev, &wildcard->events, wildcard_list) {
1451 ret = ltt_event_enable(ev);
1452 if (ret) {
1453 DBG("Error: enable error.\n");
1454 return ret;
1455 }
1456 }
1457 wildcard->enabled = 1;
1458 return 0;
1459 }
1460
1461 int ltt_wildcard_disable(struct session_wildcard *wildcard)
1462 {
1463 struct ltt_event *ev;
1464 int ret;
1465
1466 if (!wildcard->enabled)
1467 return -EEXIST;
1468 cds_list_for_each_entry(ev, &wildcard->events, wildcard_list) {
1469 ret = ltt_event_disable(ev);
1470 if (ret) {
1471 DBG("Error: disable error.\n");
1472 return ret;
1473 }
1474 }
1475 wildcard->enabled = 0;
1476 return 0;
1477 }
1478
1479 /*
1480 * Take the TLS "fault" in libuuid if dlopen'd, which can take the
1481 * dynamic linker mutex, outside of the UST lock, since the UST lock is
1482 * taken in constructors, which are called with dynamic linker mutex
1483 * held.
1484 */
1485 void lttng_fixup_event_tls(void)
1486 {
1487 unsigned char uuid[37];
1488
1489 (void) uuid_generate(uuid);
1490 }
This page took 0.112038 seconds and 4 git commands to generate.