The
vfork()
function has the same effect asfork(2)
, except that the behavior is undefined if the process [...] calls any other function before successfully calling [...] one of theexec(3)
family of functions.
This suggests that calling any exec*()
function after vfork()
is acceptable. However, later in the man page it says specifically:
In particular, the programmer cannot rely on the parent remaining blocked until the child [...] calls
execve(2)
[...].
execve(2)
is used repeatedly in the man page, and its usage suggests that it's the only exec
-type function that is acceptable after vfork()
.
So why is execve
being singled out here, and am I safe to call other exec
-type functions (like execlp
)?
On Linux all
exec*
functions are actually wrapper library functions on top ofexecve
syscall. So by callingexeclp
you are actually also callingexecve
.