1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +00:00

Kernel: Implement sigsuspend using a SignalBlocker

`sigsuspend` was previously implemented using a poll on an empty set of
file descriptors. However, this broke quite a few assumptions in
`SelectBlocker`, as it verifies at least one file descriptor to be
ready after waking up and as it relies on being notified by the file
descriptor.

A bare-bones `sigsuspend` may also be implemented by relying on any of
the `sigwait` functions, but as `sigsuspend` features several (currently
unimplemented) restrictions on how returns work, it is a syscall on its
own.
This commit is contained in:
Tim Schumacher 2022-05-13 13:15:45 +02:00 committed by Brian Gianforcaro
parent edbffb3c7a
commit cf0ad3715e
4 changed files with 28 additions and 1 deletions

View file

@ -175,7 +175,8 @@ void siglongjmp(jmp_buf env, int val)
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigsuspend.html
int sigsuspend(sigset_t const* set)
{
return pselect(0, nullptr, nullptr, nullptr, nullptr, set);
int rc = syscall(SC_sigsuspend, set);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
// https://pubs.opengroup.org/onlinepubs/009604499/functions/sigwait.html