Is there a simple way to limit the amount of time that a program
(vfork()+execvp()) can run?
i.e., can you do this:

unsigned timeout;

main thread:
...
pthread_create(.., p1, ...)
pthread_create(..., p2, ...)
pthread_join(p1)
pthread_join(p2)

p1:
fd = open("foo", O_RDONLY)
dup2(fd, 1)
execvp("bar", ...)

p2:
time_t time_ = time
if (time - _time >= timeout)
pthread_kill(p1, 9)