diff options
author | Anton Kling <anton@kling.gg> | 2023-11-15 02:44:45 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-15 21:40:13 +0100 |
commit | e22e493940266e0aa9be2bf58df1821a3539e19b (patch) | |
tree | 64d3516642fae984b5f801db3348d884f661731d /userland/libc | |
parent | 6747f9407a061684c2fba837541c254f48bfcff0 (diff) |
Kernel/LibC: Add chdir function and syscall
Diffstat (limited to 'userland/libc')
-rw-r--r-- | userland/libc/include/syscall.h | 1 | ||||
-rw-r--r-- | userland/libc/include/unistd.h | 1 | ||||
-rw-r--r-- | userland/libc/unistd/chdir.c | 4 |
3 files changed, 6 insertions, 0 deletions
diff --git a/userland/libc/include/syscall.h b/userland/libc/include/syscall.h index 3faafbf..bd1d9fc 100644 --- a/userland/libc/include/syscall.h +++ b/userland/libc/include/syscall.h @@ -36,6 +36,7 @@ #define SYS_SENDTO 28 #define SYS_KILL 29 #define SYS_SIGACTION 30 +#define SYS_CHDIR 31 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 7d74097..5654752 100644 --- a/userland/libc/include/unistd.h +++ b/userland/libc/include/unistd.h @@ -21,4 +21,5 @@ 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 +int chdir(const char *path); #endif diff --git a/userland/libc/unistd/chdir.c b/userland/libc/unistd/chdir.c new file mode 100644 index 0000000..90b30ae --- /dev/null +++ b/userland/libc/unistd/chdir.c @@ -0,0 +1,4 @@ +#include <unistd.h> +#include <syscall.h> + +int chdir(const char *path) { RC_ERRNO(syscall(SYS_CHDIR, path, 0, 0, 0, 0)); } |