mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [PATCH v3 1/3] src/signal/sys_signame.c: create hidden value-name table of signals
@ 2024-08-09 15:34 contact
  2024-08-09 15:34 ` [musl] [PATCH v3 2/3] signal: add sig2str(3) from POSIX.1-2024 contact
  2024-08-09 15:34 ` [musl] [PATCH v3 3/3] signal: add str2sig(3) " contact
  0 siblings, 2 replies; 5+ messages in thread
From: contact @ 2024-08-09 15:34 UTC (permalink / raw)
  To: musl; +Cc: Haelwenn (lanodan) Monnier

From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>

---
 src/include/signal.h     |  2 ++
 src/signal/sys_signame.c | 44 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)
 create mode 100644 src/signal/sys_signame.c

diff --git a/src/include/signal.h b/src/include/signal.h
index bb566784..6bbc51d9 100644
--- a/src/include/signal.h
+++ b/src/include/signal.h
@@ -11,4 +11,6 @@ hidden void __restore_sigs(void *);
 
 hidden void __get_handler_set(sigset_t *);
 
+hidden extern const char __sys_signame[SIGSYS+1][sizeof("STKFLT")];
+
 #endif
diff --git a/src/signal/sys_signame.c b/src/signal/sys_signame.c
new file mode 100644
index 00000000..9b30c1a1
--- /dev/null
+++ b/src/signal/sys_signame.c
@@ -0,0 +1,44 @@
+#include <signal.h>
+
+#define SIG(s) [SIG##s] = #s
+const char __sys_signame[SIGSYS+1][sizeof("STKFLT")] = {
+	SIG(HUP),
+	SIG(INT),
+	SIG(QUIT),
+	SIG(ILL),
+	SIG(TRAP),
+	SIG(ABRT),
+	SIG(BUS),
+	SIG(FPE),
+	SIG(KILL),
+	SIG(USR1),
+	SIG(SEGV),
+	SIG(USR2),
+	SIG(PIPE),
+	SIG(ALRM),
+	SIG(TERM),
+#if defined(SIGSTKFLT)
+	SIG(STKFLT),
+#endif
+#if defined(SIGEMT)
+	SIG(EMT),
+#endif
+	SIG(CHLD),
+	SIG(CONT),
+	SIG(STOP),
+	SIG(TSTP),
+	SIG(TTIN),
+	SIG(TTOU),
+	SIG(URG),
+	SIG(XCPU),
+	SIG(XFSZ),
+	SIG(VTALRM),
+	SIG(PROF),
+	SIG(WINCH),
+	SIG(IO),
+#if SIGPOLL != SIGIO
+	SIG(POLL),
+#endif
+	SIG(PWR),
+	SIG(SYS)
+};
-- 
2.44.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-11  2:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-09 15:34 [musl] [PATCH v3 1/3] src/signal/sys_signame.c: create hidden value-name table of signals contact
2024-08-09 15:34 ` [musl] [PATCH v3 2/3] signal: add sig2str(3) from POSIX.1-2024 contact
2024-08-09 15:34 ` [musl] [PATCH v3 3/3] signal: add str2sig(3) " contact
2024-08-11  0:43   ` Rich Felker
2024-08-11  2:54     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).