Luna/libs/libc/src/fcntl.cpp

26 lines
581 B
C++

#include <fcntl.h>
#include <stdarg.h>
#include <stdint.h>
#include <sys/syscall.h>
#include <unistd.h>
extern "C"
{
int open(const char* pathname, int flags, ...)
{
va_list ap;
va_start(ap, flags);
long result = syscall(SYS_open, pathname, flags, va_arg(ap, unsigned int));
va_end(ap);
return (int)result;
}
int fcntl(int fd, int cmd, ...)
{
va_list ap;
va_start(ap, cmd);
long result = syscall(SYS_fcntl, fd, cmd, va_arg(ap, uintptr_t));
va_end(ap);
return (int)result;
}
}