[libc] Minor fixes/additions to signal.h header. - #217469
Merged
Merged
Conversation
|
@llvm/pr-subscribers-libc Author: Alexey Samsonov (vonosmas) Changes
Full diff: https://github.com/llvm/llvm-project/pull/217469.diff 6 Files Affected:
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 91d601d50a711..4dcb5a2ea696a 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -414,6 +414,7 @@ add_header_macro(
.llvm-libc-macros.signal_macros
.llvm-libc-types.pid_t
.llvm-libc-types.sig_atomic_t
+ .llvm-libc-types.sig_t
.llvm-libc-types.sighandler_t
.llvm-libc-types.siginfo_t
.llvm-libc-types.sigset_t
diff --git a/libc/include/llvm-libc-macros/linux/signal-macros.h b/libc/include/llvm-libc-macros/linux/signal-macros.h
index e9fff447f9086..8532c423c395f 100644
--- a/libc/include/llvm-libc-macros/linux/signal-macros.h
+++ b/libc/include/llvm-libc-macros/linux/signal-macros.h
@@ -150,5 +150,9 @@
#define SI_TIMER (-2) // Expiration of a timer set by timer_settime()
#define SI_ASYNCIO (-4) // Completion of an synchronous I/O request
#define SI_MESGQ (-3) // Arrival of a message on an empty message queue
+#define SI_SIGIO (-5) // Queued SIGIO, on older versions of Linux
+#define SI_TKILL (-6) // Sent by tkill or tgkill
+#define SI_ASYNCNL (-60) // Async name lookup completion
+#define SI_KERNEL 128 // Sent by the kernel
#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 1c999bfd0b857..69d62619f7979 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -122,6 +122,7 @@ add_header(rlim_t HDR rlim_t.h)
add_header(sem_t HDR sem_t.h DEPENDS .__futex_word)
add_header(time_t HDR time_t_64.h DEST_HDR time_t.h)
add_header(timer_t HDR timer_t.h)
+add_header(sig_t HDR sig_t.h)
add_header(sighandler_t HDR sighandler_t.h)
add_header(stack_t HDR stack_t.h DEPENDS .size_t)
add_header(suseconds_t HDR suseconds_t.h)
diff --git a/libc/include/llvm-libc-types/sig_t.h b/libc/include/llvm-libc-types/sig_t.h
new file mode 100644
index 0000000000000..ad6b1aeb5617c
--- /dev/null
+++ b/libc/include/llvm-libc-types/sig_t.h
@@ -0,0 +1,20 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 sig_t type.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TYPES_SIG_T_H
+#define LLVM_LIBC_TYPES_SIG_T_H
+
+// BSD type for signal handlers.
+typedef void (*sig_t)(int);
+
+#endif // LLVM_LIBC_TYPES_SIG_T_H
diff --git a/libc/include/llvm-libc-types/siginfo_t.h b/libc/include/llvm-libc-types/siginfo_t.h
index 20fdd461bb6df..67366e40b1ebc 100644
--- a/libc/include/llvm-libc-types/siginfo_t.h
+++ b/libc/include/llvm-libc-types/siginfo_t.h
@@ -33,7 +33,7 @@ typedef struct {
/* POSIX.1b timers */
struct {
int si_tid; /* timer id */
- int _overrun; /* overrun count */
+ int si_overrun; /* overrun count */
union sigval si_sigval; /* same as below */
} _timer;
diff --git a/libc/include/signal.yaml b/libc/include/signal.yaml
index 7ab557875af71..307bbfedbec01 100644
--- a/libc/include/signal.yaml
+++ b/libc/include/signal.yaml
@@ -23,7 +23,12 @@ macros:
types:
- type_name: pid_t
- type_name: sig_atomic_t
+ - type_name: sig_t
+ standards:
+ - bsd
- type_name: sighandler_t
+ standards:
+ - gnu
- type_name: siginfo_t
- type_name: sigset_t
- type_name: stack_t
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
si_overrunmacro, and names should match)sig_ttype which is used in BSD for signal handler function. It's identical to GNU'ssighandler_t, and glibc provides both. Clarify this in their YAML entries.SI_*values.