summaryrefslogtreecommitdiff
path: root/src/kernel/proc.c
diff options
context:
space:
mode:
authordzwdz2023-06-11 19:17:39 +0200
committerdzwdz2023-06-11 19:17:39 +0200
commit84fa0102c6906252999967925f32098ab6d5a259 (patch)
tree00bd8c98a68e4882e2f42510c9c55932ef855ba3 /src/kernel/proc.c
parentff154205e1671e11ed8566740c1cefaad79c2512 (diff)
kernel: replace await with wait2, roughly compatible with POSIX
dash works now :^)))
Diffstat (limited to 'src/kernel/proc.c')
-rw-r--r--src/kernel/proc.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/kernel/proc.c b/src/kernel/proc.c
index ecbd839..3ef35c0 100644
--- a/src/kernel/proc.c
+++ b/src/kernel/proc.c
@@ -349,7 +349,18 @@ void proc_tryreap(Proc *dead) {
if (parent->state != PS_WAITS4CHILDDEATH) {
return; /* don't reap yet */
}
- regs_savereturn(&parent->regs, dead->death_msg);
+ if (parent->awaited_death.legacy) {
+ regs_savereturn(&parent->regs, dead->death_msg);
+ } else {
+ regs_savereturn(&parent->regs, proc_ns_id(parent->pns, dead));
+ if (parent->awaited_death.out) {
+ struct sys_wait2 __user *out = parent->awaited_death.out;
+ struct sys_wait2 data;
+ memset(&data, 0, sizeof data);
+ data.status = dead->death_msg;
+ pcpy_to(parent, out, &data, sizeof data);
+ }
+ }
proc_setstate(parent, PS_RUNNING);
}
/* can't be reaped anymore */