summaryrefslogtreecommitdiff
path: root/src/kernel/syscalls.c
diff options
context:
space:
mode:
authordzwdz2023-08-27 02:06:32 +0200
committerdzwdz2023-08-27 02:06:32 +0200
commite43939bcc6123e02314aa403eef94d5ace441f7f (patch)
treeac0cea10e8708ae1a6a7a400257c4bc59175a91f /src/kernel/syscalls.c
parent1f938c20b4a82ca1267ab9a1ec0922878a21ca6b (diff)
ports: qbe, cproc :^)
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r--src/kernel/syscalls.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index ebdf64e..a8b47ae 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -26,6 +26,7 @@ long _sys_await(void) {
bool has_children = false;
proc_setstate(proc_cur, PS_WAITS4CHILDDEATH);
proc_cur->awaited_death.legacy = true;
+ proc_cur->awaited_death.pid = 0;
for (Proc *iter = proc_cur->child;
iter; iter = iter->sibling)
@@ -403,7 +404,7 @@ uint32_t _sys_getppid(void) {
}
int _sys_wait2(int pid, int flags, struct sys_wait2 __user *out) {
- if (pid != -1 || flags != 0) {
+ if (flags != 0) {
SYSCALL_RETURN(-ENOSYS);
}
@@ -411,13 +412,13 @@ int _sys_wait2(int pid, int flags, struct sys_wait2 __user *out) {
proc_setstate(proc_cur, PS_WAITS4CHILDDEATH);
proc_cur->awaited_death.legacy = false;
proc_cur->awaited_death.out = out;
+ proc_cur->awaited_death.pid = (0 < pid) ? pid : 0;
for (Proc *iter = proc_cur->child; iter; iter = iter->sibling) {
if (iter->noreap) continue;
has_children = true;
if (iter->state == PS_TOREAP) {
proc_tryreap(iter);
- return 0; // dummy
}
}