Previously dead teams were always returned (as needed for wait/waitpid). Using waitid it should however be possible to omit the WEXITED flag to only get stopped (WUNTRACED | WSTOPPED) or continued (WCONTINUED) teams.
Adjust the other caller of the _kern_wait_for_child syscall, used by the
various less specific wait* functions, to always include WEXITED. This avoids having to special case waitid in the syscall interface or with an extra flag.
Add a check to ensure that any of these flags is set to avoid the now possible case of nothing being specified. This fails with B_BAD_VALUE (EINVAL) as on other systems.
36ef138ce5 kernel: Implement WEXITED for waitid.
src/system/kernel/team.cpp | 17 +++++++++++++----
src/system/libroot/posix/sys/wait.cpp | 3 ++-
2 files changed, 15 insertions(+), 5 deletions(-)