diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-11-28 22:01:24 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-11-28 22:01:24 +0100 |
commit | d90104f9e00906ee4144e43d33cfb6ad3a9cc38d (patch) | |
tree | 559fbcc92ca3480cbcacef99bfa422af4cf6fa62 /Kernel/Scheduler.cpp | |
parent | 938d1b8bfb2d05911ebf0f06b9d8e19a15f50630 (diff) | |
download | serenity-d90104f9e00906ee4144e43d33cfb6ad3a9cc38d.zip |
Let reap() communicate the dead process's exit status to the caller.
This way the scheduler doesn't need to plumb the exit status into the waiter.
We still plumb the waitee pid though, I don't love it but it can be fixed.
Diffstat (limited to 'Kernel/Scheduler.cpp')
-rw-r--r-- | Kernel/Scheduler.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 989ed0cfbb..c2471dfbe7 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -39,7 +39,6 @@ bool Scheduler::pick_next() if (child.state() != Process::Dead) return true; if (process.waitee() == -1 || process.waitee() == child.pid()) { - process.m_waitee_status = (child.m_termination_status << 8) | child.m_termination_signal; process.m_waitee = child.pid(); process.unblock(); return false; @@ -75,8 +74,12 @@ bool Scheduler::pick_next() } if (process.state() == Process::Dead) { - if (current != &process && !Process::from_pid(process.ppid())) - Process::reap(process); + if (current != &process && !Process::from_pid(process.ppid())) { + auto name = process.name(); + auto pid = process.pid(); + auto exit_status = Process::reap(process); + kprintf("reaped unparented process %s(%u), exit status: %u\n", name.characters(), pid, exit_status); + } return true; } |