Skip to content

Commit 46bf24c

Browse files
ports(mlibc): implement faccessat
Signed-off-by: Anhad Singh <[email protected]>
1 parent 37fdd4e commit 46bf24c

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

patches/mlibc/jinx-working-patch.patch

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,32 @@ index 0000000..1b61d5a
102102
+ ret
103103
+.section .note.GNU-stack,"",%progbits
104104
diff --git mlibc-clean/sysdeps/aero/generic/filesystem.cpp mlibc-workdir/sysdeps/aero/generic/filesystem.cpp
105-
index 33a11f4..fe5773d 100644
105+
index 33a11f4..987dc8e 100644
106106
--- mlibc-clean/sysdeps/aero/generic/filesystem.cpp
107107
+++ mlibc-workdir/sysdeps/aero/generic/filesystem.cpp
108-
@@ -102,31 +102,24 @@ int sys_access(const char *filename, int mode) {
108+
@@ -89,44 +89,38 @@ int sys_close(int fd) {
109+
return 0;
110+
}
111+
112+
-int sys_access(const char *filename, int mode) {
113+
- auto result =
114+
- syscall(SYS_ACCESS, AT_FDCWD, filename, strlen(filename), mode, 0);
115+
-
116+
- if (result < 0) {
117+
- return -result;
118+
- }
119+
-
120+
+int sys_faccessat(int dirfd, const char *pathname, int mode, int flags) {
121+
+ auto ret = syscall(SYS_ACCESS, dirfd, pathname, strlen(pathname), mode, flags);
122+
+ if(int e = sc_error(ret); e)
123+
+ return e;
124+
return 0;
125+
}
109126

127+
+int sys_access(const char *filename, int mode) {
128+
+ return sys_faccessat(AT_FDCWD, filename, mode, 0);
129+
+}
130+
+
110131
int sys_stat(fsfd_target fsfdt, int fd, const char *path, int flags,
111132
struct stat *statbuf) {
112133
- auto result = 0;
@@ -118,7 +139,7 @@ index 33a11f4..fe5773d 100644
118139
+ fd = AT_FDCWD;
119140
break;
120141
- }
121-
-
142+
122143
- case fsfd_target::fd: {
123144
- result = syscall(SYS_FSTAT, fd, statbuf);
124145
+ case fsfd_target::fd:
@@ -149,7 +170,7 @@ index 33a11f4..fe5773d 100644
149170
return 0;
150171
}
151172

152-
@@ -212,6 +205,17 @@ int sys_unlinkat(int fd, const char *path, int flags) {
173+
@@ -212,6 +206,17 @@ int sys_unlinkat(int fd, const char *path, int flags) {
153174
return 0;
154175
}
155176

0 commit comments

Comments
 (0)