aboutsummaryrefslogtreecommitdiff
path: root/common/uapi
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-11-11 19:46:22 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-11-11 19:46:22 +0200
commit1d37792fb7a47135f0e7b7fc245e83bb1d8fc496 (patch)
tree09ec92012bb9d74d5d26bc7a4a7647c36c9acb3e /common/uapi
parent9edd65c48ee75751327c6ee6d42a7009e726d667 (diff)
downloadkmi-1d37792fb7a47135f0e7b7fc245e83bb1d8fc496.tar.gz
kmi-1d37792fb7a47135f0e7b7fc245e83bb1d8fc496.zip
less buggy fork
+ Not strictly done yet, but we can swap between two processes :D
Diffstat (limited to 'common/uapi')
-rw-r--r--common/uapi/proc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/uapi/proc.c b/common/uapi/proc.c
index 5dbd90c..969dcd6 100644
--- a/common/uapi/proc.c
+++ b/common/uapi/proc.c
@@ -62,8 +62,9 @@ SYSCALL_DEFINE0(fork)(){
if (!t)
return SYS_RET1(ERR_OOMEM);
- /* prepare args for when we eventually swap to the new proc */
- set_args(t, SYS_RET2(OK, 0));
+ /* prepare args for when we eventually swap to the new proc, giving
+ * parent ID as third return value */
+ set_args(t, SYS_RET3(OK, 0, c->pid));
return SYS_RET2(OK, t->pid);
}
@@ -166,5 +167,9 @@ SYSCALL_DEFINE1(swap)(sys_arg_t tid){
/* switch over to new thread */
use_tcb(t);
+ /* set return value for current thread */
+ set_args(c, SYS_RET1(OK));
+
+ /* get register state for new thread */
return get_args(t);
}