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