From 642b5fb0007b64c77d186fcb018d571152ee1d47 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Mon, 14 Aug 2023 18:51:07 +0200 Subject: reorganization: first steps --- src/libc/fcntl.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/libc/fcntl.c (limited to 'src/libc/fcntl.c') diff --git a/src/libc/fcntl.c b/src/libc/fcntl.c new file mode 100644 index 0000000..b2d8685 --- /dev/null +++ b/src/libc/fcntl.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include +#include +#include + +#include + +int open(const char *path, int flags, ...) { + (void)path; (void)flags; + _klogf("failing open(\"%s\")", path); + return errno = ENOSYS, -1; +} + +int fcntl(int fd, int cmd, ...) { + va_list argp; + va_start(argp, cmd); + if (cmd == F_DUPFD) { + int to = va_arg(argp, int); + va_end(argp); + return _sys_dup(fd, to, DUP_SEARCH); + } else { + va_end(argp); + _klogf("failing fcntl(%d)", cmd); + return errno = ENOSYS, -1; + } +} -- cgit v1.2.3