Download raw body.
Add POSIX psiginfo(3) call
Attached fixed diff. Thanks to Philip Guenther for suggestion.
Best,
Ricardo
On 4/16/25 10:18 AM, Ricardo Branco wrote:
> For now use the same implementation used by NetBSD & DragonflyBSD.
>
>
> Attached patch.
>
>
> Best,
>
> Ricardo
diff --git include/signal.h include/signal.h
index 07982bd75a1..7506ef0fbe7 100644
--- include/signal.h
+++ 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 lib/libc/Symbols.list lib/libc/Symbols.list
index 6eb2cca93e5..7a1d560f340 100644
--- lib/libc/Symbols.list
+++ 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 lib/libc/gen/psignal.3 lib/libc/gen/psignal.3
index 3fd2ebbf7bf..015e968a107 100644
--- lib/libc/gen/psignal.3
+++ 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 lib/libc/gen/psignal.c lib/libc/gen/psignal.c
index dca921d5a5a..ee70d8c95cc 100644
--- lib/libc/gen/psignal.c
+++ 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 lib/libc/hidden/signal.h lib/libc/hidden/signal.h
index 7fdfcef7532..5011701517d 100644
--- lib/libc/hidden/signal.h
+++ 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);
Add POSIX psiginfo(3) call