diff options
author | Anton Kling <anton@kling.gg> | 2023-11-15 21:13:36 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-15 22:11:26 +0100 |
commit | 835101f96e7c9fca00940e967c471c33e4e4dae9 (patch) | |
tree | 9c48b871d4b547fac8c3a2eda6c21242e593fdfd /userland/libc | |
parent | c9358cdeac4522922df46fb6e3ab6a517203ec99 (diff) |
VFS/LibC: Add getcwd()
Diffstat (limited to 'userland/libc')
-rw-r--r-- | userland/libc/include/syscall.h | 1 | ||||
-rw-r--r-- | userland/libc/include/unistd.h | 3 | ||||
-rw-r--r-- | userland/libc/unistd/getcwd.c | 6 |
3 files changed, 9 insertions, 1 deletions
diff --git a/userland/libc/include/syscall.h b/userland/libc/include/syscall.h index bd1d9fc..32d7b33 100644 --- a/userland/libc/include/syscall.h +++ b/userland/libc/include/syscall.h @@ -37,6 +37,7 @@ #define SYS_KILL 29 #define SYS_SIGACTION 30 #define SYS_CHDIR 31 +#define SYS_GETCWD 32 int syscall(uint32_t eax, uint32_t ebx, uint32_t ecx, uint32_t edx, uint32_t esi, uint32_t edi); diff --git a/userland/libc/include/unistd.h b/userland/libc/include/unistd.h index 5654752..89c48d0 100644 --- a/userland/libc/include/unistd.h +++ b/userland/libc/include/unistd.h @@ -20,6 +20,7 @@ int unlink(const char *path); int execvp(const char *file, char *const argv[]); void _exit(int status); void msleep(uint32_t ms); // not standard -uint32_t uptime(void); // not standard +uint32_t uptime(void); // not standard int chdir(const char *path); +char *getcwd(char *buf, size_t size); #endif diff --git a/userland/libc/unistd/getcwd.c b/userland/libc/unistd/getcwd.c new file mode 100644 index 0000000..6050c95 --- /dev/null +++ b/userland/libc/unistd/getcwd.c @@ -0,0 +1,6 @@ +#include <syscall.h> +#include <unistd.h> + +char *getcwd(char *buf, size_t size) { + return syscall(SYS_GETCWD, buf, size, NULL, NULL, NULL); +} |