Warning: This file is not a C or C++ file. It does not have highlighting.
1 | //===----------------------- Linux syscalls ---------------------*- C++ -*-===// |
---|---|
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_SYSCALL_H |
10 | #define LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_SYSCALL_H |
11 | |
12 | #include "src/__support/CPP/bit.h" |
13 | #include "src/__support/common.h" |
14 | #include "src/__support/macros/config.h" |
15 | #include "src/__support/macros/properties/architectures.h" |
16 | |
17 | #ifdef LIBC_TARGET_ARCH_IS_X86_32 |
18 | #include "i386/syscall.h" |
19 | #elif defined(LIBC_TARGET_ARCH_IS_X86_64) |
20 | #include "x86_64/syscall.h" |
21 | #elif defined(LIBC_TARGET_ARCH_IS_AARCH64) |
22 | #include "aarch64/syscall.h" |
23 | #elif defined(LIBC_TARGET_ARCH_IS_ARM) |
24 | #include "arm/syscall.h" |
25 | #elif defined(LIBC_TARGET_ARCH_IS_ANY_RISCV) |
26 | #include "riscv/syscall.h" |
27 | #endif |
28 | |
29 | namespace LIBC_NAMESPACE_DECL { |
30 | |
31 | template <typename R, typename... Ts> |
32 | LIBC_INLINE R syscall_impl(long __number, Ts... ts) { |
33 | static_assert(sizeof...(Ts) <= 6, "Too many arguments for syscall"); |
34 | return cpp::bit_or_static_cast<R>(syscall_impl(__number, (long)ts...)); |
35 | } |
36 | |
37 | } // namespace LIBC_NAMESPACE_DECL |
38 | |
39 | #endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_LINUX_SYSCALL_H |
40 |
Warning: This file is not a C or C++ file. It does not have highlighting.