Move context symbols to private header
[lttng-ust.git] / include / lttng / ust-events.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
6 * Holds LTTng per-session event registry.
7 */
8
9 #ifndef _LTTNG_UST_EVENTS_H
10 #define _LTTNG_UST_EVENTS_H
11
12 #include <urcu/list.h>
13 #include <urcu/hlist.h>
14 #include <stddef.h>
15 #include <stdint.h>
16 #include <lttng/ust-abi.h>
17 #include <lttng/ust-tracer.h>
18 #include <lttng/ust-endian.h>
19 #include <float.h>
20 #include <errno.h>
21 #include <urcu/ref.h>
22 #include <pthread.h>
23
24 #ifndef LTTNG_PACKED
25 #error "LTTNG_PACKED should be defined"
26 #endif
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #define LTTNG_UST_UUID_LEN 16
33
34 /*
35 * Tracepoint provider version. Compatibility based on the major number.
36 * Older tracepoint providers can always register to newer lttng-ust
37 * library, but the opposite is rejected: a newer tracepoint provider is
38 * rejected by an older lttng-ust library.
39 */
40 #define LTTNG_UST_PROVIDER_MAJOR 2
41 #define LTTNG_UST_PROVIDER_MINOR 0
42
43 struct lttng_channel;
44 struct lttng_session;
45 struct lttng_ust_lib_ring_buffer_ctx;
46 struct lttng_ust_context_app;
47 struct lttng_event_field;
48 struct lttng_event_notifier;
49 struct lttng_event_notifier_group;
50
51 /*
52 * Data structures used by tracepoint event declarations, and by the
53 * tracer. Those structures have padding for future extension.
54 */
55
56 /*
57 * LTTng client type enumeration. Used by the consumer to map the
58 * callbacks from its own address space.
59 */
60 enum lttng_client_types {
61 LTTNG_CLIENT_METADATA = 0,
62 LTTNG_CLIENT_DISCARD = 1,
63 LTTNG_CLIENT_OVERWRITE = 2,
64 LTTNG_CLIENT_DISCARD_RT = 3,
65 LTTNG_CLIENT_OVERWRITE_RT = 4,
66 LTTNG_NR_CLIENT_TYPES,
67 };
68
69 /* Type description */
70
71 /* Update the astract_types name table in lttng-types.c along with this enum */
72 enum lttng_abstract_types {
73 atype_integer,
74 atype_enum, /* legacy */
75 atype_array, /* legacy */
76 atype_sequence, /* legacy */
77 atype_string,
78 atype_float,
79 atype_dynamic,
80 atype_struct, /* legacy */
81 atype_enum_nestable,
82 atype_array_nestable,
83 atype_sequence_nestable,
84 atype_struct_nestable,
85 NR_ABSTRACT_TYPES,
86 };
87
88 /* Update the string_encodings name table in lttng-types.c along with this enum */
89 enum lttng_string_encodings {
90 lttng_encode_none = 0,
91 lttng_encode_UTF8 = 1,
92 lttng_encode_ASCII = 2,
93 NR_STRING_ENCODINGS,
94 };
95
96 struct lttng_enum_value {
97 unsigned long long value;
98 unsigned int signedness:1;
99 };
100
101 enum lttng_enum_entry_options {
102 LTTNG_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0,
103 };
104
105 #define LTTNG_UST_ENUM_ENTRY_PADDING 16
106 struct lttng_enum_entry {
107 struct lttng_enum_value start, end; /* start and end are inclusive */
108 const char *string;
109 union {
110 struct {
111 unsigned int options;
112 } LTTNG_PACKED extra;
113 char padding[LTTNG_UST_ENUM_ENTRY_PADDING];
114 } u;
115 };
116
117 #define __type_integer(_type, _byte_order, _base, _encoding) \
118 { \
119 .atype = atype_integer, \
120 .u = \
121 { \
122 .integer = \
123 { \
124 .size = sizeof(_type) * CHAR_BIT, \
125 .alignment = lttng_alignof(_type) * CHAR_BIT, \
126 .signedness = lttng_is_signed_type(_type), \
127 .reverse_byte_order = _byte_order != BYTE_ORDER, \
128 .base = _base, \
129 .encoding = lttng_encode_##_encoding, \
130 } \
131 }, \
132 } \
133
134 #define LTTNG_UST_INTEGER_TYPE_PADDING 24
135 struct lttng_integer_type {
136 unsigned int size; /* in bits */
137 unsigned short alignment; /* in bits */
138 unsigned int signedness:1;
139 unsigned int reverse_byte_order:1;
140 unsigned int base; /* 2, 8, 10, 16, for pretty print */
141 enum lttng_string_encodings encoding;
142 char padding[LTTNG_UST_INTEGER_TYPE_PADDING];
143 };
144
145 /*
146 * Only float and double are supported. long double is not supported at
147 * the moment.
148 */
149 #define _float_mant_dig(_type) \
150 (sizeof(_type) == sizeof(float) ? FLT_MANT_DIG \
151 : (sizeof(_type) == sizeof(double) ? DBL_MANT_DIG \
152 : 0))
153
154 #define __type_float(_type) \
155 { \
156 .atype = atype_float, \
157 .u = \
158 { \
159 ._float = \
160 { \
161 .exp_dig = sizeof(_type) * CHAR_BIT \
162 - _float_mant_dig(_type), \
163 .mant_dig = _float_mant_dig(_type), \
164 .alignment = lttng_alignof(_type) * CHAR_BIT, \
165 .reverse_byte_order = BYTE_ORDER != FLOAT_WORD_ORDER, \
166 } \
167 } \
168 } \
169
170 #define LTTNG_UST_FLOAT_TYPE_PADDING 24
171 struct lttng_float_type {
172 unsigned int exp_dig; /* exponent digits, in bits */
173 unsigned int mant_dig; /* mantissa digits, in bits */
174 unsigned short alignment; /* in bits */
175 unsigned int reverse_byte_order:1;
176 char padding[LTTNG_UST_FLOAT_TYPE_PADDING];
177 };
178
179 /* legacy */
180 #define LTTNG_UST_BASIC_TYPE_PADDING 128
181 union _lttng_basic_type {
182 struct lttng_integer_type integer; /* legacy */
183 struct {
184 const struct lttng_enum_desc *desc; /* Enumeration mapping */
185 struct lttng_integer_type container_type;
186 } enumeration; /* legacy */
187 struct {
188 enum lttng_string_encodings encoding;
189 } string; /* legacy */
190 struct lttng_float_type _float; /* legacy */
191 char padding[LTTNG_UST_BASIC_TYPE_PADDING];
192 };
193
194 /* legacy */
195 struct lttng_basic_type {
196 enum lttng_abstract_types atype;
197 union {
198 union _lttng_basic_type basic;
199 } u;
200 };
201
202 #define LTTNG_UST_TYPE_PADDING 128
203 struct lttng_type {
204 enum lttng_abstract_types atype;
205 union {
206 /* provider ABI 2.0 */
207 struct lttng_integer_type integer;
208 struct lttng_float_type _float;
209 struct {
210 enum lttng_string_encodings encoding;
211 } string;
212 struct {
213 const struct lttng_enum_desc *desc; /* Enumeration mapping */
214 struct lttng_type *container_type;
215 } enum_nestable;
216 struct {
217 const struct lttng_type *elem_type;
218 unsigned int length; /* Num. elems. */
219 unsigned int alignment;
220 } array_nestable;
221 struct {
222 const char *length_name; /* Length field name. */
223 const struct lttng_type *elem_type;
224 unsigned int alignment; /* Alignment before elements. */
225 } sequence_nestable;
226 struct {
227 unsigned int nr_fields;
228 const struct lttng_event_field *fields; /* Array of fields. */
229 unsigned int alignment;
230 } struct_nestable;
231
232 union {
233 /* legacy provider ABI 1.0 */
234 union _lttng_basic_type basic; /* legacy */
235 struct {
236 struct lttng_basic_type elem_type;
237 unsigned int length; /* Num. elems. */
238 } array; /* legacy */
239 struct {
240 struct lttng_basic_type length_type;
241 struct lttng_basic_type elem_type;
242 } sequence; /* legacy */
243 struct {
244 unsigned int nr_fields;
245 struct lttng_event_field *fields; /* Array of fields. */
246 } _struct; /* legacy */
247 } legacy;
248 char padding[LTTNG_UST_TYPE_PADDING];
249 } u;
250 };
251
252 #define LTTNG_UST_ENUM_TYPE_PADDING 24
253 struct lttng_enum_desc {
254 const char *name;
255 const struct lttng_enum_entry *entries;
256 unsigned int nr_entries;
257 char padding[LTTNG_UST_ENUM_TYPE_PADDING];
258 };
259
260 /*
261 * Event field description
262 *
263 * IMPORTANT: this structure is part of the ABI between the probe and
264 * UST. Fields need to be only added at the end, never reordered, never
265 * removed.
266 */
267
268 #define LTTNG_UST_EVENT_FIELD_PADDING 28
269 struct lttng_event_field {
270 const char *name;
271 struct lttng_type type;
272 unsigned int nowrite; /* do not write into trace */
273 union {
274 struct {
275 unsigned int nofilter:1; /* do not consider for filter */
276 } ext;
277 char padding[LTTNG_UST_EVENT_FIELD_PADDING];
278 } u;
279 };
280
281 enum lttng_ust_dynamic_type {
282 LTTNG_UST_DYNAMIC_TYPE_NONE,
283 LTTNG_UST_DYNAMIC_TYPE_S8,
284 LTTNG_UST_DYNAMIC_TYPE_S16,
285 LTTNG_UST_DYNAMIC_TYPE_S32,
286 LTTNG_UST_DYNAMIC_TYPE_S64,
287 LTTNG_UST_DYNAMIC_TYPE_U8,
288 LTTNG_UST_DYNAMIC_TYPE_U16,
289 LTTNG_UST_DYNAMIC_TYPE_U32,
290 LTTNG_UST_DYNAMIC_TYPE_U64,
291 LTTNG_UST_DYNAMIC_TYPE_FLOAT,
292 LTTNG_UST_DYNAMIC_TYPE_DOUBLE,
293 LTTNG_UST_DYNAMIC_TYPE_STRING,
294 _NR_LTTNG_UST_DYNAMIC_TYPES,
295 };
296
297 struct lttng_ctx_value {
298 enum lttng_ust_dynamic_type sel;
299 union {
300 int64_t s64;
301 uint64_t u64;
302 const char *str;
303 double d;
304 } u;
305 };
306
307 struct lttng_perf_counter_field;
308
309 #define LTTNG_UST_CTX_FIELD_PADDING 40
310 struct lttng_ctx_field {
311 struct lttng_event_field event_field;
312 size_t (*get_size)(struct lttng_ctx_field *field, size_t offset);
313 void (*record)(struct lttng_ctx_field *field,
314 struct lttng_ust_lib_ring_buffer_ctx *ctx,
315 struct lttng_channel *chan);
316 void (*get_value)(struct lttng_ctx_field *field,
317 struct lttng_ctx_value *value);
318 union {
319 struct lttng_perf_counter_field *perf_counter;
320 char padding[LTTNG_UST_CTX_FIELD_PADDING];
321 } u;
322 void (*destroy)(struct lttng_ctx_field *field);
323 char *field_name; /* Has ownership, dynamically allocated. */
324 };
325
326 #define LTTNG_UST_CTX_PADDING 20
327 struct lttng_ctx {
328 struct lttng_ctx_field *fields;
329 unsigned int nr_fields;
330 unsigned int allocated_fields;
331 unsigned int largest_align;
332 char padding[LTTNG_UST_CTX_PADDING];
333 };
334
335 #define LTTNG_UST_EVENT_DESC_PADDING 40
336 struct lttng_event_desc {
337 const char *name;
338 void (*probe_callback)(void);
339 const struct lttng_event_ctx *ctx; /* context */
340 const struct lttng_event_field *fields; /* event payload */
341 unsigned int nr_fields;
342 const int **loglevel;
343 const char *signature; /* Argument types/names received */
344 union {
345 struct {
346 const char **model_emf_uri;
347 void (*event_notifier_callback)(void);
348 } ext;
349 char padding[LTTNG_UST_EVENT_DESC_PADDING];
350 } u;
351 };
352
353 #define LTTNG_UST_PROBE_DESC_PADDING 12
354 struct lttng_probe_desc {
355 const char *provider;
356 const struct lttng_event_desc **event_desc;
357 unsigned int nr_events;
358 struct cds_list_head head; /* chain registered probes */
359 struct cds_list_head lazy_init_head;
360 int lazy; /* lazy registration */
361 uint32_t major;
362 uint32_t minor;
363 char padding[LTTNG_UST_PROBE_DESC_PADDING];
364 };
365
366 /* Data structures used by the tracer. */
367
368 enum lttng_enabler_format_type {
369 LTTNG_ENABLER_FORMAT_STAR_GLOB,
370 LTTNG_ENABLER_FORMAT_EVENT,
371 };
372
373 /*
374 * Enabler field, within whatever object is enabling an event. Target of
375 * backward reference.
376 */
377 struct lttng_enabler {
378 enum lttng_enabler_format_type format_type;
379
380 /* head list of struct lttng_ust_filter_bytecode_node */
381 struct cds_list_head filter_bytecode_head;
382 /* head list of struct lttng_ust_excluder_node */
383 struct cds_list_head excluder_head;
384
385 struct lttng_ust_event event_param;
386 unsigned int enabled:1;
387 };
388
389 struct tp_list_entry {
390 struct lttng_ust_tracepoint_iter tp;
391 struct cds_list_head head;
392 };
393
394 struct lttng_ust_tracepoint_list {
395 struct tp_list_entry *iter;
396 struct cds_list_head head;
397 };
398
399 struct tp_field_list_entry {
400 struct lttng_ust_field_iter field;
401 struct cds_list_head head;
402 };
403
404 struct lttng_ust_field_list {
405 struct tp_field_list_entry *iter;
406 struct cds_list_head head;
407 };
408
409 struct ust_pending_probe;
410 struct lttng_event;
411
412 /*
413 * Bytecode interpreter return value masks.
414 */
415 enum lttng_bytecode_interpreter_ret {
416 LTTNG_INTERPRETER_DISCARD = 0,
417 LTTNG_INTERPRETER_RECORD_FLAG = (1ULL << 0),
418 /* Other bits are kept for future use. */
419 };
420
421 struct lttng_interpreter_output;
422
423 /*
424 * This structure is used in the probes. More specifically, the `filter` and
425 * `node` fields are explicity used in the probes. When modifying this
426 * structure we must not change the layout of these two fields as it is
427 * considered ABI.
428 */
429 struct lttng_bytecode_runtime {
430 /* Associated bytecode */
431 struct lttng_ust_bytecode_node *bc;
432 union {
433 uint64_t (*filter)(void *interpreter_data,
434 const char *interpreter_stack_data);
435 uint64_t (*capture)(void *interpreter_data,
436 const char *interpreter_stack_data,
437 struct lttng_interpreter_output *interpreter_output);
438 } interpreter_funcs;
439 int link_failed;
440 struct cds_list_head node; /* list of bytecode runtime in event */
441 /*
442 * Pointer to a URCU-protected pointer owned by an `struct
443 * lttng_session`or `struct lttng_event_notifier_group`.
444 */
445 struct lttng_ctx **pctx;
446 };
447
448 /*
449 * Objects in a linked-list of enablers, owned by an event or event_notifier.
450 * This is used because an event (or a event_notifier) can be enabled by more
451 * than one enabler and we want a quick way to iterate over all enablers of an
452 * object.
453 *
454 * For example, event rules "my_app:a*" and "my_app:ab*" will both match the
455 * event with the name "my_app:abc".
456 */
457 struct lttng_enabler_ref {
458 struct cds_list_head node; /* enabler ref list */
459 struct lttng_enabler *ref; /* backward ref */
460 };
461
462 /*
463 * lttng_event structure is referred to by the tracing fast path. It
464 * must be kept small.
465 *
466 * IMPORTANT: this structure is part of the ABI between the probe and
467 * UST. Fields need to be only added at the end, never reordered, never
468 * removed.
469 */
470 struct lttng_event {
471 unsigned int id;
472 struct lttng_channel *chan;
473 int enabled;
474 const struct lttng_event_desc *desc;
475 struct lttng_ctx *ctx;
476 enum lttng_ust_instrumentation instrumentation;
477 struct cds_list_head node; /* Event list in session */
478
479 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
480 struct cds_list_head filter_bytecode_runtime_head;
481 int has_enablers_without_bytecode;
482 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
483 struct cds_list_head enablers_ref_head;
484 struct cds_hlist_node hlist; /* session ht of events */
485 int registered; /* has reg'd tracepoint probe */
486 };
487
488 struct lttng_event_notifier {
489 uint64_t user_token;
490 uint64_t error_counter_index;
491 int enabled;
492 int registered; /* has reg'd tracepoint probe */
493 size_t num_captures; /* Needed to allocate the msgpack array. */
494 void (*notification_send)(struct lttng_event_notifier *event_notifier,
495 const char *stack_data);
496 struct cds_list_head filter_bytecode_runtime_head;
497 struct cds_list_head capture_bytecode_runtime_head;
498 int has_enablers_without_bytecode;
499 struct cds_list_head enablers_ref_head;
500 const struct lttng_event_desc *desc;
501 struct cds_hlist_node hlist; /* hashtable of event_notifiers */
502 struct cds_list_head node; /* event_notifier list in session */
503 struct lttng_event_notifier_group *group; /* weak ref */
504 };
505
506 struct lttng_enum {
507 const struct lttng_enum_desc *desc;
508 struct lttng_session *session;
509 struct cds_list_head node; /* Enum list in session */
510 struct cds_hlist_node hlist; /* Session ht of enums */
511 uint64_t id; /* Enumeration ID in sessiond */
512 };
513
514 struct channel;
515 struct lttng_ust_shm_handle;
516
517 /*
518 * IMPORTANT: this structure is part of the ABI between the probe and
519 * UST. Fields need to be only added at the end, never reordered, never
520 * removed.
521 */
522 struct lttng_channel_ops {
523 struct lttng_channel *(*channel_create)(const char *name,
524 void *buf_addr,
525 size_t subbuf_size, size_t num_subbuf,
526 unsigned int switch_timer_interval,
527 unsigned int read_timer_interval,
528 unsigned char *uuid,
529 uint32_t chan_id,
530 const int *stream_fds, int nr_stream_fds,
531 int64_t blocking_timeout);
532 void (*channel_destroy)(struct lttng_channel *chan);
533 int (*event_reserve)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
534 uint32_t event_id);
535 void (*event_commit)(struct lttng_ust_lib_ring_buffer_ctx *ctx);
536 void (*event_write)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
537 const void *src, size_t len);
538 /*
539 * packet_avail_size returns the available size in the current
540 * packet. Note that the size returned is only a hint, since it
541 * may change due to concurrent writes.
542 */
543 size_t (*packet_avail_size)(struct channel *chan,
544 struct lttng_ust_shm_handle *handle);
545 int (*is_finalized)(struct channel *chan);
546 int (*is_disabled)(struct channel *chan);
547 int (*flush_buffer)(struct channel *chan, struct lttng_ust_shm_handle *handle);
548 void (*event_strcpy)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
549 const char *src, size_t len);
550 };
551
552 /*
553 * IMPORTANT: this structure is part of the ABI between the probe and
554 * UST. Fields need to be only added at the end, never reordered, never
555 * removed.
556 */
557 struct lttng_channel {
558 /*
559 * The pointers located in this private data are NOT safe to be
560 * dereferenced by the consumer. The only operations the
561 * consumer process is designed to be allowed to do is to read
562 * and perform subbuffer flush.
563 */
564 struct channel *chan; /* Channel buffers */
565 int enabled;
566 struct lttng_ctx *ctx;
567 /* Event ID management */
568 struct lttng_session *session;
569 int objd; /* Object associated to channel */
570 struct cds_list_head node; /* Channel list in session */
571 const struct lttng_channel_ops *ops;
572 int header_type; /* 0: unset, 1: compact, 2: large */
573 struct lttng_ust_shm_handle *handle; /* shared-memory handle */
574
575 /* Channel ID */
576 unsigned int id;
577 enum lttng_ust_chan_type type;
578 unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
579 int tstate:1; /* Transient enable state */
580 };
581
582 #define LTTNG_COUNTER_DIMENSION_MAX 8
583
584 struct lttng_counter_dimension {
585 uint64_t size;
586 uint64_t underflow_index;
587 uint64_t overflow_index;
588 uint8_t has_underflow;
589 uint8_t has_overflow;
590 };
591
592 struct lttng_counter_ops {
593 struct lib_counter *(*counter_create)(size_t nr_dimensions,
594 const struct lttng_counter_dimension *dimensions,
595 int64_t global_sum_step,
596 int global_counter_fd,
597 int nr_counter_cpu_fds,
598 const int *counter_cpu_fds,
599 bool is_daemon);
600 void (*counter_destroy)(struct lib_counter *counter);
601 int (*counter_add)(struct lib_counter *counter,
602 const size_t *dimension_indexes, int64_t v);
603 int (*counter_read)(struct lib_counter *counter,
604 const size_t *dimension_indexes, int cpu,
605 int64_t *value, bool *overflow, bool *underflow);
606 int (*counter_aggregate)(struct lib_counter *counter,
607 const size_t *dimension_indexes, int64_t *value,
608 bool *overflow, bool *underflow);
609 int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes);
610 };
611
612 #define LTTNG_UST_STACK_CTX_PADDING 32
613 struct lttng_stack_ctx {
614 struct lttng_event *event;
615 struct lttng_ctx *chan_ctx; /* RCU dereferenced. */
616 struct lttng_ctx *event_ctx; /* RCU dereferenced. */
617 char padding[LTTNG_UST_STACK_CTX_PADDING];
618 };
619
620 #define LTTNG_UST_EVENT_HT_BITS 12
621 #define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS)
622
623 struct lttng_ust_event_ht {
624 struct cds_hlist_head table[LTTNG_UST_EVENT_HT_SIZE];
625 };
626
627 #define LTTNG_UST_EVENT_NOTIFIER_HT_BITS 12
628 #define LTTNG_UST_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_UST_EVENT_NOTIFIER_HT_BITS)
629 struct lttng_ust_event_notifier_ht {
630 struct cds_hlist_head table[LTTNG_UST_EVENT_NOTIFIER_HT_SIZE];
631 };
632
633 #define LTTNG_UST_ENUM_HT_BITS 12
634 #define LTTNG_UST_ENUM_HT_SIZE (1U << LTTNG_UST_ENUM_HT_BITS)
635
636 struct lttng_ust_enum_ht {
637 struct cds_hlist_head table[LTTNG_UST_ENUM_HT_SIZE];
638 };
639
640 /*
641 * IMPORTANT: this structure is part of the ABI between the probe and
642 * UST. Fields need to be only added at the end, never reordered, never
643 * removed.
644 */
645 struct lttng_session {
646 int active; /* Is trace session active ? */
647 int been_active; /* Been active ? */
648 int objd; /* Object associated */
649 struct cds_list_head chan_head; /* Channel list head */
650 struct cds_list_head events_head; /* list of events */
651 struct cds_list_head node; /* Session list */
652
653 /* New UST 2.1 */
654 /* List of enablers */
655 struct cds_list_head enablers_head;
656 struct lttng_ust_event_ht events_ht; /* ht of events */
657 void *owner; /* object owner */
658 int tstate:1; /* Transient enable state */
659
660 /* New UST 2.4 */
661 int statedump_pending:1;
662
663 /* New UST 2.8 */
664 struct lttng_ust_enum_ht enums_ht; /* ht of enumerations */
665 struct cds_list_head enums_head;
666 struct lttng_ctx *ctx; /* contexts for filters. */
667 };
668
669 struct lttng_counter {
670 int objd;
671 struct lttng_event_notifier_group *event_notifier_group; /* owner */
672 struct lttng_counter_transport *transport;
673 struct lib_counter *counter;
674 struct lttng_counter_ops *ops;
675 };
676
677 struct lttng_event_notifier_group {
678 int objd;
679 void *owner;
680 int notification_fd;
681 struct cds_list_head node; /* Event notifier group handle list */
682 struct cds_list_head enablers_head;
683 struct cds_list_head event_notifiers_head; /* list of event_notifiers */
684 struct lttng_ust_event_notifier_ht event_notifiers_ht; /* hashtable of event_notifiers */
685 struct lttng_ctx *ctx; /* contexts for filters. */
686
687 struct lttng_counter *error_counter;
688 size_t error_counter_len;
689 };
690
691 struct lttng_transport {
692 char *name;
693 struct cds_list_head node;
694 struct lttng_channel_ops ops;
695 const struct lttng_ust_lib_ring_buffer_config *client_config;
696 };
697
698 struct lttng_counter_transport {
699 char *name;
700 struct cds_list_head node;
701 struct lttng_counter_ops ops;
702 const struct lib_counter_config *client_config;
703 };
704
705 struct lttng_session *lttng_session_create(void);
706 int lttng_session_enable(struct lttng_session *session);
707 int lttng_session_disable(struct lttng_session *session);
708 int lttng_session_statedump(struct lttng_session *session);
709 void lttng_session_destroy(struct lttng_session *session);
710
711 struct lttng_channel *lttng_channel_create(struct lttng_session *session,
712 const char *transport_name,
713 void *buf_addr,
714 size_t subbuf_size, size_t num_subbuf,
715 unsigned int switch_timer_interval,
716 unsigned int read_timer_interval,
717 int **shm_fd, int **wait_fd,
718 uint64_t **memory_map_size,
719 struct lttng_channel *chan_priv_init);
720
721 int lttng_channel_enable(struct lttng_channel *channel);
722 int lttng_channel_disable(struct lttng_channel *channel);
723
724 void lttng_transport_register(struct lttng_transport *transport);
725 void lttng_transport_unregister(struct lttng_transport *transport);
726
727 int lttng_probe_register(struct lttng_probe_desc *desc);
728 void lttng_probe_unregister(struct lttng_probe_desc *desc);
729 void lttng_probe_provider_unregister_events(struct lttng_probe_desc *desc);
730 int lttng_fix_pending_events(void);
731 int lttng_probes_init(void);
732 void lttng_probes_exit(void);
733
734 /*
735 * Can be used by applications that change their procname to clear the ust cached value.
736 */
737 void lttng_context_procname_reset(void);
738
739 struct lttng_transport *lttng_transport_find(const char *name);
740
741 int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list);
742 void lttng_probes_prune_event_list(struct lttng_ust_tracepoint_list *list);
743 struct lttng_ust_tracepoint_iter *
744 lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list *list);
745 int lttng_probes_get_field_list(struct lttng_ust_field_list *list);
746 void lttng_probes_prune_field_list(struct lttng_ust_field_list *list);
747 struct lttng_ust_field_iter *
748 lttng_ust_field_list_get_iter_next(struct lttng_ust_field_list *list);
749
750 void lttng_free_event_filter_runtime(struct lttng_event *event);
751
752 struct cds_list_head *lttng_get_probe_list_head(void);
753 int lttng_session_active(void);
754
755 typedef int (*t_statedump_func_ptr)(struct lttng_session *session);
756 void lttng_handle_pending_statedump(void *owner);
757 struct cds_list_head *_lttng_get_sessions(void);
758
759 struct lttng_enum *lttng_ust_enum_get_from_desc(struct lttng_session *session,
760 const struct lttng_enum_desc *enum_desc);
761
762 void lttng_ust_dl_update(void *ip);
763
764 #ifdef __cplusplus
765 }
766 #endif
767
768 #endif /* _LTTNG_UST_EVENTS_H */
This page took 0.043758 seconds and 5 git commands to generate.