Commit | Line | Data |
---|---|---|
d871c65b | 1 | /* |
c0c0989a | 2 | * SPDX-License-Identifier: MIT |
d871c65b | 3 | * |
c0c0989a | 4 | * Copyright 2019 (c) Francis Deslauriers <francis.deslauriers@efficios.com> |
d871c65b FD |
5 | */ |
6 | ||
c0c0989a MJ |
7 | #ifndef _LTTNG_UST_EVENTS_INTERNAL_H |
8 | #define _LTTNG_UST_EVENTS_INTERNAL_H | |
9 | ||
d871c65b FD |
10 | #include <stdint.h> |
11 | ||
12 | #include <urcu/list.h> | |
13 | #include <urcu/hlist.h> | |
14 | ||
d871c65b FD |
15 | #include <lttng/ust-events.h> |
16 | ||
fa194c41 | 17 | #include "ust-context-provider.h" |
fd17d7ce MD |
18 | |
19 | struct lttng_ust_abi_obj; | |
06cd86a0 | 20 | struct lttng_event_notifier_group; |
fd17d7ce MD |
21 | |
22 | union lttng_ust_abi_args { | |
23 | struct { | |
24 | void *chan_data; | |
25 | int wakeup_fd; | |
26 | } channel; | |
27 | struct { | |
28 | int shm_fd; | |
29 | int wakeup_fd; | |
30 | } stream; | |
31 | struct { | |
32 | struct lttng_ust_abi_field_iter entry; | |
33 | } field_list; | |
34 | struct { | |
35 | char *ctxname; | |
36 | } app_context; | |
37 | struct { | |
38 | int event_notifier_notif_fd; | |
39 | } event_notifier_handle; | |
40 | struct { | |
41 | void *counter_data; | |
42 | } counter; | |
43 | struct { | |
44 | int shm_fd; | |
45 | } counter_shm; | |
46 | }; | |
47 | ||
48 | struct lttng_ust_abi_objd_ops { | |
49 | long (*cmd)(int objd, unsigned int cmd, unsigned long arg, | |
50 | union lttng_ust_abi_args *args, void *owner); | |
51 | int (*release)(int objd); | |
52 | }; | |
53 | ||
8665f6a4 MJ |
54 | enum lttng_enabler_format_type { |
55 | LTTNG_ENABLER_FORMAT_STAR_GLOB, | |
56 | LTTNG_ENABLER_FORMAT_EVENT, | |
57 | }; | |
58 | ||
59 | /* | |
60 | * Enabler field, within whatever object is enabling an event. Target of | |
61 | * backward reference. | |
62 | */ | |
63 | struct lttng_enabler { | |
64 | enum lttng_enabler_format_type format_type; | |
65 | ||
66 | /* head list of struct lttng_ust_filter_bytecode_node */ | |
67 | struct cds_list_head filter_bytecode_head; | |
68 | /* head list of struct lttng_ust_excluder_node */ | |
69 | struct cds_list_head excluder_head; | |
70 | ||
fd17d7ce | 71 | struct lttng_ust_abi_event event_param; |
8665f6a4 MJ |
72 | unsigned int enabled:1; |
73 | }; | |
74 | ||
d871c65b FD |
75 | struct lttng_event_enabler { |
76 | struct lttng_enabler base; | |
77 | struct cds_list_head node; /* per-session list of enablers */ | |
78 | struct lttng_channel *chan; | |
79 | /* | |
80 | * Unused, but kept around to make it explicit that the tracer can do | |
81 | * it. | |
82 | */ | |
daacdbfc | 83 | struct lttng_ust_ctx *ctx; |
d871c65b FD |
84 | }; |
85 | ||
d8d2416d FD |
86 | struct lttng_event_notifier_enabler { |
87 | struct lttng_enabler base; | |
6566528b | 88 | uint64_t error_counter_index; |
d37ecb3f FD |
89 | struct cds_list_head node; /* per-app list of event_notifier enablers */ |
90 | struct cds_list_head capture_bytecode_head; | |
d8d2416d FD |
91 | struct lttng_event_notifier_group *group; /* weak ref */ |
92 | uint64_t user_token; /* User-provided token */ | |
d37ecb3f | 93 | uint64_t num_captures; |
d8d2416d FD |
94 | }; |
95 | ||
ab249ecf FD |
96 | enum lttng_ust_bytecode_node_type { |
97 | LTTNG_UST_BYTECODE_NODE_TYPE_FILTER, | |
d37ecb3f | 98 | LTTNG_UST_BYTECODE_NODE_TYPE_CAPTURE, |
ab249ecf FD |
99 | }; |
100 | ||
101 | struct lttng_ust_bytecode_node { | |
102 | enum lttng_ust_bytecode_node_type type; | |
92495593 FD |
103 | struct cds_list_head node; |
104 | struct lttng_enabler *enabler; | |
ab249ecf FD |
105 | struct { |
106 | uint32_t len; | |
107 | uint32_t reloc_offset; | |
108 | uint64_t seqnum; | |
109 | char data[]; | |
110 | } bc; | |
92495593 FD |
111 | }; |
112 | ||
113 | struct lttng_ust_excluder_node { | |
114 | struct cds_list_head node; | |
115 | struct lttng_enabler *enabler; | |
116 | /* | |
117 | * struct lttng_ust_event_exclusion had variable sized array, | |
118 | * must be last field. | |
119 | */ | |
fd17d7ce | 120 | struct lttng_ust_abi_event_exclusion excluder; |
92495593 FD |
121 | }; |
122 | ||
bb7ad29d MJ |
123 | /* Data structures used by the tracer. */ |
124 | ||
125 | struct tp_list_entry { | |
fd17d7ce | 126 | struct lttng_ust_abi_tracepoint_iter tp; |
bb7ad29d MJ |
127 | struct cds_list_head head; |
128 | }; | |
129 | ||
130 | struct lttng_ust_tracepoint_list { | |
131 | struct tp_list_entry *iter; | |
132 | struct cds_list_head head; | |
133 | }; | |
134 | ||
135 | struct tp_field_list_entry { | |
fd17d7ce | 136 | struct lttng_ust_abi_field_iter field; |
bb7ad29d MJ |
137 | struct cds_list_head head; |
138 | }; | |
139 | ||
140 | struct lttng_ust_field_list { | |
141 | struct tp_field_list_entry *iter; | |
142 | struct cds_list_head head; | |
143 | }; | |
144 | ||
145 | /* | |
146 | * Objects in a linked-list of enablers, owned by an event or event_notifier. | |
147 | * This is used because an event (or a event_notifier) can be enabled by more | |
148 | * than one enabler and we want a quick way to iterate over all enablers of an | |
149 | * object. | |
150 | * | |
151 | * For example, event rules "my_app:a*" and "my_app:ab*" will both match the | |
152 | * event with the name "my_app:abc". | |
153 | */ | |
154 | struct lttng_enabler_ref { | |
155 | struct cds_list_head node; /* enabler ref list */ | |
156 | struct lttng_enabler *ref; /* backward ref */ | |
157 | }; | |
158 | ||
159 | #define LTTNG_COUNTER_DIMENSION_MAX 8 | |
160 | struct lttng_counter_dimension { | |
161 | uint64_t size; | |
162 | uint64_t underflow_index; | |
163 | uint64_t overflow_index; | |
164 | uint8_t has_underflow; | |
165 | uint8_t has_overflow; | |
166 | }; | |
167 | ||
b5863ea7 MD |
168 | struct lttng_counter_ops { |
169 | struct lib_counter *(*counter_create)(size_t nr_dimensions, | |
170 | const struct lttng_counter_dimension *dimensions, | |
171 | int64_t global_sum_step, | |
172 | int global_counter_fd, | |
173 | int nr_counter_cpu_fds, | |
174 | const int *counter_cpu_fds, | |
175 | bool is_daemon); | |
176 | void (*counter_destroy)(struct lib_counter *counter); | |
177 | int (*counter_add)(struct lib_counter *counter, | |
178 | const size_t *dimension_indexes, int64_t v); | |
179 | int (*counter_read)(struct lib_counter *counter, | |
180 | const size_t *dimension_indexes, int cpu, | |
181 | int64_t *value, bool *overflow, bool *underflow); | |
182 | int (*counter_aggregate)(struct lib_counter *counter, | |
183 | const size_t *dimension_indexes, int64_t *value, | |
184 | bool *overflow, bool *underflow); | |
185 | int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes); | |
186 | }; | |
187 | ||
bb7ad29d MJ |
188 | struct lttng_counter { |
189 | int objd; | |
190 | struct lttng_event_notifier_group *event_notifier_group; /* owner */ | |
191 | struct lttng_counter_transport *transport; | |
192 | struct lib_counter *counter; | |
193 | struct lttng_counter_ops *ops; | |
194 | }; | |
195 | ||
681f6001 MD |
196 | #define LTTNG_UST_EVENT_HT_BITS 12 |
197 | #define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS) | |
198 | ||
199 | struct lttng_ust_event_ht { | |
200 | struct cds_hlist_head table[LTTNG_UST_EVENT_HT_SIZE]; | |
201 | }; | |
202 | ||
203 | #define LTTNG_UST_EVENT_NOTIFIER_HT_BITS 12 | |
204 | #define LTTNG_UST_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_UST_EVENT_NOTIFIER_HT_BITS) | |
205 | struct lttng_ust_event_notifier_ht { | |
206 | struct cds_hlist_head table[LTTNG_UST_EVENT_NOTIFIER_HT_SIZE]; | |
207 | }; | |
208 | ||
209 | #define LTTNG_UST_ENUM_HT_BITS 12 | |
210 | #define LTTNG_UST_ENUM_HT_SIZE (1U << LTTNG_UST_ENUM_HT_BITS) | |
211 | ||
212 | struct lttng_ust_enum_ht { | |
213 | struct cds_hlist_head table[LTTNG_UST_ENUM_HT_SIZE]; | |
214 | }; | |
215 | ||
bb7ad29d MJ |
216 | struct lttng_event_notifier_group { |
217 | int objd; | |
218 | void *owner; | |
219 | int notification_fd; | |
220 | struct cds_list_head node; /* Event notifier group handle list */ | |
221 | struct cds_list_head enablers_head; | |
222 | struct cds_list_head event_notifiers_head; /* list of event_notifiers */ | |
223 | struct lttng_ust_event_notifier_ht event_notifiers_ht; /* hashtable of event_notifiers */ | |
daacdbfc | 224 | struct lttng_ust_ctx *ctx; /* contexts for filters. */ |
bb7ad29d MJ |
225 | |
226 | struct lttng_counter *error_counter; | |
227 | size_t error_counter_len; | |
228 | }; | |
229 | ||
230 | struct lttng_transport { | |
231 | char *name; | |
232 | struct cds_list_head node; | |
49926dbd | 233 | struct lttng_ust_channel_ops ops; |
bb7ad29d MJ |
234 | const struct lttng_ust_lib_ring_buffer_config *client_config; |
235 | }; | |
236 | ||
237 | struct lttng_counter_transport { | |
238 | char *name; | |
239 | struct cds_list_head node; | |
240 | struct lttng_counter_ops ops; | |
241 | const struct lib_counter_config *client_config; | |
242 | }; | |
243 | ||
80333dfa | 244 | struct lttng_ust_event_common_private { |
7ee76145 | 245 | struct lttng_ust_event_common *pub; /* Public event interface */ |
68bb7559 | 246 | |
dc11f93f | 247 | const struct lttng_ust_event_desc *desc; |
68bb7559 MD |
248 | /* Backward references: list of lttng_enabler_ref (ref to enablers) */ |
249 | struct cds_list_head enablers_ref_head; | |
68bb7559 | 250 | int registered; /* has reg'd tracepoint probe */ |
115db533 | 251 | uint64_t user_token; |
68bb7559 MD |
252 | }; |
253 | ||
2e70391c | 254 | struct lttng_ust_event_recorder_private { |
80333dfa MD |
255 | struct lttng_ust_event_common_private parent; |
256 | ||
2e70391c | 257 | struct lttng_ust_event_recorder *pub; /* Public event interface */ |
ba99fbe2 MD |
258 | struct cds_list_head node; /* Event recorder list */ |
259 | struct cds_hlist_node hlist; /* Hash table of event recorders */ | |
80333dfa MD |
260 | }; |
261 | ||
115db533 MD |
262 | struct lttng_ust_event_notifier_private { |
263 | struct lttng_ust_event_common_private parent; | |
264 | ||
d7d45c0d | 265 | struct lttng_ust_event_notifier *pub; /* Public event notifier interface */ |
115db533 MD |
266 | struct lttng_event_notifier_group *group; /* weak ref */ |
267 | size_t num_captures; /* Needed to allocate the msgpack array. */ | |
268 | uint64_t error_counter_index; | |
ba99fbe2 MD |
269 | struct cds_list_head node; /* Event notifier list */ |
270 | struct cds_hlist_node hlist; /* Hash table of event notifiers */ | |
115db533 MD |
271 | }; |
272 | ||
362a65de MD |
273 | struct lttng_ust_bytecode_runtime_private { |
274 | struct bytecode_runtime *pub; /* Public bytecode runtime interface */ | |
275 | ||
276 | struct lttng_ust_bytecode_node *bc; | |
277 | int link_failed; | |
278 | /* | |
279 | * Pointer to a URCU-protected pointer owned by an `struct | |
280 | * lttng_session`or `struct lttng_event_notifier_group`. | |
281 | */ | |
daacdbfc | 282 | struct lttng_ust_ctx **pctx; |
362a65de MD |
283 | }; |
284 | ||
bdb12629 | 285 | struct lttng_ust_session_private { |
f69fe5fb | 286 | struct lttng_ust_session *pub; /* Public session interface */ |
bdb12629 MD |
287 | |
288 | int been_active; /* Been active ? */ | |
289 | int objd; /* Object associated */ | |
290 | struct cds_list_head chan_head; /* Channel list head */ | |
291 | struct cds_list_head events_head; /* list of events */ | |
292 | struct cds_list_head node; /* Session list */ | |
293 | ||
294 | /* New UST 2.1 */ | |
295 | /* List of enablers */ | |
296 | struct cds_list_head enablers_head; | |
297 | struct lttng_ust_event_ht events_ht; /* ht of events */ | |
298 | void *owner; /* object owner */ | |
299 | int tstate:1; /* Transient enable state */ | |
300 | ||
301 | /* New UST 2.4 */ | |
302 | int statedump_pending:1; | |
303 | ||
304 | /* New UST 2.8 */ | |
305 | struct lttng_ust_enum_ht enums_ht; /* ht of enumerations */ | |
306 | struct cds_list_head enums_head; | |
daacdbfc | 307 | struct lttng_ust_ctx *ctx; /* contexts for filters. */ |
bdb12629 MD |
308 | }; |
309 | ||
036d17fb MD |
310 | struct lttng_enum { |
311 | const struct lttng_ust_enum_desc *desc; | |
f69fe5fb | 312 | struct lttng_ust_session *session; |
036d17fb MD |
313 | struct cds_list_head node; /* Enum list in session */ |
314 | struct cds_hlist_node hlist; /* Session ht of enums */ | |
315 | uint64_t id; /* Enumeration ID in sessiond */ | |
316 | }; | |
317 | ||
d871c65b FD |
318 | static inline |
319 | struct lttng_enabler *lttng_event_enabler_as_enabler( | |
320 | struct lttng_event_enabler *event_enabler) | |
321 | { | |
322 | return &event_enabler->base; | |
323 | } | |
324 | ||
d8d2416d FD |
325 | static inline |
326 | struct lttng_enabler *lttng_event_notifier_enabler_as_enabler( | |
327 | struct lttng_event_notifier_enabler *event_notifier_enabler) | |
328 | { | |
329 | return &event_notifier_enabler->base; | |
330 | } | |
d871c65b FD |
331 | |
332 | /* | |
333 | * Allocate and initialize a `struct lttng_event_enabler` object. | |
334 | * | |
335 | * On success, returns a `struct lttng_event_enabler`, | |
336 | * On memory error, returns NULL. | |
337 | */ | |
ddabe860 | 338 | __attribute__((visibility("hidden"))) |
d871c65b FD |
339 | struct lttng_event_enabler *lttng_event_enabler_create( |
340 | enum lttng_enabler_format_type format_type, | |
fd17d7ce | 341 | struct lttng_ust_abi_event *event_param, |
d871c65b FD |
342 | struct lttng_channel *chan); |
343 | ||
344 | /* | |
345 | * Destroy a `struct lttng_event_enabler` object. | |
346 | */ | |
ddabe860 | 347 | __attribute__((visibility("hidden"))) |
d871c65b FD |
348 | void lttng_event_enabler_destroy(struct lttng_event_enabler *enabler); |
349 | ||
350 | /* | |
351 | * Enable a `struct lttng_event_enabler` object and all events related to this | |
352 | * enabler. | |
353 | */ | |
ddabe860 | 354 | __attribute__((visibility("hidden"))) |
d871c65b FD |
355 | int lttng_event_enabler_enable(struct lttng_event_enabler *enabler); |
356 | ||
357 | /* | |
358 | * Disable a `struct lttng_event_enabler` object and all events related to this | |
359 | * enabler. | |
360 | */ | |
ddabe860 | 361 | __attribute__((visibility("hidden"))) |
d871c65b FD |
362 | int lttng_event_enabler_disable(struct lttng_event_enabler *enabler); |
363 | ||
364 | /* | |
365 | * Attach filter bytecode program to `struct lttng_event_enabler` and all | |
366 | * events related to this enabler. | |
367 | */ | |
ddabe860 | 368 | __attribute__((visibility("hidden"))) |
a56fd376 FD |
369 | int lttng_event_enabler_attach_filter_bytecode( |
370 | struct lttng_event_enabler *enabler, | |
ab89263e | 371 | struct lttng_ust_bytecode_node **bytecode); |
d871c65b FD |
372 | |
373 | /* | |
374 | * Attach an application context to an event enabler. | |
375 | * | |
376 | * Not implemented. | |
377 | */ | |
ddabe860 | 378 | __attribute__((visibility("hidden"))) |
d871c65b | 379 | int lttng_event_enabler_attach_context(struct lttng_event_enabler *enabler, |
fd17d7ce | 380 | struct lttng_ust_abi_context *ctx); |
d871c65b FD |
381 | |
382 | /* | |
383 | * Attach exclusion list to `struct lttng_event_enabler` and all | |
384 | * events related to this enabler. | |
385 | */ | |
ddabe860 | 386 | __attribute__((visibility("hidden"))) |
d871c65b | 387 | int lttng_event_enabler_attach_exclusion(struct lttng_event_enabler *enabler, |
e9fe6aad | 388 | struct lttng_ust_excluder_node **excluder); |
d871c65b FD |
389 | |
390 | /* | |
d37ecb3f FD |
391 | * Synchronize bytecodes for the enabler and the instance (event or |
392 | * event_notifier). | |
d871c65b | 393 | * |
621c07fc | 394 | * This function goes over all bytecode programs of the enabler (event or |
d37ecb3f | 395 | * event_notifier enabler) to ensure each is linked to the provided instance. |
d871c65b | 396 | */ |
ddabe860 | 397 | __attribute__((visibility("hidden"))) |
dc11f93f | 398 | void lttng_enabler_link_bytecode(const struct lttng_ust_event_desc *event_desc, |
daacdbfc | 399 | struct lttng_ust_ctx **ctx, |
621c07fc FD |
400 | struct cds_list_head *instance_bytecode_runtime_head, |
401 | struct cds_list_head *enabler_bytecode_runtime_head); | |
d871c65b | 402 | |
d8d2416d FD |
403 | /* |
404 | * Allocate and initialize a `struct lttng_event_notifier_group` object. | |
405 | * | |
406 | * On success, returns a `struct lttng_triggre_group`, | |
407 | * on memory error, returns NULL. | |
408 | */ | |
ddabe860 | 409 | __attribute__((visibility("hidden"))) |
d8d2416d FD |
410 | struct lttng_event_notifier_group *lttng_event_notifier_group_create(void); |
411 | ||
412 | /* | |
413 | * Destroy a `struct lttng_event_notifier_group` object. | |
414 | */ | |
ddabe860 | 415 | __attribute__((visibility("hidden"))) |
d8d2416d FD |
416 | void lttng_event_notifier_group_destroy( |
417 | struct lttng_event_notifier_group *event_notifier_group); | |
418 | ||
419 | /* | |
420 | * Allocate and initialize a `struct lttng_event_notifier_enabler` object. | |
421 | * | |
422 | * On success, returns a `struct lttng_event_notifier_enabler`, | |
423 | * On memory error, returns NULL. | |
424 | */ | |
ddabe860 | 425 | __attribute__((visibility("hidden"))) |
d8d2416d FD |
426 | struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create( |
427 | struct lttng_event_notifier_group *event_notifier_group, | |
428 | enum lttng_enabler_format_type format_type, | |
fd17d7ce | 429 | struct lttng_ust_abi_event_notifier *event_notifier_param); |
d8d2416d FD |
430 | |
431 | /* | |
432 | * Destroy a `struct lttng_event_notifier_enabler` object. | |
433 | */ | |
ddabe860 | 434 | __attribute__((visibility("hidden"))) |
d8d2416d FD |
435 | void lttng_event_notifier_enabler_destroy( |
436 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
437 | ||
438 | /* | |
439 | * Enable a `struct lttng_event_notifier_enabler` object and all event | |
440 | * notifiers related to this enabler. | |
441 | */ | |
ddabe860 | 442 | __attribute__((visibility("hidden"))) |
d8d2416d FD |
443 | int lttng_event_notifier_enabler_enable( |
444 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
445 | ||
446 | /* | |
447 | * Disable a `struct lttng_event_notifier_enabler` object and all event | |
448 | * notifiers related to this enabler. | |
449 | */ | |
ddabe860 | 450 | __attribute__((visibility("hidden"))) |
d8d2416d FD |
451 | int lttng_event_notifier_enabler_disable( |
452 | struct lttng_event_notifier_enabler *event_notifier_enabler); | |
453 | ||
454 | /* | |
455 | * Attach filter bytecode program to `struct lttng_event_notifier_enabler` and | |
456 | * all event notifiers related to this enabler. | |
457 | */ | |
ddabe860 | 458 | __attribute__((visibility("hidden"))) |
a56fd376 | 459 | int lttng_event_notifier_enabler_attach_filter_bytecode( |
d8d2416d | 460 | struct lttng_event_notifier_enabler *event_notifier_enabler, |
ab89263e | 461 | struct lttng_ust_bytecode_node **bytecode); |
d8d2416d | 462 | |
d37ecb3f FD |
463 | /* |
464 | * Attach capture bytecode program to `struct lttng_event_notifier_enabler` and | |
465 | * all event_notifiers related to this enabler. | |
466 | */ | |
ddabe860 | 467 | __attribute__((visibility("hidden"))) |
d37ecb3f FD |
468 | int lttng_event_notifier_enabler_attach_capture_bytecode( |
469 | struct lttng_event_notifier_enabler *event_notifier_enabler, | |
49cde654 | 470 | struct lttng_ust_bytecode_node **bytecode); |
d37ecb3f | 471 | |
d8d2416d FD |
472 | /* |
473 | * Attach exclusion list to `struct lttng_event_notifier_enabler` and all | |
474 | * event notifiers related to this enabler. | |
475 | */ | |
ddabe860 | 476 | __attribute__((visibility("hidden"))) |
d8d2416d FD |
477 | int lttng_event_notifier_enabler_attach_exclusion( |
478 | struct lttng_event_notifier_enabler *event_notifier_enabler, | |
e9fe6aad | 479 | struct lttng_ust_excluder_node **excluder); |
d8d2416d | 480 | |
ddabe860 | 481 | __attribute__((visibility("hidden"))) |
b1f720f0 | 482 | void lttng_free_event_filter_runtime(struct lttng_ust_event_common *event); |
d8d2416d FD |
483 | |
484 | /* | |
485 | * Connect the probe on all enablers matching this event description. | |
486 | * Called on library load. | |
487 | */ | |
ddabe860 | 488 | __attribute__((visibility("hidden"))) |
d8d2416d FD |
489 | int lttng_fix_pending_event_notifiers(void); |
490 | ||
ddabe860 | 491 | __attribute__((visibility("hidden"))) |
67d4e8f5 MJ |
492 | struct lttng_counter *lttng_ust_counter_create( |
493 | const char *counter_transport_name, | |
494 | size_t number_dimensions, const struct lttng_counter_dimension *dimensions); | |
495 | ||
bd8c1787 MJ |
496 | #ifdef HAVE_PERF_EVENT |
497 | ||
ddabe860 | 498 | __attribute__((visibility("hidden"))) |
bd8c1787 MJ |
499 | int lttng_add_perf_counter_to_ctx(uint32_t type, |
500 | uint64_t config, | |
501 | const char *name, | |
daacdbfc | 502 | struct lttng_ust_ctx **ctx); |
ddabe860 MJ |
503 | |
504 | __attribute__((visibility("hidden"))) | |
bd8c1787 | 505 | int lttng_perf_counter_init(void); |
ddabe860 MJ |
506 | |
507 | __attribute__((visibility("hidden"))) | |
bd8c1787 MJ |
508 | void lttng_perf_counter_exit(void); |
509 | ||
510 | #else /* #ifdef HAVE_PERF_EVENT */ | |
511 | ||
512 | static inline | |
513 | int lttng_add_perf_counter_to_ctx(uint32_t type, | |
514 | uint64_t config, | |
515 | const char *name, | |
daacdbfc | 516 | struct lttng_ust_ctx **ctx) |
bd8c1787 MJ |
517 | { |
518 | return -ENOSYS; | |
519 | } | |
520 | static inline | |
521 | int lttng_perf_counter_init(void) | |
522 | { | |
523 | return 0; | |
524 | } | |
525 | static inline | |
526 | void lttng_perf_counter_exit(void) | |
527 | { | |
528 | } | |
529 | #endif /* #else #ifdef HAVE_PERF_EVENT */ | |
530 | ||
ddabe860 | 531 | __attribute__((visibility("hidden"))) |
7753d283 | 532 | int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list); |
ddabe860 MJ |
533 | |
534 | __attribute__((visibility("hidden"))) | |
7753d283 MJ |
535 | void lttng_probes_prune_event_list(struct lttng_ust_tracepoint_list *list); |
536 | ||
ddabe860 | 537 | __attribute__((visibility("hidden"))) |
7753d283 | 538 | int lttng_probes_get_field_list(struct lttng_ust_field_list *list); |
ddabe860 MJ |
539 | |
540 | __attribute__((visibility("hidden"))) | |
7753d283 MJ |
541 | void lttng_probes_prune_field_list(struct lttng_ust_field_list *list); |
542 | ||
ddabe860 | 543 | __attribute__((visibility("hidden"))) |
fd17d7ce | 544 | struct lttng_ust_abi_tracepoint_iter * |
7753d283 | 545 | lttng_ust_tracepoint_list_get_iter_next(struct lttng_ust_tracepoint_list *list); |
ddabe860 MJ |
546 | |
547 | __attribute__((visibility("hidden"))) | |
fd17d7ce | 548 | struct lttng_ust_abi_field_iter * |
7753d283 MJ |
549 | lttng_ust_field_list_get_iter_next(struct lttng_ust_field_list *list); |
550 | ||
ddabe860 | 551 | __attribute__((visibility("hidden"))) |
f69fe5fb | 552 | struct lttng_ust_session *lttng_session_create(void); |
ddabe860 MJ |
553 | |
554 | __attribute__((visibility("hidden"))) | |
f69fe5fb | 555 | int lttng_session_enable(struct lttng_ust_session *session); |
ddabe860 MJ |
556 | |
557 | __attribute__((visibility("hidden"))) | |
f69fe5fb | 558 | int lttng_session_disable(struct lttng_ust_session *session); |
ddabe860 MJ |
559 | |
560 | __attribute__((visibility("hidden"))) | |
f69fe5fb | 561 | int lttng_session_statedump(struct lttng_ust_session *session); |
ddabe860 MJ |
562 | |
563 | __attribute__((visibility("hidden"))) | |
f69fe5fb | 564 | void lttng_session_destroy(struct lttng_ust_session *session); |
7753d283 | 565 | |
a5ae46cc MJ |
566 | /* |
567 | * Called with ust lock held. | |
568 | */ | |
569 | __attribute__((visibility("hidden"))) | |
570 | int lttng_session_active(void); | |
571 | ||
ddabe860 | 572 | __attribute__((visibility("hidden"))) |
7753d283 MJ |
573 | struct cds_list_head *lttng_get_sessions(void); |
574 | ||
ddabe860 | 575 | __attribute__((visibility("hidden"))) |
7753d283 MJ |
576 | void lttng_handle_pending_statedump(void *owner); |
577 | ||
ddabe860 | 578 | __attribute__((visibility("hidden"))) |
f69fe5fb | 579 | struct lttng_channel *lttng_channel_create(struct lttng_ust_session *session, |
7753d283 MJ |
580 | const char *transport_name, |
581 | void *buf_addr, | |
582 | size_t subbuf_size, size_t num_subbuf, | |
583 | unsigned int switch_timer_interval, | |
584 | unsigned int read_timer_interval, | |
585 | int **shm_fd, int **wait_fd, | |
586 | uint64_t **memory_map_size, | |
587 | struct lttng_channel *chan_priv_init); | |
588 | ||
ddabe860 | 589 | __attribute__((visibility("hidden"))) |
7753d283 | 590 | int lttng_channel_enable(struct lttng_channel *channel); |
ddabe860 MJ |
591 | |
592 | __attribute__((visibility("hidden"))) | |
7753d283 MJ |
593 | int lttng_channel_disable(struct lttng_channel *channel); |
594 | ||
ddabe860 | 595 | __attribute__((visibility("hidden"))) |
7753d283 | 596 | void lttng_transport_register(struct lttng_transport *transport); |
ddabe860 MJ |
597 | |
598 | __attribute__((visibility("hidden"))) | |
7753d283 MJ |
599 | void lttng_transport_unregister(struct lttng_transport *transport); |
600 | ||
65c48d6a MJ |
601 | /* This is ABI between liblttng-ust and liblttng-ust-ctl */ |
602 | struct lttng_transport *lttng_ust_transport_find(const char *name); | |
603 | ||
cbba5e04 MJ |
604 | /* This is ABI between liblttng-ust and liblttng-ust-dl */ |
605 | void lttng_ust_dl_update(void *ip); | |
606 | ||
ddabe860 | 607 | __attribute__((visibility("hidden"))) |
dc11f93f | 608 | void lttng_probe_provider_unregister_events(struct lttng_ust_probe_desc *desc); |
7753d283 | 609 | |
ddabe860 | 610 | __attribute__((visibility("hidden"))) |
7753d283 MJ |
611 | int lttng_fix_pending_events(void); |
612 | ||
ddabe860 | 613 | __attribute__((visibility("hidden"))) |
7753d283 MJ |
614 | struct cds_list_head *lttng_get_probe_list_head(void); |
615 | ||
ddabe860 | 616 | __attribute__((visibility("hidden"))) |
f69fe5fb | 617 | struct lttng_enum *lttng_ust_enum_get_from_desc(struct lttng_ust_session *session, |
891d6b55 | 618 | const struct lttng_ust_enum_desc *enum_desc); |
7753d283 | 619 | |
ddabe860 | 620 | __attribute__((visibility("hidden"))) |
fd17d7ce MD |
621 | int lttng_abi_create_root_handle(void); |
622 | ||
ddabe860 | 623 | __attribute__((visibility("hidden"))) |
fd17d7ce | 624 | const struct lttng_ust_abi_objd_ops *lttng_ust_abi_objd_ops(int id); |
ddabe860 MJ |
625 | |
626 | __attribute__((visibility("hidden"))) | |
fd17d7ce | 627 | int lttng_ust_abi_objd_unref(int id, int is_owner); |
ddabe860 MJ |
628 | |
629 | __attribute__((visibility("hidden"))) | |
fd17d7ce | 630 | void lttng_ust_abi_exit(void); |
ddabe860 MJ |
631 | |
632 | __attribute__((visibility("hidden"))) | |
fd17d7ce | 633 | void lttng_ust_abi_events_exit(void); |
ddabe860 MJ |
634 | |
635 | __attribute__((visibility("hidden"))) | |
fd17d7ce MD |
636 | void lttng_ust_abi_objd_table_owner_cleanup(void *owner); |
637 | ||
d871c65b | 638 | #endif /* _LTTNG_UST_EVENTS_INTERNAL_H */ |