Date: Thu, 24 Apr 2025 00:29:05 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 0ad5308987d0 - stable/14 - Add POSIX psiginfo(3) call Message-ID: <202504240029.53O0T5CT084535@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0ad5308987d0a34d49e1c963537759f1b73b3a4e commit 0ad5308987d0a34d49e1c963537759f1b73b3a4e Author: Ricardo Branco <rbranco@suse.de> AuthorDate: 2025-04-16 07:52:13 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-04-24 00:27:57 +0000 Add POSIX psiginfo(3) call PR: 286133 (cherry picked from commit 3b2f0bfc35167724a41c969c1823be6b1ede15ab) --- include/signal.h | 1 + lib/libc/gen/Makefile.inc | 3 ++- lib/libc/gen/Symbol.map | 1 + lib/libc/gen/psignal.3 | 22 +++++++++++++++++++++- lib/libc/gen/psignal.c | 6 ++++++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/include/signal.h b/include/signal.h index ee73b8ed492c..844630a8aafc 100644 --- a/include/signal.h +++ b/include/signal.h @@ -117,6 +117,7 @@ int siginterrupt(int, int); #endif #if __POSIX_VISIBLE >= 200809 +void psiginfo(const siginfo_t *, const char *); void psignal(int, const char *); #endif diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index f9f6f3139379..3e5f6ae8d602 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -487,7 +487,8 @@ MLINKS+=posix_spawn.3 posix_spawnp.3 \ posix_spawnattr_getsigdefault.3 posix_spawnattr_setsigdefault.3 \ posix_spawnattr_getsigmask.3 posix_spawnattr_setsigmask.3 \ posix_spawnattr_init.3 posix_spawnattr_destroy.3 -MLINKS+=psignal.3 strsignal.3 \ +MLINKS+=psignal.3 psiginfo.3 \ + psignal.3 strsignal.3 \ psignal.3 sys_siglist.3 \ psignal.3 sys_signame.3 MLINKS+=pwcache.3 group_from_gid.3 \ diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map index 5178ce56da33..2542da299cb1 100644 --- a/lib/libc/gen/Symbol.map +++ b/lib/libc/gen/Symbol.map @@ -461,6 +461,7 @@ FBSD_1.8 { aio_read2; aio_write2; execvpe; + psiginfo; rtld_get_var; rtld_set_var; }; diff --git a/lib/libc/gen/psignal.3 b/lib/libc/gen/psignal.3 index 0fc63418d3f3..b02d23dc16f1 100644 --- a/lib/libc/gen/psignal.3 +++ b/lib/libc/gen/psignal.3 @@ -27,11 +27,12 @@ .\" .\" @(#)psignal.3 8.2 (Berkeley) 2/27/95 .\" -.Dd May 30, 2016 +.Dd Apr 16, 2025 .Dt PSIGNAL 3 .Os .Sh NAME .Nm psignal , +.Nm psiginfo , .Nm strsignal , .Nm sys_siglist , .Nm sys_signame @@ -42,6 +43,8 @@ .In signal.h .Ft void .Fn psignal "int sig" "const char *s" +.Ft void +.Fn psiginfo "const siginfo_t *si" "const char *s" .Vt extern const char * const sys_siglist[] ; .Vt extern const char * const sys_signame[] ; .In string.h @@ -81,6 +84,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 through the external array .Va sys_siglist , @@ -106,3 +119,10 @@ 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 . diff --git a/lib/libc/gen/psignal.c b/lib/libc/gen/psignal.c index f8caf7621e83..eb05b08d2c27 100644 --- a/lib/libc/gen/psignal.c +++ b/lib/libc/gen/psignal.c @@ -57,3 +57,9 @@ psignal(int sig, const char *s) (void)_write(STDERR_FILENO, c, strlen(c)); (void)_write(STDERR_FILENO, "\n", 1); } + +void +psiginfo(const siginfo_t *si, const char *s) +{ + psignal(si->si_signo, s); +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504240029.53O0T5CT084535>