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