Commit | Line | Data |
---|---|---|
92bc1e23 MD |
1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) |
2 | * | |
3 | * lttng/events-internal.h | |
4 | * | |
5 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
6 | */ | |
7 | ||
8 | #ifndef _LTTNG_EVENTS_INTERNAL_H | |
9 | #define _LTTNG_EVENTS_INTERNAL_H | |
10 | ||
437d5aa5 MD |
11 | #include <lttng/events.h> |
12 | ||
344fe0f6 | 13 | struct lttng_syscall_filter; |
7c1ba2ca MD |
14 | struct lttng_metadata_cache; |
15 | struct perf_event; | |
16 | struct perf_event_attr; | |
17 | struct lib_ring_buffer_config; | |
344fe0f6 | 18 | |
311e655a MD |
19 | enum lttng_enabler_format_type { |
20 | LTTNG_ENABLER_FORMAT_STAR_GLOB, | |
21 | LTTNG_ENABLER_FORMAT_NAME, | |
22 | }; | |
23 | ||
24 | /* | |
25 | * Objects in a linked-list of enablers, owned by an event. | |
26 | */ | |
27 | struct lttng_enabler_ref { | |
28 | struct list_head node; /* enabler ref list */ | |
29 | struct lttng_enabler *ref; /* backward ref */ | |
30 | }; | |
31 | ||
e978f274 MD |
32 | struct lttng_krp; /* Kretprobe handling */ |
33 | ||
34 | struct lttng_uprobe_handler { | |
35 | struct lttng_kernel_event_common *event; | |
36 | loff_t offset; | |
37 | struct uprobe_consumer up_consumer; | |
38 | struct list_head node; | |
39 | }; | |
40 | ||
41 | struct lttng_kprobe { | |
42 | struct kprobe kp; | |
43 | char *symbol_name; | |
44 | }; | |
45 | ||
46 | struct lttng_uprobe { | |
47 | struct inode *inode; | |
48 | struct list_head head; | |
49 | }; | |
50 | ||
51 | enum lttng_syscall_entryexit { | |
52 | LTTNG_SYSCALL_ENTRY, | |
53 | LTTNG_SYSCALL_EXIT, | |
54 | }; | |
55 | ||
56 | enum lttng_syscall_abi { | |
57 | LTTNG_SYSCALL_ABI_NATIVE, | |
58 | LTTNG_SYSCALL_ABI_COMPAT, | |
59 | }; | |
60 | ||
a67ba386 MD |
61 | struct lttng_kernel_event_common_private { |
62 | struct lttng_kernel_event_common *pub; /* Public event interface */ | |
63 | ||
64 | const struct lttng_kernel_event_desc *desc; | |
65 | /* Backward references: list of lttng_enabler_ref (ref to enablers) */ | |
66 | struct list_head enablers_ref_head; | |
67 | int registered; /* has reg'd tracepoint probe */ | |
68 | uint64_t user_token; | |
69 | ||
70 | int has_enablers_without_filter_bytecode; | |
218585b9 | 71 | /* list of struct lttng_kernel_bytecode_runtime, sorted by seqnum */ |
a67ba386 MD |
72 | struct list_head filter_bytecode_runtime_head; |
73 | enum lttng_kernel_abi_instrumentation instrumentation; | |
74 | /* Selected by instrumentation */ | |
75 | union { | |
76 | struct lttng_kprobe kprobe; | |
77 | struct lttng_uprobe uprobe; | |
78 | struct { | |
79 | struct lttng_krp *lttng_krp; | |
80 | char *symbol_name; | |
81 | } kretprobe; | |
82 | struct { | |
83 | enum lttng_syscall_entryexit entryexit; | |
84 | enum lttng_syscall_abi abi; | |
85 | struct hlist_node node; /* chain registered syscall event_notifier */ | |
86 | unsigned int syscall_id; | |
87 | } syscall; | |
88 | } u; | |
89 | }; | |
90 | ||
91 | struct lttng_kernel_event_recorder_private { | |
92 | struct lttng_kernel_event_common_private parent; | |
93 | ||
94 | struct lttng_kernel_event_recorder *pub; /* Public event interface */ | |
95 | struct list_head node; /* Event recorder list */ | |
96 | struct hlist_node hlist; /* Hash table of event recorders */ | |
97 | struct lttng_kernel_ctx *ctx; | |
98 | unsigned int id; | |
99 | unsigned int metadata_dumped:1; | |
100 | }; | |
101 | ||
102 | struct lttng_kernel_event_notifier_private { | |
103 | struct lttng_kernel_event_common_private parent; | |
104 | ||
105 | struct lttng_kernel_event_notifier *pub; /* Public event notifier interface */ | |
106 | struct lttng_event_notifier_group *group; /* weak ref */ | |
107 | size_t num_captures; /* Needed to allocate the msgpack array. */ | |
108 | uint64_t error_counter_index; | |
109 | struct list_head node; /* Event notifier list */ | |
110 | struct hlist_node hlist; /* Hash table of event notifiers */ | |
111 | struct list_head capture_bytecode_runtime_head; | |
112 | ||
113 | }; | |
114 | ||
8a445457 MD |
115 | enum lttng_kernel_bytecode_interpreter_ret { |
116 | LTTNG_KERNEL_BYTECODE_INTERPRETER_ERROR = -1, | |
117 | LTTNG_KERNEL_BYTECODE_INTERPRETER_OK = 0, | |
118 | }; | |
119 | ||
120 | enum lttng_kernel_bytecode_filter_result { | |
121 | LTTNG_KERNEL_BYTECODE_FILTER_ACCEPT = 0, | |
122 | LTTNG_KERNEL_BYTECODE_FILTER_REJECT = 1, | |
123 | }; | |
124 | ||
125 | struct lttng_kernel_bytecode_filter_ctx { | |
126 | enum lttng_kernel_bytecode_filter_result result; | |
127 | }; | |
128 | ||
1efb0502 MD |
129 | struct lttng_interpreter_output; |
130 | ||
131 | enum lttng_kernel_bytecode_type { | |
132 | LTTNG_KERNEL_BYTECODE_TYPE_FILTER, | |
133 | LTTNG_KERNEL_BYTECODE_TYPE_CAPTURE, | |
134 | }; | |
135 | ||
136 | struct lttng_kernel_bytecode_node { | |
137 | enum lttng_kernel_bytecode_type type; | |
138 | struct list_head node; | |
139 | struct lttng_enabler *enabler; | |
140 | struct { | |
141 | uint32_t len; | |
142 | uint32_t reloc_offset; | |
143 | uint64_t seqnum; | |
144 | char data[]; | |
145 | } bc; | |
146 | }; | |
147 | ||
148 | struct lttng_kernel_bytecode_runtime { | |
149 | /* Associated bytecode */ | |
150 | enum lttng_kernel_bytecode_type type; | |
151 | struct lttng_kernel_bytecode_node *bc; | |
152 | int (*interpreter_func)(struct lttng_kernel_bytecode_runtime *kernel_bytecode, | |
153 | const char *interpreter_stack_data, | |
154 | struct lttng_kernel_probe_ctx *lttng_probe_ctx, | |
155 | void *caller_ctx); | |
156 | int link_failed; | |
157 | struct list_head node; /* list of bytecode runtime in event */ | |
158 | struct lttng_kernel_ctx *ctx; | |
159 | }; | |
160 | ||
5e08a34f MD |
161 | /* |
162 | * Enabler field, within whatever object is enabling an event. Target of | |
163 | * backward reference. | |
164 | */ | |
165 | struct lttng_enabler { | |
166 | enum lttng_enabler_format_type format_type; | |
167 | ||
d64ca521 | 168 | /* head list of struct lttng_kernel_bytecode_node */ |
5e08a34f MD |
169 | struct list_head filter_bytecode_head; |
170 | ||
171 | struct lttng_kernel_abi_event event_param; | |
172 | unsigned int enabled:1; | |
173 | ||
174 | uint64_t user_token; /* User-provided token. */ | |
175 | }; | |
176 | ||
177 | struct lttng_event_enabler { | |
178 | struct lttng_enabler base; | |
179 | struct list_head node; /* per-session list of enablers */ | |
180 | struct lttng_channel *chan; | |
181 | }; | |
182 | ||
183 | struct lttng_event_notifier_enabler { | |
184 | struct lttng_enabler base; | |
185 | uint64_t error_counter_index; | |
186 | struct list_head node; /* List of event_notifier enablers */ | |
187 | struct lttng_event_notifier_group *group; | |
188 | ||
d64ca521 | 189 | /* head list of struct lttng_kernel_bytecode_node */ |
5e08a34f MD |
190 | struct list_head capture_bytecode_head; |
191 | uint64_t num_captures; | |
192 | }; | |
193 | ||
0fe45627 MD |
194 | struct lttng_ctx_value { |
195 | union { | |
196 | int64_t s64; | |
197 | const char *str; | |
198 | double d; | |
199 | } u; | |
200 | }; | |
201 | ||
202 | /* | |
203 | * We need to keep this perf counter field separately from struct | |
204 | * lttng_kernel_ctx_field because cpu hotplug needs fixed-location addresses. | |
205 | */ | |
206 | struct lttng_perf_counter_field { | |
207 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) | |
208 | struct lttng_cpuhp_node cpuhp_prepare; | |
209 | struct lttng_cpuhp_node cpuhp_online; | |
210 | #else | |
211 | struct notifier_block nb; | |
212 | int hp_enable; | |
213 | #endif | |
214 | struct perf_event_attr *attr; | |
215 | struct perf_event **e; /* per-cpu array */ | |
216 | char *name; | |
217 | struct lttng_kernel_event_field *event_field; | |
218 | }; | |
219 | ||
220 | struct lttng_kernel_ctx_field { | |
221 | const struct lttng_kernel_event_field *event_field; | |
a92e844e | 222 | size_t (*get_size)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, |
0fe45627 | 223 | size_t offset); |
a92e844e | 224 | void (*record)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, |
8a57ec02 | 225 | struct lttng_kernel_ring_buffer_ctx *ctx, |
0fe45627 | 226 | struct lttng_channel *chan); |
a92e844e | 227 | void (*get_value)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, |
0fe45627 MD |
228 | struct lttng_ctx_value *value); |
229 | void (*destroy)(void *priv); | |
230 | void *priv; | |
231 | }; | |
232 | ||
233 | struct lttng_kernel_ctx { | |
234 | struct lttng_kernel_ctx_field *fields; | |
235 | unsigned int nr_fields; | |
236 | unsigned int allocated_fields; | |
237 | size_t largest_align; /* in bytes */ | |
238 | }; | |
239 | ||
8a20497f MD |
240 | struct lttng_metadata_cache { |
241 | char *data; /* Metadata cache */ | |
242 | unsigned int cache_alloc; /* Metadata allocated size (bytes) */ | |
243 | unsigned int metadata_written; /* Number of bytes written in metadata cache */ | |
244 | atomic_t producing; /* Metadata being produced (incomplete) */ | |
245 | struct kref refcount; /* Metadata cache usage */ | |
246 | struct list_head metadata_stream; /* Metadata stream list */ | |
247 | uuid_le uuid; /* Trace session unique ID (copy) */ | |
248 | struct mutex lock; /* Produce/consume lock */ | |
249 | uint64_t version; /* Current version of the metadata */ | |
250 | }; | |
251 | ||
a44f47dd MD |
252 | struct lttng_metadata_stream { |
253 | void *priv; /* Ring buffer private data */ | |
254 | struct lttng_metadata_cache *metadata_cache; | |
255 | unsigned int metadata_in; /* Bytes read from the cache */ | |
256 | unsigned int metadata_out; /* Bytes consumed from stream */ | |
257 | int finalized; /* Has channel been finalized */ | |
258 | wait_queue_head_t read_wait; /* Reader buffer-level wait queue */ | |
259 | struct list_head list; /* Stream list */ | |
260 | struct lttng_transport *transport; | |
261 | uint64_t version; /* Current version of the metadata cache */ | |
262 | bool coherent; /* Stream in a coherent state */ | |
263 | }; | |
264 | ||
4a399b76 MD |
265 | struct lttng_kernel_channel_buffer_ops_private { |
266 | struct lttng_kernel_channel_buffer_ops *pub; /* Public channel buffer ops interface */ | |
267 | ||
268 | struct channel *(*channel_create)(const char *name, | |
269 | void *priv, | |
270 | void *buf_addr, | |
271 | size_t subbuf_size, size_t num_subbuf, | |
272 | unsigned int switch_timer_interval, | |
273 | unsigned int read_timer_interval); | |
274 | void (*channel_destroy)(struct channel *chan); | |
275 | struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan); | |
276 | int (*buffer_has_read_closed_stream)(struct channel *chan); | |
277 | void (*buffer_read_close)(struct lib_ring_buffer *buf); | |
278 | /* | |
279 | * packet_avail_size returns the available size in the current | |
280 | * packet. Note that the size returned is only a hint, since it | |
281 | * may change due to concurrent writes. | |
282 | */ | |
283 | size_t (*packet_avail_size)(struct channel *chan); | |
284 | wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu); | |
285 | wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan); | |
286 | int (*is_finalized)(struct channel *chan); | |
287 | int (*is_disabled)(struct channel *chan); | |
288 | int (*timestamp_begin) (const struct lib_ring_buffer_config *config, | |
289 | struct lib_ring_buffer *bufb, | |
290 | uint64_t *timestamp_begin); | |
291 | int (*timestamp_end) (const struct lib_ring_buffer_config *config, | |
292 | struct lib_ring_buffer *bufb, | |
293 | uint64_t *timestamp_end); | |
294 | int (*events_discarded) (const struct lib_ring_buffer_config *config, | |
295 | struct lib_ring_buffer *bufb, | |
296 | uint64_t *events_discarded); | |
297 | int (*content_size) (const struct lib_ring_buffer_config *config, | |
298 | struct lib_ring_buffer *bufb, | |
299 | uint64_t *content_size); | |
300 | int (*packet_size) (const struct lib_ring_buffer_config *config, | |
301 | struct lib_ring_buffer *bufb, | |
302 | uint64_t *packet_size); | |
303 | int (*stream_id) (const struct lib_ring_buffer_config *config, | |
304 | struct lib_ring_buffer *bufb, | |
305 | uint64_t *stream_id); | |
306 | int (*current_timestamp) (const struct lib_ring_buffer_config *config, | |
307 | struct lib_ring_buffer *bufb, | |
308 | uint64_t *ts); | |
309 | int (*sequence_number) (const struct lib_ring_buffer_config *config, | |
310 | struct lib_ring_buffer *bufb, | |
311 | uint64_t *seq); | |
312 | int (*instance_id) (const struct lib_ring_buffer_config *config, | |
313 | struct lib_ring_buffer *bufb, | |
314 | uint64_t *id); | |
315 | }; | |
316 | ||
b0315544 MD |
317 | struct lttng_counter_ops { |
318 | struct lib_counter *(*counter_create)(size_t nr_dimensions, | |
319 | const size_t *max_nr_elem, /* for each dimension */ | |
320 | int64_t global_sum_step); | |
321 | void (*counter_destroy)(struct lib_counter *counter); | |
322 | int (*counter_add)(struct lib_counter *counter, const size_t *dimension_indexes, | |
323 | int64_t v); | |
324 | /* | |
325 | * counter_read reads a specific cpu's counter if @cpu >= 0, or | |
326 | * the global aggregation counter if @cpu == -1. | |
327 | */ | |
328 | int (*counter_read)(struct lib_counter *counter, const size_t *dimension_indexes, int cpu, | |
329 | int64_t *value, bool *overflow, bool *underflow); | |
330 | /* | |
331 | * counter_aggregate returns the total sum of all per-cpu counters and | |
332 | * the global aggregation counter. | |
333 | */ | |
334 | int (*counter_aggregate)(struct lib_counter *counter, const size_t *dimension_indexes, | |
335 | int64_t *value, bool *overflow, bool *underflow); | |
336 | int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes); | |
337 | }; | |
338 | ||
339 | struct lttng_counter { | |
340 | struct file *file; /* File associated to counter. */ | |
341 | struct file *owner; | |
342 | struct lttng_counter_transport *transport; | |
343 | struct lib_counter *counter; | |
344 | struct lttng_counter_ops *ops; | |
345 | }; | |
346 | ||
347 | struct lttng_event_notifier_group { | |
348 | struct file *file; /* File associated to event notifier group */ | |
349 | struct file *notif_file; /* File used to expose notifications to userspace. */ | |
350 | struct list_head node; /* event notifier group list */ | |
351 | struct list_head enablers_head; /* List of enablers */ | |
352 | struct list_head event_notifiers_head; /* List of event notifier */ | |
353 | struct lttng_event_notifier_ht event_notifiers_ht; /* Hash table of event notifiers */ | |
354 | struct lttng_kernel_channel_buffer_ops *ops; | |
355 | struct lttng_transport *transport; | |
356 | struct channel *chan; /* Ring buffer channel for event notifier group. */ | |
357 | struct lib_ring_buffer *buf; /* Ring buffer for event notifier group. */ | |
358 | wait_queue_head_t read_wait; | |
359 | struct irq_work wakeup_pending; /* Pending wakeup irq work. */ | |
360 | struct lttng_kernel_event_notifier *sc_unknown; /* for unknown syscalls */ | |
361 | struct lttng_kernel_event_notifier *sc_compat_unknown; | |
362 | ||
363 | struct lttng_syscall_filter *sc_filter; | |
364 | ||
365 | struct hlist_head *event_notifier_syscall_dispatch; | |
366 | struct hlist_head *event_notifier_compat_syscall_dispatch; | |
367 | struct hlist_head *event_notifier_exit_syscall_dispatch; | |
368 | struct hlist_head *event_notifier_exit_compat_syscall_dispatch; | |
369 | ||
370 | struct hlist_head event_notifier_unknown_syscall_dispatch; | |
371 | struct hlist_head event_notifier_compat_unknown_syscall_dispatch; | |
372 | struct hlist_head event_notifier_exit_unknown_syscall_dispatch; | |
373 | struct hlist_head event_notifier_exit_compat_unknown_syscall_dispatch; | |
374 | ||
375 | int syscall_all_entry; | |
376 | int syscall_all_exit; | |
377 | ||
378 | unsigned int sys_enter_registered:1, sys_exit_registered:1; | |
379 | ||
380 | struct lttng_counter *error_counter; | |
381 | size_t error_counter_len; | |
382 | }; | |
383 | ||
384 | struct lttng_transport { | |
385 | char *name; | |
386 | struct module *owner; | |
387 | struct list_head node; | |
388 | struct lttng_kernel_channel_buffer_ops ops; | |
389 | }; | |
390 | ||
391 | struct lttng_counter_transport { | |
392 | char *name; | |
393 | struct module *owner; | |
394 | struct list_head node; | |
395 | struct lttng_counter_ops ops; | |
396 | }; | |
397 | ||
8cdc1a81 MD |
398 | struct lttng_kernel_session_private { |
399 | struct lttng_kernel_session *pub; /* Public session interface */ | |
400 | ||
401 | int been_active; /* Has trace session been active ? */ | |
402 | struct file *file; /* File associated to session */ | |
403 | struct list_head chan; /* Channel list head */ | |
404 | struct list_head events; /* Event list head */ | |
405 | struct list_head list; /* Session list */ | |
406 | unsigned int free_chan_id; /* Next chan ID to allocate */ | |
407 | uuid_le uuid; /* Trace session unique ID */ | |
408 | struct lttng_metadata_cache *metadata_cache; | |
409 | unsigned int metadata_dumped:1, | |
410 | tstate:1; /* Transient enable state */ | |
411 | /* List of event enablers */ | |
412 | struct list_head enablers_head; | |
413 | /* Hash table of events */ | |
414 | struct lttng_event_ht events_ht; | |
415 | char name[LTTNG_KERNEL_ABI_SESSION_NAME_LEN]; | |
416 | char creation_time[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN]; | |
417 | }; | |
418 | ||
fc66bf6a MD |
419 | struct lttng_id_hash_node { |
420 | struct hlist_node hlist; | |
421 | int id; | |
422 | }; | |
423 | ||
8c0393c3 MD |
424 | enum tracker_type { |
425 | TRACKER_PID, | |
426 | TRACKER_VPID, | |
427 | TRACKER_UID, | |
428 | TRACKER_VUID, | |
429 | TRACKER_GID, | |
430 | TRACKER_VGID, | |
431 | ||
432 | TRACKER_UNKNOWN, | |
433 | }; | |
434 | ||
435 | struct lttng_kernel_id_tracker_private { | |
436 | struct lttng_kernel_id_tracker *pub; /* Public interface */ | |
437 | ||
438 | struct lttng_kernel_session *session; | |
439 | enum tracker_type tracker_type; | |
440 | }; | |
441 | ||
0fe45627 MD |
442 | extern struct lttng_kernel_ctx *lttng_static_ctx; |
443 | ||
437d5aa5 MD |
444 | static inline |
445 | const struct lttng_kernel_type_integer *lttng_kernel_get_type_integer(const struct lttng_kernel_type_common *type) | |
446 | { | |
447 | if (type->type != lttng_kernel_type_integer) | |
448 | return NULL; | |
449 | return container_of(type, const struct lttng_kernel_type_integer, parent); | |
450 | } | |
451 | ||
452 | static inline | |
453 | const struct lttng_kernel_type_string *lttng_kernel_get_type_string(const struct lttng_kernel_type_common *type) | |
454 | { | |
455 | if (type->type != lttng_kernel_type_string) | |
456 | return NULL; | |
457 | return container_of(type, const struct lttng_kernel_type_string, parent); | |
458 | } | |
459 | ||
460 | static inline | |
461 | const struct lttng_kernel_type_enum *lttng_kernel_get_type_enum(const struct lttng_kernel_type_common *type) | |
462 | { | |
463 | if (type->type != lttng_kernel_type_enum) | |
464 | return NULL; | |
465 | return container_of(type, const struct lttng_kernel_type_enum, parent); | |
466 | } | |
467 | ||
468 | static inline | |
469 | const struct lttng_kernel_type_array *lttng_kernel_get_type_array(const struct lttng_kernel_type_common *type) | |
470 | { | |
471 | if (type->type != lttng_kernel_type_array) | |
472 | return NULL; | |
473 | return container_of(type, const struct lttng_kernel_type_array, parent); | |
474 | } | |
475 | ||
476 | static inline | |
477 | const struct lttng_kernel_type_sequence *lttng_kernel_get_type_sequence(const struct lttng_kernel_type_common *type) | |
478 | { | |
479 | if (type->type != lttng_kernel_type_sequence) | |
480 | return NULL; | |
481 | return container_of(type, const struct lttng_kernel_type_sequence, parent); | |
482 | } | |
483 | ||
484 | static inline | |
485 | const struct lttng_kernel_type_struct *lttng_kernel_get_type_struct(const struct lttng_kernel_type_common *type) | |
486 | { | |
487 | if (type->type != lttng_kernel_type_struct) | |
488 | return NULL; | |
489 | return container_of(type, const struct lttng_kernel_type_struct, parent); | |
490 | } | |
491 | ||
492 | static inline | |
493 | const struct lttng_kernel_type_variant *lttng_kernel_get_type_variant(const struct lttng_kernel_type_common *type) | |
494 | { | |
495 | if (type->type != lttng_kernel_type_variant) | |
496 | return NULL; | |
497 | return container_of(type, const struct lttng_kernel_type_variant, parent); | |
498 | } | |
499 | ||
500 | static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kernel_type_common *type) | |
501 | { | |
502 | const struct lttng_kernel_type_integer *type_integer = lttng_kernel_get_type_integer(type); | |
503 | ||
504 | if (!type_integer) | |
505 | return false; | |
506 | switch (type_integer->size) { | |
507 | case 8: /* Fall-through. */ | |
508 | case 16: /* Fall-through. */ | |
509 | case 32: /* Fall-through. */ | |
510 | case 64: | |
511 | break; | |
512 | default: | |
513 | return false; | |
514 | } | |
515 | return true; | |
516 | } | |
517 | ||
8a445457 MD |
518 | int lttng_kernel_interpret_event_filter(const struct lttng_kernel_event_common *event, |
519 | const char *interpreter_stack_data, | |
a92e844e | 520 | struct lttng_kernel_probe_ctx *probe_ctx, |
8a445457 MD |
521 | void *event_filter_ctx); |
522 | ||
5e08a34f MD |
523 | static inline |
524 | struct lttng_enabler *lttng_event_enabler_as_enabler( | |
525 | struct lttng_event_enabler *event_enabler) | |
526 | { | |
527 | return &event_enabler->base; | |
528 | } | |
529 | ||
530 | static inline | |
531 | struct lttng_enabler *lttng_event_notifier_enabler_as_enabler( | |
532 | struct lttng_event_notifier_enabler *event_notifier_enabler) | |
533 | { | |
534 | return &event_notifier_enabler->base; | |
535 | } | |
536 | ||
0fe45627 MD |
537 | int lttng_context_init(void); |
538 | void lttng_context_exit(void); | |
539 | int lttng_kernel_context_append(struct lttng_kernel_ctx **ctx_p, | |
540 | const struct lttng_kernel_ctx_field *f); | |
541 | void lttng_kernel_context_remove_last(struct lttng_kernel_ctx **ctx_p); | |
542 | struct lttng_kernel_ctx_field *lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx *ctx, | |
543 | size_t index); | |
544 | int lttng_kernel_find_context(struct lttng_kernel_ctx *ctx, const char *name); | |
545 | int lttng_kernel_get_context_index(struct lttng_kernel_ctx *ctx, const char *name); | |
546 | void lttng_kernel_destroy_context(struct lttng_kernel_ctx *ctx); | |
547 | int lttng_add_pid_to_ctx(struct lttng_kernel_ctx **ctx); | |
548 | int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx **ctx); | |
549 | int lttng_add_procname_to_ctx(struct lttng_kernel_ctx **ctx); | |
550 | int lttng_add_prio_to_ctx(struct lttng_kernel_ctx **ctx); | |
551 | int lttng_add_nice_to_ctx(struct lttng_kernel_ctx **ctx); | |
552 | int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx **ctx); | |
553 | int lttng_add_tid_to_ctx(struct lttng_kernel_ctx **ctx); | |
554 | int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx **ctx); | |
555 | int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx **ctx); | |
556 | int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx **ctx); | |
557 | int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx **ctx); | |
558 | int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx **ctx); | |
559 | int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx **ctx); | |
560 | #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT) | |
561 | int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx); | |
562 | #else | |
563 | static inline | |
564 | int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx) | |
565 | { | |
566 | return -ENOSYS; | |
567 | } | |
568 | #endif | |
569 | #ifdef CONFIG_PREEMPT_RT_FULL | |
570 | int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx); | |
571 | #else | |
572 | static inline | |
573 | int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx) | |
574 | { | |
575 | return -ENOSYS; | |
576 | } | |
577 | #endif | |
578 | ||
579 | int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx **ctx, int type); | |
580 | ||
581 | #if defined(CONFIG_CGROUPS) && \ | |
582 | ((LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) || \ | |
583 | LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0)) | |
584 | int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
585 | #else | |
586 | static inline | |
587 | int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
588 | { | |
589 | return -ENOSYS; | |
590 | } | |
591 | #endif | |
592 | ||
593 | #if defined(CONFIG_IPC_NS) && \ | |
594 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
595 | int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
596 | #else | |
597 | static inline | |
598 | int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
599 | { | |
600 | return -ENOSYS; | |
601 | } | |
602 | #endif | |
603 | ||
604 | #if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \ | |
605 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
606 | int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
607 | #else | |
608 | static inline | |
609 | int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
610 | { | |
611 | return -ENOSYS; | |
612 | } | |
613 | #endif | |
614 | ||
615 | #if defined(CONFIG_NET_NS) && \ | |
616 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
617 | int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
618 | #else | |
619 | static inline | |
620 | int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
621 | { | |
622 | return -ENOSYS; | |
623 | } | |
624 | #endif | |
625 | ||
626 | #if defined(CONFIG_PID_NS) && \ | |
627 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
628 | int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
629 | #else | |
630 | static inline | |
631 | int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
632 | { | |
633 | return -ENOSYS; | |
634 | } | |
635 | #endif | |
636 | ||
637 | #if defined(CONFIG_USER_NS) && \ | |
638 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
639 | int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
640 | #else | |
641 | static inline | |
642 | int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
643 | { | |
644 | return -ENOSYS; | |
645 | } | |
646 | #endif | |
647 | ||
648 | #if defined(CONFIG_UTS_NS) && \ | |
649 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
650 | int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
651 | #else | |
652 | static inline | |
653 | int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
654 | { | |
655 | return -ENOSYS; | |
656 | } | |
657 | #endif | |
658 | ||
659 | #if defined(CONFIG_TIME_NS) && \ | |
660 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) | |
661 | int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
662 | #else | |
663 | static inline | |
664 | int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
665 | { | |
666 | return -ENOSYS; | |
667 | } | |
668 | #endif | |
669 | ||
670 | int lttng_add_uid_to_ctx(struct lttng_kernel_ctx **ctx); | |
671 | int lttng_add_euid_to_ctx(struct lttng_kernel_ctx **ctx); | |
672 | int lttng_add_suid_to_ctx(struct lttng_kernel_ctx **ctx); | |
673 | int lttng_add_gid_to_ctx(struct lttng_kernel_ctx **ctx); | |
674 | int lttng_add_egid_to_ctx(struct lttng_kernel_ctx **ctx); | |
675 | int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
676 | int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
677 | int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
678 | int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
679 | int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
680 | int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx **ctx); | |
681 | int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
682 | ||
683 | #if defined(CONFIG_PERF_EVENTS) | |
684 | int lttng_add_perf_counter_to_ctx(uint32_t type, | |
685 | uint64_t config, | |
686 | const char *name, | |
687 | struct lttng_kernel_ctx **ctx); | |
688 | int lttng_cpuhp_perf_counter_online(unsigned int cpu, | |
689 | struct lttng_cpuhp_node *node); | |
690 | int lttng_cpuhp_perf_counter_dead(unsigned int cpu, | |
691 | struct lttng_cpuhp_node *node); | |
692 | #else | |
693 | static inline | |
694 | int lttng_add_perf_counter_to_ctx(uint32_t type, | |
695 | uint64_t config, | |
696 | const char *name, | |
697 | struct lttng_kernel_ctx **ctx) | |
698 | { | |
699 | return -ENOSYS; | |
700 | } | |
701 | static inline | |
702 | int lttng_cpuhp_perf_counter_online(unsigned int cpu, | |
703 | struct lttng_cpuhp_node *node) | |
704 | { | |
705 | return 0; | |
706 | } | |
707 | static inline | |
708 | int lttng_cpuhp_perf_counter_dead(unsigned int cpu, | |
709 | struct lttng_cpuhp_node *node) | |
710 | { | |
711 | return 0; | |
712 | } | |
713 | #endif | |
714 | ||
311e655a MD |
715 | struct lttng_event_enabler *lttng_event_enabler_create( |
716 | enum lttng_enabler_format_type format_type, | |
717 | struct lttng_kernel_abi_event *event_param, | |
718 | struct lttng_channel *chan); | |
719 | ||
720 | int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler); | |
721 | int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler); | |
722 | struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create( | |
723 | struct lttng_event_notifier_group *event_notifier_group, | |
724 | enum lttng_enabler_format_type format_type, | |
725 | struct lttng_kernel_abi_event_notifier *event_notifier_param); | |
726 | ||
727 | int lttng_event_notifier_enabler_enable( | |
728 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
729 | int lttng_event_notifier_enabler_disable( | |
730 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
731 | ||
732 | int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler, | |
733 | struct lttng_kernel_abi_filter_bytecode __user *bytecode); | |
734 | int lttng_event_notifier_enabler_attach_filter_bytecode( | |
735 | struct lttng_event_notifier_enabler *event_notifier_enabler, | |
736 | struct lttng_kernel_abi_filter_bytecode __user *bytecode); | |
737 | int lttng_event_notifier_enabler_attach_capture_bytecode( | |
738 | struct lttng_event_notifier_enabler *event_notifier_enabler, | |
739 | struct lttng_kernel_abi_capture_bytecode __user *bytecode); | |
740 | ||
741 | int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc, | |
742 | struct lttng_enabler *enabler); | |
743 | ||
744 | void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc, | |
745 | struct lttng_kernel_ctx *ctx, | |
746 | struct list_head *instance_bytecode_runtime_head, | |
747 | struct list_head *enabler_bytecode_runtime_head); | |
748 | ||
749 | #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) | |
750 | int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler); | |
751 | int lttng_syscalls_unregister_channel(struct lttng_channel *chan); | |
752 | int lttng_syscalls_destroy_event(struct lttng_channel *chan); | |
753 | int lttng_syscall_filter_enable_event( | |
754 | struct lttng_channel *chan, | |
755 | struct lttng_kernel_event_recorder *event); | |
756 | int lttng_syscall_filter_disable_event( | |
757 | struct lttng_channel *chan, | |
758 | struct lttng_kernel_event_recorder *event); | |
759 | ||
760 | long lttng_channel_syscall_mask(struct lttng_channel *channel, | |
761 | struct lttng_kernel_abi_syscall_mask __user *usyscall_mask); | |
762 | ||
763 | int lttng_syscalls_register_event_notifier( | |
764 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
765 | int lttng_syscalls_create_matching_event_notifiers( | |
766 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
767 | int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group); | |
768 | int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
769 | int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
770 | #else | |
771 | static inline int lttng_syscalls_register_event( | |
772 | struct lttng_event_enabler *event_enabler) | |
773 | { | |
774 | return -ENOSYS; | |
775 | } | |
776 | ||
777 | static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan) | |
778 | { | |
779 | return 0; | |
780 | } | |
781 | ||
782 | static inline int lttng_syscalls_destroy(struct lttng_channel *chan) | |
783 | { | |
784 | return 0; | |
785 | } | |
786 | ||
787 | static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan, | |
788 | struct lttng_kernel_event_recorder *event); | |
789 | { | |
790 | return -ENOSYS; | |
791 | } | |
792 | ||
793 | static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan, | |
794 | struct lttng_kernel_event_recorder *event); | |
795 | { | |
796 | return -ENOSYS; | |
797 | } | |
798 | ||
799 | static inline long lttng_channel_syscall_mask(struct lttng_channel *channel, | |
800 | struct lttng_kernel_syscall_mask __user *usyscall_mask) | |
801 | { | |
802 | return -ENOSYS; | |
803 | } | |
804 | ||
805 | static inline int lttng_syscalls_register_event_notifier( | |
806 | struct lttng_event_notifier_group *group) | |
807 | { | |
808 | return -ENOSYS; | |
809 | } | |
810 | ||
811 | static inline int lttng_syscalls_unregister_event_notifier_group( | |
812 | struct lttng_event_notifier_group *group) | |
813 | { | |
814 | return 0; | |
815 | } | |
816 | ||
817 | static inline int lttng_syscall_filter_enable_event_notifier( | |
818 | struct lttng_event_notifier_group *group, | |
819 | const char *name) | |
820 | { | |
821 | return -ENOSYS; | |
822 | } | |
823 | ||
824 | static inline int lttng_syscall_filter_disable_event_notifier( | |
825 | struct lttng_event_notifier_group *group, | |
826 | const char *name) | |
827 | { | |
828 | return -ENOSYS; | |
829 | } | |
0fe45627 | 830 | |
311e655a | 831 | #endif |
0fe45627 | 832 | |
e4a26d6b MD |
833 | #ifdef CONFIG_KPROBES |
834 | int lttng_kprobes_register_event(const char *name, | |
835 | const char *symbol_name, | |
836 | uint64_t offset, | |
837 | uint64_t addr, | |
838 | struct lttng_kernel_event_recorder *event); | |
839 | void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event); | |
840 | void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event); | |
841 | int lttng_kprobes_register_event_notifier(const char *symbol_name, | |
842 | uint64_t offset, | |
843 | uint64_t addr, | |
844 | struct lttng_kernel_event_notifier *event_notifier); | |
845 | void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
846 | void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier); | |
847 | #else | |
848 | static inline | |
849 | int lttng_kprobes_register_event(const char *name, | |
850 | const char *symbol_name, | |
851 | uint64_t offset, | |
852 | uint64_t addr, | |
853 | struct lttng_kernel_event_recorder *event) | |
854 | { | |
855 | return -ENOSYS; | |
856 | } | |
857 | ||
858 | static inline | |
859 | void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event) | |
860 | { | |
861 | } | |
862 | ||
863 | static inline | |
864 | void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event) | |
865 | { | |
866 | } | |
867 | ||
868 | static inline | |
869 | int lttng_kprobes_register_event_notifier(const char *symbol_name, | |
870 | uint64_t offset, | |
871 | uint64_t addr, | |
872 | struct lttng_kernel_event_notifier *event_notifier) | |
873 | { | |
874 | return -ENOSYS; | |
875 | } | |
876 | ||
877 | static inline | |
878 | void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier) | |
879 | { | |
880 | } | |
881 | ||
882 | static inline | |
883 | void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier) | |
884 | { | |
885 | } | |
886 | #endif | |
887 | ||
888 | int lttng_event_add_callsite(struct lttng_kernel_event_common *event, | |
889 | struct lttng_kernel_abi_event_callsite __user *callsite); | |
890 | ||
891 | #ifdef CONFIG_UPROBES | |
892 | int lttng_uprobes_register_event(const char *name, | |
893 | int fd, struct lttng_kernel_event_recorder *event); | |
894 | int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event, | |
895 | struct lttng_kernel_abi_event_callsite __user *callsite); | |
896 | void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event); | |
897 | void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event); | |
898 | int lttng_uprobes_register_event_notifier(const char *name, | |
899 | int fd, struct lttng_kernel_event_notifier *event_notifier); | |
900 | void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
901 | void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier); | |
902 | #else | |
903 | static inline | |
904 | int lttng_uprobes_register_event(const char *name, | |
905 | int fd, struct lttng_kernel_event_recorder *event) | |
906 | { | |
907 | return -ENOSYS; | |
908 | } | |
909 | ||
910 | static inline | |
911 | int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event, | |
912 | struct lttng_kernel_abi_event_callsite __user *callsite) | |
913 | { | |
914 | return -ENOSYS; | |
915 | } | |
916 | ||
917 | static inline | |
918 | void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event) | |
919 | { | |
920 | } | |
921 | ||
922 | static inline | |
923 | void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event) | |
924 | { | |
925 | } | |
926 | ||
927 | static inline | |
928 | int lttng_uprobes_register_event_notifier(const char *name, | |
929 | int fd, struct lttng_kernel_event_notifier *event_notifier) | |
930 | { | |
931 | return -ENOSYS; | |
932 | } | |
933 | ||
934 | static inline | |
935 | void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier) | |
936 | { | |
937 | } | |
938 | ||
939 | static inline | |
940 | void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier) | |
941 | { | |
942 | } | |
943 | #endif | |
944 | ||
945 | #ifdef CONFIG_KRETPROBES | |
946 | int lttng_kretprobes_register(const char *name, | |
947 | const char *symbol_name, | |
948 | uint64_t offset, | |
949 | uint64_t addr, | |
950 | struct lttng_kernel_event_recorder *event_entry, | |
951 | struct lttng_kernel_event_recorder *event_exit); | |
952 | void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event); | |
953 | void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event); | |
954 | int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event, | |
955 | int enable); | |
956 | #else | |
957 | static inline | |
958 | int lttng_kretprobes_register(const char *name, | |
959 | const char *symbol_name, | |
960 | uint64_t offset, | |
961 | uint64_t addr, | |
962 | struct lttng_kernel_event_recorder *event_entry, | |
963 | struct lttng_kernel_event_recorder *event_exit) | |
964 | { | |
965 | return -ENOSYS; | |
966 | } | |
967 | ||
968 | static inline | |
969 | void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event) | |
970 | { | |
971 | } | |
972 | ||
973 | static inline | |
974 | void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event) | |
975 | { | |
976 | } | |
977 | ||
978 | static inline | |
979 | int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event, | |
980 | int enable) | |
981 | { | |
982 | return -ENOSYS; | |
983 | } | |
984 | #endif | |
985 | ||
e8c0bbd3 MD |
986 | void lttng_lock_sessions(void); |
987 | void lttng_unlock_sessions(void); | |
988 | ||
989 | struct list_head *lttng_get_probe_list_head(void); | |
990 | ||
991 | int lttng_fix_pending_events(void); | |
992 | int lttng_fix_pending_event_notifiers(void); | |
993 | int lttng_session_active(void); | |
994 | bool lttng_event_notifier_active(void); | |
995 | ||
8cdc1a81 MD |
996 | struct lttng_kernel_session *lttng_session_create(void); |
997 | int lttng_session_enable(struct lttng_kernel_session *session); | |
998 | int lttng_session_disable(struct lttng_kernel_session *session); | |
999 | void lttng_session_destroy(struct lttng_kernel_session *session); | |
1000 | int lttng_session_metadata_regenerate(struct lttng_kernel_session *session); | |
1001 | int lttng_session_statedump(struct lttng_kernel_session *session); | |
e8c0bbd3 MD |
1002 | void metadata_cache_destroy(struct kref *kref); |
1003 | ||
1004 | struct lttng_counter *lttng_kernel_counter_create( | |
1005 | const char *counter_transport_name, size_t number_dimensions, | |
1006 | const size_t *dimensions_sizes); | |
1007 | int lttng_kernel_counter_read(struct lttng_counter *counter, | |
1008 | const size_t *dimension_indexes, int32_t cpu, | |
1009 | int64_t *val, bool *overflow, bool *underflow); | |
1010 | int lttng_kernel_counter_aggregate(struct lttng_counter *counter, | |
1011 | const size_t *dimension_indexes, int64_t *val, | |
1012 | bool *overflow, bool *underflow); | |
1013 | int lttng_kernel_counter_clear(struct lttng_counter *counter, | |
1014 | const size_t *dimension_indexes); | |
1015 | struct lttng_event_notifier_group *lttng_event_notifier_group_create(void); | |
1016 | int lttng_event_notifier_group_create_error_counter( | |
1017 | struct file *event_notifier_group_file, | |
1018 | const struct lttng_kernel_abi_counter_conf *error_counter_conf); | |
1019 | void lttng_event_notifier_group_destroy( | |
1020 | struct lttng_event_notifier_group *event_notifier_group); | |
1021 | ||
8cdc1a81 | 1022 | struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session, |
e8c0bbd3 MD |
1023 | const char *transport_name, |
1024 | void *buf_addr, | |
1025 | size_t subbuf_size, size_t num_subbuf, | |
1026 | unsigned int switch_timer_interval, | |
1027 | unsigned int read_timer_interval, | |
1028 | enum channel_type channel_type); | |
8cdc1a81 | 1029 | struct lttng_channel *lttng_global_channel_create(struct lttng_kernel_session *session, |
e8c0bbd3 MD |
1030 | int overwrite, void *buf_addr, |
1031 | size_t subbuf_size, size_t num_subbuf, | |
1032 | unsigned int switch_timer_interval, | |
1033 | unsigned int read_timer_interval); | |
1034 | ||
1035 | void lttng_metadata_channel_destroy(struct lttng_channel *chan); | |
1036 | struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan, | |
1037 | struct lttng_kernel_abi_event *event_param, | |
1038 | const struct lttng_kernel_event_desc *event_desc, | |
1039 | enum lttng_kernel_abi_instrumentation itype); | |
1040 | struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan, | |
1041 | struct lttng_kernel_abi_event *event_param, | |
1042 | const struct lttng_kernel_event_desc *event_desc, | |
1043 | enum lttng_kernel_abi_instrumentation itype); | |
1044 | struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_channel *chan, | |
1045 | struct lttng_kernel_abi_old_event *old_event_param, | |
1046 | const struct lttng_kernel_event_desc *internal_desc); | |
1047 | ||
1048 | struct lttng_kernel_event_notifier *lttng_event_notifier_create( | |
1049 | const struct lttng_kernel_event_desc *event_notifier_desc, | |
1050 | uint64_t id, | |
1051 | uint64_t error_counter_idx, | |
1052 | struct lttng_event_notifier_group *event_notifier_group, | |
1053 | struct lttng_kernel_abi_event_notifier *event_notifier_param, | |
1054 | enum lttng_kernel_abi_instrumentation itype); | |
1055 | struct lttng_kernel_event_notifier *_lttng_event_notifier_create( | |
1056 | const struct lttng_kernel_event_desc *event_notifier_desc, | |
1057 | uint64_t id, | |
1058 | uint64_t error_counter_idx, | |
1059 | struct lttng_event_notifier_group *event_notifier_group, | |
1060 | struct lttng_kernel_abi_event_notifier *event_notifier_param, | |
1061 | enum lttng_kernel_abi_instrumentation itype); | |
1062 | ||
1063 | int lttng_channel_enable(struct lttng_channel *channel); | |
1064 | int lttng_channel_disable(struct lttng_channel *channel); | |
1065 | int lttng_event_enable(struct lttng_kernel_event_common *event); | |
1066 | int lttng_event_disable(struct lttng_kernel_event_common *event); | |
1067 | ||
1068 | void lttng_transport_register(struct lttng_transport *transport); | |
1069 | void lttng_transport_unregister(struct lttng_transport *transport); | |
1070 | ||
1071 | void lttng_counter_transport_register(struct lttng_counter_transport *transport); | |
1072 | void lttng_counter_transport_unregister(struct lttng_counter_transport *transport); | |
1073 | ||
1074 | void synchronize_trace(void); | |
1075 | int lttng_abi_init(void); | |
1076 | int lttng_abi_compat_old_init(void); | |
1077 | void lttng_abi_exit(void); | |
1078 | void lttng_abi_compat_old_exit(void); | |
1079 | ||
1080 | const struct lttng_kernel_event_desc *lttng_event_desc_get(const char *name); | |
1081 | void lttng_event_desc_put(const struct lttng_kernel_event_desc *desc); | |
1082 | int lttng_probes_init(void); | |
1083 | void lttng_probes_exit(void); | |
1084 | ||
1085 | int lttng_metadata_output_channel(struct lttng_metadata_stream *stream, | |
1086 | struct channel *chan, bool *coherent); | |
1087 | ||
1088 | int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node *node); | |
8c0393c3 MD |
1089 | int lttng_id_tracker_empty_set(struct lttng_kernel_id_tracker *lf); |
1090 | int lttng_id_tracker_init(struct lttng_kernel_id_tracker *lf, | |
1091 | struct lttng_kernel_session *session, | |
1092 | enum tracker_type type); | |
1093 | void lttng_id_tracker_fini(struct lttng_kernel_id_tracker *lf); | |
1094 | void lttng_id_tracker_destroy(struct lttng_kernel_id_tracker *lf, bool rcu); | |
1095 | int lttng_id_tracker_add(struct lttng_kernel_id_tracker *lf, int id); | |
1096 | int lttng_id_tracker_del(struct lttng_kernel_id_tracker *lf, int id); | |
e8c0bbd3 | 1097 | |
8cdc1a81 | 1098 | int lttng_session_track_id(struct lttng_kernel_session *session, |
e8c0bbd3 | 1099 | enum tracker_type tracker_type, int id); |
8cdc1a81 | 1100 | int lttng_session_untrack_id(struct lttng_kernel_session *session, |
e8c0bbd3 MD |
1101 | enum tracker_type tracker_type, int id); |
1102 | ||
8cdc1a81 | 1103 | int lttng_session_list_tracker_ids(struct lttng_kernel_session *session, |
e8c0bbd3 MD |
1104 | enum tracker_type tracker_type); |
1105 | ||
1106 | void lttng_clock_ref(void); | |
1107 | void lttng_clock_unref(void); | |
1108 | ||
1109 | void lttng_free_event_filter_runtime(struct lttng_kernel_event_common *event); | |
1110 | ||
1111 | int lttng_probes_init(void); | |
1112 | ||
1113 | int lttng_logger_init(void); | |
1114 | void lttng_logger_exit(void); | |
1115 | ||
8cdc1a81 | 1116 | extern int lttng_statedump_start(struct lttng_kernel_session *session); |
e8c0bbd3 MD |
1117 | |
1118 | int lttng_calibrate(struct lttng_kernel_abi_calibrate *calibrate); | |
1119 | ||
1120 | extern const struct file_operations lttng_tracepoint_list_fops; | |
1121 | extern const struct file_operations lttng_syscall_list_fops; | |
1122 | ||
0fe45627 MD |
1123 | #define lttng_kernel_static_ctx_field(_event_field, _get_size, _record, _get_value, _destroy, _priv) \ |
1124 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, { \ | |
1125 | .event_field = (_event_field), \ | |
1126 | .get_size = (_get_size), \ | |
1127 | .record = (_record), \ | |
1128 | .get_value = (_get_value), \ | |
1129 | .destroy = (_destroy), \ | |
1130 | .priv = (_priv), \ | |
1131 | }) | |
1132 | ||
92bc1e23 | 1133 | #endif /* _LTTNG_EVENTS_INTERNAL_H */ |