timeout: refactor helper func for wait-then-signal
timeout: refactor helper func for wait-then-signal

Factor a helper function `wait_or_kill_process()` out of the main
`timeout()` function. This helper function contains the code to wait
for a child process and send the `SIGKILL` signal if it does not
terminate within a specified amount of time. This does not change the
function of `timeout`, just the organization of the code.

uutils/coreutils,uutils/coreutils,uutils/coreutils