[libc-commits] [libc] [libc] Add a redirecting <syscall.h> header. (PR #191069)
via libc-commits
libc-commits at lists.llvm.org
Wed Apr 8 16:12:32 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Alexey Samsonov (vonosmas)
<details>
<summary>Changes</summary>
The amount of legacy code including `<syscall.h>` header instead of `<sys/syscall.h>` (which is the regular header location on Linux systems) out there is large.
Add a simple one-liner redirecting header to fix this compatibility issues. In this PR I omit the regular licensing blurb at the top, given the transient nature of this file, but I'm happy to add this if needed. Also, given that it's effectively a compatibility shim, YAML generation is not used.
---
Full diff: https://github.com/llvm/llvm-project/pull/191069.diff
5 Files Affected:
- (modified) libc/config/linux/aarch64/headers.txt (+1)
- (modified) libc/config/linux/riscv/headers.txt (+1)
- (modified) libc/config/linux/x86_64/headers.txt (+1)
- (modified) libc/include/CMakeLists.txt (+5)
- (added) libc/include/syscall.h (+1)
``````````diff
diff --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt
index 1c7df25ad930f..ea95505d4ef01 100644
--- a/libc/config/linux/aarch64/headers.txt
+++ b/libc/config/linux/aarch64/headers.txt
@@ -52,6 +52,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.sys_un
libc.include.sys_utsname
libc.include.sys_wait
+ libc.include.syscall
libc.include.sysexits
libc.include.termios
libc.include.threads
diff --git a/libc/config/linux/riscv/headers.txt b/libc/config/linux/riscv/headers.txt
index 0573851fbc20b..21c45642c2045 100644
--- a/libc/config/linux/riscv/headers.txt
+++ b/libc/config/linux/riscv/headers.txt
@@ -51,6 +51,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.sys_types
libc.include.sys_utsname
libc.include.sys_wait
+ libc.include.syscall
libc.include.sysexits
libc.include.termios
libc.include.threads
diff --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index 157740033aabf..015450d4e3650 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -55,6 +55,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.sys_un
libc.include.sys_utsname
libc.include.sys_wait
+ libc.include.syscall
libc.include.sysexits
libc.include.termios
libc.include.threads
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 3375e4e21e338..774970dbb3d9d 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -180,6 +180,11 @@ add_header_macro(
.llvm-libc-types.uint_ur_t
)
+add_header(
+ syscall
+ HDR
+ syscall.h
+)
add_header_macro(
sysexits
diff --git a/libc/include/syscall.h b/libc/include/syscall.h
new file mode 100644
index 0000000000000..4c305784472f8
--- /dev/null
+++ b/libc/include/syscall.h
@@ -0,0 +1 @@
+#include <sys/syscall.h>
``````````
</details>
https://github.com/llvm/llvm-project/pull/191069
More information about the libc-commits
mailing list