Change the first parameter of pthread_sigqueue() to be a thread id rather than a thread pointer. The change is to match the Linux implementation of this function.
The user-visible function prototype is changed in include/pthread.h. The pthread_sigqueue() function is modified to work with a passed-in thread id rather than an indirect thread pointer as before. (It was "pthread_t *thread", i.e., class pthread **.) The release note for Cygwin 3.5.5 is updated. CYGWIN_VERSION_API_MINOR is bumped to 351. Reported-by: Christian Franke <christian.fra...@t-online.de> Addresses: https://cygwin.com/pipermail/cygwin/2024-September/256439.html Signed-off-by: Mark Geisert <m...@maxrnd.com> Fixes: 2041af1a535a (cygwin.din (pthread_sigqueue): Export.) --- winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/include/pthread.h | 2 +- winsup/cygwin/release/3.5.5 | 3 +++ winsup/cygwin/thread.cc | 8 ++++---- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index fb821a681..c70d0ee15 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -485,12 +485,13 @@ details. */ 348: Add c8rtomb, mbrtoc. 349: Add fallocate. 350: Add close_range. + 351: Change pthread_sigqueue first arg type. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 350 +#define CYGWIN_VERSION_API_MINOR 351 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h index 66d367d62..a0ec32526 100644 --- a/winsup/cygwin/include/pthread.h +++ b/winsup/cygwin/include/pthread.h @@ -244,7 +244,7 @@ int pthread_getattr_np (pthread_t, pthread_attr_t *); int pthread_getname_np (pthread_t, char *, size_t) __attribute__((__nonnull__(2))); int pthread_setaffinity_np (pthread_t, size_t, const cpu_set_t *); int pthread_setname_np (pthread_t, const char *) __attribute__((__nonnull__(2))); -int pthread_sigqueue (pthread_t *, int, const union sigval); +int pthread_sigqueue (pthread_t, int, const union sigval); int pthread_timedjoin_np (pthread_t, void **, const struct timespec *); int pthread_tryjoin_np (pthread_t, void **); #endif diff --git a/winsup/cygwin/release/3.5.5 b/winsup/cygwin/release/3.5.5 index 9cc51dc2e..2ca4572db 100644 --- a/winsup/cygwin/release/3.5.5 +++ b/winsup/cygwin/release/3.5.5 @@ -30,3 +30,6 @@ Fixes: - Fix a problem that signal handler destroys the FPU context. Addresses: https://cygwin.com/pipermail/cygwin/2024-October/256503.html + +- Fix type of pthread_sigqueue() first parameter to match Linux. + Addresses: https://cygwin.com/pipermail/cygwin/2024-September/256439.html diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 0c6f57032..9ee96504b 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -3301,13 +3301,13 @@ pthread_sigmask (int operation, const sigset_t *set, sigset_t *old_set) } int -pthread_sigqueue (pthread_t *thread, int sig, const union sigval value) +pthread_sigqueue (pthread_t thread, int sig, const union sigval value) { siginfo_t si = {0}; - if (!pthread::is_good_object (thread)) + if (!pthread::is_good_object (&thread)) return EINVAL; - if (!(*thread)->valid) + if (!thread->valid) return ESRCH; si.si_signo = sig; @@ -3315,7 +3315,7 @@ pthread_sigqueue (pthread_t *thread, int sig, const union sigval value) si.si_value = value; si.si_pid = myself->pid; si.si_uid = myself->uid; - return (int) sig_send (NULL, si, (*thread)->cygtls); + return (int) sig_send (NULL, si, thread->cygtls); } /* Cancelability */ -- 2.45.1