Commit | Line | Data |
---|---|---|
17baffe2 MD |
1 | /* |
2 | * lttng-events.h | |
3 | * | |
4 | * Copyright (C) 2009 Steven Rostedt <rostedt@goodmis.org> | |
886d51a3 | 5 | * Copyright (C) 2009-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
17baffe2 | 6 | * |
886d51a3 MD |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Lesser General Public | |
9 | * License as published by the Free Software Foundation; only | |
10 | * version 2.1 of the License. | |
11 | * | |
12 | * This library is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * Lesser General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU Lesser General Public | |
18 | * License along with this library; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17baffe2 | 20 | */ |
d28686c1 | 21 | #include <linux/uaccess.h> |
d0dd2ecb | 22 | #include <linux/debugfs.h> |
c0edae1d MD |
23 | #include "lttng.h" |
24 | #include "lttng-types.h" | |
7b8ea3a5 | 25 | #include "lttng-probe-user.h" |
b13f3ebe | 26 | #include "../wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */ |
f3bc08c5 | 27 | #include "../wrapper/ringbuffer/frontend_types.h" |
a90917c3 MD |
28 | #include "../lttng-events.h" |
29 | #include "../lttng-tracer-core.h" | |
40652b65 | 30 | |
40652b65 | 31 | /* |
6db3d13b | 32 | * Macro declarations used for all stages. |
40652b65 MD |
33 | */ |
34 | ||
76e4f017 MD |
35 | /* |
36 | * LTTng name mapping macros. LTTng remaps some of the kernel events to | |
37 | * enforce name-spacing. | |
38 | */ | |
39 | #undef TRACE_EVENT_MAP | |
40 | #define TRACE_EVENT_MAP(name, map, proto, args, tstruct, assign, print) \ | |
41 | DECLARE_EVENT_CLASS(map, \ | |
42 | PARAMS(proto), \ | |
43 | PARAMS(args), \ | |
44 | PARAMS(tstruct), \ | |
45 | PARAMS(assign), \ | |
46 | PARAMS(print)) \ | |
47 | DEFINE_EVENT_MAP(map, name, map, PARAMS(proto), PARAMS(args)) | |
48 | ||
49 | #undef TRACE_EVENT_MAP_NOARGS | |
50 | #define TRACE_EVENT_MAP_NOARGS(name, map, tstruct, assign, print) \ | |
51 | DECLARE_EVENT_CLASS_NOARGS(map, \ | |
52 | PARAMS(tstruct), \ | |
53 | PARAMS(assign), \ | |
54 | PARAMS(print)) \ | |
55 | DEFINE_EVENT_MAP_NOARGS(map, name, map) | |
56 | ||
57 | #undef DEFINE_EVENT_PRINT_MAP | |
58 | #define DEFINE_EVENT_PRINT_MAP(template, name, map, proto, args, print) \ | |
59 | DEFINE_EVENT_MAP(template, name, map, PARAMS(proto), PARAMS(args)) | |
60 | ||
61 | /* Callbacks are meaningless to LTTng. */ | |
62 | #undef TRACE_EVENT_FN_MAP | |
63 | #define TRACE_EVENT_FN_MAP(name, map, proto, args, tstruct, \ | |
64 | assign, print, reg, unreg) \ | |
65 | TRACE_EVENT_MAP(name, map, PARAMS(proto), PARAMS(args), \ | |
66 | PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \ | |
67 | ||
68 | #undef TRACE_EVENT_CONDITION_MAP | |
69 | #define TRACE_EVENT_CONDITION_MAP(name, map, proto, args, cond, tstruct, assign, print) \ | |
70 | TRACE_EVENT_MAP(name, map, \ | |
71 | PARAMS(proto), \ | |
72 | PARAMS(args), \ | |
73 | PARAMS(tstruct), \ | |
74 | PARAMS(assign), \ | |
75 | PARAMS(print)) | |
76 | ||
40652b65 MD |
77 | /* |
78 | * DECLARE_EVENT_CLASS can be used to add a generic function | |
79 | * handlers for events. That is, if all events have the same | |
80 | * parameters and just have distinct trace points. | |
81 | * Each tracepoint can be defined with DEFINE_EVENT and that | |
82 | * will map the DECLARE_EVENT_CLASS to the tracepoint. | |
83 | * | |
84 | * TRACE_EVENT is a one to one mapping between tracepoint and template. | |
85 | */ | |
6db3d13b | 86 | |
40652b65 | 87 | #undef TRACE_EVENT |
76e4f017 MD |
88 | #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ |
89 | TRACE_EVENT_MAP(name, name, \ | |
90 | PARAMS(proto), \ | |
91 | PARAMS(args), \ | |
92 | PARAMS(tstruct), \ | |
93 | PARAMS(assign), \ | |
94 | PARAMS(print)) | |
40652b65 | 95 | |
f7bdf4db | 96 | #undef TRACE_EVENT_NOARGS |
76e4f017 MD |
97 | #define TRACE_EVENT_NOARGS(name, tstruct, assign, print) \ |
98 | TRACE_EVENT_MAP_NOARGS(name, name, \ | |
99 | PARAMS(tstruct), \ | |
100 | PARAMS(assign), \ | |
101 | PARAMS(print)) | |
f7bdf4db | 102 | |
6db3d13b MD |
103 | #undef DEFINE_EVENT_PRINT |
104 | #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \ | |
76e4f017 MD |
105 | DEFINE_EVENT_PRINT_MAP(template, name, name, \ |
106 | PARAMS(proto), PARAMS(args), PARAMS(print_)) | |
6db3d13b | 107 | |
6db3d13b MD |
108 | #undef TRACE_EVENT_FN |
109 | #define TRACE_EVENT_FN(name, proto, args, tstruct, \ | |
110 | assign, print, reg, unreg) \ | |
76e4f017 MD |
111 | TRACE_EVENT_FN_MAP(name, name, PARAMS(proto), PARAMS(args), \ |
112 | PARAMS(tstruct), PARAMS(assign), PARAMS(print), \ | |
113 | PARAMS(reg), PARAMS(unreg)) \ | |
114 | ||
115 | #undef DEFINE_EVENT | |
116 | #define DEFINE_EVENT(template, name, proto, args) \ | |
117 | DEFINE_EVENT_MAP(template, name, name, PARAMS(proto), PARAMS(args)) | |
118 | ||
119 | #undef DEFINE_EVENT_NOARGS | |
120 | #define DEFINE_EVENT_NOARGS(template, name) \ | |
121 | DEFINE_EVENT_MAP_NOARGS(template, name, name) | |
122 | ||
123 | #undef TRACE_EVENT_CONDITION | |
124 | #define TRACE_EVENT_CONDITION(name, proto, args, cond, tstruct, assign, print) \ | |
125 | TRACE_EVENT_CONDITION_MAP(name, name, \ | |
126 | PARAMS(proto), \ | |
127 | PARAMS(args), \ | |
128 | PARAMS(cond), \ | |
129 | PARAMS(tstruct), \ | |
130 | PARAMS(assign), \ | |
131 | PARAMS(print)) | |
6db3d13b | 132 | |
f62b389e | 133 | /* |
c099397a | 134 | * Stage 1 of the trace events. |
f62b389e MD |
135 | * |
136 | * Create dummy trace calls for each events, verifying that the LTTng module | |
137 | * TRACE_EVENT headers match the kernel arguments. Will be optimized out by the | |
138 | * compiler. | |
139 | */ | |
140 | ||
141 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ | |
142 | ||
143 | #undef TP_PROTO | |
144 | #define TP_PROTO(args...) args | |
145 | ||
146 | #undef TP_ARGS | |
147 | #define TP_ARGS(args...) args | |
148 | ||
76e4f017 MD |
149 | #undef DEFINE_EVENT_MAP |
150 | #define DEFINE_EVENT_MAP(_template, _name, _map, _proto, _args) \ | |
7eb827f2 | 151 | void trace_##_name(_proto); |
f62b389e | 152 | |
76e4f017 MD |
153 | #undef DEFINE_EVENT_MAP_NOARGS |
154 | #define DEFINE_EVENT_MAP_NOARGS(_template, _name, _map) \ | |
f7bdf4db MD |
155 | void trace_##_name(void *__data); |
156 | ||
f62b389e MD |
157 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
158 | ||
6db3d13b | 159 | /* |
c099397a | 160 | * Stage 2 of the trace events. |
6db3d13b MD |
161 | * |
162 | * Create event field type metadata section. | |
163 | * Each event produce an array of fields. | |
164 | */ | |
165 | ||
166 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ | |
167 | ||
1d12cebd MD |
168 | /* Named field types must be defined in lttng-types.h */ |
169 | ||
d71e6471 MD |
170 | #undef __field_full |
171 | #define __field_full(_type, _item, _order, _base) \ | |
c099397a MD |
172 | { \ |
173 | .name = #_item, \ | |
d71e6471 | 174 | .type = __type_integer(_type, _order, _base, none), \ |
c099397a | 175 | }, |
40652b65 | 176 | |
d71e6471 MD |
177 | #undef __field |
178 | #define __field(_type, _item) \ | |
179 | __field_full(_type, _item, __BYTE_ORDER, 10) | |
180 | ||
40652b65 | 181 | #undef __field_ext |
d71e6471 MD |
182 | #define __field_ext(_type, _item, _filter_type) \ |
183 | __field(_type, _item) | |
40652b65 | 184 | |
6d20e0ae MD |
185 | #undef __field_hex |
186 | #define __field_hex(_type, _item) \ | |
187 | __field_full(_type, _item, __BYTE_ORDER, 16) | |
188 | ||
29021503 MD |
189 | #undef __field_oct |
190 | #define __field_oct(_type, _item) \ | |
191 | __field_full(_type, _item, __BYTE_ORDER, 8) | |
192 | ||
c099397a MD |
193 | #undef __field_network |
194 | #define __field_network(_type, _item) \ | |
d71e6471 MD |
195 | __field_full(_type, _item, __BIG_ENDIAN, 10) |
196 | ||
197 | #undef __field_network_hex | |
198 | #define __field_network_hex(_type, _item) \ | |
199 | __field_full(_type, _item, __BIG_ENDIAN, 16) | |
c099397a | 200 | |
d71e6471 MD |
201 | #undef __array_enc_ext |
202 | #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ | |
299338c8 | 203 | { \ |
c099397a MD |
204 | .name = #_item, \ |
205 | .type = \ | |
206 | { \ | |
299338c8 | 207 | .atype = atype_array, \ |
c099397a MD |
208 | .u.array = \ |
209 | { \ | |
210 | .length = _length, \ | |
d71e6471 | 211 | .elem_type = __type_integer(_type, _order, _base, _encoding), \ |
c099397a | 212 | }, \ |
299338c8 MD |
213 | }, \ |
214 | }, | |
40652b65 | 215 | |
64c796d8 MD |
216 | #undef __array |
217 | #define __array(_type, _item, _length) \ | |
d71e6471 | 218 | __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, none) |
64c796d8 MD |
219 | |
220 | #undef __array_text | |
221 | #define __array_text(_type, _item, _length) \ | |
d71e6471 | 222 | __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, UTF8) |
64c796d8 | 223 | |
d71e6471 MD |
224 | #undef __array_hex |
225 | #define __array_hex(_type, _item, _length) \ | |
226 | __array_enc_ext(_type, _item, _length, __BYTE_ORDER, 16, none) | |
227 | ||
228 | #undef __dynamic_array_enc_ext | |
229 | #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding) \ | |
299338c8 | 230 | { \ |
c099397a MD |
231 | .name = #_item, \ |
232 | .type = \ | |
233 | { \ | |
299338c8 | 234 | .atype = atype_sequence, \ |
c099397a MD |
235 | .u.sequence = \ |
236 | { \ | |
64c796d8 | 237 | .length_type = __type_integer(u32, __BYTE_ORDER, 10, none), \ |
d71e6471 | 238 | .elem_type = __type_integer(_type, _order, _base, _encoding), \ |
c099397a | 239 | }, \ |
299338c8 MD |
240 | }, \ |
241 | }, | |
40652b65 | 242 | |
84da5206 MD |
243 | #undef __dynamic_array_enc_ext_2 |
244 | #define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding) \ | |
245 | __dynamic_array_enc_ext(_type, _item, _length1 + _length2, _order, _base, _encoding) | |
246 | ||
64c796d8 MD |
247 | #undef __dynamic_array |
248 | #define __dynamic_array(_type, _item, _length) \ | |
d71e6471 | 249 | __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, none) |
64c796d8 MD |
250 | |
251 | #undef __dynamic_array_text | |
252 | #define __dynamic_array_text(_type, _item, _length) \ | |
d71e6471 MD |
253 | __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 10, UTF8) |
254 | ||
255 | #undef __dynamic_array_hex | |
256 | #define __dynamic_array_hex(_type, _item, _length) \ | |
257 | __dynamic_array_enc_ext(_type, _item, _length, __BYTE_ORDER, 16, none) | |
64c796d8 | 258 | |
84da5206 MD |
259 | #undef __dynamic_array_text_2 |
260 | #define __dynamic_array_text_2(_type, _item, _length1, _length2) \ | |
261 | __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, __BYTE_ORDER, 10, UTF8) | |
262 | ||
40652b65 | 263 | #undef __string |
1d12cebd | 264 | #define __string(_item, _src) \ |
299338c8 | 265 | { \ |
c099397a MD |
266 | .name = #_item, \ |
267 | .type = \ | |
268 | { \ | |
299338c8 | 269 | .atype = atype_string, \ |
c099397a | 270 | .u.basic.string.encoding = lttng_encode_UTF8, \ |
299338c8 MD |
271 | }, \ |
272 | }, | |
1d12cebd | 273 | |
c6e3f225 MD |
274 | #undef __string_from_user |
275 | #define __string_from_user(_item, _src) \ | |
276 | __string(_item, _src) | |
277 | ||
40652b65 | 278 | #undef TP_STRUCT__entry |
1d12cebd MD |
279 | #define TP_STRUCT__entry(args...) args /* Only one used in this phase */ |
280 | ||
f7bdf4db MD |
281 | #undef DECLARE_EVENT_CLASS_NOARGS |
282 | #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \ | |
0d1d4002 MD |
283 | static const struct lttng_event_field __event_fields___##_name[] = { \ |
284 | _tstruct \ | |
299338c8 MD |
285 | }; |
286 | ||
f7bdf4db MD |
287 | #undef DECLARE_EVENT_CLASS |
288 | #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \ | |
289 | DECLARE_EVENT_CLASS_NOARGS(_name, PARAMS(_tstruct), PARAMS(_assign), \ | |
290 | PARAMS(_print)) | |
291 | ||
299338c8 MD |
292 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
293 | ||
19c57fbf | 294 | /* |
c099397a | 295 | * Stage 3 of the trace events. |
19c57fbf MD |
296 | * |
297 | * Create probe callback prototypes. | |
298 | */ | |
299 | ||
300 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ | |
301 | ||
302 | #undef TP_PROTO | |
303 | #define TP_PROTO(args...) args | |
304 | ||
305 | #undef DECLARE_EVENT_CLASS | |
306 | #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \ | |
307 | static void __event_probe__##_name(void *__data, _proto); | |
308 | ||
f7bdf4db MD |
309 | #undef DECLARE_EVENT_CLASS_NOARGS |
310 | #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \ | |
311 | static void __event_probe__##_name(void *__data); | |
312 | ||
19c57fbf MD |
313 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
314 | ||
299338c8 | 315 | /* |
f7bdf4db | 316 | * Stage 3.9 of the trace events. |
299338c8 | 317 | * |
f7bdf4db | 318 | * Create event descriptions. |
299338c8 MD |
319 | */ |
320 | ||
299338c8 MD |
321 | /* Named field types must be defined in lttng-types.h */ |
322 | ||
6db3d13b | 323 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ |
299338c8 | 324 | |
1ec65de1 MD |
325 | #ifndef TP_PROBE_CB |
326 | #define TP_PROBE_CB(_template) &__event_probe__##_template | |
327 | #endif | |
328 | ||
76e4f017 MD |
329 | #undef DEFINE_EVENT_MAP_NOARGS |
330 | #define DEFINE_EVENT_MAP_NOARGS(_template, _name, _map) \ | |
331 | static const struct lttng_event_desc __event_desc___##_map = { \ | |
f7bdf4db | 332 | .fields = __event_fields___##_template, \ |
76e4f017 | 333 | .name = #_map, \ |
a26a7e4f | 334 | .kname = #_name, \ |
f7bdf4db MD |
335 | .probe_callback = (void *) TP_PROBE_CB(_template), \ |
336 | .nr_fields = ARRAY_SIZE(__event_fields___##_template), \ | |
337 | .owner = THIS_MODULE, \ | |
338 | }; | |
339 | ||
76e4f017 MD |
340 | #undef DEFINE_EVENT_MAP |
341 | #define DEFINE_EVENT_MAP(_template, _name, _map, _proto, _args) \ | |
342 | DEFINE_EVENT_MAP_NOARGS(_template, _name, _map) | |
f7bdf4db MD |
343 | |
344 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | |
345 | ||
346 | ||
347 | /* | |
348 | * Stage 4 of the trace events. | |
349 | * | |
350 | * Create an array of event description pointers. | |
351 | */ | |
352 | ||
353 | /* Named field types must be defined in lttng-types.h */ | |
354 | ||
355 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ | |
356 | ||
76e4f017 MD |
357 | #undef DEFINE_EVENT_MAP_NOARGS |
358 | #define DEFINE_EVENT_MAP_NOARGS(_template, _name, _map) \ | |
359 | &__event_desc___##_map, | |
f7bdf4db | 360 | |
76e4f017 MD |
361 | #undef DEFINE_EVENT_MAP |
362 | #define DEFINE_EVENT_MAP(_template, _name, _map, _proto, _args) \ | |
363 | DEFINE_EVENT_MAP_NOARGS(_template, _name, _map) | |
40652b65 | 364 | |
d0dd2ecb MD |
365 | #define TP_ID1(_token, _system) _token##_system |
366 | #define TP_ID(_token, _system) TP_ID1(_token, _system) | |
40652b65 | 367 | |
f7bdf4db | 368 | static const struct lttng_event_desc *TP_ID(__event_desc___, TRACE_SYSTEM)[] = { |
40652b65 | 369 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
299338c8 MD |
370 | }; |
371 | ||
d0dd2ecb MD |
372 | #undef TP_ID1 |
373 | #undef TP_ID | |
374 | ||
85a9ca7f MD |
375 | |
376 | /* | |
c099397a | 377 | * Stage 5 of the trace events. |
85a9ca7f MD |
378 | * |
379 | * Create a toplevel descriptor for the whole probe. | |
380 | */ | |
381 | ||
382 | #define TP_ID1(_token, _system) _token##_system | |
383 | #define TP_ID(_token, _system) TP_ID1(_token, _system) | |
384 | ||
385 | /* non-const because list head will be modified when registered. */ | |
25631135 | 386 | static __used struct lttng_probe_desc TP_ID(__probe_desc___, TRACE_SYSTEM) = { |
85a9ca7f MD |
387 | .event_desc = TP_ID(__event_desc___, TRACE_SYSTEM), |
388 | .nr_events = ARRAY_SIZE(TP_ID(__event_desc___, TRACE_SYSTEM)), | |
389 | }; | |
390 | ||
391 | #undef TP_ID1 | |
392 | #undef TP_ID | |
393 | ||
d0dd2ecb | 394 | /* |
c099397a | 395 | * Stage 6 of the trace events. |
40652b65 MD |
396 | * |
397 | * Create static inline function that calculates event size. | |
398 | */ | |
399 | ||
6db3d13b | 400 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ |
40652b65 | 401 | |
6db3d13b MD |
402 | /* Named field types must be defined in lttng-types.h */ |
403 | ||
d71e6471 MD |
404 | #undef __field_full |
405 | #define __field_full(_type, _item, _order, _base) \ | |
a90917c3 | 406 | __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ |
0d1d4002 | 407 | __event_len += sizeof(_type); |
6db3d13b | 408 | |
d71e6471 MD |
409 | #undef __array_enc_ext |
410 | #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) \ | |
a90917c3 | 411 | __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ |
0d1d4002 | 412 | __event_len += sizeof(_type) * (_length); |
6db3d13b | 413 | |
d71e6471 MD |
414 | #undef __dynamic_array_enc_ext |
415 | #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ | |
a90917c3 | 416 | __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(u32)); \ |
85a80742 | 417 | __event_len += sizeof(u32); \ |
a90917c3 | 418 | __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ |
41b59694 MD |
419 | __dynamic_len[__dynamic_len_idx] = (_length); \ |
420 | __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ | |
421 | __dynamic_len_idx++; | |
6db3d13b | 422 | |
84da5206 MD |
423 | #undef __dynamic_array_enc_ext_2 |
424 | #define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding)\ | |
425 | __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(u32)); \ | |
426 | __event_len += sizeof(u32); \ | |
427 | __event_len += lib_ring_buffer_align(__event_len, lttng_alignof(_type)); \ | |
428 | __dynamic_len[__dynamic_len_idx] = (_length1); \ | |
429 | __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ | |
430 | __dynamic_len_idx++; \ | |
431 | __dynamic_len[__dynamic_len_idx] = (_length2); \ | |
432 | __event_len += sizeof(_type) * __dynamic_len[__dynamic_len_idx]; \ | |
433 | __dynamic_len_idx++; | |
434 | ||
6db3d13b | 435 | #undef __string |
85a80742 | 436 | #define __string(_item, _src) \ |
0d1d4002 MD |
437 | __event_len += __dynamic_len[__dynamic_len_idx++] = strlen(_src) + 1; |
438 | ||
d0255731 | 439 | /* |
786b8312 MD |
440 | * strlen_user includes \0. If returns 0, it faulted, so we set size to |
441 | * 1 (\0 only). | |
d0255731 | 442 | */ |
c6e3f225 MD |
443 | #undef __string_from_user |
444 | #define __string_from_user(_item, _src) \ | |
786b8312 | 445 | __event_len += __dynamic_len[__dynamic_len_idx++] = \ |
7b8ea3a5 | 446 | max_t(size_t, lttng_strlen_user_inatomic(_src), 1); |
c6e3f225 | 447 | |
0d1d4002 MD |
448 | #undef TP_PROTO |
449 | #define TP_PROTO(args...) args | |
6db3d13b MD |
450 | |
451 | #undef TP_STRUCT__entry | |
0d1d4002 | 452 | #define TP_STRUCT__entry(args...) args |
6db3d13b MD |
453 | |
454 | #undef DECLARE_EVENT_CLASS | |
0d1d4002 MD |
455 | #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \ |
456 | static inline size_t __event_get_size__##_name(size_t *__dynamic_len, _proto) \ | |
457 | { \ | |
458 | size_t __event_len = 0; \ | |
d3de7f14 MD |
459 | unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \ |
460 | \ | |
461 | _tstruct \ | |
462 | return __event_len; \ | |
463 | } | |
464 | ||
465 | #undef DECLARE_EVENT_CLASS_NOARGS | |
466 | #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \ | |
467 | static inline size_t __event_get_size__##_name(size_t *__dynamic_len) \ | |
468 | { \ | |
469 | size_t __event_len = 0; \ | |
470 | unsigned int __dynamic_len_idx __attribute__((unused)) = 0; \ | |
0d1d4002 | 471 | \ |
0d1d4002 MD |
472 | _tstruct \ |
473 | return __event_len; \ | |
6db3d13b | 474 | } |
40652b65 MD |
475 | |
476 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) | |
477 | ||
478 | /* | |
c099397a | 479 | * Stage 7 of the trace events. |
e763dbf5 MD |
480 | * |
481 | * Create static inline function that calculates event payload alignment. | |
482 | */ | |
483 | ||
484 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ | |
485 | ||
486 | /* Named field types must be defined in lttng-types.h */ | |
487 | ||
d71e6471 MD |
488 | #undef __field_full |
489 | #define __field_full(_type, _item, _order, _base) \ | |
a90917c3 | 490 | __event_align = max_t(size_t, __event_align, lttng_alignof(_type)); |
e763dbf5 | 491 | |
d71e6471 MD |
492 | #undef __array_enc_ext |
493 | #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) \ | |
a90917c3 | 494 | __event_align = max_t(size_t, __event_align, lttng_alignof(_type)); |
e763dbf5 | 495 | |
d71e6471 MD |
496 | #undef __dynamic_array_enc_ext |
497 | #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ | |
a90917c3 MD |
498 | __event_align = max_t(size_t, __event_align, lttng_alignof(u32)); \ |
499 | __event_align = max_t(size_t, __event_align, lttng_alignof(_type)); | |
e763dbf5 | 500 | |
84da5206 MD |
501 | #undef __dynamic_array_enc_ext_2 |
502 | #define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding)\ | |
503 | __dynamic_array_enc_ext(_type, _item, _length1 + _length2, _order, _base, _encoding) | |
504 | ||
e763dbf5 MD |
505 | #undef __string |
506 | #define __string(_item, _src) | |
507 | ||
c6e3f225 MD |
508 | #undef __string_from_user |
509 | #define __string_from_user(_item, _src) | |
510 | ||
e763dbf5 MD |
511 | #undef TP_PROTO |
512 | #define TP_PROTO(args...) args | |
513 | ||
514 | #undef TP_STRUCT__entry | |
515 | #define TP_STRUCT__entry(args...) args | |
516 | ||
517 | #undef DECLARE_EVENT_CLASS | |
518 | #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \ | |
519 | static inline size_t __event_get_align__##_name(_proto) \ | |
520 | { \ | |
521 | size_t __event_align = 1; \ | |
522 | _tstruct \ | |
523 | return __event_align; \ | |
524 | } | |
525 | ||
d3de7f14 MD |
526 | #undef DECLARE_EVENT_CLASS_NOARGS |
527 | #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \ | |
528 | static inline size_t __event_get_align__##_name(void) \ | |
529 | { \ | |
530 | size_t __event_align = 1; \ | |
531 | _tstruct \ | |
532 | return __event_align; \ | |
533 | } | |
534 | ||
e763dbf5 MD |
535 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
536 | ||
537 | ||
e763dbf5 | 538 | /* |
c099397a | 539 | * Stage 8 of the trace events. |
40652b65 | 540 | * |
3c4ffab9 MD |
541 | * Create structure declaration that allows the "assign" macros to access the |
542 | * field types. | |
543 | */ | |
544 | ||
545 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ | |
546 | ||
547 | /* Named field types must be defined in lttng-types.h */ | |
548 | ||
d71e6471 MD |
549 | #undef __field_full |
550 | #define __field_full(_type, _item, _order, _base) _type _item; | |
3c4ffab9 | 551 | |
d71e6471 MD |
552 | #undef __array_enc_ext |
553 | #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding) \ | |
554 | _type _item; | |
64c796d8 | 555 | |
d71e6471 MD |
556 | #undef __dynamic_array_enc_ext |
557 | #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ | |
558 | _type _item; | |
64c796d8 | 559 | |
84da5206 MD |
560 | #undef __dynamic_array_enc_ext_2 |
561 | #define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding)\ | |
562 | __dynamic_array_enc_ext(_type, _item, _length1 + _length2, _order, _base, _encoding) | |
563 | ||
3c4ffab9 | 564 | #undef __string |
c6e3f225 MD |
565 | #define __string(_item, _src) char _item; |
566 | ||
567 | #undef __string_from_user | |
568 | #define __string_from_user(_item, _src) \ | |
569 | __string(_item, _src) | |
3c4ffab9 MD |
570 | |
571 | #undef TP_STRUCT__entry | |
572 | #define TP_STRUCT__entry(args...) args | |
573 | ||
d3de7f14 MD |
574 | #undef DECLARE_EVENT_CLASS_NOARGS |
575 | #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \ | |
3c4ffab9 MD |
576 | struct __event_typemap__##_name { \ |
577 | _tstruct \ | |
578 | }; | |
579 | ||
d3de7f14 MD |
580 | #undef DECLARE_EVENT_CLASS |
581 | #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \ | |
582 | DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) | |
583 | ||
3c4ffab9 MD |
584 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
585 | ||
586 | ||
587 | /* | |
c099397a | 588 | * Stage 9 of the trace events. |
3c4ffab9 | 589 | * |
40652b65 MD |
590 | * Create the probe function : call even size calculation and write event data |
591 | * into the buffer. | |
e763dbf5 | 592 | * |
67e5e60c MD |
593 | * We use both the field and assignment macros to write the fields in the order |
594 | * defined in the field declaration. The field declarations control the | |
595 | * execution order, jumping to the appropriate assignment block. | |
40652b65 MD |
596 | */ |
597 | ||
e763dbf5 MD |
598 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ |
599 | ||
d71e6471 MD |
600 | #undef __field_full |
601 | #define __field_full(_type, _item, _order, _base) \ | |
e763dbf5 MD |
602 | goto __assign_##_item; \ |
603 | __end_field_##_item: | |
40652b65 | 604 | |
d71e6471 MD |
605 | #undef __array_enc_ext |
606 | #define __array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ | |
e763dbf5 MD |
607 | goto __assign_##_item; \ |
608 | __end_field_##_item: | |
40652b65 | 609 | |
d71e6471 MD |
610 | #undef __dynamic_array_enc_ext |
611 | #define __dynamic_array_enc_ext(_type, _item, _length, _order, _base, _encoding)\ | |
e763dbf5 MD |
612 | goto __assign_##_item##_1; \ |
613 | __end_field_##_item##_1: \ | |
e763dbf5 MD |
614 | goto __assign_##_item##_2; \ |
615 | __end_field_##_item##_2: | |
40652b65 | 616 | |
84da5206 MD |
617 | #undef __dynamic_array_enc_ext_2 |
618 | #define __dynamic_array_enc_ext_2(_type, _item, _length1, _length2, _order, _base, _encoding)\ | |
619 | goto __assign_##_item##_1; \ | |
620 | __end_field_##_item##_1: \ | |
621 | goto __assign_##_item##_2; \ | |
622 | __end_field_##_item##_2: \ | |
623 | goto __assign_##_item##_3; \ | |
624 | __end_field_##_item##_3: | |
625 | ||
e763dbf5 MD |
626 | #undef __string |
627 | #define __string(_item, _src) \ | |
628 | goto __assign_##_item; \ | |
629 | __end_field_##_item: | |
630 | ||
c6e3f225 MD |
631 | #undef __string_from_user |
632 | #define __string_from_user(_item, _src) \ | |
633 | __string(_item, _src) | |
634 | ||
e763dbf5 MD |
635 | /* |
636 | * Macros mapping tp_assign() to "=", tp_memcpy() to memcpy() and tp_strcpy() to | |
637 | * strcpy(). | |
638 | */ | |
639 | #undef tp_assign | |
640 | #define tp_assign(dest, src) \ | |
641 | __assign_##dest: \ | |
642 | { \ | |
3c4ffab9 | 643 | __typeof__(__typemap.dest) __tmp = (src); \ |
a90917c3 | 644 | lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__tmp)); \ |
aaa4004a | 645 | __chan->ops->event_write(&__ctx, &__tmp, sizeof(__tmp));\ |
e763dbf5 MD |
646 | } \ |
647 | goto __end_field_##dest; | |
648 | ||
d9a7cf03 FG |
649 | /* fixed length array memcpy */ |
650 | #undef tp_memcpy_gen | |
651 | #define tp_memcpy_gen(write_ops, dest, src, len) \ | |
e763dbf5 | 652 | __assign_##dest: \ |
d793d5e1 MD |
653 | if (0) \ |
654 | (void) __typemap.dest; \ | |
a90917c3 | 655 | lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ |
d9a7cf03 | 656 | __chan->ops->write_ops(&__ctx, src, len); \ |
e763dbf5 MD |
657 | goto __end_field_##dest; |
658 | ||
d9a7cf03 FG |
659 | #undef tp_memcpy |
660 | #define tp_memcpy(dest, src, len) \ | |
661 | tp_memcpy_gen(event_write, dest, src, len) | |
662 | ||
663 | #undef tp_memcpy_from_user | |
664 | #define tp_memcpy_from_user(dest, src, len) \ | |
665 | tp_memcpy_gen(event_write_from_user, dest, src, len) | |
666 | ||
667 | /* variable length sequence memcpy */ | |
668 | #undef tp_memcpy_dyn_gen | |
669 | #define tp_memcpy_dyn_gen(write_ops, dest, src) \ | |
e763dbf5 MD |
670 | __assign_##dest##_1: \ |
671 | { \ | |
41b59694 | 672 | u32 __tmpl = __dynamic_len[__dynamic_len_idx]; \ |
a90917c3 | 673 | lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(u32)); \ |
aaa4004a | 674 | __chan->ops->event_write(&__ctx, &__tmpl, sizeof(u32)); \ |
e763dbf5 MD |
675 | } \ |
676 | goto __end_field_##dest##_1; \ | |
677 | __assign_##dest##_2: \ | |
a90917c3 | 678 | lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ |
d9a7cf03 | 679 | __chan->ops->write_ops(&__ctx, src, \ |
41b59694 | 680 | sizeof(__typemap.dest) * __get_dynamic_array_len(dest));\ |
e763dbf5 | 681 | goto __end_field_##dest##_2; |
58aa5d24 | 682 | |
84da5206 MD |
683 | #undef tp_memcpy_dyn_gen_2 |
684 | #define tp_memcpy_dyn_gen_2(write_ops, dest, src1, src2) \ | |
685 | __assign_##dest##_1: \ | |
686 | { \ | |
687 | u32 __tmpl = __dynamic_len[__dynamic_len_idx] \ | |
688 | + __dynamic_len[__dynamic_len_idx + 1]; \ | |
689 | lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(u32)); \ | |
690 | __chan->ops->event_write(&__ctx, &__tmpl, sizeof(u32)); \ | |
691 | } \ | |
692 | goto __end_field_##dest##_1; \ | |
693 | __assign_##dest##_2: \ | |
694 | lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ | |
695 | __chan->ops->write_ops(&__ctx, src1, \ | |
696 | sizeof(__typemap.dest) * __get_dynamic_array_len(dest));\ | |
697 | goto __end_field_##dest##_2; \ | |
698 | __assign_##dest##_3: \ | |
699 | __chan->ops->write_ops(&__ctx, src2, \ | |
700 | sizeof(__typemap.dest) * __get_dynamic_array_len(dest));\ | |
701 | goto __end_field_##dest##_3; | |
702 | ||
d9a7cf03 FG |
703 | #undef tp_memcpy_dyn |
704 | #define tp_memcpy_dyn(dest, src) \ | |
705 | tp_memcpy_dyn_gen(event_write, dest, src) | |
706 | ||
84da5206 MD |
707 | #undef tp_memcpy_dyn_2 |
708 | #define tp_memcpy_dyn_2(dest, src1, src2) \ | |
709 | tp_memcpy_dyn_gen_2(event_write, dest, src1, src2) | |
710 | ||
d9a7cf03 FG |
711 | #undef tp_memcpy_dyn_from_user |
712 | #define tp_memcpy_dyn_from_user(dest, src) \ | |
713 | tp_memcpy_dyn_gen(event_write_from_user, dest, src) | |
58aa5d24 | 714 | |
d0255731 | 715 | /* |
786b8312 | 716 | * The string length including the final \0. |
d0255731 | 717 | */ |
4ea00e4f | 718 | #undef tp_copy_string_from_user |
58aa5d24 | 719 | #define tp_copy_string_from_user(dest, src) \ |
16f78f3a MD |
720 | __assign_##dest: \ |
721 | if (0) \ | |
722 | (void) __typemap.dest; \ | |
723 | lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ | |
724 | __chan->ops->event_strcpy_from_user(&__ctx, src, \ | |
725 | __get_dynamic_array_len(dest)); \ | |
4ea00e4f | 726 | goto __end_field_##dest; |
16f78f3a | 727 | |
e763dbf5 MD |
728 | #undef tp_strcpy |
729 | #define tp_strcpy(dest, src) \ | |
16f78f3a MD |
730 | __assign_##dest: \ |
731 | if (0) \ | |
732 | (void) __typemap.dest; \ | |
733 | lib_ring_buffer_align_ctx(&__ctx, lttng_alignof(__typemap.dest)); \ | |
734 | __chan->ops->event_strcpy(&__ctx, src, __get_dynamic_array_len(dest)); \ | |
735 | goto __end_field_##dest; | |
40652b65 | 736 | |
e763dbf5 MD |
737 | /* Named field types must be defined in lttng-types.h */ |
738 | ||
739 | #undef __get_str | |
740 | #define __get_str(field) field | |
741 | ||
742 | #undef __get_dynamic_array | |
743 | #define __get_dynamic_array(field) field | |
744 | ||
745 | /* Beware: this get len actually consumes the len value */ | |
746 | #undef __get_dynamic_array_len | |
747 | #define __get_dynamic_array_len(field) __dynamic_len[__dynamic_len_idx++] | |
748 | ||
749 | #undef TP_PROTO | |
750 | #define TP_PROTO(args...) args | |
751 | ||
752 | #undef TP_ARGS | |
753 | #define TP_ARGS(args...) args | |
754 | ||
755 | #undef TP_STRUCT__entry | |
756 | #define TP_STRUCT__entry(args...) args | |
757 | ||
758 | #undef TP_fast_assign | |
759 | #define TP_fast_assign(args...) args | |
760 | ||
c337ddc2 MD |
761 | /* |
762 | * For state dump, check that "session" argument (mandatory) matches the | |
763 | * session this event belongs to. Ensures that we write state dump data only | |
764 | * into the started session, not into all sessions. | |
765 | */ | |
766 | #ifdef TP_SESSION_CHECK | |
767 | #define _TP_SESSION_CHECK(session, csession) (session == csession) | |
768 | #else /* TP_SESSION_CHECK */ | |
769 | #define _TP_SESSION_CHECK(session, csession) 1 | |
770 | #endif /* TP_SESSION_CHECK */ | |
771 | ||
f9771d39 MD |
772 | /* |
773 | * __dynamic_len array length is twice the number of fields due to | |
774 | * __dynamic_array_enc_ext_2() and tp_memcpy_dyn_2(), which are the | |
775 | * worse case, needing 2 entries per field. | |
776 | */ | |
e763dbf5 MD |
777 | #undef DECLARE_EVENT_CLASS |
778 | #define DECLARE_EVENT_CLASS(_name, _proto, _args, _tstruct, _assign, _print) \ | |
779 | static void __event_probe__##_name(void *__data, _proto) \ | |
780 | { \ | |
a90917c3 MD |
781 | struct lttng_event *__event = __data; \ |
782 | struct lttng_channel *__chan = __event->chan; \ | |
aaa4004a | 783 | struct lib_ring_buffer_ctx __ctx; \ |
e763dbf5 | 784 | size_t __event_len, __event_align; \ |
d3de7f14 MD |
785 | size_t __dynamic_len_idx __attribute__((unused)) = 0; \ |
786 | size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)] __attribute__((unused)); \ | |
787 | struct __event_typemap__##_name __typemap __attribute__((unused)); \ | |
e763dbf5 MD |
788 | int __ret; \ |
789 | \ | |
c337ddc2 MD |
790 | if (!_TP_SESSION_CHECK(session, __chan->session)) \ |
791 | return; \ | |
e64957da MD |
792 | if (unlikely(!ACCESS_ONCE(__chan->session->active))) \ |
793 | return; \ | |
794 | if (unlikely(!ACCESS_ONCE(__chan->enabled))) \ | |
795 | return; \ | |
796 | if (unlikely(!ACCESS_ONCE(__event->enabled))) \ | |
52fc2e1f | 797 | return; \ |
e763dbf5 MD |
798 | __event_len = __event_get_size__##_name(__dynamic_len, _args); \ |
799 | __event_align = __event_get_align__##_name(_args); \ | |
aaa4004a | 800 | lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \ |
e763dbf5 | 801 | __event_align, -1); \ |
aaa4004a | 802 | __ret = __chan->ops->event_reserve(&__ctx, __event->id); \ |
e763dbf5 MD |
803 | if (__ret < 0) \ |
804 | return; \ | |
805 | /* Control code (field ordering) */ \ | |
806 | _tstruct \ | |
aaa4004a | 807 | __chan->ops->event_commit(&__ctx); \ |
e763dbf5 MD |
808 | return; \ |
809 | /* Copy code, steered by control code */ \ | |
810 | _assign \ | |
811 | } | |
812 | ||
f7bdf4db MD |
813 | #undef DECLARE_EVENT_CLASS_NOARGS |
814 | #define DECLARE_EVENT_CLASS_NOARGS(_name, _tstruct, _assign, _print) \ | |
815 | static void __event_probe__##_name(void *__data) \ | |
816 | { \ | |
a90917c3 MD |
817 | struct lttng_event *__event = __data; \ |
818 | struct lttng_channel *__chan = __event->chan; \ | |
f7bdf4db MD |
819 | struct lib_ring_buffer_ctx __ctx; \ |
820 | size_t __event_len, __event_align; \ | |
d3de7f14 MD |
821 | size_t __dynamic_len_idx __attribute__((unused)) = 0; \ |
822 | size_t __dynamic_len[2 * ARRAY_SIZE(__event_fields___##_name)] __attribute__((unused)); \ | |
823 | struct __event_typemap__##_name __typemap __attribute__((unused)); \ | |
f7bdf4db MD |
824 | int __ret; \ |
825 | \ | |
c337ddc2 MD |
826 | if (!_TP_SESSION_CHECK(session, __chan->session)) \ |
827 | return; \ | |
f7bdf4db MD |
828 | if (unlikely(!ACCESS_ONCE(__chan->session->active))) \ |
829 | return; \ | |
830 | if (unlikely(!ACCESS_ONCE(__chan->enabled))) \ | |
831 | return; \ | |
832 | if (unlikely(!ACCESS_ONCE(__event->enabled))) \ | |
833 | return; \ | |
d3de7f14 MD |
834 | __event_len = __event_get_size__##_name(__dynamic_len); \ |
835 | __event_align = __event_get_align__##_name(); \ | |
f7bdf4db MD |
836 | lib_ring_buffer_ctx_init(&__ctx, __chan->chan, __event, __event_len, \ |
837 | __event_align, -1); \ | |
838 | __ret = __chan->ops->event_reserve(&__ctx, __event->id); \ | |
839 | if (__ret < 0) \ | |
840 | return; \ | |
841 | /* Control code (field ordering) */ \ | |
842 | _tstruct \ | |
843 | __chan->ops->event_commit(&__ctx); \ | |
844 | return; \ | |
845 | /* Copy code, steered by control code */ \ | |
846 | _assign \ | |
847 | } | |
848 | ||
e763dbf5 MD |
849 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
850 | ||
3afe7aac | 851 | /* |
c099397a | 852 | * Stage 10 of the trace events. |
3afe7aac MD |
853 | * |
854 | * Register/unregister probes at module load/unload. | |
855 | */ | |
856 | ||
857 | #include "lttng-events-reset.h" /* Reset all macros within TRACE_EVENT */ | |
858 | ||
859 | #define TP_ID1(_token, _system) _token##_system | |
860 | #define TP_ID(_token, _system) TP_ID1(_token, _system) | |
861 | #define module_init_eval1(_token, _system) module_init(_token##_system) | |
862 | #define module_init_eval(_token, _system) module_init_eval1(_token, _system) | |
863 | #define module_exit_eval1(_token, _system) module_exit(_token##_system) | |
864 | #define module_exit_eval(_token, _system) module_exit_eval1(_token, _system) | |
865 | ||
2655f9ad | 866 | #ifndef TP_MODULE_NOINIT |
3afe7aac MD |
867 | static int TP_ID(__lttng_events_init__, TRACE_SYSTEM)(void) |
868 | { | |
6d2a620c | 869 | wrapper_vmalloc_sync_all(); |
a90917c3 | 870 | return lttng_probe_register(&TP_ID(__probe_desc___, TRACE_SYSTEM)); |
3afe7aac MD |
871 | } |
872 | ||
3afe7aac MD |
873 | static void TP_ID(__lttng_events_exit__, TRACE_SYSTEM)(void) |
874 | { | |
a90917c3 | 875 | lttng_probe_unregister(&TP_ID(__probe_desc___, TRACE_SYSTEM)); |
3afe7aac MD |
876 | } |
877 | ||
2655f9ad MD |
878 | #ifndef TP_MODULE_NOAUTOLOAD |
879 | module_init_eval(__lttng_events_init__, TRACE_SYSTEM); | |
3afe7aac | 880 | module_exit_eval(__lttng_events_exit__, TRACE_SYSTEM); |
259b6cb3 | 881 | #endif |
3afe7aac | 882 | |
2655f9ad MD |
883 | #endif |
884 | ||
3afe7aac MD |
885 | #undef module_init_eval |
886 | #undef module_exit_eval | |
887 | #undef TP_ID1 | |
888 | #undef TP_ID | |
177b3692 MD |
889 | |
890 | #undef TP_PROTO | |
891 | #undef TP_ARGS | |
892 | #undef TRACE_EVENT_FLAGS |