summaryrefslogtreecommitdiff
path: root/userland/libc
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc')
-rw-r--r--userland/libc/include/syscall.h1
-rw-r--r--userland/libc/include/unistd.h3
-rw-r--r--userland/libc/unistd/getcwd.c6
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);
+}