1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27: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

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <bits/pthread_cancel.h>
#include <errno.h>
#include <stdio.h>
#include <sys/poll.h>
@ -18,6 +19,8 @@ extern "C" {
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/select.html
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timeval* timeout_tv)
{
__pthread_maybe_cancel();
timespec* timeout_ts = nullptr;
timespec timeout;
if (timeout_tv) {
@ -30,6 +33,8 @@ int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timev
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html
int pselect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timespec const* timeout, sigset_t const* sigmask)
{
__pthread_maybe_cancel();
Vector<pollfd, FD_SETSIZE> fds;
if (nfds < 0 || static_cast<size_t>(nfds) >= fds.capacity())