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