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 | ||
0fe45627 MD |
413 | extern struct lttng_kernel_ctx *lttng_static_ctx; |
414 | ||
437d5aa5 MD |
415 | static inline |
416 | const struct lttng_kernel_type_integer *lttng_kernel_get_type_integer(const struct lttng_kernel_type_common *type) | |
417 | { | |
418 | if (type->type != lttng_kernel_type_integer) | |
419 | return NULL; | |
420 | return container_of(type, const struct lttng_kernel_type_integer, parent); | |
421 | } | |
422 | ||
423 | static inline | |
424 | const struct lttng_kernel_type_string *lttng_kernel_get_type_string(const struct lttng_kernel_type_common *type) | |
425 | { | |
426 | if (type->type != lttng_kernel_type_string) | |
427 | return NULL; | |
428 | return container_of(type, const struct lttng_kernel_type_string, parent); | |
429 | } | |
430 | ||
431 | static inline | |
432 | const struct lttng_kernel_type_enum *lttng_kernel_get_type_enum(const struct lttng_kernel_type_common *type) | |
433 | { | |
434 | if (type->type != lttng_kernel_type_enum) | |
435 | return NULL; | |
436 | return container_of(type, const struct lttng_kernel_type_enum, parent); | |
437 | } | |
438 | ||
439 | static inline | |
440 | const struct lttng_kernel_type_array *lttng_kernel_get_type_array(const struct lttng_kernel_type_common *type) | |
441 | { | |
442 | if (type->type != lttng_kernel_type_array) | |
443 | return NULL; | |
444 | return container_of(type, const struct lttng_kernel_type_array, parent); | |
445 | } | |
446 | ||
447 | static inline | |
448 | const struct lttng_kernel_type_sequence *lttng_kernel_get_type_sequence(const struct lttng_kernel_type_common *type) | |
449 | { | |
450 | if (type->type != lttng_kernel_type_sequence) | |
451 | return NULL; | |
452 | return container_of(type, const struct lttng_kernel_type_sequence, parent); | |
453 | } | |
454 | ||
455 | static inline | |
456 | const struct lttng_kernel_type_struct *lttng_kernel_get_type_struct(const struct lttng_kernel_type_common *type) | |
457 | { | |
458 | if (type->type != lttng_kernel_type_struct) | |
459 | return NULL; | |
460 | return container_of(type, const struct lttng_kernel_type_struct, parent); | |
461 | } | |
462 | ||
463 | static inline | |
464 | const struct lttng_kernel_type_variant *lttng_kernel_get_type_variant(const struct lttng_kernel_type_common *type) | |
465 | { | |
466 | if (type->type != lttng_kernel_type_variant) | |
467 | return NULL; | |
468 | return container_of(type, const struct lttng_kernel_type_variant, parent); | |
469 | } | |
470 | ||
471 | static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kernel_type_common *type) | |
472 | { | |
473 | const struct lttng_kernel_type_integer *type_integer = lttng_kernel_get_type_integer(type); | |
474 | ||
475 | if (!type_integer) | |
476 | return false; | |
477 | switch (type_integer->size) { | |
478 | case 8: /* Fall-through. */ | |
479 | case 16: /* Fall-through. */ | |
480 | case 32: /* Fall-through. */ | |
481 | case 64: | |
482 | break; | |
483 | default: | |
484 | return false; | |
485 | } | |
486 | return true; | |
487 | } | |
488 | ||
8a445457 MD |
489 | int lttng_kernel_interpret_event_filter(const struct lttng_kernel_event_common *event, |
490 | const char *interpreter_stack_data, | |
a92e844e | 491 | struct lttng_kernel_probe_ctx *probe_ctx, |
8a445457 MD |
492 | void *event_filter_ctx); |
493 | ||
5e08a34f MD |
494 | static inline |
495 | struct lttng_enabler *lttng_event_enabler_as_enabler( | |
496 | struct lttng_event_enabler *event_enabler) | |
497 | { | |
498 | return &event_enabler->base; | |
499 | } | |
500 | ||
501 | static inline | |
502 | struct lttng_enabler *lttng_event_notifier_enabler_as_enabler( | |
503 | struct lttng_event_notifier_enabler *event_notifier_enabler) | |
504 | { | |
505 | return &event_notifier_enabler->base; | |
506 | } | |
507 | ||
0fe45627 MD |
508 | int lttng_context_init(void); |
509 | void lttng_context_exit(void); | |
510 | int lttng_kernel_context_append(struct lttng_kernel_ctx **ctx_p, | |
511 | const struct lttng_kernel_ctx_field *f); | |
512 | void lttng_kernel_context_remove_last(struct lttng_kernel_ctx **ctx_p); | |
513 | struct lttng_kernel_ctx_field *lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx *ctx, | |
514 | size_t index); | |
515 | int lttng_kernel_find_context(struct lttng_kernel_ctx *ctx, const char *name); | |
516 | int lttng_kernel_get_context_index(struct lttng_kernel_ctx *ctx, const char *name); | |
517 | void lttng_kernel_destroy_context(struct lttng_kernel_ctx *ctx); | |
518 | int lttng_add_pid_to_ctx(struct lttng_kernel_ctx **ctx); | |
519 | int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx **ctx); | |
520 | int lttng_add_procname_to_ctx(struct lttng_kernel_ctx **ctx); | |
521 | int lttng_add_prio_to_ctx(struct lttng_kernel_ctx **ctx); | |
522 | int lttng_add_nice_to_ctx(struct lttng_kernel_ctx **ctx); | |
523 | int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx **ctx); | |
524 | int lttng_add_tid_to_ctx(struct lttng_kernel_ctx **ctx); | |
525 | int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx **ctx); | |
526 | int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx **ctx); | |
527 | int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx **ctx); | |
528 | int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx **ctx); | |
529 | int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx **ctx); | |
530 | int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx **ctx); | |
531 | #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT) | |
532 | int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx); | |
533 | #else | |
534 | static inline | |
535 | int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx) | |
536 | { | |
537 | return -ENOSYS; | |
538 | } | |
539 | #endif | |
540 | #ifdef CONFIG_PREEMPT_RT_FULL | |
541 | int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx); | |
542 | #else | |
543 | static inline | |
544 | int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx) | |
545 | { | |
546 | return -ENOSYS; | |
547 | } | |
548 | #endif | |
549 | ||
550 | int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx **ctx, int type); | |
551 | ||
552 | #if defined(CONFIG_CGROUPS) && \ | |
553 | ((LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) || \ | |
554 | LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0)) | |
555 | int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
556 | #else | |
557 | static inline | |
558 | int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
559 | { | |
560 | return -ENOSYS; | |
561 | } | |
562 | #endif | |
563 | ||
564 | #if defined(CONFIG_IPC_NS) && \ | |
565 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
566 | int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
567 | #else | |
568 | static inline | |
569 | int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
570 | { | |
571 | return -ENOSYS; | |
572 | } | |
573 | #endif | |
574 | ||
575 | #if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \ | |
576 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
577 | int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
578 | #else | |
579 | static inline | |
580 | int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
581 | { | |
582 | return -ENOSYS; | |
583 | } | |
584 | #endif | |
585 | ||
586 | #if defined(CONFIG_NET_NS) && \ | |
587 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
588 | int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
589 | #else | |
590 | static inline | |
591 | int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
592 | { | |
593 | return -ENOSYS; | |
594 | } | |
595 | #endif | |
596 | ||
597 | #if defined(CONFIG_PID_NS) && \ | |
598 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
599 | int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
600 | #else | |
601 | static inline | |
602 | int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
603 | { | |
604 | return -ENOSYS; | |
605 | } | |
606 | #endif | |
607 | ||
608 | #if defined(CONFIG_USER_NS) && \ | |
609 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
610 | int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
611 | #else | |
612 | static inline | |
613 | int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
614 | { | |
615 | return -ENOSYS; | |
616 | } | |
617 | #endif | |
618 | ||
619 | #if defined(CONFIG_UTS_NS) && \ | |
620 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0)) | |
621 | int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
622 | #else | |
623 | static inline | |
624 | int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
625 | { | |
626 | return -ENOSYS; | |
627 | } | |
628 | #endif | |
629 | ||
630 | #if defined(CONFIG_TIME_NS) && \ | |
631 | (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) | |
632 | int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx); | |
633 | #else | |
634 | static inline | |
635 | int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx) | |
636 | { | |
637 | return -ENOSYS; | |
638 | } | |
639 | #endif | |
640 | ||
641 | int lttng_add_uid_to_ctx(struct lttng_kernel_ctx **ctx); | |
642 | int lttng_add_euid_to_ctx(struct lttng_kernel_ctx **ctx); | |
643 | int lttng_add_suid_to_ctx(struct lttng_kernel_ctx **ctx); | |
644 | int lttng_add_gid_to_ctx(struct lttng_kernel_ctx **ctx); | |
645 | int lttng_add_egid_to_ctx(struct lttng_kernel_ctx **ctx); | |
646 | int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
647 | int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
648 | int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
649 | int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx **ctx); | |
650 | int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
651 | int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx **ctx); | |
652 | int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx **ctx); | |
653 | ||
654 | #if defined(CONFIG_PERF_EVENTS) | |
655 | int lttng_add_perf_counter_to_ctx(uint32_t type, | |
656 | uint64_t config, | |
657 | const char *name, | |
658 | struct lttng_kernel_ctx **ctx); | |
659 | int lttng_cpuhp_perf_counter_online(unsigned int cpu, | |
660 | struct lttng_cpuhp_node *node); | |
661 | int lttng_cpuhp_perf_counter_dead(unsigned int cpu, | |
662 | struct lttng_cpuhp_node *node); | |
663 | #else | |
664 | static inline | |
665 | int lttng_add_perf_counter_to_ctx(uint32_t type, | |
666 | uint64_t config, | |
667 | const char *name, | |
668 | struct lttng_kernel_ctx **ctx) | |
669 | { | |
670 | return -ENOSYS; | |
671 | } | |
672 | static inline | |
673 | int lttng_cpuhp_perf_counter_online(unsigned int cpu, | |
674 | struct lttng_cpuhp_node *node) | |
675 | { | |
676 | return 0; | |
677 | } | |
678 | static inline | |
679 | int lttng_cpuhp_perf_counter_dead(unsigned int cpu, | |
680 | struct lttng_cpuhp_node *node) | |
681 | { | |
682 | return 0; | |
683 | } | |
684 | #endif | |
685 | ||
311e655a MD |
686 | struct lttng_event_enabler *lttng_event_enabler_create( |
687 | enum lttng_enabler_format_type format_type, | |
688 | struct lttng_kernel_abi_event *event_param, | |
689 | struct lttng_channel *chan); | |
690 | ||
691 | int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler); | |
692 | int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler); | |
693 | struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create( | |
694 | struct lttng_event_notifier_group *event_notifier_group, | |
695 | enum lttng_enabler_format_type format_type, | |
696 | struct lttng_kernel_abi_event_notifier *event_notifier_param); | |
697 | ||
698 | int lttng_event_notifier_enabler_enable( | |
699 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
700 | int lttng_event_notifier_enabler_disable( | |
701 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
702 | ||
703 | int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler, | |
704 | struct lttng_kernel_abi_filter_bytecode __user *bytecode); | |
705 | int lttng_event_notifier_enabler_attach_filter_bytecode( | |
706 | struct lttng_event_notifier_enabler *event_notifier_enabler, | |
707 | struct lttng_kernel_abi_filter_bytecode __user *bytecode); | |
708 | int lttng_event_notifier_enabler_attach_capture_bytecode( | |
709 | struct lttng_event_notifier_enabler *event_notifier_enabler, | |
710 | struct lttng_kernel_abi_capture_bytecode __user *bytecode); | |
711 | ||
712 | int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc, | |
713 | struct lttng_enabler *enabler); | |
714 | ||
715 | void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc, | |
716 | struct lttng_kernel_ctx *ctx, | |
717 | struct list_head *instance_bytecode_runtime_head, | |
718 | struct list_head *enabler_bytecode_runtime_head); | |
719 | ||
720 | #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS) | |
721 | int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler); | |
722 | int lttng_syscalls_unregister_channel(struct lttng_channel *chan); | |
723 | int lttng_syscalls_destroy_event(struct lttng_channel *chan); | |
724 | int lttng_syscall_filter_enable_event( | |
725 | struct lttng_channel *chan, | |
726 | struct lttng_kernel_event_recorder *event); | |
727 | int lttng_syscall_filter_disable_event( | |
728 | struct lttng_channel *chan, | |
729 | struct lttng_kernel_event_recorder *event); | |
730 | ||
731 | long lttng_channel_syscall_mask(struct lttng_channel *channel, | |
732 | struct lttng_kernel_abi_syscall_mask __user *usyscall_mask); | |
733 | ||
734 | int lttng_syscalls_register_event_notifier( | |
735 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
736 | int lttng_syscalls_create_matching_event_notifiers( | |
737 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
738 | int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group); | |
739 | int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
740 | int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
741 | #else | |
742 | static inline int lttng_syscalls_register_event( | |
743 | struct lttng_event_enabler *event_enabler) | |
744 | { | |
745 | return -ENOSYS; | |
746 | } | |
747 | ||
748 | static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan) | |
749 | { | |
750 | return 0; | |
751 | } | |
752 | ||
753 | static inline int lttng_syscalls_destroy(struct lttng_channel *chan) | |
754 | { | |
755 | return 0; | |
756 | } | |
757 | ||
758 | static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan, | |
759 | struct lttng_kernel_event_recorder *event); | |
760 | { | |
761 | return -ENOSYS; | |
762 | } | |
763 | ||
764 | static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan, | |
765 | struct lttng_kernel_event_recorder *event); | |
766 | { | |
767 | return -ENOSYS; | |
768 | } | |
769 | ||
770 | static inline long lttng_channel_syscall_mask(struct lttng_channel *channel, | |
771 | struct lttng_kernel_syscall_mask __user *usyscall_mask) | |
772 | { | |
773 | return -ENOSYS; | |
774 | } | |
775 | ||
776 | static inline int lttng_syscalls_register_event_notifier( | |
777 | struct lttng_event_notifier_group *group) | |
778 | { | |
779 | return -ENOSYS; | |
780 | } | |
781 | ||
782 | static inline int lttng_syscalls_unregister_event_notifier_group( | |
783 | struct lttng_event_notifier_group *group) | |
784 | { | |
785 | return 0; | |
786 | } | |
787 | ||
788 | static inline int lttng_syscall_filter_enable_event_notifier( | |
789 | struct lttng_event_notifier_group *group, | |
790 | const char *name) | |
791 | { | |
792 | return -ENOSYS; | |
793 | } | |
794 | ||
795 | static inline int lttng_syscall_filter_disable_event_notifier( | |
796 | struct lttng_event_notifier_group *group, | |
797 | const char *name) | |
798 | { | |
799 | return -ENOSYS; | |
800 | } | |
0fe45627 | 801 | |
311e655a | 802 | #endif |
0fe45627 | 803 | |
e4a26d6b MD |
804 | #ifdef CONFIG_KPROBES |
805 | int lttng_kprobes_register_event(const char *name, | |
806 | const char *symbol_name, | |
807 | uint64_t offset, | |
808 | uint64_t addr, | |
809 | struct lttng_kernel_event_recorder *event); | |
810 | void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event); | |
811 | void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event); | |
812 | int lttng_kprobes_register_event_notifier(const char *symbol_name, | |
813 | uint64_t offset, | |
814 | uint64_t addr, | |
815 | struct lttng_kernel_event_notifier *event_notifier); | |
816 | void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
817 | void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier); | |
818 | #else | |
819 | static inline | |
820 | int lttng_kprobes_register_event(const char *name, | |
821 | const char *symbol_name, | |
822 | uint64_t offset, | |
823 | uint64_t addr, | |
824 | struct lttng_kernel_event_recorder *event) | |
825 | { | |
826 | return -ENOSYS; | |
827 | } | |
828 | ||
829 | static inline | |
830 | void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event) | |
831 | { | |
832 | } | |
833 | ||
834 | static inline | |
835 | void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event) | |
836 | { | |
837 | } | |
838 | ||
839 | static inline | |
840 | int lttng_kprobes_register_event_notifier(const char *symbol_name, | |
841 | uint64_t offset, | |
842 | uint64_t addr, | |
843 | struct lttng_kernel_event_notifier *event_notifier) | |
844 | { | |
845 | return -ENOSYS; | |
846 | } | |
847 | ||
848 | static inline | |
849 | void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier) | |
850 | { | |
851 | } | |
852 | ||
853 | static inline | |
854 | void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier) | |
855 | { | |
856 | } | |
857 | #endif | |
858 | ||
859 | int lttng_event_add_callsite(struct lttng_kernel_event_common *event, | |
860 | struct lttng_kernel_abi_event_callsite __user *callsite); | |
861 | ||
862 | #ifdef CONFIG_UPROBES | |
863 | int lttng_uprobes_register_event(const char *name, | |
864 | int fd, struct lttng_kernel_event_recorder *event); | |
865 | int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event, | |
866 | struct lttng_kernel_abi_event_callsite __user *callsite); | |
867 | void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event); | |
868 | void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event); | |
869 | int lttng_uprobes_register_event_notifier(const char *name, | |
870 | int fd, struct lttng_kernel_event_notifier *event_notifier); | |
871 | void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier); | |
872 | void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier); | |
873 | #else | |
874 | static inline | |
875 | int lttng_uprobes_register_event(const char *name, | |
876 | int fd, struct lttng_kernel_event_recorder *event) | |
877 | { | |
878 | return -ENOSYS; | |
879 | } | |
880 | ||
881 | static inline | |
882 | int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event, | |
883 | struct lttng_kernel_abi_event_callsite __user *callsite) | |
884 | { | |
885 | return -ENOSYS; | |
886 | } | |
887 | ||
888 | static inline | |
889 | void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event) | |
890 | { | |
891 | } | |
892 | ||
893 | static inline | |
894 | void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event) | |
895 | { | |
896 | } | |
897 | ||
898 | static inline | |
899 | int lttng_uprobes_register_event_notifier(const char *name, | |
900 | int fd, struct lttng_kernel_event_notifier *event_notifier) | |
901 | { | |
902 | return -ENOSYS; | |
903 | } | |
904 | ||
905 | static inline | |
906 | void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier) | |
907 | { | |
908 | } | |
909 | ||
910 | static inline | |
911 | void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier) | |
912 | { | |
913 | } | |
914 | #endif | |
915 | ||
916 | #ifdef CONFIG_KRETPROBES | |
917 | int lttng_kretprobes_register(const char *name, | |
918 | const char *symbol_name, | |
919 | uint64_t offset, | |
920 | uint64_t addr, | |
921 | struct lttng_kernel_event_recorder *event_entry, | |
922 | struct lttng_kernel_event_recorder *event_exit); | |
923 | void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event); | |
924 | void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event); | |
925 | int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event, | |
926 | int enable); | |
927 | #else | |
928 | static inline | |
929 | int lttng_kretprobes_register(const char *name, | |
930 | const char *symbol_name, | |
931 | uint64_t offset, | |
932 | uint64_t addr, | |
933 | struct lttng_kernel_event_recorder *event_entry, | |
934 | struct lttng_kernel_event_recorder *event_exit) | |
935 | { | |
936 | return -ENOSYS; | |
937 | } | |
938 | ||
939 | static inline | |
940 | void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event) | |
941 | { | |
942 | } | |
943 | ||
944 | static inline | |
945 | void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event) | |
946 | { | |
947 | } | |
948 | ||
949 | static inline | |
950 | int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event, | |
951 | int enable) | |
952 | { | |
953 | return -ENOSYS; | |
954 | } | |
955 | #endif | |
956 | ||
e8c0bbd3 MD |
957 | void lttng_lock_sessions(void); |
958 | void lttng_unlock_sessions(void); | |
959 | ||
960 | struct list_head *lttng_get_probe_list_head(void); | |
961 | ||
962 | int lttng_fix_pending_events(void); | |
963 | int lttng_fix_pending_event_notifiers(void); | |
964 | int lttng_session_active(void); | |
965 | bool lttng_event_notifier_active(void); | |
966 | ||
8cdc1a81 MD |
967 | struct lttng_kernel_session *lttng_session_create(void); |
968 | int lttng_session_enable(struct lttng_kernel_session *session); | |
969 | int lttng_session_disable(struct lttng_kernel_session *session); | |
970 | void lttng_session_destroy(struct lttng_kernel_session *session); | |
971 | int lttng_session_metadata_regenerate(struct lttng_kernel_session *session); | |
972 | int lttng_session_statedump(struct lttng_kernel_session *session); | |
e8c0bbd3 MD |
973 | void metadata_cache_destroy(struct kref *kref); |
974 | ||
975 | struct lttng_counter *lttng_kernel_counter_create( | |
976 | const char *counter_transport_name, size_t number_dimensions, | |
977 | const size_t *dimensions_sizes); | |
978 | int lttng_kernel_counter_read(struct lttng_counter *counter, | |
979 | const size_t *dimension_indexes, int32_t cpu, | |
980 | int64_t *val, bool *overflow, bool *underflow); | |
981 | int lttng_kernel_counter_aggregate(struct lttng_counter *counter, | |
982 | const size_t *dimension_indexes, int64_t *val, | |
983 | bool *overflow, bool *underflow); | |
984 | int lttng_kernel_counter_clear(struct lttng_counter *counter, | |
985 | const size_t *dimension_indexes); | |
986 | struct lttng_event_notifier_group *lttng_event_notifier_group_create(void); | |
987 | int lttng_event_notifier_group_create_error_counter( | |
988 | struct file *event_notifier_group_file, | |
989 | const struct lttng_kernel_abi_counter_conf *error_counter_conf); | |
990 | void lttng_event_notifier_group_destroy( | |
991 | struct lttng_event_notifier_group *event_notifier_group); | |
992 | ||
8cdc1a81 | 993 | struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session, |
e8c0bbd3 MD |
994 | const char *transport_name, |
995 | void *buf_addr, | |
996 | size_t subbuf_size, size_t num_subbuf, | |
997 | unsigned int switch_timer_interval, | |
998 | unsigned int read_timer_interval, | |
999 | enum channel_type channel_type); | |
8cdc1a81 | 1000 | struct lttng_channel *lttng_global_channel_create(struct lttng_kernel_session *session, |
e8c0bbd3 MD |
1001 | int overwrite, void *buf_addr, |
1002 | size_t subbuf_size, size_t num_subbuf, | |
1003 | unsigned int switch_timer_interval, | |
1004 | unsigned int read_timer_interval); | |
1005 | ||
1006 | void lttng_metadata_channel_destroy(struct lttng_channel *chan); | |
1007 | struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan, | |
1008 | struct lttng_kernel_abi_event *event_param, | |
1009 | const struct lttng_kernel_event_desc *event_desc, | |
1010 | enum lttng_kernel_abi_instrumentation itype); | |
1011 | struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan, | |
1012 | struct lttng_kernel_abi_event *event_param, | |
1013 | const struct lttng_kernel_event_desc *event_desc, | |
1014 | enum lttng_kernel_abi_instrumentation itype); | |
1015 | struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_channel *chan, | |
1016 | struct lttng_kernel_abi_old_event *old_event_param, | |
1017 | const struct lttng_kernel_event_desc *internal_desc); | |
1018 | ||
1019 | struct lttng_kernel_event_notifier *lttng_event_notifier_create( | |
1020 | const struct lttng_kernel_event_desc *event_notifier_desc, | |
1021 | uint64_t id, | |
1022 | uint64_t error_counter_idx, | |
1023 | struct lttng_event_notifier_group *event_notifier_group, | |
1024 | struct lttng_kernel_abi_event_notifier *event_notifier_param, | |
1025 | enum lttng_kernel_abi_instrumentation itype); | |
1026 | struct lttng_kernel_event_notifier *_lttng_event_notifier_create( | |
1027 | const struct lttng_kernel_event_desc *event_notifier_desc, | |
1028 | uint64_t id, | |
1029 | uint64_t error_counter_idx, | |
1030 | struct lttng_event_notifier_group *event_notifier_group, | |
1031 | struct lttng_kernel_abi_event_notifier *event_notifier_param, | |
1032 | enum lttng_kernel_abi_instrumentation itype); | |
1033 | ||
1034 | int lttng_channel_enable(struct lttng_channel *channel); | |
1035 | int lttng_channel_disable(struct lttng_channel *channel); | |
1036 | int lttng_event_enable(struct lttng_kernel_event_common *event); | |
1037 | int lttng_event_disable(struct lttng_kernel_event_common *event); | |
1038 | ||
1039 | void lttng_transport_register(struct lttng_transport *transport); | |
1040 | void lttng_transport_unregister(struct lttng_transport *transport); | |
1041 | ||
1042 | void lttng_counter_transport_register(struct lttng_counter_transport *transport); | |
1043 | void lttng_counter_transport_unregister(struct lttng_counter_transport *transport); | |
1044 | ||
1045 | void synchronize_trace(void); | |
1046 | int lttng_abi_init(void); | |
1047 | int lttng_abi_compat_old_init(void); | |
1048 | void lttng_abi_exit(void); | |
1049 | void lttng_abi_compat_old_exit(void); | |
1050 | ||
1051 | const struct lttng_kernel_event_desc *lttng_event_desc_get(const char *name); | |
1052 | void lttng_event_desc_put(const struct lttng_kernel_event_desc *desc); | |
1053 | int lttng_probes_init(void); | |
1054 | void lttng_probes_exit(void); | |
1055 | ||
1056 | int lttng_metadata_output_channel(struct lttng_metadata_stream *stream, | |
1057 | struct channel *chan, bool *coherent); | |
1058 | ||
1059 | int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node *node); | |
1060 | int lttng_id_tracker_empty_set(struct lttng_id_tracker *lf); | |
1061 | void lttng_id_tracker_destroy(struct lttng_id_tracker *lf, bool rcu); | |
1062 | int lttng_id_tracker_add(struct lttng_id_tracker *lf, int id); | |
1063 | int lttng_id_tracker_del(struct lttng_id_tracker *lf, int id); | |
1064 | ||
8cdc1a81 | 1065 | int lttng_session_track_id(struct lttng_kernel_session *session, |
e8c0bbd3 | 1066 | enum tracker_type tracker_type, int id); |
8cdc1a81 | 1067 | int lttng_session_untrack_id(struct lttng_kernel_session *session, |
e8c0bbd3 MD |
1068 | enum tracker_type tracker_type, int id); |
1069 | ||
8cdc1a81 | 1070 | int lttng_session_list_tracker_ids(struct lttng_kernel_session *session, |
e8c0bbd3 MD |
1071 | enum tracker_type tracker_type); |
1072 | ||
1073 | void lttng_clock_ref(void); | |
1074 | void lttng_clock_unref(void); | |
1075 | ||
1076 | void lttng_free_event_filter_runtime(struct lttng_kernel_event_common *event); | |
1077 | ||
1078 | int lttng_probes_init(void); | |
1079 | ||
1080 | int lttng_logger_init(void); | |
1081 | void lttng_logger_exit(void); | |
1082 | ||
8cdc1a81 | 1083 | extern int lttng_statedump_start(struct lttng_kernel_session *session); |
e8c0bbd3 MD |
1084 | |
1085 | int lttng_calibrate(struct lttng_kernel_abi_calibrate *calibrate); | |
1086 | ||
1087 | extern const struct file_operations lttng_tracepoint_list_fops; | |
1088 | extern const struct file_operations lttng_syscall_list_fops; | |
1089 | ||
0fe45627 MD |
1090 | #define lttng_kernel_static_ctx_field(_event_field, _get_size, _record, _get_value, _destroy, _priv) \ |
1091 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, { \ | |
1092 | .event_field = (_event_field), \ | |
1093 | .get_size = (_get_size), \ | |
1094 | .record = (_record), \ | |
1095 | .get_value = (_get_value), \ | |
1096 | .destroy = (_destroy), \ | |
1097 | .priv = (_priv), \ | |
1098 | }) | |
1099 | ||
92bc1e23 | 1100 | #endif /* _LTTNG_EVENTS_INTERNAL_H */ |