summaryrefslogtreecommitdiff
path: root/lib/libc/fcntl/openat.c
diff options
context:
space:
mode:
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);
+}