Watch for stopped child processes (waitpid's WUNTRACED)
Submitted by Mark Seaborn
glib's event loop currently provides no way to find out when child processes have been stopped with SIGSTOP, something which is important for shells. glib doesn't make waitpid()'s WUNTRACED flag available and it sets the SA_NOCLDSTOP flag on the SIGCHLD signal handler.
Here is a patch to allow child watches to report child-stopped statuses. The existing g_child_watch_add_full() doesn't have a flags argument, so I added a g_child_watch_source_include_stops() function to set a flag on a GChildWatchSource. This interface could be improved. Should I add variants of g_child_watch_add() and g_child_watch_add_full() that report stopped processes?
The patch removes setting of SA_NOCLDSTOP, even when the new child watches are not used. This means the main loop will be woken up by SIGCHLD in more cases, but that shouldn't be a big problem; it will still not busy-wait.