summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/signal.cpp
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2022-06-12 15:15:09 +0200
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-07-22 10:07:15 -0700
commitc85f307e6233397993e18b31d0034ed77bed73d9 (patch)
tree9a9e344799bb9588b848273d0fecbffe1957e3d4 /Userland/Libraries/LibC/signal.cpp
parent899fd74f8ecc7c0b57a555babbad445f87ac36b4 (diff)
downloadserenity-c85f307e6233397993e18b31d0034ed77bed73d9.zip
LibC: Mark a bunch of functions as cancellation points
Diffstat (limited to 'Userland/Libraries/LibC/signal.cpp')
-rw-r--r--Userland/Libraries/LibC/signal.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/signal.cpp b/Userland/Libraries/LibC/signal.cpp
index 850dd48caa..f15a313d75 100644
--- a/Userland/Libraries/LibC/signal.cpp
+++ b/Userland/Libraries/LibC/signal.cpp
@@ -6,6 +6,7 @@
#include <AK/Format.h>
#include <assert.h>
+#include <bits/pthread_cancel.h>
#include <errno.h>
#include <setjmp.h>
#include <signal.h>
@@ -175,6 +176,8 @@ void siglongjmp(jmp_buf env, int val)
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigsuspend.html
int sigsuspend(sigset_t const* set)
{
+ __pthread_maybe_cancel();
+
int rc = syscall(SC_sigsuspend, set);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
@@ -182,6 +185,8 @@ int sigsuspend(sigset_t const* set)
// https://pubs.opengroup.org/onlinepubs/009604499/functions/sigwait.html
int sigwait(sigset_t const* set, int* sig)
{
+ __pthread_maybe_cancel();
+
int rc = syscall(Syscall::SC_sigtimedwait, set, nullptr, nullptr);
VERIFY(rc != 0);
if (rc < 0)
@@ -199,6 +204,8 @@ int sigwaitinfo(sigset_t const* set, siginfo_t* info)
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigtimedwait.html
int sigtimedwait(sigset_t const* set, siginfo_t* info, struct timespec const* timeout)
{
+ __pthread_maybe_cancel();
+
int rc = syscall(Syscall::SC_sigtimedwait, set, info, timeout);
__RETURN_WITH_ERRNO(rc, rc, -1);
}