[libc-commits] [libc] [libc] Add redirecting headers sys/vfs.h and sys/syslog.h on Linux. (PR #219118)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Wed Aug 26 22:36:03 PDT 2026


https://github.com/vonosmas created https://github.com/llvm/llvm-project/pull/219118

* `<sys/vfs.h>` is a Linux header for providing `statfs` function, and can be used interchangeably with `<sys/statfs.h>` (https://man7.org/linux/man-pages/man2/statfs.2.html). Simply redirect the former to the latter, as `statfs` is already implemented.
* `<sys/syslog.h>` is frequently used instead of POSIX-specified `<syslog.h>` header, so create the redirecting alias for it as well.

This would fix one of the problems in issue #97191 (building Clang against LLVM-libc), since `<sys/vfs.h>` is actually used by LLVM Support.

>From d68cbec651225515d0d46e9de1260a2627d4912d Mon Sep 17 00:00:00 2001
From: Alexey Samsonov <vonosmas at gmail.com>
Date: Thu, 27 Aug 2026 05:32:10 +0000
Subject: [PATCH] [libc] Add redirecting headers sys/vfs.h and sys/syslog.h on
 Linux.

---
 libc/config/linux/aarch64/headers.txt |  2 ++
 libc/config/linux/riscv/headers.txt   |  2 ++
 libc/config/linux/x86_64/headers.txt  |  2 ++
 libc/include/CMakeLists.txt           | 16 ++++++++++++++++
 libc/include/sys/syslog.yaml          |  5 +++++
 libc/include/sys/vfs.yaml             |  5 +++++
 6 files changed, 32 insertions(+)
 create mode 100644 libc/include/sys/syslog.yaml
 create mode 100644 libc/include/sys/vfs.yaml

diff --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt
index b80ed913c5007..e6fefb3963c12 100644
--- a/libc/config/linux/aarch64/headers.txt
+++ b/libc/config/linux/aarch64/headers.txt
@@ -69,12 +69,14 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.sys_sysinfo
     libc.include.sys_syscall
     libc.include.sys_sysmacros
+    libc.include.sys_syslog
     libc.include.sys_time
     libc.include.sys_types
     libc.include.sys_uio
     libc.include.sys_un
     libc.include.sys_unistd
     libc.include.sys_utsname
+    libc.include.sys_vfs
     libc.include.sys_wait
     libc.include.syscall
     libc.include.sysexits
diff --git a/libc/config/linux/riscv/headers.txt b/libc/config/linux/riscv/headers.txt
index a8e00b657b2e9..01652d02fee69 100644
--- a/libc/config/linux/riscv/headers.txt
+++ b/libc/config/linux/riscv/headers.txt
@@ -69,12 +69,14 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.sys_statvfs
     libc.include.sys_sysinfo
     libc.include.sys_syscall
+    libc.include.sys_syslog
     libc.include.sys_time
     libc.include.sys_types
     libc.include.sys_uio
     libc.include.sys_un
     libc.include.sys_unistd
     libc.include.sys_utsname
+    libc.include.sys_vfs
     libc.include.sys_wait
     libc.include.syscall
     libc.include.sysexits
diff --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index 06ee91983ebd5..8e10cf070dd29 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -72,6 +72,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.sys_sysinfo
     libc.include.sys_syscall
     libc.include.sys_sysmacros
+    libc.include.sys_syslog
     libc.include.sys_time
     libc.include.sys_types
     libc.include.sys_ucontext
@@ -79,6 +80,7 @@ set(TARGET_PUBLIC_HEADERS
     libc.include.sys_un
     libc.include.sys_unistd
     libc.include.sys_utsname
+    libc.include.sys_vfs
     libc.include.sys_wait
     libc.include.syscall
     libc.include.sysexits
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index d44febe667cb1..9ede2a2b1f570 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -247,6 +247,14 @@ add_header_macro(
     .llvm-libc-macros.syslog_macros
 )
 
+add_header_macro(
+  sys_syslog
+  ../libc/include/sys/syslog.yaml
+  sys/syslog.h
+  DEPENDS
+    .syslog
+)
+
 add_header_macro(
   alloca
   ../libc/include/alloca.yaml
@@ -1009,6 +1017,14 @@ add_header_macro(
     .llvm-libc-types.struct_sockaddr_un
 )
 
+add_header_macro(
+  sys_vfs
+  ../libc/include/sys/vfs.yaml
+  sys/vfs.h
+  DEPENDS
+    .sys_statfs
+)
+
 add_header_macro(
   sys_wait
   ../libc/include/sys/wait.yaml
diff --git a/libc/include/sys/syslog.yaml b/libc/include/sys/syslog.yaml
new file mode 100644
index 0000000000000..402b9388ff2b9
--- /dev/null
+++ b/libc/include/sys/syslog.yaml
@@ -0,0 +1,5 @@
+header: sys/syslog.h
+public_includes:
+  - syslog.h
+standards:
+  - posix
diff --git a/libc/include/sys/vfs.yaml b/libc/include/sys/vfs.yaml
new file mode 100644
index 0000000000000..61b37d01a02fc
--- /dev/null
+++ b/libc/include/sys/vfs.yaml
@@ -0,0 +1,5 @@
+header: sys/vfs.h
+public_includes:
+  - sys/statfs.h
+standards:
+  - linux



More information about the libc-commits mailing list