banan-os/libc/fcntl.cpp

16 lines
236 B
C++
Raw Normal View History

2023-04-23 14:32:37 +03:00
#include <fcntl.h>
#include <errno.h>
#include <sys/syscall.h>
#include <unistd.h>
int open(const char* path, int oflag, ...)
{
int ret = syscall(SYS_OPEN, path, oflag);
if (ret < 0)
{
errno = -ret;
return -1;
}
return ret;
}