LibC: Implement pthread cancelation
This code is not tested at all but it looks correct xD
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int creat(const char* path, mode_t mode)
|
||||
{
|
||||
pthread_testcancel();
|
||||
return open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
||||
}
|
||||
|
||||
int open(const char* path, int oflag, ...)
|
||||
{
|
||||
pthread_testcancel();
|
||||
|
||||
va_list args;
|
||||
va_start(args, oflag);
|
||||
mode_t mode = va_arg(args, mode_t);
|
||||
@@ -20,6 +24,8 @@ int open(const char* path, int oflag, ...)
|
||||
|
||||
int openat(int fd, const char* path, int oflag, ...)
|
||||
{
|
||||
pthread_testcancel();
|
||||
|
||||
va_list args;
|
||||
va_start(args, oflag);
|
||||
mode_t mode = va_arg(args, mode_t);
|
||||
@@ -30,6 +36,8 @@ int openat(int fd, const char* path, int oflag, ...)
|
||||
|
||||
int fcntl(int fildes, int cmd, ...)
|
||||
{
|
||||
pthread_testcancel();
|
||||
|
||||
va_list args;
|
||||
va_start(args, cmd);
|
||||
int extra = va_arg(args, int);
|
||||
|
||||
Reference in New Issue
Block a user