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 { |
a67ba386 MD |
331 | struct lttng_kernel_event_recorder *event; |
332 | struct lttng_kernel_event_notifier *event_notifier; // Not sure if we will ever need it. | |
79150a49 JD |
333 | uint8_t interruptible; |
334 | }; | |
335 | ||
437d5aa5 MD |
336 | struct lttng_kernel_ctx_field { |
337 | const struct lttng_kernel_event_field *event_field; | |
f1676205 | 338 | size_t (*get_size)(size_t offset); |
437d5aa5 | 339 | size_t (*get_size_arg)(size_t offset, struct lttng_kernel_ctx_field *field, |
1474c8e2 FG |
340 | struct lib_ring_buffer_ctx *ctx, |
341 | struct lttng_channel *chan); | |
437d5aa5 | 342 | void (*record)(struct lttng_kernel_ctx_field *field, |
f1676205 | 343 | struct lib_ring_buffer_ctx *ctx, |
a90917c3 | 344 | struct lttng_channel *chan); |
437d5aa5 | 345 | void (*get_value)(struct lttng_kernel_ctx_field *field, |
79150a49 | 346 | struct lttng_probe_ctx *lttng_probe_ctx, |
07dfc1d0 | 347 | union lttng_ctx_value *value); |
437d5aa5 | 348 | void (*destroy)(struct lttng_kernel_ctx_field *field); |
3c1a57e8 | 349 | void *priv; |
ba1f5986 MD |
350 | }; |
351 | ||
437d5aa5 MD |
352 | struct lttng_kernel_ctx { |
353 | struct lttng_kernel_ctx_field *fields; | |
0d1a681e | 354 | unsigned int nr_fields; |
ba1f5986 | 355 | unsigned int allocated_fields; |
a9dd15da | 356 | size_t largest_align; /* in bytes */ |
0d1a681e MD |
357 | }; |
358 | ||
437d5aa5 MD |
359 | struct lttng_kernel_event_desc { |
360 | const char *event_name; /* lttng-modules name */ | |
361 | const char *event_kname; /* Linux kernel name (tracepoints) */ | |
362 | const struct lttng_kernel_probe_desc *probe_desc; | |
363 | void (*probe_callback)(void); | |
364 | const struct lttng_kernel_event_field **fields; /* event payload */ | |
c0edae1d | 365 | unsigned int nr_fields; |
dc7f600a | 366 | struct module *owner; |
7fad9b39 | 367 | void *event_notifier_callback; |
c0edae1d MD |
368 | }; |
369 | ||
437d5aa5 MD |
370 | struct lttng_kernel_probe_desc { |
371 | const char *provider_name; | |
372 | const struct lttng_kernel_event_desc **event_desc; | |
85a9ca7f MD |
373 | unsigned int nr_events; |
374 | struct list_head head; /* chain registered probes */ | |
3c997079 MD |
375 | struct list_head lazy_init_head; |
376 | int lazy; /* lazy registration */ | |
85a9ca7f MD |
377 | }; |
378 | ||
7371f44c MD |
379 | struct lttng_krp; /* Kretprobe handling */ |
380 | ||
89ec2b91 FD |
381 | enum lttng_bytecode_node_type { |
382 | LTTNG_BYTECODE_NODE_TYPE_FILTER, | |
99d223ad | 383 | LTTNG_BYTECODE_NODE_TYPE_CAPTURE, |
89ec2b91 FD |
384 | }; |
385 | ||
386 | struct lttng_bytecode_node { | |
387 | enum lttng_bytecode_node_type type; | |
07dfc1d0 MD |
388 | struct list_head node; |
389 | struct lttng_enabler *enabler; | |
89ec2b91 FD |
390 | struct { |
391 | uint32_t len; | |
392 | uint32_t reloc_offset; | |
393 | uint64_t seqnum; | |
394 | char data[]; | |
395 | } bc; | |
07dfc1d0 MD |
396 | }; |
397 | ||
398 | /* | |
80c2a69a | 399 | * Bytecode interpreter return value masks. |
07dfc1d0 | 400 | */ |
80c2a69a FD |
401 | enum lttng_bytecode_interpreter_ret { |
402 | LTTNG_INTERPRETER_DISCARD = 0, | |
403 | LTTNG_INTERPRETER_RECORD_FLAG = (1ULL << 0), | |
07dfc1d0 MD |
404 | /* Other bits are kept for future use. */ |
405 | }; | |
406 | ||
99d223ad FD |
407 | struct lttng_interpreter_output; |
408 | ||
07dfc1d0 MD |
409 | struct lttng_bytecode_runtime { |
410 | /* Associated bytecode */ | |
89ec2b91 | 411 | struct lttng_bytecode_node *bc; |
3d650c7b FD |
412 | union { |
413 | uint64_t (*filter)(void *filter_data, | |
414 | struct lttng_probe_ctx *lttng_probe_ctx, | |
415 | const char *filter_stack_data); | |
99d223ad FD |
416 | uint64_t (*capture)(void *filter_data, |
417 | struct lttng_probe_ctx *lttng_probe_ctx, | |
418 | const char *capture_stack_data, | |
419 | struct lttng_interpreter_output *output); | |
3d650c7b | 420 | } interpreter_funcs; |
07dfc1d0 MD |
421 | int link_failed; |
422 | struct list_head node; /* list of bytecode runtime in event */ | |
437d5aa5 | 423 | struct lttng_kernel_ctx *ctx; |
07dfc1d0 MD |
424 | }; |
425 | ||
3c997079 MD |
426 | /* |
427 | * Objects in a linked-list of enablers, owned by an event. | |
428 | */ | |
429 | struct lttng_enabler_ref { | |
430 | struct list_head node; /* enabler ref list */ | |
431 | struct lttng_enabler *ref; /* backward ref */ | |
432 | }; | |
433 | ||
3aed4dca | 434 | struct lttng_uprobe_handler { |
83b802dc | 435 | union { |
a67ba386 MD |
436 | struct lttng_kernel_event_recorder *event; |
437 | struct lttng_kernel_event_notifier *event_notifier; | |
83b802dc | 438 | } u; |
3aed4dca FD |
439 | loff_t offset; |
440 | struct uprobe_consumer up_consumer; | |
441 | struct list_head node; | |
442 | }; | |
443 | ||
8bf17deb FD |
444 | struct lttng_kprobe { |
445 | struct kprobe kp; | |
446 | char *symbol_name; | |
447 | }; | |
448 | ||
83b802dc FD |
449 | struct lttng_uprobe { |
450 | struct inode *inode; | |
451 | struct list_head head; | |
452 | }; | |
453 | ||
badfe9f5 MD |
454 | enum lttng_syscall_entryexit { |
455 | LTTNG_SYSCALL_ENTRY, | |
456 | LTTNG_SYSCALL_EXIT, | |
457 | }; | |
458 | ||
459 | enum lttng_syscall_abi { | |
460 | LTTNG_SYSCALL_ABI_NATIVE, | |
461 | LTTNG_SYSCALL_ABI_COMPAT, | |
462 | }; | |
463 | ||
a67ba386 MD |
464 | struct lttng_kernel_event_common_private; |
465 | ||
466 | enum lttng_kernel_event_type { | |
467 | LTTNG_KERNEL_EVENT_TYPE_RECORDER = 0, | |
468 | LTTNG_KERNEL_EVENT_TYPE_NOTIFIER = 1, | |
469 | }; | |
470 | ||
471 | struct lttng_kernel_event_common { | |
472 | struct lttng_kernel_event_common_private *priv; /* Private event interface */ | |
473 | ||
474 | enum lttng_kernel_event_type type; | |
475 | /* Get child with container_of(). */ | |
476 | ||
e64957da | 477 | int enabled; |
a67ba386 MD |
478 | int eval_filter; /* Need to evaluate filters */ |
479 | int (*run_filter)(struct lttng_kernel_event_common *event, | |
480 | const char *stack_data, | |
481 | void *filter_ctx); | |
3c997079 MD |
482 | }; |
483 | ||
a67ba386 MD |
484 | struct lttng_kernel_event_recorder_private; |
485 | ||
486 | struct lttng_kernel_event_recorder { | |
487 | struct lttng_kernel_event_common parent; | |
488 | struct lttng_kernel_event_recorder_private *priv; /* Private event record interface */ | |
489 | ||
490 | struct lttng_channel *chan; | |
c3eddb2e MD |
491 | }; |
492 | ||
a67ba386 MD |
493 | struct lttng_kernel_notification_ctx { |
494 | int eval_capture; /* Capture evaluation available. */ | |
495 | }; | |
dffef45d | 496 | |
a67ba386 | 497 | struct lttng_kernel_event_notifier_private; |
8a8ac9a8 | 498 | |
a67ba386 MD |
499 | struct lttng_kernel_event_notifier { |
500 | struct lttng_kernel_event_common parent; | |
501 | struct lttng_kernel_event_notifier_private *priv; /* Private event notifier interface */ | |
dffef45d | 502 | |
a67ba386 MD |
503 | int eval_capture; /* Need to evaluate capture */ |
504 | void (*notification_send)(struct lttng_kernel_event_notifier *event_notifier, | |
505 | struct lttng_probe_ctx *probe_ctx, | |
506 | const char *stack_data, | |
507 | struct lttng_kernel_notification_ctx *notif_ctx); | |
dffef45d FD |
508 | }; |
509 | ||
3b861b22 FD |
510 | enum lttng_enabler_format_type { |
511 | LTTNG_ENABLER_FORMAT_STAR_GLOB, | |
512 | LTTNG_ENABLER_FORMAT_NAME, | |
3c997079 MD |
513 | }; |
514 | ||
515 | /* | |
516 | * Enabler field, within whatever object is enabling an event. Target of | |
517 | * backward reference. | |
518 | */ | |
519 | struct lttng_enabler { | |
3b861b22 | 520 | enum lttng_enabler_format_type format_type; |
3c997079 | 521 | |
608ab495 | 522 | /* head list of struct lttng_bytecode_node */ |
07dfc1d0 | 523 | struct list_head filter_bytecode_head; |
3c997079 | 524 | |
606828e4 | 525 | struct lttng_kernel_abi_event event_param; |
b2bc0bc8 | 526 | unsigned int enabled:1; |
dffef45d FD |
527 | |
528 | uint64_t user_token; /* User-provided token. */ | |
b2bc0bc8 FD |
529 | }; |
530 | ||
531 | struct lttng_event_enabler { | |
532 | struct lttng_enabler base; | |
533 | struct list_head node; /* per-session list of enablers */ | |
3c997079 | 534 | struct lttng_channel *chan; |
85a9ca7f MD |
535 | }; |
536 | ||
dffef45d FD |
537 | struct lttng_event_notifier_enabler { |
538 | struct lttng_enabler base; | |
99f52fcc | 539 | uint64_t error_counter_index; |
dffef45d FD |
540 | struct list_head node; /* List of event_notifier enablers */ |
541 | struct lttng_event_notifier_group *group; | |
99d223ad FD |
542 | |
543 | /* head list of struct lttng_bytecode_node */ | |
544 | struct list_head capture_bytecode_head; | |
545 | uint64_t num_captures; | |
dffef45d FD |
546 | }; |
547 | ||
99d223ad | 548 | |
b2bc0bc8 FD |
549 | static inline |
550 | struct lttng_enabler *lttng_event_enabler_as_enabler( | |
551 | struct lttng_event_enabler *event_enabler) | |
552 | { | |
553 | return &event_enabler->base; | |
554 | } | |
555 | ||
dffef45d FD |
556 | static inline |
557 | struct lttng_enabler *lttng_event_notifier_enabler_as_enabler( | |
558 | struct lttng_event_notifier_enabler *event_notifier_enabler) | |
559 | { | |
560 | return &event_notifier_enabler->base; | |
561 | } | |
b2bc0bc8 | 562 | |
a90917c3 | 563 | struct lttng_channel_ops { |
85a9ca7f | 564 | struct channel *(*channel_create)(const char *name, |
5cf4b87c | 565 | void *priv, |
85a9ca7f MD |
566 | void *buf_addr, |
567 | size_t subbuf_size, size_t num_subbuf, | |
568 | unsigned int switch_timer_interval, | |
569 | unsigned int read_timer_interval); | |
570 | void (*channel_destroy)(struct channel *chan); | |
571 | struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan); | |
f71ecafa | 572 | int (*buffer_has_read_closed_stream)(struct channel *chan); |
85a9ca7f | 573 | void (*buffer_read_close)(struct lib_ring_buffer *buf); |
4e1f08f4 | 574 | int (*event_reserve)(struct lib_ring_buffer_ctx *ctx, |
64c796d8 | 575 | uint32_t event_id); |
85a9ca7f MD |
576 | void (*event_commit)(struct lib_ring_buffer_ctx *ctx); |
577 | void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src, | |
578 | size_t len); | |
4ea00e4f JD |
579 | void (*event_write_from_user)(struct lib_ring_buffer_ctx *ctx, |
580 | const void *src, size_t len); | |
58aa5d24 MD |
581 | void (*event_memset)(struct lib_ring_buffer_ctx *ctx, |
582 | int c, size_t len); | |
16f78f3a MD |
583 | void (*event_strcpy)(struct lib_ring_buffer_ctx *ctx, const char *src, |
584 | size_t len); | |
585 | void (*event_strcpy_from_user)(struct lib_ring_buffer_ctx *ctx, | |
586 | const char __user *src, size_t len); | |
1ec3f75a MD |
587 | /* |
588 | * packet_avail_size returns the available size in the current | |
589 | * packet. Note that the size returned is only a hint, since it | |
590 | * may change due to concurrent writes. | |
591 | */ | |
592 | size_t (*packet_avail_size)(struct channel *chan); | |
71c1d843 | 593 | wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu); |
24cedcfe MD |
594 | wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan); |
595 | int (*is_finalized)(struct channel *chan); | |
254ec7bc | 596 | int (*is_disabled)(struct channel *chan); |
3b731ab1 JD |
597 | int (*timestamp_begin) (const struct lib_ring_buffer_config *config, |
598 | struct lib_ring_buffer *bufb, | |
599 | uint64_t *timestamp_begin); | |
600 | int (*timestamp_end) (const struct lib_ring_buffer_config *config, | |
601 | struct lib_ring_buffer *bufb, | |
602 | uint64_t *timestamp_end); | |
603 | int (*events_discarded) (const struct lib_ring_buffer_config *config, | |
604 | struct lib_ring_buffer *bufb, | |
605 | uint64_t *events_discarded); | |
606 | int (*content_size) (const struct lib_ring_buffer_config *config, | |
607 | struct lib_ring_buffer *bufb, | |
608 | uint64_t *content_size); | |
609 | int (*packet_size) (const struct lib_ring_buffer_config *config, | |
610 | struct lib_ring_buffer *bufb, | |
611 | uint64_t *packet_size); | |
612 | int (*stream_id) (const struct lib_ring_buffer_config *config, | |
613 | struct lib_ring_buffer *bufb, | |
614 | uint64_t *stream_id); | |
2348ca17 JD |
615 | int (*current_timestamp) (const struct lib_ring_buffer_config *config, |
616 | struct lib_ring_buffer *bufb, | |
617 | uint64_t *ts); | |
5b3cf4f9 JD |
618 | int (*sequence_number) (const struct lib_ring_buffer_config *config, |
619 | struct lib_ring_buffer *bufb, | |
620 | uint64_t *seq); | |
5594698f JD |
621 | int (*instance_id) (const struct lib_ring_buffer_config *config, |
622 | struct lib_ring_buffer *bufb, | |
623 | uint64_t *id); | |
85a9ca7f MD |
624 | }; |
625 | ||
a101fa10 MD |
626 | struct lttng_counter_ops { |
627 | struct lib_counter *(*counter_create)(size_t nr_dimensions, | |
628 | const size_t *max_nr_elem, /* for each dimension */ | |
629 | int64_t global_sum_step); | |
630 | void (*counter_destroy)(struct lib_counter *counter); | |
631 | int (*counter_add)(struct lib_counter *counter, const size_t *dimension_indexes, | |
632 | int64_t v); | |
633 | /* | |
634 | * counter_read reads a specific cpu's counter if @cpu >= 0, or | |
635 | * the global aggregation counter if @cpu == -1. | |
636 | */ | |
637 | int (*counter_read)(struct lib_counter *counter, const size_t *dimension_indexes, int cpu, | |
638 | int64_t *value, bool *overflow, bool *underflow); | |
639 | /* | |
640 | * counter_aggregate returns the total sum of all per-cpu counters and | |
641 | * the global aggregation counter. | |
642 | */ | |
643 | int (*counter_aggregate)(struct lib_counter *counter, const size_t *dimension_indexes, | |
644 | int64_t *value, bool *overflow, bool *underflow); | |
645 | int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes); | |
646 | }; | |
647 | ||
a90917c3 | 648 | struct lttng_transport { |
a33c9927 MD |
649 | char *name; |
650 | struct module *owner; | |
651 | struct list_head node; | |
a90917c3 | 652 | struct lttng_channel_ops ops; |
a33c9927 MD |
653 | }; |
654 | ||
a101fa10 MD |
655 | struct lttng_counter_transport { |
656 | char *name; | |
657 | struct module *owner; | |
658 | struct list_head node; | |
659 | struct lttng_counter_ops ops; | |
660 | }; | |
661 | ||
80f87dd2 MD |
662 | struct lttng_syscall_filter; |
663 | ||
3c997079 MD |
664 | #define LTTNG_EVENT_HT_BITS 12 |
665 | #define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS) | |
666 | ||
667 | struct lttng_event_ht { | |
668 | struct hlist_head table[LTTNG_EVENT_HT_SIZE]; | |
669 | }; | |
670 | ||
dffef45d FD |
671 | #define LTTNG_EVENT_NOTIFIER_HT_BITS 12 |
672 | #define LTTNG_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_EVENT_NOTIFIER_HT_BITS) | |
673 | ||
674 | struct lttng_event_notifier_ht { | |
675 | struct hlist_head table[LTTNG_EVENT_NOTIFIER_HT_SIZE]; | |
676 | }; | |
677 | ||
a90917c3 | 678 | struct lttng_channel { |
c099397a | 679 | unsigned int id; |
85a9ca7f | 680 | struct channel *chan; /* Channel buffers */ |
e64957da | 681 | int enabled; |
437d5aa5 | 682 | struct lttng_kernel_ctx *ctx; |
85a9ca7f | 683 | /* Event ID management */ |
a90917c3 | 684 | struct lttng_session *session; |
85a9ca7f MD |
685 | struct file *file; /* File associated to channel */ |
686 | unsigned int free_event_id; /* Next event ID to allocate */ | |
687 | struct list_head list; /* Channel list */ | |
a90917c3 MD |
688 | struct lttng_channel_ops *ops; |
689 | struct lttng_transport *transport; | |
3b82c4e1 MD |
690 | struct hlist_head *sc_table; /* for syscall tracing */ |
691 | struct hlist_head *compat_sc_table; | |
692 | struct hlist_head *sc_exit_table; /* for syscall exit tracing */ | |
693 | struct hlist_head *compat_sc_exit_table; | |
694 | struct hlist_head sc_unknown; /* for unknown syscalls */ | |
695 | struct hlist_head sc_compat_unknown; | |
696 | struct hlist_head sc_exit_unknown; | |
697 | struct hlist_head compat_sc_exit_unknown; | |
80f87dd2 | 698 | struct lttng_syscall_filter *sc_filter; |
9115fbdc | 699 | int header_type; /* 0: unset, 1: compact, 2: large */ |
d83004aa | 700 | enum channel_type channel_type; |
3b82c4e1 MD |
701 | int syscall_all_entry; |
702 | int syscall_all_exit; | |
80f87dd2 MD |
703 | unsigned int metadata_dumped:1, |
704 | sys_enter_registered:1, | |
705 | sys_exit_registered:1, | |
3c997079 | 706 | tstate:1; /* Transient enable state */ |
85a9ca7f MD |
707 | }; |
708 | ||
d83004aa JD |
709 | struct lttng_metadata_stream { |
710 | void *priv; /* Ring buffer private data */ | |
711 | struct lttng_metadata_cache *metadata_cache; | |
f613e3e6 MD |
712 | unsigned int metadata_in; /* Bytes read from the cache */ |
713 | unsigned int metadata_out; /* Bytes consumed from stream */ | |
d83004aa JD |
714 | int finalized; /* Has channel been finalized */ |
715 | wait_queue_head_t read_wait; /* Reader buffer-level wait queue */ | |
716 | struct list_head list; /* Stream list */ | |
b3b8072b | 717 | struct lttng_transport *transport; |
9616f0bf | 718 | uint64_t version; /* Current version of the metadata cache */ |
8b97fd42 | 719 | bool coherent; /* Stream in a coherent state */ |
d83004aa JD |
720 | }; |
721 | ||
114667d5 MD |
722 | #define LTTNG_DYNAMIC_LEN_STACK_SIZE 128 |
723 | ||
724 | struct lttng_dynamic_len_stack { | |
725 | size_t stack[LTTNG_DYNAMIC_LEN_STACK_SIZE]; | |
726 | size_t offset; | |
727 | }; | |
728 | ||
729 | DECLARE_PER_CPU(struct lttng_dynamic_len_stack, lttng_dynamic_len_stack); | |
e0130fab MD |
730 | |
731 | /* | |
d1f652f8 | 732 | * struct lttng_id_tracker declared in header due to deferencing of *v |
e0130fab MD |
733 | * in RCU_INITIALIZER(v). |
734 | */ | |
d1f652f8 MD |
735 | #define LTTNG_ID_HASH_BITS 6 |
736 | #define LTTNG_ID_TABLE_SIZE (1 << LTTNG_ID_HASH_BITS) | |
e0130fab | 737 | |
d1f652f8 MD |
738 | enum tracker_type { |
739 | TRACKER_PID, | |
740 | TRACKER_VPID, | |
741 | TRACKER_UID, | |
742 | TRACKER_VUID, | |
743 | TRACKER_GID, | |
744 | TRACKER_VGID, | |
745 | ||
746 | TRACKER_UNKNOWN, | |
747 | }; | |
748 | ||
749 | struct lttng_id_tracker_rcu { | |
750 | struct hlist_head id_hash[LTTNG_ID_TABLE_SIZE]; | |
751 | }; | |
752 | ||
753 | struct lttng_id_tracker { | |
754 | struct lttng_session *session; | |
755 | enum tracker_type tracker_type; | |
756 | struct lttng_id_tracker_rcu *p; /* RCU dereferenced. */ | |
e0130fab MD |
757 | }; |
758 | ||
d1f652f8 | 759 | struct lttng_id_hash_node { |
7e6f9ef6 | 760 | struct hlist_node hlist; |
d1f652f8 | 761 | int id; |
7e6f9ef6 MD |
762 | }; |
763 | ||
a90917c3 | 764 | struct lttng_session { |
85a9ca7f | 765 | int active; /* Is trace session active ? */ |
8070f5c0 | 766 | int been_active; /* Has trace session been active ? */ |
85a9ca7f MD |
767 | struct file *file; /* File associated to session */ |
768 | struct list_head chan; /* Channel list head */ | |
769 | struct list_head events; /* Event list head */ | |
770 | struct list_head list; /* Session list */ | |
c099397a | 771 | unsigned int free_chan_id; /* Next chan ID to allocate */ |
d793d5e1 | 772 | uuid_le uuid; /* Trace session unique ID */ |
d83004aa | 773 | struct lttng_metadata_cache *metadata_cache; |
d1f652f8 MD |
774 | struct lttng_id_tracker pid_tracker; |
775 | struct lttng_id_tracker vpid_tracker; | |
776 | struct lttng_id_tracker uid_tracker; | |
777 | struct lttng_id_tracker vuid_tracker; | |
778 | struct lttng_id_tracker gid_tracker; | |
779 | struct lttng_id_tracker vgid_tracker; | |
3c997079 MD |
780 | unsigned int metadata_dumped:1, |
781 | tstate:1; /* Transient enable state */ | |
b2bc0bc8 | 782 | /* List of event enablers */ |
3c997079 MD |
783 | struct list_head enablers_head; |
784 | /* Hash table of events */ | |
785 | struct lttng_event_ht events_ht; | |
606828e4 MD |
786 | char name[LTTNG_KERNEL_ABI_SESSION_NAME_LEN]; |
787 | char creation_time[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN]; | |
85a9ca7f MD |
788 | }; |
789 | ||
99f52fcc FD |
790 | struct lttng_counter { |
791 | struct file *file; /* File associated to counter. */ | |
792 | struct file *owner; | |
793 | struct lttng_counter_transport *transport; | |
794 | struct lib_counter *counter; | |
795 | struct lttng_counter_ops *ops; | |
796 | }; | |
797 | ||
750b05f2 FD |
798 | struct lttng_event_notifier_group { |
799 | struct file *file; /* File associated to event notifier group */ | |
21f58fb7 | 800 | struct file *notif_file; /* File used to expose notifications to userspace. */ |
750b05f2 | 801 | struct list_head node; /* event notifier group list */ |
dffef45d FD |
802 | struct list_head enablers_head; /* List of enablers */ |
803 | struct list_head event_notifiers_head; /* List of event notifier */ | |
804 | struct lttng_event_notifier_ht event_notifiers_ht; /* Hash table of event notifiers */ | |
750b05f2 FD |
805 | struct lttng_channel_ops *ops; |
806 | struct lttng_transport *transport; | |
807 | struct channel *chan; /* Ring buffer channel for event notifier group. */ | |
808 | struct lib_ring_buffer *buf; /* Ring buffer for event notifier group. */ | |
21f58fb7 FD |
809 | wait_queue_head_t read_wait; |
810 | struct irq_work wakeup_pending; /* Pending wakeup irq work. */ | |
a67ba386 MD |
811 | struct lttng_kernel_event_notifier *sc_unknown; /* for unknown syscalls */ |
812 | struct lttng_kernel_event_notifier *sc_compat_unknown; | |
8a8ac9a8 FD |
813 | |
814 | struct lttng_syscall_filter *sc_filter; | |
815 | ||
816 | struct hlist_head *event_notifier_syscall_dispatch; | |
817 | struct hlist_head *event_notifier_compat_syscall_dispatch; | |
818 | struct hlist_head *event_notifier_exit_syscall_dispatch; | |
819 | struct hlist_head *event_notifier_exit_compat_syscall_dispatch; | |
820 | ||
821 | struct hlist_head event_notifier_unknown_syscall_dispatch; | |
822 | struct hlist_head event_notifier_compat_unknown_syscall_dispatch; | |
823 | struct hlist_head event_notifier_exit_unknown_syscall_dispatch; | |
824 | struct hlist_head event_notifier_exit_compat_unknown_syscall_dispatch; | |
825 | ||
826 | int syscall_all_entry; | |
827 | int syscall_all_exit; | |
828 | ||
829 | unsigned int sys_enter_registered:1, sys_exit_registered:1; | |
830 | ||
831 | struct lttng_counter *error_counter; | |
832 | size_t error_counter_len; | |
750b05f2 FD |
833 | }; |
834 | ||
d83004aa JD |
835 | struct lttng_metadata_cache { |
836 | char *data; /* Metadata cache */ | |
837 | unsigned int cache_alloc; /* Metadata allocated size (bytes) */ | |
838 | unsigned int metadata_written; /* Number of bytes written in metadata cache */ | |
3e75e2a7 | 839 | atomic_t producing; /* Metadata being produced (incomplete) */ |
d83004aa JD |
840 | struct kref refcount; /* Metadata cache usage */ |
841 | struct list_head metadata_stream; /* Metadata stream list */ | |
a36580d5 | 842 | uuid_le uuid; /* Trace session unique ID (copy) */ |
9616f0bf JD |
843 | struct mutex lock; /* Produce/consume lock */ |
844 | uint64_t version; /* Current version of the metadata */ | |
d83004aa JD |
845 | }; |
846 | ||
3c997079 MD |
847 | void lttng_lock_sessions(void); |
848 | void lttng_unlock_sessions(void); | |
849 | ||
850 | struct list_head *lttng_get_probe_list_head(void); | |
851 | ||
b2bc0bc8 FD |
852 | struct lttng_event_enabler *lttng_event_enabler_create( |
853 | enum lttng_enabler_format_type format_type, | |
606828e4 | 854 | struct lttng_kernel_abi_event *event_param, |
3c997079 MD |
855 | struct lttng_channel *chan); |
856 | ||
b2bc0bc8 FD |
857 | int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler); |
858 | int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler); | |
dffef45d FD |
859 | struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create( |
860 | struct lttng_event_notifier_group *event_notifier_group, | |
861 | enum lttng_enabler_format_type format_type, | |
606828e4 | 862 | struct lttng_kernel_abi_event_notifier *event_notifier_param); |
dffef45d FD |
863 | |
864 | int lttng_event_notifier_enabler_enable( | |
865 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
866 | int lttng_event_notifier_enabler_disable( | |
867 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
3c997079 | 868 | int lttng_fix_pending_events(void); |
b01155ba | 869 | int lttng_fix_pending_event_notifiers(void); |
3c997079 | 870 | int lttng_session_active(void); |
b01155ba | 871 | bool lttng_event_notifier_active(void); |
3c997079 | 872 | |
a90917c3 MD |
873 | struct lttng_session *lttng_session_create(void); |
874 | int lttng_session_enable(struct lttng_session *session); | |
875 | int lttng_session_disable(struct lttng_session *session); | |
876 | void lttng_session_destroy(struct lttng_session *session); | |
9616f0bf | 877 | int lttng_session_metadata_regenerate(struct lttng_session *session); |
601252cf | 878 | int lttng_session_statedump(struct lttng_session *session); |
d83004aa | 879 | void metadata_cache_destroy(struct kref *kref); |
4e3c1b9b | 880 | |
99f52fcc FD |
881 | struct lttng_counter *lttng_kernel_counter_create( |
882 | const char *counter_transport_name, size_t number_dimensions, | |
883 | const size_t *dimensions_sizes); | |
884 | int lttng_kernel_counter_read(struct lttng_counter *counter, | |
885 | const size_t *dimension_indexes, int32_t cpu, | |
886 | int64_t *val, bool *overflow, bool *underflow); | |
887 | int lttng_kernel_counter_aggregate(struct lttng_counter *counter, | |
888 | const size_t *dimension_indexes, int64_t *val, | |
889 | bool *overflow, bool *underflow); | |
890 | int lttng_kernel_counter_clear(struct lttng_counter *counter, | |
891 | const size_t *dimension_indexes); | |
892 | ||
893 | ||
750b05f2 | 894 | struct lttng_event_notifier_group *lttng_event_notifier_group_create(void); |
99f52fcc FD |
895 | int lttng_event_notifier_group_create_error_counter( |
896 | struct file *event_notifier_group_file, | |
606828e4 | 897 | const struct lttng_kernel_abi_counter_conf *error_counter_conf); |
750b05f2 FD |
898 | void lttng_event_notifier_group_destroy( |
899 | struct lttng_event_notifier_group *event_notifier_group); | |
900 | ||
a90917c3 | 901 | struct lttng_channel *lttng_channel_create(struct lttng_session *session, |
5dbbdb43 MD |
902 | const char *transport_name, |
903 | void *buf_addr, | |
904 | size_t subbuf_size, size_t num_subbuf, | |
905 | unsigned int switch_timer_interval, | |
d83004aa JD |
906 | unsigned int read_timer_interval, |
907 | enum channel_type channel_type); | |
a90917c3 | 908 | struct lttng_channel *lttng_global_channel_create(struct lttng_session *session, |
4e3c1b9b MD |
909 | int overwrite, void *buf_addr, |
910 | size_t subbuf_size, size_t num_subbuf, | |
911 | unsigned int switch_timer_interval, | |
912 | unsigned int read_timer_interval); | |
4e3c1b9b | 913 | |
d83004aa | 914 | void lttng_metadata_channel_destroy(struct lttng_channel *chan); |
a67ba386 | 915 | struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan, |
606828e4 | 916 | struct lttng_kernel_abi_event *event_param, |
437d5aa5 | 917 | const struct lttng_kernel_event_desc *event_desc, |
606828e4 | 918 | enum lttng_kernel_abi_instrumentation itype); |
a67ba386 | 919 | struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan, |
606828e4 | 920 | struct lttng_kernel_abi_event *event_param, |
437d5aa5 | 921 | const struct lttng_kernel_event_desc *event_desc, |
606828e4 | 922 | enum lttng_kernel_abi_instrumentation itype); |
a67ba386 | 923 | struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_channel *chan, |
606828e4 | 924 | struct lttng_kernel_abi_old_event *old_event_param, |
437d5aa5 | 925 | const struct lttng_kernel_event_desc *internal_desc); |
c0e31d2e | 926 | |
a67ba386 | 927 | struct lttng_kernel_event_notifier *lttng_event_notifier_create( |
437d5aa5 | 928 | const struct lttng_kernel_event_desc *event_notifier_desc, |
dffef45d | 929 | uint64_t id, |
99f52fcc | 930 | uint64_t error_counter_idx, |
dffef45d | 931 | struct lttng_event_notifier_group *event_notifier_group, |
606828e4 | 932 | struct lttng_kernel_abi_event_notifier *event_notifier_param, |
606828e4 | 933 | enum lttng_kernel_abi_instrumentation itype); |
a67ba386 | 934 | struct lttng_kernel_event_notifier *_lttng_event_notifier_create( |
437d5aa5 | 935 | const struct lttng_kernel_event_desc *event_notifier_desc, |
dffef45d | 936 | uint64_t id, |
99f52fcc | 937 | uint64_t error_counter_idx, |
dffef45d | 938 | struct lttng_event_notifier_group *event_notifier_group, |
606828e4 | 939 | struct lttng_kernel_abi_event_notifier *event_notifier_param, |
606828e4 | 940 | enum lttng_kernel_abi_instrumentation itype); |
dffef45d | 941 | |
a90917c3 MD |
942 | int lttng_channel_enable(struct lttng_channel *channel); |
943 | int lttng_channel_disable(struct lttng_channel *channel); | |
a67ba386 MD |
944 | int lttng_event_enable(struct lttng_kernel_event_recorder *event); |
945 | int lttng_event_disable(struct lttng_kernel_event_recorder *event); | |
e64957da | 946 | |
a67ba386 MD |
947 | int lttng_event_notifier_enable(struct lttng_kernel_event_notifier *event_notifier); |
948 | int lttng_event_notifier_disable(struct lttng_kernel_event_notifier *event_notifier); | |
2b16f0c9 | 949 | |
a90917c3 MD |
950 | void lttng_transport_register(struct lttng_transport *transport); |
951 | void lttng_transport_unregister(struct lttng_transport *transport); | |
11b5a3c2 | 952 | |
a101fa10 MD |
953 | void lttng_counter_transport_register(struct lttng_counter_transport *transport); |
954 | void lttng_counter_transport_unregister(struct lttng_counter_transport *transport); | |
955 | ||
360f38ea | 956 | void synchronize_trace(void); |
80996790 | 957 | int lttng_abi_init(void); |
6dccd6c1 | 958 | int lttng_abi_compat_old_init(void); |
80996790 | 959 | void lttng_abi_exit(void); |
6dccd6c1 | 960 | void lttng_abi_compat_old_exit(void); |
1c25284c | 961 | |
437d5aa5 MD |
962 | int lttng_probe_register(struct lttng_kernel_probe_desc *desc); |
963 | void lttng_probe_unregister(struct lttng_kernel_probe_desc *desc); | |
964 | const struct lttng_kernel_event_desc *lttng_event_desc_get(const char *name); | |
965 | void lttng_event_desc_put(const struct lttng_kernel_event_desc *desc); | |
a90917c3 MD |
966 | int lttng_probes_init(void); |
967 | void lttng_probes_exit(void); | |
1ec65de1 | 968 | |
b3b8072b | 969 | int lttng_metadata_output_channel(struct lttng_metadata_stream *stream, |
8b97fd42 | 970 | struct channel *chan, bool *coherent); |
d83004aa | 971 | |
d1f652f8 MD |
972 | int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node *node); |
973 | int lttng_id_tracker_empty_set(struct lttng_id_tracker *lf); | |
974 | void lttng_id_tracker_destroy(struct lttng_id_tracker *lf, bool rcu); | |
975 | bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu *p, int id); | |
976 | int lttng_id_tracker_add(struct lttng_id_tracker *lf, int id); | |
977 | int lttng_id_tracker_del(struct lttng_id_tracker *lf, int id); | |
e0130fab | 978 | |
d1f652f8 MD |
979 | int lttng_session_track_id(struct lttng_session *session, |
980 | enum tracker_type tracker_type, int id); | |
981 | int lttng_session_untrack_id(struct lttng_session *session, | |
982 | enum tracker_type tracker_type, int id); | |
e0130fab | 983 | |
d1f652f8 MD |
984 | int lttng_session_list_tracker_ids(struct lttng_session *session, |
985 | enum tracker_type tracker_type); | |
7e6f9ef6 | 986 | |
2754583e MD |
987 | void lttng_clock_ref(void); |
988 | void lttng_clock_unref(void); | |
989 | ||
437d5aa5 | 990 | int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc, |
8a8ac9a8 FD |
991 | struct lttng_enabler *enabler); |
992 | ||
3a523f5b | 993 | #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) |
a67ba386 | 994 | int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler); |
3b82c4e1 | 995 | int lttng_syscalls_unregister_channel(struct lttng_channel *chan); |
2d6d88c6 | 996 | int lttng_syscalls_destroy_event(struct lttng_channel *chan); |
ade8a729 FD |
997 | int lttng_syscall_filter_enable_event( |
998 | struct lttng_channel *chan, | |
a67ba386 | 999 | struct lttng_kernel_event_recorder *event); |
ade8a729 FD |
1000 | int lttng_syscall_filter_disable_event( |
1001 | struct lttng_channel *chan, | |
a67ba386 | 1002 | struct lttng_kernel_event_recorder *event); |
ade8a729 | 1003 | |
12e579db | 1004 | long lttng_channel_syscall_mask(struct lttng_channel *channel, |
606828e4 | 1005 | struct lttng_kernel_abi_syscall_mask __user *usyscall_mask); |
2d6d88c6 | 1006 | |
8a8ac9a8 | 1007 | int lttng_syscalls_register_event_notifier( |
a67ba386 MD |
1008 | struct lttng_event_notifier_enabler *event_notifier_enabler); |
1009 | int lttng_syscalls_create_matching_event_notifiers( | |
1010 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
3b82c4e1 | 1011 | int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group); |
a67ba386 MD |
1012 | int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); |
1013 | int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
1ec65de1 | 1014 | #else |
2d6d88c6 | 1015 | static inline int lttng_syscalls_register_event( |
a67ba386 | 1016 | struct lttng_event_enabler *event_enabler) |
1ec65de1 MD |
1017 | { |
1018 | return -ENOSYS; | |
1019 | } | |
1020 | ||
3b82c4e1 | 1021 | static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan) |
1ec65de1 MD |
1022 | { |
1023 | return 0; | |
1024 | } | |
80f87dd2 | 1025 | |
badfe9f5 MD |
1026 | static inline int lttng_syscalls_destroy(struct lttng_channel *chan) |
1027 | { | |
1028 | return 0; | |
1029 | } | |
1030 | ||
2d6d88c6 | 1031 | static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan, |
a67ba386 | 1032 | struct lttng_kernel_event_recorder *event); |
80f87dd2 MD |
1033 | { |
1034 | return -ENOSYS; | |
1035 | } | |
1036 | ||
2d6d88c6 | 1037 | static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan, |
a67ba386 | 1038 | struct lttng_kernel_event_recorder *event); |
80f87dd2 MD |
1039 | { |
1040 | return -ENOSYS; | |
1041 | } | |
12e579db | 1042 | |
f127e61e | 1043 | static inline long lttng_channel_syscall_mask(struct lttng_channel *channel, |
12e579db MD |
1044 | struct lttng_kernel_syscall_mask __user *usyscall_mask) |
1045 | { | |
1046 | return -ENOSYS; | |
1047 | } | |
dffef45d | 1048 | |
8a8ac9a8 | 1049 | static inline int lttng_syscalls_register_event_notifier( |
a67ba386 | 1050 | struct lttng_event_notifier_group *group) |
8a8ac9a8 FD |
1051 | { |
1052 | return -ENOSYS; | |
1053 | } | |
1054 | ||
3b82c4e1 | 1055 | static inline int lttng_syscalls_unregister_event_notifier_group( |
8a8ac9a8 FD |
1056 | struct lttng_event_notifier_group *group) |
1057 | { | |
1058 | return 0; | |
1059 | } | |
1060 | ||
1061 | static inline int lttng_syscall_filter_enable_event_notifier( | |
1062 | struct lttng_event_notifier_group *group, | |
1063 | const char *name) | |
1064 | { | |
1065 | return -ENOSYS; | |
1066 | } | |
1067 | ||
1068 | static inline int lttng_syscall_filter_disable_event_notifier( | |
1069 | struct lttng_event_notifier_group *group, | |
1070 | const char *name) | |
1071 | { | |
1072 | return -ENOSYS; | |
1073 | } | |
1074 | ||
1ec65de1 MD |
1075 | #endif |
1076 | ||
183e8b3a | 1077 | int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler, |
606828e4 | 1078 | struct lttng_kernel_abi_filter_bytecode __user *bytecode); |
183e8b3a | 1079 | int lttng_event_notifier_enabler_attach_filter_bytecode( |
dffef45d | 1080 | struct lttng_event_notifier_enabler *event_notifier_enabler, |
606828e4 | 1081 | struct lttng_kernel_abi_filter_bytecode __user *bytecode); |
99d223ad FD |
1082 | int lttng_event_notifier_enabler_attach_capture_bytecode( |
1083 | struct lttng_event_notifier_enabler *event_notifier_enabler, | |
606828e4 | 1084 | struct lttng_kernel_abi_capture_bytecode __user *bytecode); |
2dfda770 | 1085 | |
437d5aa5 MD |
1086 | void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc, |
1087 | struct lttng_kernel_ctx *ctx, | |
60206944 FD |
1088 | struct list_head *instance_bytecode_runtime_head, |
1089 | struct list_head *enabler_bytecode_runtime_head); | |
a67ba386 MD |
1090 | void lttng_free_event_filter_runtime(struct lttng_kernel_event_recorder *event); |
1091 | void lttng_free_event_notifier_filter_runtime(struct lttng_kernel_event_notifier *event_notifier); | |
07dfc1d0 | 1092 | |
114667d5 MD |
1093 | int lttng_probes_init(void); |
1094 | ||
437d5aa5 | 1095 | extern struct lttng_kernel_ctx *lttng_static_ctx; |
07dfc1d0 MD |
1096 | |
1097 | int lttng_context_init(void); | |
1098 | void lttng_context_exit(void); | |
437d5aa5 MD |
1099 | int lttng_kernel_context_append(struct lttng_kernel_ctx **ctx_p, |
1100 | const struct lttng_kernel_ctx_field *f); | |
1101 | void lttng_kernel_context_remove_last(struct lttng_kernel_ctx **ctx_p); | |
1102 | struct lttng_kernel_ctx_field *lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx *ctx, | |
c02eb859 | 1103 | size_t index); |
437d5aa5 MD |
1104 | int lttng_kernel_find_context(struct lttng_kernel_ctx *ctx, const char *name); |
1105 | int lttng_kernel_get_context_index(struct lttng_kernel_ctx *ctx, const char *name); | |
1106 | void lttng_kernel_destroy_context(struct lttng_kernel_ctx *ctx); | |
1107 | int lttng_add_pid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1108 | int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx **ctx); | |
1109 | int lttng_add_procname_to_ctx(struct lttng_kernel_ctx **ctx); | |
1110 | int lttng_add_prio_to_ctx(struct lttng_kernel_ctx **ctx); | |
1111 | int lttng_add_nice_to_ctx(struct lttng_kernel_ctx **ctx); | |
1112 | int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1113 | int lttng_add_tid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1114 | int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1115 | int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1116 | int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1117 | int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx **ctx); | |
1118 | int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx **ctx); | |
1119 | int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx **ctx); | |
79150a49 | 1120 | #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT) |
437d5aa5 | 1121 | int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx); |
79150a49 JD |
1122 | #else |
1123 | static inline | |
437d5aa5 | 1124 | int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx) |
79150a49 JD |
1125 | { |
1126 | return -ENOSYS; | |
1127 | } | |
1128 | #endif | |
1129 | #ifdef CONFIG_PREEMPT_RT_FULL | |
437d5aa5 | 1130 | int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx); |
79150a49 JD |
1131 | #else |
1132 | static inline | |
437d5aa5 | 1133 | int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx) |
79150a49 JD |
1134 | { |
1135 | return -ENOSYS; | |
1136 | } | |
1137 | #endif | |
2fa2d39a | 1138 | |
437d5aa5 | 1139 | int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx **ctx, int type); |
2fa2d39a | 1140 | |
a6cf40a4 | 1141 | #if defined(CONFIG_CGROUPS) && \ |
5f4c791e | 1142 | ((LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) || \ |
a6cf40a4 | 1143 | LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0)) |
437d5aa5 | 1144 | int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1145 | #else |
1146 | static inline | |
437d5aa5 | 1147 | int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1148 | { |
1149 | return -ENOSYS; | |
1150 | } | |
1151 | #endif | |
1152 | ||
1153 | #if defined(CONFIG_IPC_NS) && \ | |
5f4c791e | 1154 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1155 | int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1156 | #else |
1157 | static inline | |
437d5aa5 | 1158 | int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1159 | { |
1160 | return -ENOSYS; | |
1161 | } | |
1162 | #endif | |
1163 | ||
1164 | #if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \ | |
5f4c791e | 1165 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1166 | int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1167 | #else |
1168 | static inline | |
437d5aa5 | 1169 | int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1170 | { |
1171 | return -ENOSYS; | |
1172 | } | |
1173 | #endif | |
1174 | ||
1175 | #if defined(CONFIG_NET_NS) && \ | |
5f4c791e | 1176 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1177 | int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1178 | #else |
1179 | static inline | |
437d5aa5 | 1180 | int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1181 | { |
1182 | return -ENOSYS; | |
1183 | } | |
1184 | #endif | |
1185 | ||
1186 | #if defined(CONFIG_PID_NS) && \ | |
5f4c791e | 1187 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1188 | int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1189 | #else |
1190 | static inline | |
437d5aa5 | 1191 | int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1192 | { |
1193 | return -ENOSYS; | |
1194 | } | |
1195 | #endif | |
1196 | ||
1197 | #if defined(CONFIG_USER_NS) && \ | |
5f4c791e | 1198 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1199 | int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1200 | #else |
1201 | static inline | |
437d5aa5 | 1202 | int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1203 | { |
1204 | return -ENOSYS; | |
1205 | } | |
1206 | #endif | |
1207 | ||
1208 | #if defined(CONFIG_UTS_NS) && \ | |
5f4c791e | 1209 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) |
437d5aa5 | 1210 | int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
a6cf40a4 MJ |
1211 | #else |
1212 | static inline | |
437d5aa5 | 1213 | int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
a6cf40a4 MJ |
1214 | { |
1215 | return -ENOSYS; | |
1216 | } | |
1217 | #endif | |
1218 | ||
876e2e92 | 1219 | #if defined(CONFIG_TIME_NS) && \ |
5f4c791e | 1220 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) |
437d5aa5 | 1221 | int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx); |
876e2e92 MJ |
1222 | #else |
1223 | static inline | |
437d5aa5 | 1224 | int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx) |
876e2e92 MJ |
1225 | { |
1226 | return -ENOSYS; | |
1227 | } | |
1228 | #endif | |
1229 | ||
437d5aa5 MD |
1230 | int lttng_add_uid_to_ctx(struct lttng_kernel_ctx **ctx); |
1231 | int lttng_add_euid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1232 | int lttng_add_suid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1233 | int lttng_add_gid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1234 | int lttng_add_egid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1235 | int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1236 | int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1237 | int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1238 | int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1239 | int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1240 | int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx **ctx); | |
1241 | int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
dc923e75 | 1242 | |
8a3af9ee | 1243 | #if defined(CONFIG_PERF_EVENTS) |
c24a0d71 MD |
1244 | int lttng_add_perf_counter_to_ctx(uint32_t type, |
1245 | uint64_t config, | |
1246 | const char *name, | |
437d5aa5 | 1247 | struct lttng_kernel_ctx **ctx); |
1e367326 MD |
1248 | int lttng_cpuhp_perf_counter_online(unsigned int cpu, |
1249 | struct lttng_cpuhp_node *node); | |
1250 | int lttng_cpuhp_perf_counter_dead(unsigned int cpu, | |
1251 | struct lttng_cpuhp_node *node); | |
1d443b34 MD |
1252 | #else |
1253 | static inline | |
1254 | int lttng_add_perf_counter_to_ctx(uint32_t type, | |
1255 | uint64_t config, | |
1256 | const char *name, | |
437d5aa5 | 1257 | struct lttng_kernel_ctx **ctx) |
1d443b34 MD |
1258 | { |
1259 | return -ENOSYS; | |
1260 | } | |
1e367326 MD |
1261 | static inline |
1262 | int lttng_cpuhp_perf_counter_online(unsigned int cpu, | |
1263 | struct lttng_cpuhp_node *node) | |
1264 | { | |
1265 | return 0; | |
1266 | } | |
1267 | static inline | |
1268 | int lttng_cpuhp_perf_counter_dead(unsigned int cpu, | |
1269 | struct lttng_cpuhp_node *node) | |
1270 | { | |
1271 | return 0; | |
1272 | } | |
1d443b34 | 1273 | #endif |
02119ee5 | 1274 | |
0c956676 MD |
1275 | int lttng_logger_init(void); |
1276 | void lttng_logger_exit(void); | |
1277 | ||
c337ddc2 MD |
1278 | extern int lttng_statedump_start(struct lttng_session *session); |
1279 | ||
acd614cc | 1280 | #ifdef CONFIG_KPROBES |
8bf17deb | 1281 | int lttng_kprobes_register_event(const char *name, |
f17701fb MD |
1282 | const char *symbol_name, |
1283 | uint64_t offset, | |
1284 | uint64_t addr, | |
a67ba386 MD |
1285 | struct lttng_kernel_event_recorder *event); |
1286 | void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event); | |
1287 | void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event); | |
2b16f0c9 FD |
1288 | int lttng_kprobes_register_event_notifier(const char *symbol_name, |
1289 | uint64_t offset, | |
1290 | uint64_t addr, | |
a67ba386 MD |
1291 | struct lttng_kernel_event_notifier *event_notifier); |
1292 | void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
1293 | void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier); | |
acd614cc MD |
1294 | #else |
1295 | static inline | |
8bf17deb | 1296 | int lttng_kprobes_register_event(const char *name, |
acd614cc MD |
1297 | const char *symbol_name, |
1298 | uint64_t offset, | |
1299 | uint64_t addr, | |
a67ba386 | 1300 | struct lttng_kernel_event_recorder *event) |
acd614cc MD |
1301 | { |
1302 | return -ENOSYS; | |
1303 | } | |
1304 | ||
25f53c39 | 1305 | static inline |
a67ba386 | 1306 | void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event) |
8bf17deb FD |
1307 | { |
1308 | } | |
1309 | ||
1310 | static inline | |
a67ba386 | 1311 | void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event) |
acd614cc MD |
1312 | { |
1313 | } | |
edeb3137 MD |
1314 | |
1315 | static inline | |
2b16f0c9 FD |
1316 | int lttng_kprobes_register_event_notifier(const char *symbol_name, |
1317 | uint64_t offset, | |
1318 | uint64_t addr, | |
a67ba386 | 1319 | struct lttng_kernel_event_notifier *event_notifier) |
2b16f0c9 FD |
1320 | { |
1321 | return -ENOSYS; | |
1322 | } | |
1323 | ||
1324 | static inline | |
a67ba386 | 1325 | void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier) |
2b16f0c9 FD |
1326 | { |
1327 | } | |
1328 | ||
1329 | static inline | |
a67ba386 | 1330 | void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier) |
edeb3137 MD |
1331 | { |
1332 | } | |
acd614cc | 1333 | #endif |
d6d808f3 | 1334 | |
a67ba386 | 1335 | int lttng_event_add_callsite(struct lttng_kernel_event_recorder *event, |
606828e4 | 1336 | struct lttng_kernel_abi_event_callsite __user *callsite); |
e33fc900 | 1337 | |
a67ba386 | 1338 | int lttng_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier, |
606828e4 | 1339 | struct lttng_kernel_abi_event_callsite __user *callsite); |
9de67196 | 1340 | |
149b9a9d | 1341 | #ifdef CONFIG_UPROBES |
83b802dc | 1342 | int lttng_uprobes_register_event(const char *name, |
a67ba386 MD |
1343 | int fd, struct lttng_kernel_event_recorder *event); |
1344 | int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_recorder *event, | |
606828e4 | 1345 | struct lttng_kernel_abi_event_callsite __user *callsite); |
a67ba386 MD |
1346 | void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event); |
1347 | void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event); | |
9de67196 | 1348 | int lttng_uprobes_register_event_notifier(const char *name, |
a67ba386 MD |
1349 | int fd, struct lttng_kernel_event_notifier *event_notifier); |
1350 | int lttng_uprobes_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier, | |
606828e4 | 1351 | struct lttng_kernel_abi_event_callsite __user *callsite); |
a67ba386 MD |
1352 | void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier); |
1353 | void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier); | |
149b9a9d YB |
1354 | #else |
1355 | static inline | |
83b802dc | 1356 | int lttng_uprobes_register_event(const char *name, |
a67ba386 | 1357 | int fd, struct lttng_kernel_event_recorder *event) |
3aed4dca FD |
1358 | { |
1359 | return -ENOSYS; | |
1360 | } | |
1361 | ||
1362 | static inline | |
a67ba386 | 1363 | int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_recorder *event, |
606828e4 | 1364 | struct lttng_kernel_abi_event_callsite __user *callsite) |
149b9a9d YB |
1365 | { |
1366 | return -ENOSYS; | |
1367 | } | |
1368 | ||
1369 | static inline | |
a67ba386 | 1370 | void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event) |
149b9a9d YB |
1371 | { |
1372 | } | |
1373 | ||
1374 | static inline | |
a67ba386 | 1375 | void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event) |
149b9a9d YB |
1376 | { |
1377 | } | |
9de67196 FD |
1378 | |
1379 | static inline | |
1380 | int lttng_uprobes_register_event_notifier(const char *name, | |
a67ba386 | 1381 | int fd, struct lttng_kernel_event_notifier *event_notifier) |
9de67196 FD |
1382 | { |
1383 | return -ENOSYS; | |
1384 | } | |
1385 | ||
1386 | static inline | |
a67ba386 | 1387 | int lttng_uprobes_event_notifier_add_callsite(struct lttng_kernel_event_notifier *event_notifier, |
606828e4 | 1388 | struct lttng_kernel_abi_event_callsite __user *callsite) |
9de67196 FD |
1389 | { |
1390 | return -ENOSYS; | |
1391 | } | |
1392 | ||
1393 | static inline | |
a67ba386 | 1394 | void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier) |
9de67196 FD |
1395 | { |
1396 | } | |
1397 | ||
1398 | static inline | |
a67ba386 | 1399 | void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier) |
9de67196 FD |
1400 | { |
1401 | } | |
149b9a9d YB |
1402 | #endif |
1403 | ||
7371f44c MD |
1404 | #ifdef CONFIG_KRETPROBES |
1405 | int lttng_kretprobes_register(const char *name, | |
1406 | const char *symbol_name, | |
1407 | uint64_t offset, | |
1408 | uint64_t addr, | |
a67ba386 MD |
1409 | struct lttng_kernel_event_recorder *event_entry, |
1410 | struct lttng_kernel_event_recorder *event_exit); | |
1411 | void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event); | |
1412 | void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event); | |
1413 | int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_recorder *event, | |
a0493bef | 1414 | int enable); |
7371f44c MD |
1415 | #else |
1416 | static inline | |
1417 | int lttng_kretprobes_register(const char *name, | |
1418 | const char *symbol_name, | |
1419 | uint64_t offset, | |
1420 | uint64_t addr, | |
a67ba386 MD |
1421 | struct lttng_kernel_event_recorder *event_entry, |
1422 | struct lttng_kernel_event_recorder *event_exit) | |
7371f44c MD |
1423 | { |
1424 | return -ENOSYS; | |
1425 | } | |
1426 | ||
1427 | static inline | |
a67ba386 | 1428 | void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event) |
7371f44c MD |
1429 | { |
1430 | } | |
1431 | ||
1432 | static inline | |
a67ba386 | 1433 | void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event) |
7371f44c MD |
1434 | { |
1435 | } | |
a0493bef MD |
1436 | |
1437 | static inline | |
a67ba386 | 1438 | int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_recorder *event, |
a0493bef MD |
1439 | int enable) |
1440 | { | |
1441 | return -ENOSYS; | |
1442 | } | |
7371f44c MD |
1443 | #endif |
1444 | ||
606828e4 | 1445 | int lttng_calibrate(struct lttng_kernel_abi_calibrate *calibrate); |
57105fc2 | 1446 | |
271b6681 | 1447 | extern const struct file_operations lttng_tracepoint_list_fops; |
2d2464bd | 1448 | extern const struct file_operations lttng_syscall_list_fops; |
271b6681 | 1449 | |
ef200626 | 1450 | #define TRACEPOINT_HAS_DATA_ARG |
ef200626 | 1451 | |
a90917c3 | 1452 | #endif /* _LTTNG_EVENTS_H */ |