Download raw body.
[PATCH]: Add missing POSIX psiginfo(3) call
Attached patch.
Best,
From d4e06d510810d09ed261b0bbcae6dbe1ca1810f2 Mon Sep 17 00:00:00 2001
From: Ricardo Branco <rbranco@suse.de>
Date: Wed, 16 Apr 2025 10:16:13 +0200
Subject: [PATCH] Add POSIX psiginfo(3) call
---
include/signal.h | 1 +
lib/libc/Symbols.list | 1 +
lib/libc/gen/psignal.3 | 21 ++++++++++++++++++++-
lib/libc/gen/psignal.c | 6 ++++++
lib/libc/hidden/signal.h | 1 +
5 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/include/signal.h b/include/signal.h
index 07982bd75a1..7506ef0fbe7 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -132,6 +132,7 @@ int thrkill(pid_t _tid, int _signum, void *_tcb);
int sigwait(const sigset_t *__restrict, int *__restrict);
#endif
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809
+void psiginfo(const siginfo_t *, const char *);
void psignal(unsigned int, const char *);
#endif
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
diff --git a/lib/libc/Symbols.list b/lib/libc/Symbols.list
index 7b1dbdeca69..12e04f89fb4 100644
--- a/lib/libc/Symbols.list
+++ b/lib/libc/Symbols.list
@@ -745,6 +745,7 @@ posix_spawnattr_setschedpolicy
posix_spawnattr_setsigdefault
posix_spawnattr_setsigmask
posix_spawnp
+psiginfo
psignal
pw_dup
raise
diff --git a/lib/libc/gen/psignal.3 b/lib/libc/gen/psignal.3
index 3fd2ebbf7bf..015e968a107 100644
--- a/lib/libc/gen/psignal.3
+++ b/lib/libc/gen/psignal.3
@@ -27,11 +27,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 16 2019 $
+.Dd $Mdocdate: Apr 16 2025 $
.Dt PSIGNAL 3
.Os
.Sh NAME
.Nm psignal ,
+.Nm psiginfo ,
.Nm sys_siglist ,
.Nm sys_signame
.Nd system signal messages
@@ -39,6 +40,7 @@
.In signal.h
.Ft void
.Fn psignal "unsigned int sig" "const char *s"
+.Fn psiginfo "const siginfo_t *si" "const char *s"
.Vt extern char *sys_siglist[];
.Vt extern char *sys_signame[];
.Sh DESCRIPTION
@@ -64,6 +66,16 @@ the string
.Dq Unknown signal
is produced.
.Pp
+The
+.Fn psiginfo
+function is similar to
+.Fn psignal ,
+except that the signal number information is taken from the
+.Fa si
+argument which is a
+.Vt siginfo_t
+structure.
+.Pp
The message strings can be accessed directly using the external array
.Va sys_siglist ,
indexed by recognized signal numbers.
@@ -87,6 +99,13 @@ The
.Fn psignal
function appeared in
.Bx 4.2 .
+The
+.Fn psiginfo
+function appeared in
+.Fx 15.0 ,
+.Nx 6.0 ,
+and
+.Dx 4.1 .
.Sh CAVEATS
On systems other than
.Ox ,
diff --git a/lib/libc/gen/psignal.c b/lib/libc/gen/psignal.c
index dca921d5a5a..ee70d8c95cc 100644
--- a/lib/libc/gen/psignal.c
+++ b/lib/libc/gen/psignal.c
@@ -61,3 +61,9 @@ psignal(unsigned int sig, const char *s)
iov[niov+1].iov_len = 1;
(void)writev(STDERR_FILENO, iov, niov+2);
}
+
+void
+psiginfo(const siginfo_t *si, const char *s)
+{
+ psignal(si->si_signo, s);
+}
diff --git a/lib/libc/hidden/signal.h b/lib/libc/hidden/signal.h
index 7fdfcef7532..5011701517d 100644
--- a/lib/libc/hidden/signal.h
+++ b/lib/libc/hidden/signal.h
@@ -52,6 +52,7 @@ PROTO_NORMAL(__errno);
PROTO_DEPRECATED(bsd_signal);
PROTO_NORMAL(kill); /* wrap to ban SIGTHR? */
PROTO_DEPRECATED(killpg);
+PROTO_DEPRECATED(psiginfo);
PROTO_DEPRECATED(psignal);
PROTO_DEPRECATED(pthread_sigmask);
PROTO_NORMAL(raise);
--
2.50.1
[PATCH]: Add missing POSIX psiginfo(3) call