On 17/03/2023 10:57, Amit Daniel Kachhap wrote:
Replace the busy loop with the lightweight waitpid() syscall (Instead of existing waitid()) to wait for the child to exit normally.
I don't have anything against using waitid or waitpid, but I would rather we use the same one everywhere, unless there's a specific reason to use one or the other.
I wanted to use waitpid() as waitid() is used for advanced clone tests below and they further makes use of the the parameters siginfo, wait_ru.
As it may also make the tests repetitive so thought of using lightweight wait syscall for these initial clone tests.
Sure, I understand the rationale for using the simpler waitpid() when we just want to wait for a process to exit.
My issue is rather that our use of waitid() becomes inconsistent. The tests in signal.c could use waitpid() in the same way, and arguably run_clone3() too when waiting for the child to exit. None of these actually use either wait_si or wait_ru. Maybe we could have a separate patch that introduces waitpid() in freestanding.h and converts these calls to using waitpid(), and then this patch that replaces the busy loop with (the now already available) waitpid()?
Kevin