app: Fix signal handling of terminated children

When a child process terminates, the parent is sent a SIGCHLD signal. We
catch this, see if the reason for termination was _not_ a SIGKILL or
SIGTERM (in these cases the application wants to shutdown) and if so set
the create_new_server flag to 1.

This generally works fine. However, there is potential for child
terminations to be missed. This can happen if multiple children die
simultaneously, the signal handler will be called for the first signal,
but while it's processing that signal, it won't get any others. Thus
if two children terminate simultaneously, the SIGCHLD signal handler
will only be called once and only one new server will be created.

The fix for this is quite simple, we just loop around waitpid() with the
WNOHANG option set until there are no more children left to wait on.

Each time around the loop we now increment the create_new_server
variable, renamed to create_nr_new_server and pass that variable into
create_new_server() in the main loop.

Signed-off-by: Andrew Clayton <andrew@opentechlabs.co.uk>