summaryrefslogtreecommitdiff
path: root/lib/libc/fcntl/openat.c
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
commitfc00c656c96528112d05cf0edf8631bd5eaea446 (patch)
treea6e0e6c588191a8bd1c64afc3b7a258e3e66c236 /lib/libc/fcntl/openat.c
Add build system scaffolding and libc headers
Diffstat (limited to 'lib/libc/fcntl/openat.c')
-rw-r--r--lib/libc/fcntl/openat.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/libc/fcntl/openat.c b/lib/libc/fcntl/openat.c
new file mode 100644
index 00000000..bb34d600
--- /dev/null
+++ b/lib/libc/fcntl/openat.c
@@ -0,0 +1,17 @@
+#include <fcntl.h>
+#include <stdarg.h>
+#include <syscall.h>
+
+int openat(int fd, const char *path, int oflag, ...)
+{
+ mode_t mode = 0;
+
+ if (oflag & O_CREAT) {
+ va_list ap;
+ va_start(ap, oflag);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+ }
+
+ return syscall(openat, fd, path, oflag, mode);
+}