Path: blob/main/system/lib/libc/sigtimedwait.c
6162 views
/*1* Copyright 2021 The Emscripten Authors. All rights reserved.2* Emscripten is available under two separate licenses, the MIT license and the3* University of Illinois/NCSA Open Source License. Both these licenses can be4* found in the LICENSE file.5*/67#include <signal.h>8#include <errno.h>9#include "syscall.h"10#include "libc.h"1112extern sigset_t __sig_pending;1314int sigtimedwait(const sigset_t *restrict mask, siginfo_t *restrict si, const struct timespec *restrict timeout) {15for (int sig = 0; sig < _NSIG; sig++) {16if (sigismember(mask, sig) && sigismember(&__sig_pending, sig)) {17if (si) {18siginfo_t t = {0};19*si = t;20}21sigdelset(&__sig_pending, sig);22return sig;23}24}2526errno = EINVAL;27return -1;28}293031