syscalls: faccessat

This commit is contained in:
Matheus
2023-07-05 00:02:18 -03:00
parent 2bb044ffe2
commit f31295460c
4 changed files with 86 additions and 7 deletions
+14 -4
View File
@@ -133,10 +133,10 @@ index 0000000..e5b087a
+
diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
new file mode 100644
index 0000000..6b6d167
index 0000000..f931e99
--- /dev/null
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
@@ -0,0 +1,246 @@
@@ -0,0 +1,255 @@
+#include <bits/ensure.h>
+#include <mlibc/debug.hpp>
+#include <mlibc/all-sysdeps.hpp>
@@ -192,6 +192,15 @@ index 0000000..6b6d167
+ return 0;
+ }
+
+ int sys_faccessat(int dirfd, const char *pathname, int mode, int flags){
+ long ret;
+ return syscall(SYSCALL_FACCESSAT, &ret, dirfd, (uint64_t)pathname, mode, flags);
+ }
+
+ int sys_access(const char *path, int mode){
+ return sys_faccessat(AT_FDCWD, path, mode, 0);
+ }
+
+ int sys_pipe(int *fds, int flags) {
+ long ret = 0;
+ long err = syscall(SYSCALL_PIPE2, &ret, flags);
@@ -402,10 +411,10 @@ index 0000000..990eca0
+#endif
diff --git mlibc-workdir/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h
new file mode 100644
index 0000000..09c7dd4
index 0000000..3a71f84
--- /dev/null
+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h
@@ -0,0 +1,47 @@
@@ -0,0 +1,48 @@
+#ifndef _SYSCALL_H_INCLUDE
+#define _SYSCALL_H_INCLUDE
+
@@ -433,6 +442,7 @@ index 0000000..09c7dd4
+#define SYSCALL_CHDIR 21
+#define SYSCALL_PIPE2 22
+#define SYSCALL_ISATTY 23
+#define SYSCALL_FACCESSAT 24
+
+#include <stddef.h>
+#include <stdint.h>