[libc-commits] [libc] [libc] Add a redirecting <syscall.h> header. (PR #191069)
Alexey Samsonov via libc-commits
libc-commits at lists.llvm.org
Wed Apr 8 16:10:12 PDT 2026
https://github.com/vonosmas created https://github.com/llvm/llvm-project/pull/191069
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.
>From a706131a8da8af3e691c378f3e587dacd80738bb Mon Sep 17 00:00:00 2001
From: Alexey Samsonov <vonosmas at gmail.com>
Date: Wed, 8 Apr 2026 23:05:44 +0000
Subject: [PATCH] [libc] Add a redirecting <syscall.h> header.
---
libc/config/linux/aarch64/headers.txt | 1 +
libc/config/linux/riscv/headers.txt | 1 +
libc/config/linux/x86_64/headers.txt | 1 +
libc/include/CMakeLists.txt | 5 +++++
libc/include/syscall.h | 1 +
5 files changed, 9 insertions(+)
create mode 100644 libc/include/syscall.h
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>
More information about the libc-commits
mailing list