2022-10-10 18:45:26 +00:00
|
|
|
#include <fcntl.h>
|
2022-10-15 09:16:34 +00:00
|
|
|
#include <stdarg.h>
|
2022-10-16 15:27:15 +00:00
|
|
|
#include <stdint.h>
|
2022-10-10 18:45:26 +00:00
|
|
|
#include <sys/syscall.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
2022-10-27 05:52:57 +00:00
|
|
|
int open(const char* pathname, int flags, ...)
|
2022-10-10 18:45:26 +00:00
|
|
|
{
|
2022-10-27 05:52:57 +00:00
|
|
|
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;
|
2022-10-10 18:45:26 +00:00
|
|
|
}
|
2022-10-15 09:16:34 +00:00
|
|
|
|
|
|
|
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));
|
2022-10-15 09:16:34 +00:00
|
|
|
va_end(ap);
|
|
|
|
return (int)result;
|
|
|
|
}
|
2022-10-10 18:45:26 +00:00
|
|
|
}
|