[libc-commits] [libc] [libc] Add POSIX redirection header specifications in YAML (PR #211859)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Tue Jul 28 06:33:45 PDT 2026
https://github.com/kaladron updated https://github.com/llvm/llvm-project/pull/211859
>From 8edc62777b20b327501f2627c4bc7364d13dae18 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Fri, 24 Jul 2026 12:59:43 +0100
Subject: [PATCH 1/2] [libc] Add POSIX redirection header specifications in
YAML
Add header YAML specifications for memory.h, sys/poll.h, sys/unistd.h,
sys/fcntl.h, and sys/signal.h using public_includes.
POSIX.1-2017 and historical X/Open System Interfaces (XSI) standards
define these headers as alternate or legacy header locations that forward
to string.h, poll.h, unistd.h, fcntl.h, and signal.h respectively.
The YAML header specs allow hdrgen to generate the public headers
automatically with proper license headers and guards.
Updated Linux target headers.txt configuration files to register the new
public header targets for installation.
Assisted-by: Automated tooling, human reviewed.
---
libc/config/linux/aarch64/headers.txt | 5 ++++
libc/config/linux/arm/headers.txt | 5 ++--
libc/config/linux/riscv/headers.txt | 5 ++++
libc/config/linux/x86_64/headers.txt | 5 ++++
libc/include/CMakeLists.txt | 40 +++++++++++++++++++++++++++
libc/include/memory.yaml | 5 ++++
libc/include/sys/fcntl.yaml | 5 ++++
libc/include/sys/poll.yaml | 5 ++++
libc/include/sys/signal.yaml | 5 ++++
libc/include/sys/unistd.yaml | 5 ++++
10 files changed, 83 insertions(+), 2 deletions(-)
create mode 100644 libc/include/memory.yaml
create mode 100644 libc/include/sys/fcntl.yaml
create mode 100644 libc/include/sys/poll.yaml
create mode 100644 libc/include/sys/signal.yaml
create mode 100644 libc/include/sys/unistd.yaml
diff --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt
index 7d3e65c2434c7..0aa08039eb41a 100644
--- a/libc/config/linux/aarch64/headers.txt
+++ b/libc/config/linux/aarch64/headers.txt
@@ -24,6 +24,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.locale
libc.include.malloc
libc.include.math
+ libc.include.memory
libc.include.net_if
libc.include.netinet_in
libc.include.netinet_tcp
@@ -45,16 +46,19 @@ set(TARGET_PUBLIC_HEADERS
libc.include.strings
libc.include.sys_auxv
libc.include.sys_epoll
+ libc.include.sys_fcntl
libc.include.sys_ioctl
libc.include.sys_mman
libc.include.sys_param
libc.include.sys_personality
+ libc.include.sys_poll
libc.include.sys_prctl
libc.include.sys_queue
libc.include.sys_random
libc.include.sys_resource
libc.include.sys_select
libc.include.sys_sendfile
+ libc.include.sys_signal
libc.include.sys_socket
libc.include.sys_stat
libc.include.sys_statvfs
@@ -63,6 +67,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.sys_types
libc.include.sys_uio
libc.include.sys_un
+ libc.include.sys_unistd
libc.include.sys_utsname
libc.include.sys_wait
libc.include.syscall
diff --git a/libc/config/linux/arm/headers.txt b/libc/config/linux/arm/headers.txt
index 785bf07878088..a079ca883aeab 100644
--- a/libc/config/linux/arm/headers.txt
+++ b/libc/config/linux/arm/headers.txt
@@ -10,8 +10,11 @@ set(TARGET_PUBLIC_HEADERS
libc.include.inttypes
libc.include.langinfo
libc.include.libgen
+ libc.include.locale
libc.include.malloc
libc.include.math
+ libc.include.memory
+ libc.include.net_if
libc.include.search
libc.include.setjmp
libc.include.stdbit
@@ -23,10 +26,8 @@ set(TARGET_PUBLIC_HEADERS
libc.include.uchar
libc.include.wchar
libc.include.wctype
-
libc.include.sys_param
libc.include.sys_personality
-
# Disabled due to epoll_wait syscalls not being available on this platform.
# libc.include.sys_epoll
)
diff --git a/libc/config/linux/riscv/headers.txt b/libc/config/linux/riscv/headers.txt
index 199b0fa1e47c2..51cc94e8cb8ff 100644
--- a/libc/config/linux/riscv/headers.txt
+++ b/libc/config/linux/riscv/headers.txt
@@ -24,6 +24,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.locale
libc.include.malloc
libc.include.math
+ libc.include.memory
libc.include.net_if
libc.include.netinet_in
libc.include.netinet_tcp
@@ -46,16 +47,19 @@ set(TARGET_PUBLIC_HEADERS
libc.include.strings
libc.include.sys_auxv
libc.include.sys_epoll
+ libc.include.sys_fcntl
libc.include.sys_ioctl
libc.include.sys_mman
libc.include.sys_param
libc.include.sys_personality
+ libc.include.sys_poll
libc.include.sys_prctl
libc.include.sys_queue
libc.include.sys_random
libc.include.sys_resource
libc.include.sys_select
libc.include.sys_sendfile
+ libc.include.sys_signal
libc.include.sys_socket
libc.include.sys_stat
libc.include.sys_statvfs
@@ -64,6 +68,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.sys_types
libc.include.sys_uio
libc.include.sys_un
+ libc.include.sys_unistd
libc.include.sys_utsname
libc.include.sys_wait
libc.include.syscall
diff --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index 89090501c3a04..d4849cd4c1463 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -24,6 +24,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.locale
libc.include.malloc
libc.include.math
+ libc.include.memory
libc.include.net_if
libc.include.netinet_in
libc.include.netinet_tcp
@@ -46,11 +47,13 @@ set(TARGET_PUBLIC_HEADERS
libc.include.strings
libc.include.sys_auxv
libc.include.sys_epoll
+ libc.include.sys_fcntl
libc.include.sys_ioctl
libc.include.sys_ipc
libc.include.sys_mman
libc.include.sys_param
libc.include.sys_personality
+ libc.include.sys_poll
libc.include.sys_prctl
libc.include.sys_queue
libc.include.sys_random
@@ -58,6 +61,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.sys_select
libc.include.sys_sem
libc.include.sys_sendfile
+ libc.include.sys_signal
libc.include.sys_socket
libc.include.sys_stat
libc.include.sys_statvfs
@@ -67,6 +71,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.sys_ucontext
libc.include.sys_uio
libc.include.sys_un
+ libc.include.sys_unistd
libc.include.sys_utsname
libc.include.sys_wait
libc.include.syscall
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 0f161f46af471..5a95b72b8ae95 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -64,6 +64,14 @@ add_header_macro(
.llvm_libc_common_h
)
+add_header_macro(
+ sys_fcntl
+ ../libc/include/sys/fcntl.yaml
+ sys/fcntl.h
+ DEPENDS
+ .fcntl
+)
+
add_header_macro(
dlfcn
../libc/include/dlfcn.yaml
@@ -282,6 +290,14 @@ add_header_macro(
.llvm-libc-types.size_t
)
+add_header_macro(
+ memory
+ ../libc/include/memory.yaml
+ memory.h
+ DEPENDS
+ .string
+)
+
add_header_macro(
strings
../libc/include/strings.yaml
@@ -384,6 +400,14 @@ add_header_macro(
.llvm-libc-types.union_sigval
)
+add_header_macro(
+ sys_signal
+ ../libc/include/sys/signal.yaml
+ sys/signal.h
+ DEPENDS
+ .signal
+)
+
add_header_macro(
stdbit
../libc/include/stdbit.yaml
@@ -461,6 +485,14 @@ add_header_macro(
.llvm-libc-types.__getoptargv_t
)
+add_header_macro(
+ sys_unistd
+ ../libc/include/sys/unistd.yaml
+ sys/unistd.h
+ DEPENDS
+ .unistd
+)
+
add_header_macro(
pthread
../libc/include/pthread.yaml
@@ -1062,6 +1094,14 @@ add_header_macro(
.llvm-libc-macros.poll-macros
)
+add_header_macro(
+ sys_poll
+ ../libc/include/sys/poll.yaml
+ sys/poll.h
+ DEPENDS
+ .poll
+)
+
add_header_macro(
nl_types
../libc/include/nl_types.yaml
diff --git a/libc/include/memory.yaml b/libc/include/memory.yaml
new file mode 100644
index 0000000000000..81a84e4a80295
--- /dev/null
+++ b/libc/include/memory.yaml
@@ -0,0 +1,5 @@
+header: memory.h
+public_includes:
+ - string.h
+standards:
+ - posix
diff --git a/libc/include/sys/fcntl.yaml b/libc/include/sys/fcntl.yaml
new file mode 100644
index 0000000000000..c21755d098433
--- /dev/null
+++ b/libc/include/sys/fcntl.yaml
@@ -0,0 +1,5 @@
+header: sys/fcntl.h
+public_includes:
+ - fcntl.h
+standards:
+ - posix
diff --git a/libc/include/sys/poll.yaml b/libc/include/sys/poll.yaml
new file mode 100644
index 0000000000000..204e832388e30
--- /dev/null
+++ b/libc/include/sys/poll.yaml
@@ -0,0 +1,5 @@
+header: sys/poll.h
+public_includes:
+ - poll.h
+standards:
+ - posix
diff --git a/libc/include/sys/signal.yaml b/libc/include/sys/signal.yaml
new file mode 100644
index 0000000000000..6c678fd9f7e0c
--- /dev/null
+++ b/libc/include/sys/signal.yaml
@@ -0,0 +1,5 @@
+header: sys/signal.h
+public_includes:
+ - signal.h
+standards:
+ - posix
diff --git a/libc/include/sys/unistd.yaml b/libc/include/sys/unistd.yaml
new file mode 100644
index 0000000000000..e00f7d533217a
--- /dev/null
+++ b/libc/include/sys/unistd.yaml
@@ -0,0 +1,5 @@
+header: sys/unistd.h
+public_includes:
+ - unistd.h
+standards:
+ - posix
>From 92dce7272653468c878ebd7f61fcb3c70a061856 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Tue, 28 Jul 2026 14:32:59 +0100
Subject: [PATCH 2/2] Remove accidental add of headers to linux/arm
---
libc/config/linux/arm/headers.txt | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libc/config/linux/arm/headers.txt b/libc/config/linux/arm/headers.txt
index a079ca883aeab..785bf07878088 100644
--- a/libc/config/linux/arm/headers.txt
+++ b/libc/config/linux/arm/headers.txt
@@ -10,11 +10,8 @@ set(TARGET_PUBLIC_HEADERS
libc.include.inttypes
libc.include.langinfo
libc.include.libgen
- libc.include.locale
libc.include.malloc
libc.include.math
- libc.include.memory
- libc.include.net_if
libc.include.search
libc.include.setjmp
libc.include.stdbit
@@ -26,8 +23,10 @@ set(TARGET_PUBLIC_HEADERS
libc.include.uchar
libc.include.wchar
libc.include.wctype
+
libc.include.sys_param
libc.include.sys_personality
+
# Disabled due to epoll_wait syscalls not being available on this platform.
# libc.include.sys_epoll
)
More information about the libc-commits
mailing list