| 1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) |
| 2 | * |
| 3 | * lttng-syscalls.h |
| 4 | * |
| 5 | * LTTng syscall header. |
| 6 | * |
| 7 | * Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com> |
| 8 | */ |
| 9 | |
| 10 | #ifndef LTTNG_SYSCALLS_H |
| 11 | #define LTTNG_SYSCALLS_H |
| 12 | |
| 13 | #include <asm/ptrace.h> |
| 14 | #include <linux/compat.h> |
| 15 | #include <linux/fcntl.h> |
| 16 | #include <linux/in.h> |
| 17 | #include <linux/in6.h> |
| 18 | #include <linux/mman.h> |
| 19 | #include <linux/posix_types.h> |
| 20 | |
| 21 | #include <lttng/events.h> |
| 22 | #include <lttng/kernel-version.h> |
| 23 | |
| 24 | /* |
| 25 | * Forward declarations allowing LTTng to build its system call instrumentation |
| 26 | * against old kernels which do not declare the more recent system call |
| 27 | * argument structure types. |
| 28 | */ |
| 29 | struct clone_args; |
| 30 | struct file_handle; |
| 31 | struct futex_waitv; |
| 32 | struct io_uring_params; |
| 33 | struct mmap_arg_struct; |
| 34 | struct mmsghdr; |
| 35 | struct mount_attr; |
| 36 | struct oldold_utsname; |
| 37 | struct old_utsname; |
| 38 | struct old_itimerspec32; |
| 39 | struct old_timespec32; |
| 40 | struct old_timeval32; |
| 41 | struct old_timex32; |
| 42 | struct old_utimbuf32; |
| 43 | struct open_how; |
| 44 | struct rlimit64; |
| 45 | struct rseq; |
| 46 | struct sched_attr; |
| 47 | struct sel_arg_struct; |
| 48 | struct statx; |
| 49 | struct user_msghdr; |
| 50 | |
| 51 | struct __aio_sigset; |
| 52 | struct __kernel_old_itimerval; |
| 53 | struct __kernel_timespec; |
| 54 | struct __kernel_timex; |
| 55 | struct __kernel_old_timeval; |
| 56 | struct __kernel_itimerspec; |
| 57 | |
| 58 | union bpf_attr; |
| 59 | |
| 60 | #ifndef __kernel_long_t |
| 61 | typedef long __kernel_long_t; |
| 62 | #endif |
| 63 | |
| 64 | typedef __kernel_long_t __kernel_old_time_t; |
| 65 | typedef int __bitwise __kernel_rwf_t; |
| 66 | typedef __kernel_rwf_t rwf_t; |
| 67 | typedef s32 old_time32_t; |
| 68 | |
| 69 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) |
| 70 | /* |
| 71 | * Forward declaration and typedef for old types expected by MIPS and POWER |
| 72 | * system call instrumentation when building against kernel >= 5.6.0. To be |
| 73 | * removed after those system call instrumentation headers are regenerated |
| 74 | * against a recent kernel. |
| 75 | */ |
| 76 | typedef __kernel_old_time_t time_t; |
| 77 | |
| 78 | struct itimerspec; |
| 79 | struct itimerval; |
| 80 | struct timeval; |
| 81 | struct timex; |
| 82 | #endif |
| 83 | |
| 84 | struct trace_syscall_entry { |
| 85 | void *event_func; |
| 86 | const struct lttng_kernel_event_desc *desc; |
| 87 | const struct lttng_kernel_event_field * const *fields; |
| 88 | unsigned int nrargs; |
| 89 | }; |
| 90 | |
| 91 | struct trace_syscall_table { |
| 92 | const struct trace_syscall_entry *table; |
| 93 | const size_t len; |
| 94 | }; |
| 95 | |
| 96 | extern |
| 97 | void syscall_entry_event_probe(void *__data, struct pt_regs *regs, long id); |
| 98 | |
| 99 | extern |
| 100 | void syscall_exit_event_probe(void *__data, struct pt_regs *regs, long ret); |
| 101 | |
| 102 | extern |
| 103 | void syscall_entry_event_notifier_probe(void *__data, struct pt_regs *regs, |
| 104 | long id); |
| 105 | extern |
| 106 | void syscall_exit_event_notifier_probe(void *__data, struct pt_regs *regs, |
| 107 | long ret); |
| 108 | |
| 109 | #endif /* LTTNG_SYSCALLS_H */ |