Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) |
9f36eaed | 2 | * |
2df37e95 | 3 | * lttng/events.h |
4e3c1b9b | 4 | * |
4e3c1b9b | 5 | * Holds LTTng per-session event registry. |
17baffe2 | 6 | * |
886d51a3 | 7 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
4e3c1b9b MD |
8 | */ |
9 | ||
9f36eaed MJ |
10 | #ifndef _LTTNG_EVENTS_H |
11 | #define _LTTNG_EVENTS_H | |
12 | ||
5f4c791e | 13 | #include <lttng/kernel-version.h> |
4e3c1b9b | 14 | #include <linux/list.h> |
d6d808f3 | 15 | #include <linux/kprobes.h> |
d83004aa | 16 | #include <linux/kref.h> |
41f229dc | 17 | #include <linux/uuid.h> |
754d534a | 18 | #include <linux/irq_work.h> |
149b9a9d | 19 | #include <wrapper/uprobes.h> |
2df37e95 MD |
20 | #include <lttng/cpuhotplug.h> |
21 | #include <lttng/tracer.h> | |
22 | #include <lttng/abi.h> | |
23 | #include <lttng/abi-old.h> | |
24 | #include <lttng/endian.h> | |
4e3c1b9b | 25 | |
e97dc605 | 26 | #define lttng_is_signed_type(type) (((type) -1) < (type) 1) |
9e7e4892 | 27 | |
a90917c3 MD |
28 | struct lttng_channel; |
29 | struct lttng_session; | |
d83004aa | 30 | struct lttng_metadata_cache; |
e27e4381 | 31 | struct lttng_kernel_ring_buffer_ctx; |
ba1f5986 | 32 | struct perf_event; |
833ad6a0 | 33 | struct perf_event_attr; |
3b731ab1 | 34 | struct lib_ring_buffer_config; |
4e3c1b9b | 35 | |
c0edae1d MD |
36 | /* Type description */ |
37 | ||
12bb2edb MD |
38 | enum lttng_kernel_type { |
39 | lttng_kernel_type_integer, | |
40 | lttng_kernel_type_string, | |
437d5aa5 MD |
41 | lttng_kernel_type_enum, |
42 | lttng_kernel_type_array, | |
43 | lttng_kernel_type_sequence, | |
44 | lttng_kernel_type_struct, | |
45 | lttng_kernel_type_variant, | |
12bb2edb | 46 | NR_LTTNG_KERNEL_TYPES, |
c0edae1d MD |
47 | }; |
48 | ||
28cbcb59 MD |
49 | enum lttng_kernel_string_encoding { |
50 | lttng_kernel_string_encoding_none = 0, | |
51 | lttng_kernel_string_encoding_UTF8 = 1, | |
52 | lttng_kernel_string_encoding_ASCII = 2, | |
53 | NR_LTTNG_KERNEL_STRING_ENCODING, | |
c0edae1d MD |
54 | }; |
55 | ||
d83004aa JD |
56 | enum channel_type { |
57 | PER_CPU_CHANNEL, | |
58 | METADATA_CHANNEL, | |
59 | }; | |
60 | ||
a28cc520 | 61 | struct lttng_kernel_enum_value { |
141ddf28 MD |
62 | unsigned long long value; |
63 | unsigned int signedness:1; | |
64 | }; | |
65 | ||
a28cc520 MD |
66 | struct lttng_kernel_enum_entry { |
67 | struct lttng_kernel_enum_value start, end; /* start and end are inclusive */ | |
c0edae1d | 68 | const char *string; |
08ad1061 PP |
69 | struct { |
70 | unsigned int is_auto:1; | |
71 | } options; | |
c0edae1d MD |
72 | }; |
73 | ||
437d5aa5 MD |
74 | /* |
75 | * struct lttng_kernel_type_common is fixed-size. Its children inherits | |
76 | * from it by embedding struct lttng_kernel_type_common as its first field. | |
77 | */ | |
78 | struct lttng_kernel_type_common { | |
79 | enum lttng_kernel_type type; | |
80 | }; | |
81 | ||
82 | struct lttng_kernel_type_integer { | |
83 | struct lttng_kernel_type_common parent; | |
c099397a MD |
84 | unsigned int size; /* in bits */ |
85 | unsigned short alignment; /* in bits */ | |
9cccf98a MD |
86 | unsigned int signedness:1, |
87 | reverse_byte_order:1; | |
e0a7a7c4 | 88 | unsigned int base; /* 2, 8, 10, 16, for pretty print */ |
437d5aa5 MD |
89 | }; |
90 | ||
91 | struct lttng_kernel_type_string { | |
92 | struct lttng_kernel_type_common parent; | |
28cbcb59 | 93 | enum lttng_kernel_string_encoding encoding; |
c099397a MD |
94 | }; |
95 | ||
437d5aa5 MD |
96 | struct lttng_kernel_type_enum { |
97 | struct lttng_kernel_type_common parent; | |
98 | const struct lttng_kernel_enum_desc *desc; /* Enumeration mapping */ | |
99 | const struct lttng_kernel_type_common *container_type; | |
100 | }; | |
101 | ||
102 | struct lttng_kernel_type_array { | |
103 | struct lttng_kernel_type_common parent; | |
104 | const struct lttng_kernel_type_common *elem_type; | |
105 | unsigned int length; /* Num. elems. */ | |
106 | unsigned int alignment; | |
107 | enum lttng_kernel_string_encoding encoding; | |
108 | }; | |
109 | ||
110 | struct lttng_kernel_type_sequence { | |
111 | struct lttng_kernel_type_common parent; | |
f0039724 | 112 | const char *length_name; /* Length field name. If NULL, use previous field. */ |
437d5aa5 MD |
113 | const struct lttng_kernel_type_common *elem_type; |
114 | unsigned int alignment; /* Alignment before elements. */ | |
115 | enum lttng_kernel_string_encoding encoding; | |
116 | }; | |
117 | ||
118 | struct lttng_kernel_type_struct { | |
119 | struct lttng_kernel_type_common parent; | |
120 | unsigned int nr_fields; | |
121 | const struct lttng_kernel_event_field **fields; /* Array of pointers to fields. */ | |
122 | unsigned int alignment; | |
123 | }; | |
124 | ||
125 | struct lttng_kernel_type_variant { | |
126 | struct lttng_kernel_type_common parent; | |
f0039724 | 127 | const char *tag_name; /* Tag field name. If NULL, use previous field. */ |
437d5aa5 MD |
128 | const struct lttng_kernel_event_field **choices; /* Array of pointers to fields. */ |
129 | unsigned int nr_choices; | |
130 | unsigned int alignment; | |
c099397a MD |
131 | }; |
132 | ||
d96a4a7a | 133 | struct lttng_kernel_enum_desc { |
c099397a | 134 | const char *name; |
437d5aa5 | 135 | const struct lttng_kernel_enum_entry **entries; |
141ddf28 | 136 | unsigned int nr_entries; |
c099397a | 137 | }; |
c0edae1d MD |
138 | |
139 | /* Event field description */ | |
140 | ||
437d5aa5 | 141 | struct lttng_kernel_event_field { |
c0edae1d | 142 | const char *name; |
437d5aa5 | 143 | const struct lttng_kernel_type_common *type; |
f127e61e | 144 | unsigned int nowrite:1, /* do not write into trace */ |
ceabb767 MD |
145 | user:1, /* fetch from user-space */ |
146 | nofilter:1; /* do not consider for filter */ | |
c0edae1d MD |
147 | }; |
148 | ||
437d5aa5 MD |
149 | #define lttng_kernel_static_type_integer(_size, _alignment, _signedness, _byte_order, _base) \ |
150 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_integer, { \ | |
151 | .parent = { \ | |
152 | .type = lttng_kernel_type_integer, \ | |
153 | }, \ | |
154 | .size = (_size), \ | |
155 | .alignment = (_alignment), \ | |
156 | .signedness = (_signedness), \ | |
157 | .reverse_byte_order = (_byte_order) != __BYTE_ORDER, \ | |
158 | .base = (_base), \ | |
159 | })) | |
160 | ||
161 | #define lttng_kernel_static_type_integer_from_type(_type, _byte_order, _base) \ | |
162 | lttng_kernel_static_type_integer(sizeof(_type) * CHAR_BIT, \ | |
163 | lttng_alignof(_type) * CHAR_BIT, \ | |
164 | lttng_is_signed_type(_type), \ | |
165 | _byte_order, \ | |
166 | _base) | |
167 | ||
168 | #define lttng_kernel_static_type_enum(_desc, _container_type) \ | |
169 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_enum, { \ | |
170 | .parent = { \ | |
171 | .type = lttng_kernel_type_enum, \ | |
172 | }, \ | |
173 | .desc = (_desc), \ | |
174 | .container_type = (_container_type), \ | |
175 | })) | |
176 | ||
177 | #define lttng_kernel_static_type_array(_length, _elem_type, _alignment, _encoding) \ | |
178 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_array, { \ | |
179 | .parent = { \ | |
180 | .type = lttng_kernel_type_array, \ | |
181 | }, \ | |
182 | .length = (_length), \ | |
183 | .alignment = (_alignment), \ | |
184 | .encoding = lttng_kernel_string_encoding_##_encoding, \ | |
185 | .elem_type = (_elem_type), \ | |
186 | })) | |
187 | ||
188 | #define lttng_kernel_static_type_array_text(_length) \ | |
189 | lttng_kernel_static_type_array(_length, \ | |
190 | lttng_kernel_static_type_integer(sizeof(char) * CHAR_BIT, \ | |
191 | lttng_alignof(char) * CHAR_BIT, lttng_is_signed_type(char), \ | |
192 | __BYTE_ORDER, 10), \ | |
193 | 0, UTF8) | |
194 | ||
195 | #define lttng_kernel_static_type_sequence(_length_name, _elem_type, _alignment, _encoding) \ | |
196 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_sequence, { \ | |
197 | .parent = { \ | |
198 | .type = lttng_kernel_type_sequence, \ | |
199 | }, \ | |
200 | .length_name = (_length_name), \ | |
201 | .alignment = (_alignment), \ | |
202 | .encoding = lttng_kernel_string_encoding_##_encoding, \ | |
203 | .elem_type = (_elem_type), \ | |
204 | })) | |
205 | ||
206 | #define lttng_kernel_static_type_string(_encoding) \ | |
207 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_string, { \ | |
208 | .parent = { \ | |
209 | .type = lttng_kernel_type_string, \ | |
210 | }, \ | |
211 | .encoding = lttng_kernel_string_encoding_##_encoding, \ | |
212 | })) | |
213 | ||
214 | #define lttng_kernel_static_type_struct(_nr_fields, _fields, _alignment) \ | |
215 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_struct, { \ | |
216 | .parent = { \ | |
217 | .type = lttng_kernel_type_struct, \ | |
218 | }, \ | |
219 | .nr_fields = (_nr_fields), \ | |
220 | .fields = _fields, \ | |
221 | .alignment = (_alignment), \ | |
222 | })) | |
223 | ||
224 | #define lttng_kernel_static_type_variant(_nr_choices, _choices, _tag_name, _alignment) \ | |
225 | ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_variant, { \ | |
226 | .parent = { \ | |
227 | .type = lttng_kernel_type_variant, \ | |
228 | }, \ | |
229 | .tag_name = (_tag_name), \ | |
230 | .choices = _choices, \ | |
231 | .nr_choices = (_nr_choices), \ | |
232 | .alignment = (_alignment), \ | |
233 | })) | |
234 | ||
235 | #define lttng_kernel_static_event_field(_name, _type, _nowrite, _user, _nofilter) \ | |
236 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field, { \ | |
237 | .name = (_name), \ | |
238 | .type = (_type), \ | |
239 | .nowrite = (_nowrite), \ | |
240 | .user = (_user), \ | |
241 | .nofilter = (_nofilter), \ | |
242 | }) | |
243 | ||
244 | #define lttng_kernel_static_event_field_array(_fields...) \ | |
245 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_event_field *, \ | |
246 | _fields \ | |
247 | ) | |
248 | ||
437d5aa5 MD |
249 | #define lttng_kernel_static_enum_entry_value(_string, _value) \ |
250 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \ | |
251 | .start = { \ | |
252 | .signedness = lttng_is_signed_type(__typeof__(_value)), \ | |
253 | .value = lttng_is_signed_type(__typeof__(_value)) ? \ | |
254 | (long long) (_value) : (_value), \ | |
255 | }, \ | |
256 | .end = { \ | |
257 | .signedness = lttng_is_signed_type(__typeof__(_value)), \ | |
258 | .value = lttng_is_signed_type(__typeof__(_value)) ? \ | |
259 | (long long) (_value) : (_value), \ | |
260 | }, \ | |
261 | .string = (_string), \ | |
262 | }), | |
263 | ||
264 | #define lttng_kernel_static_enum_entry_range(_string, _range_start, _range_end) \ | |
265 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \ | |
266 | .start = { \ | |
267 | .signedness = lttng_is_signed_type(__typeof__(_range_start)), \ | |
268 | .value = lttng_is_signed_type(__typeof__(_range_start)) ? \ | |
269 | (long long) (_range_start) : (_range_start), \ | |
270 | }, \ | |
271 | .end = { \ | |
272 | .signedness = lttng_is_signed_type(__typeof__(_range_end)), \ | |
273 | .value = lttng_is_signed_type(__typeof__(_range_end)) ? \ | |
274 | (long long) (_range_end) : (_range_end), \ | |
275 | }, \ | |
276 | .string = (_string), \ | |
277 | }), | |
278 | ||
279 | #define lttng_kernel_static_enum_entry_auto(_string) \ | |
280 | __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_enum_entry, { \ | |
281 | .start = { \ | |
282 | .signedness = -1, \ | |
283 | .value = -1, \ | |
284 | }, \ | |
285 | .end = { \ | |
286 | .signedness = -1, \ | |
287 | .value = -1, \ | |
288 | }, \ | |
289 | .string = (_string), \ | |
290 | .options = { \ | |
291 | .is_auto = 1, \ | |
292 | } \ | |
293 | }), | |
294 | ||
346cb5ee | 295 | struct lttng_kernel_probe_ctx { |
e2d5dbc7 | 296 | struct lttng_kernel_event_common *event; |
79150a49 JD |
297 | uint8_t interruptible; |
298 | }; | |
299 | ||
437d5aa5 MD |
300 | struct lttng_kernel_event_desc { |
301 | const char *event_name; /* lttng-modules name */ | |
302 | const char *event_kname; /* Linux kernel name (tracepoints) */ | |
303 | const struct lttng_kernel_probe_desc *probe_desc; | |
304 | void (*probe_callback)(void); | |
305 | const struct lttng_kernel_event_field **fields; /* event payload */ | |
c0edae1d | 306 | unsigned int nr_fields; |
dc7f600a | 307 | struct module *owner; |
c0edae1d MD |
308 | }; |
309 | ||
437d5aa5 MD |
310 | struct lttng_kernel_probe_desc { |
311 | const char *provider_name; | |
312 | const struct lttng_kernel_event_desc **event_desc; | |
85a9ca7f MD |
313 | unsigned int nr_events; |
314 | struct list_head head; /* chain registered probes */ | |
3c997079 MD |
315 | struct list_head lazy_init_head; |
316 | int lazy; /* lazy registration */ | |
85a9ca7f MD |
317 | }; |
318 | ||
8a445457 MD |
319 | /* |
320 | * Result of the run_filter() callback. | |
321 | */ | |
322 | enum lttng_kernel_event_filter_result { | |
323 | LTTNG_KERNEL_EVENT_FILTER_ACCEPT = 0, | |
324 | LTTNG_KERNEL_EVENT_FILTER_REJECT = 1, | |
325 | }; | |
326 | ||
a67ba386 MD |
327 | struct lttng_kernel_event_common_private; |
328 | ||
329 | enum lttng_kernel_event_type { | |
330 | LTTNG_KERNEL_EVENT_TYPE_RECORDER = 0, | |
331 | LTTNG_KERNEL_EVENT_TYPE_NOTIFIER = 1, | |
332 | }; | |
333 | ||
334 | struct lttng_kernel_event_common { | |
335 | struct lttng_kernel_event_common_private *priv; /* Private event interface */ | |
336 | ||
337 | enum lttng_kernel_event_type type; | |
338 | /* Get child with container_of(). */ | |
339 | ||
e64957da | 340 | int enabled; |
a67ba386 | 341 | int eval_filter; /* Need to evaluate filters */ |
8a445457 | 342 | int (*run_filter)(const struct lttng_kernel_event_common *event, |
a67ba386 | 343 | const char *stack_data, |
346cb5ee | 344 | struct lttng_kernel_probe_ctx *probe_ctx, |
a67ba386 | 345 | void *filter_ctx); |
3c997079 MD |
346 | }; |
347 | ||
a67ba386 MD |
348 | struct lttng_kernel_event_recorder_private; |
349 | ||
350 | struct lttng_kernel_event_recorder { | |
351 | struct lttng_kernel_event_common parent; | |
352 | struct lttng_kernel_event_recorder_private *priv; /* Private event record interface */ | |
353 | ||
354 | struct lttng_channel *chan; | |
c3eddb2e MD |
355 | }; |
356 | ||
a67ba386 MD |
357 | struct lttng_kernel_notification_ctx { |
358 | int eval_capture; /* Capture evaluation available. */ | |
359 | }; | |
dffef45d | 360 | |
a67ba386 | 361 | struct lttng_kernel_event_notifier_private; |
8a8ac9a8 | 362 | |
a67ba386 MD |
363 | struct lttng_kernel_event_notifier { |
364 | struct lttng_kernel_event_common parent; | |
365 | struct lttng_kernel_event_notifier_private *priv; /* Private event notifier interface */ | |
dffef45d | 366 | |
a67ba386 MD |
367 | int eval_capture; /* Need to evaluate capture */ |
368 | void (*notification_send)(struct lttng_kernel_event_notifier *event_notifier, | |
a67ba386 | 369 | const char *stack_data, |
346cb5ee | 370 | struct lttng_kernel_probe_ctx *probe_ctx, |
a67ba386 | 371 | struct lttng_kernel_notification_ctx *notif_ctx); |
dffef45d FD |
372 | }; |
373 | ||
da1fe18f MD |
374 | struct lttng_kernel_channel_buffer_ops { |
375 | struct lttng_kernel_channel_buffer_ops_private *priv; /* Private channel buffer ops interface. */ | |
376 | ||
e27e4381 MD |
377 | int (*event_reserve)(struct lttng_kernel_ring_buffer_ctx *ctx); |
378 | void (*event_commit)(struct lttng_kernel_ring_buffer_ctx *ctx); | |
379 | void (*event_write)(struct lttng_kernel_ring_buffer_ctx *ctx, const void *src, | |
85a9ca7f | 380 | size_t len); |
e27e4381 | 381 | void (*event_write_from_user)(struct lttng_kernel_ring_buffer_ctx *ctx, |
4ea00e4f | 382 | const void *src, size_t len); |
e27e4381 | 383 | void (*event_memset)(struct lttng_kernel_ring_buffer_ctx *ctx, |
58aa5d24 | 384 | int c, size_t len); |
e27e4381 | 385 | void (*event_strcpy)(struct lttng_kernel_ring_buffer_ctx *ctx, const char *src, |
16f78f3a | 386 | size_t len); |
e27e4381 | 387 | void (*event_strcpy_from_user)(struct lttng_kernel_ring_buffer_ctx *ctx, |
16f78f3a | 388 | const char __user *src, size_t len); |
85a9ca7f MD |
389 | }; |
390 | ||
80f87dd2 MD |
391 | struct lttng_syscall_filter; |
392 | ||
3c997079 MD |
393 | #define LTTNG_EVENT_HT_BITS 12 |
394 | #define LTTNG_EVENT_HT_SIZE (1U << LTTNG_EVENT_HT_BITS) | |
395 | ||
396 | struct lttng_event_ht { | |
397 | struct hlist_head table[LTTNG_EVENT_HT_SIZE]; | |
398 | }; | |
399 | ||
dffef45d FD |
400 | #define LTTNG_EVENT_NOTIFIER_HT_BITS 12 |
401 | #define LTTNG_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_EVENT_NOTIFIER_HT_BITS) | |
402 | ||
403 | struct lttng_event_notifier_ht { | |
404 | struct hlist_head table[LTTNG_EVENT_NOTIFIER_HT_SIZE]; | |
405 | }; | |
406 | ||
a90917c3 | 407 | struct lttng_channel { |
c099397a | 408 | unsigned int id; |
85a9ca7f | 409 | struct channel *chan; /* Channel buffers */ |
e64957da | 410 | int enabled; |
437d5aa5 | 411 | struct lttng_kernel_ctx *ctx; |
85a9ca7f | 412 | /* Event ID management */ |
a90917c3 | 413 | struct lttng_session *session; |
85a9ca7f MD |
414 | struct file *file; /* File associated to channel */ |
415 | unsigned int free_event_id; /* Next event ID to allocate */ | |
416 | struct list_head list; /* Channel list */ | |
da1fe18f | 417 | struct lttng_kernel_channel_buffer_ops *ops; |
a90917c3 | 418 | struct lttng_transport *transport; |
3b82c4e1 MD |
419 | struct hlist_head *sc_table; /* for syscall tracing */ |
420 | struct hlist_head *compat_sc_table; | |
421 | struct hlist_head *sc_exit_table; /* for syscall exit tracing */ | |
422 | struct hlist_head *compat_sc_exit_table; | |
423 | struct hlist_head sc_unknown; /* for unknown syscalls */ | |
424 | struct hlist_head sc_compat_unknown; | |
425 | struct hlist_head sc_exit_unknown; | |
426 | struct hlist_head compat_sc_exit_unknown; | |
80f87dd2 | 427 | struct lttng_syscall_filter *sc_filter; |
9115fbdc | 428 | int header_type; /* 0: unset, 1: compact, 2: large */ |
d83004aa | 429 | enum channel_type channel_type; |
3b82c4e1 MD |
430 | int syscall_all_entry; |
431 | int syscall_all_exit; | |
80f87dd2 MD |
432 | unsigned int metadata_dumped:1, |
433 | sys_enter_registered:1, | |
434 | sys_exit_registered:1, | |
3c997079 | 435 | tstate:1; /* Transient enable state */ |
85a9ca7f MD |
436 | }; |
437 | ||
114667d5 MD |
438 | #define LTTNG_DYNAMIC_LEN_STACK_SIZE 128 |
439 | ||
440 | struct lttng_dynamic_len_stack { | |
441 | size_t stack[LTTNG_DYNAMIC_LEN_STACK_SIZE]; | |
442 | size_t offset; | |
443 | }; | |
444 | ||
445 | DECLARE_PER_CPU(struct lttng_dynamic_len_stack, lttng_dynamic_len_stack); | |
e0130fab MD |
446 | |
447 | /* | |
d1f652f8 | 448 | * struct lttng_id_tracker declared in header due to deferencing of *v |
e0130fab MD |
449 | * in RCU_INITIALIZER(v). |
450 | */ | |
d1f652f8 MD |
451 | #define LTTNG_ID_HASH_BITS 6 |
452 | #define LTTNG_ID_TABLE_SIZE (1 << LTTNG_ID_HASH_BITS) | |
e0130fab | 453 | |
d1f652f8 MD |
454 | enum tracker_type { |
455 | TRACKER_PID, | |
456 | TRACKER_VPID, | |
457 | TRACKER_UID, | |
458 | TRACKER_VUID, | |
459 | TRACKER_GID, | |
460 | TRACKER_VGID, | |
461 | ||
462 | TRACKER_UNKNOWN, | |
463 | }; | |
464 | ||
465 | struct lttng_id_tracker_rcu { | |
466 | struct hlist_head id_hash[LTTNG_ID_TABLE_SIZE]; | |
467 | }; | |
468 | ||
469 | struct lttng_id_tracker { | |
470 | struct lttng_session *session; | |
471 | enum tracker_type tracker_type; | |
472 | struct lttng_id_tracker_rcu *p; /* RCU dereferenced. */ | |
e0130fab MD |
473 | }; |
474 | ||
d1f652f8 | 475 | struct lttng_id_hash_node { |
7e6f9ef6 | 476 | struct hlist_node hlist; |
d1f652f8 | 477 | int id; |
7e6f9ef6 MD |
478 | }; |
479 | ||
a90917c3 | 480 | struct lttng_session { |
85a9ca7f | 481 | int active; /* Is trace session active ? */ |
8070f5c0 | 482 | int been_active; /* Has trace session been active ? */ |
85a9ca7f MD |
483 | struct file *file; /* File associated to session */ |
484 | struct list_head chan; /* Channel list head */ | |
485 | struct list_head events; /* Event list head */ | |
486 | struct list_head list; /* Session list */ | |
c099397a | 487 | unsigned int free_chan_id; /* Next chan ID to allocate */ |
d793d5e1 | 488 | uuid_le uuid; /* Trace session unique ID */ |
d83004aa | 489 | struct lttng_metadata_cache *metadata_cache; |
d1f652f8 MD |
490 | struct lttng_id_tracker pid_tracker; |
491 | struct lttng_id_tracker vpid_tracker; | |
492 | struct lttng_id_tracker uid_tracker; | |
493 | struct lttng_id_tracker vuid_tracker; | |
494 | struct lttng_id_tracker gid_tracker; | |
495 | struct lttng_id_tracker vgid_tracker; | |
3c997079 MD |
496 | unsigned int metadata_dumped:1, |
497 | tstate:1; /* Transient enable state */ | |
b2bc0bc8 | 498 | /* List of event enablers */ |
3c997079 MD |
499 | struct list_head enablers_head; |
500 | /* Hash table of events */ | |
501 | struct lttng_event_ht events_ht; | |
606828e4 MD |
502 | char name[LTTNG_KERNEL_ABI_SESSION_NAME_LEN]; |
503 | char creation_time[LTTNG_KERNEL_ABI_SESSION_CREATION_TIME_ISO8601_LEN]; | |
85a9ca7f MD |
504 | }; |
505 | ||
c93ed3b0 MD |
506 | int lttng_kernel_probe_register(struct lttng_kernel_probe_desc *desc); |
507 | void lttng_kernel_probe_unregister(struct lttng_kernel_probe_desc *desc); | |
d83004aa | 508 | |
d1f652f8 | 509 | bool lttng_id_tracker_lookup(struct lttng_id_tracker_rcu *p, int id); |
271b6681 | 510 | |
a90917c3 | 511 | #endif /* _LTTNG_EVENTS_H */ |