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