Fix: Use default visibility for tracepoint provider symbol
[lttng-ust.git] / include / lttng / ust-tracepoint-event.h
1 /*
2 * Copyright (c) 2011-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23 #include <stdint.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <urcu/compiler.h>
27 #include <urcu/rculist.h>
28 #include <lttng/ust-events.h>
29 #include <lttng/ringbuffer-config.h>
30 #include <lttng/ust-compiler.h>
31 #include <lttng/tracepoint.h>
32 #include <lttng/ust-endian.h>
33 #include <string.h>
34
35 #define __LTTNG_UST_NULL_STRING "(null)"
36
37 #undef tp_list_for_each_entry_rcu
38 #define tp_list_for_each_entry_rcu(pos, head, member) \
39 for (pos = cds_list_entry(tp_rcu_dereference((head)->next), __typeof__(*pos), member); \
40 &pos->member != (head); \
41 pos = cds_list_entry(tp_rcu_dereference(pos->member.next), __typeof__(*pos), member))
42
43 /*
44 * TRACEPOINT_EVENT_CLASS declares a class of tracepoints receiving the
45 * same arguments and having the same field layout.
46 *
47 * TRACEPOINT_EVENT_INSTANCE declares an instance of a tracepoint, with
48 * its own provider and name. It refers to a class (template).
49 *
50 * TRACEPOINT_EVENT declared both a class and an instance and does a
51 * direct mapping from the instance to the class.
52 */
53
54 #undef TRACEPOINT_EVENT
55 #define TRACEPOINT_EVENT(_provider, _name, _args, _fields) \
56 _TRACEPOINT_EVENT_CLASS(_provider, _name, \
57 _TP_PARAMS(_args), \
58 _TP_PARAMS(_fields)) \
59 _TRACEPOINT_EVENT_INSTANCE(_provider, _name, _name, \
60 _TP_PARAMS(_args))
61
62 #undef TRACEPOINT_EVENT_CLASS
63 #define TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
64 _TRACEPOINT_EVENT_CLASS(_provider, _name, _TP_PARAMS(_args), _TP_PARAMS(_fields))
65
66 #undef TRACEPOINT_EVENT_INSTANCE
67 #define TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
68 _TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _TP_PARAMS(_args))
69
70 /* Helpers */
71 #define _TP_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
72
73 #define _tp_max_t(type, x, y) \
74 ({ \
75 type __max1 = (x); \
76 type __max2 = (y); \
77 __max1 > __max2 ? __max1: __max2; \
78 })
79
80 /*
81 * Stage 0 of tracepoint event generation.
82 *
83 * Check that each TRACEPOINT_EVENT provider argument match the
84 * TRACEPOINT_PROVIDER by creating dummy callbacks.
85 */
86
87 /* Reset all macros within TRACEPOINT_EVENT */
88 #include <lttng/ust-tracepoint-event-reset.h>
89
90 static inline lttng_ust_notrace
91 void _TP_COMBINE_TOKENS(__tracepoint_provider_mismatch_, TRACEPOINT_PROVIDER)(void);
92 static inline
93 void _TP_COMBINE_TOKENS(__tracepoint_provider_mismatch_, TRACEPOINT_PROVIDER)(void)
94 {
95 }
96
97 #undef _TRACEPOINT_EVENT_CLASS
98 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
99 __tracepoint_provider_mismatch_##_provider();
100
101 #undef _TRACEPOINT_EVENT_INSTANCE
102 #define _TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
103 __tracepoint_provider_mismatch_##_provider();
104
105 static inline lttng_ust_notrace
106 void _TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void);
107 static inline
108 void _TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)(void)
109 {
110 #include TRACEPOINT_INCLUDE
111 }
112
113 /*
114 * Stage 0.1 of tracepoint event generation.
115 *
116 * Check that each TRACEPOINT_EVENT provider:name does not exceed the
117 * tracepoint name length limit.
118 */
119
120 /* Reset all macros within TRACEPOINT_EVENT */
121 #include <lttng/ust-tracepoint-event-reset.h>
122
123 #undef _TRACEPOINT_EVENT_INSTANCE
124 #define _TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
125 static const char \
126 __tp_name_len_check##_provider##___##_name[LTTNG_UST_SYM_NAME_LEN] \
127 __attribute__((unused)) = \
128 #_provider ":" #_name;
129
130 #include TRACEPOINT_INCLUDE
131
132 /*
133 * Stage 0.2 of tracepoint event generation.
134 *
135 * Create dummy trace prototypes for each event class, and for each used
136 * template. This will allow checking whether the prototypes from the
137 * class and the instance using the class actually match.
138 */
139
140 /* Reset all macros within TRACEPOINT_EVENT */
141 #include <lttng/ust-tracepoint-event-reset.h>
142
143 #undef TP_ARGS
144 #define TP_ARGS(...) __VA_ARGS__
145
146 #undef _TRACEPOINT_EVENT_INSTANCE
147 #define _TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
148 void __event_template_proto___##_provider##___##_template(_TP_ARGS_DATA_PROTO(_args));
149
150 #undef _TRACEPOINT_EVENT_CLASS
151 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
152 void __event_template_proto___##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args));
153
154 #include TRACEPOINT_INCLUDE
155
156 /*
157 * Stage 0.9 of tracepoint event generation
158 *
159 * Unfolding the enums
160 */
161 #include <lttng/ust-tracepoint-event-reset.h>
162
163 /* Enumeration entry (single value) */
164 #undef ctf_enum_value
165 #define ctf_enum_value(_string, _value) \
166 { \
167 .start = { \
168 .value = lttng_is_signed_type(__typeof__(_value)) ? \
169 (long long) (_value) : (_value), \
170 .signedness = lttng_is_signed_type(__typeof__(_value)), \
171 }, \
172 .end = { \
173 .value = lttng_is_signed_type(__typeof__(_value)) ? \
174 (long long) (_value) : (_value), \
175 .signedness = lttng_is_signed_type(__typeof__(_value)), \
176 }, \
177 .string = (_string), \
178 },
179
180 /* Enumeration entry (range) */
181 #undef ctf_enum_range
182 #define ctf_enum_range(_string, _range_start, _range_end) \
183 { \
184 .start = { \
185 .value = lttng_is_signed_type(__typeof__(_range_start)) ? \
186 (long long) (_range_start) : (_range_start), \
187 .signedness = lttng_is_signed_type(__typeof__(_range_start)), \
188 }, \
189 .end = { \
190 .value = lttng_is_signed_type(__typeof__(_range_end)) ? \
191 (long long) (_range_end) : (_range_end), \
192 .signedness = lttng_is_signed_type(__typeof__(_range_end)), \
193 }, \
194 .string = (_string), \
195 },
196
197 /* Enumeration entry (automatic value; follows the rules of CTF) */
198 #undef ctf_enum_auto
199 #define ctf_enum_auto(_string) \
200 { \
201 .start = { \
202 .value = -1ULL, \
203 .signedness = 0, \
204 }, \
205 .end = { \
206 .value = -1ULL, \
207 .signedness = 0, \
208 }, \
209 .string = (_string), \
210 .u = { \
211 .extra = { \
212 .options = LTTNG_ENUM_ENTRY_OPTION_IS_AUTO, \
213 }, \
214 }, \
215 },
216
217 #undef TP_ENUM_VALUES
218 #define TP_ENUM_VALUES(...) \
219 __VA_ARGS__
220
221 #undef TRACEPOINT_ENUM
222 #define TRACEPOINT_ENUM(_provider, _name, _values) \
223 const struct lttng_enum_entry __enum_values__##_provider##_##_name[] = { \
224 _values \
225 ctf_enum_value("", 0) /* Dummy, 0-len array forbidden by C99. */ \
226 };
227 #include TRACEPOINT_INCLUDE
228
229 /*
230 * Stage 0.9.1
231 * Verifying array and sequence elements are of an integer type.
232 */
233
234 /* Reset all macros within TRACEPOINT_EVENT */
235 #include <lttng/ust-tracepoint-event-reset.h>
236 #include <lttng/ust-tracepoint-event-write.h>
237 #include <lttng/ust-tracepoint-event-nowrite.h>
238
239 #undef _ctf_array_encoded
240 #define _ctf_array_encoded(_type, _item, _src, _byte_order, \
241 _length, _encoding, _nowrite, \
242 _elem_type_base) \
243 _lttng_array_element_type_is_supported(_type, _item)
244
245 #undef _ctf_sequence_encoded
246 #define _ctf_sequence_encoded(_type, _item, _src, _byte_order, \
247 _length_type, _src_length, _encoding, _nowrite, \
248 _elem_type_base) \
249 _lttng_array_element_type_is_supported(_type, _item)
250
251 #undef TP_FIELDS
252 #define TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
253
254 #undef _TRACEPOINT_EVENT_CLASS
255 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
256 _fields
257
258 #include TRACEPOINT_INCLUDE
259
260 /*
261 * Stage 1 of tracepoint event generation.
262 *
263 * Create event field type metadata section.
264 * Each event produce an array of fields.
265 */
266
267 /* Reset all macros within TRACEPOINT_EVENT */
268 #include <lttng/ust-tracepoint-event-reset.h>
269 #include <lttng/ust-tracepoint-event-write.h>
270 #include <lttng/ust-tracepoint-event-nowrite.h>
271
272 #undef _ctf_integer_ext
273 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
274 { \
275 .name = #_item, \
276 .type = __type_integer(_type, _byte_order, _base, none),\
277 .nowrite = _nowrite, \
278 .u = { \
279 .ext = { \
280 .nofilter = 0, \
281 }, \
282 }, \
283 },
284
285 #undef _ctf_float
286 #define _ctf_float(_type, _item, _src, _nowrite) \
287 { \
288 .name = #_item, \
289 .type = __type_float(_type), \
290 .nowrite = _nowrite, \
291 .u = { \
292 .ext = { \
293 .nofilter = 0, \
294 }, \
295 }, \
296 },
297
298 #undef _ctf_array_encoded
299 #define _ctf_array_encoded(_type, _item, _src, _byte_order, \
300 _length, _encoding, _nowrite, \
301 _elem_type_base) \
302 { \
303 .name = #_item, \
304 .type = \
305 { \
306 .atype = atype_array_nestable, \
307 .u = \
308 { \
309 .array_nestable = \
310 { \
311 .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
312 __type_integer(_type, _byte_order, _elem_type_base, _encoding)), \
313 .length = _length, \
314 .alignment = 0, \
315 } \
316 } \
317 }, \
318 .nowrite = _nowrite, \
319 .u = { \
320 .ext = { \
321 .nofilter = 0, \
322 }, \
323 }, \
324 },
325
326 #undef _ctf_sequence_encoded
327 #define _ctf_sequence_encoded(_type, _item, _src, _byte_order, \
328 _length_type, _src_length, _encoding, _nowrite, \
329 _elem_type_base) \
330 { \
331 .name = "_" #_item "_length", \
332 .type = __type_integer(_length_type, BYTE_ORDER, 10, none), \
333 .nowrite = _nowrite, \
334 .u = { \
335 .ext = { \
336 .nofilter = 1, \
337 }, \
338 }, \
339 }, \
340 { \
341 .name = #_item, \
342 .type = \
343 { \
344 .atype = atype_sequence_nestable, \
345 .u = \
346 { \
347 .sequence_nestable = \
348 { \
349 .length_name = "_" #_item "_length", \
350 .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
351 __type_integer(_type, _byte_order, _elem_type_base, _encoding)), \
352 .alignment = 0, \
353 }, \
354 }, \
355 }, \
356 .nowrite = _nowrite, \
357 .u = { \
358 .ext = { \
359 .nofilter = 0, \
360 }, \
361 }, \
362 },
363
364 #undef _ctf_string
365 #define _ctf_string(_item, _src, _nowrite) \
366 { \
367 .name = #_item, \
368 .type = \
369 { \
370 .atype = atype_string, \
371 .u = \
372 { \
373 .string = { .encoding = lttng_encode_UTF8 } \
374 }, \
375 }, \
376 .nowrite = _nowrite, \
377 .u = { \
378 .ext = { \
379 .nofilter = 0, \
380 }, \
381 }, \
382 },
383
384 #undef _ctf_enum
385 #define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
386 { \
387 .name = #_item, \
388 .type = { \
389 .atype = atype_enum_nestable, \
390 .u = { \
391 .enum_nestable = { \
392 .desc = &__enum_##_provider##_##_name, \
393 .container_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
394 __type_integer(_type, BYTE_ORDER, 10, none)), \
395 }, \
396 }, \
397 }, \
398 .nowrite = _nowrite, \
399 .u = { \
400 .ext = { \
401 .nofilter = 0, \
402 }, \
403 }, \
404 },
405
406 #undef TP_FIELDS
407 #define TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
408
409 #undef _TRACEPOINT_EVENT_CLASS
410 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
411 static const struct lttng_event_field __event_fields___##_provider##___##_name[] = { \
412 _fields \
413 ctf_integer(int, dummy, 0) /* Dummy, C99 forbids 0-len array. */ \
414 };
415
416 #undef TRACEPOINT_ENUM
417 #define TRACEPOINT_ENUM(_provider, _name, _values) \
418 static const struct lttng_enum_desc __enum_##_provider##_##_name = { \
419 .name = #_provider "_" #_name, \
420 .entries = __enum_values__##_provider##_##_name, \
421 .nr_entries = _TP_ARRAY_SIZE(__enum_values__##_provider##_##_name) - 1, \
422 };
423
424 #include TRACEPOINT_INCLUDE
425
426 /*
427 * Stage 2 of tracepoint event generation.
428 *
429 * Create probe callback prototypes.
430 */
431
432 /* Reset all macros within TRACEPOINT_EVENT */
433 #include <lttng/ust-tracepoint-event-reset.h>
434
435 #undef TP_ARGS
436 #define TP_ARGS(...) __VA_ARGS__
437
438 #undef _TRACEPOINT_EVENT_CLASS
439 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
440 static void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args));
441
442 #include TRACEPOINT_INCLUDE
443
444 /*
445 * Stage 2.1 of tracepoint event generation.
446 *
447 * Create probe event notifier callback prototypes.
448 */
449
450 /* Reset all macros within TRACEPOINT_EVENT */
451 #include <lttng/ust-tracepoint-event-reset.h>
452
453 #undef TP_ARGS
454 #define TP_ARGS(...) __VA_ARGS__
455
456 #undef _TRACEPOINT_EVENT_CLASS
457 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
458 static void __event_notifier_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args));
459
460 #include TRACEPOINT_INCLUDE
461
462 /*
463 * Stage 3.0 of tracepoint event generation.
464 *
465 * Create static inline function that calculates event size.
466 */
467
468 /* Reset all macros within TRACEPOINT_EVENT */
469 #include <lttng/ust-tracepoint-event-reset.h>
470 #include <lttng/ust-tracepoint-event-write.h>
471
472 #undef _ctf_integer_ext
473 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
474 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
475 __event_len += sizeof(_type);
476
477 #undef _ctf_float
478 #define _ctf_float(_type, _item, _src, _nowrite) \
479 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
480 __event_len += sizeof(_type);
481
482 #undef _ctf_array_encoded
483 #define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, _encoding, \
484 _nowrite, _elem_type_base) \
485 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
486 __event_len += sizeof(_type) * (_length);
487
488 #undef _ctf_sequence_encoded
489 #define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
490 _src_length, _encoding, _nowrite, _elem_type_base) \
491 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \
492 __event_len += sizeof(_length_type); \
493 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
494 __dynamic_len[__dynamic_len_idx] = (_src_length); \
495 __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \
496 __dynamic_len_idx++;
497
498 #undef _ctf_string
499 #define _ctf_string(_item, _src, _nowrite) \
500 __event_len += __dynamic_len[__dynamic_len_idx++] = \
501 strlen((_src) ? (_src) : __LTTNG_UST_NULL_STRING) + 1;
502
503 #undef _ctf_enum
504 #define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
505 _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
506
507 #undef TP_ARGS
508 #define TP_ARGS(...) __VA_ARGS__
509
510 #undef TP_FIELDS
511 #define TP_FIELDS(...) __VA_ARGS__
512
513 #undef _TRACEPOINT_EVENT_CLASS
514 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
515 static inline lttng_ust_notrace \
516 size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)); \
517 static inline \
518 size_t __event_get_size__##_provider##___##_name(size_t *__dynamic_len, _TP_ARGS_DATA_PROTO(_args)) \
519 { \
520 size_t __event_len = 0; \
521 unsigned int __dynamic_len_idx = 0; \
522 \
523 if (0) \
524 (void) __dynamic_len_idx; /* don't warn if unused */ \
525 _fields \
526 return __event_len; \
527 }
528
529 #include TRACEPOINT_INCLUDE
530
531 /*
532 * Stage 3.1 of tracepoint event generation.
533 *
534 * Create static inline function that layout the filter stack data.
535 * We make both write and nowrite data available to the filter.
536 */
537
538 /* Reset all macros within TRACEPOINT_EVENT */
539 #include <lttng/ust-tracepoint-event-reset.h>
540 #include <lttng/ust-tracepoint-event-write.h>
541 #include <lttng/ust-tracepoint-event-nowrite.h>
542
543 #undef _ctf_integer_ext
544 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
545 if (lttng_is_signed_type(_type)) { \
546 int64_t __ctf_tmp_int64; \
547 switch (sizeof(_type)) { \
548 case 1: \
549 { \
550 union { _type t; int8_t v; } __tmp = { (_type) (_src) }; \
551 __ctf_tmp_int64 = (int64_t) __tmp.v; \
552 break; \
553 } \
554 case 2: \
555 { \
556 union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
557 if (_byte_order != BYTE_ORDER) \
558 __tmp.v = bswap_16(__tmp.v); \
559 __ctf_tmp_int64 = (int64_t) __tmp.v; \
560 break; \
561 } \
562 case 4: \
563 { \
564 union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \
565 if (_byte_order != BYTE_ORDER) \
566 __tmp.v = bswap_32(__tmp.v); \
567 __ctf_tmp_int64 = (int64_t) __tmp.v; \
568 break; \
569 } \
570 case 8: \
571 { \
572 union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \
573 if (_byte_order != BYTE_ORDER) \
574 __tmp.v = bswap_64(__tmp.v); \
575 __ctf_tmp_int64 = (int64_t) __tmp.v; \
576 break; \
577 } \
578 default: \
579 abort(); \
580 }; \
581 memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t)); \
582 } else { \
583 uint64_t __ctf_tmp_uint64; \
584 switch (sizeof(_type)) { \
585 case 1: \
586 { \
587 union { _type t; uint8_t v; } __tmp = { (_type) (_src) }; \
588 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
589 break; \
590 } \
591 case 2: \
592 { \
593 union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
594 if (_byte_order != BYTE_ORDER) \
595 __tmp.v = bswap_16(__tmp.v); \
596 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
597 break; \
598 } \
599 case 4: \
600 { \
601 union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \
602 if (_byte_order != BYTE_ORDER) \
603 __tmp.v = bswap_32(__tmp.v); \
604 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
605 break; \
606 } \
607 case 8: \
608 { \
609 union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \
610 if (_byte_order != BYTE_ORDER) \
611 __tmp.v = bswap_64(__tmp.v); \
612 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
613 break; \
614 } \
615 default: \
616 abort(); \
617 }; \
618 memcpy(__stack_data, &__ctf_tmp_uint64, sizeof(uint64_t)); \
619 } \
620 __stack_data += sizeof(int64_t);
621
622 #undef _ctf_float
623 #define _ctf_float(_type, _item, _src, _nowrite) \
624 { \
625 double __ctf_tmp_double = (double) (_type) (_src); \
626 memcpy(__stack_data, &__ctf_tmp_double, sizeof(double)); \
627 __stack_data += sizeof(double); \
628 }
629
630 #undef _ctf_array_encoded
631 #define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, \
632 _encoding, _nowrite, _elem_type_base) \
633 { \
634 unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \
635 const void *__ctf_tmp_ptr = (_src); \
636 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
637 __stack_data += sizeof(unsigned long); \
638 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
639 __stack_data += sizeof(void *); \
640 }
641
642 #undef _ctf_sequence_encoded
643 #define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
644 _src_length, _encoding, _nowrite, _elem_type_base) \
645 { \
646 unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \
647 const void *__ctf_tmp_ptr = (_src); \
648 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
649 __stack_data += sizeof(unsigned long); \
650 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
651 __stack_data += sizeof(void *); \
652 }
653
654 #undef _ctf_string
655 #define _ctf_string(_item, _src, _nowrite) \
656 { \
657 const void *__ctf_tmp_ptr = \
658 ((_src) ? (_src) : __LTTNG_UST_NULL_STRING); \
659 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
660 __stack_data += sizeof(void *); \
661 }
662
663 #undef _ctf_enum
664 #define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
665 _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
666
667 #undef TP_ARGS
668 #define TP_ARGS(...) __VA_ARGS__
669
670 #undef TP_FIELDS
671 #define TP_FIELDS(...) __VA_ARGS__
672
673 #undef _TRACEPOINT_EVENT_CLASS
674 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
675 static inline \
676 void __event_prepare_interpreter_stack__##_provider##___##_name(char *__stack_data,\
677 _TP_ARGS_DATA_PROTO(_args)) \
678 { \
679 _fields \
680 }
681
682 #include TRACEPOINT_INCLUDE
683
684 /*
685 * Stage 4 of tracepoint event generation.
686 *
687 * Create static inline function that calculates event payload alignment.
688 */
689
690 /* Reset all macros within TRACEPOINT_EVENT */
691 #include <lttng/ust-tracepoint-event-reset.h>
692 #include <lttng/ust-tracepoint-event-write.h>
693
694 #undef _ctf_integer_ext
695 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
696 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
697
698 #undef _ctf_float
699 #define _ctf_float(_type, _item, _src, _nowrite) \
700 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
701
702 #undef _ctf_array_encoded
703 #define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, \
704 _encoding, _nowrite, _elem_type_base) \
705 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
706
707 #undef _ctf_sequence_encoded
708 #define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
709 _src_length, _encoding, _nowrite, _elem_type_base) \
710 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_length_type)); \
711 __event_align = _tp_max_t(size_t, __event_align, lttng_alignof(_type));
712
713 #undef _ctf_string
714 #define _ctf_string(_item, _src, _nowrite)
715
716 #undef _ctf_enum
717 #define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
718 _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
719
720 #undef TP_ARGS
721 #define TP_ARGS(...) __VA_ARGS__
722
723 #undef TP_FIELDS
724 #define TP_FIELDS(...) __VA_ARGS__
725
726 #undef _TRACEPOINT_EVENT_CLASS
727 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
728 static inline lttng_ust_notrace \
729 size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)); \
730 static inline \
731 size_t __event_get_align__##_provider##___##_name(_TP_ARGS_PROTO(_args)) \
732 { \
733 size_t __event_align = 1; \
734 _fields \
735 return __event_align; \
736 }
737
738 #include TRACEPOINT_INCLUDE
739
740
741 /*
742 * Stage 5 of tracepoint event generation.
743 *
744 * Create the probe function. This function calls event size calculation
745 * and writes event data into the buffer.
746 */
747
748 /* Reset all macros within TRACEPOINT_EVENT */
749 #include <lttng/ust-tracepoint-event-reset.h>
750 #include <lttng/ust-tracepoint-event-write.h>
751
752 #undef _ctf_integer_ext
753 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _nowrite) \
754 { \
755 _type __tmp = (_src); \
756 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
757 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
758 }
759
760 #undef _ctf_float
761 #define _ctf_float(_type, _item, _src, _nowrite) \
762 { \
763 _type __tmp = (_src); \
764 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
765 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
766 }
767
768 #undef _ctf_array_encoded
769 #define _ctf_array_encoded(_type, _item, _src, _byte_order, _length, \
770 _encoding, _nowrite, _elem_type_base) \
771 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
772 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length));
773
774 #undef _ctf_sequence_encoded
775 #define _ctf_sequence_encoded(_type, _item, _src, _byte_order, _length_type, \
776 _src_length, _encoding, _nowrite, _elem_type_base) \
777 { \
778 _length_type __tmpl = __stackvar.__dynamic_len[__dynamic_len_idx]; \
779 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
780 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
781 } \
782 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
783 __chan->ops->event_write(&__ctx, _src, \
784 sizeof(_type) * __get_dynamic_len(dest));
785
786 #undef _ctf_string
787 #define _ctf_string(_item, _src, _nowrite) \
788 { \
789 const char *__ctf_tmp_string = \
790 ((_src) ? (_src) : __LTTNG_UST_NULL_STRING); \
791 lib_ring_buffer_align_ctx(&__ctx, \
792 lttng_alignof(*__ctf_tmp_string)); \
793 __chan->ops->event_strcpy(&__ctx, __ctf_tmp_string, \
794 __get_dynamic_len(dest)); \
795 }
796
797
798 #undef _ctf_enum
799 #define _ctf_enum(_provider, _name, _type, _item, _src, _nowrite) \
800 _ctf_integer_ext(_type, _item, _src, BYTE_ORDER, 10, _nowrite)
801
802 /* Beware: this get len actually consumes the len value */
803 #undef __get_dynamic_len
804 #define __get_dynamic_len(field) __stackvar.__dynamic_len[__dynamic_len_idx++]
805
806 #undef TP_ARGS
807 #define TP_ARGS(...) __VA_ARGS__
808
809 #undef TP_FIELDS
810 #define TP_FIELDS(...) __VA_ARGS__
811
812 /*
813 * For state dump, check that "session" argument (mandatory) matches the
814 * session this event belongs to. Ensures that we write state dump data only
815 * into the started session, not into all sessions.
816 */
817 #undef _TP_SESSION_CHECK
818 #ifdef TP_SESSION_CHECK
819 #define _TP_SESSION_CHECK(session, csession) (session == csession)
820 #else /* TP_SESSION_CHECK */
821 #define _TP_SESSION_CHECK(session, csession) 1
822 #endif /* TP_SESSION_CHECK */
823
824 /*
825 * Use of __builtin_return_address(0) sometimes seems to cause stack
826 * corruption on 32-bit PowerPC. Disable this feature on that
827 * architecture for now by always using the NULL value for the ip
828 * context.
829 */
830 #undef _TP_IP_PARAM
831 #ifdef TP_IP_PARAM
832 #define _TP_IP_PARAM(x) (x)
833 #else /* TP_IP_PARAM */
834
835 #if defined(__PPC__) && !defined(__PPC64__)
836 #define _TP_IP_PARAM(x) NULL
837 #else /* #if defined(__PPC__) && !defined(__PPC64__) */
838 #define _TP_IP_PARAM(x) __builtin_return_address(0)
839 #endif /* #else #if defined(__PPC__) && !defined(__PPC64__) */
840
841 #endif /* TP_IP_PARAM */
842
843 /*
844 * Using twice size for filter stack data to hold size and pointer for
845 * each field (worse case). For integers, max size required is 64-bit.
846 * Same for double-precision floats. Those fit within
847 * 2*sizeof(unsigned long) for all supported architectures.
848 * Perform UNION (||) of filter runtime list.
849 */
850 #undef _TRACEPOINT_EVENT_CLASS
851 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
852 static lttng_ust_notrace \
853 void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); \
854 static \
855 void __event_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \
856 { \
857 struct lttng_event *__event = (struct lttng_event *) __tp_data; \
858 struct lttng_channel *__chan = __event->chan; \
859 struct lttng_ust_lib_ring_buffer_ctx __ctx; \
860 struct lttng_stack_ctx __lttng_ctx; \
861 size_t __event_len, __event_align; \
862 size_t __dynamic_len_idx = 0; \
863 const size_t __num_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_name) - 1; \
864 union { \
865 size_t __dynamic_len[__num_fields]; \
866 char __filter_stack_data[2 * sizeof(unsigned long) * __num_fields]; \
867 } __stackvar; \
868 int __ret; \
869 \
870 if (0) \
871 (void) __dynamic_len_idx; /* don't warn if unused */ \
872 if (!_TP_SESSION_CHECK(session, __chan->session)) \
873 return; \
874 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->session->active))) \
875 return; \
876 if (caa_unlikely(!CMM_ACCESS_ONCE(__chan->enabled))) \
877 return; \
878 if (caa_unlikely(!CMM_ACCESS_ONCE(__event->enabled))) \
879 return; \
880 if (caa_unlikely(!TP_RCU_LINK_TEST())) \
881 return; \
882 if (caa_unlikely(!cds_list_empty(&__event->filter_bytecode_runtime_head))) { \
883 struct lttng_bytecode_runtime *__filter_bc_runtime; \
884 int __filter_record = __event->has_enablers_without_bytecode; \
885 \
886 __event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__filter_stack_data, \
887 _TP_ARGS_DATA_VAR(_args)); \
888 tp_list_for_each_entry_rcu(__filter_bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
889 if (caa_unlikely(__filter_bc_runtime->interpreter_funcs.filter(__filter_bc_runtime, \
890 __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
891 __filter_record = 1; \
892 break; \
893 } \
894 } \
895 if (caa_likely(!__filter_record)) \
896 return; \
897 } \
898 __event_len = __event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \
899 _TP_ARGS_DATA_VAR(_args)); \
900 __event_align = __event_get_align__##_provider##___##_name(_TP_ARGS_VAR(_args)); \
901 memset(&__lttng_ctx, 0, sizeof(__lttng_ctx)); \
902 __lttng_ctx.event = __event; \
903 __lttng_ctx.chan_ctx = tp_rcu_dereference(__chan->ctx); \
904 __lttng_ctx.event_ctx = tp_rcu_dereference(__event->ctx); \
905 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \
906 __event_align, -1, __chan->handle, &__lttng_ctx); \
907 __ctx.ip = _TP_IP_PARAM(TP_IP_PARAM); \
908 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
909 if (__ret < 0) \
910 return; \
911 _fields \
912 __chan->ops->event_commit(&__ctx); \
913 }
914
915 #include TRACEPOINT_INCLUDE
916
917 #undef __get_dynamic_len
918
919 /*
920 * Stage 5.1 of tracepoint event generation.
921 *
922 * Create probe signature
923 */
924
925 /* Reset all macros within TRACEPOINT_EVENT */
926 #include <lttng/ust-tracepoint-event-reset.h>
927
928 #undef TP_ARGS
929 #define TP_ARGS(...) __VA_ARGS__
930
931 #define _TP_EXTRACT_STRING2(...) #__VA_ARGS__
932
933 #undef _TRACEPOINT_EVENT_CLASS
934 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
935 static const char __tp_event_signature___##_provider##___##_name[] = \
936 _TP_EXTRACT_STRING2(_args);
937
938 #include TRACEPOINT_INCLUDE
939
940 #undef _TP_EXTRACT_STRING2
941
942 /*
943 * Stage 5.2 of tracepoint event generation.
944 *
945 * Create the event notifier probe function.
946 */
947 #undef _TRACEPOINT_EVENT_CLASS
948 #define _TRACEPOINT_EVENT_CLASS(_provider, _name, _args, _fields) \
949 static lttng_ust_notrace \
950 void __event_notifier_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)); \
951 static \
952 void __event_notifier_probe__##_provider##___##_name(_TP_ARGS_DATA_PROTO(_args)) \
953 { \
954 struct lttng_event_notifier *__event_notifier = (struct lttng_event_notifier *) __tp_data; \
955 const size_t __num_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_name) - 1;\
956 union { \
957 size_t __dynamic_len[__num_fields]; \
958 char __interpreter_stack_data[2 * sizeof(unsigned long) * __num_fields]; \
959 } __stackvar; \
960 \
961 if (caa_unlikely(!CMM_ACCESS_ONCE(__event_notifier->enabled))) \
962 return; \
963 if (caa_unlikely(!TP_RCU_LINK_TEST())) \
964 return; \
965 if (caa_unlikely(!cds_list_empty(&__event_notifier->filter_bytecode_runtime_head))) { \
966 struct lttng_bytecode_runtime *__filter_bc_runtime; \
967 int __filter_record = __event_notifier->has_enablers_without_bytecode; \
968 \
969 __event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \
970 _TP_ARGS_DATA_VAR(_args)); \
971 tp_list_for_each_entry_rcu(__filter_bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
972 if (caa_unlikely(__filter_bc_runtime->interpreter_funcs.filter(__filter_bc_runtime, \
973 __stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \
974 __filter_record = 1; \
975 } \
976 if (caa_likely(!__filter_record)) \
977 return; \
978 } \
979 if (caa_unlikely(!cds_list_empty(&__event_notifier->capture_bytecode_runtime_head))) \
980 __event_prepare_interpreter_stack__##_provider##___##_name(__stackvar.__interpreter_stack_data, \
981 _TP_ARGS_DATA_VAR(_args)); \
982 \
983 __event_notifier->notification_send(__event_notifier, \
984 __stackvar.__interpreter_stack_data); \
985 }
986
987 #include TRACEPOINT_INCLUDE
988
989 /*
990 * Stage 6 of tracepoint event generation.
991 *
992 * Tracepoint loglevel mapping definition generation. We generate a
993 * symbol for each mapping for a provider/event to ensure at most a 1 to
994 * 1 mapping between events and loglevels. If the symbol is repeated,
995 * the compiler will complain.
996 */
997
998 /* Reset all macros within TRACEPOINT_EVENT */
999 #include <lttng/ust-tracepoint-event-reset.h>
1000
1001 /*
1002 * Declare _loglevel___##__provider##___##__name as non-static, with
1003 * hidden visibility for c++ handling of weakref. We do a weakref to the
1004 * symbol in a later stage, which requires that the symbol is not
1005 * mangled.
1006 */
1007 #ifdef __cplusplus
1008 #define LTTNG_TP_EXTERN_C extern "C"
1009 #else
1010 #define LTTNG_TP_EXTERN_C
1011 #endif
1012
1013 #undef TRACEPOINT_LOGLEVEL
1014 #define TRACEPOINT_LOGLEVEL(__provider, __name, __loglevel) \
1015 static const int _loglevel_value___##__provider##___##__name = __loglevel; \
1016 LTTNG_TP_EXTERN_C const int *_loglevel___##__provider##___##__name \
1017 __attribute__((visibility("hidden"))) = \
1018 &_loglevel_value___##__provider##___##__name;
1019
1020 #include TRACEPOINT_INCLUDE
1021
1022 #undef LTTNG_TP_EXTERN_C
1023
1024 /*
1025 * Stage 6.1 of tracepoint event generation.
1026 *
1027 * Tracepoint UML URI info.
1028 */
1029
1030 /* Reset all macros within TRACEPOINT_EVENT */
1031 #include <lttng/ust-tracepoint-event-reset.h>
1032
1033 /*
1034 * Declare _model_emf_uri___##__provider##___##__name as non-static,
1035 * with hidden visibility for c++ handling of weakref. We do a weakref
1036 * to the symbol in a later stage, which requires that the symbol is not
1037 * mangled.
1038 */
1039 #ifdef __cplusplus
1040 #define LTTNG_TP_EXTERN_C extern "C"
1041 #else
1042 #define LTTNG_TP_EXTERN_C
1043 #endif
1044
1045 #undef TRACEPOINT_MODEL_EMF_URI
1046 #define TRACEPOINT_MODEL_EMF_URI(__provider, __name, __uri) \
1047 LTTNG_TP_EXTERN_C const char *_model_emf_uri___##__provider##___##__name \
1048 __attribute__((visibility("hidden"))) = __uri; \
1049
1050 #include TRACEPOINT_INCLUDE
1051
1052 #undef LTTNG_TP_EXTERN_C
1053
1054 /*
1055 * Stage 7.1 of tracepoint event generation.
1056 *
1057 * Create events description structures. We use a weakref because
1058 * loglevels are optional. If not declared, the event will point to the
1059 * a loglevel that contains NULL.
1060 */
1061
1062 /* Reset all macros within TRACEPOINT_EVENT */
1063 #include <lttng/ust-tracepoint-event-reset.h>
1064
1065 #undef _TRACEPOINT_EVENT_INSTANCE
1066 #define _TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
1067 static const int * \
1068 __ref_loglevel___##_provider##___##_name \
1069 __attribute__((weakref ("_loglevel___" #_provider "___" #_name))); \
1070 static const char * \
1071 __ref_model_emf_uri___##_provider##___##_name \
1072 __attribute__((weakref ("_model_emf_uri___" #_provider "___" #_name)));\
1073 static const struct lttng_event_desc __event_desc___##_provider##_##_name = { \
1074 .name = #_provider ":" #_name, \
1075 .probe_callback = (void (*)(void)) &__event_probe__##_provider##___##_template,\
1076 .ctx = NULL, \
1077 .fields = __event_fields___##_provider##___##_template, \
1078 .nr_fields = _TP_ARRAY_SIZE(__event_fields___##_provider##___##_template) - 1, \
1079 .loglevel = &__ref_loglevel___##_provider##___##_name, \
1080 .signature = __tp_event_signature___##_provider##___##_template, \
1081 .u = { \
1082 .ext = { \
1083 .model_emf_uri = &__ref_model_emf_uri___##_provider##___##_name, \
1084 .event_notifier_callback = (void (*)(void)) &__event_notifier_probe__##_provider##___##_template,\
1085 }, \
1086 }, \
1087 };
1088
1089 #include TRACEPOINT_INCLUDE
1090
1091 /*
1092 * Stage 7.2 of tracepoint event generation.
1093 *
1094 * Create array of events.
1095 */
1096
1097 /* Reset all macros within TRACEPOINT_EVENT */
1098 #include <lttng/ust-tracepoint-event-reset.h>
1099
1100 #undef _TRACEPOINT_EVENT_INSTANCE
1101 #define _TRACEPOINT_EVENT_INSTANCE(_provider, _template, _name, _args) \
1102 &__event_desc___##_provider##_##_name,
1103
1104 static const struct lttng_event_desc *_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)[] = {
1105 #include TRACEPOINT_INCLUDE
1106 NULL, /* Dummy, C99 forbids 0-len array. */
1107 };
1108
1109
1110 /*
1111 * Stage 8 of tracepoint event generation.
1112 *
1113 * Create a toplevel descriptor for the whole probe.
1114 */
1115
1116 /* non-const because list head will be modified when registered. */
1117 static struct lttng_probe_desc _TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER) = {
1118 .provider = __tp_stringify(TRACEPOINT_PROVIDER),
1119 .event_desc = _TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER),
1120 .nr_events = _TP_ARRAY_SIZE(_TP_COMBINE_TOKENS(__event_desc___, TRACEPOINT_PROVIDER)) - 1,
1121 .head = { NULL, NULL },
1122 .lazy_init_head = { NULL, NULL },
1123 .lazy = 0,
1124 .major = LTTNG_UST_PROVIDER_MAJOR,
1125 .minor = LTTNG_UST_PROVIDER_MINOR,
1126 };
1127
1128 static int _TP_COMBINE_TOKENS(__probe_register_refcount___, TRACEPOINT_PROVIDER);
1129
1130 /*
1131 * Stage 9 of tracepoint event generation.
1132 *
1133 * Register/unregister probes at module load/unload.
1134 *
1135 * Generate the constructor as an externally visible symbol for use when
1136 * linking the probe statically.
1137 *
1138 * Register refcount is protected by libc dynamic loader mutex.
1139 */
1140
1141 /* Reset all macros within TRACEPOINT_EVENT */
1142 #include <lttng/ust-tracepoint-event-reset.h>
1143 static void lttng_ust_notrace __attribute__((constructor))
1144 _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void);
1145 static void
1146 _TP_COMBINE_TOKENS(__lttng_events_init__, TRACEPOINT_PROVIDER)(void)
1147 {
1148 int ret;
1149
1150 if (_TP_COMBINE_TOKENS(__probe_register_refcount___,
1151 TRACEPOINT_PROVIDER)++) {
1152 return;
1153 }
1154 /*
1155 * __tracepoint_provider_check_ ## TRACEPOINT_PROVIDER() is a
1156 * static inline function that ensures every probe PROVIDER
1157 * argument match the provider within which they appear. It
1158 * calls empty static inline functions, and therefore has no
1159 * runtime effect. However, if it detects an error, a linker
1160 * error will appear.
1161 */
1162 _TP_COMBINE_TOKENS(__tracepoint_provider_check_, TRACEPOINT_PROVIDER)();
1163 ret = lttng_probe_register(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
1164 if (ret) {
1165 fprintf(stderr, "LTTng-UST: Error (%d) while registering tracepoint probe.\n", ret);
1166 abort();
1167 }
1168 }
1169
1170 static void lttng_ust_notrace __attribute__((destructor))
1171 _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void);
1172 static void
1173 _TP_COMBINE_TOKENS(__lttng_events_exit__, TRACEPOINT_PROVIDER)(void)
1174 {
1175 if (--_TP_COMBINE_TOKENS(__probe_register_refcount___,
1176 TRACEPOINT_PROVIDER)) {
1177 return;
1178 }
1179 lttng_probe_unregister(&_TP_COMBINE_TOKENS(__probe_desc___, TRACEPOINT_PROVIDER));
1180 }
1181
1182 int _TP_COMBINE_TOKENS(__tracepoint_provider_, TRACEPOINT_PROVIDER)
1183 __attribute__((visibility("default")));
This page took 0.085524 seconds and 4 git commands to generate.