Move bytecode structures to internal header
[lttng-modules.git] / include / lttng / events.h
CommitLineData
b7cdc182 1/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
9f36eaed 2 *
2df37e95 3 * lttng/events.h
4e3c1b9b 4 *
4e3c1b9b 5 * Holds LTTng per-session event registry.
17baffe2 6 *
886d51a3 7 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4e3c1b9b
MD
8 */
9
9f36eaed
MJ
10#ifndef _LTTNG_EVENTS_H
11#define _LTTNG_EVENTS_H
12
5f4c791e 13#include <lttng/kernel-version.h>
4e3c1b9b 14#include <linux/list.h>
d6d808f3 15#include <linux/kprobes.h>
d83004aa 16#include <linux/kref.h>
41f229dc 17#include <linux/uuid.h>
754d534a 18#include <linux/irq_work.h>
149b9a9d 19#include <wrapper/uprobes.h>
2df37e95
MD
20#include <lttng/cpuhotplug.h>
21#include <lttng/tracer.h>
22#include <lttng/abi.h>
23#include <lttng/abi-old.h>
24#include <lttng/endian.h>
4e3c1b9b 25
e97dc605 26#define lttng_is_signed_type(type) (((type) -1) < (type) 1)
9e7e4892 27
a90917c3
MD
28struct lttng_channel;
29struct lttng_session;
d83004aa 30struct lttng_metadata_cache;
1c25284c 31struct lib_ring_buffer_ctx;
ba1f5986 32struct perf_event;
833ad6a0 33struct perf_event_attr;
3b731ab1 34struct lib_ring_buffer_config;
4e3c1b9b 35
c0edae1d
MD
36/* Type description */
37
12bb2edb
MD
38enum lttng_kernel_type {
39 lttng_kernel_type_integer,
40 lttng_kernel_type_string,
437d5aa5
MD
41 lttng_kernel_type_enum,
42 lttng_kernel_type_array,
43 lttng_kernel_type_sequence,
44 lttng_kernel_type_struct,
45 lttng_kernel_type_variant,
12bb2edb 46 NR_LTTNG_KERNEL_TYPES,
c0edae1d
MD
47};
48
28cbcb59
MD
49enum lttng_kernel_string_encoding {
50 lttng_kernel_string_encoding_none = 0,
51 lttng_kernel_string_encoding_UTF8 = 1,
52 lttng_kernel_string_encoding_ASCII = 2,
53 NR_LTTNG_KERNEL_STRING_ENCODING,
c0edae1d
MD
54};
55
d83004aa
JD
56enum channel_type {
57 PER_CPU_CHANNEL,
58 METADATA_CHANNEL,
59};
60
a28cc520 61struct lttng_kernel_enum_value {
141ddf28
MD
62 unsigned long long value;
63 unsigned int signedness:1;
64};
65
a28cc520
MD
66struct lttng_kernel_enum_entry {
67 struct lttng_kernel_enum_value start, end; /* start and end are inclusive */
c0edae1d 68 const char *string;
08ad1061
PP
69 struct {
70 unsigned int is_auto:1;
71 } options;
c0edae1d
MD
72};
73
437d5aa5
MD
74/*
75 * struct lttng_kernel_type_common is fixed-size. Its children inherits
76 * from it by embedding struct lttng_kernel_type_common as its first field.
77 */
78struct lttng_kernel_type_common {
79 enum lttng_kernel_type type;
80};
81
82struct lttng_kernel_type_integer {
83 struct lttng_kernel_type_common parent;
c099397a
MD
84 unsigned int size; /* in bits */
85 unsigned short alignment; /* in bits */
9cccf98a
MD
86 unsigned int signedness:1,
87 reverse_byte_order:1;
e0a7a7c4 88 unsigned int base; /* 2, 8, 10, 16, for pretty print */
437d5aa5
MD
89};
90
91struct lttng_kernel_type_string {
92 struct lttng_kernel_type_common parent;
28cbcb59 93 enum lttng_kernel_string_encoding encoding;
c099397a
MD
94};
95
437d5aa5
MD
96struct lttng_kernel_type_enum {
97 struct lttng_kernel_type_common parent;
98 const struct lttng_kernel_enum_desc *desc; /* Enumeration mapping */
99 const struct lttng_kernel_type_common *container_type;
100};
101
102struct lttng_kernel_type_array {
103 struct lttng_kernel_type_common parent;
104 const struct lttng_kernel_type_common *elem_type;
105 unsigned int length; /* Num. elems. */
106 unsigned int alignment;
107 enum lttng_kernel_string_encoding encoding;
108};
109
110struct lttng_kernel_type_sequence {
111 struct lttng_kernel_type_common parent;
51ef4536 112 const char *length_name; /* Length field name. If NULL, use previous field. */
437d5aa5
MD
113 const struct lttng_kernel_type_common *elem_type;
114 unsigned int alignment; /* Alignment before elements. */
115 enum lttng_kernel_string_encoding encoding;
116};
117
118struct lttng_kernel_type_struct {
119 struct lttng_kernel_type_common parent;
120 unsigned int nr_fields;
121 const struct lttng_kernel_event_field **fields; /* Array of pointers to fields. */
122 unsigned int alignment;
123};
124
125struct lttng_kernel_type_variant {
126 struct lttng_kernel_type_common parent;
51ef4536 127 const char *tag_name; /* Tag field name. If NULL, use previous field. */
437d5aa5
MD
128 const struct lttng_kernel_event_field **choices; /* Array of pointers to fields. */
129 unsigned int nr_choices;
130 unsigned int alignment;
c099397a
MD
131};
132
d96a4a7a 133struct lttng_kernel_enum_desc {
c099397a 134 const char *name;
437d5aa5 135 const struct lttng_kernel_enum_entry **entries;
141ddf28 136 unsigned int nr_entries;
c099397a 137};
c0edae1d
MD
138
139/* Event field description */
140
437d5aa5 141struct lttng_kernel_event_field {
c0edae1d 142 const char *name;
437d5aa5 143 const struct lttng_kernel_type_common *type;
f127e61e 144 unsigned int nowrite:1, /* do not write into trace */
ceabb767
MD
145 user:1, /* fetch from user-space */
146 nofilter:1; /* do not consider for filter */
c0edae1d
MD
147};
148
437d5aa5
MD
149#define lttng_kernel_static_type_integer(_size, _alignment, _signedness, _byte_order, _base) \
150 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_integer, { \
151 .parent = { \
152 .type = lttng_kernel_type_integer, \
153 }, \
154 .size = (_size), \
155 .alignment = (_alignment), \
156 .signedness = (_signedness), \
157 .reverse_byte_order = (_byte_order) != __BYTE_ORDER, \
158 .base = (_base), \
159 }))
160
161#define lttng_kernel_static_type_integer_from_type(_type, _byte_order, _base) \
162 lttng_kernel_static_type_integer(sizeof(_type) * CHAR_BIT, \
163 lttng_alignof(_type) * CHAR_BIT, \
164 lttng_is_signed_type(_type), \
165 _byte_order, \
166 _base)
167
168#define lttng_kernel_static_type_enum(_desc, _container_type) \
169 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_enum, { \
170 .parent = { \
171 .type = lttng_kernel_type_enum, \
172 }, \
173 .desc = (_desc), \
174 .container_type = (_container_type), \
175 }))
176
177#define lttng_kernel_static_type_array(_length, _elem_type, _alignment, _encoding) \
178 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_array, { \
179 .parent = { \
180 .type = lttng_kernel_type_array, \
181 }, \
182 .length = (_length), \
183 .alignment = (_alignment), \
184 .encoding = lttng_kernel_string_encoding_##_encoding, \
185 .elem_type = (_elem_type), \
186 }))
187
188#define lttng_kernel_static_type_array_text(_length) \
189 lttng_kernel_static_type_array(_length, \
190 lttng_kernel_static_type_integer(sizeof(char) * CHAR_BIT, \
191 lttng_alignof(char) * CHAR_BIT, lttng_is_signed_type(char), \
192 __BYTE_ORDER, 10), \
193 0, UTF8)
194
195#define lttng_kernel_static_type_sequence(_length_name, _elem_type, _alignment, _encoding) \
196 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_sequence, { \
197 .parent = { \
198 .type = lttng_kernel_type_sequence, \
199 }, \
200 .length_name = (_length_name), \
201 .alignment = (_alignment), \
202 .encoding = lttng_kernel_string_encoding_##_encoding, \
203 .elem_type = (_elem_type), \
204 }))
205
206#define lttng_kernel_static_type_string(_encoding) \
207 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_string, { \
208 .parent = { \
209 .type = lttng_kernel_type_string, \
210 }, \
211 .encoding = lttng_kernel_string_encoding_##_encoding, \
212 }))
213
214#define lttng_kernel_static_type_struct(_nr_fields, _fields, _alignment) \
215 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_struct, { \
216 .parent = { \
217 .type = lttng_kernel_type_struct, \
218 }, \
219 .nr_fields = (_nr_fields), \
220 .fields = _fields, \
221 .alignment = (_alignment), \
222 }))
223
224#define lttng_kernel_static_type_variant(_nr_choices, _choices, _tag_name, _alignment) \
225 ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_variant, { \
226 .parent = { \
227 .type = lttng_kernel_type_variant, \
228 }, \
229 .tag_name = (_tag_name), \
230 .choices = _choices, \
231 .nr_choices = (_nr_choices), \
232 .alignment = (_alignment), \
233 }))
234
235#define lttng_kernel_static_event_field(_name, _type, _nowrite, _user, _nofilter) \
236 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field, { \
237 .name = (_name), \
238 .type = (_type), \
239 .nowrite = (_nowrite), \
240 .user = (_user), \
241 .nofilter = (_nofilter), \
242 })
243
244#define lttng_kernel_static_event_field_array(_fields...) \
245 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field *, \
246 _fields \
247 )
248
437d5aa5
MD
249#define lttng_kernel_static_enum_entry_value(_string, _value) \
250 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \
251 .start = { \
252 .signedness = lttng_is_signed_type(__typeof__(_value)), \
253 .value = lttng_is_signed_type(__typeof__(_value)) ? \
254 (long long) (_value) : (_value), \
255 }, \
256 .end = { \
257 .signedness = lttng_is_signed_type(__typeof__(_value)), \
258 .value = lttng_is_signed_type(__typeof__(_value)) ? \
259 (long long) (_value) : (_value), \
260 }, \
261 .string = (_string), \
262 }),
263
264#define lttng_kernel_static_enum_entry_range(_string, _range_start, _range_end) \
265 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \
266 .start = { \
267 .signedness = lttng_is_signed_type(__typeof__(_range_start)), \
268 .value = lttng_is_signed_type(__typeof__(_range_start)) ? \
269 (long long) (_range_start) : (_range_start), \
270 }, \
271 .end = { \
272 .signedness = lttng_is_signed_type(__typeof__(_range_end)), \
273 .value = lttng_is_signed_type(__typeof__(_range_end)) ? \
274 (long long) (_range_end) : (_range_end), \
275 }, \
276 .string = (_string), \
277 }),
278
279#define lttng_kernel_static_enum_entry_auto(_string) \
280 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \
281 .start = { \
282 .signedness = -1, \
283 .value = -1, \
284 }, \
285 .end = { \
286 .signedness = -1, \
287 .value = -1, \
288 }, \
289 .string = (_string), \
290 .options = { \
291 .is_auto = 1, \
292 } \
293 }),
294
a92e844e 295struct lttng_kernel_probe_ctx {
e2d5dbc7 296 struct lttng_kernel_event_common *event;
79150a49
JD
297 uint8_t interruptible;
298};
299
437d5aa5
MD
300struct lttng_kernel_event_desc {
301 const char *event_name; /* lttng-modules name */
302 const char *event_kname; /* Linux kernel name (tracepoints) */
303 const struct lttng_kernel_probe_desc *probe_desc;
304 void (*probe_callback)(void);
305 const struct lttng_kernel_event_field **fields; /* event payload */
c0edae1d 306 unsigned int nr_fields;
dc7f600a 307 struct module *owner;
c0edae1d
MD
308};
309
437d5aa5
MD
310struct lttng_kernel_probe_desc {
311 const char *provider_name;
312 const struct lttng_kernel_event_desc **event_desc;
85a9ca7f
MD
313 unsigned int nr_events;
314 struct list_head head; /* chain registered probes */
3c997079
MD
315 struct list_head lazy_init_head;
316 int lazy; /* lazy registration */
85a9ca7f
MD
317};
318
7371f44c
MD
319struct lttng_krp; /* Kretprobe handling */
320
3c997079
MD
321/*
322 * Objects in a linked-list of enablers, owned by an event.
323 */
324struct lttng_enabler_ref {
325 struct list_head node; /* enabler ref list */
326 struct lttng_enabler *ref; /* backward ref */
327};
328
3aed4dca 329struct lttng_uprobe_handler {
e2d5dbc7 330 struct lttng_kernel_event_common *event;
3aed4dca
FD
331 loff_t offset;
332 struct uprobe_consumer up_consumer;
333 struct list_head node;
334};
335
8bf17deb
FD
336struct lttng_kprobe {
337 struct kprobe kp;
338 char *symbol_name;
339};
340
83b802dc
FD
341struct lttng_uprobe {
342 struct inode *inode;
343 struct list_head head;
344};
345
badfe9f5
MD
346enum lttng_syscall_entryexit {
347 LTTNG_SYSCALL_ENTRY,
348 LTTNG_SYSCALL_EXIT,
349};
350
351enum lttng_syscall_abi {
352 LTTNG_SYSCALL_ABI_NATIVE,
353 LTTNG_SYSCALL_ABI_COMPAT,
354};
355
8a445457
MD
356/*
357 * Result of the run_filter() callback.
358 */
359enum lttng_kernel_event_filter_result {
360 LTTNG_KERNEL_EVENT_FILTER_ACCEPT = 0,
361 LTTNG_KERNEL_EVENT_FILTER_REJECT = 1,
362};
363
a67ba386
MD
364struct lttng_kernel_event_common_private;
365
366enum lttng_kernel_event_type {
367 LTTNG_KERNEL_EVENT_TYPE_RECORDER = 0,
368 LTTNG_KERNEL_EVENT_TYPE_NOTIFIER = 1,
369};
370
371struct lttng_kernel_event_common {
372 struct lttng_kernel_event_common_private *priv; /* Private event interface */
373
374 enum lttng_kernel_event_type type;
375 /* Get child with container_of(). */
376
e64957da 377 int enabled;
a67ba386 378 int eval_filter; /* Need to evaluate filters */
8a445457 379 int (*run_filter)(const struct lttng_kernel_event_common *event,
a67ba386 380 const char *stack_data,
a92e844e 381 struct lttng_kernel_probe_ctx *probe_ctx,
a67ba386 382 void *filter_ctx);
3c997079
MD
383};
384
a67ba386
MD
385struct lttng_kernel_event_recorder_private;
386
387struct lttng_kernel_event_recorder {
388 struct lttng_kernel_event_common parent;
389 struct lttng_kernel_event_recorder_private *priv; /* Private event record interface */
390
391 struct lttng_channel *chan;
c3eddb2e
MD
392};
393
a67ba386
MD
394struct lttng_kernel_notification_ctx {
395 int eval_capture; /* Capture evaluation available. */
396};
dffef45d 397
a67ba386 398struct lttng_kernel_event_notifier_private;
8a8ac9a8 399
a67ba386
MD
400struct lttng_kernel_event_notifier {
401 struct lttng_kernel_event_common parent;
402 struct lttng_kernel_event_notifier_private *priv; /* Private event notifier interface */
dffef45d 403
a67ba386
MD
404 int eval_capture; /* Need to evaluate capture */
405 void (*notification_send)(struct lttng_kernel_event_notifier *event_notifier,
a67ba386 406 const char *stack_data,
a92e844e 407 struct lttng_kernel_probe_ctx *probe_ctx,
a67ba386 408 struct lttng_kernel_notification_ctx *notif_ctx);
dffef45d
FD
409};
410
3b861b22
FD
411enum lttng_enabler_format_type {
412 LTTNG_ENABLER_FORMAT_STAR_GLOB,
413 LTTNG_ENABLER_FORMAT_NAME,
3c997079
MD
414};
415
a90917c3 416struct lttng_channel_ops {
85a9ca7f 417 struct channel *(*channel_create)(const char *name,
5cf4b87c 418 void *priv,
85a9ca7f
MD
419 void *buf_addr,
420 size_t subbuf_size, size_t num_subbuf,
421 unsigned int switch_timer_interval,
422 unsigned int read_timer_interval);
423 void (*channel_destroy)(struct channel *chan);
424 struct lib_ring_buffer *(*buffer_read_open)(struct channel *chan);
f71ecafa 425 int (*buffer_has_read_closed_stream)(struct channel *chan);
85a9ca7f 426 void (*buffer_read_close)(struct lib_ring_buffer *buf);
c2fb9c1c 427 int (*event_reserve)(struct lib_ring_buffer_ctx *ctx);
85a9ca7f
MD
428 void (*event_commit)(struct lib_ring_buffer_ctx *ctx);
429 void (*event_write)(struct lib_ring_buffer_ctx *ctx, const void *src,
430 size_t len);
4ea00e4f
JD
431 void (*event_write_from_user)(struct lib_ring_buffer_ctx *ctx,
432 const void *src, size_t len);
58aa5d24
MD
433 void (*event_memset)(struct lib_ring_buffer_ctx *ctx,
434 int c, size_t len);
16f78f3a
MD
435 void (*event_strcpy)(struct lib_ring_buffer_ctx *ctx, const char *src,
436 size_t len);
437 void (*event_strcpy_from_user)(struct lib_ring_buffer_ctx *ctx,
438 const char __user *src, size_t len);
1ec3f75a
MD
439 /*
440 * packet_avail_size returns the available size in the current
441 * packet. Note that the size returned is only a hint, since it
442 * may change due to concurrent writes.
443 */
444 size_t (*packet_avail_size)(struct channel *chan);
71c1d843 445 wait_queue_head_t *(*get_writer_buf_wait_queue)(struct channel *chan, int cpu);
24cedcfe
MD
446 wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
447 int (*is_finalized)(struct channel *chan);
254ec7bc 448 int (*is_disabled)(struct channel *chan);
3b731ab1
JD
449 int (*timestamp_begin) (const struct lib_ring_buffer_config *config,
450 struct lib_ring_buffer *bufb,
451 uint64_t *timestamp_begin);
452 int (*timestamp_end) (const struct lib_ring_buffer_config *config,
453 struct lib_ring_buffer *bufb,
454 uint64_t *timestamp_end);
455 int (*events_discarded) (const struct lib_ring_buffer_config *config,
456 struct lib_ring_buffer *bufb,
457 uint64_t *events_discarded);
458 int (*content_size) (const struct lib_ring_buffer_config *config,
459 struct lib_ring_buffer *bufb,
460 uint64_t *content_size);
461 int (*packet_size) (const struct lib_ring_buffer_config *config,
462 struct lib_ring_buffer *bufb,
463 uint64_t *packet_size);
464 int (*stream_id) (const struct lib_ring_buffer_config *config,
465 struct lib_ring_buffer *bufb,
466 uint64_t *stream_id);
2348ca17
JD
467 int (*current_timestamp) (const struct lib_ring_buffer_config *config,
468 struct lib_ring_buffer *bufb,
469 uint64_t *ts);
5b3cf4f9
JD
470 int (*sequence_number) (const struct lib_ring_buffer_config *config,
471 struct lib_ring_buffer *bufb,
472 uint64_t *seq);
5594698f
JD
473 int (*instance_id) (const struct lib_ring_buffer_config *config,
474 struct lib_ring_buffer *bufb,
475 uint64_t *id);
85a9ca7f
MD
476};
477
a101fa10
MD
478struct lttng_counter_ops {
479 struct lib_counter *(*counter_create)(size_t nr_dimensions,
480 const size_t *max_nr_elem, /* for each dimension */
481 int64_t global_sum_step);
482 void (*counter_destroy)(struct lib_counter *counter);
483 int (*counter_add)(struct lib_counter *counter, const size_t *dimension_indexes,
484 int64_t v);
485 /*
486 * counter_read reads a specific cpu's counter if @cpu >= 0, or
487 * the global aggregation counter if @cpu == -1.
488 */
489 int (*counter_read)(struct lib_counter *counter, const size_t *dimension_indexes, int cpu,
490 int64_t *value, bool *overflow, bool *underflow);
491 /*
492 * counter_aggregate returns the total sum of all per-cpu counters and
493 * the global aggregation counter.
494 */
495 int (*counter_aggregate)(struct lib_counter *counter, const size_t *dimension_indexes,
496 int64_t *value, bool *overflow, bool *underflow);
497 int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes);
498};
499
a90917c3 500struct lttng_transport {
a33c9927
MD
501 char *name;
502 struct module *owner;
503 struct list_head node;
a90917c3 504 struct lttng_channel_ops ops;
a33c9927
MD
505};
506
a101fa10
MD
507struct lttng_counter_transport {
508 char *name;
509 struct module *owner;
510 struct list_head node;
511 struct lttng_counter_ops ops;
512};
513
80f87dd2
MD
514struct lttng_syscall_filter;
515
3c997079
MD
516#define LTTNG_EVENT_HT_BITS 12
517#define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS)
518
519struct lttng_event_ht {
520 struct hlist_head table[LTTNG_EVENT_HT_SIZE];
521};
522
dffef45d
FD
523#define LTTNG_EVENT_NOTIFIER_HT_BITS 12
524#define LTTNG_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_EVENT_NOTIFIER_HT_BITS)
525
526struct lttng_event_notifier_ht {
527 struct hlist_head table[LTTNG_EVENT_NOTIFIER_HT_SIZE];
528};
529
a90917c3 530struct lttng_channel {
c099397a 531 unsigned int id;
85a9ca7f 532 struct channel *chan; /* Channel buffers */
e64957da 533 int enabled;
437d5aa5 534 struct lttng_kernel_ctx *ctx;
85a9ca7f 535 /* Event ID management */
a90917c3 536 struct lttng_session *session;
85a9ca7f
MD
537 struct file *file; /* File associated to channel */
538 unsigned int free_event_id; /* Next event ID to allocate */
539 struct list_head list; /* Channel list */
a90917c3
MD
540 struct lttng_channel_ops *ops;
541 struct lttng_transport *transport;
3b82c4e1
MD
542 struct hlist_head *sc_table; /* for syscall tracing */
543 struct hlist_head *compat_sc_table;
544 struct hlist_head *sc_exit_table; /* for syscall exit tracing */
545 struct hlist_head *compat_sc_exit_table;
546 struct hlist_head sc_unknown; /* for unknown syscalls */
547 struct hlist_head sc_compat_unknown;
548 struct hlist_head sc_exit_unknown;
549 struct hlist_head compat_sc_exit_unknown;
80f87dd2 550 struct lttng_syscall_filter *sc_filter;
9115fbdc 551 int header_type; /* 0: unset, 1: compact, 2: large */
d83004aa 552 enum channel_type channel_type;
3b82c4e1
MD
553 int syscall_all_entry;
554 int syscall_all_exit;
80f87dd2
MD
555 unsigned int metadata_dumped:1,
556 sys_enter_registered:1,
557 sys_exit_registered:1,
3c997079 558 tstate:1; /* Transient enable state */
85a9ca7f
MD
559};
560
d83004aa
JD
561struct lttng_metadata_stream {
562 void *priv; /* Ring buffer private data */
563 struct lttng_metadata_cache *metadata_cache;
f613e3e6
MD
564 unsigned int metadata_in; /* Bytes read from the cache */
565 unsigned int metadata_out; /* Bytes consumed from stream */
d83004aa
JD
566 int finalized; /* Has channel been finalized */
567 wait_queue_head_t read_wait; /* Reader buffer-level wait queue */
568 struct list_head list; /* Stream list */
b3b8072b 569 struct lttng_transport *transport;
9616f0bf 570 uint64_t version; /* Current version of the metadata cache */
8b97fd42 571 bool coherent; /* Stream in a coherent state */
d83004aa
JD
572};
573
114667d5
MD
574#define LTTNG_DYNAMIC_LEN_STACK_SIZE 128
575
576struct lttng_dynamic_len_stack {
577 size_t stack[LTTNG_DYNAMIC_LEN_STACK_SIZE];
578 size_t offset;
579};
580
581DECLARE_PER_CPU(struct lttng_dynamic_len_stack, lttng_dynamic_len_stack);
e0130fab
MD
582
583/*
d1f652f8 584 * struct lttng_id_tracker declared in header due to deferencing of *v
e0130fab
MD
585 * in RCU_INITIALIZER(v).
586 */
d1f652f8
MD
587#define LTTNG_ID_HASH_BITS 6
588#define LTTNG_ID_TABLE_SIZE (1 << LTTNG_ID_HASH_BITS)
e0130fab 589
d1f652f8
MD
590enum tracker_type {
591 TRACKER_PID,
592 TRACKER_VPID,
593 TRACKER_UID,
594 TRACKER_VUID,
595 TRACKER_GID,
596 TRACKER_VGID,
597
598 TRACKER_UNKNOWN,
599};
600
601struct lttng_id_tracker_rcu {
602 struct hlist_head id_hash[LTTNG_ID_TABLE_SIZE];
603};
604
605struct lttng_id_tracker {
606 struct lttng_session *session;
607 enum tracker_type tracker_type;
608 struct lttng_id_tracker_rcu *p; /* RCU dereferenced. */
e0130fab
MD
609};
610
d1f652f8 611struct lttng_id_hash_node {
7e6f9ef6 612 struct hlist_node hlist;
d1f652f8 613 int id;
7e6f9ef6
MD
614};
615
a90917c3 616struct lttng_session {
85a9ca7f 617 int active; /* Is trace session active ? */
8070f5c0 618 int been_active; /* Has trace session been active ? */
85a9ca7f
MD
619 struct file *file; /* File associated to session */
620 struct list_head chan; /* Channel list head */
621 struct list_head events; /* Event list head */
622 struct list_head list; /* Session list */
c099397a 623 unsigned int free_chan_id; /* Next chan ID to allocate */
d793d5e1 624 uuid_le uuid; /* Trace session unique ID */
d83004aa 625 struct lttng_metadata_cache *metadata_cache;
d1f652f8
MD
626 struct lttng_id_tracker pid_tracker;
627 struct lttng_id_tracker vpid_tracker;
628 struct lttng_id_tracker uid_tracker;
629 struct lttng_id_tracker vuid_tracker;
630 struct lttng_id_tracker gid_tracker;
631 struct lttng_id_tracker vgid_tracker;
3c997079
MD
632 unsigned int metadata_dumped:1,
633 tstate:1; /* Transient enable state */
b2bc0bc8 634 /* List of event enablers */
3c997079
MD
635 struct list_head enablers_head;
636 /* Hash table of events */
637 struct lttng_event_ht events_ht;
606828e4
MD
638 char name[LTTNG_KERNEL_ABI_SESSION_NAME_LEN];
639 char creation_time[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN];
85a9ca7f
MD
640};
641
99f52fcc
FD
642struct lttng_counter {
643 struct file *file; /* File associated to counter. */
644 struct file *owner;
645 struct lttng_counter_transport *transport;
646 struct lib_counter *counter;
647 struct lttng_counter_ops *ops;
648};
649
750b05f2
FD
650struct lttng_event_notifier_group {
651 struct file *file; /* File associated to event notifier group */
21f58fb7 652 struct file *notif_file; /* File used to expose notifications to userspace. */
750b05f2 653 struct list_head node; /* event notifier group list */
dffef45d
FD
654 struct list_head enablers_head; /* List of enablers */
655 struct list_head event_notifiers_head; /* List of event notifier */
656 struct lttng_event_notifier_ht event_notifiers_ht; /* Hash table of event notifiers */
750b05f2
FD
657 struct lttng_channel_ops *ops;
658 struct lttng_transport *transport;
659 struct channel *chan; /* Ring buffer channel for event notifier group. */
660 struct lib_ring_buffer *buf; /* Ring buffer for event notifier group. */
21f58fb7
FD
661 wait_queue_head_t read_wait;
662 struct irq_work wakeup_pending; /* Pending wakeup irq work. */
a67ba386
MD
663 struct lttng_kernel_event_notifier *sc_unknown; /* for unknown syscalls */
664 struct lttng_kernel_event_notifier *sc_compat_unknown;
8a8ac9a8
FD
665
666 struct lttng_syscall_filter *sc_filter;
667
668 struct hlist_head *event_notifier_syscall_dispatch;
669 struct hlist_head *event_notifier_compat_syscall_dispatch;
670 struct hlist_head *event_notifier_exit_syscall_dispatch;
671 struct hlist_head *event_notifier_exit_compat_syscall_dispatch;
672
673 struct hlist_head event_notifier_unknown_syscall_dispatch;
674 struct hlist_head event_notifier_compat_unknown_syscall_dispatch;
675 struct hlist_head event_notifier_exit_unknown_syscall_dispatch;
676 struct hlist_head event_notifier_exit_compat_unknown_syscall_dispatch;
677
678 int syscall_all_entry;
679 int syscall_all_exit;
680
681 unsigned int sys_enter_registered:1, sys_exit_registered:1;
682
683 struct lttng_counter *error_counter;
684 size_t error_counter_len;
750b05f2
FD
685};
686
d83004aa
JD
687struct lttng_metadata_cache {
688 char *data; /* Metadata cache */
689 unsigned int cache_alloc; /* Metadata allocated size (bytes) */
690 unsigned int metadata_written; /* Number of bytes written in metadata cache */
3e75e2a7 691 atomic_t producing; /* Metadata being produced (incomplete) */
d83004aa
JD
692 struct kref refcount; /* Metadata cache usage */
693 struct list_head metadata_stream; /* Metadata stream list */
a36580d5 694 uuid_le uuid; /* Trace session unique ID (copy) */
9616f0bf
JD
695 struct mutex lock; /* Produce/consume lock */
696 uint64_t version; /* Current version of the metadata */
d83004aa
JD
697};
698
3c997079
MD
699void lttng_lock_sessions(void);
700void lttng_unlock_sessions(void);
701
702struct list_head *lttng_get_probe_list_head(void);
703
b2bc0bc8
FD
704struct lttng_event_enabler *lttng_event_enabler_create(
705 enum lttng_enabler_format_type format_type,
606828e4 706 struct lttng_kernel_abi_event *event_param,
3c997079
MD
707 struct lttng_channel *chan);
708
b2bc0bc8
FD
709int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler);
710int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler);
dffef45d
FD
711struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create(
712 struct lttng_event_notifier_group *event_notifier_group,
713 enum lttng_enabler_format_type format_type,
606828e4 714 struct lttng_kernel_abi_event_notifier *event_notifier_param);
dffef45d
FD
715
716int lttng_event_notifier_enabler_enable(
717 struct lttng_event_notifier_enabler *event_notifier_enabler);
718int lttng_event_notifier_enabler_disable(
719 struct lttng_event_notifier_enabler *event_notifier_enabler);
3c997079 720int lttng_fix_pending_events(void);
b01155ba 721int lttng_fix_pending_event_notifiers(void);
3c997079 722int lttng_session_active(void);
b01155ba 723bool lttng_event_notifier_active(void);
3c997079 724
a90917c3
MD
725struct lttng_session *lttng_session_create(void);
726int lttng_session_enable(struct lttng_session *session);
727int lttng_session_disable(struct lttng_session *session);
728void lttng_session_destroy(struct lttng_session *session);
9616f0bf 729int lttng_session_metadata_regenerate(struct lttng_session *session);
601252cf 730int lttng_session_statedump(struct lttng_session *session);
d83004aa 731void metadata_cache_destroy(struct kref *kref);
4e3c1b9b 732
99f52fcc
FD
733struct lttng_counter *lttng_kernel_counter_create(
734 const char *counter_transport_name, size_t number_dimensions,
735 const size_t *dimensions_sizes);
736int lttng_kernel_counter_read(struct lttng_counter *counter,
737 const size_t *dimension_indexes, int32_t cpu,
738 int64_t *val, bool *overflow, bool *underflow);
739int lttng_kernel_counter_aggregate(struct lttng_counter *counter,
740 const size_t *dimension_indexes, int64_t *val,
741 bool *overflow, bool *underflow);
742int lttng_kernel_counter_clear(struct lttng_counter *counter,
743 const size_t *dimension_indexes);
744
745
750b05f2 746struct lttng_event_notifier_group *lttng_event_notifier_group_create(void);
99f52fcc
FD
747int lttng_event_notifier_group_create_error_counter(
748 struct file *event_notifier_group_file,
606828e4 749 const struct lttng_kernel_abi_counter_conf *error_counter_conf);
750b05f2
FD
750void lttng_event_notifier_group_destroy(
751 struct lttng_event_notifier_group *event_notifier_group);
752
a90917c3 753struct lttng_channel *lttng_channel_create(struct lttng_session *session,
5dbbdb43
MD
754 const char *transport_name,
755 void *buf_addr,
756 size_t subbuf_size, size_t num_subbuf,
757 unsigned int switch_timer_interval,
d83004aa
JD
758 unsigned int read_timer_interval,
759 enum channel_type channel_type);
a90917c3 760struct lttng_channel *lttng_global_channel_create(struct lttng_session *session,
4e3c1b9b
MD
761 int overwrite, void *buf_addr,
762 size_t subbuf_size, size_t num_subbuf,
763 unsigned int switch_timer_interval,
764 unsigned int read_timer_interval);
4e3c1b9b 765
d83004aa 766void lttng_metadata_channel_destroy(struct lttng_channel *chan);
a67ba386 767struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan,
606828e4 768 struct lttng_kernel_abi_event *event_param,
437d5aa5 769 const struct lttng_kernel_event_desc *event_desc,
606828e4 770 enum lttng_kernel_abi_instrumentation itype);
a67ba386 771struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan,
606828e4 772 struct lttng_kernel_abi_event *event_param,
437d5aa5 773 const struct lttng_kernel_event_desc *event_desc,
606828e4 774 enum lttng_kernel_abi_instrumentation itype);
a67ba386 775struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_channel *chan,
606828e4 776 struct lttng_kernel_abi_old_event *old_event_param,
437d5aa5 777 const struct lttng_kernel_event_desc *internal_desc);
c0e31d2e 778
a67ba386 779struct lttng_kernel_event_notifier *lttng_event_notifier_create(
437d5aa5 780 const struct lttng_kernel_event_desc *event_notifier_desc,
dffef45d 781 uint64_t id,
99f52fcc 782 uint64_t error_counter_idx,
dffef45d 783 struct lttng_event_notifier_group *event_notifier_group,
606828e4 784 struct lttng_kernel_abi_event_notifier *event_notifier_param,
606828e4 785 enum lttng_kernel_abi_instrumentation itype);
a67ba386 786struct lttng_kernel_event_notifier *_lttng_event_notifier_create(
437d5aa5 787 const struct lttng_kernel_event_desc *event_notifier_desc,
dffef45d 788 uint64_t id,
99f52fcc 789 uint64_t error_counter_idx,
dffef45d 790 struct lttng_event_notifier_group *event_notifier_group,
606828e4 791 struct lttng_kernel_abi_event_notifier *event_notifier_param,
606828e4 792 enum lttng_kernel_abi_instrumentation itype);
dffef45d 793
a90917c3
MD
794int lttng_channel_enable(struct lttng_channel *channel);
795int lttng_channel_disable(struct lttng_channel *channel);
9d993668
MD
796int lttng_event_enable(struct lttng_kernel_event_common *event);
797int lttng_event_disable(struct lttng_kernel_event_common *event);
2b16f0c9 798
a90917c3
MD
799void lttng_transport_register(struct lttng_transport *transport);
800void lttng_transport_unregister(struct lttng_transport *transport);
11b5a3c2 801
a101fa10
MD
802void lttng_counter_transport_register(struct lttng_counter_transport *transport);
803void lttng_counter_transport_unregister(struct lttng_counter_transport *transport);
804
360f38ea 805void synchronize_trace(void);
80996790 806int lttng_abi_init(void);
6dccd6c1 807int lttng_abi_compat_old_init(void);
80996790 808void lttng_abi_exit(void);
6dccd6c1 809void lttng_abi_compat_old_exit(void);
1c25284c 810
437d5aa5
MD
811int lttng_probe_register(struct lttng_kernel_probe_desc *desc);
812void lttng_probe_unregister(struct lttng_kernel_probe_desc *desc);
813const struct lttng_kernel_event_desc *lttng_event_desc_get(const char *name);
814void lttng_event_desc_put(const struct lttng_kernel_event_desc *desc);
a90917c3
MD
815int lttng_probes_init(void);
816void lttng_probes_exit(void);
1ec65de1 817
b3b8072b 818int lttng_metadata_output_channel(struct lttng_metadata_stream *stream,
8b97fd42 819 struct channel *chan, bool *coherent);
d83004aa 820
d1f652f8
MD
821int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node *node);
822int lttng_id_tracker_empty_set(struct lttng_id_tracker *lf);
823void lttng_id_tracker_destroy(struct lttng_id_tracker *lf, bool rcu);
824bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu *p, int id);
825int lttng_id_tracker_add(struct lttng_id_tracker *lf, int id);
826int lttng_id_tracker_del(struct lttng_id_tracker *lf, int id);
e0130fab 827
d1f652f8
MD
828int lttng_session_track_id(struct lttng_session *session,
829 enum tracker_type tracker_type, int id);
830int lttng_session_untrack_id(struct lttng_session *session,
831 enum tracker_type tracker_type, int id);
e0130fab 832
d1f652f8
MD
833int lttng_session_list_tracker_ids(struct lttng_session *session,
834 enum tracker_type tracker_type);
7e6f9ef6 835
2754583e
MD
836void lttng_clock_ref(void);
837void lttng_clock_unref(void);
838
437d5aa5 839int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
8a8ac9a8
FD
840 struct lttng_enabler *enabler);
841
3a523f5b 842#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
a67ba386 843int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler);
3b82c4e1 844int lttng_syscalls_unregister_channel(struct lttng_channel *chan);
2d6d88c6 845int lttng_syscalls_destroy_event(struct lttng_channel *chan);
ade8a729
FD
846int lttng_syscall_filter_enable_event(
847 struct lttng_channel *chan,
a67ba386 848 struct lttng_kernel_event_recorder *event);
ade8a729
FD
849int lttng_syscall_filter_disable_event(
850 struct lttng_channel *chan,
a67ba386 851 struct lttng_kernel_event_recorder *event);
ade8a729 852
12e579db 853long lttng_channel_syscall_mask(struct lttng_channel *channel,
606828e4 854 struct lttng_kernel_abi_syscall_mask __user *usyscall_mask);
2d6d88c6 855
8a8ac9a8 856int lttng_syscalls_register_event_notifier(
a67ba386
MD
857 struct lttng_event_notifier_enabler *event_notifier_enabler);
858int lttng_syscalls_create_matching_event_notifiers(
859 struct lttng_event_notifier_enabler *event_notifier_enabler);
3b82c4e1 860int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group);
a67ba386
MD
861int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
862int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
1ec65de1 863#else
2d6d88c6 864static inline int lttng_syscalls_register_event(
a67ba386 865 struct lttng_event_enabler *event_enabler)
1ec65de1
MD
866{
867 return -ENOSYS;
868}
869
3b82c4e1 870static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan)
1ec65de1
MD
871{
872 return 0;
873}
80f87dd2 874
badfe9f5
MD
875static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
876{
877 return 0;
878}
879
2d6d88c6 880static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan,
a67ba386 881 struct lttng_kernel_event_recorder *event);
80f87dd2
MD
882{
883 return -ENOSYS;
884}
885
2d6d88c6 886static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan,
a67ba386 887 struct lttng_kernel_event_recorder *event);
80f87dd2
MD
888{
889 return -ENOSYS;
890}
12e579db 891
f127e61e 892static inline long lttng_channel_syscall_mask(struct lttng_channel *channel,
12e579db
MD
893 struct lttng_kernel_syscall_mask __user *usyscall_mask)
894{
895 return -ENOSYS;
896}
dffef45d 897
8a8ac9a8 898static inline int lttng_syscalls_register_event_notifier(
a67ba386 899 struct lttng_event_notifier_group *group)
8a8ac9a8
FD
900{
901 return -ENOSYS;
902}
903
3b82c4e1 904static inline int lttng_syscalls_unregister_event_notifier_group(
8a8ac9a8
FD
905 struct lttng_event_notifier_group *group)
906{
907 return 0;
908}
909
910static inline int lttng_syscall_filter_enable_event_notifier(
911 struct lttng_event_notifier_group *group,
912 const char *name)
913{
914 return -ENOSYS;
915}
916
917static inline int lttng_syscall_filter_disable_event_notifier(
918 struct lttng_event_notifier_group *group,
919 const char *name)
920{
921 return -ENOSYS;
922}
923
1ec65de1
MD
924#endif
925
183e8b3a 926int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler,
606828e4 927 struct lttng_kernel_abi_filter_bytecode __user *bytecode);
183e8b3a 928int lttng_event_notifier_enabler_attach_filter_bytecode(
dffef45d 929 struct lttng_event_notifier_enabler *event_notifier_enabler,
606828e4 930 struct lttng_kernel_abi_filter_bytecode __user *bytecode);
99d223ad
FD
931int lttng_event_notifier_enabler_attach_capture_bytecode(
932 struct lttng_event_notifier_enabler *event_notifier_enabler,
606828e4 933 struct lttng_kernel_abi_capture_bytecode __user *bytecode);
2dfda770 934
437d5aa5
MD
935void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc,
936 struct lttng_kernel_ctx *ctx,
60206944
FD
937 struct list_head *instance_bytecode_runtime_head,
938 struct list_head *enabler_bytecode_runtime_head);
0648898e 939void lttng_free_event_filter_runtime(struct lttng_kernel_event_common *event);
07dfc1d0 940
114667d5
MD
941int lttng_probes_init(void);
942
0c956676
MD
943int lttng_logger_init(void);
944void lttng_logger_exit(void);
945
c337ddc2
MD
946extern int lttng_statedump_start(struct lttng_session *session);
947
acd614cc 948#ifdef CONFIG_KPROBES
8bf17deb 949int lttng_kprobes_register_event(const char *name,
f17701fb
MD
950 const char *symbol_name,
951 uint64_t offset,
952 uint64_t addr,
a67ba386
MD
953 struct lttng_kernel_event_recorder *event);
954void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event);
955void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event);
2b16f0c9
FD
956int lttng_kprobes_register_event_notifier(const char *symbol_name,
957 uint64_t offset,
958 uint64_t addr,
a67ba386
MD
959 struct lttng_kernel_event_notifier *event_notifier);
960void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
961void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier);
acd614cc
MD
962#else
963static inline
8bf17deb 964int lttng_kprobes_register_event(const char *name,
acd614cc
MD
965 const char *symbol_name,
966 uint64_t offset,
967 uint64_t addr,
a67ba386 968 struct lttng_kernel_event_recorder *event)
acd614cc
MD
969{
970 return -ENOSYS;
971}
972
25f53c39 973static inline
a67ba386 974void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event)
8bf17deb
FD
975{
976}
977
978static inline
a67ba386 979void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event)
acd614cc
MD
980{
981}
edeb3137
MD
982
983static inline
2b16f0c9
FD
984int lttng_kprobes_register_event_notifier(const char *symbol_name,
985 uint64_t offset,
986 uint64_t addr,
a67ba386 987 struct lttng_kernel_event_notifier *event_notifier)
2b16f0c9
FD
988{
989 return -ENOSYS;
990}
991
992static inline
a67ba386 993void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
2b16f0c9
FD
994{
995}
996
997static inline
a67ba386 998void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
edeb3137
MD
999{
1000}
acd614cc 1001#endif
d6d808f3 1002
e2d5dbc7 1003int lttng_event_add_callsite(struct lttng_kernel_event_common *event,
606828e4 1004 struct lttng_kernel_abi_event_callsite __user *callsite);
9de67196 1005
149b9a9d 1006#ifdef CONFIG_UPROBES
83b802dc 1007int lttng_uprobes_register_event(const char *name,
a67ba386 1008 int fd, struct lttng_kernel_event_recorder *event);
e2d5dbc7 1009int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event,
606828e4 1010 struct lttng_kernel_abi_event_callsite __user *callsite);
a67ba386
MD
1011void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event);
1012void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event);
9de67196 1013int lttng_uprobes_register_event_notifier(const char *name,
a67ba386 1014 int fd, struct lttng_kernel_event_notifier *event_notifier);
a67ba386
MD
1015void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
1016void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier);
149b9a9d
YB
1017#else
1018static inline
83b802dc 1019int lttng_uprobes_register_event(const char *name,
a67ba386 1020 int fd, struct lttng_kernel_event_recorder *event)
3aed4dca
FD
1021{
1022 return -ENOSYS;
1023}
1024
1025static inline
e2d5dbc7 1026int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event,
606828e4 1027 struct lttng_kernel_abi_event_callsite __user *callsite)
149b9a9d
YB
1028{
1029 return -ENOSYS;
1030}
1031
1032static inline
a67ba386 1033void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event)
149b9a9d
YB
1034{
1035}
1036
1037static inline
a67ba386 1038void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event)
149b9a9d
YB
1039{
1040}
9de67196
FD
1041
1042static inline
1043int lttng_uprobes_register_event_notifier(const char *name,
a67ba386 1044 int fd, struct lttng_kernel_event_notifier *event_notifier)
9de67196
FD
1045{
1046 return -ENOSYS;
1047}
1048
9de67196 1049static inline
a67ba386 1050void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
9de67196
FD
1051{
1052}
1053
1054static inline
a67ba386 1055void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
9de67196
FD
1056{
1057}
149b9a9d
YB
1058#endif
1059
7371f44c
MD
1060#ifdef CONFIG_KRETPROBES
1061int lttng_kretprobes_register(const char *name,
1062 const char *symbol_name,
1063 uint64_t offset,
1064 uint64_t addr,
a67ba386
MD
1065 struct lttng_kernel_event_recorder *event_entry,
1066 struct lttng_kernel_event_recorder *event_exit);
1067void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event);
1068void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event);
e2d5dbc7 1069int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event,
a0493bef 1070 int enable);
7371f44c
MD
1071#else
1072static inline
1073int lttng_kretprobes_register(const char *name,
1074 const char *symbol_name,
1075 uint64_t offset,
1076 uint64_t addr,
a67ba386
MD
1077 struct lttng_kernel_event_recorder *event_entry,
1078 struct lttng_kernel_event_recorder *event_exit)
7371f44c
MD
1079{
1080 return -ENOSYS;
1081}
1082
1083static inline
a67ba386 1084void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event)
7371f44c
MD
1085{
1086}
1087
1088static inline
a67ba386 1089void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event)
7371f44c
MD
1090{
1091}
a0493bef
MD
1092
1093static inline
e2d5dbc7 1094int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event,
a0493bef
MD
1095 int enable)
1096{
1097 return -ENOSYS;
1098}
7371f44c
MD
1099#endif
1100
606828e4 1101int lttng_calibrate(struct lttng_kernel_abi_calibrate *calibrate);
57105fc2 1102
271b6681 1103extern const struct file_operations lttng_tracepoint_list_fops;
2d2464bd 1104extern const struct file_operations lttng_syscall_list_fops;
271b6681 1105
ef200626 1106#define TRACEPOINT_HAS_DATA_ARG
ef200626 1107
a90917c3 1108#endif /* _LTTNG_EVENTS_H */
This page took 0.119049 seconds and 4 git commands to generate.