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