Move kprobes, uprobes, kretprobes, syscall structures to internal header
[lttng-modules.git] / include / lttng / events-internal.h
1 /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
2 *
3 * lttng/events-internal.h
4 *
5 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 */
7
8 #ifndef _LTTNG_EVENTS_INTERNAL_H
9 #define _LTTNG_EVENTS_INTERNAL_H
10
11 #include <lttng/events.h>
12
13 enum lttng_enabler_format_type {
14 LTTNG_ENABLER_FORMAT_STAR_GLOB,
15 LTTNG_ENABLER_FORMAT_NAME,
16 };
17
18 /*
19 * Objects in a linked-list of enablers, owned by an event.
20 */
21 struct lttng_enabler_ref {
22 struct list_head node; /* enabler ref list */
23 struct lttng_enabler *ref; /* backward ref */
24 };
25
26 struct lttng_krp; /* Kretprobe handling */
27
28 struct lttng_uprobe_handler {
29 struct lttng_kernel_event_common *event;
30 loff_t offset;
31 struct uprobe_consumer up_consumer;
32 struct list_head node;
33 };
34
35 struct lttng_kprobe {
36 struct kprobe kp;
37 char *symbol_name;
38 };
39
40 struct lttng_uprobe {
41 struct inode *inode;
42 struct list_head head;
43 };
44
45 enum lttng_syscall_entryexit {
46 LTTNG_SYSCALL_ENTRY,
47 LTTNG_SYSCALL_EXIT,
48 };
49
50 enum lttng_syscall_abi {
51 LTTNG_SYSCALL_ABI_NATIVE,
52 LTTNG_SYSCALL_ABI_COMPAT,
53 };
54
55 struct lttng_kernel_event_common_private {
56 struct lttng_kernel_event_common *pub; /* Public event interface */
57
58 const struct lttng_kernel_event_desc *desc;
59 /* Backward references: list of lttng_enabler_ref (ref to enablers) */
60 struct list_head enablers_ref_head;
61 int registered; /* has reg'd tracepoint probe */
62 uint64_t user_token;
63
64 int has_enablers_without_filter_bytecode;
65 /* list of struct lttng_kernel_bytecode_runtime, sorted by seqnum */
66 struct list_head filter_bytecode_runtime_head;
67 enum lttng_kernel_abi_instrumentation instrumentation;
68 /* Selected by instrumentation */
69 union {
70 struct lttng_kprobe kprobe;
71 struct lttng_uprobe uprobe;
72 struct {
73 struct lttng_krp *lttng_krp;
74 char *symbol_name;
75 } kretprobe;
76 struct {
77 enum lttng_syscall_entryexit entryexit;
78 enum lttng_syscall_abi abi;
79 struct hlist_node node; /* chain registered syscall event_notifier */
80 unsigned int syscall_id;
81 } syscall;
82 } u;
83 };
84
85 struct lttng_kernel_event_recorder_private {
86 struct lttng_kernel_event_common_private parent;
87
88 struct lttng_kernel_event_recorder *pub; /* Public event interface */
89 struct list_head node; /* Event recorder list */
90 struct hlist_node hlist; /* Hash table of event recorders */
91 struct lttng_kernel_ctx *ctx;
92 unsigned int id;
93 unsigned int metadata_dumped:1;
94 };
95
96 struct lttng_kernel_event_notifier_private {
97 struct lttng_kernel_event_common_private parent;
98
99 struct lttng_kernel_event_notifier *pub; /* Public event notifier interface */
100 struct lttng_event_notifier_group *group; /* weak ref */
101 size_t num_captures; /* Needed to allocate the msgpack array. */
102 uint64_t error_counter_index;
103 struct list_head node; /* Event notifier list */
104 struct hlist_node hlist; /* Hash table of event notifiers */
105 struct list_head capture_bytecode_runtime_head;
106
107 };
108
109 enum lttng_kernel_bytecode_interpreter_ret {
110 LTTNG_KERNEL_BYTECODE_INTERPRETER_ERROR = -1,
111 LTTNG_KERNEL_BYTECODE_INTERPRETER_OK = 0,
112 };
113
114 enum lttng_kernel_bytecode_filter_result {
115 LTTNG_KERNEL_BYTECODE_FILTER_ACCEPT = 0,
116 LTTNG_KERNEL_BYTECODE_FILTER_REJECT = 1,
117 };
118
119 struct lttng_kernel_bytecode_filter_ctx {
120 enum lttng_kernel_bytecode_filter_result result;
121 };
122
123 struct lttng_interpreter_output;
124
125 enum lttng_kernel_bytecode_type {
126 LTTNG_KERNEL_BYTECODE_TYPE_FILTER,
127 LTTNG_KERNEL_BYTECODE_TYPE_CAPTURE,
128 };
129
130 struct lttng_kernel_bytecode_node {
131 enum lttng_kernel_bytecode_type type;
132 struct list_head node;
133 struct lttng_enabler *enabler;
134 struct {
135 uint32_t len;
136 uint32_t reloc_offset;
137 uint64_t seqnum;
138 char data[];
139 } bc;
140 };
141
142 struct lttng_kernel_bytecode_runtime {
143 /* Associated bytecode */
144 enum lttng_kernel_bytecode_type type;
145 struct lttng_kernel_bytecode_node *bc;
146 int (*interpreter_func)(struct lttng_kernel_bytecode_runtime *kernel_bytecode,
147 const char *interpreter_stack_data,
148 struct lttng_kernel_probe_ctx *lttng_probe_ctx,
149 void *caller_ctx);
150 int link_failed;
151 struct list_head node; /* list of bytecode runtime in event */
152 struct lttng_kernel_ctx *ctx;
153 };
154
155 /*
156 * Enabler field, within whatever object is enabling an event. Target of
157 * backward reference.
158 */
159 struct lttng_enabler {
160 enum lttng_enabler_format_type format_type;
161
162 /* head list of struct lttng_kernel_bytecode_node */
163 struct list_head filter_bytecode_head;
164
165 struct lttng_kernel_abi_event event_param;
166 unsigned int enabled:1;
167
168 uint64_t user_token; /* User-provided token. */
169 };
170
171 struct lttng_event_enabler {
172 struct lttng_enabler base;
173 struct list_head node; /* per-session list of enablers */
174 struct lttng_channel *chan;
175 };
176
177 struct lttng_event_notifier_enabler {
178 struct lttng_enabler base;
179 uint64_t error_counter_index;
180 struct list_head node; /* List of event_notifier enablers */
181 struct lttng_event_notifier_group *group;
182
183 /* head list of struct lttng_kernel_bytecode_node */
184 struct list_head capture_bytecode_head;
185 uint64_t num_captures;
186 };
187
188 struct lttng_ctx_value {
189 union {
190 int64_t s64;
191 const char *str;
192 double d;
193 } u;
194 };
195
196 /*
197 * We need to keep this perf counter field separately from struct
198 * lttng_kernel_ctx_field because cpu hotplug needs fixed-location addresses.
199 */
200 struct lttng_perf_counter_field {
201 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0))
202 struct lttng_cpuhp_node cpuhp_prepare;
203 struct lttng_cpuhp_node cpuhp_online;
204 #else
205 struct notifier_block nb;
206 int hp_enable;
207 #endif
208 struct perf_event_attr *attr;
209 struct perf_event **e; /* per-cpu array */
210 char *name;
211 struct lttng_kernel_event_field *event_field;
212 };
213
214 struct lttng_kernel_ctx_field {
215 const struct lttng_kernel_event_field *event_field;
216 size_t (*get_size)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
217 size_t offset);
218 void (*record)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
219 struct lib_ring_buffer_ctx *ctx,
220 struct lttng_channel *chan);
221 void (*get_value)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
222 struct lttng_ctx_value *value);
223 void (*destroy)(void *priv);
224 void *priv;
225 };
226
227 struct lttng_kernel_ctx {
228 struct lttng_kernel_ctx_field *fields;
229 unsigned int nr_fields;
230 unsigned int allocated_fields;
231 size_t largest_align; /* in bytes */
232 };
233
234 extern struct lttng_kernel_ctx *lttng_static_ctx;
235
236 static inline
237 const struct lttng_kernel_type_integer *lttng_kernel_get_type_integer(const struct lttng_kernel_type_common *type)
238 {
239 if (type->type != lttng_kernel_type_integer)
240 return NULL;
241 return container_of(type, const struct lttng_kernel_type_integer, parent);
242 }
243
244 static inline
245 const struct lttng_kernel_type_string *lttng_kernel_get_type_string(const struct lttng_kernel_type_common *type)
246 {
247 if (type->type != lttng_kernel_type_string)
248 return NULL;
249 return container_of(type, const struct lttng_kernel_type_string, parent);
250 }
251
252 static inline
253 const struct lttng_kernel_type_enum *lttng_kernel_get_type_enum(const struct lttng_kernel_type_common *type)
254 {
255 if (type->type != lttng_kernel_type_enum)
256 return NULL;
257 return container_of(type, const struct lttng_kernel_type_enum, parent);
258 }
259
260 static inline
261 const struct lttng_kernel_type_array *lttng_kernel_get_type_array(const struct lttng_kernel_type_common *type)
262 {
263 if (type->type != lttng_kernel_type_array)
264 return NULL;
265 return container_of(type, const struct lttng_kernel_type_array, parent);
266 }
267
268 static inline
269 const struct lttng_kernel_type_sequence *lttng_kernel_get_type_sequence(const struct lttng_kernel_type_common *type)
270 {
271 if (type->type != lttng_kernel_type_sequence)
272 return NULL;
273 return container_of(type, const struct lttng_kernel_type_sequence, parent);
274 }
275
276 static inline
277 const struct lttng_kernel_type_struct *lttng_kernel_get_type_struct(const struct lttng_kernel_type_common *type)
278 {
279 if (type->type != lttng_kernel_type_struct)
280 return NULL;
281 return container_of(type, const struct lttng_kernel_type_struct, parent);
282 }
283
284 static inline
285 const struct lttng_kernel_type_variant *lttng_kernel_get_type_variant(const struct lttng_kernel_type_common *type)
286 {
287 if (type->type != lttng_kernel_type_variant)
288 return NULL;
289 return container_of(type, const struct lttng_kernel_type_variant, parent);
290 }
291
292 static inline bool lttng_kernel_type_is_bytewise_integer(const struct lttng_kernel_type_common *type)
293 {
294 const struct lttng_kernel_type_integer *type_integer = lttng_kernel_get_type_integer(type);
295
296 if (!type_integer)
297 return false;
298 switch (type_integer->size) {
299 case 8: /* Fall-through. */
300 case 16: /* Fall-through. */
301 case 32: /* Fall-through. */
302 case 64:
303 break;
304 default:
305 return false;
306 }
307 return true;
308 }
309
310 int lttng_kernel_interpret_event_filter(const struct lttng_kernel_event_common *event,
311 const char *interpreter_stack_data,
312 struct lttng_kernel_probe_ctx *probe_ctx,
313 void *event_filter_ctx);
314
315 static inline
316 struct lttng_enabler *lttng_event_enabler_as_enabler(
317 struct lttng_event_enabler *event_enabler)
318 {
319 return &event_enabler->base;
320 }
321
322 static inline
323 struct lttng_enabler *lttng_event_notifier_enabler_as_enabler(
324 struct lttng_event_notifier_enabler *event_notifier_enabler)
325 {
326 return &event_notifier_enabler->base;
327 }
328
329 int lttng_context_init(void);
330 void lttng_context_exit(void);
331 int lttng_kernel_context_append(struct lttng_kernel_ctx **ctx_p,
332 const struct lttng_kernel_ctx_field *f);
333 void lttng_kernel_context_remove_last(struct lttng_kernel_ctx **ctx_p);
334 struct lttng_kernel_ctx_field *lttng_kernel_get_context_field_from_index(struct lttng_kernel_ctx *ctx,
335 size_t index);
336 int lttng_kernel_find_context(struct lttng_kernel_ctx *ctx, const char *name);
337 int lttng_kernel_get_context_index(struct lttng_kernel_ctx *ctx, const char *name);
338 void lttng_kernel_destroy_context(struct lttng_kernel_ctx *ctx);
339 int lttng_add_pid_to_ctx(struct lttng_kernel_ctx **ctx);
340 int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx **ctx);
341 int lttng_add_procname_to_ctx(struct lttng_kernel_ctx **ctx);
342 int lttng_add_prio_to_ctx(struct lttng_kernel_ctx **ctx);
343 int lttng_add_nice_to_ctx(struct lttng_kernel_ctx **ctx);
344 int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx **ctx);
345 int lttng_add_tid_to_ctx(struct lttng_kernel_ctx **ctx);
346 int lttng_add_vtid_to_ctx(struct lttng_kernel_ctx **ctx);
347 int lttng_add_ppid_to_ctx(struct lttng_kernel_ctx **ctx);
348 int lttng_add_vppid_to_ctx(struct lttng_kernel_ctx **ctx);
349 int lttng_add_hostname_to_ctx(struct lttng_kernel_ctx **ctx);
350 int lttng_add_interruptible_to_ctx(struct lttng_kernel_ctx **ctx);
351 int lttng_add_need_reschedule_to_ctx(struct lttng_kernel_ctx **ctx);
352 #if defined(CONFIG_PREEMPT_RT_FULL) || defined(CONFIG_PREEMPT)
353 int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx);
354 #else
355 static inline
356 int lttng_add_preemptible_to_ctx(struct lttng_kernel_ctx **ctx)
357 {
358 return -ENOSYS;
359 }
360 #endif
361 #ifdef CONFIG_PREEMPT_RT_FULL
362 int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx);
363 #else
364 static inline
365 int lttng_add_migratable_to_ctx(struct lttng_kernel_ctx **ctx)
366 {
367 return -ENOSYS;
368 }
369 #endif
370
371 int lttng_add_callstack_to_ctx(struct lttng_kernel_ctx **ctx, int type);
372
373 #if defined(CONFIG_CGROUPS) && \
374 ((LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,6,0)) || \
375 LTTNG_UBUNTU_KERNEL_RANGE(4,4,0,0, 4,5,0,0))
376 int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx);
377 #else
378 static inline
379 int lttng_add_cgroup_ns_to_ctx(struct lttng_kernel_ctx **ctx)
380 {
381 return -ENOSYS;
382 }
383 #endif
384
385 #if defined(CONFIG_IPC_NS) && \
386 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
387 int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx);
388 #else
389 static inline
390 int lttng_add_ipc_ns_to_ctx(struct lttng_kernel_ctx **ctx)
391 {
392 return -ENOSYS;
393 }
394 #endif
395
396 #if !defined(LTTNG_MNT_NS_MISSING_HEADER) && \
397 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
398 int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx);
399 #else
400 static inline
401 int lttng_add_mnt_ns_to_ctx(struct lttng_kernel_ctx **ctx)
402 {
403 return -ENOSYS;
404 }
405 #endif
406
407 #if defined(CONFIG_NET_NS) && \
408 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
409 int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx);
410 #else
411 static inline
412 int lttng_add_net_ns_to_ctx(struct lttng_kernel_ctx **ctx)
413 {
414 return -ENOSYS;
415 }
416 #endif
417
418 #if defined(CONFIG_PID_NS) && \
419 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
420 int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx);
421 #else
422 static inline
423 int lttng_add_pid_ns_to_ctx(struct lttng_kernel_ctx **ctx)
424 {
425 return -ENOSYS;
426 }
427 #endif
428
429 #if defined(CONFIG_USER_NS) && \
430 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
431 int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx);
432 #else
433 static inline
434 int lttng_add_user_ns_to_ctx(struct lttng_kernel_ctx **ctx)
435 {
436 return -ENOSYS;
437 }
438 #endif
439
440 #if defined(CONFIG_UTS_NS) && \
441 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,8,0))
442 int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx);
443 #else
444 static inline
445 int lttng_add_uts_ns_to_ctx(struct lttng_kernel_ctx **ctx)
446 {
447 return -ENOSYS;
448 }
449 #endif
450
451 #if defined(CONFIG_TIME_NS) && \
452 (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
453 int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx);
454 #else
455 static inline
456 int lttng_add_time_ns_to_ctx(struct lttng_kernel_ctx **ctx)
457 {
458 return -ENOSYS;
459 }
460 #endif
461
462 int lttng_add_uid_to_ctx(struct lttng_kernel_ctx **ctx);
463 int lttng_add_euid_to_ctx(struct lttng_kernel_ctx **ctx);
464 int lttng_add_suid_to_ctx(struct lttng_kernel_ctx **ctx);
465 int lttng_add_gid_to_ctx(struct lttng_kernel_ctx **ctx);
466 int lttng_add_egid_to_ctx(struct lttng_kernel_ctx **ctx);
467 int lttng_add_sgid_to_ctx(struct lttng_kernel_ctx **ctx);
468 int lttng_add_vuid_to_ctx(struct lttng_kernel_ctx **ctx);
469 int lttng_add_veuid_to_ctx(struct lttng_kernel_ctx **ctx);
470 int lttng_add_vsuid_to_ctx(struct lttng_kernel_ctx **ctx);
471 int lttng_add_vgid_to_ctx(struct lttng_kernel_ctx **ctx);
472 int lttng_add_vegid_to_ctx(struct lttng_kernel_ctx **ctx);
473 int lttng_add_vsgid_to_ctx(struct lttng_kernel_ctx **ctx);
474
475 #if defined(CONFIG_PERF_EVENTS)
476 int lttng_add_perf_counter_to_ctx(uint32_t type,
477 uint64_t config,
478 const char *name,
479 struct lttng_kernel_ctx **ctx);
480 int lttng_cpuhp_perf_counter_online(unsigned int cpu,
481 struct lttng_cpuhp_node *node);
482 int lttng_cpuhp_perf_counter_dead(unsigned int cpu,
483 struct lttng_cpuhp_node *node);
484 #else
485 static inline
486 int lttng_add_perf_counter_to_ctx(uint32_t type,
487 uint64_t config,
488 const char *name,
489 struct lttng_kernel_ctx **ctx)
490 {
491 return -ENOSYS;
492 }
493 static inline
494 int lttng_cpuhp_perf_counter_online(unsigned int cpu,
495 struct lttng_cpuhp_node *node)
496 {
497 return 0;
498 }
499 static inline
500 int lttng_cpuhp_perf_counter_dead(unsigned int cpu,
501 struct lttng_cpuhp_node *node)
502 {
503 return 0;
504 }
505 #endif
506
507 struct lttng_event_enabler *lttng_event_enabler_create(
508 enum lttng_enabler_format_type format_type,
509 struct lttng_kernel_abi_event *event_param,
510 struct lttng_channel *chan);
511
512 int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler);
513 int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler);
514 struct lttng_event_notifier_enabler *lttng_event_notifier_enabler_create(
515 struct lttng_event_notifier_group *event_notifier_group,
516 enum lttng_enabler_format_type format_type,
517 struct lttng_kernel_abi_event_notifier *event_notifier_param);
518
519 int lttng_event_notifier_enabler_enable(
520 struct lttng_event_notifier_enabler *event_notifier_enabler);
521 int lttng_event_notifier_enabler_disable(
522 struct lttng_event_notifier_enabler *event_notifier_enabler);
523
524 int lttng_event_enabler_attach_filter_bytecode(struct lttng_event_enabler *event_enabler,
525 struct lttng_kernel_abi_filter_bytecode __user *bytecode);
526 int lttng_event_notifier_enabler_attach_filter_bytecode(
527 struct lttng_event_notifier_enabler *event_notifier_enabler,
528 struct lttng_kernel_abi_filter_bytecode __user *bytecode);
529 int lttng_event_notifier_enabler_attach_capture_bytecode(
530 struct lttng_event_notifier_enabler *event_notifier_enabler,
531 struct lttng_kernel_abi_capture_bytecode __user *bytecode);
532
533 int lttng_desc_match_enabler(const struct lttng_kernel_event_desc *desc,
534 struct lttng_enabler *enabler);
535
536 void lttng_enabler_link_bytecode(const struct lttng_kernel_event_desc *event_desc,
537 struct lttng_kernel_ctx *ctx,
538 struct list_head *instance_bytecode_runtime_head,
539 struct list_head *enabler_bytecode_runtime_head);
540
541 #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
542 int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler);
543 int lttng_syscalls_unregister_channel(struct lttng_channel *chan);
544 int lttng_syscalls_destroy_event(struct lttng_channel *chan);
545 int lttng_syscall_filter_enable_event(
546 struct lttng_channel *chan,
547 struct lttng_kernel_event_recorder *event);
548 int lttng_syscall_filter_disable_event(
549 struct lttng_channel *chan,
550 struct lttng_kernel_event_recorder *event);
551
552 long lttng_channel_syscall_mask(struct lttng_channel *channel,
553 struct lttng_kernel_abi_syscall_mask __user *usyscall_mask);
554
555 int lttng_syscalls_register_event_notifier(
556 struct lttng_event_notifier_enabler *event_notifier_enabler);
557 int lttng_syscalls_create_matching_event_notifiers(
558 struct lttng_event_notifier_enabler *event_notifier_enabler);
559 int lttng_syscalls_unregister_event_notifier_group(struct lttng_event_notifier_group *group);
560 int lttng_syscall_filter_enable_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
561 int lttng_syscall_filter_disable_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
562 #else
563 static inline int lttng_syscalls_register_event(
564 struct lttng_event_enabler *event_enabler)
565 {
566 return -ENOSYS;
567 }
568
569 static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan)
570 {
571 return 0;
572 }
573
574 static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
575 {
576 return 0;
577 }
578
579 static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan,
580 struct lttng_kernel_event_recorder *event);
581 {
582 return -ENOSYS;
583 }
584
585 static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan,
586 struct lttng_kernel_event_recorder *event);
587 {
588 return -ENOSYS;
589 }
590
591 static inline long lttng_channel_syscall_mask(struct lttng_channel *channel,
592 struct lttng_kernel_syscall_mask __user *usyscall_mask)
593 {
594 return -ENOSYS;
595 }
596
597 static inline int lttng_syscalls_register_event_notifier(
598 struct lttng_event_notifier_group *group)
599 {
600 return -ENOSYS;
601 }
602
603 static inline int lttng_syscalls_unregister_event_notifier_group(
604 struct lttng_event_notifier_group *group)
605 {
606 return 0;
607 }
608
609 static inline int lttng_syscall_filter_enable_event_notifier(
610 struct lttng_event_notifier_group *group,
611 const char *name)
612 {
613 return -ENOSYS;
614 }
615
616 static inline int lttng_syscall_filter_disable_event_notifier(
617 struct lttng_event_notifier_group *group,
618 const char *name)
619 {
620 return -ENOSYS;
621 }
622
623 #endif
624
625 #ifdef CONFIG_KPROBES
626 int lttng_kprobes_register_event(const char *name,
627 const char *symbol_name,
628 uint64_t offset,
629 uint64_t addr,
630 struct lttng_kernel_event_recorder *event);
631 void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event);
632 void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event);
633 int lttng_kprobes_register_event_notifier(const char *symbol_name,
634 uint64_t offset,
635 uint64_t addr,
636 struct lttng_kernel_event_notifier *event_notifier);
637 void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
638 void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier);
639 #else
640 static inline
641 int lttng_kprobes_register_event(const char *name,
642 const char *symbol_name,
643 uint64_t offset,
644 uint64_t addr,
645 struct lttng_kernel_event_recorder *event)
646 {
647 return -ENOSYS;
648 }
649
650 static inline
651 void lttng_kprobes_unregister_event(struct lttng_kernel_event_recorder *event)
652 {
653 }
654
655 static inline
656 void lttng_kprobes_destroy_event_private(struct lttng_kernel_event_recorder *event)
657 {
658 }
659
660 static inline
661 int lttng_kprobes_register_event_notifier(const char *symbol_name,
662 uint64_t offset,
663 uint64_t addr,
664 struct lttng_kernel_event_notifier *event_notifier)
665 {
666 return -ENOSYS;
667 }
668
669 static inline
670 void lttng_kprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
671 {
672 }
673
674 static inline
675 void lttng_kprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
676 {
677 }
678 #endif
679
680 int lttng_event_add_callsite(struct lttng_kernel_event_common *event,
681 struct lttng_kernel_abi_event_callsite __user *callsite);
682
683 #ifdef CONFIG_UPROBES
684 int lttng_uprobes_register_event(const char *name,
685 int fd, struct lttng_kernel_event_recorder *event);
686 int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event,
687 struct lttng_kernel_abi_event_callsite __user *callsite);
688 void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event);
689 void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event);
690 int lttng_uprobes_register_event_notifier(const char *name,
691 int fd, struct lttng_kernel_event_notifier *event_notifier);
692 void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier);
693 void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier);
694 #else
695 static inline
696 int lttng_uprobes_register_event(const char *name,
697 int fd, struct lttng_kernel_event_recorder *event)
698 {
699 return -ENOSYS;
700 }
701
702 static inline
703 int lttng_uprobes_event_add_callsite(struct lttng_kernel_event_common *event,
704 struct lttng_kernel_abi_event_callsite __user *callsite)
705 {
706 return -ENOSYS;
707 }
708
709 static inline
710 void lttng_uprobes_unregister_event(struct lttng_kernel_event_recorder *event)
711 {
712 }
713
714 static inline
715 void lttng_uprobes_destroy_event_private(struct lttng_kernel_event_recorder *event)
716 {
717 }
718
719 static inline
720 int lttng_uprobes_register_event_notifier(const char *name,
721 int fd, struct lttng_kernel_event_notifier *event_notifier)
722 {
723 return -ENOSYS;
724 }
725
726 static inline
727 void lttng_uprobes_unregister_event_notifier(struct lttng_kernel_event_notifier *event_notifier)
728 {
729 }
730
731 static inline
732 void lttng_uprobes_destroy_event_notifier_private(struct lttng_kernel_event_notifier *event_notifier)
733 {
734 }
735 #endif
736
737 #ifdef CONFIG_KRETPROBES
738 int lttng_kretprobes_register(const char *name,
739 const char *symbol_name,
740 uint64_t offset,
741 uint64_t addr,
742 struct lttng_kernel_event_recorder *event_entry,
743 struct lttng_kernel_event_recorder *event_exit);
744 void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event);
745 void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event);
746 int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event,
747 int enable);
748 #else
749 static inline
750 int lttng_kretprobes_register(const char *name,
751 const char *symbol_name,
752 uint64_t offset,
753 uint64_t addr,
754 struct lttng_kernel_event_recorder *event_entry,
755 struct lttng_kernel_event_recorder *event_exit)
756 {
757 return -ENOSYS;
758 }
759
760 static inline
761 void lttng_kretprobes_unregister(struct lttng_kernel_event_recorder *event)
762 {
763 }
764
765 static inline
766 void lttng_kretprobes_destroy_private(struct lttng_kernel_event_recorder *event)
767 {
768 }
769
770 static inline
771 int lttng_kretprobes_event_enable_state(struct lttng_kernel_event_common *event,
772 int enable)
773 {
774 return -ENOSYS;
775 }
776 #endif
777
778 #define lttng_kernel_static_ctx_field(_event_field, _get_size, _record, _get_value, _destroy, _priv) \
779 __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_ctx_field, { \
780 .event_field = (_event_field), \
781 .get_size = (_get_size), \
782 .record = (_record), \
783 .get_value = (_get_value), \
784 .destroy = (_destroy), \
785 .priv = (_priv), \
786 })
787
788 #endif /* _LTTNG_EVENTS_INTERNAL_H */
This page took 0.045925 seconds and 4 git commands to generate.