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.
Code:
kill(pid,SIGKILL):
waitpid(pid,NULL,0);
Now I presume this would not happen if I called exit() within the process (PID). i.e. the child process is terminated fully.
Code:
execv("/bin/sh",argv); //if this hangs here its terminated with kill after a select timeout
exit(1); //this never gets called
It would solve my problems if the timeout caused an exit within the child process (with PID).
Do you agree?