Commit | Line | Data |
---|---|---|
51489cad MD |
1 | #ifndef _LTTNG_UST_EVENTS_H |
2 | #define _LTTNG_UST_EVENTS_H | |
8020ceb5 MD |
3 | |
4 | /* | |
51489cad | 5 | * lttng/ust-events.h |
8020ceb5 | 6 | * |
e92f3e28 | 7 | * Copyright 2010-2012 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
8020ceb5 MD |
8 | * |
9 | * Holds LTTng per-session event registry. | |
10 | * | |
e92f3e28 MD |
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: | |
a60d70e6 | 17 | * |
e92f3e28 MD |
18 | * The above copyright notice and this permission notice shall be included in |
19 | * all copies or substantial portions of the Software. | |
d2428e87 MD |
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. | |
8020ceb5 MD |
28 | */ |
29 | ||
9f3fdbc6 | 30 | #include <urcu/list.h> |
1f18504e | 31 | #include <urcu/hlist.h> |
9f3fdbc6 | 32 | #include <stdint.h> |
4318ae1b MD |
33 | #include <lttng/ust-abi.h> |
34 | #include <lttng/ust-tracer.h> | |
2ae57758 | 35 | #include <lttng/ust-endian.h> |
20f1eee7 | 36 | #include <float.h> |
8020ceb5 | 37 | |
19d8b1b3 MD |
38 | #define LTTNG_UST_UUID_LEN 16 |
39 | ||
71d31690 MD |
40 | /* |
41 | * Tracepoint provider version. Compatibility based on the major number. | |
42 | * Older tracepoint providers can always register to newer lttng-ust | |
43 | * library, but the opposite is rejected: a newer tracepoint provider is | |
44 | * rejected by an older lttng-ust library. | |
45 | */ | |
46 | #define LTTNG_UST_PROVIDER_MAJOR 1 | |
47 | #define LTTNG_UST_PROVIDER_MINOR 0 | |
48 | ||
7dd08bec MD |
49 | struct lttng_channel; |
50 | struct lttng_session; | |
4cfec15c | 51 | struct lttng_ust_lib_ring_buffer_ctx; |
8020ceb5 | 52 | |
37d5e202 MD |
53 | /* |
54 | * Data structures used by tracepoint event declarations, and by the | |
55 | * tracer. Those structures have padding for future extension. | |
56 | */ | |
57 | ||
c1fca457 MD |
58 | /* |
59 | * LTTng client type enumeration. Used by the consumer to map the | |
60 | * callbacks from its own address space. | |
61 | */ | |
62 | enum lttng_client_types { | |
63 | LTTNG_CLIENT_METADATA = 0, | |
64 | LTTNG_CLIENT_DISCARD = 1, | |
65 | LTTNG_CLIENT_OVERWRITE = 2, | |
34a91bdb MD |
66 | LTTNG_CLIENT_DISCARD_RT = 3, |
67 | LTTNG_CLIENT_OVERWRITE_RT = 4, | |
c1fca457 MD |
68 | LTTNG_NR_CLIENT_TYPES, |
69 | }; | |
70 | ||
8020ceb5 MD |
71 | /* Type description */ |
72 | ||
73 | /* Update the astract_types name table in lttng-types.c along with this enum */ | |
7dd08bec | 74 | enum lttng_abstract_types { |
8020ceb5 MD |
75 | atype_integer, |
76 | atype_enum, | |
77 | atype_array, | |
78 | atype_sequence, | |
79 | atype_string, | |
20f1eee7 | 80 | atype_float, |
8020ceb5 MD |
81 | NR_ABSTRACT_TYPES, |
82 | }; | |
83 | ||
84 | /* Update the string_encodings name table in lttng-types.c along with this enum */ | |
85 | enum lttng_string_encodings { | |
86 | lttng_encode_none = 0, | |
87 | lttng_encode_UTF8 = 1, | |
88 | lttng_encode_ASCII = 2, | |
89 | NR_STRING_ENCODINGS, | |
90 | }; | |
91 | ||
37d5e202 | 92 | #define LTTNG_UST_ENUM_ENTRY_PADDING 16 |
8020ceb5 MD |
93 | struct lttng_enum_entry { |
94 | unsigned long long start, end; /* start and end are inclusive */ | |
95 | const char *string; | |
37d5e202 | 96 | char padding[LTTNG_UST_ENUM_ENTRY_PADDING]; |
8020ceb5 MD |
97 | }; |
98 | ||
99 | #define __type_integer(_type, _byte_order, _base, _encoding) \ | |
100 | { \ | |
101 | .atype = atype_integer, \ | |
102 | .u.basic.integer = \ | |
103 | { \ | |
104 | .size = sizeof(_type) * CHAR_BIT, \ | |
1dbfff0c MD |
105 | .alignment = lttng_alignof(_type) * CHAR_BIT, \ |
106 | .signedness = lttng_is_signed_type(_type), \ | |
8d1d746f | 107 | .reverse_byte_order = _byte_order != BYTE_ORDER, \ |
8020ceb5 MD |
108 | .base = _base, \ |
109 | .encoding = lttng_encode_##_encoding, \ | |
110 | }, \ | |
111 | } \ | |
112 | ||
37d5e202 | 113 | #define LTTNG_UST_INTEGER_TYPE_PADDING 24 |
8020ceb5 MD |
114 | struct lttng_integer_type { |
115 | unsigned int size; /* in bits */ | |
116 | unsigned short alignment; /* in bits */ | |
117 | unsigned int signedness:1; | |
118 | unsigned int reverse_byte_order:1; | |
119 | unsigned int base; /* 2, 8, 10, 16, for pretty print */ | |
120 | enum lttng_string_encodings encoding; | |
37d5e202 | 121 | char padding[LTTNG_UST_INTEGER_TYPE_PADDING]; |
8020ceb5 MD |
122 | }; |
123 | ||
d3ed854b MD |
124 | /* |
125 | * Only float and double are supported. long double is not supported at | |
126 | * the moment. | |
127 | */ | |
20f1eee7 MD |
128 | #define _float_mant_dig(_type) \ |
129 | (sizeof(_type) == sizeof(float) ? FLT_MANT_DIG \ | |
130 | : (sizeof(_type) == sizeof(double) ? DBL_MANT_DIG \ | |
d3ed854b | 131 | : 0)) |
20f1eee7 MD |
132 | |
133 | #define __type_float(_type) \ | |
134 | { \ | |
135 | .atype = atype_float, \ | |
136 | .u.basic._float = \ | |
137 | { \ | |
138 | .exp_dig = sizeof(_type) * CHAR_BIT \ | |
139 | - _float_mant_dig(_type), \ | |
140 | .mant_dig = _float_mant_dig(_type), \ | |
1dbfff0c | 141 | .alignment = lttng_alignof(_type) * CHAR_BIT, \ |
ad496c21 | 142 | .reverse_byte_order = BYTE_ORDER != FLOAT_WORD_ORDER, \ |
20f1eee7 MD |
143 | }, \ |
144 | } \ | |
145 | ||
37d5e202 | 146 | #define LTTNG_UST_FLOAT_TYPE_PADDING 24 |
20f1eee7 MD |
147 | struct lttng_float_type { |
148 | unsigned int exp_dig; /* exponent digits, in bits */ | |
149 | unsigned int mant_dig; /* mantissa digits, in bits */ | |
150 | unsigned short alignment; /* in bits */ | |
151 | unsigned int reverse_byte_order:1; | |
37d5e202 | 152 | char padding[LTTNG_UST_FLOAT_TYPE_PADDING]; |
20f1eee7 MD |
153 | }; |
154 | ||
37d5e202 | 155 | #define LTTNG_UST_BASIC_TYPE_PADDING 128 |
8020ceb5 MD |
156 | union _lttng_basic_type { |
157 | struct lttng_integer_type integer; | |
158 | struct { | |
159 | const char *name; | |
160 | } enumeration; | |
161 | struct { | |
162 | enum lttng_string_encodings encoding; | |
163 | } string; | |
20f1eee7 | 164 | struct lttng_float_type _float; |
37d5e202 | 165 | char padding[LTTNG_UST_BASIC_TYPE_PADDING]; |
8020ceb5 MD |
166 | }; |
167 | ||
168 | struct lttng_basic_type { | |
7dd08bec | 169 | enum lttng_abstract_types atype; |
8020ceb5 MD |
170 | union { |
171 | union _lttng_basic_type basic; | |
172 | } u; | |
173 | }; | |
174 | ||
37d5e202 | 175 | #define LTTNG_UST_TYPE_PADDING 128 |
8020ceb5 | 176 | struct lttng_type { |
7dd08bec | 177 | enum lttng_abstract_types atype; |
8020ceb5 MD |
178 | union { |
179 | union _lttng_basic_type basic; | |
180 | struct { | |
181 | struct lttng_basic_type elem_type; | |
182 | unsigned int length; /* num. elems. */ | |
183 | } array; | |
184 | struct { | |
185 | struct lttng_basic_type length_type; | |
186 | struct lttng_basic_type elem_type; | |
187 | } sequence; | |
37d5e202 | 188 | char padding[LTTNG_UST_TYPE_PADDING]; |
8020ceb5 MD |
189 | } u; |
190 | }; | |
191 | ||
37d5e202 | 192 | #define LTTNG_UST_ENUM_TYPE_PADDING 24 |
8020ceb5 MD |
193 | struct lttng_enum { |
194 | const char *name; | |
195 | struct lttng_type container_type; | |
196 | const struct lttng_enum_entry *entries; | |
23c8854a | 197 | unsigned int len; |
37d5e202 | 198 | char padding[LTTNG_UST_ENUM_TYPE_PADDING]; |
8020ceb5 MD |
199 | }; |
200 | ||
180901e6 MD |
201 | /* |
202 | * Event field description | |
203 | * | |
204 | * IMPORTANT: this structure is part of the ABI between the probe and | |
205 | * UST. Fields need to be only added at the end, never reordered, never | |
206 | * removed. | |
207 | */ | |
8020ceb5 | 208 | |
4774c8f3 | 209 | #define LTTNG_UST_EVENT_FIELD_PADDING 28 |
8020ceb5 MD |
210 | struct lttng_event_field { |
211 | const char *name; | |
212 | struct lttng_type type; | |
180901e6 | 213 | unsigned int nowrite; /* do not write into trace */ |
37d5e202 | 214 | char padding[LTTNG_UST_EVENT_FIELD_PADDING]; |
8020ceb5 MD |
215 | }; |
216 | ||
77aa5901 MD |
217 | union lttng_ctx_value { |
218 | int64_t s64; | |
219 | const char *str; | |
220 | double d; | |
221 | }; | |
222 | ||
37d5e202 | 223 | #define LTTNG_UST_CTX_FIELD_PADDING 40 |
8020ceb5 MD |
224 | struct lttng_ctx_field { |
225 | struct lttng_event_field event_field; | |
226 | size_t (*get_size)(size_t offset); | |
227 | void (*record)(struct lttng_ctx_field *field, | |
4cfec15c | 228 | struct lttng_ust_lib_ring_buffer_ctx *ctx, |
7dd08bec | 229 | struct lttng_channel *chan); |
77aa5901 MD |
230 | void (*get_value)(struct lttng_ctx_field *field, |
231 | union lttng_ctx_value *value); | |
8020ceb5 | 232 | union { |
37d5e202 | 233 | char padding[LTTNG_UST_CTX_FIELD_PADDING]; |
8020ceb5 MD |
234 | } u; |
235 | void (*destroy)(struct lttng_ctx_field *field); | |
236 | }; | |
237 | ||
37d5e202 | 238 | #define LTTNG_UST_CTX_PADDING 24 |
8020ceb5 MD |
239 | struct lttng_ctx { |
240 | struct lttng_ctx_field *fields; | |
241 | unsigned int nr_fields; | |
242 | unsigned int allocated_fields; | |
37d5e202 MD |
243 | char padding[LTTNG_UST_CTX_PADDING]; |
244 | }; | |
245 | ||
246 | #define LTTNG_UST_EVENT_DESC_PADDING 40 | |
247 | struct lttng_event_desc { | |
248 | const char *name; | |
fbdeb5ec | 249 | void (*probe_callback)(void); |
37d5e202 MD |
250 | const struct lttng_event_ctx *ctx; /* context */ |
251 | const struct lttng_event_field *fields; /* event payload */ | |
252 | unsigned int nr_fields; | |
253 | const int **loglevel; | |
68755429 | 254 | const char *signature; /* Argument types/names received */ |
6ddc916d MD |
255 | union { |
256 | struct { | |
257 | const char **model_emf_uri; | |
258 | } ext; | |
259 | char padding[LTTNG_UST_EVENT_DESC_PADDING]; | |
260 | } u; | |
37d5e202 MD |
261 | }; |
262 | ||
71d31690 | 263 | #define LTTNG_UST_PROBE_DESC_PADDING 12 |
37d5e202 MD |
264 | struct lttng_probe_desc { |
265 | const char *provider; | |
266 | const struct lttng_event_desc **event_desc; | |
267 | unsigned int nr_events; | |
268 | struct cds_list_head head; /* chain registered probes */ | |
6715d7d1 MD |
269 | struct cds_list_head lazy_init_head; |
270 | int lazy; /* lazy registration */ | |
71d31690 MD |
271 | uint32_t major; |
272 | uint32_t minor; | |
37d5e202 | 273 | char padding[LTTNG_UST_PROBE_DESC_PADDING]; |
8020ceb5 MD |
274 | }; |
275 | ||
37d5e202 MD |
276 | /* Data structures used by the tracer. */ |
277 | ||
e58095ef MD |
278 | enum lttng_enabler_type { |
279 | LTTNG_ENABLER_WILDCARD, | |
280 | LTTNG_ENABLER_EVENT, | |
e6c12e3d MD |
281 | }; |
282 | ||
283 | /* | |
e58095ef MD |
284 | * Enabler field, within whatever object is enabling an event. Target of |
285 | * backward reference. | |
e6c12e3d | 286 | */ |
e58095ef MD |
287 | struct lttng_enabler { |
288 | enum lttng_enabler_type type; | |
289 | ||
290 | /* head list of struct lttng_ust_filter_bytecode_node */ | |
291 | struct cds_list_head filter_bytecode_head; | |
292 | struct cds_list_head node; /* per-session list of enablers */ | |
293 | ||
294 | struct lttng_ust_event event_param; | |
295 | struct lttng_channel *chan; | |
296 | struct lttng_ctx *ctx; | |
297 | unsigned int enabled:1; | |
e6c12e3d MD |
298 | }; |
299 | ||
c8fcf224 MD |
300 | struct tp_list_entry { |
301 | struct lttng_ust_tracepoint_iter tp; | |
302 | struct cds_list_head head; | |
303 | }; | |
304 | ||
305 | struct lttng_ust_tracepoint_list { | |
306 | struct tp_list_entry *iter; | |
307 | struct cds_list_head head; | |
8020ceb5 MD |
308 | }; |
309 | ||
06d4f27e MD |
310 | struct tp_field_list_entry { |
311 | struct lttng_ust_field_iter field; | |
312 | struct cds_list_head head; | |
313 | }; | |
314 | ||
315 | struct lttng_ust_field_list { | |
316 | struct tp_field_list_entry *iter; | |
317 | struct cds_list_head head; | |
318 | }; | |
319 | ||
8165c8da | 320 | struct ust_pending_probe; |
7dd08bec | 321 | struct lttng_event; |
f488575f MD |
322 | |
323 | struct lttng_ust_filter_bytecode_node { | |
324 | struct cds_list_head node; | |
e58095ef | 325 | struct lttng_enabler *enabler; |
a543151c MD |
326 | /* |
327 | * struct lttng_ust_filter_bytecode has var. sized array, must | |
328 | * be last field. | |
329 | */ | |
330 | struct lttng_ust_filter_bytecode bc; | |
f488575f MD |
331 | }; |
332 | ||
8a92ed2a MD |
333 | /* |
334 | * Filter return value masks. | |
335 | */ | |
336 | enum lttng_filter_ret { | |
337 | LTTNG_FILTER_DISCARD = 0, | |
338 | LTTNG_FILTER_RECORD_FLAG = (1ULL << 0), | |
339 | /* Other bits are kept for future use. */ | |
340 | }; | |
341 | ||
f488575f MD |
342 | struct lttng_bytecode_runtime { |
343 | /* Associated bytecode */ | |
344 | struct lttng_ust_filter_bytecode_node *bc; | |
8a92ed2a | 345 | uint64_t (*filter)(void *filter_data, const char *filter_stack_data); |
21af05a9 | 346 | int link_failed; |
e58095ef MD |
347 | struct cds_list_head node; /* list of bytecode runtime in event */ |
348 | }; | |
349 | ||
350 | /* | |
351 | * Objects in a linked-list of enablers, owned by an event. | |
352 | */ | |
353 | struct lttng_enabler_ref { | |
354 | struct cds_list_head node; /* enabler ref list */ | |
355 | struct lttng_enabler *ref; /* backward ref */ | |
f488575f | 356 | }; |
8165c8da | 357 | |
8020ceb5 | 358 | /* |
7dd08bec MD |
359 | * lttng_event structure is referred to by the tracing fast path. It |
360 | * must be kept small. | |
180901e6 MD |
361 | * |
362 | * IMPORTANT: this structure is part of the ABI between the probe and | |
363 | * UST. Fields need to be only added at the end, never reordered, never | |
364 | * removed. | |
8020ceb5 | 365 | */ |
7dd08bec | 366 | struct lttng_event { |
180901e6 | 367 | /* LTTng-UST 2.0 starts here */ |
8020ceb5 | 368 | unsigned int id; |
7dd08bec | 369 | struct lttng_channel *chan; |
976fe9ea | 370 | int enabled; |
8020ceb5 | 371 | const struct lttng_event_desc *desc; |
e58095ef | 372 | void *_deprecated1; |
8020ceb5 | 373 | struct lttng_ctx *ctx; |
9f3fdbc6 | 374 | enum lttng_ust_instrumentation instrumentation; |
8020ceb5 | 375 | union { |
8020ceb5 | 376 | } u; |
e58095ef MD |
377 | struct cds_list_head node; /* Event list in session */ |
378 | struct cds_list_head _deprecated2; | |
379 | void *_deprecated3; | |
13b21cd6 | 380 | unsigned int _deprecated4:1; |
e58095ef | 381 | |
180901e6 | 382 | /* LTTng-UST 2.1 starts here */ |
e58095ef MD |
383 | /* list of struct lttng_bytecode_runtime, sorted by seqnum */ |
384 | struct cds_list_head bytecode_runtime_head; | |
dcdeaff0 | 385 | int has_enablers_without_bytecode; |
e58095ef MD |
386 | /* Backward references: list of lttng_enabler_ref (ref to enablers) */ |
387 | struct cds_list_head enablers_ref_head; | |
d56fa719 | 388 | struct cds_hlist_node hlist; /* session ht of events */ |
ac6b4ac6 | 389 | int registered; /* has reg'd tracepoint probe */ |
8020ceb5 MD |
390 | }; |
391 | ||
8d8a24c8 | 392 | struct channel; |
38fae1d3 | 393 | struct lttng_ust_shm_handle; |
8d8a24c8 | 394 | |
180901e6 MD |
395 | /* |
396 | * IMPORTANT: this structure is part of the ABI between the probe and | |
397 | * UST. Fields need to be only added at the end, never reordered, never | |
398 | * removed. | |
399 | */ | |
7dd08bec MD |
400 | struct lttng_channel_ops { |
401 | struct lttng_channel *(*channel_create)(const char *name, | |
74d81a6c MD |
402 | void *buf_addr, |
403 | size_t subbuf_size, size_t num_subbuf, | |
404 | unsigned int switch_timer_interval, | |
405 | unsigned int read_timer_interval, | |
6ca18e66 MD |
406 | unsigned char *uuid, |
407 | uint32_t chan_id); | |
74d81a6c | 408 | void (*channel_destroy)(struct lttng_channel *chan); |
9e917229 MD |
409 | void *_deprecated1; |
410 | void *_deprecated2; | |
4cfec15c | 411 | int (*event_reserve)(struct lttng_ust_lib_ring_buffer_ctx *ctx, |
8020ceb5 | 412 | uint32_t event_id); |
4cfec15c | 413 | void (*event_commit)(struct lttng_ust_lib_ring_buffer_ctx *ctx); |
74d81a6c MD |
414 | void (*event_write)(struct lttng_ust_lib_ring_buffer_ctx *ctx, |
415 | const void *src, size_t len); | |
8020ceb5 MD |
416 | /* |
417 | * packet_avail_size returns the available size in the current | |
418 | * packet. Note that the size returned is only a hint, since it | |
419 | * may change due to concurrent writes. | |
420 | */ | |
1d498196 | 421 | size_t (*packet_avail_size)(struct channel *chan, |
38fae1d3 | 422 | struct lttng_ust_shm_handle *handle); |
9f3fdbc6 MD |
423 | //wait_queue_head_t *(*get_reader_wait_queue)(struct channel *chan); |
424 | //wait_queue_head_t *(*get_hp_wait_queue)(struct channel *chan); | |
8020ceb5 MD |
425 | int (*is_finalized)(struct channel *chan); |
426 | int (*is_disabled)(struct channel *chan); | |
38fae1d3 | 427 | int (*flush_buffer)(struct channel *chan, struct lttng_ust_shm_handle *handle); |
8020ceb5 MD |
428 | }; |
429 | ||
180901e6 MD |
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 | */ | |
7dd08bec | 435 | struct lttng_channel { |
a3f61e7f MD |
436 | /* |
437 | * The pointers located in this private data are NOT safe to be | |
438 | * dereferenced by the consumer. The only operations the | |
439 | * consumer process is designed to be allowed to do is to read | |
440 | * and perform subbuffer flush. | |
441 | */ | |
8020ceb5 | 442 | struct channel *chan; /* Channel buffers */ |
976fe9ea | 443 | int enabled; |
8020ceb5 MD |
444 | struct lttng_ctx *ctx; |
445 | /* Event ID management */ | |
7dd08bec | 446 | struct lttng_session *session; |
0a42beb6 | 447 | int objd; /* Object associated to channel */ |
32ce8569 MD |
448 | unsigned int _deprecated1; |
449 | unsigned int _deprecated2; | |
e58095ef | 450 | struct cds_list_head node; /* Channel list in session */ |
74d81a6c | 451 | const struct lttng_channel_ops *ops; |
8020ceb5 | 452 | int header_type; /* 0: unset, 1: compact, 2: large */ |
38fae1d3 | 453 | struct lttng_ust_shm_handle *handle; /* shared-memory handle */ |
13b21cd6 | 454 | unsigned int _deprecated3:1; |
a3f61e7f | 455 | |
74d81a6c | 456 | /* Channel ID */ |
a3f61e7f | 457 | unsigned int id; |
74d81a6c | 458 | enum lttng_ust_chan_type type; |
19d8b1b3 | 459 | unsigned char uuid[LTTNG_UST_UUID_LEN]; /* Trace session unique ID */ |
ac6b4ac6 | 460 | int tstate:1; /* Transient enable state */ |
8020ceb5 MD |
461 | }; |
462 | ||
71a9d034 | 463 | #define LTTNG_UST_EVENT_HT_BITS 12 |
e58095ef MD |
464 | #define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS) |
465 | ||
466 | struct lttng_ust_event_ht { | |
467 | struct cds_hlist_head table[LTTNG_UST_EVENT_HT_SIZE]; | |
468 | }; | |
469 | ||
180901e6 MD |
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 | */ | |
7dd08bec | 475 | struct lttng_session { |
e58095ef MD |
476 | int active; /* Is trace session active ? */ |
477 | int been_active; /* Been active ? */ | |
478 | int objd; /* Object associated */ | |
13b21cd6 | 479 | void *_deprecated1; |
e58095ef MD |
480 | struct cds_list_head chan_head; /* Channel list head */ |
481 | struct cds_list_head events_head; /* list of events */ | |
13b21cd6 | 482 | struct cds_list_head _deprecated2; |
e58095ef | 483 | struct cds_list_head node; /* Session list */ |
13b21cd6 MD |
484 | int _deprecated3; |
485 | unsigned int _deprecated4:1; | |
e58095ef MD |
486 | |
487 | /* New UST 2.1 */ | |
488 | /* List of enablers */ | |
489 | struct cds_list_head enablers_head; | |
d56fa719 | 490 | struct lttng_ust_event_ht events_ht; /* ht of events */ |
32ce8569 | 491 | void *owner; /* object owner */ |
ac6b4ac6 | 492 | int tstate:1; /* Transient enable state */ |
8020ceb5 MD |
493 | }; |
494 | ||
7dd08bec | 495 | struct lttng_transport { |
8020ceb5 | 496 | char *name; |
9f3fdbc6 | 497 | struct cds_list_head node; |
7dd08bec | 498 | struct lttng_channel_ops ops; |
74d81a6c | 499 | const struct lttng_ust_lib_ring_buffer_config *client_config; |
8020ceb5 MD |
500 | }; |
501 | ||
7dd08bec MD |
502 | struct lttng_session *lttng_session_create(void); |
503 | int lttng_session_enable(struct lttng_session *session); | |
504 | int lttng_session_disable(struct lttng_session *session); | |
505 | void lttng_session_destroy(struct lttng_session *session); | |
8020ceb5 | 506 | |
7dd08bec | 507 | struct lttng_channel *lttng_channel_create(struct lttng_session *session, |
8020ceb5 MD |
508 | const char *transport_name, |
509 | void *buf_addr, | |
510 | size_t subbuf_size, size_t num_subbuf, | |
511 | unsigned int switch_timer_interval, | |
193183fb | 512 | unsigned int read_timer_interval, |
ef9ff354 MD |
513 | int **shm_fd, int **wait_fd, |
514 | uint64_t **memory_map_size, | |
7dd08bec | 515 | struct lttng_channel *chan_priv_init); |
8020ceb5 | 516 | |
7dd08bec MD |
517 | int lttng_channel_enable(struct lttng_channel *channel); |
518 | int lttng_channel_disable(struct lttng_channel *channel); | |
e58095ef MD |
519 | |
520 | struct lttng_enabler *lttng_enabler_create(enum lttng_enabler_type type, | |
521 | struct lttng_ust_event *event_param, | |
522 | struct lttng_channel *chan); | |
523 | int lttng_enabler_enable(struct lttng_enabler *enabler); | |
524 | int lttng_enabler_disable(struct lttng_enabler *enabler); | |
525 | int lttng_enabler_attach_bytecode(struct lttng_enabler *enabler, | |
526 | struct lttng_ust_filter_bytecode_node *bytecode); | |
527 | int lttng_enabler_attach_context(struct lttng_enabler *enabler, | |
528 | struct lttng_ust_context *ctx); | |
529 | ||
530 | int lttng_attach_context(struct lttng_ust_context *context_param, | |
531 | struct lttng_ctx **ctx, struct lttng_session *session); | |
a0a3bef9 MD |
532 | void lttng_context_init(void); |
533 | void lttng_context_exit(void); | |
534 | struct lttng_ctx *lttng_static_ctx; /* Used by filtering */ | |
976fe9ea | 535 | |
7dd08bec MD |
536 | void lttng_transport_register(struct lttng_transport *transport); |
537 | void lttng_transport_unregister(struct lttng_transport *transport); | |
8020ceb5 | 538 | |
4b4de73e | 539 | void synchronize_trace(void); |
8020ceb5 | 540 | |
7dd08bec MD |
541 | int lttng_probe_register(struct lttng_probe_desc *desc); |
542 | void lttng_probe_unregister(struct lttng_probe_desc *desc); | |
5f733922 | 543 | int lttng_fix_pending_events(void); |
7dd08bec MD |
544 | int lttng_probes_init(void); |
545 | void lttng_probes_exit(void); | |
8173ec7c | 546 | int lttng_find_context(struct lttng_ctx *ctx, const char *name); |
77aa5901 | 547 | int lttng_get_context_index(struct lttng_ctx *ctx, const char *name); |
8173ec7c MD |
548 | struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p); |
549 | void lttng_remove_context_field(struct lttng_ctx **ctx_p, | |
8020ceb5 MD |
550 | struct lttng_ctx_field *field); |
551 | void lttng_destroy_context(struct lttng_ctx *ctx); | |
3b402b40 | 552 | int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx); |
c1ef86f0 | 553 | int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx); |
8173ec7c | 554 | int lttng_add_pthread_id_to_ctx(struct lttng_ctx **ctx); |
4847e9bb | 555 | int lttng_add_procname_to_ctx(struct lttng_ctx **ctx); |
a93bfc45 | 556 | void lttng_context_vtid_reset(void); |
c1ef86f0 | 557 | void lttng_context_vpid_reset(void); |
9f3fdbc6 | 558 | |
5a821cd6 MD |
559 | extern const struct lttng_ust_lib_ring_buffer_client_cb *lttng_client_callbacks_metadata; |
560 | extern const struct lttng_ust_lib_ring_buffer_client_cb *lttng_client_callbacks_discard; | |
561 | extern const struct lttng_ust_lib_ring_buffer_client_cb *lttng_client_callbacks_overwrite; | |
c1fca457 | 562 | |
7dd08bec | 563 | struct lttng_transport *lttng_transport_find(const char *name); |
c1fca457 | 564 | |
7dd08bec MD |
565 | int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list); |
566 | void lttng_probes_prune_event_list(struct lttng_ust_tracepoint_list *list); | |
c8fcf224 MD |
567 | struct lttng_ust_tracepoint_iter * |
568 | lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list *list); | |
7dd08bec MD |
569 | int lttng_probes_get_field_list(struct lttng_ust_field_list *list); |
570 | void lttng_probes_prune_field_list(struct lttng_ust_field_list *list); | |
06d4f27e MD |
571 | struct lttng_ust_field_iter * |
572 | lttng_ust_field_list_get_iter_next(struct lttng_ust_field_list *list); | |
c8fcf224 | 573 | |
7dd08bec | 574 | void lttng_filter_event_link_bytecode(struct lttng_event *event); |
e58095ef MD |
575 | void lttng_enabler_event_link_bytecode(struct lttng_event *event, |
576 | struct lttng_enabler *enabler); | |
7dd08bec | 577 | void lttng_free_event_filter_runtime(struct lttng_event *event); |
e58095ef MD |
578 | void lttng_filter_sync_state(struct lttng_bytecode_runtime *runtime); |
579 | ||
580 | struct cds_list_head *lttng_get_probe_list_head(void); | |
6715d7d1 | 581 | int lttng_session_active(void); |
e6c12e3d | 582 | |
51489cad | 583 | #endif /* _LTTNG_UST_EVENTS_H */ |