/* See LICENSE file for copyright and license details. */ #define REQUIRE_FLEXABLE_OR_NPARAMS #include "../common.h" #include "../generated/linux-syscall-table.h" #include "../generated/linux-syscalls.h" #if defined(__GNUC__) # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wunused-variable" /* unused = not available on any architecutre the library is being compiled for */ #endif #include "syscalls.h" #if defined(__GNUC__) # pragma GCC diagnostic pop #endif /* generated/linux-syscall-dedup.h removes references to duplicate symbols, then compiler optimisation removes them */ #if defined(__clang__) # pragma clang diagnostic ignored "-Wunused-const-variable" #elif defined(__GNUC__) # pragma GCC diagnostic ignored "-Wunused-const-variable" #endif #define MAKE_SYSCALL_WITHOUT_COMPAT(ARCH, NR, NAME, ACTUAL)\ static const struct libsyscalls_syscall linux_##ARCH##_syscall_##NAME = {\ .name = #NAME,\ .actual_syscall = &linux_syscall_##ACTUAL,\ .actual_compat_syscall = NULL\ } #define MAKE_SYSCALL_WITH_COMPAT(ARCH, NR, NAME, ACTUAL, COMPAT)\ static const struct libsyscalls_syscall linux_##ARCH##_syscall_##NAME = {\ .name = #NAME,\ .actual_syscall = &linux_syscall_##ACTUAL,\ .actual_compat_syscall = &linux_syscall_##COMPAT\ } #define X(ARCH)\ LIST_LINUX_SYSCALLS_FOR_##ARCH(MAKE_##ARCH##_SYSCALL_WITHOUT_COMPAT, MAKE_##ARCH##_SYSCALL_WITH_COMPAT, ;); LIST_LINUX_ARCHES_WITHOUT_ENDIANS(X,) #undef X #ifndef CREATING_DEDUP_TABLE # include "../generated/linux-syscall-dedup.h" #endif #define MAKE_SYSCALL_TABLE_ENTRY(ARCH, NR, NAME, ...)\ [NR] = &linux_##ARCH##_syscall_##NAME #define X(ARCH)\ static const struct libsyscalls_syscall *const linux_##ARCH##_syscalls_table[] = {\ LIST_LINUX_SYSCALLS_FOR_##ARCH(MAKE_##ARCH##_SYSCALL_TABLE_ENTRY, MAKE_##ARCH##_SYSCALL_TABLE_ENTRY, COMMA)\ }; LIST_LINUX_ARCHES_WITHOUT_ENDIANS(X,) #undef X const struct libsyscalls_syscall *const *const libsyscalls_linux_syscalls_table_[] = { #define X(ARCH)\ [LIBSYSCALLS_ARCH_##ARCH] = linux_##ARCH##_syscalls_table LIST_LINUX_ARCHES(X, COMMA) #undef X };