1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

LibC: Implement sigwait()

This is done internally by just calling the more modern sigtimedwait
syscall and then massaging the results to fit sigwait's interface.
This commit is contained in:
Idan Horowitz 2021-12-11 21:21:47 +02:00
parent 640844c965
commit 656b1dd6be
2 changed files with 12 additions and 0 deletions

View file

@ -163,6 +163,17 @@ int sigsuspend(const sigset_t* set)
return pselect(0, nullptr, nullptr, nullptr, nullptr, set);
}
// https://pubs.opengroup.org/onlinepubs/009604499/functions/sigwait.html
int sigwait(sigset_t const* set, int* sig)
{
int rc = syscall(Syscall::SC_sigtimedwait, set, nullptr, nullptr);
VERIFY(rc != 0);
if (rc < 0)
return -rc;
*sig = rc;
return 0;
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigwaitinfo.html
int sigwaitinfo(sigset_t const* set, siginfo_t* info)
{

View file

@ -28,6 +28,7 @@ int sigprocmask(int how, const sigset_t* set, sigset_t* old_set);
int sigpending(sigset_t*);
int sigsuspend(const sigset_t*);
int sigtimedwait(sigset_t const*, siginfo_t*, struct timespec const*);
int sigwait(sigset_t const*, int*);
int sigwaitinfo(sigset_t const*, siginfo_t*);
int raise(int sig);
int getsignalbyname(const char*);