1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
3 * lttng/events-internal.h
5 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 #ifndef _LTTNG_EVENTS_INTERNAL_H
9 #define _LTTNG_EVENTS_INTERNAL_H
11 #include <wrapper/compiler_attributes.h>
12 #include <wrapper/uuid.h>
14 #include <lttng/events.h>
16 struct lttng_syscall_filter
;
17 struct lttng_metadata_cache
;
19 struct perf_event_attr
;
20 struct lttng_kernel_ring_buffer_config
;
21 struct lttng_kernel_counter_dimension
;
23 enum lttng_enabler_format_type
{
24 LTTNG_ENABLER_FORMAT_STAR_GLOB
,
25 LTTNG_ENABLER_FORMAT_NAME
,
28 enum lttng_kernel_event_enabler_type
{
29 LTTNG_EVENT_ENABLER_TYPE_RECORDER
,
30 LTTNG_EVENT_ENABLER_TYPE_NOTIFIER
,
31 LTTNG_EVENT_ENABLER_TYPE_COUNTER
,
40 * Objects in a linked-list of enablers, owned by an event.
42 struct lttng_enabler_ref
{
43 struct list_head node
; /* enabler ref list */
44 struct lttng_event_enabler_common
*ref
; /* backward ref */
47 struct lttng_krp
; /* Kretprobe handling */
49 struct lttng_uprobe_handler
{
50 struct lttng_kernel_event_common
*event
;
52 struct uprobe_consumer up_consumer
;
53 struct list_head node
;
61 kprobe_pre_handler_t pre_handler
;
66 struct list_head head
;
69 enum lttng_syscall_entryexit
{
74 enum lttng_syscall_abi
{
75 LTTNG_SYSCALL_ABI_NATIVE
,
76 LTTNG_SYSCALL_ABI_COMPAT
,
79 enum lttng_kretprobe_entryexit
{
80 LTTNG_KRETPROBE_ENTRY
,
83 NR_LTTNG_KRETPROBE_ENTRYEXIT
,
86 struct lttng_kernel_event_common_private
{
87 struct lttng_kernel_event_common
*pub
; /* Public event interface */
89 const struct lttng_kernel_event_desc
*desc
;
90 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
91 struct list_head enablers_ref_head
;
92 int registered
; /* has reg'd tracepoint probe */
95 int has_enablers_without_filter_bytecode
;
96 /* list of struct lttng_kernel_bytecode_runtime, sorted by seqnum */
97 struct list_head filter_bytecode_runtime_head
;
99 struct hlist_node hlist_name_node
; /* node in events name hash table */
100 struct list_head node
; /* node in event list */
102 enum lttng_kernel_abi_instrumentation instrumentation
;
103 /* Selected by instrumentation */
105 struct lttng_kprobe kprobe
;
106 struct lttng_uprobe uprobe
;
108 enum lttng_kretprobe_entryexit entryexit
;
109 struct lttng_krp
*lttng_krp
;
113 enum lttng_syscall_entryexit entryexit
;
114 enum lttng_syscall_abi abi
;
115 struct hlist_node node
; /* chain registered syscall event_notifier */
116 unsigned int syscall_id
;
121 struct lttng_kernel_event_session_common_private
{
122 struct lttng_kernel_event_common_private parent
;
124 struct lttng_kernel_channel_common
*chan
;
125 uint64_t id
; /* Event id */
128 struct lttng_kernel_event_recorder_private
{
129 struct lttng_kernel_event_session_common_private parent
;
131 struct lttng_kernel_event_recorder
*pub
; /* Public event interface */
132 unsigned int metadata_dumped
:1;
135 #define LTTNG_KERNEL_COUNTER_KEY_LEN 256
137 enum lttng_event_counter_action
{
138 LTTNG_EVENT_COUNTER_ACTION_INCREMENT
= 0,
141 struct lttng_kernel_event_counter_private
{
142 struct lttng_kernel_event_session_common_private parent
;
144 struct lttng_kernel_event_counter
*pub
; /* Public event interface */
145 struct hlist_node hlist_key_node
; /* node in events key hash table */
146 enum lttng_event_counter_action action
;
147 char key
[LTTNG_KERNEL_COUNTER_KEY_LEN
];
150 struct lttng_kernel_event_notifier_private
{
151 struct lttng_kernel_event_common_private parent
;
153 struct lttng_kernel_event_notifier
*pub
; /* Public event notifier interface */
154 struct lttng_event_notifier_group
*group
; /* weak ref */
155 size_t num_captures
; /* Needed to allocate the msgpack array. */
156 uint64_t error_counter_index
;
157 struct list_head capture_bytecode_runtime_head
;
160 struct lttng_kernel_syscall_table
{
161 unsigned int sys_enter_registered
:1,
162 sys_exit_registered
:1;
164 struct hlist_head
*syscall_dispatch
; /* for syscall tracing */
165 struct hlist_head
*compat_syscall_dispatch
;
166 struct hlist_head
*syscall_exit_dispatch
; /* for syscall exit tracing */
167 struct hlist_head
*compat_syscall_exit_dispatch
;
170 * Combining all unknown syscall events works as long as they
171 * are only matched by "all" syscalls enablers, but will require
172 * a design change when we allow matching by syscall number, for
173 * instance by allocating sc_tables accomodating NR_syscalls
176 struct hlist_head unknown_syscall_dispatch
; /* for unknown syscalls */
177 struct hlist_head compat_unknown_syscall_dispatch
;
178 struct hlist_head unknown_syscall_exit_dispatch
;
179 struct hlist_head compat_unknown_syscall_exit_dispatch
;
181 struct lttng_syscall_filter
*sc_filter
;
182 int syscall_all_entry
;
183 int syscall_all_exit
;
186 struct lttng_kernel_channel_common_private
{
187 struct lttng_kernel_channel_common
*pub
;
189 struct file
*file
; /* File associated to channel */
190 unsigned int tstate
:1; /* Transient enable state */
193 struct list_head node
; /* Channel list in session */
195 struct lttng_kernel_syscall_table syscall_table
;
198 struct lttng_kernel_channel_buffer_private
{
199 struct lttng_kernel_channel_common_private parent
;
201 struct lttng_kernel_channel_buffer
*pub
;
203 unsigned int id
; /* Channel ID */
204 unsigned int free_event_id
; /* Next event ID to allocate */
205 int header_type
; /* 0: unset, 1: compact, 2: large */
207 enum channel_type channel_type
;
208 struct lttng_kernel_ctx
*ctx
;
209 struct lttng_kernel_ring_buffer_channel
*rb_chan
; /* Ring buffer channel */
210 unsigned int metadata_dumped
:1;
211 struct lttng_transport
*transport
;
214 struct lttng_kernel_channel_counter_ops_private
{
215 struct lttng_kernel_channel_counter_ops
*pub
; /* Public channel counter ops interface */
217 struct lttng_kernel_channel_counter
*(*counter_create
)(size_t nr_dimensions
,
218 const struct lttng_kernel_counter_dimension
*dimensions
,
219 int64_t global_sum_step
);
220 void (*counter_destroy
)(struct lttng_kernel_channel_counter
*counter
);
221 int (*counter_add
)(struct lttng_kernel_channel_counter
*counter
,
222 const size_t *dimension_indexes
, int64_t v
);
224 * counter_read reads a specific cpu's counter if @cpu >= 0, or
225 * the global aggregation counter if @cpu == -1.
227 int (*counter_read
)(struct lttng_kernel_channel_counter
*counter
,
228 const size_t *dimension_indexes
, int cpu
,
229 int64_t *value
, bool *overflow
, bool *underflow
);
231 * counter_aggregate returns the total sum of all per-cpu counters and
232 * the global aggregation counter.
234 int (*counter_aggregate
)(struct lttng_kernel_channel_counter
*counter
,
235 const size_t *dimension_indexes
, int64_t *value
,
236 bool *overflow
, bool *underflow
);
237 int (*counter_clear
)(struct lttng_kernel_channel_counter
*counter
,
238 const size_t *dimension_indexes
);
239 int (*counter_get_nr_dimensions
)(struct lttng_kernel_channel_counter
*counter
,
240 size_t *nr_dimensions
);
241 int (*counter_get_max_nr_elem
)(struct lttng_kernel_channel_counter
*counter
,
242 size_t *max_nr_elem
); /* array of size nr_dimensions */
245 struct lttng_counter_map_descriptor
{
248 char key
[LTTNG_KERNEL_COUNTER_KEY_LEN
];
251 struct lttng_counter_map
{
252 struct lttng_counter_map_descriptor
*descriptors
;
253 size_t nr_descriptors
;
255 struct mutex lock
; /* counter map lock */
258 struct lttng_kernel_channel_counter_private
{
259 struct lttng_kernel_channel_common_private parent
;
261 struct lttng_kernel_channel_counter
*pub
; /* Public channel counter interface */
262 struct lib_counter
*counter
;
263 struct lttng_kernel_channel_counter_ops
*ops
;
265 struct lttng_counter_map map
;
267 /* Owned either by session or event notifier group. */
269 /* Session or event notifier group file owner. */
272 /* Event notifier group owner. */
273 struct lttng_event_notifier_group
*event_notifier_group
;
276 size_t free_index
; /* Next index to allocate */
277 struct lttng_counter_transport
*transport
;
280 enum lttng_kernel_bytecode_interpreter_ret
{
281 LTTNG_KERNEL_BYTECODE_INTERPRETER_ERROR
= -1,
282 LTTNG_KERNEL_BYTECODE_INTERPRETER_OK
= 0,
285 enum lttng_kernel_bytecode_filter_result
{
286 LTTNG_KERNEL_BYTECODE_FILTER_ACCEPT
= 0,
287 LTTNG_KERNEL_BYTECODE_FILTER_REJECT
= 1,
290 struct lttng_kernel_bytecode_filter_ctx
{
291 enum lttng_kernel_bytecode_filter_result result
;
294 struct lttng_interpreter_output
;
296 enum lttng_kernel_bytecode_type
{
297 LTTNG_KERNEL_BYTECODE_TYPE_FILTER
,
298 LTTNG_KERNEL_BYTECODE_TYPE_CAPTURE
,
301 struct lttng_kernel_bytecode_node
{
302 enum lttng_kernel_bytecode_type type
;
303 struct list_head node
;
304 struct lttng_event_enabler_common
*enabler
;
307 uint32_t reloc_offset
;
313 struct lttng_kernel_bytecode_runtime
{
314 /* Associated bytecode */
315 enum lttng_kernel_bytecode_type type
;
316 struct lttng_kernel_bytecode_node
*bc
;
317 int (*interpreter_func
)(struct lttng_kernel_bytecode_runtime
*kernel_bytecode
,
318 const char *interpreter_stack_data
,
319 struct lttng_kernel_probe_ctx
*lttng_probe_ctx
,
322 struct list_head node
; /* list of bytecode runtime in event */
323 struct lttng_kernel_ctx
*ctx
;
327 * Enabler field, within whatever object is enabling an event. Target of
328 * backward reference.
330 struct lttng_event_enabler_common
{
331 enum lttng_kernel_event_enabler_type enabler_type
;
332 enum lttng_enabler_format_type format_type
;
334 /* head list of struct lttng_kernel_bytecode_node */
335 struct list_head filter_bytecode_head
;
337 struct lttng_kernel_abi_event event_param
;
338 unsigned int enabled
:1;
340 uint64_t user_token
; /* User-provided token. */
342 struct list_head node
; /* list of enablers */
343 bool published
; /* published in list. */
346 struct lttng_event_enabler_session_common
{
347 struct lttng_event_enabler_common parent
;
348 struct lttng_kernel_channel_common
*chan
;
351 struct lttng_event_recorder_enabler
{
352 struct lttng_event_enabler_session_common parent
;
353 struct lttng_kernel_channel_buffer
*chan
;
356 struct lttng_event_counter_enabler
{
357 struct lttng_event_enabler_session_common parent
;
358 struct lttng_kernel_channel_counter
*chan
;
359 struct lttng_kernel_counter_key
*key
;
361 enum lttng_event_counter_action action
;
364 struct lttng_event_notifier_enabler
{
365 struct lttng_event_enabler_common parent
;
366 uint64_t error_counter_index
;
367 struct lttng_event_notifier_group
*group
;
369 /* head list of struct lttng_kernel_bytecode_node */
370 struct list_head capture_bytecode_head
;
371 uint64_t num_captures
;
374 struct lttng_ctx_value
{
383 * We need to keep this perf counter field separately from struct
384 * lttng_kernel_ctx_field because cpu hotplug needs fixed-location addresses.
386 struct lttng_perf_counter_field
{
387 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
388 struct lttng_cpuhp_node cpuhp_prepare
;
389 struct lttng_cpuhp_node cpuhp_online
;
391 struct notifier_block nb
;
394 struct perf_event_attr
*attr
;
395 struct perf_event
**e
; /* per-cpu array */
397 struct lttng_kernel_event_field
*event_field
;
400 struct lttng_kernel_ctx_field
{
401 const struct lttng_kernel_event_field
*event_field
;
402 size_t (*get_size
)(void *priv
, struct lttng_kernel_probe_ctx
*probe_ctx
,
404 void (*record
)(void *priv
, struct lttng_kernel_probe_ctx
*probe_ctx
,
405 struct lttng_kernel_ring_buffer_ctx
*ctx
,
406 struct lttng_kernel_channel_buffer
*chan
);
407 void (*get_value
)(void *priv
, struct lttng_kernel_probe_ctx
*probe_ctx
,
408 struct lttng_ctx_value
*value
);
409 void (*destroy
)(void *priv
);
413 struct lttng_kernel_ctx
{
414 struct lttng_kernel_ctx_field
*fields
;
415 unsigned int nr_fields
;
416 unsigned int allocated_fields
;
417 size_t largest_align
; /* in bytes */
420 struct lttng_metadata_cache
{
421 char *data
; /* Metadata cache */
422 unsigned int cache_alloc
; /* Metadata allocated size (bytes) */
423 unsigned int metadata_written
; /* Number of bytes written in metadata cache */
424 atomic_t producing
; /* Metadata being produced (incomplete) */
425 struct kref refcount
; /* Metadata cache usage */
426 struct list_head metadata_stream
; /* Metadata stream list */
427 guid_t uuid
; /* Trace session unique ID (copy) */
428 struct mutex lock
; /* Produce/consume lock */
429 uint64_t version
; /* Current version of the metadata */
432 struct lttng_metadata_stream
{
433 void *priv
; /* Ring buffer private data */
434 struct lttng_metadata_cache
*metadata_cache
;
435 unsigned int metadata_in
; /* Bytes read from the cache */
436 unsigned int metadata_out
; /* Bytes consumed from stream */
437 int finalized
; /* Has channel been finalized */
438 wait_queue_head_t read_wait
; /* Reader buffer-level wait queue */
439 struct list_head node
; /* Stream list */
440 struct lttng_transport
*transport
;
441 uint64_t version
; /* Current version of the metadata cache */
442 bool coherent
; /* Stream in a coherent state */
445 struct lttng_kernel_event_pair
{
447 char name
[LTTNG_KERNEL_ABI_SYM_NAME_LEN
];
448 struct lttng_krp
*krp
;
450 enum lttng_kretprobe_entryexit entryexit
;
453 struct lttng_kernel_channel_buffer_ops_private
{
454 struct lttng_kernel_channel_buffer_ops
*pub
; /* Public channel buffer ops interface */
456 struct lttng_kernel_ring_buffer_channel
*(*channel_create
)(const char *name
,
459 size_t subbuf_size
, size_t num_subbuf
,
460 unsigned int switch_timer_interval
,
461 unsigned int read_timer_interval
);
462 void (*channel_destroy
)(struct lttng_kernel_ring_buffer_channel
*chan
);
463 struct lttng_kernel_ring_buffer
*(*buffer_read_open
)(struct lttng_kernel_ring_buffer_channel
*chan
);
464 int (*buffer_has_read_closed_stream
)(struct lttng_kernel_ring_buffer_channel
*chan
);
465 void (*buffer_read_close
)(struct lttng_kernel_ring_buffer
*buf
);
467 * packet_avail_size returns the available size in the current
468 * packet. Note that the size returned is only a hint, since it
469 * may change due to concurrent writes.
471 size_t (*packet_avail_size
)(struct lttng_kernel_ring_buffer_channel
*chan
);
472 wait_queue_head_t
*(*get_writer_buf_wait_queue
)(struct lttng_kernel_ring_buffer_channel
*chan
, int cpu
);
473 wait_queue_head_t
*(*get_hp_wait_queue
)(struct lttng_kernel_ring_buffer_channel
*chan
);
474 int (*is_finalized
)(struct lttng_kernel_ring_buffer_channel
*chan
);
475 int (*is_disabled
)(struct lttng_kernel_ring_buffer_channel
*chan
);
476 int (*timestamp_begin
) (const struct lttng_kernel_ring_buffer_config
*config
,
477 struct lttng_kernel_ring_buffer
*bufb
,
478 uint64_t *timestamp_begin
);
479 int (*timestamp_end
) (const struct lttng_kernel_ring_buffer_config
*config
,
480 struct lttng_kernel_ring_buffer
*bufb
,
481 uint64_t *timestamp_end
);
482 int (*events_discarded
) (const struct lttng_kernel_ring_buffer_config
*config
,
483 struct lttng_kernel_ring_buffer
*bufb
,
484 uint64_t *events_discarded
);
485 int (*content_size
) (const struct lttng_kernel_ring_buffer_config
*config
,
486 struct lttng_kernel_ring_buffer
*bufb
,
487 uint64_t *content_size
);
488 int (*packet_size
) (const struct lttng_kernel_ring_buffer_config
*config
,
489 struct lttng_kernel_ring_buffer
*bufb
,
490 uint64_t *packet_size
);
491 int (*stream_id
) (const struct lttng_kernel_ring_buffer_config
*config
,
492 struct lttng_kernel_ring_buffer
*bufb
,
493 uint64_t *stream_id
);
494 int (*current_timestamp
) (const struct lttng_kernel_ring_buffer_config
*config
,
495 struct lttng_kernel_ring_buffer
*bufb
,
497 int (*sequence_number
) (const struct lttng_kernel_ring_buffer_config
*config
,
498 struct lttng_kernel_ring_buffer
*bufb
,
500 int (*instance_id
) (const struct lttng_kernel_ring_buffer_config
*config
,
501 struct lttng_kernel_ring_buffer
*bufb
,
505 #define LTTNG_EVENT_HT_BITS 12
506 #define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS)
508 struct lttng_event_ht
{
509 struct hlist_head table
[LTTNG_EVENT_HT_SIZE
];
512 struct lttng_event_notifier_group
{
513 struct file
*file
; /* File associated to event notifier group */
514 struct file
*notif_file
; /* File used to expose notifications to userspace. */
515 struct list_head node
; /* event notifier group list */
516 struct list_head enablers_head
; /* List of enablers */
517 struct list_head event_notifiers_head
; /* List of event notifier */
518 struct lttng_event_ht events_name_ht
; /* Hash table of event notifiers, indexed by name */
519 struct lttng_kernel_channel_buffer_ops
*ops
;
520 struct lttng_transport
*transport
;
521 struct lttng_kernel_ring_buffer_channel
*chan
; /* Ring buffer channel for event notifier group. */
522 struct lttng_kernel_ring_buffer
*buf
; /* Ring buffer for event notifier group. */
523 wait_queue_head_t read_wait
;
524 struct irq_work wakeup_pending
; /* Pending wakeup irq work. */
526 struct lttng_kernel_syscall_table syscall_table
;
528 struct lttng_kernel_channel_counter
*error_counter
;
529 size_t error_counter_len
;
532 struct lttng_transport
{
534 struct module
*owner
;
535 struct list_head node
;
536 struct lttng_kernel_channel_buffer_ops ops
;
539 struct lttng_counter_transport
{
541 struct module
*owner
;
542 struct list_head node
;
543 struct lttng_kernel_channel_counter_ops ops
;
546 struct lttng_kernel_session_private
{
547 struct lttng_kernel_session
*pub
; /* Public session interface */
549 int been_active
; /* Has trace session been active ? */
550 struct file
*file
; /* File associated to session */
551 struct list_head chan_head
; /* Channel list head */
552 struct list_head events_head
; /* Event list head */
553 struct list_head enablers_head
; /* List of event enablers */
555 struct lttng_event_ht events_name_ht
; /* Hash table of events, indexed by name */
556 struct lttng_event_ht events_key_ht
; /* Hash table of events, indexed by key */
558 struct list_head node
; /* Session list */
559 unsigned int free_chan_id
; /* Next chan ID to allocate */
560 guid_t uuid
; /* Trace session unique ID */
561 struct lttng_metadata_cache
*metadata_cache
;
562 unsigned int metadata_dumped
:1,
563 tstate
:1; /* Transient enable state */
565 char name
[LTTNG_KERNEL_ABI_SESSION_NAME_LEN
];
566 char creation_time
[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN
];
569 struct lttng_id_hash_node
{
570 struct hlist_node hlist
;
585 struct lttng_kernel_id_tracker_private
{
586 struct lttng_kernel_id_tracker
*pub
; /* Public interface */
588 struct lttng_kernel_session
*session
;
589 enum tracker_type tracker_type
;
592 enum lttng_kernel_counter_dimension_flags
{
593 LTTNG_KERNEL_COUNTER_DIMENSION_FLAG_UNDERFLOW
= (1 << 0),
594 LTTNG_KERNEL_COUNTER_DIMENSION_FLAG_OVERFLOW
= (1 << 1),
597 enum lttng_kernel_counter_conf_flags
{
598 LTTNG_KERNEL_COUNTER_CONF_FLAG_COALESCE_HITS
= (1 << 0),
601 enum lttng_kernel_counter_arithmetic
{
602 LTTNG_KERNEL_COUNTER_ARITHMETIC_MODULAR
= 0,
605 enum lttng_kernel_counter_bitness
{
606 LTTNG_KERNEL_COUNTER_BITNESS_32
= 0,
607 LTTNG_KERNEL_COUNTER_BITNESS_64
= 1,
610 /* Internally, only 1 dimension is supported fow now. */
611 #define LTTNG_KERNEL_COUNTER_MAX_DIMENSIONS 1
612 /* Internally, only 16 tokens are supported for now. */
613 #define LTTNG_KERNEL_COUNTER_MAX_TOKENS 16
615 struct lttng_kernel_counter_dimension
{
616 uint32_t flags
; /* enum lttng_kernel_counter_dimension_flags */
617 uint64_t size
; /* dimension size */
618 uint64_t underflow_index
;
619 uint64_t overflow_index
;
622 struct lttng_kernel_counter_conf
{
623 uint32_t flags
; /* enum lttng_kernel_counter_conf_flags */
624 uint32_t arithmetic
; /* enum lttng_kernel_counter_arithmetic */
625 uint32_t bitness
; /* enum lttng_kernel_counter_bitness */
626 int64_t global_sum_step
;
627 struct lttng_kernel_counter_dimension dimension_array
[LTTNG_KERNEL_COUNTER_MAX_DIMENSIONS
];
630 enum lttng_key_token_type
{
631 LTTNG_KEY_TOKEN_UNKNOWN
= 0, /* Uninitialized. */
633 LTTNG_KEY_TOKEN_STRING
= 1,
634 LTTNG_KEY_TOKEN_EVENT_NAME
= 2,
637 struct lttng_key_token
{
638 enum lttng_key_token_type type
;
642 struct lttng_kernel_counter_key_dimension
{
643 size_t nr_key_tokens
;
644 struct lttng_key_token
*token_array
;
647 struct lttng_kernel_counter_key
{
648 size_t nr_dimensions
;
649 struct lttng_kernel_counter_key_dimension dimension_array
[LTTNG_KERNEL_COUNTER_MAX_DIMENSIONS
];
652 struct lttng_kernel_counter_event
{
653 struct lttng_kernel_abi_event event_param
;
654 struct lttng_kernel_abi_event_ext event_param_ext
;
656 struct lttng_kernel_counter_key
*counter_key
;
659 extern struct lttng_kernel_ctx
*lttng_static_ctx
;
662 const struct lttng_kernel_type_integer
*lttng_kernel_get_type_integer(const struct lttng_kernel_type_common
*type
)
664 if (type
->type
!= lttng_kernel_type_integer
)
666 return container_of(type
, const struct lttng_kernel_type_integer
, parent
);
670 const struct lttng_kernel_type_string
*lttng_kernel_get_type_string(const struct lttng_kernel_type_common
*type
)
672 if (type
->type
!= lttng_kernel_type_string
)
674 return container_of(type
, const struct lttng_kernel_type_string
, parent
);
678 const struct lttng_kernel_type_enum
*lttng_kernel_get_type_enum(const struct lttng_kernel_type_common
*type
)
680 if (type
->type
!= lttng_kernel_type_enum
)
682 return container_of(type
, const struct lttng_kernel_type_enum
, parent
);
686 const struct lttng_kernel_type_array
*lttng_kernel_get_type_array(const struct lttng_kernel_type_common
*type
)
688 if (type
->type
!= lttng_kernel_type_array
)
690 return container_of(type
, const struct lttng_kernel_type_array
, parent
);
694 const struct lttng_kernel_type_sequence
*lttng_kernel_get_type_sequence(const struct lttng_kernel_type_common
*type
)
696 if (type
->type
!= lttng_kernel_type_sequence
)
698 return container_of(type
, const struct lttng_kernel_type_sequence
, parent
);
702 const struct lttng_kernel_type_struct
*lttng_kernel_get_type_struct(const struct lttng_kernel_type_common
*type
)
704 if (type
->type
!= lttng_kernel_type_struct
)
706 return container_of(type
, const struct lttng_kernel_type_struct
, parent
);
710 const struct lttng_kernel_type_variant
*lttng_kernel_get_type_variant(const struct lttng_kernel_type_common
*type
)
712 if (type
->type
!= lttng_kernel_type_variant
)
714 return container_of(type
, const struct lttng_kernel_type_variant
, parent
);
717 static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kernel_type_common
*type
)
719 const struct lttng_kernel_type_integer
*type_integer
= lttng_kernel_get_type_integer(type
);
723 switch (type_integer
->size
) {
738 int lttng_kernel_interpret_event_filter(const struct lttng_kernel_event_common
*event
,
739 const char *interpreter_stack_data
,
740 struct lttng_kernel_probe_ctx
*probe_ctx
,
741 void *event_filter_ctx
);
744 struct lttng_event_enabler_common
*lttng_event_notifier_enabler_as_enabler(
745 struct lttng_event_notifier_enabler
*event_notifier_enabler
)
747 return &event_notifier_enabler
->parent
;
751 struct lttng_event_ht
*lttng_get_events_name_ht_from_enabler(struct lttng_event_enabler_common
*event_enabler
)
753 switch (event_enabler
->enabler_type
) {
754 case LTTNG_EVENT_ENABLER_TYPE_RECORDER
:
756 case LTTNG_EVENT_ENABLER_TYPE_COUNTER
:
758 struct lttng_event_enabler_session_common
*event_enabler_session
=
759 container_of(event_enabler
, struct lttng_event_enabler_session_common
, parent
);
760 return &event_enabler_session
->chan
->session
->priv
->events_name_ht
;
762 case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER
:
764 struct lttng_event_notifier_enabler
*event_notifier_enabler
=
765 container_of(event_enabler
, struct lttng_event_notifier_enabler
, parent
);
766 return &event_notifier_enabler
->group
->events_name_ht
;
774 struct lttng_event_ht
*lttng_get_events_key_ht_from_enabler(struct lttng_event_enabler_common
*event_enabler
)
776 switch (event_enabler
->enabler_type
) {
777 case LTTNG_EVENT_ENABLER_TYPE_RECORDER
:
779 case LTTNG_EVENT_ENABLER_TYPE_COUNTER
:
781 struct lttng_event_enabler_session_common
*event_enabler_session
=
782 container_of(event_enabler
, struct lttng_event_enabler_session_common
, parent
);
783 return &event_enabler_session
->chan
->session
->priv
->events_key_ht
;
785 case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER
:
793 struct list_head
*lttng_get_event_list_head_from_enabler(struct lttng_event_enabler_common
*event_enabler
)
795 switch (event_enabler
->enabler_type
) {
796 case LTTNG_EVENT_ENABLER_TYPE_RECORDER
:
798 case LTTNG_EVENT_ENABLER_TYPE_COUNTER
:
800 struct lttng_event_enabler_session_common
*event_enabler_session
=
801 container_of(event_enabler
, struct lttng_event_enabler_session_common
, parent
);
802 return &event_enabler_session
->chan
->session
->priv
->events_head
;
804 case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER
:
806 struct lttng_event_notifier_enabler
*event_notifier_enabler
=
807 container_of(event_enabler
, struct lttng_event_notifier_enabler
, parent
);
808 return &event_notifier_enabler
->group
->event_notifiers_head
;
815 int lttng_context_init(void);
816 void lttng_context_exit(void);
817 int lttng_kernel_context_append(struct lttng_kernel_ctx
**ctx_p
,
818 const struct lttng_kernel_ctx_field
*f
);
819 void lttng_kernel_context_remove_last(struct lttng_kernel_ctx
**ctx_p
);
820 struct lttng_kernel_ctx_field
*lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx
*ctx
,
822 int lttng_kernel_find_context(struct lttng_kernel_ctx
*ctx
, const char *name
);
823 int lttng_kernel_get_context_index(struct lttng_kernel_ctx
*ctx
, const char *name
);
824 void lttng_kernel_destroy_context(struct lttng_kernel_ctx
*ctx
);
825 int lttng_add_pid_to_ctx(struct lttng_kernel_ctx
**ctx
);
826 int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx
**ctx
);
827 int lttng_add_procname_to_ctx(struct lttng_kernel_ctx
**ctx
);
828 int lttng_add_prio_to_ctx(struct lttng_kernel_ctx
**ctx
);
829 int lttng_add_nice_to_ctx(struct lttng_kernel_ctx
**ctx
);
830 int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx
**ctx
);
831 int lttng_add_tid_to_ctx(struct lttng_kernel_ctx
**ctx
);
832 int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx
**ctx
);
833 int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx
**ctx
);
834 int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx
**ctx
);
835 int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx
**ctx
);
836 int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx
**ctx
);
837 int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx
**ctx
);
838 #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
839 int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx
**ctx
);
842 int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx
**ctx
)
847 #ifdef CONFIG_PREEMPT_RT_FULL
848 int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx
**ctx
);
851 int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx
**ctx
)
857 int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx
**ctx
, int type
);
859 #if defined(CONFIG_CGROUPS) && \
860 ((LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) || \
861 LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0))
862 int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
865 int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
871 #if defined(CONFIG_IPC_NS) && \
872 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
873 int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
876 int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
882 #if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \
883 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
884 int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
887 int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
893 #if defined(CONFIG_NET_NS) && \
894 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
895 int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
898 int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
904 #if defined(CONFIG_PID_NS) && \
905 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
906 int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
909 int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
915 #if defined(CONFIG_USER_NS) && \
916 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
917 int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
920 int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
926 #if defined(CONFIG_UTS_NS) && \
927 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
928 int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
931 int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
937 #if defined(CONFIG_TIME_NS) && \
938 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0) || \
939 LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
940 int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx
**ctx
);
943 int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx
**ctx
)
949 int lttng_add_uid_to_ctx(struct lttng_kernel_ctx
**ctx
);
950 int lttng_add_euid_to_ctx(struct lttng_kernel_ctx
**ctx
);
951 int lttng_add_suid_to_ctx(struct lttng_kernel_ctx
**ctx
);
952 int lttng_add_gid_to_ctx(struct lttng_kernel_ctx
**ctx
);
953 int lttng_add_egid_to_ctx(struct lttng_kernel_ctx
**ctx
);
954 int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx
**ctx
);
955 int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx
**ctx
);
956 int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx
**ctx
);
957 int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx
**ctx
);
958 int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx
**ctx
);
959 int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx
**ctx
);
960 int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx
**ctx
);
962 #if defined(CONFIG_PERF_EVENTS)
963 int lttng_add_perf_counter_to_ctx(uint32_t type
,
966 struct lttng_kernel_ctx
**ctx
);
967 int lttng_cpuhp_perf_counter_online(unsigned int cpu
,
968 struct lttng_cpuhp_node
*node
);
969 int lttng_cpuhp_perf_counter_dead(unsigned int cpu
,
970 struct lttng_cpuhp_node
*node
);
973 int lttng_add_perf_counter_to_ctx(uint32_t type
,
976 struct lttng_kernel_ctx
**ctx
)
981 int lttng_cpuhp_perf_counter_online(unsigned int cpu
,
982 struct lttng_cpuhp_node
*node
)
987 int lttng_cpuhp_perf_counter_dead(unsigned int cpu
,
988 struct lttng_cpuhp_node
*node
)
994 struct lttng_event_recorder_enabler
*lttng_event_recorder_enabler_create(
995 enum lttng_enabler_format_type format_type
,
996 struct lttng_kernel_abi_event
*event_param
,
997 struct lttng_kernel_channel_buffer
*chan
);
998 void lttng_event_enabler_session_add(struct lttng_kernel_session
*session
,
999 struct lttng_event_enabler_session_common
*event_enabler
);
1001 struct lttng_event_notifier_enabler
*lttng_event_notifier_enabler_create(
1002 enum lttng_enabler_format_type format_type
,
1003 struct lttng_kernel_abi_event_notifier
*event_notifier_param
,
1004 struct lttng_event_notifier_group
*event_notifier_group
);
1005 void lttng_event_notifier_enabler_group_add(struct lttng_event_notifier_group
*event_notifier_group
,
1006 struct lttng_event_notifier_enabler
*event_notifier_enabler
);
1007 int lttng_event_notifier_enabler_attach_capture_bytecode(
1008 struct lttng_event_notifier_enabler
*event_notifier_enabler
,
1009 struct lttng_kernel_abi_capture_bytecode __user
*bytecode
);
1011 int lttng_event_enabler_enable(struct lttng_event_enabler_common
*event_enabler
);
1012 int lttng_event_enabler_disable(struct lttng_event_enabler_common
*event_enabler
);
1013 int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler_common
*event_enabler
,
1014 struct lttng_kernel_abi_filter_bytecode __user
*bytecode
);
1015 void lttng_event_enabler_destroy(struct lttng_event_enabler_common
*event_enabler
);
1017 bool lttng_desc_match_enabler(const struct lttng_kernel_event_desc
*desc
,
1018 struct lttng_event_enabler_common
*enabler
);
1019 bool lttng_event_enabler_match_event(struct lttng_event_enabler_common
*event_enabler
,
1020 struct lttng_kernel_event_common
*event
);
1022 void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc
*event_desc
,
1023 struct lttng_kernel_ctx
*ctx
,
1024 struct list_head
*instance_bytecode_runtime_head
,
1025 struct list_head
*enabler_bytecode_runtime_head
);
1027 #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
1028 int lttng_event_enabler_create_syscall_events_if_missing(struct lttng_event_enabler_common
*event_enabler
);
1029 int lttng_syscall_filter_enable_event(struct lttng_kernel_event_common
*event
);
1030 int lttng_syscall_filter_disable_event(struct lttng_kernel_event_common
*event
);
1032 int lttng_syscalls_unregister_syscall_table(struct lttng_kernel_syscall_table
*syscall_table
);
1033 int lttng_syscalls_destroy_syscall_table(struct lttng_kernel_syscall_table
*syscall_table
);
1035 long lttng_syscall_table_get_active_mask(struct lttng_kernel_syscall_table
*syscall_table
,
1036 struct lttng_kernel_abi_syscall_mask __user
*usyscall_mask
);
1038 void lttng_syscall_table_set_wildcard_all(struct lttng_event_enabler_common
*event_enabler
);
1040 static inline int lttng_event_enabler_create_syscall_events_if_missing(struct lttng_event_enabler_common
*event_enabler
)
1045 static inline int lttng_syscall_filter_enable_event(struct lttng_kernel_event_common
*event
)
1050 static inline int lttng_syscall_filter_disable_event(struct lttng_kernel_event_common
*event
)
1055 static inline int lttng_syscalls_unregister_syscall_table(struct lttng_kernel_syscall_table
*syscall_table
)
1060 static inline int lttng_syscalls_destroy_syscall_table(struct lttng_kernel_syscall_table
*syscall_table
)
1065 static inline long lttng_syscall_table_get_active_mask(struct lttng_kernel_syscall_table
*syscall_table
,
1066 struct lttng_kernel_abi_syscall_mask __user
*usyscall_mask
)
1071 static inline int lttng_syscalls_create_matching_event_notifiers(struct lttng_event_notifier_enabler
*event_notifier_enabler
)
1076 static inline void lttng_syscall_table_set_wildcard_all(struct lttng_event_enabler_common
*event_enabler
)
1081 #ifdef CONFIG_KPROBES
1082 int lttng_kprobes_init_event(const char *name
,
1083 const char *symbol_name
,
1086 struct lttng_kernel_event_common
*event
);
1087 int lttng_kprobes_register_event(struct lttng_kernel_event_common
*event
);
1088 void lttng_kprobes_unregister_event(struct lttng_kernel_event_common
*event
);
1089 void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_common
*event
);
1090 int lttng_kprobes_match_check(const char *symbol_name
, uint64_t offset
, uint64_t addr
);
1094 int lttng_kprobes_init_event(const char *name
,
1095 const char *symbol_name
,
1098 struct lttng_kernel_event_common
*event
)
1103 int lttng_kprobes_register_event(struct lttng_kernel_event_common
*event
)
1109 void lttng_kprobes_unregister_event(struct lttng_kernel_event_common
*event
)
1114 void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_common
*event
)
1118 int lttng_kprobes_match_check(const char *symbol_name
, uint64_t offset
, uint64_t addr
)
1124 int lttng_event_add_callsite(struct lttng_kernel_event_common
*event
,
1125 struct lttng_kernel_abi_event_callsite __user
*callsite
);
1127 #ifdef CONFIG_UPROBES
1128 int lttng_uprobes_register_event(const char *name
,
1129 int fd
, struct lttng_kernel_event_common
*event
);
1130 int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common
*event
,
1131 struct lttng_kernel_abi_event_callsite __user
*callsite
);
1132 void lttng_uprobes_unregister_event(struct lttng_kernel_event_common
*event
);
1133 void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_common
*event
);
1136 int lttng_uprobes_register_event(const char *name
,
1137 int fd
, struct lttng_kernel_event_common
*event
)
1143 int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common
*event
,
1144 struct lttng_kernel_abi_event_callsite __user
*callsite
)
1150 void lttng_uprobes_unregister_event(struct lttng_kernel_event_common
*event
)
1155 void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_common
*event
)
1160 #ifdef CONFIG_KRETPROBES
1161 struct lttng_krp
*lttng_kretprobes_create_krp(const char *symbol_name
,
1162 uint64_t offset
, uint64_t addr
);
1163 void lttng_kretprobes_put_krp(struct lttng_krp
*krp
);
1164 int lttng_kretprobes_init_event(const char *name
,
1165 enum lttng_kretprobe_entryexit entryexit
,
1166 struct lttng_kernel_event_common
*event
,
1167 struct lttng_krp
*krp
);
1168 int lttng_kretprobes_register_event(struct lttng_kernel_event_common
*event
);
1169 void lttng_kretprobes_unregister_event(struct lttng_kernel_event_common
*event
);
1170 void lttng_kretprobes_destroy_event_private(struct lttng_kernel_event_common
*event
);
1171 int lttng_kretprobes_match_check(const char *symbol_name
, uint64_t offset
, uint64_t addr
);
1174 struct lttng_krp
*lttng_kretprobes_create_krp(const char *symbol_name
,
1175 uint64_t offset
, uint64_t addr
)
1181 void lttng_kretprobes_put_krp(struct lttng_krp
*krp
)
1186 int lttng_kretprobes_init_event(const char *name
,
1187 enum lttng_kretprobe_entryexit entryexit
,
1188 struct lttng_kernel_event_common
*event
,
1189 struct lttng_krp
*krp
)
1195 int lttng_kretprobes_register_event(struct lttng_kernel_event_common
*event
)
1201 void lttng_kretprobes_unregister_event(struct lttng_kernel_event_common
*event
)
1206 void lttng_kretprobes_destroy_event_private(struct lttng_kernel_event_common
*event
)
1211 int lttng_kretprobes_match_check(const char *symbol_name
, uint64_t offset
, uint64_t addr
)
1217 struct lttng_kernel_event_desc
*lttng_create_kretprobes_event_desc(const char *name
)
1223 int lttng_kretprobes_register(const char *symbol_name
,
1226 struct lttng_kernel_event_common
*event_entry
,
1227 struct lttng_kernel_event_common
*event_exit
)
1233 void lttng_lock_sessions(void);
1234 void lttng_unlock_sessions(void);
1236 struct list_head
*lttng_get_probe_list_head(void);
1238 int lttng_fix_pending_events(void);
1239 int lttng_fix_pending_event_notifiers(void);
1240 int lttng_session_active(void);
1241 bool lttng_event_notifier_active(void);
1243 struct lttng_kernel_session
*lttng_session_create(void);
1244 int lttng_session_enable(struct lttng_kernel_session
*session
);
1245 int lttng_session_disable(struct lttng_kernel_session
*session
);
1246 void lttng_session_destroy(struct lttng_kernel_session
*session
);
1247 int lttng_session_metadata_regenerate(struct lttng_kernel_session
*session
);
1248 int lttng_session_statedump(struct lttng_kernel_session
*session
);
1249 void metadata_cache_destroy(struct kref
*kref
);
1251 struct lttng_kernel_channel_counter
*lttng_kernel_counter_create(
1252 const char *counter_transport_name
,
1253 size_t number_dimensions
,
1254 const struct lttng_kernel_counter_dimension
*dimensions
,
1255 int64_t global_sum_step
,
1256 bool coalesce_hits
);
1257 int lttng_kernel_counter_read(struct lttng_kernel_channel_counter
*counter
,
1258 const size_t *dimension_indexes
, int32_t cpu
,
1259 int64_t *val
, bool *overflow
, bool *underflow
);
1260 int lttng_kernel_counter_aggregate(struct lttng_kernel_channel_counter
*counter
,
1261 const size_t *dimension_indexes
, int64_t *val
,
1262 bool *overflow
, bool *underflow
);
1263 int lttng_kernel_counter_clear(struct lttng_kernel_channel_counter
*counter
,
1264 const size_t *dimension_indexes
);
1265 int lttng_kernel_counter_get_nr_dimensions(struct lttng_kernel_channel_counter
*counter
,
1266 size_t *nr_dimensions
);
1267 int lttng_kernel_counter_get_max_nr_elem(struct lttng_kernel_channel_counter
*counter
,
1268 size_t *max_nr_elem
);
1269 struct lttng_event_notifier_group
*lttng_event_notifier_group_create(void);
1270 void lttng_event_notifier_group_destroy(
1271 struct lttng_event_notifier_group
*event_notifier_group
);
1273 struct lttng_kernel_channel_buffer
*lttng_channel_buffer_create(struct lttng_kernel_session
*session
,
1274 const char *transport_name
,
1276 size_t subbuf_size
, size_t num_subbuf
,
1277 unsigned int switch_timer_interval
,
1278 unsigned int read_timer_interval
,
1279 enum channel_type channel_type
);
1280 struct lttng_kernel_channel_buffer
*lttng_global_channel_create(struct lttng_kernel_session
*session
,
1281 int overwrite
, void *buf_addr
,
1282 size_t subbuf_size
, size_t num_subbuf
,
1283 unsigned int switch_timer_interval
,
1284 unsigned int read_timer_interval
);
1286 void lttng_metadata_channel_buffer_destroy(struct lttng_kernel_channel_buffer
*chan
);
1287 struct lttng_kernel_event_common
*_lttng_kernel_event_create(struct lttng_event_enabler_common
*event_enabler
,
1288 const struct lttng_kernel_event_desc
*event_desc
,
1289 struct lttng_kernel_event_pair
*event_pair
);
1290 struct lttng_kernel_event_common
*lttng_kernel_event_create(struct lttng_event_enabler_common
*event_enabler
,
1291 const struct lttng_kernel_event_desc
*event_desc
,
1292 struct lttng_kernel_event_pair
*event_pair
);
1294 int lttng_channel_enable(struct lttng_kernel_channel_common
*channel
);
1295 int lttng_channel_disable(struct lttng_kernel_channel_common
*channel
);
1296 int lttng_event_enable(struct lttng_kernel_event_common
*event
);
1297 int lttng_event_disable(struct lttng_kernel_event_common
*event
);
1299 void lttng_transport_register(struct lttng_transport
*transport
);
1300 void lttng_transport_unregister(struct lttng_transport
*transport
);
1302 void lttng_counter_transport_register(struct lttng_counter_transport
*transport
);
1303 void lttng_counter_transport_unregister(struct lttng_counter_transport
*transport
);
1305 void synchronize_trace(void);
1306 int lttng_abi_init(void);
1307 int lttng_abi_compat_old_init(void);
1308 void lttng_abi_exit(void);
1309 void lttng_abi_compat_old_exit(void);
1311 const struct lttng_kernel_event_desc
*lttng_event_desc_get(const char *name
);
1312 void lttng_event_desc_put(const struct lttng_kernel_event_desc
*desc
);
1313 int lttng_probes_init(void);
1314 void lttng_probes_exit(void);
1316 int lttng_metadata_output_channel(struct lttng_metadata_stream
*stream
,
1317 struct lttng_kernel_ring_buffer_channel
*chan
, bool *coherent
);
1319 int lttng_id_tracker_get_node_id(const struct lttng_id_hash_node
*node
);
1320 int lttng_id_tracker_empty_set(struct lttng_kernel_id_tracker
*lf
);
1321 int lttng_id_tracker_init(struct lttng_kernel_id_tracker
*lf
,
1322 struct lttng_kernel_session
*session
,
1323 enum tracker_type type
);
1324 void lttng_id_tracker_fini(struct lttng_kernel_id_tracker
*lf
);
1325 void lttng_id_tracker_destroy(struct lttng_kernel_id_tracker
*lf
, bool rcu
);
1326 int lttng_id_tracker_add(struct lttng_kernel_id_tracker
*lf
, int id
);
1327 int lttng_id_tracker_del(struct lttng_kernel_id_tracker
*lf
, int id
);
1329 int lttng_session_track_id(struct lttng_kernel_session
*session
,
1330 enum tracker_type tracker_type
, int id
);
1331 int lttng_session_untrack_id(struct lttng_kernel_session
*session
,
1332 enum tracker_type tracker_type
, int id
);
1334 int lttng_session_list_tracker_ids(struct lttng_kernel_session
*session
,
1335 enum tracker_type tracker_type
);
1337 void lttng_clock_ref(void);
1338 void lttng_clock_unref(void);
1340 void lttng_free_event_filter_runtime(struct lttng_kernel_event_common
*event
);
1342 int lttng_probes_init(void);
1344 int lttng_logger_init(void);
1345 void lttng_logger_exit(void);
1347 extern int lttng_statedump_start(struct lttng_kernel_session
*session
);
1349 int lttng_calibrate(struct lttng_kernel_abi_calibrate
*calibrate
);
1351 extern const struct file_operations lttng_tracepoint_list_fops
;
1352 extern const struct file_operations lttng_syscall_list_fops
;
1354 struct lttng_kernel_channel_buffer
*lttng_kernel_alloc_channel_buffer(void);
1355 struct lttng_kernel_channel_counter
*lttng_kernel_alloc_channel_counter(void);
1356 void lttng_kernel_free_channel_common(struct lttng_kernel_channel_common
*chan
);
1358 int format_event_key(struct lttng_event_enabler_common
*event_enabler
, char *key_string
,
1359 const char *event_name
);
1360 bool lttng_event_enabler_event_name_key_match_event(struct lttng_event_enabler_common
*event_enabler
,
1361 const char *event_name
, const char *key_string
, struct lttng_kernel_event_common
*event
);
1362 struct lttng_event_counter_enabler
*lttng_event_counter_enabler_create(
1363 enum lttng_enabler_format_type format_type
,
1364 struct lttng_kernel_abi_event
*event_param
,
1365 struct lttng_kernel_counter_key
*counter_key
,
1366 struct lttng_kernel_channel_counter
*chan
);
1368 int create_counter_key_from_kernel(struct lttng_kernel_counter_key
**counter_key
,
1369 const struct lttng_kernel_counter_key
*key
);
1370 void destroy_counter_key(struct lttng_kernel_counter_key
*counter_key
);
1372 #define lttng_kernel_static_ctx_field(_event_field, _get_size, _record, _get_value, _destroy, _priv) \
1373 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, { \
1374 .event_field = (_event_field), \
1375 .get_size = (_get_size), \
1376 .record = (_record), \
1377 .get_value = (_get_value), \
1378 .destroy = (_destroy), \
1382 #endif /* _LTTNG_EVENTS_INTERNAL_H */