You CAN use execve(), and probably HAVE to use it. But just keep in mind that the kernel version of this function (the one we're discussing) does not work 100% the same as the userland libc version. Very very similar, except it does not return anything (eg. the PID), but rather just does an exec() from the current process/thread to run the specified command (never returns, as far as I can tell).

So you have to fork the process first, and then somehow figure out the new PID that execve() transmogrifies itself into, and then figure out how to poll for (1) startup, and (2) completion of that thread.

The source code is there. Have a look.

Cheers