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 /kernel/scalls/getcwd.c | |
parent | c9358cdeac4522922df46fb6e3ab6a517203ec99 (diff) |
VFS/LibC: Add getcwd()
Diffstat (limited to 'kernel/scalls/getcwd.c')
-rw-r--r-- | kernel/scalls/getcwd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/scalls/getcwd.c b/kernel/scalls/getcwd.c new file mode 100644 index 0000000..629d0f5 --- /dev/null +++ b/kernel/scalls/getcwd.c @@ -0,0 +1,11 @@ +#include <math.h> +#include <scalls/getcwd.h> +#include <sched/scheduler.h> + +char *syscall_getcwd(char *buf, size_t size) { + kprintf("syscall_getcwd\n"); + const char *cwd = get_current_task()->current_working_directory; + size_t len = min(size, strlen(cwd)); + strlcpy(buf, get_current_task()->current_working_directory, len); + return buf; +} |