[libc-commits] [libc] [libc] Add sys/ucontext.h header (PR #194329)
via libc-commits
libc-commits at lists.llvm.org
Mon Apr 27 03:32:27 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Jeff Bailey (kaladron)
<details>
<summary>Changes</summary>
POSIX historically provided <sys/ucontext.h> as an alias for <ucontext.h>. Some software still includes the sys/ path. Added the header as a simple wrapper that includes <ucontext.h>, gated to x86_64 alongside the existing ucontext support.
---
Full diff: https://github.com/llvm/llvm-project/pull/194329.diff
3 Files Affected:
- (modified) libc/config/linux/x86_64/headers.txt (+1)
- (modified) libc/include/CMakeLists.txt (+6)
- (added) libc/include/sys/ucontext.h (+14)
``````````diff
diff --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index 2b93c84b13b5f..fb461444b43d8 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -53,6 +53,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.sys_syscall
libc.include.sys_time
libc.include.sys_types
+ libc.include.sys_ucontext
libc.include.sys_un
libc.include.sys_utsname
libc.include.sys_wait
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 6c5ecac302dc8..38e0c435006b7 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -476,6 +476,12 @@ if(LIBC_TARGET_ARCHITECTURE STREQUAL "x86_64")
.llvm-libc-types.sigset_t
.llvm-libc-types.stack_t
)
+
+ add_header(
+ sys_ucontext
+ HDR
+ sys/ucontext.h
+ )
endif()
add_header_macro(
diff --git a/libc/include/sys/ucontext.h b/libc/include/sys/ucontext.h
new file mode 100644
index 0000000000000..7f0b830434475
--- /dev/null
+++ b/libc/include/sys/ucontext.h
@@ -0,0 +1,14 @@
+//===-- POSIX header sys/ucontext.h ---------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SYS_UCONTEXT_H
+#define LLVM_LIBC_SYS_UCONTEXT_H
+
+#include <ucontext.h>
+
+#endif // LLVM_LIBC_SYS_UCONTEXT_H
``````````
</details>
https://github.com/llvm/llvm-project/pull/194329
More information about the libc-commits
mailing list