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