From 31760ee65ae3e79434fb257d93e17a6de6021f48 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 16 May 2025 16:18:21 +0300 Subject: [PATCH] libthr: add stable user interface for sigfastblock(2) Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50377 --- include/pthread_np.h | 2 ++ lib/libthr/pthread.map | 2 ++ lib/libthr/thread/thr_sig.c | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/include/pthread_np.h b/include/pthread_np.h index dcc762156a6..a9e738540db 100644 --- a/include/pthread_np.h +++ b/include/pthread_np.h @@ -59,6 +59,8 @@ int pthread_resume_np(pthread_t); int pthread_peekjoin_np(pthread_t, void **); void pthread_set_name_np(pthread_t, const char *); int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *); +void pthread_signals_block_np(void); +void pthread_signals_unblock_np(void); int pthread_single_np(void); void pthread_suspend_all_np(void); int pthread_suspend_np(pthread_t); diff --git a/lib/libthr/pthread.map b/lib/libthr/pthread.map index f75ef4c9135..1c8dde03367 100644 --- a/lib/libthr/pthread.map +++ b/lib/libthr/pthread.map @@ -339,5 +339,7 @@ FBSD_1.6 { }; FBSD_1.8 { + pthread_signals_block_np; + pthread_signals_unblock_np; pthread_sigqueue; }; diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index c5ee5aa8423..2cd3de512d1 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "un-namespace.h" #include "libc_private.h" @@ -163,6 +164,24 @@ _thr_signal_block_setup(struct pthread *curthread) __sys_sigfastblock(SIGFASTBLOCK_SETPTR, &curthread->fsigblock); } +void +pthread_signals_block_np(void) +{ + struct pthread *curthread; + + curthread = _get_curthread(); + _thr_signal_block(curthread); +} + +void +pthread_signals_unblock_np(void) +{ + struct pthread *curthread; + + curthread = _get_curthread(); + _thr_signal_unblock(curthread); +} + int _thr_send_sig(struct pthread *thread, int sig) {