1 #ifndef _LTTNG_UST_EVENTS_H
2 #define _LTTNG_UST_EVENTS_H
7 * Copyright 2010-2012 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Holds LTTng per-session event registry.
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 #include <urcu/list.h>
31 #include <urcu/hlist.h>
34 #include <lttng/ust-config.h>
35 #include <lttng/ust-abi.h>
36 #include <lttng/ust-tracer.h>
37 #include <lttng/ust-endian.h>
44 #error "LTTNG_PACKED should be defined"
51 #define LTTNG_UST_UUID_LEN 16
54 * Tracepoint provider version. Compatibility based on the major number.
55 * Older tracepoint providers can always register to newer lttng-ust
56 * library, but the opposite is rejected: a newer tracepoint provider is
57 * rejected by an older lttng-ust library.
59 #define LTTNG_UST_PROVIDER_MAJOR 2
60 #define LTTNG_UST_PROVIDER_MINOR 0
64 struct lttng_ust_lib_ring_buffer_ctx
;
65 struct lttng_ust_context_app
;
66 struct lttng_event_field
;
69 * Data structures used by tracepoint event declarations, and by the
70 * tracer. Those structures have padding for future extension.
74 * LTTng client type enumeration. Used by the consumer to map the
75 * callbacks from its own address space.
77 enum lttng_client_types
{
78 LTTNG_CLIENT_METADATA
= 0,
79 LTTNG_CLIENT_DISCARD
= 1,
80 LTTNG_CLIENT_OVERWRITE
= 2,
81 LTTNG_CLIENT_DISCARD_RT
= 3,
82 LTTNG_CLIENT_OVERWRITE_RT
= 4,
83 LTTNG_NR_CLIENT_TYPES
,
86 /* Type description */
88 /* Update the astract_types name table in lttng-types.c along with this enum */
89 enum lttng_abstract_types
{
91 atype_enum
, /* legacy */
92 atype_array
, /* legacy */
93 atype_sequence
, /* legacy */
97 atype_struct
, /* legacy */
100 atype_sequence_nestable
,
101 atype_struct_nestable
,
105 /* Update the string_encodings name table in lttng-types.c along with this enum */
106 enum lttng_string_encodings
{
107 lttng_encode_none
= 0,
108 lttng_encode_UTF8
= 1,
109 lttng_encode_ASCII
= 2,
113 struct lttng_enum_value
{
114 unsigned long long value
;
115 unsigned int signedness
:1;
118 enum lttng_enum_entry_options
{
119 LTTNG_ENUM_ENTRY_OPTION_IS_AUTO
= 1U << 0,
122 #define LTTNG_UST_ENUM_ENTRY_PADDING 16
123 struct lttng_enum_entry
{
124 struct lttng_enum_value start
, end
; /* start and end are inclusive */
128 unsigned int options
;
129 } LTTNG_PACKED extra
;
130 char padding
[LTTNG_UST_ENUM_ENTRY_PADDING
];
134 #define __type_integer(_type, _byte_order, _base, _encoding) \
136 .atype = atype_integer, \
141 .size = sizeof(_type) * CHAR_BIT, \
142 .alignment = lttng_alignof(_type) * CHAR_BIT, \
143 .signedness = lttng_is_signed_type(_type), \
144 .reverse_byte_order = _byte_order != BYTE_ORDER, \
146 .encoding = lttng_encode_##_encoding, \
151 #define LTTNG_UST_INTEGER_TYPE_PADDING 24
152 struct lttng_integer_type
{
153 unsigned int size
; /* in bits */
154 unsigned short alignment
; /* in bits */
155 unsigned int signedness
:1;
156 unsigned int reverse_byte_order
:1;
157 unsigned int base
; /* 2, 8, 10, 16, for pretty print */
158 enum lttng_string_encodings encoding
;
159 char padding
[LTTNG_UST_INTEGER_TYPE_PADDING
];
163 * Only float and double are supported. long double is not supported at
166 #define _float_mant_dig(_type) \
167 (sizeof(_type) == sizeof(float) ? FLT_MANT_DIG \
168 : (sizeof(_type) == sizeof(double) ? DBL_MANT_DIG \
171 #define __type_float(_type) \
173 .atype = atype_float, \
178 .exp_dig = sizeof(_type) * CHAR_BIT \
179 - _float_mant_dig(_type), \
180 .mant_dig = _float_mant_dig(_type), \
181 .alignment = lttng_alignof(_type) * CHAR_BIT, \
182 .reverse_byte_order = BYTE_ORDER != FLOAT_WORD_ORDER, \
187 #define LTTNG_UST_FLOAT_TYPE_PADDING 24
188 struct lttng_float_type
{
189 unsigned int exp_dig
; /* exponent digits, in bits */
190 unsigned int mant_dig
; /* mantissa digits, in bits */
191 unsigned short alignment
; /* in bits */
192 unsigned int reverse_byte_order
:1;
193 char padding
[LTTNG_UST_FLOAT_TYPE_PADDING
];
197 #define LTTNG_UST_BASIC_TYPE_PADDING 128
198 union _lttng_basic_type
{
199 struct lttng_integer_type integer
; /* legacy */
201 const struct lttng_enum_desc
*desc
; /* Enumeration mapping */
202 struct lttng_integer_type container_type
;
203 } enumeration
; /* legacy */
205 enum lttng_string_encodings encoding
;
206 } string
; /* legacy */
207 struct lttng_float_type _float
; /* legacy */
208 char padding
[LTTNG_UST_BASIC_TYPE_PADDING
];
212 struct lttng_basic_type
{
213 enum lttng_abstract_types atype
;
215 union _lttng_basic_type basic
;
219 #define LTTNG_UST_TYPE_PADDING 128
221 enum lttng_abstract_types atype
;
223 /* provider ABI 2.0 */
224 struct lttng_integer_type integer
;
225 struct lttng_float_type _float
;
227 enum lttng_string_encodings encoding
;
230 const struct lttng_enum_desc
*desc
; /* Enumeration mapping */
231 struct lttng_type
*container_type
;
234 const struct lttng_type
*elem_type
;
235 unsigned int length
; /* Num. elems. */
236 unsigned int alignment
;
239 const char *length_name
; /* Length field name. */
240 const struct lttng_type
*elem_type
;
241 unsigned int alignment
; /* Alignment before elements. */
244 unsigned int nr_fields
;
245 const struct lttng_event_field
*fields
; /* Array of fields. */
246 unsigned int alignment
;
250 /* legacy provider ABI 1.0 */
251 union _lttng_basic_type basic
; /* legacy */
253 struct lttng_basic_type elem_type
;
254 unsigned int length
; /* Num. elems. */
255 } array
; /* legacy */
257 struct lttng_basic_type length_type
;
258 struct lttng_basic_type elem_type
;
259 } sequence
; /* legacy */
261 unsigned int nr_fields
;
262 struct lttng_event_field
*fields
; /* Array of fields. */
263 } _struct
; /* legacy */
265 char padding
[LTTNG_UST_TYPE_PADDING
];
269 #define LTTNG_UST_ENUM_TYPE_PADDING 24
270 struct lttng_enum_desc
{
272 const struct lttng_enum_entry
*entries
;
273 unsigned int nr_entries
;
274 char padding
[LTTNG_UST_ENUM_TYPE_PADDING
];
278 * Event field description
280 * IMPORTANT: this structure is part of the ABI between the probe and
281 * UST. Fields need to be only added at the end, never reordered, never
285 #define LTTNG_UST_EVENT_FIELD_PADDING 28
286 struct lttng_event_field
{
288 struct lttng_type type
;
289 unsigned int nowrite
; /* do not write into trace */
292 unsigned int nofilter
:1; /* do not consider for filter */
294 char padding
[LTTNG_UST_EVENT_FIELD_PADDING
];
298 enum lttng_ust_dynamic_type
{
299 LTTNG_UST_DYNAMIC_TYPE_NONE
,
300 LTTNG_UST_DYNAMIC_TYPE_S8
,
301 LTTNG_UST_DYNAMIC_TYPE_S16
,
302 LTTNG_UST_DYNAMIC_TYPE_S32
,
303 LTTNG_UST_DYNAMIC_TYPE_S64
,
304 LTTNG_UST_DYNAMIC_TYPE_U8
,
305 LTTNG_UST_DYNAMIC_TYPE_U16
,
306 LTTNG_UST_DYNAMIC_TYPE_U32
,
307 LTTNG_UST_DYNAMIC_TYPE_U64
,
308 LTTNG_UST_DYNAMIC_TYPE_FLOAT
,
309 LTTNG_UST_DYNAMIC_TYPE_DOUBLE
,
310 LTTNG_UST_DYNAMIC_TYPE_STRING
,
311 _NR_LTTNG_UST_DYNAMIC_TYPES
,
314 struct lttng_ctx_value
{
315 enum lttng_ust_dynamic_type sel
;
324 struct lttng_perf_counter_field
;
326 #define LTTNG_UST_CTX_FIELD_PADDING 40
327 struct lttng_ctx_field
{
328 struct lttng_event_field event_field
;
329 size_t (*get_size
)(struct lttng_ctx_field
*field
, size_t offset
);
330 void (*record
)(struct lttng_ctx_field
*field
,
331 struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
332 struct lttng_channel
*chan
);
333 void (*get_value
)(struct lttng_ctx_field
*field
,
334 struct lttng_ctx_value
*value
);
336 struct lttng_perf_counter_field
*perf_counter
;
337 char padding
[LTTNG_UST_CTX_FIELD_PADDING
];
339 void (*destroy
)(struct lttng_ctx_field
*field
);
340 char *field_name
; /* Has ownership, dynamically allocated. */
343 #define LTTNG_UST_CTX_PADDING 20
345 struct lttng_ctx_field
*fields
;
346 unsigned int nr_fields
;
347 unsigned int allocated_fields
;
348 unsigned int largest_align
;
349 char padding
[LTTNG_UST_CTX_PADDING
];
352 #define LTTNG_UST_EVENT_DESC_PADDING 40
353 struct lttng_event_desc
{
355 void (*probe_callback
)(void);
356 const struct lttng_event_ctx
*ctx
; /* context */
357 const struct lttng_event_field
*fields
; /* event payload */
358 unsigned int nr_fields
;
359 const int **loglevel
;
360 const char *signature
; /* Argument types/names received */
363 const char **model_emf_uri
;
364 void (*event_notifier_callback
)(void);
366 char padding
[LTTNG_UST_EVENT_DESC_PADDING
];
370 #define LTTNG_UST_PROBE_DESC_PADDING 12
371 struct lttng_probe_desc
{
372 const char *provider
;
373 const struct lttng_event_desc
**event_desc
;
374 unsigned int nr_events
;
375 struct cds_list_head head
; /* chain registered probes */
376 struct cds_list_head lazy_init_head
;
377 int lazy
; /* lazy registration */
380 char padding
[LTTNG_UST_PROBE_DESC_PADDING
];
383 /* Data structures used by the tracer. */
385 enum lttng_enabler_format_type
{
386 LTTNG_ENABLER_FORMAT_STAR_GLOB
,
387 LTTNG_ENABLER_FORMAT_EVENT
,
391 * Enabler field, within whatever object is enabling an event. Target of
392 * backward reference.
394 struct lttng_enabler
{
395 enum lttng_enabler_format_type format_type
;
397 /* head list of struct lttng_ust_filter_bytecode_node */
398 struct cds_list_head filter_bytecode_head
;
399 /* head list of struct lttng_ust_excluder_node */
400 struct cds_list_head excluder_head
;
402 struct lttng_ust_event event_param
;
403 unsigned int enabled
:1;
406 struct tp_list_entry
{
407 struct lttng_ust_tracepoint_iter tp
;
408 struct cds_list_head head
;
411 struct lttng_ust_tracepoint_list
{
412 struct tp_list_entry
*iter
;
413 struct cds_list_head head
;
416 struct tp_field_list_entry
{
417 struct lttng_ust_field_iter field
;
418 struct cds_list_head head
;
421 struct lttng_ust_field_list
{
422 struct tp_field_list_entry
*iter
;
423 struct cds_list_head head
;
426 struct ust_pending_probe
;
430 * Bytecode interpreter return value masks.
432 enum lttng_bytecode_interpreter_ret
{
433 LTTNG_INTERPRETER_DISCARD
= 0,
434 LTTNG_INTERPRETER_RECORD_FLAG
= (1ULL << 0),
435 /* Other bits are kept for future use. */
438 struct lttng_interpreter_output
;
441 * This structure is used in the probes. More specifically, the `filter` and
442 * `node` fields are explicity used in the probes. When modifying this
443 * structure we must not change the layout of these two fields as it is
446 struct lttng_bytecode_runtime
{
447 /* Associated bytecode */
448 struct lttng_ust_bytecode_node
*bc
;
450 uint64_t (*filter
)(void *interpreter_data
,
451 const char *interpreter_stack_data
);
452 uint64_t (*capture
)(void *interpreter_data
,
453 const char *interpreter_stack_data
,
454 struct lttng_interpreter_output
*interpreter_output
);
457 struct cds_list_head node
; /* list of bytecode runtime in event */
459 * Pointer to a URCU-protected pointer owned by an `struct
460 * lttng_session`or `struct lttng_event_notifier_group`.
462 struct lttng_ctx
**pctx
;
466 * Objects in a linked-list of enablers, owned by an event or event_notifier.
467 * This is used because an event (or a event_notifier) can be enabled by more
468 * than one enabler and we want a quick way to iterate over all enablers of an
471 * For example, event rules "my_app:a*" and "my_app:ab*" will both match the
472 * event with the name "my_app:abc".
474 struct lttng_enabler_ref
{
475 struct cds_list_head node
; /* enabler ref list */
476 struct lttng_enabler
*ref
; /* backward ref */
480 * lttng_event structure is referred to by the tracing fast path. It
481 * must be kept small.
483 * IMPORTANT: this structure is part of the ABI between the probe and
484 * UST. Fields need to be only added at the end, never reordered, never
488 /* LTTng-UST 2.0 starts here */
490 struct lttng_channel
*chan
;
492 const struct lttng_event_desc
*desc
;
494 struct lttng_ctx
*ctx
;
495 enum lttng_ust_instrumentation instrumentation
;
496 struct cds_list_head node
; /* Event list in session */
497 struct cds_list_head _deprecated2
;
499 unsigned int _deprecated4
:1;
501 /* LTTng-UST 2.1 starts here */
502 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
503 struct cds_list_head filter_bytecode_runtime_head
;
504 int has_enablers_without_bytecode
;
505 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
506 struct cds_list_head enablers_ref_head
;
507 struct cds_hlist_node hlist
; /* session ht of events */
508 int registered
; /* has reg'd tracepoint probe */
511 struct lttng_event_notifier
{
514 int registered
; /* has reg'd tracepoint probe */
515 size_t num_captures
; /* Needed to allocate the msgpack array. */
516 struct cds_list_head filter_bytecode_runtime_head
;
517 struct cds_list_head capture_bytecode_runtime_head
;
518 int has_enablers_without_bytecode
;
519 struct cds_list_head enablers_ref_head
;
520 const struct lttng_event_desc
*desc
;
521 struct cds_hlist_node hlist
; /* hashtable of event_notifiers */
522 struct cds_list_head node
; /* event_notifier list in session */
523 struct lttng_event_notifier_group
*group
; /* weak ref */
527 const struct lttng_enum_desc
*desc
;
528 struct lttng_session
*session
;
529 struct cds_list_head node
; /* Enum list in session */
530 struct cds_hlist_node hlist
; /* Session ht of enums */
531 uint64_t id
; /* Enumeration ID in sessiond */
535 struct lttng_ust_shm_handle
;
538 * IMPORTANT: this structure is part of the ABI between the probe and
539 * UST. Fields need to be only added at the end, never reordered, never
542 struct lttng_channel_ops
{
543 struct lttng_channel
*(*channel_create
)(const char *name
,
545 size_t subbuf_size
, size_t num_subbuf
,
546 unsigned int switch_timer_interval
,
547 unsigned int read_timer_interval
,
550 const int *stream_fds
, int nr_stream_fds
,
551 int64_t blocking_timeout
);
552 void (*channel_destroy
)(struct lttng_channel
*chan
);
556 * has_strcpy is needed by probe providers version 1.0 to
557 * dynamically detect whether the LTTng-UST tracepoint
558 * provider ABI implements event_strcpy. Starting from
559 * probe providers version 2.0, the check is not needed,
560 * but backward compatibility is provided for older versions.
562 unsigned long has_strcpy
:1; /* ABI has strcpy */
565 int (*event_reserve
)(struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
567 void (*event_commit
)(struct lttng_ust_lib_ring_buffer_ctx
*ctx
);
568 void (*event_write
)(struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
569 const void *src
, size_t len
);
571 * packet_avail_size returns the available size in the current
572 * packet. Note that the size returned is only a hint, since it
573 * may change due to concurrent writes.
575 size_t (*packet_avail_size
)(struct channel
*chan
,
576 struct lttng_ust_shm_handle
*handle
);
577 //wait_queue_head_t *(*get_reader_wait_queue)(struct channel *chan);
578 //wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
579 int (*is_finalized
)(struct channel
*chan
);
580 int (*is_disabled
)(struct channel
*chan
);
581 int (*flush_buffer
)(struct channel
*chan
, struct lttng_ust_shm_handle
*handle
);
582 void (*event_strcpy
)(struct lttng_ust_lib_ring_buffer_ctx
*ctx
,
583 const char *src
, size_t len
);
587 * IMPORTANT: this structure is part of the ABI between the probe and
588 * UST. Fields need to be only added at the end, never reordered, never
591 struct lttng_channel
{
593 * The pointers located in this private data are NOT safe to be
594 * dereferenced by the consumer. The only operations the
595 * consumer process is designed to be allowed to do is to read
596 * and perform subbuffer flush.
598 struct channel
*chan
; /* Channel buffers */
600 struct lttng_ctx
*ctx
;
601 /* Event ID management */
602 struct lttng_session
*session
;
603 int objd
; /* Object associated to channel */
604 unsigned int _deprecated1
;
605 unsigned int _deprecated2
;
606 struct cds_list_head node
; /* Channel list in session */
607 const struct lttng_channel_ops
*ops
;
608 int header_type
; /* 0: unset, 1: compact, 2: large */
609 struct lttng_ust_shm_handle
*handle
; /* shared-memory handle */
610 unsigned int _deprecated3
:1;
614 enum lttng_ust_chan_type type
;
615 unsigned char uuid
[LTTNG_UST_UUID_LEN
]; /* Trace session unique ID */
616 int tstate
:1; /* Transient enable state */
619 #define LTTNG_UST_STACK_CTX_PADDING 32
620 struct lttng_stack_ctx
{
621 struct lttng_event
*event
;
622 struct lttng_ctx
*chan_ctx
; /* RCU dereferenced. */
623 struct lttng_ctx
*event_ctx
; /* RCU dereferenced. */
624 char padding
[LTTNG_UST_STACK_CTX_PADDING
];
627 #define LTTNG_UST_EVENT_HT_BITS 12
628 #define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS)
630 struct lttng_ust_event_ht
{
631 struct cds_hlist_head table
[LTTNG_UST_EVENT_HT_SIZE
];
634 #define LTTNG_UST_EVENT_NOTIFIER_HT_BITS 12
635 #define LTTNG_UST_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_UST_EVENT_NOTIFIER_HT_BITS)
636 struct lttng_ust_event_notifier_ht
{
637 struct cds_hlist_head table
[LTTNG_UST_EVENT_NOTIFIER_HT_SIZE
];
640 #define LTTNG_UST_ENUM_HT_BITS 12
641 #define LTTNG_UST_ENUM_HT_SIZE (1U << LTTNG_UST_ENUM_HT_BITS)
643 struct lttng_ust_enum_ht
{
644 struct cds_hlist_head table
[LTTNG_UST_ENUM_HT_SIZE
];
648 * IMPORTANT: this structure is part of the ABI between the probe and
649 * UST. Fields need to be only added at the end, never reordered, never
652 struct lttng_session
{
653 int active
; /* Is trace session active ? */
654 int been_active
; /* Been active ? */
655 int objd
; /* Object associated */
657 struct cds_list_head chan_head
; /* Channel list head */
658 struct cds_list_head events_head
; /* list of events */
659 struct cds_list_head _deprecated2
;
660 struct cds_list_head node
; /* Session list */
662 unsigned int _deprecated4
:1;
665 /* List of enablers */
666 struct cds_list_head enablers_head
;
667 struct lttng_ust_event_ht events_ht
; /* ht of events */
668 void *owner
; /* object owner */
669 int tstate
:1; /* Transient enable state */
672 int statedump_pending
:1;
675 struct lttng_ust_enum_ht enums_ht
; /* ht of enumerations */
676 struct cds_list_head enums_head
;
677 struct lttng_ctx
*ctx
; /* contexts for filters. */
680 struct lttng_event_notifier_group
{
684 struct cds_list_head node
; /* Event notifier group handle list */
685 struct cds_list_head enablers_head
;
686 struct cds_list_head event_notifiers_head
; /* list of event_notifiers */
687 struct lttng_ust_event_notifier_ht event_notifiers_ht
; /* hashtable of event_notifiers */
688 struct lttng_ctx
*ctx
; /* contexts for filters. */
691 struct lttng_transport
{
693 struct cds_list_head node
;
694 struct lttng_channel_ops ops
;
695 const struct lttng_ust_lib_ring_buffer_config
*client_config
;
698 struct lttng_session
*lttng_session_create(void);
699 int lttng_session_enable(struct lttng_session
*session
);
700 int lttng_session_disable(struct lttng_session
*session
);
701 int lttng_session_statedump(struct lttng_session
*session
);
702 void lttng_session_destroy(struct lttng_session
*session
);
704 void lttng_event_notifier_notification_send(
705 struct lttng_event_notifier
*event_notifier
,
706 const char *stack_data
);
708 struct lttng_channel
*lttng_channel_create(struct lttng_session
*session
,
709 const char *transport_name
,
711 size_t subbuf_size
, size_t num_subbuf
,
712 unsigned int switch_timer_interval
,
713 unsigned int read_timer_interval
,
714 int **shm_fd
, int **wait_fd
,
715 uint64_t **memory_map_size
,
716 struct lttng_channel
*chan_priv_init
);
718 int lttng_channel_enable(struct lttng_channel
*channel
);
719 int lttng_channel_disable(struct lttng_channel
*channel
);
721 int lttng_attach_context(struct lttng_ust_context
*context_param
,
722 union ust_args
*uargs
,
723 struct lttng_ctx
**ctx
, struct lttng_session
*session
);
724 void lttng_transport_register(struct lttng_transport
*transport
);
725 void lttng_transport_unregister(struct lttng_transport
*transport
);
727 void synchronize_trace(void);
729 int lttng_probe_register(struct lttng_probe_desc
*desc
);
730 void lttng_probe_unregister(struct lttng_probe_desc
*desc
);
731 void lttng_probe_provider_unregister_events(struct lttng_probe_desc
*desc
);
732 int lttng_fix_pending_events(void);
733 int lttng_probes_init(void);
734 void lttng_probes_exit(void);
735 int lttng_find_context(struct lttng_ctx
*ctx
, const char *name
);
736 int lttng_get_context_index(struct lttng_ctx
*ctx
, const char *name
);
737 struct lttng_ctx_field
*lttng_append_context(struct lttng_ctx
**ctx_p
);
738 void lttng_context_update(struct lttng_ctx
*ctx
);
739 void lttng_remove_context_field(struct lttng_ctx
**ctx_p
,
740 struct lttng_ctx_field
*field
);
741 void lttng_destroy_context(struct lttng_ctx
*ctx
);
742 int lttng_add_vtid_to_ctx(struct lttng_ctx
**ctx
);
743 int lttng_add_vpid_to_ctx(struct lttng_ctx
**ctx
);
744 int lttng_add_pthread_id_to_ctx(struct lttng_ctx
**ctx
);
745 int lttng_add_procname_to_ctx(struct lttng_ctx
**ctx
);
746 int lttng_add_ip_to_ctx(struct lttng_ctx
**ctx
);
747 int lttng_add_cpu_id_to_ctx(struct lttng_ctx
**ctx
);
748 int lttng_add_dyntest_to_ctx(struct lttng_ctx
**ctx
);
749 int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx
**ctx
);
750 int lttng_add_ipc_ns_to_ctx(struct lttng_ctx
**ctx
);
751 int lttng_add_mnt_ns_to_ctx(struct lttng_ctx
**ctx
);
752 int lttng_add_net_ns_to_ctx(struct lttng_ctx
**ctx
);
753 int lttng_add_pid_ns_to_ctx(struct lttng_ctx
**ctx
);
754 int lttng_add_time_ns_to_ctx(struct lttng_ctx
**ctx
);
755 int lttng_add_user_ns_to_ctx(struct lttng_ctx
**ctx
);
756 int lttng_add_uts_ns_to_ctx(struct lttng_ctx
**ctx
);
757 int lttng_add_vuid_to_ctx(struct lttng_ctx
**ctx
);
758 int lttng_add_veuid_to_ctx(struct lttng_ctx
**ctx
);
759 int lttng_add_vsuid_to_ctx(struct lttng_ctx
**ctx
);
760 int lttng_add_vgid_to_ctx(struct lttng_ctx
**ctx
);
761 int lttng_add_vegid_to_ctx(struct lttng_ctx
**ctx
);
762 int lttng_add_vsgid_to_ctx(struct lttng_ctx
**ctx
);
763 void lttng_context_vtid_reset(void);
764 void lttng_context_vpid_reset(void);
765 void lttng_context_procname_reset(void);
766 void lttng_context_cgroup_ns_reset(void);
767 void lttng_context_ipc_ns_reset(void);
768 void lttng_context_mnt_ns_reset(void);
769 void lttng_context_net_ns_reset(void);
770 void lttng_context_pid_ns_reset(void);
771 void lttng_context_time_ns_reset(void);
772 void lttng_context_user_ns_reset(void);
773 void lttng_context_uts_ns_reset(void);
774 void lttng_context_vuid_reset(void);
775 void lttng_context_veuid_reset(void);
776 void lttng_context_vsuid_reset(void);
777 void lttng_context_vgid_reset(void);
778 void lttng_context_vegid_reset(void);
779 void lttng_context_vsgid_reset(void);
781 #ifdef LTTNG_UST_HAVE_PERF_EVENT
782 int lttng_add_perf_counter_to_ctx(uint32_t type
,
785 struct lttng_ctx
**ctx
);
786 int lttng_perf_counter_init(void);
787 void lttng_perf_counter_exit(void);
788 #else /* #ifdef LTTNG_UST_HAVE_PERF_EVENT */
790 int lttng_add_perf_counter_to_ctx(uint32_t type
,
793 struct lttng_ctx
**ctx
)
798 int lttng_perf_counter_init(void)
803 void lttng_perf_counter_exit(void)
806 #endif /* #else #ifdef LTTNG_UST_HAVE_PERF_EVENT */
808 extern const struct lttng_ust_client_lib_ring_buffer_client_cb
*lttng_client_callbacks_metadata
;
809 extern const struct lttng_ust_client_lib_ring_buffer_client_cb
*lttng_client_callbacks_discard
;
810 extern const struct lttng_ust_client_lib_ring_buffer_client_cb
*lttng_client_callbacks_overwrite
;
812 struct lttng_transport
*lttng_transport_find(const char *name
);
814 int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list
*list
);
815 void lttng_probes_prune_event_list(struct lttng_ust_tracepoint_list
*list
);
816 struct lttng_ust_tracepoint_iter
*
817 lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list
*list
);
818 int lttng_probes_get_field_list(struct lttng_ust_field_list
*list
);
819 void lttng_probes_prune_field_list(struct lttng_ust_field_list
*list
);
820 struct lttng_ust_field_iter
*
821 lttng_ust_field_list_get_iter_next(struct lttng_ust_field_list
*list
);
823 void lttng_free_event_filter_runtime(struct lttng_event
*event
);
825 struct cds_list_head
*lttng_get_probe_list_head(void);
826 int lttng_session_active(void);
828 typedef int (*t_statedump_func_ptr
)(struct lttng_session
*session
);
829 void lttng_handle_pending_statedump(void *owner
);
830 struct cds_list_head
*_lttng_get_sessions(void);
832 struct lttng_enum
*lttng_ust_enum_get_from_desc(struct lttng_session
*session
,
833 const struct lttng_enum_desc
*enum_desc
);
835 void lttng_ust_dl_update(void *ip
);
836 void lttng_ust_fixup_fd_tracker_tls(void);
838 /* For backward compatibility. Leave those exported symbols in place. */
839 extern struct lttng_ctx
*lttng_static_ctx
;
840 struct lttng_ust_filter_bytecode_node
;
841 struct lttng_ust_excluder_node
;
842 void lttng_context_init(void);
843 void lttng_context_exit(void);
844 void lttng_filter_event_link_bytecode(struct lttng_event
*event
);
845 struct lttng_enabler
*lttng_enabler_create(
846 enum lttng_enabler_format_type format_type
,
847 struct lttng_ust_event
*event_param
,
848 struct lttng_channel
*chan
);
849 int lttng_enabler_enable(struct lttng_enabler
*enabler
);
850 int lttng_enabler_disable(struct lttng_enabler
*enabler
);
851 int lttng_enabler_attach_bytecode(struct lttng_enabler
*enabler
,
852 struct lttng_ust_filter_bytecode_node
*bytecode
);
853 int lttng_enabler_attach_context(struct lttng_enabler
*enabler
,
854 struct lttng_ust_context
*ctx
);
855 int lttng_enabler_attach_exclusion(struct lttng_enabler
*enabler
,
856 struct lttng_ust_excluder_node
*excluder
);
857 void lttng_enabler_event_link_bytecode(struct lttng_event
*event
,
858 struct lttng_enabler
*enabler
);
859 void lttng_filter_sync_state(struct lttng_bytecode_runtime
*runtime
);
860 int lttng_session_context_init(struct lttng_ctx
**ctx
);
867 #endif /* _LTTNG_UST_EVENTS_H */