Thanks vVv, I like the idea.
But it still doesn't give me the control I need of the processes descendants.
The problem is (i think) that the kill() function only (depending on the specified signal - in my case SIGKILL) kills the process with the specified PID, leaving processes called by the process (with PID) orphaned and owned by init.
Now I presume this would not happen if I called exit() within the process (PID). i.e. the child process is terminated fully.
It would solve my problems if the timeout caused an exit within the child process (with PID).
execv("/bin/sh",argv); //if this hangs here its terminated with kill after a select timeout
exit(1); //this never gets called
Do you agree?