mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:54:58 +00:00
LibC: Mark a bunch of functions as cancellation points
This commit is contained in:
parent
899fd74f8e
commit
c85f307e62
15 changed files with 78 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <bits/pthread_cancel.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
|
@ -17,6 +18,8 @@ extern "C" {
|
|||
|
||||
int fcntl(int fd, int cmd, ...)
|
||||
{
|
||||
__pthread_maybe_cancel();
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, cmd);
|
||||
uintptr_t extra_arg = va_arg(ap, uintptr_t);
|
||||
|
@ -46,11 +49,15 @@ int inode_watcher_remove_watch(int fd, int wd)
|
|||
|
||||
int creat(char const* path, mode_t mode)
|
||||
{
|
||||
__pthread_maybe_cancel();
|
||||
|
||||
return open(path, O_CREAT | O_WRONLY | O_TRUNC, mode);
|
||||
}
|
||||
|
||||
int open(char const* path, int options, ...)
|
||||
{
|
||||
__pthread_maybe_cancel();
|
||||
|
||||
if (!path) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
|
@ -71,6 +78,8 @@ int open(char const* path, int options, ...)
|
|||
|
||||
int openat(int dirfd, char const* path, int options, ...)
|
||||
{
|
||||
__pthread_maybe_cancel();
|
||||
|
||||
if (!path) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue