1570af302Sopenharmony_ci#include <signal.h> 2570af302Sopenharmony_ci#include <errno.h> 3570af302Sopenharmony_ci#include "syscall.h" 4570af302Sopenharmony_ci 5570af302Sopenharmony_ciint pthread_sigmask(int how, const sigset_t *restrict set, sigset_t *restrict old) 6570af302Sopenharmony_ci{ 7570af302Sopenharmony_ci int ret; 8570af302Sopenharmony_ci if (set && (unsigned)how - SIG_BLOCK > 2U) return EINVAL; 9570af302Sopenharmony_ci ret = -__syscall(SYS_rt_sigprocmask, how, set, old, _NSIG/8); 10570af302Sopenharmony_ci if (!ret && old) { 11570af302Sopenharmony_ci if (sizeof old->__bits[0] == 8) { 12570af302Sopenharmony_ci old->__bits[0] &= ~0x380000000ULL; 13570af302Sopenharmony_ci } else { 14570af302Sopenharmony_ci old->__bits[0] &= ~0x80000000UL; 15570af302Sopenharmony_ci old->__bits[1] &= ~0x3UL; 16570af302Sopenharmony_ci } 17570af302Sopenharmony_ci } 18570af302Sopenharmony_ci return ret; 19570af302Sopenharmony_ci}