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