[libc-commits] [libc] [libc] Add struct sigevent definition and proxy header. (PR #217699)
via libc-commits
libc-commits at lists.llvm.org
Thu Aug 20 10:33:37 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: lntue
<details>
<summary>Changes</summary>
Definition follows the standard POSIX layout from: https://man7.org/linux/man-pages/man3/sigevent.3type.html
---
Full diff: https://github.com/llvm/llvm-project/pull/217699.diff
7 Files Affected:
- (modified) libc/hdr/types/CMakeLists.txt (+9)
- (added) libc/hdr/types/struct_sigevent.h (+27)
- (modified) libc/include/llvm-libc-macros/linux/signal-macros.h (+6)
- (modified) libc/include/llvm-libc-types/CMakeLists.txt (+1)
- (added) libc/include/llvm-libc-types/struct_sigevent.h (+31)
- (modified) libc/include/signal.yaml (+9)
- (modified) libc/include/time.yaml (+1)
``````````diff
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index 4983109aa82f8..a6e180d44c363 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -425,6 +425,15 @@ add_proxy_header_library(
libc.include.signal
)
+add_proxy_header_library(
+ struct_sigevent
+ HDRS
+ struct_sigevent.h
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.struct_sigevent
+ libc.include.signal
+)
+
add_proxy_header_library(
FILE
HDRS
diff --git a/libc/hdr/types/struct_sigevent.h b/libc/hdr/types/struct_sigevent.h
new file mode 100644
index 0000000000000..6ebc9e492e539
--- /dev/null
+++ b/libc/hdr/types/struct_sigevent.h
@@ -0,0 +1,27 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Proxy for struct sigevent.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_SIGEVENT_H
+#define LLVM_LIBC_HDR_TYPES_STRUCT_SIGEVENT_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/struct_sigevent.h"
+
+#else
+
+#include <signal.h>
+
+#endif // LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_STRUCT_SIGEVENT_H
diff --git a/libc/include/llvm-libc-macros/linux/signal-macros.h b/libc/include/llvm-libc-macros/linux/signal-macros.h
index 8532c423c395f..8734fd72b80cb 100644
--- a/libc/include/llvm-libc-macros/linux/signal-macros.h
+++ b/libc/include/llvm-libc-macros/linux/signal-macros.h
@@ -155,4 +155,10 @@
#define SI_ASYNCNL (-60) // Async name lookup completion
#define SI_KERNEL 128 // Sent by the kernel
+// `sigev_notify` values for `struct sigevent`.
+#define SIGEV_SIGNAL 0
+#define SIGEV_NONE 1
+#define SIGEV_THREAD 2
+#define SIGEV_THREAD_ID 4
+
#endif // LLVM_LIBC_MACROS_LINUX_SIGNAL_MACROS_H
diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt
index 69d62619f7979..59dc6c1c4f10a 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -205,6 +205,7 @@ add_header(__jmp_buf HDR __jmp_buf.h DEPENDS .sigset_t)
add_header(jmp_buf HDR jmp_buf.h DEPENDS .__jmp_buf)
add_header(sigjmp_buf HDR sigjmp_buf.h DEPENDS .__jmp_buf)
add_header(struct_sigaction HDR struct_sigaction.h DEPENDS .sigset_t .siginfo_t)
+add_header(struct_sigevent HDR struct_sigevent.h DEPENDS .union_sigval .pthread_attr_t .pid_t)
add_header(struct_timespec HDR struct_timespec.h DEPENDS .time_t)
add_header(
struct_stat
diff --git a/libc/include/llvm-libc-types/struct_sigevent.h b/libc/include/llvm-libc-types/struct_sigevent.h
new file mode 100644
index 0000000000000..d1341f2fdae38
--- /dev/null
+++ b/libc/include/llvm-libc-types/struct_sigevent.h
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Definition of struct sigevent type.
+/// https://man7.org/linux/man-pages/man3/sigevent.3type.html
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TYPES_STRUCT_SIGEVENT_H
+#define LLVM_LIBC_TYPES_STRUCT_SIGEVENT_H
+
+#include "pid_t.h"
+#include "pthread_attr_t.h"
+#include "union_sigval.h"
+
+struct sigevent {
+ int sigev_notify;
+ int sigev_signo;
+ union sigval sigev_value;
+ void (*sigev_notify_function)(union sigval);
+ pthread_attr_t *sigev_notify_attributes;
+ pid_t sigev_notify_thread_id;
+};
+
+#endif // LLVM_LIBC_TYPES_STRUCT_SIGEVENT_H
diff --git a/libc/include/signal.yaml b/libc/include/signal.yaml
index 307bbfedbec01..88c931edd51f9 100644
--- a/libc/include/signal.yaml
+++ b/libc/include/signal.yaml
@@ -20,6 +20,14 @@ macros:
macro_header: signal-macros.h
- macro_name: SIG_IGN
macro_header: signal-macros.h
+ - macro_name: SIGEV_SIGNAL
+ macro_header: signal-macros.h
+ - macro_name: SIGEV_NONE
+ macro_header: signal-macros.h
+ - macro_name: SIGEV_THREAD
+ macro_header: signal-macros.h
+ - macro_name: SIGEV_THREAD_ID
+ macro_header: signal-macros.h
types:
- type_name: pid_t
- type_name: sig_atomic_t
@@ -33,6 +41,7 @@ types:
- type_name: sigset_t
- type_name: stack_t
- type_name: struct_sigaction
+ - type_name: struct_sigevent
- type_name: union_sigval
enums: []
objects: []
diff --git a/libc/include/time.yaml b/libc/include/time.yaml
index a7c0cc7cc3e8e..440789d211944 100644
--- a/libc/include/time.yaml
+++ b/libc/include/time.yaml
@@ -19,6 +19,7 @@ types:
- type_name: size_t
- type_name: locale_t
- type_name: tm_gmtoff_t
+ - type_name: struct_sigevent
enums: []
objects: []
functions:
``````````
</details>
https://github.com/llvm/llvm-project/pull/217699
More information about the libc-commits
mailing list