Implement capturing payload on event notifier
[lttng-modules.git] / include / lttng / tracepoint-event-impl.h
1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
2 *
3 * lttng/tracepoint-event-impl.h
4 *
5 * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org>
6 * Copyright (C) 2009-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 */
8
9 #include <linux/uaccess.h>
10 #include <linux/debugfs.h>
11 #include <linux/rculist.h>
12 #include <asm/byteorder.h>
13 #include <linux/swab.h>
14
15 #include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_mappings() */
16 #include <ringbuffer/frontend_types.h>
17 #include <ringbuffer/backend.h>
18 #include <wrapper/rcu.h>
19 #include <wrapper/user_namespace.h>
20 #include <lttng/types.h>
21 #include <lttng/probe-user.h>
22 #include <lttng/events.h>
23 #include <lttng/tracer-core.h>
24 #include <lttng/tp-mempool.h>
25
26 #define __LTTNG_NULL_STRING "(null)"
27
28 #undef PARAMS
29 #define PARAMS(args...) args
30
31 /*
32 * Macro declarations used for all stages.
33 */
34
35 /*
36 * LTTng name mapping macros. LTTng remaps some of the kernel events to
37 * enforce name-spacing.
38 */
39 #undef LTTNG_TRACEPOINT_EVENT_MAP
40 #define LTTNG_TRACEPOINT_EVENT_MAP(name, map, proto, args, fields) \
41 LTTNG_TRACEPOINT_EVENT_CLASS(map, \
42 PARAMS(proto), \
43 PARAMS(args), \
44 PARAMS(fields)) \
45 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args))
46
47 #undef LTTNG_TRACEPOINT_EVENT_MAP_NOARGS
48 #define LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, map, fields) \
49 LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(map, \
50 PARAMS(fields)) \
51 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(map, name, map)
52
53 #undef LTTNG_TRACEPOINT_EVENT_CODE_MAP
54 #define LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, map, proto, args, _locvar, _code_pre, fields, _code_post) \
55 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(map, \
56 PARAMS(proto), \
57 PARAMS(args), \
58 PARAMS(_locvar), \
59 PARAMS(_code_pre), \
60 PARAMS(fields), \
61 PARAMS(_code_post)) \
62 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args))
63
64 #undef LTTNG_TRACEPOINT_EVENT_CODE
65 #define LTTNG_TRACEPOINT_EVENT_CODE(name, proto, args, _locvar, _code_pre, fields, _code_post) \
66 LTTNG_TRACEPOINT_EVENT_CODE_MAP(name, name, \
67 PARAMS(proto), \
68 PARAMS(args), \
69 PARAMS(_locvar), \
70 PARAMS(_code_pre), \
71 PARAMS(fields), \
72 PARAMS(_code_post))
73
74 /*
75 * LTTNG_TRACEPOINT_EVENT_CLASS can be used to add a generic function
76 * handlers for events. That is, if all events have the same parameters
77 * and just have distinct trace points. Each tracepoint can be defined
78 * with LTTNG_TRACEPOINT_EVENT_INSTANCE and that will map the
79 * LTTNG_TRACEPOINT_EVENT_CLASS to the tracepoint.
80 *
81 * LTTNG_TRACEPOINT_EVENT is a one to one mapping between tracepoint and
82 * template.
83 */
84
85 #undef LTTNG_TRACEPOINT_EVENT
86 #define LTTNG_TRACEPOINT_EVENT(name, proto, args, fields) \
87 LTTNG_TRACEPOINT_EVENT_MAP(name, name, \
88 PARAMS(proto), \
89 PARAMS(args), \
90 PARAMS(fields))
91
92 #undef LTTNG_TRACEPOINT_EVENT_NOARGS
93 #define LTTNG_TRACEPOINT_EVENT_NOARGS(name, fields) \
94 LTTNG_TRACEPOINT_EVENT_MAP_NOARGS(name, name, PARAMS(fields))
95
96 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE
97 #define LTTNG_TRACEPOINT_EVENT_INSTANCE(template, name, proto, args) \
98 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(template, name, name, PARAMS(proto), PARAMS(args))
99
100 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS
101 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(template, name) \
102 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(template, name, name)
103
104 #undef LTTNG_TRACEPOINT_EVENT_CLASS
105 #define LTTNG_TRACEPOINT_EVENT_CLASS(_name, _proto, _args, _fields) \
106 LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, PARAMS(_proto), PARAMS(_args), , , \
107 PARAMS(_fields), )
108
109 #undef LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
110 #define LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields) \
111 LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, , , PARAMS(_fields), )
112
113
114 /*
115 * Stage 1 of the trace events.
116 *
117 * Create dummy trace calls for each events, verifying that the LTTng module
118 * instrumentation headers match the kernel arguments. Will be optimized
119 * out by the compiler.
120 */
121
122 /* Reset all macros within TRACEPOINT_EVENT */
123 #include <lttng/events-reset.h>
124
125 #undef TP_PROTO
126 #define TP_PROTO(...) __VA_ARGS__
127
128 #undef TP_ARGS
129 #define TP_ARGS(...) __VA_ARGS__
130
131 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
132 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
133 void trace_##_name(_proto);
134
135 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
136 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
137 void trace_##_name(void);
138
139 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
140
141 /*
142 * Stage 1.1 of the trace events.
143 *
144 * Create dummy trace prototypes for each event class, and for each used
145 * template. This will allow checking whether the prototypes from the
146 * class and the instance using the class actually match.
147 */
148
149 #include <lttng/events-reset.h> /* Reset all macros within TRACE_EVENT */
150
151 #undef TP_PROTO
152 #define TP_PROTO(...) __VA_ARGS__
153
154 #undef TP_ARGS
155 #define TP_ARGS(...) __VA_ARGS__
156
157 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
158 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
159 void __event_template_proto___##_template(_proto);
160
161 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
162 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
163 void __event_template_proto___##_template(void);
164
165 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
166 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
167 void __event_template_proto___##_name(_proto);
168
169 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
170 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
171 void __event_template_proto___##_name(void);
172
173 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
174
175 /*
176 * Stage 1.2 of the trace event_notifier.
177 *
178 * Create dummy trace prototypes for each event class, and for each used
179 * template. This will allow checking whether the prototypes from the
180 * class and the instance using the class actually match.
181 */
182
183 #include <lttng/events-reset.h> /* Reset all macros within TRACE_EVENT */
184
185 #undef TP_PROTO
186 #define TP_PROTO(...) __VA_ARGS__
187
188 #undef TP_ARGS
189 #define TP_ARGS(...) __VA_ARGS__
190
191 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
192 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
193 void __event_notifier_template_proto___##_template(_proto);
194
195 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
196 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
197 void __event_notifier_template_proto___##_template(void);
198
199 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
200 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
201 void __event_notifier_template_proto___##_name(_proto);
202
203 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
204 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
205 void __event_notifier_template_proto___##_name(void);
206
207 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
208
209
210 /*
211 * Stage 1.2 of tracepoint event generation
212 *
213 * Unfolding the enums
214 */
215 #include <lttng/events-reset.h> /* Reset all macros within TRACE_EVENT */
216
217 /* Enumeration entry (single value) */
218 #undef ctf_enum_value
219 #define ctf_enum_value(_string, _value) \
220 { \
221 .start = { \
222 .signedness = lttng_is_signed_type(__typeof__(_value)), \
223 .value = lttng_is_signed_type(__typeof__(_value)) ? \
224 (long long) (_value) : (_value), \
225 }, \
226 .end = { \
227 .signedness = lttng_is_signed_type(__typeof__(_value)), \
228 .value = lttng_is_signed_type(__typeof__(_value)) ? \
229 (long long) (_value) : (_value), \
230 }, \
231 .string = (_string), \
232 },
233
234 /* Enumeration entry (range) */
235 #undef ctf_enum_range
236 #define ctf_enum_range(_string, _range_start, _range_end) \
237 { \
238 .start = { \
239 .signedness = lttng_is_signed_type(__typeof__(_range_start)), \
240 .value = lttng_is_signed_type(__typeof__(_range_start)) ? \
241 (long long) (_range_start) : (_range_start), \
242 }, \
243 .end = { \
244 .signedness = lttng_is_signed_type(__typeof__(_range_end)), \
245 .value = lttng_is_signed_type(__typeof__(_range_end)) ? \
246 (long long) (_range_end) : (_range_end), \
247 }, \
248 .string = (_string), \
249 },
250
251 /* Enumeration entry (automatic value; follows the rules of CTF) */
252 #undef ctf_enum_auto
253 #define ctf_enum_auto(_string) \
254 { \
255 .start = { \
256 .signedness = -1, \
257 .value = -1, \
258 }, \
259 .end = { \
260 .signedness = -1, \
261 .value = -1, \
262 }, \
263 .string = (_string), \
264 .options = { \
265 .is_auto = 1, \
266 } \
267 },
268
269 #undef TP_ENUM_VALUES
270 #define TP_ENUM_VALUES(...) \
271 __VA_ARGS__
272
273 #undef LTTNG_TRACEPOINT_ENUM
274 #define LTTNG_TRACEPOINT_ENUM(_name, _values) \
275 const struct lttng_enum_entry __enum_values__##_name[] = { \
276 _values \
277 };
278
279 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
280
281 /*
282 * Stage 2 of the trace events.
283 *
284 * Create event field type metadata section.
285 * Each event produce an array of fields.
286 */
287
288 /* Reset all macros within TRACEPOINT_EVENT */
289 #include <lttng/events-reset.h>
290 #include <lttng/events-write.h>
291 #include <lttng/events-nowrite.h>
292
293 #undef _ctf_integer_ext
294 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
295 { \
296 .name = #_item, \
297 .type = __type_integer(_type, 0, 0, -1, _byte_order, _base, none), \
298 .nowrite = _nowrite, \
299 .user = _user, \
300 .nofilter = 0, \
301 },
302
303 #undef _ctf_array_encoded
304 #define _ctf_array_encoded(_type, _item, _src, _length, \
305 _encoding, _byte_order, _elem_type_base, _user, _nowrite) \
306 { \
307 .name = #_item, \
308 .type = \
309 { \
310 .atype = atype_array_nestable, \
311 .u = \
312 { \
313 .array_nestable = \
314 { \
315 .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
316 __type_integer(_type, 0, 0, -1, _byte_order, _elem_type_base, _encoding)), \
317 .length = _length, \
318 .alignment = 0, \
319 } \
320 } \
321 }, \
322 .nowrite = _nowrite, \
323 .user = _user, \
324 .nofilter = 0, \
325 },
326
327 #undef _ctf_array_bitfield
328 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
329 { \
330 .name = #_item, \
331 .type = \
332 { \
333 .atype = atype_array_nestable, \
334 .u = \
335 { \
336 .array_nestable = \
337 { \
338 .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
339 __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none)), \
340 .length = (_length) * sizeof(_type) * CHAR_BIT, \
341 .alignment = lttng_alignof(_type), \
342 } \
343 } \
344 }, \
345 .nowrite = _nowrite, \
346 .user = _user, \
347 .nofilter = 0, \
348 },
349
350
351 #undef _ctf_sequence_encoded
352 #define _ctf_sequence_encoded(_type, _item, _src, \
353 _length_type, _src_length, _encoding, \
354 _byte_order, _elem_type_base, _user, _nowrite) \
355 { \
356 .name = "_" #_item "_length", \
357 .type = __type_integer(_length_type, 0, 0, -1, __BYTE_ORDER, 10, none), \
358 .nowrite = _nowrite, \
359 .nofilter = 1, \
360 }, \
361 { \
362 .name = #_item, \
363 .type = \
364 { \
365 .atype = atype_sequence_nestable, \
366 .u = \
367 { \
368 .sequence_nestable = \
369 { \
370 .length_name = "_" #_item "_length", \
371 .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
372 __type_integer(_type, 0, 0, -1, _byte_order, _elem_type_base, _encoding)), \
373 .alignment = 0, \
374 }, \
375 }, \
376 }, \
377 .nowrite = _nowrite, \
378 .user = _user, \
379 .nofilter = 0, \
380 },
381
382 #undef _ctf_sequence_bitfield
383 #define _ctf_sequence_bitfield(_type, _item, _src, \
384 _length_type, _src_length, \
385 _user, _nowrite) \
386 { \
387 .name = "_" #_item "_length", \
388 .type = __type_integer(_length_type, 0, 0, -1, __BYTE_ORDER, 10, none), \
389 .nowrite = _nowrite, \
390 .nofilter = 1, \
391 }, \
392 { \
393 .name = #_item, \
394 .type = \
395 { \
396 .atype = atype_sequence_nestable, \
397 .u = \
398 { \
399 .sequence_nestable = \
400 { \
401 .length_name = "_" #_item "_length", \
402 .elem_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
403 __type_integer(_type, 1, 1, 0, __LITTLE_ENDIAN, 10, none)), \
404 .alignment = lttng_alignof(_type), \
405 }, \
406 }, \
407 }, \
408 .nowrite = _nowrite, \
409 .user = _user, \
410 .nofilter = 0, \
411 },
412
413 #undef _ctf_string
414 #define _ctf_string(_item, _src, _user, _nowrite) \
415 { \
416 .name = #_item, \
417 .type = \
418 { \
419 .atype = atype_string, \
420 .u = \
421 { \
422 .string = { .encoding = lttng_encode_UTF8 }, \
423 }, \
424 }, \
425 .nowrite = _nowrite, \
426 .user = _user, \
427 .nofilter = 0, \
428 },
429
430 #undef _ctf_enum
431 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
432 { \
433 .name = #_item, \
434 .type = { \
435 .atype = atype_enum_nestable, \
436 .u = { \
437 .enum_nestable = { \
438 .desc = &__enum_##_name, \
439 .container_type = __LTTNG_COMPOUND_LITERAL(struct lttng_type, \
440 __type_integer(_type, 0, 0, -1, __BYTE_ORDER, 10, none)), \
441 }, \
442 }, \
443 }, \
444 .nowrite = _nowrite, \
445 .user = _user, \
446 .nofilter = 0, \
447 },
448
449 #undef ctf_custom_field
450 #define ctf_custom_field(_type, _item, _code) \
451 { \
452 .name = #_item, \
453 .type = _type, \
454 .nowrite = 0, \
455 .user = 0, \
456 .nofilter = 1, \
457 },
458
459 #undef ctf_custom_type
460 #define ctf_custom_type(...) __VA_ARGS__
461
462 #undef TP_FIELDS
463 #define TP_FIELDS(...) __VA_ARGS__ /* Only one used in this phase */
464
465 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
466 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
467 static const struct lttng_event_field __event_fields___##_name[] = { \
468 _fields \
469 };
470
471 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
472 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
473 LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, PARAMS(_fields), _code_post)
474
475 #undef LTTNG_TRACEPOINT_ENUM
476 #define LTTNG_TRACEPOINT_ENUM(_name, _values) \
477 static const struct lttng_enum_desc __enum_##_name = { \
478 .name = #_name, \
479 .entries = __enum_values__##_name, \
480 .nr_entries = ARRAY_SIZE(__enum_values__##_name), \
481 };
482
483 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
484
485 /*
486 * Stage 3 of the trace events.
487 *
488 * Create probe callback prototypes.
489 */
490
491 /* Reset all macros within TRACEPOINT_EVENT */
492 #include <lttng/events-reset.h>
493
494 #undef TP_PROTO
495 #define TP_PROTO(...) __VA_ARGS__
496
497 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
498 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
499 static void __event_probe__##_name(void *__data, _proto);
500
501 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
502 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
503 static void __event_probe__##_name(void *__data);
504
505 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
506
507 /*
508 * Stage 3.1 of the trace event_notifiers.
509 *
510 * Create event_notifier probe callback prototypes.
511 */
512
513 /* Reset all macros within TRACEPOINT_EVENT */
514 #include <lttng/events-reset.h>
515
516 #undef TP_PROTO
517 #define TP_PROTO(...) __VA_ARGS__
518
519 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
520 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
521 static void __event_notifier_probe__##_name(void *__data, _proto);
522
523 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
524 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
525 static void __event_notifier_probe__##_name(void *__data);
526
527 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
528
529 /*
530 * Stage 4 of the trace events.
531 *
532 * Create static inline function that calculates event size.
533 */
534
535 /* Reset all macros within TRACEPOINT_EVENT */
536 #include <lttng/events-reset.h>
537 #include <lttng/events-write.h>
538
539 #undef _ctf_integer_ext
540 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
541 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
542 __event_len += sizeof(_type);
543
544 #undef _ctf_array_encoded
545 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
546 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
547 __event_len += sizeof(_type) * (_length);
548
549 #undef _ctf_array_bitfield
550 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
551 _ctf_array_encoded(_type, _item, _src, _length, none, __LITTLE_ENDIAN, 0, _user, _nowrite)
552
553 #undef _ctf_sequence_encoded
554 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
555 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
556 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_length_type)); \
557 __event_len += sizeof(_length_type); \
558 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \
559 { \
560 size_t __seqlen = (_src_length); \
561 \
562 if (unlikely(++this_cpu_ptr(&lttng_dynamic_len_stack)->offset >= LTTNG_DYNAMIC_LEN_STACK_SIZE)) \
563 goto error; \
564 barrier(); /* reserve before use. */ \
565 this_cpu_ptr(&lttng_dynamic_len_stack)->stack[this_cpu_ptr(&lttng_dynamic_len_stack)->offset - 1] = __seqlen; \
566 __event_len += sizeof(_type) * __seqlen; \
567 }
568
569 #undef _ctf_sequence_bitfield
570 #define _ctf_sequence_bitfield(_type, _item, _src, \
571 _length_type, _src_length, \
572 _user, _nowrite) \
573 _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
574 none, __LITTLE_ENDIAN, 10, _user, _nowrite)
575
576 /*
577 * ctf_user_string includes \0. If returns 0, it faulted, so we set size to
578 * 1 (\0 only).
579 */
580 #undef _ctf_string
581 #define _ctf_string(_item, _src, _user, _nowrite) \
582 if (unlikely(++this_cpu_ptr(&lttng_dynamic_len_stack)->offset >= LTTNG_DYNAMIC_LEN_STACK_SIZE)) \
583 goto error; \
584 barrier(); /* reserve before use. */ \
585 if (_user) { \
586 __event_len += this_cpu_ptr(&lttng_dynamic_len_stack)->stack[this_cpu_ptr(&lttng_dynamic_len_stack)->offset - 1] = \
587 max_t(size_t, lttng_strlen_user_inatomic(_src), 1); \
588 } else { \
589 __event_len += this_cpu_ptr(&lttng_dynamic_len_stack)->stack[this_cpu_ptr(&lttng_dynamic_len_stack)->offset - 1] = \
590 strlen((_src) ? (_src) : __LTTNG_NULL_STRING) + 1; \
591 }
592
593 #undef _ctf_enum
594 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
595 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
596
597 #undef ctf_align
598 #define ctf_align(_type) \
599 __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type));
600
601 #undef ctf_custom_field
602 #define ctf_custom_field(_type, _item, _code) \
603 { \
604 _code \
605 }
606
607 #undef ctf_custom_code
608 #define ctf_custom_code(...) __VA_ARGS__
609
610 #undef TP_PROTO
611 #define TP_PROTO(...) __VA_ARGS__
612
613 #undef TP_FIELDS
614 #define TP_FIELDS(...) __VA_ARGS__
615
616 #undef TP_locvar
617 #define TP_locvar(...) __VA_ARGS__
618
619 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
620 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
621 static inline ssize_t __event_get_size__##_name(void *__tp_locvar, _proto) \
622 { \
623 size_t __event_len = 0; \
624 unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
625 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
626 \
627 _fields \
628 return __event_len; \
629 \
630 error: \
631 __attribute__((unused)); \
632 return -1; \
633 }
634
635 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
636 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
637 static inline ssize_t __event_get_size__##_name(void *__tp_locvar) \
638 { \
639 size_t __event_len = 0; \
640 unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \
641 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
642 \
643 _fields \
644 return __event_len; \
645 \
646 error: \
647 __attribute__((unused)); \
648 return -1; \
649 }
650
651 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
652
653
654 /*
655 * Stage 4.1 of tracepoint event generation.
656 *
657 * Create static inline function that layout the filter stack data.
658 * We make both write and nowrite data available to the filter.
659 */
660
661 /* Reset all macros within TRACEPOINT_EVENT */
662 #include <lttng/events-reset.h>
663 #include <lttng/events-write.h>
664 #include <lttng/events-nowrite.h>
665
666 #undef _ctf_integer_ext_fetched
667 #define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \
668 if (lttng_is_signed_type(_type)) { \
669 int64_t __ctf_tmp_int64; \
670 switch (sizeof(_type)) { \
671 case 1: \
672 { \
673 union { _type t; int8_t v; } __tmp = { (_type) (_src) }; \
674 __ctf_tmp_int64 = (int64_t) __tmp.v; \
675 break; \
676 } \
677 case 2: \
678 { \
679 union { _type t; int16_t v; } __tmp = { (_type) (_src) }; \
680 if (_byte_order != __BYTE_ORDER) \
681 __swab16s(&__tmp.v); \
682 __ctf_tmp_int64 = (int64_t) __tmp.v; \
683 break; \
684 } \
685 case 4: \
686 { \
687 union { _type t; int32_t v; } __tmp = { (_type) (_src) }; \
688 if (_byte_order != __BYTE_ORDER) \
689 __swab32s(&__tmp.v); \
690 __ctf_tmp_int64 = (int64_t) __tmp.v; \
691 break; \
692 } \
693 case 8: \
694 { \
695 union { _type t; int64_t v; } __tmp = { (_type) (_src) }; \
696 if (_byte_order != __BYTE_ORDER) \
697 __swab64s(&__tmp.v); \
698 __ctf_tmp_int64 = (int64_t) __tmp.v; \
699 break; \
700 } \
701 default: \
702 BUG_ON(1); \
703 }; \
704 memcpy(__stack_data, &__ctf_tmp_int64, sizeof(int64_t)); \
705 } else { \
706 uint64_t __ctf_tmp_uint64; \
707 switch (sizeof(_type)) { \
708 case 1: \
709 { \
710 union { _type t; uint8_t v; } __tmp = { (_type) (_src) }; \
711 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
712 break; \
713 } \
714 case 2: \
715 { \
716 union { _type t; uint16_t v; } __tmp = { (_type) (_src) }; \
717 if (_byte_order != __BYTE_ORDER) \
718 __swab16s(&__tmp.v); \
719 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
720 break; \
721 } \
722 case 4: \
723 { \
724 union { _type t; uint32_t v; } __tmp = { (_type) (_src) }; \
725 if (_byte_order != __BYTE_ORDER) \
726 __swab32s(&__tmp.v); \
727 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
728 break; \
729 } \
730 case 8: \
731 { \
732 union { _type t; uint64_t v; } __tmp = { (_type) (_src) }; \
733 if (_byte_order != __BYTE_ORDER) \
734 __swab64s(&__tmp.v); \
735 __ctf_tmp_uint64 = (uint64_t) __tmp.v; \
736 break; \
737 } \
738 default: \
739 BUG_ON(1); \
740 }; \
741 memcpy(__stack_data, &__ctf_tmp_uint64, sizeof(uint64_t)); \
742 } \
743 __stack_data += sizeof(int64_t);
744
745 #undef _ctf_integer_ext_isuser0
746 #define _ctf_integer_ext_isuser0(_type, _item, _src, _byte_order, _base, _nowrite) \
747 _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite)
748
749 #undef _ctf_integer_ext_isuser1
750 #define _ctf_integer_ext_isuser1(_type, _item, _user_src, _byte_order, _base, _nowrite) \
751 { \
752 union { \
753 char __array[sizeof(_user_src)]; \
754 __typeof__(_user_src) __v; \
755 } __tmp_fetch; \
756 if (lib_ring_buffer_copy_from_user_check_nofault(__tmp_fetch.__array, \
757 &(_user_src), sizeof(_user_src))) \
758 memset(__tmp_fetch.__array, 0, sizeof(__tmp_fetch.__array)); \
759 _ctf_integer_ext_fetched(_type, _item, __tmp_fetch.__v, _byte_order, _base, _nowrite) \
760 }
761
762 #undef _ctf_integer_ext
763 #define _ctf_integer_ext(_type, _item, _user_src, _byte_order, _base, _user, _nowrite) \
764 _ctf_integer_ext_isuser##_user(_type, _item, _user_src, _byte_order, _base, _nowrite)
765
766 #undef _ctf_array_encoded
767 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
768 { \
769 unsigned long __ctf_tmp_ulong = (unsigned long) (_length); \
770 const void *__ctf_tmp_ptr = (_src); \
771 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
772 __stack_data += sizeof(unsigned long); \
773 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
774 __stack_data += sizeof(void *); \
775 }
776
777 #undef _ctf_array_bitfield
778 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
779 _ctf_array_encoded(_type, _item, _src, _length, none, __LITTLE_ENDIAN, 0, _user, _nowrite)
780
781 #undef _ctf_sequence_encoded
782 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
783 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
784 { \
785 unsigned long __ctf_tmp_ulong = (unsigned long) (_src_length); \
786 const void *__ctf_tmp_ptr = (_src); \
787 memcpy(__stack_data, &__ctf_tmp_ulong, sizeof(unsigned long)); \
788 __stack_data += sizeof(unsigned long); \
789 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
790 __stack_data += sizeof(void *); \
791 }
792
793 #undef _ctf_sequence_bitfield
794 #define _ctf_sequence_bitfield(_type, _item, _src, \
795 _length_type, _src_length, \
796 _user, _nowrite) \
797 _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
798 none, __LITTLE_ENDIAN, 10, _user, _nowrite)
799
800 #undef _ctf_string
801 #define _ctf_string(_item, _src, _user, _nowrite) \
802 { \
803 const void *__ctf_tmp_ptr = \
804 ((_src) ? (_src) : __LTTNG_NULL_STRING); \
805 memcpy(__stack_data, &__ctf_tmp_ptr, sizeof(void *)); \
806 __stack_data += sizeof(void *); \
807 }
808
809 #undef _ctf_enum
810 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
811 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
812
813 #undef TP_PROTO
814 #define TP_PROTO(...) __VA_ARGS__
815
816 #undef TP_FIELDS
817 #define TP_FIELDS(...) __VA_ARGS__
818
819 #undef TP_locvar
820 #define TP_locvar(...) __VA_ARGS__
821
822 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
823 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
824 static inline \
825 void __event_prepare_interpreter_stack__##_name(char *__stack_data, \
826 void *__tp_locvar) \
827 { \
828 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
829 \
830 _fields \
831 }
832
833 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
834 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
835 static inline \
836 void __event_prepare_interpreter_stack__##_name(char *__stack_data, \
837 void *__tp_locvar, _proto) \
838 { \
839 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
840 \
841 _fields \
842 }
843
844 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
845
846 /*
847 * Stage 5 of the trace events.
848 *
849 * Create static inline function that calculates event payload alignment.
850 */
851
852 /* Reset all macros within TRACEPOINT_EVENT */
853 #include <lttng/events-reset.h>
854 #include <lttng/events-write.h>
855
856 #undef _ctf_integer_ext
857 #define _ctf_integer_ext(_type, _item, _src, _byte_order, _base, _user, _nowrite) \
858 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
859
860 #undef _ctf_array_encoded
861 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
862 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
863
864 #undef _ctf_array_bitfield
865 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
866 _ctf_array_encoded(_type, _item, _src, _length, none, __LITTLE_ENDIAN, 0, _user, _nowrite)
867
868 #undef _ctf_sequence_encoded
869 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
870 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
871 __event_align = max_t(size_t, __event_align, lttng_alignof(_length_type)); \
872 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
873
874 #undef _ctf_sequence_bitfield
875 #define _ctf_sequence_bitfield(_type, _item, _src, \
876 _length_type, _src_length, \
877 _user, _nowrite) \
878 _ctf_sequence_encoded(_type, _item, _src, _length_type, _src_length, \
879 none, __LITTLE_ENDIAN, 10, _user, _nowrite)
880
881 #undef _ctf_string
882 #define _ctf_string(_item, _src, _user, _nowrite)
883
884 #undef _ctf_enum
885 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
886 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
887
888 #undef ctf_align
889 #define ctf_align(_type) \
890 __event_align = max_t(size_t, __event_align, lttng_alignof(_type));
891
892 #undef TP_PROTO
893 #define TP_PROTO(...) __VA_ARGS__
894
895 #undef TP_FIELDS
896 #define TP_FIELDS(...) __VA_ARGS__
897
898 #undef TP_locvar
899 #define TP_locvar(...) __VA_ARGS__
900
901 #undef ctf_custom_field
902 #define ctf_custom_field(_type, _item, _code) _code
903
904 #undef ctf_custom_code
905 #define ctf_custom_code(...) \
906 { \
907 __VA_ARGS__ \
908 }
909
910 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
911 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
912 static inline size_t __event_get_align__##_name(void *__tp_locvar, _proto) \
913 { \
914 size_t __event_align = 1; \
915 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
916 \
917 _fields \
918 return __event_align; \
919 }
920
921 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
922 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
923 static inline size_t __event_get_align__##_name(void *__tp_locvar) \
924 { \
925 size_t __event_align = 1; \
926 struct { _locvar } *tp_locvar __attribute__((unused)) = __tp_locvar; \
927 \
928 _fields \
929 return __event_align; \
930 }
931
932 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
933
934 /*
935 * Stage 6 of tracepoint event generation.
936 *
937 * Create the probe function. This function calls event size calculation
938 * and writes event data into the buffer.
939 */
940
941 /* Reset all macros within TRACEPOINT_EVENT */
942 #include <lttng/events-reset.h>
943 #include <lttng/events-write.h>
944
945 #undef _ctf_integer_ext_fetched
946 #define _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite) \
947 { \
948 _type __tmp = _src; \
949 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp));\
950 __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\
951 }
952
953 #undef _ctf_integer_ext_isuser0
954 #define _ctf_integer_ext_isuser0(_type, _item, _src, _byte_order, _base, _nowrite) \
955 _ctf_integer_ext_fetched(_type, _item, _src, _byte_order, _base, _nowrite)
956
957 #undef _ctf_integer_ext_isuser1
958 #define _ctf_integer_ext_isuser1(_type, _item, _user_src, _byte_order, _base, _nowrite) \
959 { \
960 union { \
961 char __array[sizeof(_user_src)]; \
962 __typeof__(_user_src) __v; \
963 } __tmp_fetch; \
964 if (lib_ring_buffer_copy_from_user_check_nofault(__tmp_fetch.__array, \
965 &(_user_src), sizeof(_user_src))) \
966 memset(__tmp_fetch.__array, 0, sizeof(__tmp_fetch.__array)); \
967 _ctf_integer_ext_fetched(_type, _item, __tmp_fetch.__v, _byte_order, _base, _nowrite) \
968 }
969
970 #undef _ctf_integer_ext
971 #define _ctf_integer_ext(_type, _item, _user_src, _byte_order, _base, _user, _nowrite) \
972 _ctf_integer_ext_isuser##_user(_type, _item, _user_src, _byte_order, _base, _nowrite)
973
974 #undef _ctf_array_encoded
975 #define _ctf_array_encoded(_type, _item, _src, _length, _encoding, _byte_order, _base, _user, _nowrite) \
976 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
977 if (_user) { \
978 __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \
979 } else { \
980 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
981 }
982
983 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
984 #undef _ctf_array_bitfield
985 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
986 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
987 if (_user) { \
988 __chan->ops->event_write_from_user(&__ctx, _src, sizeof(_type) * (_length)); \
989 } else { \
990 __chan->ops->event_write(&__ctx, _src, sizeof(_type) * (_length)); \
991 }
992 #else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
993 /*
994 * For big endian, we need to byteswap into little endian.
995 */
996 #undef _ctf_array_bitfield
997 #define _ctf_array_bitfield(_type, _item, _src, _length, _user, _nowrite) \
998 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
999 { \
1000 size_t _i; \
1001 \
1002 for (_i = 0; _i < (_length); _i++) { \
1003 _type _tmp; \
1004 \
1005 if (_user) { \
1006 if (get_user(_tmp, (_type *) _src + _i)) \
1007 _tmp = 0; \
1008 } else { \
1009 _tmp = ((_type *) _src)[_i]; \
1010 } \
1011 switch (sizeof(_type)) { \
1012 case 1: \
1013 break; \
1014 case 2: \
1015 _tmp = cpu_to_le16(_tmp); \
1016 break; \
1017 case 4: \
1018 _tmp = cpu_to_le32(_tmp); \
1019 break; \
1020 case 8: \
1021 _tmp = cpu_to_le64(_tmp); \
1022 break; \
1023 default: \
1024 BUG_ON(1); \
1025 } \
1026 __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
1027 } \
1028 }
1029 #endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
1030
1031 #undef _ctf_sequence_encoded
1032 #define _ctf_sequence_encoded(_type, _item, _src, _length_type, \
1033 _src_length, _encoding, _byte_order, _base, _user, _nowrite) \
1034 { \
1035 _length_type __tmpl = this_cpu_ptr(&lttng_dynamic_len_stack)->stack[__dynamic_len_idx]; \
1036 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
1037 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
1038 } \
1039 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
1040 if (_user) { \
1041 __chan->ops->event_write_from_user(&__ctx, _src, \
1042 sizeof(_type) * __get_dynamic_len(dest)); \
1043 } else { \
1044 __chan->ops->event_write(&__ctx, _src, \
1045 sizeof(_type) * __get_dynamic_len(dest)); \
1046 }
1047
1048 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
1049 #undef _ctf_sequence_bitfield
1050 #define _ctf_sequence_bitfield(_type, _item, _src, \
1051 _length_type, _src_length, \
1052 _user, _nowrite) \
1053 { \
1054 _length_type __tmpl = this_cpu_ptr(&lttng_dynamic_len_stack)->stack[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
1055 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
1056 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
1057 } \
1058 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
1059 if (_user) { \
1060 __chan->ops->event_write_from_user(&__ctx, _src, \
1061 sizeof(_type) * __get_dynamic_len(dest)); \
1062 } else { \
1063 __chan->ops->event_write(&__ctx, _src, \
1064 sizeof(_type) * __get_dynamic_len(dest)); \
1065 }
1066 #else /* #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
1067 /*
1068 * For big endian, we need to byteswap into little endian.
1069 */
1070 #undef _ctf_sequence_bitfield
1071 #define _ctf_sequence_bitfield(_type, _item, _src, \
1072 _length_type, _src_length, \
1073 _user, _nowrite) \
1074 { \
1075 _length_type __tmpl = this_cpu_ptr(&lttng_dynamic_len_stack)->stack[__dynamic_len_idx] * sizeof(_type) * CHAR_BIT; \
1076 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_length_type));\
1077 __chan->ops->event_write(&__ctx, &__tmpl, sizeof(_length_type));\
1078 } \
1079 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type)); \
1080 { \
1081 size_t _i, _length; \
1082 \
1083 _length = __get_dynamic_len(dest); \
1084 for (_i = 0; _i < _length; _i++) { \
1085 _type _tmp; \
1086 \
1087 if (_user) { \
1088 if (get_user(_tmp, (_type *) _src + _i)) \
1089 _tmp = 0; \
1090 } else { \
1091 _tmp = ((_type *) _src)[_i]; \
1092 } \
1093 switch (sizeof(_type)) { \
1094 case 1: \
1095 break; \
1096 case 2: \
1097 _tmp = cpu_to_le16(_tmp); \
1098 break; \
1099 case 4: \
1100 _tmp = cpu_to_le32(_tmp); \
1101 break; \
1102 case 8: \
1103 _tmp = cpu_to_le64(_tmp); \
1104 break; \
1105 default: \
1106 BUG_ON(1); \
1107 } \
1108 __chan->ops->event_write(&__ctx, &_tmp, sizeof(_type)); \
1109 } \
1110 }
1111 #endif /* #else #if (__BYTE_ORDER == __LITTLE_ENDIAN) */
1112
1113 #undef _ctf_string
1114 #define _ctf_string(_item, _src, _user, _nowrite) \
1115 if (_user) { \
1116 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(*(_src))); \
1117 __chan->ops->event_strcpy_from_user(&__ctx, _src, \
1118 __get_dynamic_len(dest)); \
1119 } else { \
1120 const char *__ctf_tmp_string = \
1121 ((_src) ? (_src) : __LTTNG_NULL_STRING); \
1122 lib_ring_buffer_align_ctx(&__ctx, \
1123 lttng_alignof(*__ctf_tmp_string)); \
1124 __chan->ops->event_strcpy(&__ctx, __ctf_tmp_string, \
1125 __get_dynamic_len(dest)); \
1126 }
1127
1128 #undef _ctf_enum
1129 #define _ctf_enum(_name, _type, _item, _src, _user, _nowrite) \
1130 _ctf_integer_ext(_type, _item, _src, __BYTE_ORDER, 10, _user, _nowrite)
1131
1132 #undef ctf_align
1133 #define ctf_align(_type) \
1134 lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(_type));
1135
1136 #undef ctf_custom_field
1137 #define ctf_custom_field(_type, _item, _code) _code
1138
1139 #undef ctf_custom_code
1140 #define ctf_custom_code(...) \
1141 { \
1142 __VA_ARGS__ \
1143 }
1144
1145 /* Beware: this get len actually consumes the len value */
1146 #undef __get_dynamic_len
1147 #define __get_dynamic_len(field) this_cpu_ptr(&lttng_dynamic_len_stack)->stack[__dynamic_len_idx++]
1148
1149 #undef TP_PROTO
1150 #define TP_PROTO(...) __VA_ARGS__
1151
1152 #undef TP_ARGS
1153 #define TP_ARGS(...) __VA_ARGS__
1154
1155 #undef TP_FIELDS
1156 #define TP_FIELDS(...) __VA_ARGS__
1157
1158 #undef TP_locvar
1159 #define TP_locvar(...) __VA_ARGS__
1160
1161 #undef TP_code_pre
1162 #define TP_code_pre(...) __VA_ARGS__
1163
1164 #undef TP_code_post
1165 #define TP_code_post(...) __VA_ARGS__
1166
1167 /*
1168 * For state dump, check that "session" argument (mandatory) matches the
1169 * session this event belongs to. Ensures that we write state dump data only
1170 * into the started session, not into all sessions.
1171 */
1172 #ifdef TP_SESSION_CHECK
1173 #define _TP_SESSION_CHECK(session, csession) (session == csession)
1174 #else /* TP_SESSION_CHECK */
1175 #define _TP_SESSION_CHECK(session, csession) 1
1176 #endif /* TP_SESSION_CHECK */
1177
1178 /*
1179 * Using twice size for filter stack data to hold size and pointer for
1180 * each field (worse case). For integers, max size required is 64-bit.
1181 * Same for double-precision floats. Those fit within
1182 * 2*sizeof(unsigned long) for all supported architectures.
1183 * Perform UNION (||) of filter runtime list.
1184 */
1185 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
1186 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
1187 static void __event_probe__##_name(void *__data, _proto) \
1188 { \
1189 struct probe_local_vars { _locvar }; \
1190 struct lttng_event *__event = __data; \
1191 struct lttng_probe_ctx __lttng_probe_ctx = { \
1192 .event = __event, \
1193 .event_notifier = NULL, \
1194 .interruptible = !irqs_disabled(), \
1195 }; \
1196 struct lttng_channel *__chan = __event->chan; \
1197 struct lttng_session *__session = __chan->session; \
1198 struct lib_ring_buffer_ctx __ctx; \
1199 ssize_t __event_len; \
1200 size_t __event_align; \
1201 size_t __orig_dynamic_len_offset, __dynamic_len_idx __attribute__((unused)); \
1202 union { \
1203 size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
1204 char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
1205 } __stackvar; \
1206 int __ret; \
1207 struct probe_local_vars __tp_locvar; \
1208 struct probe_local_vars *tp_locvar __attribute__((unused)) = \
1209 &__tp_locvar; \
1210 struct lttng_id_tracker_rcu *__lf; \
1211 \
1212 if (!_TP_SESSION_CHECK(session, __session)) \
1213 return; \
1214 if (unlikely(!LTTNG_READ_ONCE(__session->active))) \
1215 return; \
1216 if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \
1217 return; \
1218 if (unlikely(!LTTNG_READ_ONCE(__event->enabled))) \
1219 return; \
1220 __lf = lttng_rcu_dereference(__session->pid_tracker.p); \
1221 if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \
1222 return; \
1223 __lf = lttng_rcu_dereference(__session->vpid_tracker.p); \
1224 if (__lf && likely(!lttng_id_tracker_lookup(__lf, task_tgid_vnr(current)))) \
1225 return; \
1226 __lf = lttng_rcu_dereference(__session->uid_tracker.p); \
1227 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1228 lttng_current_uid()))) \
1229 return; \
1230 __lf = lttng_rcu_dereference(__session->vuid_tracker.p); \
1231 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1232 lttng_current_vuid()))) \
1233 return; \
1234 __lf = lttng_rcu_dereference(__session->gid_tracker.p); \
1235 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1236 lttng_current_gid()))) \
1237 return; \
1238 __lf = lttng_rcu_dereference(__session->vgid_tracker.p); \
1239 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1240 lttng_current_vgid()))) \
1241 return; \
1242 __orig_dynamic_len_offset = this_cpu_ptr(&lttng_dynamic_len_stack)->offset; \
1243 __dynamic_len_idx = __orig_dynamic_len_offset; \
1244 _code_pre \
1245 if (unlikely(!list_empty(&__event->filter_bytecode_runtime_head))) { \
1246 struct lttng_bytecode_runtime *bc_runtime; \
1247 int __filter_record = __event->has_enablers_without_bytecode; \
1248 \
1249 __event_prepare_interpreter_stack__##_name(__stackvar.__filter_stack_data, \
1250 tp_locvar, _args); \
1251 lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
1252 if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
1253 __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
1254 __filter_record = 1; \
1255 break; \
1256 } \
1257 } \
1258 if (likely(!__filter_record)) \
1259 goto __post; \
1260 } \
1261 __event_len = __event_get_size__##_name(tp_locvar, _args); \
1262 if (unlikely(__event_len < 0)) { \
1263 lib_ring_buffer_lost_event_too_big(__chan->chan); \
1264 goto __post; \
1265 } \
1266 __event_align = __event_get_align__##_name(tp_locvar, _args); \
1267 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_probe_ctx, __event_len, \
1268 __event_align, -1); \
1269 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
1270 if (__ret < 0) \
1271 goto __post; \
1272 _fields \
1273 __chan->ops->event_commit(&__ctx); \
1274 __post: \
1275 _code_post \
1276 barrier(); /* use before un-reserve. */ \
1277 this_cpu_ptr(&lttng_dynamic_len_stack)->offset = __orig_dynamic_len_offset; \
1278 return; \
1279 }
1280
1281 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
1282 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
1283 static void __event_probe__##_name(void *__data) \
1284 { \
1285 struct probe_local_vars { _locvar }; \
1286 struct lttng_event *__event = __data; \
1287 struct lttng_probe_ctx __lttng_probe_ctx = { \
1288 .event = __event, \
1289 .event_notifier = NULL, \
1290 .interruptible = !irqs_disabled(), \
1291 }; \
1292 struct lttng_channel *__chan = __event->chan; \
1293 struct lttng_session *__session = __chan->session; \
1294 struct lib_ring_buffer_ctx __ctx; \
1295 ssize_t __event_len; \
1296 size_t __event_align; \
1297 size_t __orig_dynamic_len_offset, __dynamic_len_idx __attribute__((unused)); \
1298 union { \
1299 size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
1300 char __filter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
1301 } __stackvar; \
1302 int __ret; \
1303 struct probe_local_vars __tp_locvar; \
1304 struct probe_local_vars *tp_locvar __attribute__((unused)) = \
1305 &__tp_locvar; \
1306 struct lttng_id_tracker_rcu *__lf; \
1307 \
1308 if (!_TP_SESSION_CHECK(session, __session)) \
1309 return; \
1310 if (unlikely(!LTTNG_READ_ONCE(__session->active))) \
1311 return; \
1312 if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \
1313 return; \
1314 if (unlikely(!LTTNG_READ_ONCE(__event->enabled))) \
1315 return; \
1316 __lf = lttng_rcu_dereference(__session->pid_tracker.p); \
1317 if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \
1318 return; \
1319 __lf = lttng_rcu_dereference(__session->vpid_tracker.p); \
1320 if (__lf && likely(!lttng_id_tracker_lookup(__lf, task_tgid_vnr(current)))) \
1321 return; \
1322 __lf = lttng_rcu_dereference(__session->uid_tracker.p); \
1323 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1324 lttng_current_uid()))) \
1325 return; \
1326 __lf = lttng_rcu_dereference(__session->vuid_tracker.p); \
1327 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1328 lttng_current_vuid()))) \
1329 return; \
1330 __lf = lttng_rcu_dereference(__session->gid_tracker.p); \
1331 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1332 lttng_current_gid()))) \
1333 return; \
1334 __lf = lttng_rcu_dereference(__session->vgid_tracker.p); \
1335 if (__lf && likely(!lttng_id_tracker_lookup(__lf, \
1336 lttng_current_vgid()))) \
1337 return; \
1338 __orig_dynamic_len_offset = this_cpu_ptr(&lttng_dynamic_len_stack)->offset; \
1339 __dynamic_len_idx = __orig_dynamic_len_offset; \
1340 _code_pre \
1341 if (unlikely(!list_empty(&__event->filter_bytecode_runtime_head))) { \
1342 struct lttng_bytecode_runtime *bc_runtime; \
1343 int __filter_record = __event->has_enablers_without_bytecode; \
1344 \
1345 __event_prepare_interpreter_stack__##_name(__stackvar.__filter_stack_data, \
1346 tp_locvar); \
1347 lttng_list_for_each_entry_rcu(bc_runtime, &__event->filter_bytecode_runtime_head, node) { \
1348 if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
1349 __stackvar.__filter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) { \
1350 __filter_record = 1; \
1351 break; \
1352 } \
1353 } \
1354 if (likely(!__filter_record)) \
1355 goto __post; \
1356 } \
1357 __event_len = __event_get_size__##_name(tp_locvar); \
1358 if (unlikely(__event_len < 0)) { \
1359 lib_ring_buffer_lost_event_too_big(__chan->chan); \
1360 goto __post; \
1361 } \
1362 __event_align = __event_get_align__##_name(tp_locvar); \
1363 lib_ring_buffer_ctx_init(&__ctx, __chan->chan, &__lttng_probe_ctx, __event_len, \
1364 __event_align, -1); \
1365 __ret = __chan->ops->event_reserve(&__ctx, __event->id); \
1366 if (__ret < 0) \
1367 goto __post; \
1368 _fields \
1369 __chan->ops->event_commit(&__ctx); \
1370 __post: \
1371 _code_post \
1372 barrier(); /* use before un-reserve. */ \
1373 this_cpu_ptr(&lttng_dynamic_len_stack)->offset = __orig_dynamic_len_offset; \
1374 return; \
1375 }
1376
1377 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1378
1379 #undef __get_dynamic_len
1380
1381 /*
1382 * Stage 6.1 of tracepoint generation: generate event notifier probes
1383 *
1384 * Create the probe function. This function evaluates the filter bytecode and
1385 * queue a notification to be sent to userspace.
1386 */
1387
1388 #include <lttng/events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1389
1390 #undef TP_PROTO
1391 #define TP_PROTO(...) __VA_ARGS__
1392
1393 #undef TP_ARGS
1394 #define TP_ARGS(...) __VA_ARGS__
1395
1396 #undef TP_FIELDS
1397 #define TP_FIELDS(...) __VA_ARGS__
1398
1399 #undef TP_locvar
1400 #define TP_locvar(...) __VA_ARGS__
1401
1402 #undef TP_code_pre
1403 #define TP_code_pre(...) __VA_ARGS__
1404
1405 #undef TP_code_post
1406 #define TP_code_post(...) __VA_ARGS__
1407
1408 /*
1409 * Using twice size for filter stack data to hold size and pointer for
1410 * each field (worse case). For integers, max size required is 64-bit.
1411 * Same for double-precision floats. Those fit within
1412 * 2*sizeof(unsigned long) for all supported architectures.
1413 * Perform UNION (||) of filter runtime list.
1414 */
1415 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE
1416 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
1417 static void __event_notifier_probe__##_name(void *__data, _proto) \
1418 { \
1419 struct probe_local_vars { _locvar }; \
1420 struct lttng_event_notifier *__event_notifier = __data; \
1421 struct lttng_probe_ctx __lttng_probe_ctx = { \
1422 .event = NULL, \
1423 .event_notifier = __event_notifier, \
1424 .interruptible = !irqs_disabled(), \
1425 }; \
1426 union { \
1427 size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
1428 char __interpreter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
1429 } __stackvar; \
1430 struct probe_local_vars __tp_locvar; \
1431 struct probe_local_vars *tp_locvar __attribute__((unused)) = \
1432 &__tp_locvar; \
1433 \
1434 if (unlikely(!READ_ONCE(__event_notifier->enabled))) \
1435 return; \
1436 _code_pre \
1437 if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) { \
1438 struct lttng_bytecode_runtime *bc_runtime; \
1439 int __filter_record = __event_notifier->has_enablers_without_bytecode; \
1440 \
1441 __event_prepare_interpreter_stack__##_name(__stackvar.__interpreter_stack_data, \
1442 tp_locvar, _args); \
1443 lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
1444 if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
1445 __stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \
1446 __filter_record = 1; \
1447 } \
1448 if (likely(!__filter_record)) \
1449 goto __post; \
1450 } \
1451 \
1452 if (unlikely(!list_empty(&__event_notifier->capture_bytecode_runtime_head))) \
1453 __event_prepare_interpreter_stack__##_name( \
1454 __stackvar.__interpreter_stack_data, \
1455 tp_locvar, _args); \
1456 \
1457 __event_notifier->send_notification(__event_notifier, \
1458 &__lttng_probe_ctx, \
1459 __stackvar.__interpreter_stack_data); \
1460 \
1461 __post: \
1462 _code_post \
1463 return; \
1464 }
1465
1466 #undef LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
1467 #define LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, _fields, _code_post) \
1468 static void __event_notifier_probe__##_name(void *__data) \
1469 { \
1470 struct probe_local_vars { _locvar }; \
1471 struct lttng_event_notifier *__event_notifier = __data; \
1472 struct lttng_probe_ctx __lttng_probe_ctx = { \
1473 .event = NULL, \
1474 .event_notifier = __event_notifier, \
1475 .interruptible = !irqs_disabled(), \
1476 }; \
1477 union { \
1478 size_t __dynamic_len_removed[ARRAY_SIZE(__event_fields___##_name)]; \
1479 char __interpreter_stack_data[2 * sizeof(unsigned long) * ARRAY_SIZE(__event_fields___##_name)]; \
1480 } __stackvar; \
1481 struct probe_local_vars __tp_locvar; \
1482 struct probe_local_vars *tp_locvar __attribute__((unused)) = \
1483 &__tp_locvar; \
1484 \
1485 if (unlikely(!READ_ONCE(__event_notifier->enabled))) \
1486 return; \
1487 _code_pre \
1488 if (unlikely(!list_empty(&__event_notifier->filter_bytecode_runtime_head))) { \
1489 struct lttng_bytecode_runtime *bc_runtime; \
1490 int __filter_record = __event_notifier->has_enablers_without_bytecode; \
1491 \
1492 __event_prepare_interpreter_stack__##_name(__stackvar.__interpreter_stack_data, \
1493 tp_locvar); \
1494 lttng_list_for_each_entry_rcu(bc_runtime, &__event_notifier->filter_bytecode_runtime_head, node) { \
1495 if (unlikely(bc_runtime->interpreter_funcs.filter(bc_runtime, &__lttng_probe_ctx, \
1496 __stackvar.__interpreter_stack_data) & LTTNG_INTERPRETER_RECORD_FLAG)) \
1497 __filter_record = 1; \
1498 } \
1499 if (likely(!__filter_record)) \
1500 goto __post; \
1501 } \
1502 \
1503 if (unlikely(!list_empty(&__event_notifier->capture_bytecode_runtime_head))) \
1504 __event_prepare_interpreter_stack__##_name( \
1505 __stackvar.__interpreter_stack_data, \
1506 tp_locvar); \
1507 \
1508 __event_notifier->send_notification(__event_notifier, \
1509 &__lttng_probe_ctx, \
1510 __stackvar.__interpreter_stack_data); \
1511 __post: \
1512 _code_post \
1513 return; \
1514 }
1515
1516 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1517 /*
1518 * Stage 7 of the trace events.
1519 *
1520 * Create event descriptions.
1521 */
1522
1523 /* Named field types must be defined in lttng-types.h */
1524
1525 #include <lttng/events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1526
1527 #ifndef TP_PROBE_CB
1528 #define TP_PROBE_CB(_template) &__event_probe__##_template
1529 #endif
1530
1531 #ifndef TP_EVENT_NOTIFIER_PROBE_CB
1532 #define TP_EVENT_NOTIFIER_PROBE_CB(_template) &__event_notifier_probe__##_template
1533 #endif
1534
1535 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
1536 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
1537 static const struct lttng_event_desc __event_desc___##_map = { \
1538 .fields = __event_fields___##_template, \
1539 .name = #_map, \
1540 .kname = #_name, \
1541 .probe_callback = (void *) TP_PROBE_CB(_template), \
1542 .nr_fields = ARRAY_SIZE(__event_fields___##_template), \
1543 .owner = THIS_MODULE, \
1544 .event_notifier_callback = (void *) TP_EVENT_NOTIFIER_PROBE_CB(_template), \
1545 };
1546
1547 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
1548 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
1549 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map)
1550
1551 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1552
1553 /*
1554 * Stage 8 of the trace events.
1555 *
1556 * Create an array of event description pointers.
1557 */
1558
1559 #include <lttng/events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1560
1561 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS
1562 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map) \
1563 &__event_desc___##_map,
1564
1565 #undef LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP
1566 #define LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(_template, _name, _map, _proto, _args) \
1567 LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS(_template, _name, _map)
1568
1569 #define TP_ID1(_token, _system) _token##_system
1570 #define TP_ID(_token, _system) TP_ID1(_token, _system)
1571
1572 static const struct lttng_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = {
1573 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
1574 };
1575
1576 #undef TP_ID1
1577 #undef TP_ID
1578
1579 /*
1580 * Stage 9 of the trace events.
1581 *
1582 * Create a toplevel descriptor for the whole probe.
1583 */
1584
1585 #define TP_ID1(_token, _system) _token##_system
1586 #define TP_ID(_token, _system) TP_ID1(_token, _system)
1587
1588 /* non-const because list head will be modified when registered. */
1589 static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = {
1590 .provider = __stringify(TRACE_SYSTEM),
1591 .event_desc = TP_ID(__event_desc___, TRACE_SYSTEM),
1592 .nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)),
1593 .head = { NULL, NULL },
1594 .lazy_init_head = { NULL, NULL },
1595 .lazy = 0,
1596 };
1597
1598 #undef TP_ID1
1599 #undef TP_ID
1600
1601 /*
1602 * Stage 10 of the trace events.
1603 *
1604 * Register/unregister probes at module load/unload.
1605 */
1606
1607 #include <lttng/events-reset.h> /* Reset all macros within LTTNG_TRACEPOINT_EVENT */
1608
1609 #define TP_ID1(_token, _system) _token##_system
1610 #define TP_ID(_token, _system) TP_ID1(_token, _system)
1611 #define module_init_eval1(_token, _system) module_init(_token##_system)
1612 #define module_init_eval(_token, _system) module_init_eval1(_token, _system)
1613 #define module_exit_eval1(_token, _system) module_exit(_token##_system)
1614 #define module_exit_eval(_token, _system) module_exit_eval1(_token, _system)
1615
1616 #ifndef TP_MODULE_NOINIT
1617 static int TP_ID(__lttng_events_init__, TRACE_SYSTEM)(void)
1618 {
1619 wrapper_vmalloc_sync_mappings();
1620 return lttng_probe_register(&TP_ID(__probe_desc___, TRACE_SYSTEM));
1621 }
1622
1623 static void TP_ID(__lttng_events_exit__, TRACE_SYSTEM)(void)
1624 {
1625 lttng_probe_unregister(&TP_ID(__probe_desc___, TRACE_SYSTEM));
1626 }
1627
1628 #ifndef TP_MODULE_NOAUTOLOAD
1629 module_init_eval(__lttng_events_init__, TRACE_SYSTEM);
1630 module_exit_eval(__lttng_events_exit__, TRACE_SYSTEM);
1631 #endif
1632
1633 #endif
1634
1635 #undef module_init_eval
1636 #undef module_exit_eval
1637 #undef TP_ID1
1638 #undef TP_ID
1639
1640 #undef TP_PROTO
1641 #undef TP_ARGS
This page took 0.100174 seconds and 4 git commands to generate.