Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) |
9f36eaed | 2 | * |
2df37e95 | 3 | * lttng/events.h |
4e3c1b9b | 4 | * |
4e3c1b9b | 5 | * Holds LTTng per-session event registry. |
17baffe2 | 6 | * |
886d51a3 | 7 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
4e3c1b9b MD |
8 | */ |
9 | ||
9f36eaed MJ |
10 | #ifndef _LTTNG_EVENTS_H |
11 | #define _LTTNG_EVENTS_H | |
12 | ||
5f4c791e | 13 | #include <lttng/kernel-version.h> |
4e3c1b9b | 14 | #include <linux/list.h> |
d6d808f3 | 15 | #include <linux/kprobes.h> |
d83004aa | 16 | #include <linux/kref.h> |
41f229dc | 17 | #include <linux/uuid.h> |
754d534a | 18 | #include <linux/irq_work.h> |
149b9a9d | 19 | #include <wrapper/uprobes.h> |
2df37e95 MD |
20 | #include <lttng/cpuhotplug.h> |
21 | #include <lttng/tracer.h> | |
22 | #include <lttng/abi.h> | |
23 | #include <lttng/abi-old.h> | |
24 | #include <lttng/endian.h> | |
4e3c1b9b | 25 | |
e97dc605 | 26 | #define lttng_is_signed_type(type) (((type) -1) < (type) 1) |
9e7e4892 | 27 | |
a90917c3 MD |
28 | struct lttng_channel; |
29 | struct lttng_session; | |
d83004aa | 30 | struct lttng_metadata_cache; |
1c25284c | 31 | struct lib_ring_buffer_ctx; |
ba1f5986 | 32 | struct perf_event; |
833ad6a0 | 33 | struct perf_event_attr; |
3b731ab1 | 34 | struct lib_ring_buffer_config; |
4e3c1b9b | 35 | |
c0edae1d MD |
36 | /* Type description */ |
37 | ||
12bb2edb MD |
38 | enum lttng_kernel_type { |
39 | lttng_kernel_type_integer, | |
40 | lttng_kernel_type_string, | |
437d5aa5 MD |
41 | lttng_kernel_type_enum, |
42 | lttng_kernel_type_array, | |
43 | lttng_kernel_type_sequence, | |
44 | lttng_kernel_type_struct, | |
45 | lttng_kernel_type_variant, | |
12bb2edb | 46 | NR_LTTNG_KERNEL_TYPES, |
c0edae1d MD |
47 | }; |
48 | ||
28cbcb59 MD |
49 | enum lttng_kernel_string_encoding { |
50 | lttng_kernel_string_encoding_none = 0, | |
51 | lttng_kernel_string_encoding_UTF8 = 1, | |
52 | lttng_kernel_string_encoding_ASCII = 2, | |
53 | NR_LTTNG_KERNEL_STRING_ENCODING, | |
c0edae1d MD |
54 | }; |
55 | ||
d83004aa JD |
56 | enum channel_type { |
57 | PER_CPU_CHANNEL, | |
58 | METADATA_CHANNEL, | |
59 | }; | |
60 | ||
a28cc520 | 61 | struct lttng_kernel_enum_value { |
141ddf28 MD |
62 | unsigned long long value; |
63 | unsigned int signedness:1; | |
64 | }; | |
65 | ||
a28cc520 MD |
66 | struct lttng_kernel_enum_entry { |
67 | struct lttng_kernel_enum_value start, end; /* start and end are inclusive */ | |
c0edae1d | 68 | const char *string; |
08ad1061 PP |
69 | struct { |
70 | unsigned int is_auto:1; | |
71 | } options; | |
c0edae1d MD |
72 | }; |
73 | ||
437d5aa5 MD |
74 | /* |
75 | * struct lttng_kernel_type_common is fixed-size. Its children inherits | |
76 | * from it by embedding struct lttng_kernel_type_common as its first field. | |
77 | */ | |
78 | struct lttng_kernel_type_common { | |
79 | enum lttng_kernel_type type; | |
80 | }; | |
81 | ||
82 | struct lttng_kernel_type_integer { | |
83 | struct lttng_kernel_type_common parent; | |
c099397a MD |
84 | unsigned int size; /* in bits */ |
85 | unsigned short alignment; /* in bits */ | |
9cccf98a MD |
86 | unsigned int signedness:1, |
87 | reverse_byte_order:1; | |
e0a7a7c4 | 88 | unsigned int base; /* 2, 8, 10, 16, for pretty print */ |
437d5aa5 MD |
89 | }; |
90 | ||
91 | struct lttng_kernel_type_string { | |
92 | struct lttng_kernel_type_common parent; | |
28cbcb59 | 93 | enum lttng_kernel_string_encoding encoding; |
c099397a MD |
94 | }; |
95 | ||
437d5aa5 MD |
96 | struct lttng_kernel_type_enum { |
97 | struct lttng_kernel_type_common parent; | |
98 | const struct lttng_kernel_enum_desc *desc; /* Enumeration mapping */ | |
99 | const struct lttng_kernel_type_common *container_type; | |
100 | }; | |
101 | ||
102 | struct lttng_kernel_type_array { | |
103 | struct lttng_kernel_type_common parent; | |
104 | const struct lttng_kernel_type_common *elem_type; | |
105 | unsigned int length; /* Num. elems. */ | |
106 | unsigned int alignment; | |
107 | enum lttng_kernel_string_encoding encoding; | |
108 | }; | |
109 | ||
110 | struct lttng_kernel_type_sequence { | |
111 | struct lttng_kernel_type_common parent; | |
112 | const char *length_name; /* Length field name. */ | |
113 | const struct lttng_kernel_type_common *elem_type; | |
114 | unsigned int alignment; /* Alignment before elements. */ | |
115 | enum lttng_kernel_string_encoding encoding; | |
116 | }; | |
117 | ||
118 | struct lttng_kernel_type_struct { | |
119 | struct lttng_kernel_type_common parent; | |
120 | unsigned int nr_fields; | |
121 | const struct lttng_kernel_event_field **fields; /* Array of pointers to fields. */ | |
122 | unsigned int alignment; | |
123 | }; | |
124 | ||
125 | struct lttng_kernel_type_variant { | |
126 | struct lttng_kernel_type_common parent; | |
127 | const char *tag_name; | |
128 | const struct lttng_kernel_event_field **choices; /* Array of pointers to fields. */ | |
129 | unsigned int nr_choices; | |
130 | unsigned int alignment; | |
c099397a MD |
131 | }; |
132 | ||
d96a4a7a | 133 | struct lttng_kernel_enum_desc { |
c099397a | 134 | const char *name; |
437d5aa5 | 135 | const struct lttng_kernel_enum_entry **entries; |
141ddf28 | 136 | unsigned int nr_entries; |
c099397a | 137 | }; |
c0edae1d MD |
138 | |
139 | /* Event field description */ | |
140 | ||
437d5aa5 | 141 | struct lttng_kernel_event_field { |
c0edae1d | 142 | const char *name; |
437d5aa5 | 143 | const struct lttng_kernel_type_common *type; |
f127e61e | 144 | unsigned int nowrite:1, /* do not write into trace */ |
ceabb767 MD |
145 | user:1, /* fetch from user-space */ |
146 | nofilter:1; /* do not consider for filter */ | |
c0edae1d MD |
147 | }; |
148 | ||
437d5aa5 MD |
149 | #define lttng_kernel_static_type_integer(_size, _alignment, _signedness, _byte_order, _base) \ |
150 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_integer, { \ | |
151 | .parent = { \ | |
152 | .type = lttng_kernel_type_integer, \ | |
153 | }, \ | |
154 | .size = (_size), \ | |
155 | .alignment = (_alignment), \ | |
156 | .signedness = (_signedness), \ | |
157 | .reverse_byte_order = (_byte_order) != __BYTE_ORDER, \ | |
158 | .base = (_base), \ | |
159 | })) | |
160 | ||
161 | #define lttng_kernel_static_type_integer_from_type(_type, _byte_order, _base) \ | |
162 | lttng_kernel_static_type_integer(sizeof(_type) * CHAR_BIT, \ | |
163 | lttng_alignof(_type) * CHAR_BIT, \ | |
164 | lttng_is_signed_type(_type), \ | |
165 | _byte_order, \ | |
166 | _base) | |
167 | ||
168 | #define lttng_kernel_static_type_enum(_desc, _container_type) \ | |
169 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_enum, { \ | |
170 | .parent = { \ | |
171 | .type = lttng_kernel_type_enum, \ | |
172 | }, \ | |
173 | .desc = (_desc), \ | |
174 | .container_type = (_container_type), \ | |
175 | })) | |
176 | ||
177 | #define lttng_kernel_static_type_array(_length, _elem_type, _alignment, _encoding) \ | |
178 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_array, { \ | |
179 | .parent = { \ | |
180 | .type = lttng_kernel_type_array, \ | |
181 | }, \ | |
182 | .length = (_length), \ | |
183 | .alignment = (_alignment), \ | |
184 | .encoding = lttng_kernel_string_encoding_##_encoding, \ | |
185 | .elem_type = (_elem_type), \ | |
186 | })) | |
187 | ||
188 | #define lttng_kernel_static_type_array_text(_length) \ | |
189 | lttng_kernel_static_type_array(_length, \ | |
190 | lttng_kernel_static_type_integer(sizeof(char) * CHAR_BIT, \ | |
191 | lttng_alignof(char) * CHAR_BIT, lttng_is_signed_type(char), \ | |
192 | __BYTE_ORDER, 10), \ | |
193 | 0, UTF8) | |
194 | ||
195 | #define lttng_kernel_static_type_sequence(_length_name, _elem_type, _alignment, _encoding) \ | |
196 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_sequence, { \ | |
197 | .parent = { \ | |
198 | .type = lttng_kernel_type_sequence, \ | |
199 | }, \ | |
200 | .length_name = (_length_name), \ | |
201 | .alignment = (_alignment), \ | |
202 | .encoding = lttng_kernel_string_encoding_##_encoding, \ | |
203 | .elem_type = (_elem_type), \ | |
204 | })) | |
205 | ||
206 | #define lttng_kernel_static_type_string(_encoding) \ | |
207 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_string, { \ | |
208 | .parent = { \ | |
209 | .type = lttng_kernel_type_string, \ | |
210 | }, \ | |
211 | .encoding = lttng_kernel_string_encoding_##_encoding, \ | |
212 | })) | |
213 | ||
214 | #define lttng_kernel_static_type_struct(_nr_fields, _fields, _alignment) \ | |
215 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_struct, { \ | |
216 | .parent = { \ | |
217 | .type = lttng_kernel_type_struct, \ | |
218 | }, \ | |
219 | .nr_fields = (_nr_fields), \ | |
220 | .fields = _fields, \ | |
221 | .alignment = (_alignment), \ | |
222 | })) | |
223 | ||
224 | #define lttng_kernel_static_type_variant(_nr_choices, _choices, _tag_name, _alignment) \ | |
225 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_variant, { \ | |
226 | .parent = { \ | |
227 | .type = lttng_kernel_type_variant, \ | |
228 | }, \ | |
229 | .tag_name = (_tag_name), \ | |
230 | .choices = _choices, \ | |
231 | .nr_choices = (_nr_choices), \ | |
232 | .alignment = (_alignment), \ | |
233 | })) | |
234 | ||
235 | #define lttng_kernel_static_event_field(_name, _type, _nowrite, _user, _nofilter) \ | |
236 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field, { \ | |
237 | .name = (_name), \ | |
238 | .type = (_type), \ | |
239 | .nowrite = (_nowrite), \ | |
240 | .user = (_user), \ | |
241 | .nofilter = (_nofilter), \ | |
242 | }) | |
243 | ||
244 | #define lttng_kernel_static_event_field_array(_fields...) \ | |
245 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field *, \ | |
246 | _fields \ | |
247 | ) | |
248 | ||
249 | #define lttng_kernel_static_ctx_field(_event_field, _get_size, _get_size_arg, _record, _get_value, _destroy, _priv) \ | |
250 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, { \ | |
251 | .event_field = (_event_field), \ | |
252 | .get_size = (_get_size), \ | |
253 | .get_size_arg = (_get_size_arg), \ | |
254 | .record = (_record), \ | |
255 | .get_value = (_get_value), \ | |
256 | .destroy = (_destroy), \ | |
257 | .priv = (_priv), \ | |
258 | }) | |
259 | ||
260 | #define lttng_kernel_static_enum_entry_value(_string, _value) \ | |
261 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \ | |
262 | .start = { \ | |
263 | .signedness = lttng_is_signed_type(__typeof__(_value)), \ | |
264 | .value = lttng_is_signed_type(__typeof__(_value)) ? \ | |
265 | (long long) (_value) : (_value), \ | |
266 | }, \ | |
267 | .end = { \ | |
268 | .signedness = lttng_is_signed_type(__typeof__(_value)), \ | |
269 | .value = lttng_is_signed_type(__typeof__(_value)) ? \ | |
270 | (long long) (_value) : (_value), \ | |
271 | }, \ | |
272 | .string = (_string), \ | |
273 | }), | |
274 | ||
275 | #define lttng_kernel_static_enum_entry_range(_string, _range_start, _range_end) \ | |
276 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \ | |
277 | .start = { \ | |
278 | .signedness = lttng_is_signed_type(__typeof__(_range_start)), \ | |
279 | .value = lttng_is_signed_type(__typeof__(_range_start)) ? \ | |
280 | (long long) (_range_start) : (_range_start), \ | |
281 | }, \ | |
282 | .end = { \ | |
283 | .signedness = lttng_is_signed_type(__typeof__(_range_end)), \ | |
284 | .value = lttng_is_signed_type(__typeof__(_range_end)) ? \ | |
285 | (long long) (_range_end) : (_range_end), \ | |
286 | }, \ | |
287 | .string = (_string), \ | |
288 | }), | |
289 | ||
290 | #define lttng_kernel_static_enum_entry_auto(_string) \ | |
291 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \ | |
292 | .start = { \ | |
293 | .signedness = -1, \ | |
294 | .value = -1, \ | |
295 | }, \ | |
296 | .end = { \ | |
297 | .signedness = -1, \ | |
298 | .value = -1, \ | |
299 | }, \ | |
300 | .string = (_string), \ | |
301 | .options = { \ | |
302 | .is_auto = 1, \ | |
303 | } \ | |
304 | }), | |
305 | ||
07dfc1d0 MD |
306 | union lttng_ctx_value { |
307 | int64_t s64; | |
308 | const char *str; | |
309 | double d; | |
310 | }; | |
311 | ||
2001023e MD |
312 | /* |
313 | * We need to keep this perf counter field separately from struct | |
437d5aa5 | 314 | * lttng_kernel_ctx_field because cpu hotplug needs fixed-location addresses. |
2001023e MD |
315 | */ |
316 | struct lttng_perf_counter_field { | |
5f4c791e | 317 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) |
1e367326 MD |
318 | struct lttng_cpuhp_node cpuhp_prepare; |
319 | struct lttng_cpuhp_node cpuhp_online; | |
320 | #else | |
2001023e MD |
321 | struct notifier_block nb; |
322 | int hp_enable; | |
1e367326 | 323 | #endif |
2001023e MD |
324 | struct perf_event_attr *attr; |
325 | struct perf_event **e; /* per-cpu array */ | |
437d5aa5 MD |
326 | char *name; |
327 | struct lttng_kernel_event_field *event_field; | |
2001023e MD |
328 | }; |
329 | ||
79150a49 | 330 | struct lttng_probe_ctx { |
e2d5dbc7 | 331 | struct lttng_kernel_event_common *event; |
79150a49 JD |
332 | uint8_t interruptible; |
333 | }; | |
334 | ||
437d5aa5 MD |
335 | struct lttng_kernel_ctx_field { |
336 | const struct lttng_kernel_event_field *event_field; | |
f1676205 | 337 | size_t (*get_size)(size_t offset); |
437d5aa5 | 338 | size_t (*get_size_arg)(size_t offset, struct lttng_kernel_ctx_field *field, |
1474c8e2 FG |
339 | struct lib_ring_buffer_ctx *ctx, |
340 | struct lttng_channel *chan); | |
437d5aa5 | 341 | void (*record)(struct lttng_kernel_ctx_field *field, |
f1676205 | 342 | struct lib_ring_buffer_ctx *ctx, |
a90917c3 | 343 | struct lttng_channel *chan); |
437d5aa5 | 344 | void (*get_value)(struct lttng_kernel_ctx_field *field, |
79150a49 | 345 | struct lttng_probe_ctx *lttng_probe_ctx, |
07dfc1d0 | 346 | union lttng_ctx_value *value); |
437d5aa5 | 347 | void (*destroy)(struct lttng_kernel_ctx_field *field); |
3c1a57e8 | 348 | void *priv; |
ba1f5986 MD |
349 | }; |
350 | ||
437d5aa5 MD |
351 | struct lttng_kernel_ctx { |
352 | struct lttng_kernel_ctx_field *fields; | |
0d1a681e | 353 | unsigned int nr_fields; |
ba1f5986 | 354 | unsigned int allocated_fields; |
a9dd15da | 355 | size_t largest_align; /* in bytes */ |
0d1a681e MD |
356 | }; |
357 | ||
437d5aa5 MD |
358 | struct lttng_kernel_event_desc { |
359 | const char *event_name; /* lttng-modules name */ | |
360 | const char *event_kname; /* Linux kernel name (tracepoints) */ | |
361 | const struct lttng_kernel_probe_desc *probe_desc; | |
362 | void (*probe_callback)(void); | |
363 | const struct lttng_kernel_event_field **fields; /* event payload */ | |
c0edae1d | 364 | unsigned int nr_fields; |
dc7f600a | 365 | struct module *owner; |
c0edae1d MD |
366 | }; |
367 | ||
437d5aa5 MD |
368 | struct lttng_kernel_probe_desc { |
369 | const char *provider_name; | |
370 | const struct lttng_kernel_event_desc **event_desc; | |
85a9ca7f MD |
371 | unsigned int nr_events; |
372 | struct list_head head; /* chain registered probes */ | |
3c997079 MD |
373 | struct list_head lazy_init_head; |
374 | int lazy; /* lazy registration */ | |
85a9ca7f MD |
375 | }; |
376 | ||
7371f44c MD |
377 | struct lttng_krp; /* Kretprobe handling */ |
378 | ||
89ec2b91 FD |
379 | enum lttng_bytecode_node_type { |
380 | LTTNG_BYTECODE_NODE_TYPE_FILTER, | |
99d223ad | 381 | LTTNG_BYTECODE_NODE_TYPE_CAPTURE, |
89ec2b91 FD |
382 | }; |
383 | ||
384 | struct lttng_bytecode_node { | |
385 | enum lttng_bytecode_node_type type; | |
07dfc1d0 MD |
386 | struct list_head node; |
387 | struct lttng_enabler *enabler; | |
89ec2b91 FD |
388 | struct { |
389 | uint32_t len; | |
390 | uint32_t reloc_offset; | |
391 | uint64_t seqnum; | |
392 | char data[]; | |
393 | } bc; | |
07dfc1d0 MD |
394 | }; |
395 | ||
396 | /* | |
80c2a69a | 397 | * Bytecode interpreter return value masks. |
07dfc1d0 | 398 | */ |
80c2a69a FD |
399 | enum lttng_bytecode_interpreter_ret { |
400 | LTTNG_INTERPRETER_DISCARD = 0, | |
401 | LTTNG_INTERPRETER_RECORD_FLAG = (1ULL << 0), | |
07dfc1d0 MD |
402 | /* Other bits are kept for future use. */ |
403 | }; | |
404 | ||
99d223ad FD |
405 | struct lttng_interpreter_output; |
406 | ||
07dfc1d0 MD |
407 | struct lttng_bytecode_runtime { |
408 | /* Associated bytecode */ | |
89ec2b91 | 409 | struct lttng_bytecode_node *bc; |
3d650c7b FD |
410 | union { |
411 | uint64_t (*filter)(void *filter_data, | |
412 | struct lttng_probe_ctx *lttng_probe_ctx, | |
413 | const char *filter_stack_data); | |
99d223ad FD |
414 | uint64_t (*capture)(void *filter_data, |
415 | struct lttng_probe_ctx *lttng_probe_ctx, | |
416 | const char *capture_stack_data, | |
417 | struct lttng_interpreter_output *output); | |
3d650c7b | 418 | } interpreter_funcs; |
07dfc1d0 MD |
419 | int link_failed; |
420 | struct list_head node; /* list of bytecode runtime in event */ | |
437d5aa5 | 421 | struct lttng_kernel_ctx *ctx; |
07dfc1d0 MD |
422 | }; |
423 | ||
3c997079 MD |
424 | /* |
425 | * Objects in a linked-list of enablers, owned by an event. | |
426 | */ | |
427 | struct lttng_enabler_ref { | |
428 | struct list_head node; /* enabler ref list */ | |
429 | struct lttng_enabler *ref; /* backward ref */ | |
430 | }; | |
431 | ||
3aed4dca | 432 | struct lttng_uprobe_handler { |
e2d5dbc7 | 433 | struct lttng_kernel_event_common *event; |
3aed4dca FD |
434 | loff_t offset; |
435 | struct uprobe_consumer up_consumer; | |
436 | struct list_head node; | |
437 | }; | |
438 | ||
8bf17deb FD |
439 | struct lttng_kprobe { |
440 | struct kprobe kp; | |
441 | char *symbol_name; | |
442 | }; | |
443 | ||
83b802dc FD |
444 | struct lttng_uprobe { |
445 | struct inode *inode; | |
446 | struct list_head head; | |
447 | }; | |
448 | ||
badfe9f5 MD |
449 | enum lttng_syscall_entryexit { |
450 | LTTNG_SYSCALL_ENTRY, | |
451 | LTTNG_SYSCALL_EXIT, | |
452 | }; | |
453 | ||
454 | enum lttng_syscall_abi { | |
455 | LTTNG_SYSCALL_ABI_NATIVE, | |
456 | LTTNG_SYSCALL_ABI_COMPAT, | |
457 | }; | |
458 | ||
a67ba386 MD |
459 | struct lttng_kernel_event_common_private; |
460 | ||
461 | enum lttng_kernel_event_type { | |
462 | LTTNG_KERNEL_EVENT_TYPE_RECORDER = 0, | |
463 | LTTNG_KERNEL_EVENT_TYPE_NOTIFIER = 1, | |
464 | }; | |
465 | ||
466 | struct lttng_kernel_event_common { | |
467 | struct lttng_kernel_event_common_private *priv; /* Private event interface */ | |
468 | ||
469 | enum lttng_kernel_event_type type; | |
470 | /* Get child with container_of(). */ | |
471 | ||
e64957da | 472 | int enabled; |
a67ba386 MD |
473 | int eval_filter; /* Need to evaluate filters */ |
474 | int (*run_filter)(struct lttng_kernel_event_common *event, | |
475 | const char *stack_data, | |
476 | void *filter_ctx); | |
3c997079 MD |
477 | }; |
478 | ||
a67ba386 MD |
479 | struct lttng_kernel_event_recorder_private; |
480 | ||
481 | struct lttng_kernel_event_recorder { | |
482 | struct lttng_kernel_event_common parent; | |
483 | struct lttng_kernel_event_recorder_private *priv; /* Private event record interface */ | |
484 | ||
485 | struct lttng_channel *chan; | |
c3eddb2e MD |
486 | }; |
487 | ||
a67ba386 MD |
488 | struct lttng_kernel_notification_ctx { |
489 | int eval_capture; /* Capture evaluation available. */ | |
490 | }; | |
dffef45d | 491 | |
a67ba386 | 492 | struct lttng_kernel_event_notifier_private; |
8a8ac9a8 | 493 | |
a67ba386 MD |
494 | struct lttng_kernel_event_notifier { |
495 | struct lttng_kernel_event_common parent; | |
496 | struct lttng_kernel_event_notifier_private *priv; /* Private event notifier interface */ | |
dffef45d | 497 | |
a67ba386 MD |
498 | int eval_capture; /* Need to evaluate capture */ |
499 | void (*notification_send)(struct lttng_kernel_event_notifier *event_notifier, | |
500 | struct lttng_probe_ctx *probe_ctx, | |
501 | const char *stack_data, | |
502 | struct lttng_kernel_notification_ctx *notif_ctx); | |
dffef45d FD |
503 | }; |
504 | ||
3b861b22 FD |
505 | enum lttng_enabler_format_type { |
506 | LTTNG_ENABLER_FORMAT_STAR_GLOB, | |
507 | LTTNG_ENABLER_FORMAT_NAME, | |
3c997079 MD |
508 | }; |
509 | ||
510 | /* | |
511 | * Enabler field, within whatever object is enabling an event. Target of | |
512 | * backward reference. | |
513 | */ | |
514 | struct lttng_enabler { | |
3b861b22 | 515 | enum lttng_enabler_format_type format_type; |
3c997079 | 516 | |
608ab495 | 517 | /* head list of struct lttng_bytecode_node */ |
07dfc1d0 | 518 | struct list_head filter_bytecode_head; |
3c997079 | 519 | |
606828e4 | 520 | struct lttng_kernel_abi_event event_param; |
b2bc0bc8 | 521 | unsigned int enabled:1; |
dffef45d FD |
522 | |
523 | uint64_t user_token; /* User-provided token. */ | |
b2bc0bc8 FD |
524 | }; |
525 | ||
526 | struct lttng_event_enabler { | |
527 | struct lttng_enabler base; | |
528 | struct list_head node; /* per-session list of enablers */ | |
3c997079 | 529 | struct lttng_channel *chan; |
85a9ca7f MD |
530 | }; |
531 | ||
dffef45d FD |
532 | struct lttng_event_notifier_enabler { |
533 | struct lttng_enabler base; | |
99f52fcc | 534 | uint64_t error_counter_index; |
dffef45d FD |
535 | struct list_head node; /* List of event_notifier enablers */ |
536 | struct lttng_event_notifier_group *group; | |
99d223ad FD |
537 | |
538 | /* head list of struct lttng_bytecode_node */ | |
539 | struct list_head capture_bytecode_head; | |
540 | uint64_t num_captures; | |
dffef45d FD |
541 | }; |
542 | ||
99d223ad | 543 | |
b2bc0bc8 FD |
544 | static inline |
545 | struct lttng_enabler *lttng_event_enabler_as_enabler( | |
546 | struct lttng_event_enabler *event_enabler) | |
547 | { | |
548 | return &event_enabler->base; | |
549 | } | |
550 | ||
dffef45d FD |
551 | static inline |
552 | struct lttng_enabler *lttng_event_notifier_enabler_as_enabler( | |
553 | struct lttng_event_notifier_enabler *event_notifier_enabler) | |
554 | { | |
555 | return &event_notifier_enabler->base; | |
556 | } | |
b2bc0bc8 | 557 | |
a90917c3 | 558 | struct lttng_channel_ops { |
85a9ca7f | 559 | struct channel *(*channel_create)(const char *name, |
5cf4b87c | 560 | void *priv, |
85a9ca7f MD |
561 | void *buf_addr, |
562 | size_t subbuf_size, size_t num_subbuf, | |
563 | unsigned int switch_timer_interval, | |
564 | unsigned int read_timer_interval); | |
565 | void (*channel_destroy)(struct channel *chan); | |
566 | struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan); | |
f71ecafa | 567 | int (*buffer_has_read_closed_stream)(struct channel *chan); |
85a9ca7f | 568 | void (*buffer_read_close)(struct lib_ring_buffer *buf); |
4e1f08f4 | 569 | int (*event_reserve)(struct lib_ring_buffer_ctx *ctx, |
64c796d8 | 570 | uint32_t event_id); |
85a9ca7f MD |
571 | void (*event_commit)(struct lib_ring_buffer_ctx *ctx); |
572 | void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src, | |
573 | size_t len); | |
4ea00e4f JD |
574 | void (*event_write_from_user)(struct lib_ring_buffer_ctx *ctx, |
575 | const void *src, size_t len); | |
58aa5d24 MD |
576 | void (*event_memset)(struct lib_ring_buffer_ctx *ctx, |
577 | int c, size_t len); | |
16f78f3a MD |
578 | void (*event_strcpy)(struct lib_ring_buffer_ctx *ctx, const char *src, |
579 | size_t len); | |
580 | void (*event_strcpy_from_user)(struct lib_ring_buffer_ctx *ctx, | |
581 | const char __user *src, size_t len); | |
1ec3f75a MD |
582 | /* |
583 | * packet_avail_size returns the available size in the current | |
584 | * packet. Note that the size returned is only a hint, since it | |
585 | * may change due to concurrent writes. | |
586 | */ | |
587 | size_t (*packet_avail_size)(struct channel *chan); | |
71c1d843 | 588 | wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu); |
24cedcfe MD |
589 | wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan); |
590 | int (*is_finalized)(struct channel *chan); | |
254ec7bc | 591 | int (*is_disabled)(struct channel *chan); |
3b731ab1 JD |
592 | int (*timestamp_begin) (const struct lib_ring_buffer_config *config, |
593 | struct lib_ring_buffer *bufb, | |
594 | uint64_t *timestamp_begin); | |
595 | int (*timestamp_end) (const struct lib_ring_buffer_config *config, | |
596 | struct lib_ring_buffer *bufb, | |
597 | uint64_t *timestamp_end); | |
598 | int (*events_discarded) (const struct lib_ring_buffer_config *config, | |
599 | struct lib_ring_buffer *bufb, | |
600 | uint64_t *events_discarded); | |
601 | int (*content_size) (const struct lib_ring_buffer_config *config, | |
602 | struct lib_ring_buffer *bufb, | |
603 | uint64_t *content_size); | |
604 | int (*packet_size) (const struct lib_ring_buffer_config *config, | |
605 | struct lib_ring_buffer *bufb, | |
606 | uint64_t *packet_size); | |
607 | int (*stream_id) (const struct lib_ring_buffer_config *config, | |
608 | struct lib_ring_buffer *bufb, | |
609 | uint64_t *stream_id); | |
2348ca17 JD |
610 | int (*current_timestamp) (const struct lib_ring_buffer_config *config, |
611 | struct lib_ring_buffer *bufb, | |
612 | uint64_t *ts); | |
5b3cf4f9 JD |
613 | int (*sequence_number) (const struct lib_ring_buffer_config *config, |
614 | struct lib_ring_buffer *bufb, | |
615 | uint64_t *seq); | |
5594698f JD |
616 | int (*instance_id) (const struct lib_ring_buffer_config *config, |
617 | struct lib_ring_buffer *bufb, | |
618 | uint64_t *id); | |
85a9ca7f MD |
619 | }; |
620 | ||
a101fa10 MD |
621 | struct lttng_counter_ops { |
622 | struct lib_counter *(*counter_create)(size_t nr_dimensions, | |
623 | const size_t *max_nr_elem, /* for each dimension */ | |
624 | int64_t global_sum_step); | |
625 | void (*counter_destroy)(struct lib_counter *counter); | |
626 | int (*counter_add)(struct lib_counter *counter, const size_t *dimension_indexes, | |
627 | int64_t v); | |
628 | /* | |
629 | * counter_read reads a specific cpu's counter if @cpu >= 0, or | |
630 | * the global aggregation counter if @cpu == -1. | |
631 | */ | |
632 | int (*counter_read)(struct lib_counter *counter, const size_t *dimension_indexes, int cpu, | |
633 | int64_t *value, bool *overflow, bool *underflow); | |
634 | /* | |
635 | * counter_aggregate returns the total sum of all per-cpu counters and | |
636 | * the global aggregation counter. | |
637 | */ | |
638 | int (*counter_aggregate)(struct lib_counter *counter, const size_t *dimension_indexes, | |
639 | int64_t *value, bool *overflow, bool *underflow); | |
640 | int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes); | |
641 | }; | |
642 | ||
a90917c3 | 643 | struct lttng_transport { |
a33c9927 MD |
644 | char *name; |
645 | struct module *owner; | |
646 | struct list_head node; | |
a90917c3 | 647 | struct lttng_channel_ops ops; |
a33c9927 MD |
648 | }; |
649 | ||
a101fa10 MD |
650 | struct lttng_counter_transport { |
651 | char *name; | |
652 | struct module *owner; | |
653 | struct list_head node; | |
654 | struct lttng_counter_ops ops; | |
655 | }; | |
656 | ||
80f87dd2 MD |
657 | struct lttng_syscall_filter; |
658 | ||
3c997079 MD |
659 | #define LTTNG_EVENT_HT_BITS 12 |
660 | #define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS) | |
661 | ||
662 | struct lttng_event_ht { | |
663 | struct hlist_head table[LTTNG_EVENT_HT_SIZE]; | |
664 | }; | |
665 | ||
dffef45d FD |
666 | #define LTTNG_EVENT_NOTIFIER_HT_BITS 12 |
667 | #define LTTNG_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_EVENT_NOTIFIER_HT_BITS) | |
668 | ||
669 | struct lttng_event_notifier_ht { | |
670 | struct hlist_head table[LTTNG_EVENT_NOTIFIER_HT_SIZE]; | |
671 | }; | |
672 | ||
a90917c3 | 673 | struct lttng_channel { |
c099397a | 674 | unsigned int id; |
85a9ca7f | 675 | struct channel *chan; /* Channel buffers */ |
e64957da | 676 | int enabled; |
437d5aa5 | 677 | struct lttng_kernel_ctx *ctx; |
85a9ca7f | 678 | /* Event ID management */ |
a90917c3 | 679 | struct lttng_session *session; |
85a9ca7f MD |
680 | struct file *file; /* File associated to channel */ |
681 | unsigned int free_event_id; /* Next event ID to allocate */ | |
682 | struct list_head list; /* Channel list */ | |
a90917c3 MD |
683 | struct lttng_channel_ops *ops; |
684 | struct lttng_transport *transport; | |
3b82c4e1 MD |
685 | struct hlist_head *sc_table; /* for syscall tracing */ |
686 | struct hlist_head *compat_sc_table; | |
687 | struct hlist_head *sc_exit_table; /* for syscall exit tracing */ | |
688 | struct hlist_head *compat_sc_exit_table; | |
689 | struct hlist_head sc_unknown; /* for unknown syscalls */ | |
690 | struct hlist_head sc_compat_unknown; | |
691 | struct hlist_head sc_exit_unknown; | |
692 | struct hlist_head compat_sc_exit_unknown; | |
80f87dd2 | 693 | struct lttng_syscall_filter *sc_filter; |
9115fbdc | 694 | int header_type; /* 0: unset, 1: compact, 2: large */ |
d83004aa | 695 | enum channel_type channel_type; |
3b82c4e1 MD |
696 | int syscall_all_entry; |
697 | int syscall_all_exit; | |
80f87dd2 MD |
698 | unsigned int metadata_dumped:1, |
699 | sys_enter_registered:1, | |
700 | sys_exit_registered:1, | |
3c997079 | 701 | tstate:1; /* Transient enable state */ |
85a9ca7f MD |
702 | }; |
703 | ||
d83004aa JD |
704 | struct lttng_metadata_stream { |
705 | void *priv; /* Ring buffer private data */ | |
706 | struct lttng_metadata_cache *metadata_cache; | |
f613e3e6 MD |
707 | unsigned int metadata_in; /* Bytes read from the cache */ |
708 | unsigned int metadata_out; /* Bytes consumed from stream */ | |
d83004aa JD |
709 | int finalized; /* Has channel been finalized */ |
710 | wait_queue_head_t read_wait; /* Reader buffer-level wait queue */ | |
711 | struct list_head list; /* Stream list */ | |
b3b8072b | 712 | struct lttng_transport *transport; |
9616f0bf | 713 | uint64_t version; /* Current version of the metadata cache */ |
8b97fd42 | 714 | bool coherent; /* Stream in a coherent state */ |
d83004aa JD |
715 | }; |
716 | ||
114667d5 MD |
717 | #define LTTNG_DYNAMIC_LEN_STACK_SIZE 128 |
718 | ||
719 | struct lttng_dynamic_len_stack { | |
720 | size_t stack[LTTNG_DYNAMIC_LEN_STACK_SIZE]; | |
721 | size_t offset; | |
722 | }; | |
723 | ||
724 | DECLARE_PER_CPU(struct lttng_dynamic_len_stack, lttng_dynamic_len_stack); | |
e0130fab MD |
725 | |
726 | /* | |
d1f652f8 | 727 | * struct lttng_id_tracker declared in header due to deferencing of *v |
e0130fab MD |
728 | * in RCU_INITIALIZER(v). |
729 | */ | |
d1f652f8 MD |
730 | #define LTTNG_ID_HASH_BITS 6 |
731 | #define LTTNG_ID_TABLE_SIZE (1 << LTTNG_ID_HASH_BITS) | |
e0130fab | 732 | |
d1f652f8 MD |
733 | enum tracker_type { |
734 | TRACKER_PID, | |
735 | TRACKER_VPID, | |
736 | TRACKER_UID, | |
737 | TRACKER_VUID, | |
738 | TRACKER_GID, | |
739 | TRACKER_VGID, | |
740 | ||
741 | TRACKER_UNKNOWN, | |
742 | }; | |
743 | ||
744 | struct lttng_id_tracker_rcu { | |
745 | struct hlist_head id_hash[LTTNG_ID_TABLE_SIZE]; | |
746 | }; | |
747 | ||
748 | struct lttng_id_tracker { | |
749 | struct lttng_session *session; | |
750 | enum tracker_type tracker_type; | |
751 | struct lttng_id_tracker_rcu *p; /* RCU dereferenced. */ | |
e0130fab MD |
752 | }; |
753 | ||
d1f652f8 | 754 | struct lttng_id_hash_node { |
7e6f9ef6 | 755 | struct hlist_node hlist; |
d1f652f8 | 756 | int id; |
7e6f9ef6 MD |
757 | }; |
758 | ||
a90917c3 | 759 | struct lttng_session { |
85a9ca7f | 760 | int active; /* Is trace session active ? */ |
8070f5c0 | 761 | int been_active; /* Has trace session been active ? */ |
85a9ca7f MD |
762 | struct file *file; /* File associated to session */ |
763 | struct list_head chan; /* Channel list head */ | |
764 | struct list_head events; /* Event list head */ | |
765 | struct list_head list; /* Session list */ | |
c099397a | 766 | unsigned int free_chan_id; /* Next chan ID to allocate */ |
d793d5e1 | 767 | uuid_le uuid; /* Trace session unique ID */ |
d83004aa | 768 | struct lttng_metadata_cache *metadata_cache; |
d1f652f8 MD |
769 | struct lttng_id_tracker pid_tracker; |
770 | struct lttng_id_tracker vpid_tracker; | |
771 | struct lttng_id_tracker uid_tracker; | |
772 | struct lttng_id_tracker vuid_tracker; | |
773 | struct lttng_id_tracker gid_tracker; | |
774 | struct lttng_id_tracker vgid_tracker; | |
3c997079 MD |
775 | unsigned int metadata_dumped:1, |
776 | tstate:1; /* Transient enable state */ | |
b2bc0bc8 | 777 | /* List of event enablers */ |
3c997079 MD |
778 | struct list_head enablers_head; |
779 | /* Hash table of events */ | |
780 | struct lttng_event_ht events_ht; | |
606828e4 MD |
781 | char name[LTTNG_KERNEL_ABI_SESSION_NAME_LEN]; |
782 | char creation_time[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN]; | |
85a9ca7f MD |
783 | }; |
784 | ||
99f52fcc FD |
785 | struct lttng_counter { |
786 | struct file *file; /* File associated to counter. */ | |
787 | struct file *owner; | |
788 | struct lttng_counter_transport *transport; | |
789 | struct lib_counter *counter; | |
790 | struct lttng_counter_ops *ops; | |
791 | }; | |
792 | ||
750b05f2 FD |
793 | struct lttng_event_notifier_group { |
794 | struct file *file; /* File associated to event notifier group */ | |
21f58fb7 | 795 | struct file *notif_file; /* File used to expose notifications to userspace. */ |
750b05f2 | 796 | struct list_head node; /* event notifier group list */ |
dffef45d FD |
797 | struct list_head enablers_head; /* List of enablers */ |
798 | struct list_head event_notifiers_head; /* List of event notifier */ | |
799 | struct lttng_event_notifier_ht event_notifiers_ht; /* Hash table of event notifiers */ | |
750b05f2 FD |
800 | struct lttng_channel_ops *ops; |
801 | struct lttng_transport *transport; | |
802 | struct channel *chan; /* Ring buffer channel for event notifier group. */ | |
803 | struct lib_ring_buffer *buf; /* Ring buffer for event notifier group. */ | |
21f58fb7 FD |
804 | wait_queue_head_t read_wait; |
805 | struct irq_work wakeup_pending; /* Pending wakeup irq work. */ | |
a67ba386 MD |
806 | struct lttng_kernel_event_notifier *sc_unknown; /* for unknown syscalls */ |
807 | struct lttng_kernel_event_notifier *sc_compat_unknown; | |
8a8ac9a8 FD |
808 | |
809 | struct lttng_syscall_filter *sc_filter; | |
810 | ||
811 | struct hlist_head *event_notifier_syscall_dispatch; | |
812 | struct hlist_head *event_notifier_compat_syscall_dispatch; | |
813 | struct hlist_head *event_notifier_exit_syscall_dispatch; | |
814 | struct hlist_head *event_notifier_exit_compat_syscall_dispatch; | |
815 | ||
816 | struct hlist_head event_notifier_unknown_syscall_dispatch; | |
817 | struct hlist_head event_notifier_compat_unknown_syscall_dispatch; | |
818 | struct hlist_head event_notifier_exit_unknown_syscall_dispatch; | |
819 | struct hlist_head event_notifier_exit_compat_unknown_syscall_dispatch; | |
820 | ||
821 | int syscall_all_entry; | |
822 | int syscall_all_exit; | |
823 | ||
824 | unsigned int sys_enter_registered:1, sys_exit_registered:1; | |
825 | ||
826 | struct lttng_counter *error_counter; | |
827 | size_t error_counter_len; | |
750b05f2 FD |
828 | }; |
829 | ||
d83004aa JD |
830 | struct lttng_metadata_cache { |
831 | char *data; /* Metadata cache */ | |
832 | unsigned int cache_alloc; /* Metadata allocated size (bytes) */ | |
833 | unsigned int metadata_written; /* Number of bytes written in metadata cache */ | |
3e75e2a7 | 834 | atomic_t producing; /* Metadata being produced (incomplete) */ |
d83004aa JD |
835 | struct kref refcount; /* Metadata cache usage */ |
836 | struct list_head metadata_stream; /* Metadata stream list */ | |
a36580d5 | 837 | uuid_le uuid; /* Trace session unique ID (copy) */ |
9616f0bf JD |
838 | struct mutex lock; /* Produce/consume lock */ |
839 | uint64_t version; /* Current version of the metadata */ | |
d83004aa JD |
840 | }; |
841 | ||
3c997079 MD |
842 | void lttng_lock_sessions(void); |
843 | void lttng_unlock_sessions(void); | |
844 | ||
845 | struct list_head *lttng_get_probe_list_head(void); | |
846 | ||
b2bc0bc8 FD |
847 | struct lttng_event_enabler *lttng_event_enabler_create( |
848 | enum lttng_enabler_format_type format_type, | |
606828e4 | 849 | struct lttng_kernel_abi_event *event_param, |
3c997079 MD |
850 | struct lttng_channel *chan); |
851 | ||
b2bc0bc8 FD |
852 | int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler); |
853 | int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler); | |
dffef45d FD |
854 | struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create( |
855 | struct lttng_event_notifier_group *event_notifier_group, | |
856 | enum lttng_enabler_format_type format_type, | |
606828e4 | 857 | struct lttng_kernel_abi_event_notifier *event_notifier_param); |
dffef45d FD |
858 | |
859 | int lttng_event_notifier_enabler_enable( | |
860 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
861 | int lttng_event_notifier_enabler_disable( | |
862 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
3c997079 | 863 | int lttng_fix_pending_events(void); |
b01155ba | 864 | int lttng_fix_pending_event_notifiers(void); |
3c997079 | 865 | int lttng_session_active(void); |
b01155ba | 866 | bool lttng_event_notifier_active(void); |
3c997079 | 867 | |
a90917c3 MD |
868 | struct lttng_session *lttng_session_create(void); |
869 | int lttng_session_enable(struct lttng_session *session); | |
870 | int lttng_session_disable(struct lttng_session *session); | |
871 | void lttng_session_destroy(struct lttng_session *session); | |
9616f0bf | 872 | int lttng_session_metadata_regenerate(struct lttng_session *session); |
601252cf | 873 | int lttng_session_statedump(struct lttng_session *session); |
d83004aa | 874 | void metadata_cache_destroy(struct kref *kref); |
4e3c1b9b | 875 | |
99f52fcc FD |
876 | struct lttng_counter *lttng_kernel_counter_create( |
877 | const char *counter_transport_name, size_t number_dimensions, | |
878 | const size_t *dimensions_sizes); | |
879 | int lttng_kernel_counter_read(struct lttng_counter *counter, | |
880 | const size_t *dimension_indexes, int32_t cpu, | |
881 | int64_t *val, bool *overflow, bool *underflow); | |
882 | int lttng_kernel_counter_aggregate(struct lttng_counter *counter, | |
883 | const size_t *dimension_indexes, int64_t *val, | |
884 | bool *overflow, bool *underflow); | |
885 | int lttng_kernel_counter_clear(struct lttng_counter *counter, | |
886 | const size_t *dimension_indexes); | |
887 | ||
888 | ||
750b05f2 | 889 | struct lttng_event_notifier_group *lttng_event_notifier_group_create(void); |
99f52fcc FD |
890 | int lttng_event_notifier_group_create_error_counter( |
891 | struct file *event_notifier_group_file, | |
606828e4 | 892 | const struct lttng_kernel_abi_counter_conf *error_counter_conf); |
750b05f2 FD |
893 | void lttng_event_notifier_group_destroy( |
894 | struct lttng_event_notifier_group *event_notifier_group); | |
895 | ||
a90917c3 | 896 | struct lttng_channel *lttng_channel_create(struct lttng_session *session, |
5dbbdb43 MD |
897 | const char *transport_name, |
898 | void *buf_addr, | |
899 | size_t subbuf_size, size_t num_subbuf, | |
900 | unsigned int switch_timer_interval, | |
d83004aa JD |
901 | unsigned int read_timer_interval, |
902 | enum channel_type channel_type); | |
a90917c3 | 903 | struct lttng_channel *lttng_global_channel_create(struct lttng_session *session, |
4e3c1b9b MD |
904 | int overwrite, void *buf_addr, |
905 | size_t subbuf_size, size_t num_subbuf, | |
906 | unsigned int switch_timer_interval, | |
907 | unsigned int read_timer_interval); | |
4e3c1b9b | 908 | |
d83004aa | 909 | void lttng_metadata_channel_destroy(struct lttng_channel *chan); |
a67ba386 | 910 | struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan, |
606828e4 | 911 | struct lttng_kernel_abi_event *event_param, |
437d5aa5 | 912 | const struct lttng_kernel_event_desc *event_desc, |
606828e4 | 913 | enum lttng_kernel_abi_instrumentation itype); |
a67ba386 | 914 | struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan, |
606828e4 | 915 | struct lttng_kernel_abi_event *event_param, |
437d5aa5 | 916 | const struct lttng_kernel_event_desc *event_desc, |
606828e4 | 917 | enum lttng_kernel_abi_instrumentation itype); |
a67ba386 | 918 | struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_channel *chan, |
606828e4 | 919 | struct lttng_kernel_abi_old_event *old_event_param, |
437d5aa5 | 920 | const struct lttng_kernel_event_desc *internal_desc); |
c0e31d2e | 921 | |
a67ba386 | 922 | struct lttng_kernel_event_notifier *lttng_event_notifier_create( |
437d5aa5 | 923 | const struct lttng_kernel_event_desc *event_notifier_desc, |
dffef45d | 924 | uint64_t id, |
99f52fcc | 925 | uint64_t error_counter_idx, |
dffef45d | 926 | struct lttng_event_notifier_group *event_notifier_group, |
606828e4 | 927 | struct lttng_kernel_abi_event_notifier *event_notifier_param, |
606828e4 | 928 | enum lttng_kernel_abi_instrumentation itype); |
a67ba386 | 929 | struct lttng_kernel_event_notifier *_lttng_event_notifier_create( |
437d5aa5 | 930 | const struct lttng_kernel_event_desc *event_notifier_desc, |
dffef45d | 931 | uint64_t id, |
99f52fcc | 932 | uint64_t error_counter_idx, |
dffef45d | 933 | struct lttng_event_notifier_group *event_notifier_group, |
606828e4 | 934 | struct lttng_kernel_abi_event_notifier *event_notifier_param, |
606828e4 | 935 | enum lttng_kernel_abi_instrumentation itype); |
dffef45d | 936 | |
a90917c3 MD |
937 | int lttng_channel_enable(struct lttng_channel *channel); |
938 | int lttng_channel_disable(struct lttng_channel *channel); | |
a67ba386 MD |
939 | int lttng_event_enable(struct lttng_kernel_event_recorder *event); |
940 | int lttng_event_disable(struct lttng_kernel_event_recorder *event); | |
e64957da | 941 | |
a67ba386 MD |
942 | int lttng_event_notifier_enable(struct lttng_kernel_event_notifier *event_notifier); |
943 | int lttng_event_notifier_disable(struct lttng_kernel_event_notifier *event_notifier); | |
2b16f0c9 | 944 | |
a90917c3 MD |
945 | void lttng_transport_register(struct lttng_transport *transport); |
946 | void lttng_transport_unregister(struct lttng_transport *transport); | |
11b5a3c2 | 947 | |
a101fa10 MD |
948 | void lttng_counter_transport_register(struct lttng_counter_transport *transport); |
949 | void lttng_counter_transport_unregister(struct lttng_counter_transport *transport); | |
950 | ||
360f38ea | 951 | void synchronize_trace(void); |
80996790 | 952 | int lttng_abi_init(void); |
6dccd6c1 | 953 | int lttng_abi_compat_old_init(void); |
80996790 | 954 | void lttng_abi_exit(void); |
6dccd6c1 | 955 | void lttng_abi_compat_old_exit(void); |
1c25284c | 956 | |
437d5aa5 MD |
957 | int lttng_probe_register(struct lttng_kernel_probe_desc *desc); |
958 | void lttng_probe_unregister(struct lttng_kernel_probe_desc *desc); | |
959 | const struct lttng_kernel_event_desc *lttng_event_desc_get(const char *name); | |
960 | void lttng_event_desc_put(const struct lttng_kernel_event_desc *desc); | |
a90917c3 MD |
961 | int lttng_probes_init(void); |
962 | void lttng_probes_exit(void); | |
1ec65de1 | 963 | |
b3b8072b | 964 | int lttng_metadata_output_channel(struct lttng_metadata_stream *stream, |
8b97fd42 | 965 | struct channel *chan, bool *coherent); |
d83004aa | 966 | |
d1f652f8 MD |
967 | int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node *node); |
968 | int lttng_id_tracker_empty_set(struct lttng_id_tracker *lf); | |
969 | void lttng_id_tracker_destroy(struct lttng_id_tracker *lf, bool rcu); | |
970 | bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu *p, int id); | |
971 | int lttng_id_tracker_add(struct lttng_id_tracker *lf, int id); | |
972 | int lttng_id_tracker_del(struct lttng_id_tracker *lf, int id); | |
e0130fab | 973 | |
d1f652f8 MD |
974 | int lttng_session_track_id(struct lttng_session *session, |
975 | enum tracker_type tracker_type, int id); | |
976 | int lttng_session_untrack_id(struct lttng_session *session, | |
977 | enum tracker_type tracker_type, int id); | |
e0130fab | 978 | |
d1f652f8 MD |
979 | int lttng_session_list_tracker_ids(struct lttng_session *session, |
980 | enum tracker_type tracker_type); | |
7e6f9ef6 | 981 | |
2754583e MD |
982 | void lttng_clock_ref(void); |
983 | void lttng_clock_unref(void); | |
984 | ||
437d5aa5 | 985 | int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc, |
8a8ac9a8 FD |
986 | struct lttng_enabler *enabler); |
987 | ||
3a523f5b | 988 | #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) |
a67ba386 | 989 | int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler); |
3b82c4e1 | 990 | int lttng_syscalls_unregister_channel(struct lttng_channel *chan); |
2d6d88c6 | 991 | int lttng_syscalls_destroy_event(struct lttng_channel *chan); |
ade8a729 FD |
992 | int lttng_syscall_filter_enable_event( |
993 | struct lttng_channel *chan, | |
a67ba386 | 994 | struct lttng_kernel_event_recorder *event); |
ade8a729 FD |
995 | int lttng_syscall_filter_disable_event( |
996 | struct lttng_channel *chan, | |
a67ba386 | 997 | struct lttng_kernel_event_recorder *event); |
ade8a729 | 998 | |
12e579db | 999 | long lttng_channel_syscall_mask(struct lttng_channel *channel, |
606828e4 | 1000 | struct lttng_kernel_abi_syscall_mask __user *usyscall_mask); |
2d6d88c6 | 1001 | |
8a8ac9a8 | 1002 | int lttng_syscalls_register_event_notifier( |
a67ba386 MD |
1003 | struct lttng_event_notifier_enabler *event_notifier_enabler); |
1004 | int lttng_syscalls_create_matching_event_notifiers( | |
1005 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
3b82c4e1 | 1006 | int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group); |
a67ba386 MD |
1007 | int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); |
1008 | int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
1ec65de1 | 1009 | #else |
2d6d88c6 | 1010 | static inline int lttng_syscalls_register_event( |
a67ba386 | 1011 | struct lttng_event_enabler *event_enabler) |
1ec65de1 MD |
1012 | { |
1013 | return -ENOSYS; | |
1014 | } | |
1015 | ||
3b82c4e1 | 1016 | static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan) |
1ec65de1 MD |
1017 | { |
1018 | return 0; | |
1019 | } | |
80f87dd2 | 1020 | |
badfe9f5 MD |
1021 | static inline int lttng_syscalls_destroy(struct lttng_channel *chan) |
1022 | { | |
1023 | return 0; | |
1024 | } | |
1025 | ||
2d6d88c6 | 1026 | static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan, |
a67ba386 | 1027 | struct lttng_kernel_event_recorder *event); |
80f87dd2 MD |
1028 | { |
1029 | return -ENOSYS; | |
1030 | } | |
1031 | ||
2d6d88c6 | 1032 | static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan, |
a67ba386 | 1033 | struct lttng_kernel_event_recorder *event); |
80f87dd2 MD |
1034 | { |
1035 | return -ENOSYS; | |
1036 | } | |
12e579db | 1037 | |
f127e61e | 1038 | static inline long lttng_channel_syscall_mask(struct lttng_channel *channel, |
12e579db MD |
1039 | struct lttng_kernel_syscall_mask __user *usyscall_mask) |
1040 | { | |
1041 | return -ENOSYS; | |
1042 | } | |
dffef45d | 1043 | |
8a8ac9a8 | 1044 | static inline int lttng_syscalls_register_event_notifier( |
a67ba386 | 1045 | struct lttng_event_notifier_group *group) |
8a8ac9a8 FD |
1046 | { |
1047 | return -ENOSYS; | |
1048 | } | |
1049 | ||
3b82c4e1 | 1050 | static inline int lttng_syscalls_unregister_event_notifier_group( |
8a8ac9a8 FD |
1051 | struct lttng_event_notifier_group *group) |
1052 | { | |
1053 | return 0; | |
1054 | } | |
1055 | ||
1056 | static inline int lttng_syscall_filter_enable_event_notifier( | |
1057 | struct lttng_event_notifier_group *group, | |
1058 | const char *name) | |
1059 | { | |
1060 | return -ENOSYS; | |
1061 | } | |
1062 | ||
1063 | static inline int lttng_syscall_filter_disable_event_notifier( | |
1064 | struct lttng_event_notifier_group *group, | |
1065 | const char *name) | |
1066 | { | |
1067 | return -ENOSYS; | |
1068 | } | |
1069 | ||
1ec65de1 MD |
1070 | #endif |
1071 | ||
183e8b3a | 1072 | int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler, |
606828e4 | 1073 | struct lttng_kernel_abi_filter_bytecode __user *bytecode); |
183e8b3a | 1074 | int lttng_event_notifier_enabler_attach_filter_bytecode( |
dffef45d | 1075 | struct lttng_event_notifier_enabler *event_notifier_enabler, |
606828e4 | 1076 | struct lttng_kernel_abi_filter_bytecode __user *bytecode); |
99d223ad FD |
1077 | int lttng_event_notifier_enabler_attach_capture_bytecode( |
1078 | struct lttng_event_notifier_enabler *event_notifier_enabler, | |
606828e4 | 1079 | struct lttng_kernel_abi_capture_bytecode __user *bytecode); |
2dfda770 | 1080 | |
437d5aa5 MD |
1081 | void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc, |
1082 | struct lttng_kernel_ctx *ctx, | |
60206944 FD |
1083 | struct list_head *instance_bytecode_runtime_head, |
1084 | struct list_head *enabler_bytecode_runtime_head); | |
0648898e | 1085 | void lttng_free_event_filter_runtime(struct lttng_kernel_event_common *event); |
07dfc1d0 | 1086 | |
114667d5 MD |
1087 | int lttng_probes_init(void); |
1088 | ||
437d5aa5 | 1089 | extern struct lttng_kernel_ctx *lttng_static_ctx; |
07dfc1d0 MD |
1090 | |
1091 | int lttng_context_init(void); | |
1092 | void lttng_context_exit(void); | |
437d5aa5 MD |
1093 | int lttng_kernel_context_append(struct lttng_kernel_ctx **ctx_p, |
1094 | const struct lttng_kernel_ctx_field *f); | |
1095 | void lttng_kernel_context_remove_last(struct lttng_kernel_ctx **ctx_p); | |
1096 | struct lttng_kernel_ctx_field *lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx *ctx, | |
c02eb859 | 1097 | size_t index); |
437d5aa5 MD |
1098 | int lttng_kernel_find_context(struct lttng_kernel_ctx *ctx, const char *name); |
1099 | int lttng_kernel_get_context_index(struct lttng_kernel_ctx *ctx, const char *name); | |
1100 | void lttng_kernel_destroy_context(struct lttng_kernel_ctx *ctx); | |
1101 | int lttng_add_pid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1102 | int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx **ctx); | |
1103 | int lttng_add_procname_to_ctx(struct lttng_kernel_ctx **ctx); | |
1104 | int lttng_add_prio_to_ctx(struct lttng_kernel_ctx **ctx); | |
1105 | int lttng_add_nice_to_ctx(struct lttng_kernel_ctx **ctx); | |
1106 | int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1107 | int lttng_add_tid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1108 | int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1109 | int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1110 | int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1111 | int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx **ctx); | |
1112 | int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx **ctx); | |
1113 | int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx **ctx); | |
79150a49 | 1114 | #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT) |
437d5aa5 | 1115 | int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx); |
79150a49 JD |
1116 | #else |
1117 | static inline | |
437d5aa5 | 1118 | int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx) |
79150a49 JD |
1119 | { |
1120 | return -ENOSYS; | |
1121 | } | |
1122 | #endif | |
1123 | #ifdef CONFIG_PREEMPT_RT_FULL | |
437d5aa5 | 1124 | int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx); |
79150a49 JD |
1125 | #else |
1126 | static inline | |
437d5aa5 | 1127 | int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx) |
79150a49 JD |
1128 | { |
1129 | return -ENOSYS; | |
1130 | } | |
1131 | #endif | |
2fa2d39a | 1132 | |
437d5aa5 | 1133 | int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx **ctx, int type); |
2fa2d39a | 1134 | |
a6cf40a4 | 1135 | #if defined(CONFIG_CGROUPS) && \ |
5f4c791e | 1136 | ((LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) || \ |
a6cf40a4 | 1137 | LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0)) |
437d5aa5 | 1138 | int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1139 | #else |
1140 | static inline | |
437d5aa5 | 1141 | int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1142 | { |
1143 | return -ENOSYS; | |
1144 | } | |
1145 | #endif | |
1146 | ||
1147 | #if defined(CONFIG_IPC_NS) && \ | |
5f4c791e | 1148 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1149 | int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1150 | #else |
1151 | static inline | |
437d5aa5 | 1152 | int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1153 | { |
1154 | return -ENOSYS; | |
1155 | } | |
1156 | #endif | |
1157 | ||
1158 | #if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \ | |
5f4c791e | 1159 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1160 | int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1161 | #else |
1162 | static inline | |
437d5aa5 | 1163 | int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1164 | { |
1165 | return -ENOSYS; | |
1166 | } | |
1167 | #endif | |
1168 | ||
1169 | #if defined(CONFIG_NET_NS) && \ | |
5f4c791e | 1170 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1171 | int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1172 | #else |
1173 | static inline | |
437d5aa5 | 1174 | int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1175 | { |
1176 | return -ENOSYS; | |
1177 | } | |
1178 | #endif | |
1179 | ||
1180 | #if defined(CONFIG_PID_NS) && \ | |
5f4c791e | 1181 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1182 | int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1183 | #else |
1184 | static inline | |
437d5aa5 | 1185 | int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1186 | { |
1187 | return -ENOSYS; | |
1188 | } | |
1189 | #endif | |
1190 | ||
1191 | #if defined(CONFIG_USER_NS) && \ | |
5f4c791e | 1192 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1193 | int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1194 | #else |
1195 | static inline | |
437d5aa5 | 1196 | int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1197 | { |
1198 | return -ENOSYS; | |
1199 | } | |
1200 | #endif | |
1201 | ||
1202 | #if defined(CONFIG_UTS_NS) && \ | |
5f4c791e | 1203 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1204 | int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1205 | #else |
1206 | static inline | |
437d5aa5 | 1207 | int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1208 | { |
1209 | return -ENOSYS; | |
1210 | } | |
1211 | #endif | |
1212 | ||
876e2e92 | 1213 | #if defined(CONFIG_TIME_NS) && \ |
5f4c791e | 1214 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) |
437d5aa5 | 1215 | int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
876e2e92 MJ |
1216 | #else |
1217 | static inline | |
437d5aa5 | 1218 | int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
876e2e92 MJ |
1219 | { |
1220 | return -ENOSYS; | |
1221 | } | |
1222 | #endif | |
1223 | ||
437d5aa5 MD |
1224 | int lttng_add_uid_to_ctx(struct lttng_kernel_ctx **ctx); |
1225 | int lttng_add_euid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1226 | int lttng_add_suid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1227 | int lttng_add_gid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1228 | int lttng_add_egid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1229 | int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1230 | int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1231 | int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1232 | int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1233 | int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1234 | int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1235 | int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
dc923e75 | 1236 | |
8a3af9ee | 1237 | #if defined(CONFIG_PERF_EVENTS) |
c24a0d71 MD |
1238 | int lttng_add_perf_counter_to_ctx(uint32_t type, |
1239 | uint64_t config, | |
1240 | const char *name, | |
437d5aa5 | 1241 | struct lttng_kernel_ctx **ctx); |
1e367326 MD |
1242 | int lttng_cpuhp_perf_counter_online(unsigned int cpu, |
1243 | struct lttng_cpuhp_node *node); | |
1244 | int lttng_cpuhp_perf_counter_dead(unsigned int cpu, | |
1245 | struct lttng_cpuhp_node *node); | |
1d443b34 MD |
1246 | #else |
1247 | static inline | |
1248 | int lttng_add_perf_counter_to_ctx(uint32_t type, | |
1249 | uint64_t config, | |
1250 | const char *name, | |
437d5aa5 | 1251 | struct lttng_kernel_ctx **ctx) |
1d443b34 MD |
1252 | { |
1253 | return -ENOSYS; | |
1254 | } | |
1e367326 MD |
1255 | static inline |
1256 | int lttng_cpuhp_perf_counter_online(unsigned int cpu, | |
1257 | struct lttng_cpuhp_node *node) | |
1258 | { | |
1259 | return 0; | |
1260 | } | |
1261 | static inline | |
1262 | int lttng_cpuhp_perf_counter_dead(unsigned int cpu, | |
1263 | struct lttng_cpuhp_node *node) | |
1264 | { | |
1265 | return 0; | |
1266 | } | |
1d443b34 | 1267 | #endif |
02119ee5 | 1268 | |
0c956676 MD |
1269 | int lttng_logger_init(void); |
1270 | void lttng_logger_exit(void); | |
1271 | ||
c337ddc2 MD |
1272 | extern int lttng_statedump_start(struct lttng_session *session); |
1273 | ||
acd614cc | 1274 | #ifdef CONFIG_KPROBES |
8bf17deb | 1275 | int lttng_kprobes_register_event(const char *name, |
f17701fb MD |
1276 | const char *symbol_name, |
1277 | uint64_t offset, | |
1278 | uint64_t addr, | |
a67ba386 MD |
1279 | struct lttng_kernel_event_recorder *event); |
1280 | void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event); | |
1281 | void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event); | |
2b16f0c9 FD |
1282 | int lttng_kprobes_register_event_notifier(const char *symbol_name, |
1283 | uint64_t offset, | |
1284 | uint64_t addr, | |
a67ba386 MD |
1285 | struct lttng_kernel_event_notifier *event_notifier); |
1286 | void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
1287 | void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier); | |
acd614cc MD |
1288 | #else |
1289 | static inline | |
8bf17deb | 1290 | int lttng_kprobes_register_event(const char *name, |
acd614cc MD |
1291 | const char *symbol_name, |
1292 | uint64_t offset, | |
1293 | uint64_t addr, | |
a67ba386 | 1294 | struct lttng_kernel_event_recorder *event) |
acd614cc MD |
1295 | { |
1296 | return -ENOSYS; | |
1297 | } | |
1298 | ||
25f53c39 | 1299 | static inline |
a67ba386 | 1300 | void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event) |
8bf17deb FD |
1301 | { |
1302 | } | |
1303 | ||
1304 | static inline | |
a67ba386 | 1305 | void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event) |
acd614cc MD |
1306 | { |
1307 | } | |
edeb3137 MD |
1308 | |
1309 | static inline | |
2b16f0c9 FD |
1310 | int lttng_kprobes_register_event_notifier(const char *symbol_name, |
1311 | uint64_t offset, | |
1312 | uint64_t addr, | |
a67ba386 | 1313 | struct lttng_kernel_event_notifier *event_notifier) |
2b16f0c9 FD |
1314 | { |
1315 | return -ENOSYS; | |
1316 | } | |
1317 | ||
1318 | static inline | |
a67ba386 | 1319 | void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier) |
2b16f0c9 FD |
1320 | { |
1321 | } | |
1322 | ||
1323 | static inline | |
a67ba386 | 1324 | void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier) |
edeb3137 MD |
1325 | { |
1326 | } | |
acd614cc | 1327 | #endif |
d6d808f3 | 1328 | |
e2d5dbc7 | 1329 | int lttng_event_add_callsite(struct lttng_kernel_event_common *event, |
606828e4 | 1330 | struct lttng_kernel_abi_event_callsite __user *callsite); |
9de67196 | 1331 | |
149b9a9d | 1332 | #ifdef CONFIG_UPROBES |
83b802dc | 1333 | int lttng_uprobes_register_event(const char *name, |
a67ba386 | 1334 | int fd, struct lttng_kernel_event_recorder *event); |
e2d5dbc7 | 1335 | int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event, |
606828e4 | 1336 | struct lttng_kernel_abi_event_callsite __user *callsite); |
a67ba386 MD |
1337 | void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event); |
1338 | void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event); | |
9de67196 | 1339 | int lttng_uprobes_register_event_notifier(const char *name, |
a67ba386 | 1340 | int fd, struct lttng_kernel_event_notifier *event_notifier); |
a67ba386 MD |
1341 | void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier); |
1342 | void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier); | |
149b9a9d YB |
1343 | #else |
1344 | static inline | |
83b802dc | 1345 | int lttng_uprobes_register_event(const char *name, |
a67ba386 | 1346 | int fd, struct lttng_kernel_event_recorder *event) |
3aed4dca FD |
1347 | { |
1348 | return -ENOSYS; | |
1349 | } | |
1350 | ||
1351 | static inline | |
e2d5dbc7 | 1352 | int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event, |
606828e4 | 1353 | struct lttng_kernel_abi_event_callsite __user *callsite) |
149b9a9d YB |
1354 | { |
1355 | return -ENOSYS; | |
1356 | } | |
1357 | ||
1358 | static inline | |
a67ba386 | 1359 | void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event) |
149b9a9d YB |
1360 | { |
1361 | } | |
1362 | ||
1363 | static inline | |
a67ba386 | 1364 | void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event) |
149b9a9d YB |
1365 | { |
1366 | } | |
9de67196 FD |
1367 | |
1368 | static inline | |
1369 | int lttng_uprobes_register_event_notifier(const char *name, | |
a67ba386 | 1370 | int fd, struct lttng_kernel_event_notifier *event_notifier) |
9de67196 FD |
1371 | { |
1372 | return -ENOSYS; | |
1373 | } | |
1374 | ||
9de67196 | 1375 | static inline |
a67ba386 | 1376 | void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier) |
9de67196 FD |
1377 | { |
1378 | } | |
1379 | ||
1380 | static inline | |
a67ba386 | 1381 | void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier) |
9de67196 FD |
1382 | { |
1383 | } | |
149b9a9d YB |
1384 | #endif |
1385 | ||
7371f44c MD |
1386 | #ifdef CONFIG_KRETPROBES |
1387 | int lttng_kretprobes_register(const char *name, | |
1388 | const char *symbol_name, | |
1389 | uint64_t offset, | |
1390 | uint64_t addr, | |
a67ba386 MD |
1391 | struct lttng_kernel_event_recorder *event_entry, |
1392 | struct lttng_kernel_event_recorder *event_exit); | |
1393 | void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event); | |
1394 | void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event); | |
e2d5dbc7 | 1395 | int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event, |
a0493bef | 1396 | int enable); |
7371f44c MD |
1397 | #else |
1398 | static inline | |
1399 | int lttng_kretprobes_register(const char *name, | |
1400 | const char *symbol_name, | |
1401 | uint64_t offset, | |
1402 | uint64_t addr, | |
a67ba386 MD |
1403 | struct lttng_kernel_event_recorder *event_entry, |
1404 | struct lttng_kernel_event_recorder *event_exit) | |
7371f44c MD |
1405 | { |
1406 | return -ENOSYS; | |
1407 | } | |
1408 | ||
1409 | static inline | |
a67ba386 | 1410 | void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event) |
7371f44c MD |
1411 | { |
1412 | } | |
1413 | ||
1414 | static inline | |
a67ba386 | 1415 | void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event) |
7371f44c MD |
1416 | { |
1417 | } | |
a0493bef MD |
1418 | |
1419 | static inline | |
e2d5dbc7 | 1420 | int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event, |
a0493bef MD |
1421 | int enable) |
1422 | { | |
1423 | return -ENOSYS; | |
1424 | } | |
7371f44c MD |
1425 | #endif |
1426 | ||
606828e4 | 1427 | int lttng_calibrate(struct lttng_kernel_abi_calibrate *calibrate); |
57105fc2 | 1428 | |
271b6681 | 1429 | extern const struct file_operations lttng_tracepoint_list_fops; |
2d2464bd | 1430 | extern const struct file_operations lttng_syscall_list_fops; |
271b6681 | 1431 | |
ef200626 | 1432 | #define TRACEPOINT_HAS_DATA_ARG |
ef200626 | 1433 | |
a90917c3 | 1434 | #endif /* _LTTNG_EVENTS_H */ |