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