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

LibC: Mark a bunch of functions as cancellation points

This commit is contained in:
Tim Schumacher 2022-06-12 15:15:09 +02:00 committed by Brian Gianforcaro
parent 899fd74f8e
commit c85f307e62
15 changed files with 78 additions and 0 deletions

View file

@ -5,6 +5,7 @@
*/
#include <assert.h>
#include <bits/pthread_cancel.h>
#include <errno.h>
#include <sys/wait.h>
#include <syscall.h>
@ -21,6 +22,8 @@ pid_t wait(int* wstatus)
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html
pid_t waitpid(pid_t waitee, int* wstatus, int options)
{
__pthread_maybe_cancel();
siginfo_t siginfo;
idtype_t idtype;
id_t id;
@ -78,6 +81,8 @@ pid_t waitpid(pid_t waitee, int* wstatus, int options)
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/waitid.html
int waitid(idtype_t idtype, id_t id, siginfo_t* infop, int options)
{
__pthread_maybe_cancel();
Syscall::SC_waitid_params params { idtype, id, infop, options };
int rc = syscall(SC_waitid, &params);
__RETURN_WITH_ERRNO(rc, rc, -1);