-/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
*
* lttng-syscalls.c
*
#include <linux/stringify.h>
#include <linux/file.h>
#include <linux/anon_inodes.h>
+#include <linux/fcntl.h>
#include <asm/ptrace.h>
#include <asm/syscall.h>
#include <lib/bitfield.h>
-#include <wrapper/tracepoint.h>
-#include <wrapper/file.h>
-#include <wrapper/rcu.h>
-#include <wrapper/syscall.h>
#include <lttng-events.h>
+#include "lttng-tracepoint.h"
+
+#define LTTNG_SYSCALL_NR_ARGS 6
#ifndef CONFIG_COMPAT
# ifndef is_compat_task
* Forward declaration for kernels >= 5.6
*/
struct timex;
+struct timeval;
+struct itimerval;
+struct itimerspec;
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
+typedef __kernel_old_time_t time_t;
+#endif
#ifdef IA32_NR_syscalls
#define NR_compat_syscalls IA32_NR_syscalls
{
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
if (unlikely(in_compat_syscall()))
__event_probe__compat_syscall_entry_unknown(event, id, args);
else
void (*fptr)(void *__data, unsigned long arg0) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, args[0]);
break;
}
unsigned long arg1) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1]);
break;
}
unsigned long arg2) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1], args[2]);
break;
}
unsigned long arg3) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1], args[2], args[3]);
break;
}
unsigned long arg4) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1], args[2], args[3], args[4]);
break;
}
unsigned long arg5) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, args[0], args[1], args[2],
args[3], args[4], args[5]);
break;
{
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
if (unlikely(in_compat_syscall()))
__event_probe__compat_syscall_exit_unknown(event, id, ret,
args);
unsigned long arg0) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0]);
break;
}
unsigned long arg1) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1]);
break;
}
unsigned long arg2) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1], args[2]);
break;
}
unsigned long arg3) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1], args[2], args[3]);
break;
}
unsigned long arg4) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1], args[2], args[3], args[4]);
break;
}
unsigned long arg5) = entry->func;
unsigned long args[LTTNG_SYSCALL_NR_ARGS];
- lttng_syscall_get_arguments(current, regs, args);
+ syscall_get_arguments(current, regs, args);
fptr(event, ret, args[0], args[1], args[2],
args[3], args[4], args[5]);
break;
struct lttng_kernel_event ev;
int ret;
- wrapper_vmalloc_sync_all();
-
if (!chan->sc_table) {
/* create syscall table mapping syscall to events */
chan->sc_table = kzalloc(sizeof(struct lttng_event *)
return ret;
#endif
if (!chan->sys_enter_registered) {
- ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
+ ret = lttng_tracepoint_probe_register("sys_enter",
(void *) syscall_entry_probe, chan);
if (ret)
return ret;
* conflict with sys_exit syscall entry.
*/
if (!chan->sys_exit_registered) {
- ret = lttng_wrapper_tracepoint_probe_register("sys_exit",
+ ret = lttng_tracepoint_probe_register("sys_exit",
(void *) syscall_exit_probe, chan);
if (ret) {
- WARN_ON_ONCE(lttng_wrapper_tracepoint_probe_unregister("sys_enter",
+ WARN_ON_ONCE(lttng_tracepoint_probe_unregister("sys_enter",
(void *) syscall_entry_probe, chan));
return ret;
}
if (!chan->sc_table)
return 0;
if (chan->sys_enter_registered) {
- ret = lttng_wrapper_tracepoint_probe_unregister("sys_enter",
+ ret = lttng_tracepoint_probe_unregister("sys_enter",
(void *) syscall_entry_probe, chan);
if (ret)
return ret;
chan->sys_enter_registered = 0;
}
if (chan->sys_exit_registered) {
- ret = lttng_wrapper_tracepoint_probe_unregister("sys_exit",
+ ret = lttng_tracepoint_probe_unregister("sys_exit",
(void *) syscall_exit_probe, chan);
if (ret)
return ret;
struct file *syscall_list_file;
int file_fd, ret;
- file_fd = lttng_get_unused_fd();
+ file_fd = get_unused_fd_flags(0);
if (file_fd < 0) {
ret = file_fd;
goto fd_error;