aboutsummaryrefslogtreecommitdiff
path: root/src/userspace/libc
diff options
context:
space:
mode:
authorMarvin Borner2020-05-07 14:29:28 +0200
committerMarvin Borner2020-05-07 14:29:28 +0200
commit130121dd61a9adf70d1800ceb03007275bfb589d (patch)
tree5b00d9046c5f5a5678479b0ddf1bdbe72bc74158 /src/userspace/libc
parent31767b532e69c5a63df0106fa08e137e3106a449 (diff)
Added wait syscall
Diffstat (limited to 'src/userspace/libc')
-rw-r--r--src/userspace/libc/syscall.c2
-rw-r--r--src/userspace/libc/syscall.h2
-rw-r--r--src/userspace/libc/unistd.h4
-rw-r--r--src/userspace/libc/unistd/wait.c12
4 files changed, 20 insertions, 0 deletions
diff --git a/src/userspace/libc/syscall.c b/src/userspace/libc/syscall.c
index d5c6708..4b5c200 100644
--- a/src/userspace/libc/syscall.c
+++ b/src/userspace/libc/syscall.c
@@ -17,6 +17,8 @@ DEFN_SYSCALL4(write, SYS_WRITE, char *, u32, u32, u8 *);
DEFN_SYSCALL1(exec, SYS_EXEC, char *);
+DEFN_SYSCALL3(wait, SYS_WAIT, u32, u32 *, u32);
+
DEFN_SYSCALL0(get_pid, SYS_GET_PID);
DEFN_SYSCALL1(malloc, SYS_MALLOC, u32);
diff --git a/src/userspace/libc/syscall.h b/src/userspace/libc/syscall.h
index 30925da..bd9d38d 100644
--- a/src/userspace/libc/syscall.h
+++ b/src/userspace/libc/syscall.h
@@ -80,6 +80,8 @@ DECL_SYSCALL4(write, char *, u32, u32, u8 *);
DECL_SYSCALL1(exec, char *);
+DECL_SYSCALL3(wait, u32, u32 *, u32);
+
DECL_SYSCALL0(get_pid);
DECL_SYSCALL1(malloc, u32);
diff --git a/src/userspace/libc/unistd.h b/src/userspace/libc/unistd.h
index ac0bacf..876f35c 100644
--- a/src/userspace/libc/unistd.h
+++ b/src/userspace/libc/unistd.h
@@ -15,4 +15,8 @@ u32 read(char *path, u32 offset, u32 count, u8 *buf);
u32 write(char *path, u32 offset, u32 count, u8 *buf);
+// These should be somewhere else ig
+u32 wait(u32 *status);
+u32 wait_pid(u32 pid, u32 *status, u32 options);
+
#endif \ No newline at end of file
diff --git a/src/userspace/libc/unistd/wait.c b/src/userspace/libc/unistd/wait.c
new file mode 100644
index 0000000..7c0a6fb
--- /dev/null
+++ b/src/userspace/libc/unistd/wait.c
@@ -0,0 +1,12 @@
+#include <stdint.h>
+#include <syscall.h>
+
+u32 wait_pid(u32 pid, u32 *status, u32 options)
+{
+ return syscall_wait(pid, status, options);
+}
+
+u32 wait(u32 *status)
+{
+ return wait_pid(-1, status, 0);
+} \ No newline at end of file