From 08b63b747f9a6b4d1460195f6ca68680abcdd656 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Fri, 24 Nov 2023 21:29:12 +0100 Subject: Refactor open() --- userland/libc/fcntl/open.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 userland/libc/fcntl/open.c (limited to 'userland/libc/fcntl/open.c') diff --git a/userland/libc/fcntl/open.c b/userland/libc/fcntl/open.c new file mode 100644 index 0000000..37bb629 --- /dev/null +++ b/userland/libc/fcntl/open.c @@ -0,0 +1,15 @@ +#include +#include +#include + +int open(const char *file, int flags, ...) { + mode_t mode = 0; + + if (flags & O_CREAT) { + va_list ap; + va_start(ap, flags); + mode = va_arg(ap, mode_t); + va_end(ap); + } + RC_ERRNO(syscall(SYS_OPEN, file, flags, mode, 0, 0)); +} -- cgit v1.2.3