From ac3faa6a169be36d2d49554fea4503755d08fef4 Mon Sep 17 00:00:00 2001 From: SilvanScherrer Date: Mon, 6 Jan 2020 11:26:11 +0100 Subject: [PATCH] fix return of pthread_sigmask, as it needs to be errno in case of a error and not what sigprocmask gives back --- src/Makefile.kmk | 1 + src/pthread.def | 1 + src/pthread.h | 3 ++- src/pthread_sigmask.c | 10 ++++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/pthread_sigmask.c diff --git a/src/Makefile.kmk b/src/Makefile.kmk index c65b30b..fddbdc0 100644 --- a/src/Makefile.kmk +++ b/src/Makefile.kmk @@ -20,6 +20,7 @@ LIBRARIES = pthread_s pthread_g pthread_dll pthread_s_SOURCES = \ pthread_attr.c \ + pthread_sigmask.c \ rwlock.c \ my_os2cond.c \ my_os2mutex.c \ diff --git a/src/pthread.def b/src/pthread.def index 79e301a..547d047 100644 --- a/src/pthread.def +++ b/src/pthread.def @@ -62,3 +62,4 @@ _pthread_rwlock_tryrdlock _pthread_rwlock_rdlock _pthread_rwlock_trywrlock _pthread_rwlock_wrlock +_pthread_sigmask diff --git a/src/pthread.h b/src/pthread.h index f93efd4..25f6884 100644 --- a/src/pthread.h +++ b/src/pthread.h @@ -4,6 +4,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -91,7 +92,7 @@ void pthread_setprio( int, int); int pthread_detach (pthread_t thread); int pthread_kill (pthread_t thread, int sig); -#define pthread_sigmask(A,B,C) sigprocmask((A),(B),(C)) +int pthread_sigmask(int, const sigset_t *, sigset_t *); /* * PThread Attribute Functions diff --git a/src/pthread_sigmask.c b/src/pthread_sigmask.c new file mode 100644 index 0000000..bded344 --- /dev/null +++ b/src/pthread_sigmask.c @@ -0,0 +1,10 @@ +#include +#include + +#include "pthread.h" + +int pthread_sigmask(int how, const sigset_t *newmask, sigset_t *oldmask) +{ + return sigprocmask(how, newmask, oldmask) == -1 ? errno : 0; +} +