From f69b6c845c2ab8a61c0b7b63d0262fb8b9b75ff0 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Fri, 10 Jan 2014 16:16:30 +0100 Subject: [PATCH] Add pthread_sigmask(3). --- libc/include/signal.h | 2 +- libpthread/Makefile | 1 + libpthread/pthread_sigmask.c++ | 35 ++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 libpthread/pthread_sigmask.c++ diff --git a/libc/include/signal.h b/libc/include/signal.h index 3b7efd2e..eb70a84c 100644 --- a/libc/include/signal.h +++ b/libc/include/signal.h @@ -207,7 +207,7 @@ int killpg(pid_t, int); void psiginfo(const siginfo_t*, const char*); void psignal(int, const char*); /* TODO: int pthread_kill(pthread_t, int); */ -/* TODO: int pthread_sigmask(int, const sigset_t* __restrict, sigset_t* __restrict); */ +int pthread_sigmask(int, const sigset_t* __restrict, sigset_t* __restrict); int raise(int sig); int sigaction(int, const struct sigaction* __restrict, struct sigaction* __restrict); int sigaddset(sigset_t*, int); diff --git a/libpthread/Makefile b/libpthread/Makefile index 2f63fe21..aaa209ac 100644 --- a/libpthread/Makefile +++ b/libpthread/Makefile @@ -46,6 +46,7 @@ pthread_rwlock_unlock.o \ pthread_rwlock_wrlock.o \ pthread_self.o \ pthread_setspecific.o \ +pthread_sigmask.o \ BINS:=libpthread.a diff --git a/libpthread/pthread_sigmask.c++ b/libpthread/pthread_sigmask.c++ new file mode 100644 index 00000000..e5fdb44e --- /dev/null +++ b/libpthread/pthread_sigmask.c++ @@ -0,0 +1,35 @@ +/******************************************************************************* + + Copyright(C) Jonas 'Sortie' Termansen 2014. + + This file is part of Sortix libpthread. + + Sortix libpthread is free software: you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + Sortix libpthread is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with Sortix libpthread. If not, see . + + pthread_sigmask.c++ + Examine and change blocked signals. + +*******************************************************************************/ + +#include +#include +#include + +extern "C" +int pthread_sigmask(int how, + const sigset_t* restrict set, + sigset_t* restrict oldset) +{ + return sigprocmask(how, set, oldset) < 0 ? errno : 0; +}