Commit | Line | Data |
---|---|---|
8020ceb5 | 1 | /* |
c0c0989a | 2 | * SPDX-License-Identifier: MIT |
8020ceb5 | 3 | * |
c0c0989a | 4 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
8020ceb5 MD |
5 | * |
6 | * Holds LTTng per-session event registry. | |
8020ceb5 MD |
7 | */ |
8 | ||
c0c0989a MJ |
9 | #ifndef _LTTNG_UST_EVENTS_H |
10 | #define _LTTNG_UST_EVENTS_H | |
11 | ||
9f3fdbc6 | 12 | #include <urcu/list.h> |
1f18504e | 13 | #include <urcu/hlist.h> |
b4051ad8 | 14 | #include <stddef.h> |
9f3fdbc6 | 15 | #include <stdint.h> |
4318ae1b MD |
16 | #include <lttng/ust-abi.h> |
17 | #include <lttng/ust-tracer.h> | |
2ae57758 | 18 | #include <lttng/ust-endian.h> |
20f1eee7 | 19 | #include <float.h> |
d58d1454 MD |
20 | #include <errno.h> |
21 | #include <urcu/ref.h> | |
22 | #include <pthread.h> | |
8020ceb5 | 23 | |
db56acaf MD |
24 | #ifndef LTTNG_PACKED |
25 | #error "LTTNG_PACKED should be defined" | |
26 | #endif | |
27 | ||
6453d237 MD |
28 | #ifdef __cplusplus |
29 | extern "C" { | |
30 | #endif | |
31 | ||
19d8b1b3 MD |
32 | #define LTTNG_UST_UUID_LEN 16 |
33 | ||
71d31690 MD |
34 | /* |
35 | * Tracepoint provider version. Compatibility based on the major number. | |
36 | * Older tracepoint providers can always register to newer lttng-ust | |
37 | * library, but the opposite is rejected: a newer tracepoint provider is | |
38 | * rejected by an older lttng-ust library. | |
39 | */ | |
04f0b55a | 40 | #define LTTNG_UST_PROVIDER_MAJOR 2 |
71d31690 MD |
41 | #define LTTNG_UST_PROVIDER_MINOR 0 |
42 | ||
7dd08bec MD |
43 | struct lttng_channel; |
44 | struct lttng_session; | |
4cfec15c | 45 | struct lttng_ust_lib_ring_buffer_ctx; |
25cff019 | 46 | struct lttng_ust_event_field; |
ebabbf58 | 47 | struct lttng_event_notifier_group; |
8020ceb5 | 48 | |
37d5e202 MD |
49 | /* |
50 | * Data structures used by tracepoint event declarations, and by the | |
51 | * tracer. Those structures have padding for future extension. | |
52 | */ | |
53 | ||
8020ceb5 MD |
54 | /* Type description */ |
55 | ||
56 | /* Update the astract_types name table in lttng-types.c along with this enum */ | |
7dd08bec | 57 | enum lttng_abstract_types { |
8020ceb5 | 58 | atype_integer, |
8020ceb5 | 59 | atype_string, |
20f1eee7 | 60 | atype_float, |
53569322 | 61 | atype_dynamic, |
218deb69 MD |
62 | atype_enum_nestable, |
63 | atype_array_nestable, | |
64 | atype_sequence_nestable, | |
65 | atype_struct_nestable, | |
8020ceb5 MD |
66 | NR_ABSTRACT_TYPES, |
67 | }; | |
68 | ||
69 | /* Update the string_encodings name table in lttng-types.c along with this enum */ | |
70 | enum lttng_string_encodings { | |
71 | lttng_encode_none = 0, | |
72 | lttng_encode_UTF8 = 1, | |
73 | lttng_encode_ASCII = 2, | |
74 | NR_STRING_ENCODINGS, | |
75 | }; | |
76 | ||
a6f80644 MD |
77 | struct lttng_enum_value { |
78 | unsigned long long value; | |
79 | unsigned int signedness:1; | |
80 | }; | |
81 | ||
3e762260 PP |
82 | enum lttng_enum_entry_options { |
83 | LTTNG_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0, | |
84 | }; | |
85 | ||
891d6b55 MD |
86 | /* |
87 | * Enumeration entry description | |
88 | * | |
89 | * IMPORTANT: this structure is part of the ABI between the probe and | |
90 | * UST. Fields need to be only added at the end, never reordered, never | |
91 | * removed. | |
92 | * | |
93 | * The field @struct_size should be used to determine the size of the | |
94 | * structure. It should be queried before using additional fields added | |
95 | * at the end of the structure. | |
96 | */ | |
97 | ||
98 | struct lttng_ust_enum_entry { | |
99 | uint32_t struct_size; | |
100 | ||
a6f80644 | 101 | struct lttng_enum_value start, end; /* start and end are inclusive */ |
8020ceb5 | 102 | const char *string; |
891d6b55 MD |
103 | unsigned int options; |
104 | ||
105 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
8020ceb5 MD |
106 | }; |
107 | ||
108 | #define __type_integer(_type, _byte_order, _base, _encoding) \ | |
109 | { \ | |
46d52200 ZT |
110 | .atype = atype_integer, \ |
111 | .u = \ | |
8020ceb5 | 112 | { \ |
218deb69 | 113 | .integer = \ |
46d52200 | 114 | { \ |
218deb69 MD |
115 | .size = sizeof(_type) * CHAR_BIT, \ |
116 | .alignment = lttng_alignof(_type) * CHAR_BIT, \ | |
117 | .signedness = lttng_is_signed_type(_type), \ | |
118 | .reverse_byte_order = _byte_order != BYTE_ORDER, \ | |
119 | .base = _base, \ | |
120 | .encoding = lttng_encode_##_encoding, \ | |
46d52200 | 121 | } \ |
8020ceb5 MD |
122 | }, \ |
123 | } \ | |
124 | ||
37d5e202 | 125 | #define LTTNG_UST_INTEGER_TYPE_PADDING 24 |
8020ceb5 MD |
126 | struct lttng_integer_type { |
127 | unsigned int size; /* in bits */ | |
128 | unsigned short alignment; /* in bits */ | |
129 | unsigned int signedness:1; | |
130 | unsigned int reverse_byte_order:1; | |
131 | unsigned int base; /* 2, 8, 10, 16, for pretty print */ | |
132 | enum lttng_string_encodings encoding; | |
37d5e202 | 133 | char padding[LTTNG_UST_INTEGER_TYPE_PADDING]; |
8020ceb5 MD |
134 | }; |
135 | ||
d3ed854b MD |
136 | /* |
137 | * Only float and double are supported. long double is not supported at | |
138 | * the moment. | |
139 | */ | |
20f1eee7 MD |
140 | #define _float_mant_dig(_type) \ |
141 | (sizeof(_type) == sizeof(float) ? FLT_MANT_DIG \ | |
142 | : (sizeof(_type) == sizeof(double) ? DBL_MANT_DIG \ | |
d3ed854b | 143 | : 0)) |
20f1eee7 MD |
144 | |
145 | #define __type_float(_type) \ | |
146 | { \ | |
46d52200 ZT |
147 | .atype = atype_float, \ |
148 | .u = \ | |
20f1eee7 | 149 | { \ |
218deb69 | 150 | ._float = \ |
46d52200 | 151 | { \ |
218deb69 MD |
152 | .exp_dig = sizeof(_type) * CHAR_BIT \ |
153 | - _float_mant_dig(_type), \ | |
154 | .mant_dig = _float_mant_dig(_type), \ | |
155 | .alignment = lttng_alignof(_type) * CHAR_BIT, \ | |
156 | .reverse_byte_order = BYTE_ORDER != FLOAT_WORD_ORDER, \ | |
46d52200 | 157 | } \ |
218deb69 | 158 | } \ |
20f1eee7 MD |
159 | } \ |
160 | ||
37d5e202 | 161 | #define LTTNG_UST_FLOAT_TYPE_PADDING 24 |
20f1eee7 MD |
162 | struct lttng_float_type { |
163 | unsigned int exp_dig; /* exponent digits, in bits */ | |
164 | unsigned int mant_dig; /* mantissa digits, in bits */ | |
165 | unsigned short alignment; /* in bits */ | |
166 | unsigned int reverse_byte_order:1; | |
37d5e202 | 167 | char padding[LTTNG_UST_FLOAT_TYPE_PADDING]; |
20f1eee7 MD |
168 | }; |
169 | ||
37d5e202 | 170 | #define LTTNG_UST_TYPE_PADDING 128 |
8020ceb5 | 171 | struct lttng_type { |
7dd08bec | 172 | enum lttng_abstract_types atype; |
8020ceb5 | 173 | union { |
218deb69 MD |
174 | /* provider ABI 2.0 */ |
175 | struct lttng_integer_type integer; | |
176 | struct lttng_float_type _float; | |
177 | struct { | |
178 | enum lttng_string_encodings encoding; | |
179 | } string; | |
180 | struct { | |
891d6b55 | 181 | const struct lttng_ust_enum_desc *desc; /* Enumeration mapping */ |
218deb69 MD |
182 | struct lttng_type *container_type; |
183 | } enum_nestable; | |
8020ceb5 | 184 | struct { |
218deb69 MD |
185 | const struct lttng_type *elem_type; |
186 | unsigned int length; /* Num. elems. */ | |
187 | unsigned int alignment; | |
188 | } array_nestable; | |
8020ceb5 | 189 | struct { |
218deb69 MD |
190 | const char *length_name; /* Length field name. */ |
191 | const struct lttng_type *elem_type; | |
192 | unsigned int alignment; /* Alignment before elements. */ | |
193 | } sequence_nestable; | |
53569322 | 194 | struct { |
218deb69 | 195 | unsigned int nr_fields; |
25cff019 | 196 | const struct lttng_ust_event_field **fields; /* Array of pointers to fields. */ |
218deb69 MD |
197 | unsigned int alignment; |
198 | } struct_nestable; | |
199 | ||
37d5e202 | 200 | char padding[LTTNG_UST_TYPE_PADDING]; |
8020ceb5 MD |
201 | } u; |
202 | }; | |
203 | ||
891d6b55 MD |
204 | /* |
205 | * Enumeration description | |
206 | * | |
207 | * IMPORTANT: this structure is part of the ABI between the probe and | |
208 | * UST. Fields need to be only added at the end, never reordered, never | |
209 | * removed. | |
210 | * | |
211 | * The field @struct_size should be used to determine the size of the | |
212 | * structure. It should be queried before using additional fields added | |
213 | * at the end of the structure. | |
214 | */ | |
215 | ||
216 | struct lttng_ust_enum_desc { | |
217 | uint32_t struct_size; | |
218 | ||
8020ceb5 | 219 | const char *name; |
891d6b55 | 220 | const struct lttng_ust_enum_entry **entries; |
c785c634 | 221 | unsigned int nr_entries; |
891d6b55 MD |
222 | |
223 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
8020ceb5 MD |
224 | }; |
225 | ||
180901e6 MD |
226 | /* |
227 | * Event field description | |
228 | * | |
229 | * IMPORTANT: this structure is part of the ABI between the probe and | |
230 | * UST. Fields need to be only added at the end, never reordered, never | |
231 | * removed. | |
25cff019 MD |
232 | * |
233 | * The field @struct_size should be used to determine the size of the | |
234 | * structure. It should be queried before using additional fields added | |
235 | * at the end of the structure. | |
180901e6 | 236 | */ |
8020ceb5 | 237 | |
25cff019 MD |
238 | struct lttng_ust_event_field { |
239 | uint32_t struct_size; | |
240 | ||
8020ceb5 MD |
241 | const char *name; |
242 | struct lttng_type type; | |
25cff019 MD |
243 | unsigned int nowrite:1, /* do not write into trace */ |
244 | nofilter:1; /* do not consider for filter */ | |
245 | ||
246 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
8020ceb5 MD |
247 | }; |
248 | ||
53569322 MD |
249 | enum lttng_ust_dynamic_type { |
250 | LTTNG_UST_DYNAMIC_TYPE_NONE, | |
251 | LTTNG_UST_DYNAMIC_TYPE_S8, | |
252 | LTTNG_UST_DYNAMIC_TYPE_S16, | |
253 | LTTNG_UST_DYNAMIC_TYPE_S32, | |
254 | LTTNG_UST_DYNAMIC_TYPE_S64, | |
255 | LTTNG_UST_DYNAMIC_TYPE_U8, | |
256 | LTTNG_UST_DYNAMIC_TYPE_U16, | |
257 | LTTNG_UST_DYNAMIC_TYPE_U32, | |
258 | LTTNG_UST_DYNAMIC_TYPE_U64, | |
259 | LTTNG_UST_DYNAMIC_TYPE_FLOAT, | |
260 | LTTNG_UST_DYNAMIC_TYPE_DOUBLE, | |
261 | LTTNG_UST_DYNAMIC_TYPE_STRING, | |
262 | _NR_LTTNG_UST_DYNAMIC_TYPES, | |
263 | }; | |
264 | ||
265 | struct lttng_ctx_value { | |
266 | enum lttng_ust_dynamic_type sel; | |
267 | union { | |
268 | int64_t s64; | |
86133caf | 269 | uint64_t u64; |
53569322 MD |
270 | const char *str; |
271 | double d; | |
272 | } u; | |
77aa5901 MD |
273 | }; |
274 | ||
d58d1454 MD |
275 | struct lttng_perf_counter_field; |
276 | ||
37d5e202 | 277 | #define LTTNG_UST_CTX_FIELD_PADDING 40 |
8020ceb5 | 278 | struct lttng_ctx_field { |
25cff019 | 279 | struct lttng_ust_event_field event_field; |
53569322 | 280 | size_t (*get_size)(struct lttng_ctx_field *field, size_t offset); |
8020ceb5 | 281 | void (*record)(struct lttng_ctx_field *field, |
4cfec15c | 282 | struct lttng_ust_lib_ring_buffer_ctx *ctx, |
7dd08bec | 283 | struct lttng_channel *chan); |
77aa5901 | 284 | void (*get_value)(struct lttng_ctx_field *field, |
53569322 | 285 | struct lttng_ctx_value *value); |
8020ceb5 | 286 | union { |
d58d1454 | 287 | struct lttng_perf_counter_field *perf_counter; |
37d5e202 | 288 | char padding[LTTNG_UST_CTX_FIELD_PADDING]; |
8020ceb5 MD |
289 | } u; |
290 | void (*destroy)(struct lttng_ctx_field *field); | |
53569322 | 291 | char *field_name; /* Has ownership, dynamically allocated. */ |
8020ceb5 MD |
292 | }; |
293 | ||
b2cc986a | 294 | #define LTTNG_UST_CTX_PADDING 20 |
8020ceb5 MD |
295 | struct lttng_ctx { |
296 | struct lttng_ctx_field *fields; | |
297 | unsigned int nr_fields; | |
298 | unsigned int allocated_fields; | |
b2cc986a | 299 | unsigned int largest_align; |
37d5e202 MD |
300 | char padding[LTTNG_UST_CTX_PADDING]; |
301 | }; | |
302 | ||
dc11f93f MD |
303 | /* |
304 | * IMPORTANT: this structure is part of the ABI between the probe and | |
305 | * UST. Fields need to be only added at the end, never reordered, never | |
306 | * removed. | |
307 | * | |
308 | * The field @struct_size should be used to determine the size of the | |
309 | * structure. It should be queried before using additional fields added | |
310 | * at the end of the structure. | |
311 | */ | |
312 | struct lttng_ust_event_desc { | |
313 | uint32_t struct_size; /* Size of this structure. */ | |
37d5e202 | 314 | const char *name; |
fbdeb5ec | 315 | void (*probe_callback)(void); |
37d5e202 | 316 | const struct lttng_event_ctx *ctx; /* context */ |
25cff019 | 317 | const struct lttng_ust_event_field **fields; /* event payload */ |
37d5e202 MD |
318 | unsigned int nr_fields; |
319 | const int **loglevel; | |
dc11f93f MD |
320 | const char *signature; /* Argument types/names received */ |
321 | const char **model_emf_uri; | |
322 | ||
323 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
37d5e202 MD |
324 | }; |
325 | ||
dc11f93f MD |
326 | /* |
327 | * IMPORTANT: this structure is part of the ABI between the probe and | |
328 | * UST. Fields need to be only added at the end, never reordered, never | |
329 | * removed. | |
330 | * | |
331 | * The field @struct_size should be used to determine the size of the | |
332 | * structure. It should be queried before using additional fields added | |
333 | * at the end of the structure. | |
334 | */ | |
335 | struct lttng_ust_probe_desc { | |
336 | uint32_t struct_size; /* Size of this structure. */ | |
337 | ||
37d5e202 | 338 | const char *provider; |
dc11f93f | 339 | const struct lttng_ust_event_desc **event_desc; |
37d5e202 MD |
340 | unsigned int nr_events; |
341 | struct cds_list_head head; /* chain registered probes */ | |
6715d7d1 MD |
342 | struct cds_list_head lazy_init_head; |
343 | int lazy; /* lazy registration */ | |
71d31690 MD |
344 | uint32_t major; |
345 | uint32_t minor; | |
dc11f93f MD |
346 | |
347 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
8020ceb5 MD |
348 | }; |
349 | ||
37d5e202 MD |
350 | /* Data structures used by the tracer. */ |
351 | ||
8a92ed2a | 352 | /* |
04aa13f8 | 353 | * Bytecode interpreter return value masks. |
8a92ed2a | 354 | */ |
04aa13f8 FD |
355 | enum lttng_bytecode_interpreter_ret { |
356 | LTTNG_INTERPRETER_DISCARD = 0, | |
357 | LTTNG_INTERPRETER_RECORD_FLAG = (1ULL << 0), | |
8a92ed2a MD |
358 | /* Other bits are kept for future use. */ |
359 | }; | |
360 | ||
d37ecb3f | 361 | struct lttng_interpreter_output; |
362a65de | 362 | struct lttng_ust_bytecode_runtime_private; |
d37ecb3f | 363 | |
73d37531 | 364 | /* |
5469a374 MD |
365 | * IMPORTANT: this structure is part of the ABI between the probe and |
366 | * UST. Fields need to be only added at the end, never reordered, never | |
367 | * removed. | |
368 | * | |
369 | * The field @struct_size should be used to determine the size of the | |
370 | * structure. It should be queried before using additional fields added | |
371 | * at the end of the structure. | |
73d37531 | 372 | */ |
5469a374 MD |
373 | struct lttng_ust_bytecode_runtime { |
374 | uint32_t struct_size; /* Size of this structure. */ | |
362a65de | 375 | |
5469a374 | 376 | struct lttng_ust_bytecode_runtime_private *priv; |
f488575f | 377 | /* Associated bytecode */ |
c42416df FD |
378 | union { |
379 | uint64_t (*filter)(void *interpreter_data, | |
380 | const char *interpreter_stack_data); | |
d37ecb3f FD |
381 | uint64_t (*capture)(void *interpreter_data, |
382 | const char *interpreter_stack_data, | |
383 | struct lttng_interpreter_output *interpreter_output); | |
c42416df | 384 | } interpreter_funcs; |
e58095ef | 385 | struct cds_list_head node; /* list of bytecode runtime in event */ |
5469a374 MD |
386 | |
387 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
e58095ef MD |
388 | }; |
389 | ||
8020ceb5 | 390 | /* |
7dd08bec MD |
391 | * lttng_event structure is referred to by the tracing fast path. It |
392 | * must be kept small. | |
180901e6 MD |
393 | * |
394 | * IMPORTANT: this structure is part of the ABI between the probe and | |
395 | * UST. Fields need to be only added at the end, never reordered, never | |
396 | * removed. | |
8020ceb5 | 397 | */ |
68bb7559 | 398 | |
80333dfa MD |
399 | struct lttng_ust_event_common_private; |
400 | ||
808edfc8 MD |
401 | enum lttng_ust_event_type { |
402 | LTTNG_UST_EVENT_TYPE_RECORDER = 0, | |
403 | LTTNG_UST_EVENT_TYPE_NOTIFIER = 1, | |
404 | }; | |
405 | ||
93cfd247 | 406 | /* |
6d35572a MD |
407 | * IMPORTANT: this structure is part of the ABI between the probe and |
408 | * UST. Fields need to be only added at the end, never reordered, never | |
409 | * removed. | |
410 | * | |
93cfd247 MD |
411 | * struct lttng_ust_event_common is the common ancestor of the various |
412 | * public event actions. Inheritance is done by composition: The parent | |
413 | * has a pointer to its child, and the child has a pointer to its | |
414 | * parent. Inheritance of those public structures is done by composition | |
415 | * to ensure both parent and child structures can be extended. | |
416 | * | |
417 | * The field @struct_size should be used to determine the size of the | |
418 | * structure. It should be queried before using additional fields added | |
419 | * at the end of the structure. | |
420 | */ | |
7ee76145 | 421 | struct lttng_ust_event_common { |
80333dfa MD |
422 | uint32_t struct_size; /* Size of this structure. */ |
423 | struct lttng_ust_event_common_private *priv; /* Private event interface */ | |
424 | ||
808edfc8 | 425 | enum lttng_ust_event_type type; |
ba99fbe2 MD |
426 | void *child; /* Pointer to child, for inheritance by aggregation. */ |
427 | ||
80333dfa MD |
428 | int enabled; |
429 | int has_enablers_without_bytecode; | |
5469a374 | 430 | /* list of struct lttng_ust_bytecode_runtime, sorted by seqnum */ |
80333dfa | 431 | struct cds_list_head filter_bytecode_runtime_head; |
93cfd247 MD |
432 | |
433 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
80333dfa MD |
434 | }; |
435 | ||
2e70391c | 436 | struct lttng_ust_event_recorder_private; |
68bb7559 | 437 | |
93cfd247 | 438 | /* |
6d35572a MD |
439 | * IMPORTANT: this structure is part of the ABI between the probe and |
440 | * UST. Fields need to be only added at the end, never reordered, never | |
441 | * removed. | |
442 | * | |
93cfd247 MD |
443 | * struct lttng_ust_event_recorder is the action for recording events |
444 | * into a ring buffer. It inherits from struct lttng_ust_event_common | |
445 | * by composition to ensure both parent and child structure are | |
446 | * extensible. | |
447 | * | |
448 | * The field @struct_size should be used to determine the size of the | |
449 | * structure. It should be queried before using additional fields added | |
450 | * at the end of the structure. | |
451 | */ | |
2e70391c MD |
452 | struct lttng_ust_event_recorder { |
453 | uint32_t struct_size; /* Size of this structure. */ | |
ba99fbe2 | 454 | struct lttng_ust_event_common *parent; /* Inheritance by aggregation. */ |
2e70391c | 455 | struct lttng_ust_event_recorder_private *priv; /* Private event record interface */ |
68bb7559 | 456 | |
8020ceb5 | 457 | unsigned int id; |
68bb7559 MD |
458 | struct lttng_channel *chan; |
459 | struct lttng_ctx *ctx; | |
93cfd247 MD |
460 | |
461 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
8020ceb5 MD |
462 | }; |
463 | ||
115db533 MD |
464 | struct lttng_ust_event_notifier_private; |
465 | ||
93cfd247 | 466 | /* |
6d35572a MD |
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 | * | |
93cfd247 MD |
471 | * struct lttng_ust_event_notifier is the action for sending |
472 | * notifications. It inherits from struct lttng_ust_event_common | |
473 | * by composition to ensure both parent and child structure are | |
474 | * extensible. | |
475 | * | |
476 | * The field @struct_size should be used to determine the size of the | |
477 | * structure. It should be queried before using additional fields added | |
478 | * at the end of the structure. | |
479 | */ | |
d7d45c0d | 480 | struct lttng_ust_event_notifier { |
115db533 | 481 | uint32_t struct_size; /* Size of this structure. */ |
105cf2eb | 482 | |
ba99fbe2 | 483 | struct lttng_ust_event_common *parent; /* Inheritance by aggregation. */ |
115db533 MD |
484 | struct lttng_ust_event_notifier_private *priv; /* Private event notifier interface */ |
485 | ||
d7d45c0d | 486 | void (*notification_send)(struct lttng_ust_event_notifier *event_notifier, |
cab88ff8 | 487 | const char *stack_data); |
d37ecb3f | 488 | struct cds_list_head capture_bytecode_runtime_head; |
93cfd247 MD |
489 | |
490 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
d8d2416d FD |
491 | }; |
492 | ||
8d8a24c8 | 493 | struct channel; |
38fae1d3 | 494 | struct lttng_ust_shm_handle; |
8d8a24c8 | 495 | |
180901e6 MD |
496 | /* |
497 | * IMPORTANT: this structure is part of the ABI between the probe and | |
498 | * UST. Fields need to be only added at the end, never reordered, never | |
499 | * removed. | |
49926dbd MD |
500 | * |
501 | * The field @struct_size should be used to determine the size of the | |
502 | * structure. It should be queried before using additional fields added | |
503 | * at the end of the structure. | |
180901e6 | 504 | */ |
49926dbd MD |
505 | struct lttng_ust_channel_ops { |
506 | uint32_t struct_size; | |
507 | ||
7dd08bec | 508 | struct lttng_channel *(*channel_create)(const char *name, |
74d81a6c MD |
509 | void *buf_addr, |
510 | size_t subbuf_size, size_t num_subbuf, | |
511 | unsigned int switch_timer_interval, | |
512 | unsigned int read_timer_interval, | |
6ca18e66 | 513 | unsigned char *uuid, |
a9ff648c | 514 | uint32_t chan_id, |
b2c5f61a MD |
515 | const int *stream_fds, int nr_stream_fds, |
516 | int64_t blocking_timeout); | |
74d81a6c | 517 | void (*channel_destroy)(struct lttng_channel *chan); |
4cfec15c | 518 | int (*event_reserve)(struct lttng_ust_lib_ring_buffer_ctx *ctx, |
8020ceb5 | 519 | uint32_t event_id); |
4cfec15c | 520 | void (*event_commit)(struct lttng_ust_lib_ring_buffer_ctx *ctx); |
74d81a6c MD |
521 | void (*event_write)(struct lttng_ust_lib_ring_buffer_ctx *ctx, |
522 | const void *src, size_t len); | |
8020ceb5 MD |
523 | /* |
524 | * packet_avail_size returns the available size in the current | |
525 | * packet. Note that the size returned is only a hint, since it | |
526 | * may change due to concurrent writes. | |
527 | */ | |
1d498196 | 528 | size_t (*packet_avail_size)(struct channel *chan, |
38fae1d3 | 529 | struct lttng_ust_shm_handle *handle); |
8020ceb5 MD |
530 | int (*is_finalized)(struct channel *chan); |
531 | int (*is_disabled)(struct channel *chan); | |
38fae1d3 | 532 | int (*flush_buffer)(struct channel *chan, struct lttng_ust_shm_handle *handle); |
a44c74d9 MD |
533 | void (*event_strcpy)(struct lttng_ust_lib_ring_buffer_ctx *ctx, |
534 | const char *src, size_t len); | |
49926dbd MD |
535 | |
536 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
8020ceb5 MD |
537 | }; |
538 | ||
180901e6 MD |
539 | /* |
540 | * IMPORTANT: this structure is part of the ABI between the probe and | |
541 | * UST. Fields need to be only added at the end, never reordered, never | |
542 | * removed. | |
543 | */ | |
7dd08bec | 544 | struct lttng_channel { |
a3f61e7f MD |
545 | /* |
546 | * The pointers located in this private data are NOT safe to be | |
547 | * dereferenced by the consumer. The only operations the | |
548 | * consumer process is designed to be allowed to do is to read | |
549 | * and perform subbuffer flush. | |
550 | */ | |
8020ceb5 | 551 | struct channel *chan; /* Channel buffers */ |
976fe9ea | 552 | int enabled; |
8020ceb5 MD |
553 | struct lttng_ctx *ctx; |
554 | /* Event ID management */ | |
7dd08bec | 555 | struct lttng_session *session; |
0a42beb6 | 556 | int objd; /* Object associated to channel */ |
e58095ef | 557 | struct cds_list_head node; /* Channel list in session */ |
49926dbd | 558 | const struct lttng_ust_channel_ops *ops; |
8020ceb5 | 559 | int header_type; /* 0: unset, 1: compact, 2: large */ |
38fae1d3 | 560 | struct lttng_ust_shm_handle *handle; /* shared-memory handle */ |
a3f61e7f | 561 | |
74d81a6c | 562 | /* Channel ID */ |
a3f61e7f | 563 | unsigned int id; |
fd17d7ce | 564 | enum lttng_ust_abi_chan_type type; |
19d8b1b3 | 565 | unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */ |
ac6b4ac6 | 566 | int tstate:1; /* Transient enable state */ |
8020ceb5 MD |
567 | }; |
568 | ||
2a9d9339 MD |
569 | /* |
570 | * IMPORTANT: this structure is part of the ABI between the probe and | |
571 | * UST. Fields need to be only added at the end, never reordered, never | |
572 | * removed. | |
573 | * | |
574 | * The field @struct_size should be used to determine the size of the | |
575 | * structure. It should be queried before using additional fields added | |
576 | * at the end of the structure. | |
577 | */ | |
578 | struct lttng_ust_stack_ctx { | |
579 | uint32_t struct_size; /* Size of this structure */ | |
580 | ||
2e70391c | 581 | struct lttng_ust_event_recorder *event_recorder; |
53569322 MD |
582 | struct lttng_ctx *chan_ctx; /* RCU dereferenced. */ |
583 | struct lttng_ctx *event_ctx; /* RCU dereferenced. */ | |
2a9d9339 MD |
584 | |
585 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
53569322 MD |
586 | }; |
587 | ||
bdb12629 MD |
588 | struct lttng_ust_session_private; |
589 | ||
180901e6 MD |
590 | /* |
591 | * IMPORTANT: this structure is part of the ABI between the probe and | |
592 | * UST. Fields need to be only added at the end, never reordered, never | |
593 | * removed. | |
6d35572a MD |
594 | * |
595 | * The field @struct_size should be used to determine the size of the | |
596 | * structure. It should be queried before using additional fields added | |
597 | * at the end of the structure. | |
180901e6 | 598 | */ |
7dd08bec | 599 | struct lttng_session { |
bd640d74 | 600 | uint32_t struct_size; /* Size of this structure */ |
bdb12629 MD |
601 | struct lttng_ust_session_private *priv; /* Private session interface */ |
602 | ||
e58095ef | 603 | int active; /* Is trace session active ? */ |
6d35572a MD |
604 | |
605 | /* End of base ABI. Fields below should be used after checking struct_size. */ | |
8020ceb5 MD |
606 | }; |
607 | ||
dc11f93f MD |
608 | int lttng_ust_probe_register(struct lttng_ust_probe_desc *desc); |
609 | void lttng_ust_probe_unregister(struct lttng_ust_probe_desc *desc); | |
9f3fdbc6 | 610 | |
fc80554e | 611 | /* |
0af0bdb2 MJ |
612 | * Applications that change their procname and need the new value to be |
613 | * reflected in the procname event context have to call this function to clear | |
614 | * the internally cached value. This should not be called from a signal | |
615 | * handler. | |
fc80554e | 616 | */ |
0af0bdb2 | 617 | void lttng_ust_context_procname_reset(void); |
d58d1454 | 618 | |
7dd08bec | 619 | struct lttng_transport *lttng_transport_find(const char *name); |
c1fca457 | 620 | |
6715d7d1 | 621 | int lttng_session_active(void); |
e6c12e3d | 622 | |
97c7c238 MD |
623 | void lttng_ust_dl_update(void *ip); |
624 | ||
6453d237 MD |
625 | #ifdef __cplusplus |
626 | } | |
627 | #endif | |
628 | ||
51489cad | 629 | #endif /* _LTTNG_UST_EVENTS_H */ |