I'm writing a SIGCHLD handler and I'm wondering under what conditions would a call to waitpid() return -1?
More specifically, if I create a loop in which I call waitpid(...) and want it to run until all terminated child processes have been reaped, would I be iterating until waitpid(...) returns -1? Otherwise, how can I know if there are any more children that require reaping?