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