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

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


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Alexey Samsonov (vonosmas)

<details>
<summary>Changes</summary>

* `<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.

---
Full diff: https://github.com/llvm/llvm-project/pull/219118.diff


6 Files Affected:

- (modified) libc/config/linux/aarch64/headers.txt (+2) 
- (modified) libc/config/linux/riscv/headers.txt (+2) 
- (modified) libc/config/linux/x86_64/headers.txt (+2) 
- (modified) libc/include/CMakeLists.txt (+16) 
- (added) libc/include/sys/syslog.yaml (+5) 
- (added) libc/include/sys/vfs.yaml (+5) 


``````````diff
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

``````````

</details>


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


More information about the libc-commits mailing list