[libc] Add a redirecting <syscall.h> header. (#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.
diff --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt
index 34da6f91..4784fc5 100644
--- a/libc/config/linux/aarch64/headers.txt
+++ b/libc/config/linux/aarch64/headers.txt
@@ -53,6 +53,7 @@
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 576e931..45c42eb 100644
--- a/libc/config/linux/riscv/headers.txt
+++ b/libc/config/linux/riscv/headers.txt
@@ -52,6 +52,7 @@
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 36121f3..0e5d5c7 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -56,6 +56,7 @@
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 3375e4e..774970d 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -180,6 +180,11 @@
.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 0000000..4c30578
--- /dev/null
+++ b/libc/include/syscall.h
@@ -0,0 +1 @@
+#include <sys/syscall.h>