Skip to content

Commit

Permalink
fix return of pthread_sigmask, as it needs to be errno in case of a e…
Browse files Browse the repository at this point in the history
…rror and not what sigprocmask gives back
  • Loading branch information
SilvanScherrer committed Jan 6, 2020
1 parent 4075a3e commit ac3faa6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Makefile.kmk
Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions src/pthread.def
Expand Up @@ -62,3 +62,4 @@ _pthread_rwlock_tryrdlock
_pthread_rwlock_rdlock
_pthread_rwlock_trywrlock
_pthread_rwlock_wrlock
_pthread_sigmask
3 changes: 2 additions & 1 deletion src/pthread.h
Expand Up @@ -4,6 +4,7 @@

#include <errno.h>
#include <time.h>
#include <signal.h>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/pthread_sigmask.c
@@ -0,0 +1,10 @@
#include <errno.h>
#include <signal.h>

#include "pthread.h"

int pthread_sigmask(int how, const sigset_t *newmask, sigset_t *oldmask)
{
return sigprocmask(how, newmask, oldmask) == -1 ? errno : 0;
}

0 comments on commit ac3faa6

Please sign in to comment.