Add token to `struct lttng_ust_event`
[lttng-ust.git] / include / lttng / ust-events.h
... / ...
CommitLineData
1#ifndef _LTTNG_UST_EVENTS_H
2#define _LTTNG_UST_EVENTS_H
3
4/*
5 * lttng/ust-events.h
6 *
7 * Copyright 2010-2012 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * Holds LTTng per-session event registry.
10 *
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:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
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
27 * SOFTWARE.
28 */
29
30#include <urcu/list.h>
31#include <urcu/hlist.h>
32#include <stddef.h>
33#include <stdint.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>
38#include <float.h>
39#include <errno.h>
40#include <urcu/ref.h>
41#include <pthread.h>
42
43#ifndef LTTNG_PACKED
44#error "LTTNG_PACKED should be defined"
45#endif
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51#define LTTNG_UST_UUID_LEN 16
52
53/*
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.
58 */
59#define LTTNG_UST_PROVIDER_MAJOR 2
60#define LTTNG_UST_PROVIDER_MINOR 0
61
62struct lttng_channel;
63struct lttng_session;
64struct lttng_ust_lib_ring_buffer_ctx;
65struct lttng_ust_context_app;
66struct lttng_event_field;
67
68/*
69 * Data structures used by tracepoint event declarations, and by the
70 * tracer. Those structures have padding for future extension.
71 */
72
73/*
74 * LTTng client type enumeration. Used by the consumer to map the
75 * callbacks from its own address space.
76 */
77enum 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,
84};
85
86/* Type description */
87
88/* Update the astract_types name table in lttng-types.c along with this enum */
89enum lttng_abstract_types {
90 atype_integer,
91 atype_enum, /* legacy */
92 atype_array, /* legacy */
93 atype_sequence, /* legacy */
94 atype_string,
95 atype_float,
96 atype_dynamic,
97 atype_struct, /* legacy */
98 atype_enum_nestable,
99 atype_array_nestable,
100 atype_sequence_nestable,
101 atype_struct_nestable,
102 NR_ABSTRACT_TYPES,
103};
104
105/* Update the string_encodings name table in lttng-types.c along with this enum */
106enum lttng_string_encodings {
107 lttng_encode_none = 0,
108 lttng_encode_UTF8 = 1,
109 lttng_encode_ASCII = 2,
110 NR_STRING_ENCODINGS,
111};
112
113struct lttng_enum_value {
114 unsigned long long value;
115 unsigned int signedness:1;
116};
117
118enum lttng_enum_entry_options {
119 LTTNG_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0,
120};
121
122#define LTTNG_UST_ENUM_ENTRY_PADDING 16
123struct lttng_enum_entry {
124 struct lttng_enum_value start, end; /* start and end are inclusive */
125 const char *string;
126 union {
127 struct {
128 unsigned int options;
129 } LTTNG_PACKED extra;
130 char padding[LTTNG_UST_ENUM_ENTRY_PADDING];
131 } u;
132};
133
134#define __type_integer(_type, _byte_order, _base, _encoding) \
135 { \
136 .atype = atype_integer, \
137 .u = \
138 { \
139 .integer = \
140 { \
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, \
145 .base = _base, \
146 .encoding = lttng_encode_##_encoding, \
147 } \
148 }, \
149 } \
150
151#define LTTNG_UST_INTEGER_TYPE_PADDING 24
152struct 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];
160};
161
162/*
163 * Only float and double are supported. long double is not supported at
164 * the moment.
165 */
166#define _float_mant_dig(_type) \
167 (sizeof(_type) == sizeof(float) ? FLT_MANT_DIG \
168 : (sizeof(_type) == sizeof(double) ? DBL_MANT_DIG \
169 : 0))
170
171#define __type_float(_type) \
172 { \
173 .atype = atype_float, \
174 .u = \
175 { \
176 ._float = \
177 { \
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, \
183 } \
184 } \
185 } \
186
187#define LTTNG_UST_FLOAT_TYPE_PADDING 24
188struct 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];
194};
195
196/* legacy */
197#define LTTNG_UST_BASIC_TYPE_PADDING 128
198union _lttng_basic_type {
199 struct lttng_integer_type integer; /* legacy */
200 struct {
201 const struct lttng_enum_desc *desc; /* Enumeration mapping */
202 struct lttng_integer_type container_type;
203 } enumeration; /* legacy */
204 struct {
205 enum lttng_string_encodings encoding;
206 } string; /* legacy */
207 struct lttng_float_type _float; /* legacy */
208 char padding[LTTNG_UST_BASIC_TYPE_PADDING];
209};
210
211/* legacy */
212struct lttng_basic_type {
213 enum lttng_abstract_types atype;
214 union {
215 union _lttng_basic_type basic;
216 } u;
217};
218
219#define LTTNG_UST_TYPE_PADDING 128
220struct lttng_type {
221 enum lttng_abstract_types atype;
222 union {
223 /* provider ABI 2.0 */
224 struct lttng_integer_type integer;
225 struct lttng_float_type _float;
226 struct {
227 enum lttng_string_encodings encoding;
228 } string;
229 struct {
230 const struct lttng_enum_desc *desc; /* Enumeration mapping */
231 struct lttng_type *container_type;
232 } enum_nestable;
233 struct {
234 const struct lttng_type *elem_type;
235 unsigned int length; /* Num. elems. */
236 unsigned int alignment;
237 } array_nestable;
238 struct {
239 const char *length_name; /* Length field name. */
240 const struct lttng_type *elem_type;
241 unsigned int alignment; /* Alignment before elements. */
242 } sequence_nestable;
243 struct {
244 unsigned int nr_fields;
245 const struct lttng_event_field *fields; /* Array of fields. */
246 unsigned int alignment;
247 } struct_nestable;
248
249 union {
250 /* legacy provider ABI 1.0 */
251 union _lttng_basic_type basic; /* legacy */
252 struct {
253 struct lttng_basic_type elem_type;
254 unsigned int length; /* Num. elems. */
255 } array; /* legacy */
256 struct {
257 struct lttng_basic_type length_type;
258 struct lttng_basic_type elem_type;
259 } sequence; /* legacy */
260 struct {
261 unsigned int nr_fields;
262 struct lttng_event_field *fields; /* Array of fields. */
263 } _struct; /* legacy */
264 } legacy;
265 char padding[LTTNG_UST_TYPE_PADDING];
266 } u;
267};
268
269#define LTTNG_UST_ENUM_TYPE_PADDING 24
270struct lttng_enum_desc {
271 const char *name;
272 const struct lttng_enum_entry *entries;
273 unsigned int nr_entries;
274 char padding[LTTNG_UST_ENUM_TYPE_PADDING];
275};
276
277/*
278 * Event field description
279 *
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
282 * removed.
283 */
284
285#define LTTNG_UST_EVENT_FIELD_PADDING 28
286struct lttng_event_field {
287 const char *name;
288 struct lttng_type type;
289 unsigned int nowrite; /* do not write into trace */
290 union {
291 struct {
292 unsigned int nofilter:1; /* do not consider for filter */
293 } ext;
294 char padding[LTTNG_UST_EVENT_FIELD_PADDING];
295 } u;
296};
297
298enum 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,
312};
313
314struct lttng_ctx_value {
315 enum lttng_ust_dynamic_type sel;
316 union {
317 int64_t s64;
318 const char *str;
319 double d;
320 } u;
321};
322
323struct lttng_perf_counter_field;
324
325#define LTTNG_UST_CTX_FIELD_PADDING 40
326struct lttng_ctx_field {
327 struct lttng_event_field event_field;
328 size_t (*get_size)(struct lttng_ctx_field *field, size_t offset);
329 void (*record)(struct lttng_ctx_field *field,
330 struct lttng_ust_lib_ring_buffer_ctx *ctx,
331 struct lttng_channel *chan);
332 void (*get_value)(struct lttng_ctx_field *field,
333 struct lttng_ctx_value *value);
334 union {
335 struct lttng_perf_counter_field *perf_counter;
336 char padding[LTTNG_UST_CTX_FIELD_PADDING];
337 } u;
338 void (*destroy)(struct lttng_ctx_field *field);
339 char *field_name; /* Has ownership, dynamically allocated. */
340};
341
342#define LTTNG_UST_CTX_PADDING 20
343struct lttng_ctx {
344 struct lttng_ctx_field *fields;
345 unsigned int nr_fields;
346 unsigned int allocated_fields;
347 unsigned int largest_align;
348 char padding[LTTNG_UST_CTX_PADDING];
349};
350
351#define LTTNG_UST_EVENT_DESC_PADDING 40
352struct lttng_event_desc {
353 const char *name;
354 void (*probe_callback)(void);
355 const struct lttng_event_ctx *ctx; /* context */
356 const struct lttng_event_field *fields; /* event payload */
357 unsigned int nr_fields;
358 const int **loglevel;
359 const char *signature; /* Argument types/names received */
360 union {
361 struct {
362 const char **model_emf_uri;
363 } ext;
364 char padding[LTTNG_UST_EVENT_DESC_PADDING];
365 } u;
366};
367
368#define LTTNG_UST_PROBE_DESC_PADDING 12
369struct lttng_probe_desc {
370 const char *provider;
371 const struct lttng_event_desc **event_desc;
372 unsigned int nr_events;
373 struct cds_list_head head; /* chain registered probes */
374 struct cds_list_head lazy_init_head;
375 int lazy; /* lazy registration */
376 uint32_t major;
377 uint32_t minor;
378 char padding[LTTNG_UST_PROBE_DESC_PADDING];
379};
380
381/* Data structures used by the tracer. */
382
383enum lttng_enabler_format_type {
384 LTTNG_ENABLER_FORMAT_STAR_GLOB,
385 LTTNG_ENABLER_FORMAT_EVENT,
386};
387
388/*
389 * Enabler field, within whatever object is enabling an event. Target of
390 * backward reference.
391 */
392struct lttng_enabler {
393 enum lttng_enabler_format_type format_type;
394
395 /* head list of struct lttng_ust_filter_bytecode_node */
396 struct cds_list_head filter_bytecode_head;
397 /* head list of struct lttng_ust_excluder_node */
398 struct cds_list_head excluder_head;
399
400 struct lttng_ust_event event_param;
401 unsigned int enabled:1;
402};
403
404struct tp_list_entry {
405 struct lttng_ust_tracepoint_iter tp;
406 struct cds_list_head head;
407};
408
409struct lttng_ust_tracepoint_list {
410 struct tp_list_entry *iter;
411 struct cds_list_head head;
412};
413
414struct tp_field_list_entry {
415 struct lttng_ust_field_iter field;
416 struct cds_list_head head;
417};
418
419struct lttng_ust_field_list {
420 struct tp_field_list_entry *iter;
421 struct cds_list_head head;
422};
423
424struct ust_pending_probe;
425struct lttng_event;
426
427/*
428 * Filter return value masks.
429 */
430enum lttng_filter_ret {
431 LTTNG_FILTER_DISCARD = 0,
432 LTTNG_FILTER_RECORD_FLAG = (1ULL << 0),
433 /* Other bits are kept for future use. */
434};
435
436/*
437 * This structure is used in the probes. More specifically, the `filter` and
438 * `node` fields are explicity used in the probes. When modifying this
439 * structure we must not change the layout of these two fields as it is
440 * considered ABI.
441 */
442struct lttng_bytecode_runtime {
443 /* Associated bytecode */
444 struct lttng_ust_filter_bytecode_node *bc;
445 uint64_t (*filter)(void *filter_data, const char *filter_stack_data);
446 int link_failed;
447 struct cds_list_head node; /* list of bytecode runtime in event */
448 /*
449 * Pointer to a `struct lttng_session`-owned and URCU-protected
450 * pointer.
451 */
452 struct lttng_ctx **pctx;
453};
454
455/*
456 * Objects in a linked-list of enablers, owned by an event.
457 */
458struct lttng_enabler_ref {
459 struct cds_list_head node; /* enabler ref list */
460 struct lttng_enabler *ref; /* backward ref */
461};
462
463/*
464 * lttng_event structure is referred to by the tracing fast path. It
465 * must be kept small.
466 *
467 * IMPORTANT: this structure is part of the ABI between the probe and
468 * UST. Fields need to be only added at the end, never reordered, never
469 * removed.
470 */
471struct lttng_event {
472 /* LTTng-UST 2.0 starts here */
473 unsigned int id;
474 struct lttng_channel *chan;
475 int enabled;
476 const struct lttng_event_desc *desc;
477 void *_deprecated1;
478 struct lttng_ctx *ctx;
479 enum lttng_ust_instrumentation instrumentation;
480 struct cds_list_head node; /* Event list in session */
481 struct cds_list_head _deprecated2;
482 void *_deprecated3;
483 unsigned int _deprecated4:1;
484
485 /* LTTng-UST 2.1 starts here */
486 /* list of struct lttng_bytecode_runtime, sorted by seqnum */
487 struct cds_list_head bytecode_runtime_head;
488 int has_enablers_without_bytecode;
489 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
490 struct cds_list_head enablers_ref_head;
491 struct cds_hlist_node hlist; /* session ht of events */
492 int registered; /* has reg'd tracepoint probe */
493};
494
495struct lttng_enum {
496 const struct lttng_enum_desc *desc;
497 struct lttng_session *session;
498 struct cds_list_head node; /* Enum list in session */
499 struct cds_hlist_node hlist; /* Session ht of enums */
500 uint64_t id; /* Enumeration ID in sessiond */
501};
502
503struct channel;
504struct lttng_ust_shm_handle;
505
506/*
507 * IMPORTANT: this structure is part of the ABI between the probe and
508 * UST. Fields need to be only added at the end, never reordered, never
509 * removed.
510 */
511struct lttng_channel_ops {
512 struct lttng_channel *(*channel_create)(const char *name,
513 void *buf_addr,
514 size_t subbuf_size, size_t num_subbuf,
515 unsigned int switch_timer_interval,
516 unsigned int read_timer_interval,
517 unsigned char *uuid,
518 uint32_t chan_id,
519 const int *stream_fds, int nr_stream_fds,
520 int64_t blocking_timeout);
521 void (*channel_destroy)(struct lttng_channel *chan);
522 union {
523 void *_deprecated1;
524 /*
525 * has_strcpy is needed by probe providers version 1.0 to
526 * dynamically detect whether the LTTng-UST tracepoint
527 * provider ABI implements event_strcpy. Starting from
528 * probe providers version 2.0, the check is not needed,
529 * but backward compatibility is provided for older versions.
530 */
531 unsigned long has_strcpy:1; /* ABI has strcpy */
532 } u;
533 void *_deprecated2;
534 int (*event_reserve)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
535 uint32_t event_id);
536 void (*event_commit)(struct lttng_ust_lib_ring_buffer_ctx *ctx);
537 void (*event_write)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
538 const void *src, size_t len);
539 /*
540 * packet_avail_size returns the available size in the current
541 * packet. Note that the size returned is only a hint, since it
542 * may change due to concurrent writes.
543 */
544 size_t (*packet_avail_size)(struct channel *chan,
545 struct lttng_ust_shm_handle *handle);
546 //wait_queue_head_t *(*get_reader_wait_queue)(struct channel *chan);
547 //wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan);
548 int (*is_finalized)(struct channel *chan);
549 int (*is_disabled)(struct channel *chan);
550 int (*flush_buffer)(struct channel *chan, struct lttng_ust_shm_handle *handle);
551 void (*event_strcpy)(struct lttng_ust_lib_ring_buffer_ctx *ctx,
552 const char *src, size_t len);
553};
554
555/*
556 * IMPORTANT: this structure is part of the ABI between the probe and
557 * UST. Fields need to be only added at the end, never reordered, never
558 * removed.
559 */
560struct lttng_channel {
561 /*
562 * The pointers located in this private data are NOT safe to be
563 * dereferenced by the consumer. The only operations the
564 * consumer process is designed to be allowed to do is to read
565 * and perform subbuffer flush.
566 */
567 struct channel *chan; /* Channel buffers */
568 int enabled;
569 struct lttng_ctx *ctx;
570 /* Event ID management */
571 struct lttng_session *session;
572 int objd; /* Object associated to channel */
573 unsigned int _deprecated1;
574 unsigned int _deprecated2;
575 struct cds_list_head node; /* Channel list in session */
576 const struct lttng_channel_ops *ops;
577 int header_type; /* 0: unset, 1: compact, 2: large */
578 struct lttng_ust_shm_handle *handle; /* shared-memory handle */
579 unsigned int _deprecated3:1;
580
581 /* Channel ID */
582 unsigned int id;
583 enum lttng_ust_chan_type type;
584 unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */
585 int tstate:1; /* Transient enable state */
586};
587
588#define LTTNG_UST_STACK_CTX_PADDING 32
589struct lttng_stack_ctx {
590 struct lttng_event *event;
591 struct lttng_ctx *chan_ctx; /* RCU dereferenced. */
592 struct lttng_ctx *event_ctx; /* RCU dereferenced. */
593 char padding[LTTNG_UST_STACK_CTX_PADDING];
594};
595
596#define LTTNG_UST_EVENT_HT_BITS 12
597#define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS)
598
599struct lttng_ust_event_ht {
600 struct cds_hlist_head table[LTTNG_UST_EVENT_HT_SIZE];
601};
602
603#define LTTNG_UST_ENUM_HT_BITS 12
604#define LTTNG_UST_ENUM_HT_SIZE (1U << LTTNG_UST_ENUM_HT_BITS)
605
606struct lttng_ust_enum_ht {
607 struct cds_hlist_head table[LTTNG_UST_ENUM_HT_SIZE];
608};
609
610/*
611 * IMPORTANT: this structure is part of the ABI between the probe and
612 * UST. Fields need to be only added at the end, never reordered, never
613 * removed.
614 */
615struct lttng_session {
616 int active; /* Is trace session active ? */
617 int been_active; /* Been active ? */
618 int objd; /* Object associated */
619 void *_deprecated1;
620 struct cds_list_head chan_head; /* Channel list head */
621 struct cds_list_head events_head; /* list of events */
622 struct cds_list_head _deprecated2;
623 struct cds_list_head node; /* Session list */
624 int _deprecated3;
625 unsigned int _deprecated4:1;
626
627 /* New UST 2.1 */
628 /* List of enablers */
629 struct cds_list_head enablers_head;
630 struct lttng_ust_event_ht events_ht; /* ht of events */
631 void *owner; /* object owner */
632 int tstate:1; /* Transient enable state */
633
634 /* New UST 2.4 */
635 int statedump_pending:1;
636
637 /* New UST 2.8 */
638 struct lttng_ust_enum_ht enums_ht; /* ht of enumerations */
639 struct cds_list_head enums_head;
640 struct lttng_ctx *ctx; /* contexts for filters. */
641};
642
643struct lttng_transport {
644 char *name;
645 struct cds_list_head node;
646 struct lttng_channel_ops ops;
647 const struct lttng_ust_lib_ring_buffer_config *client_config;
648};
649
650struct lttng_session *lttng_session_create(void);
651int lttng_session_enable(struct lttng_session *session);
652int lttng_session_disable(struct lttng_session *session);
653int lttng_session_statedump(struct lttng_session *session);
654void lttng_session_destroy(struct lttng_session *session);
655
656struct lttng_channel *lttng_channel_create(struct lttng_session *session,
657 const char *transport_name,
658 void *buf_addr,
659 size_t subbuf_size, size_t num_subbuf,
660 unsigned int switch_timer_interval,
661 unsigned int read_timer_interval,
662 int **shm_fd, int **wait_fd,
663 uint64_t **memory_map_size,
664 struct lttng_channel *chan_priv_init);
665
666int lttng_channel_enable(struct lttng_channel *channel);
667int lttng_channel_disable(struct lttng_channel *channel);
668
669int lttng_attach_context(struct lttng_ust_context *context_param,
670 union ust_args *uargs,
671 struct lttng_ctx **ctx, struct lttng_session *session);
672int lttng_session_context_init(struct lttng_ctx **ctx);
673
674void lttng_transport_register(struct lttng_transport *transport);
675void lttng_transport_unregister(struct lttng_transport *transport);
676
677void synchronize_trace(void);
678
679int lttng_probe_register(struct lttng_probe_desc *desc);
680void lttng_probe_unregister(struct lttng_probe_desc *desc);
681void lttng_probe_provider_unregister_events(struct lttng_probe_desc *desc);
682int lttng_fix_pending_events(void);
683int lttng_probes_init(void);
684void lttng_probes_exit(void);
685int lttng_find_context(struct lttng_ctx *ctx, const char *name);
686int lttng_get_context_index(struct lttng_ctx *ctx, const char *name);
687struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p);
688void lttng_context_update(struct lttng_ctx *ctx);
689void lttng_remove_context_field(struct lttng_ctx **ctx_p,
690 struct lttng_ctx_field *field);
691void lttng_destroy_context(struct lttng_ctx *ctx);
692int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx);
693int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx);
694int lttng_add_pthread_id_to_ctx(struct lttng_ctx **ctx);
695int lttng_add_procname_to_ctx(struct lttng_ctx **ctx);
696int lttng_add_ip_to_ctx(struct lttng_ctx **ctx);
697int lttng_add_cpu_id_to_ctx(struct lttng_ctx **ctx);
698int lttng_add_dyntest_to_ctx(struct lttng_ctx **ctx);
699int lttng_add_cgroup_ns_to_ctx(struct lttng_ctx **ctx);
700int lttng_add_ipc_ns_to_ctx(struct lttng_ctx **ctx);
701int lttng_add_mnt_ns_to_ctx(struct lttng_ctx **ctx);
702int lttng_add_net_ns_to_ctx(struct lttng_ctx **ctx);
703int lttng_add_pid_ns_to_ctx(struct lttng_ctx **ctx);
704int lttng_add_time_ns_to_ctx(struct lttng_ctx **ctx);
705int lttng_add_user_ns_to_ctx(struct lttng_ctx **ctx);
706int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx);
707int lttng_add_vuid_to_ctx(struct lttng_ctx **ctx);
708int lttng_add_veuid_to_ctx(struct lttng_ctx **ctx);
709int lttng_add_vsuid_to_ctx(struct lttng_ctx **ctx);
710int lttng_add_vgid_to_ctx(struct lttng_ctx **ctx);
711int lttng_add_vegid_to_ctx(struct lttng_ctx **ctx);
712int lttng_add_vsgid_to_ctx(struct lttng_ctx **ctx);
713void lttng_context_vtid_reset(void);
714void lttng_context_vpid_reset(void);
715void lttng_context_procname_reset(void);
716void lttng_context_cgroup_ns_reset(void);
717void lttng_context_ipc_ns_reset(void);
718void lttng_context_mnt_ns_reset(void);
719void lttng_context_net_ns_reset(void);
720void lttng_context_pid_ns_reset(void);
721void lttng_context_time_ns_reset(void);
722void lttng_context_user_ns_reset(void);
723void lttng_context_uts_ns_reset(void);
724void lttng_context_vuid_reset(void);
725void lttng_context_veuid_reset(void);
726void lttng_context_vsuid_reset(void);
727void lttng_context_vgid_reset(void);
728void lttng_context_vegid_reset(void);
729void lttng_context_vsgid_reset(void);
730
731#ifdef LTTNG_UST_HAVE_PERF_EVENT
732int lttng_add_perf_counter_to_ctx(uint32_t type,
733 uint64_t config,
734 const char *name,
735 struct lttng_ctx **ctx);
736int lttng_perf_counter_init(void);
737void lttng_perf_counter_exit(void);
738#else /* #ifdef LTTNG_UST_HAVE_PERF_EVENT */
739static inline
740int lttng_add_perf_counter_to_ctx(uint32_t type,
741 uint64_t config,
742 const char *name,
743 struct lttng_ctx **ctx)
744{
745 return -ENOSYS;
746}
747static inline
748int lttng_perf_counter_init(void)
749{
750 return 0;
751}
752static inline
753void lttng_perf_counter_exit(void)
754{
755}
756#endif /* #else #ifdef LTTNG_UST_HAVE_PERF_EVENT */
757
758extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_metadata;
759extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_discard;
760extern const struct lttng_ust_client_lib_ring_buffer_client_cb *lttng_client_callbacks_overwrite;
761
762struct lttng_transport *lttng_transport_find(const char *name);
763
764int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list);
765void lttng_probes_prune_event_list(struct lttng_ust_tracepoint_list *list);
766struct lttng_ust_tracepoint_iter *
767 lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list *list);
768int lttng_probes_get_field_list(struct lttng_ust_field_list *list);
769void lttng_probes_prune_field_list(struct lttng_ust_field_list *list);
770struct lttng_ust_field_iter *
771 lttng_ust_field_list_get_iter_next(struct lttng_ust_field_list *list);
772
773void lttng_free_event_filter_runtime(struct lttng_event *event);
774void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime);
775
776struct cds_list_head *lttng_get_probe_list_head(void);
777int lttng_session_active(void);
778
779typedef int (*t_statedump_func_ptr)(struct lttng_session *session);
780void lttng_handle_pending_statedump(void *owner);
781struct cds_list_head *_lttng_get_sessions(void);
782
783struct lttng_enum *lttng_ust_enum_get_from_desc(struct lttng_session *session,
784 const struct lttng_enum_desc *enum_desc);
785
786void lttng_ust_dl_update(void *ip);
787void lttng_ust_fixup_fd_tracker_tls(void);
788
789/* For backward compatibility. Leave those exported symbols in place. */
790extern struct lttng_ctx *lttng_static_ctx;
791struct lttng_ust_filter_bytecode_node;
792struct lttng_ust_excluder_node;
793void lttng_context_init(void);
794void lttng_context_exit(void);
795void lttng_filter_event_link_bytecode(struct lttng_event *event);
796struct lttng_enabler *lttng_enabler_create(
797 enum lttng_enabler_format_type format_type,
798 struct lttng_ust_event *event_param,
799 struct lttng_channel *chan);
800int lttng_enabler_enable(struct lttng_enabler *enabler);
801int lttng_enabler_disable(struct lttng_enabler *enabler);
802int lttng_enabler_attach_bytecode(struct lttng_enabler *enabler,
803 struct lttng_ust_filter_bytecode_node *bytecode);
804int lttng_enabler_attach_context(struct lttng_enabler *enabler,
805 struct lttng_ust_context *ctx);
806int lttng_enabler_attach_exclusion(struct lttng_enabler *enabler,
807 struct lttng_ust_excluder_node *excluder);
808void lttng_enabler_event_link_bytecode(struct lttng_event *event,
809 struct lttng_enabler *enabler);
810
811#ifdef __cplusplus
812}
813#endif
814
815#endif /* _LTTNG_UST_EVENTS_H */
This page took 0.025071 seconds and 4 git commands to generate.