From e89e984ccbfe56a2500f7407d329b99b1d604e40 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Fri, 21 Mar 2025 01:17:21 +0000 Subject: [PATCH] feat(userspace/libc): implement access() Signed-off-by: EnderIce2 --- Userspace/libc/include/unistd.h | 2 +- Userspace/libc/src/std/unistd.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Userspace/libc/include/unistd.h b/Userspace/libc/include/unistd.h index 57a19a43..2b3af1e7 100644 --- a/Userspace/libc/include/unistd.h +++ b/Userspace/libc/include/unistd.h @@ -59,7 +59,7 @@ extern "C" extern int optind, opterr, optopt; extern char **environ; - int access(const char *, int); + int access(const char *path, int amode); unsigned int alarm(unsigned int seconds); int brk(void *); int chdir(const char *); diff --git a/Userspace/libc/src/std/unistd.c b/Userspace/libc/src/std/unistd.c index 721efea8..06563a7a 100644 --- a/Userspace/libc/src/std/unistd.c +++ b/Userspace/libc/src/std/unistd.c @@ -29,7 +29,10 @@ export char *optarg; export int optind, opterr, optopt; export char **environ; -export int access(const char *, int); +export int access(const char *path, int amode) +{ + return __check_errno(sysdep(Access)(path, amode), -1); +} export unsigned int alarm(unsigned int seconds) {