Luna/libs/libc/src/fcntl.cpp

26 lines
581 B
C++
Raw Normal View History

#include <fcntl.h>
#include <stdarg.h>
2022-10-16 15:27:15 +00:00
#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);
2022-10-16 15:27:15 +00:00
long result = syscall(SYS_fcntl, fd, cmd, va_arg(ap, uintptr_t));
va_end(ap);
return (int)result;
}
}