When an execvp() system call is performed there is no return if the call is successful. Does that mean the process will never terminate? If so is it always in the running state?
I know this is a basic question but I think I am having a serious confusion on what it means in the man page when it says “The exec() functions only return if an error has have occurred. The return value is -1, and errno is set to indicate the error.”
Thanks in advance!
execve, upon success, replaces the currently executing process image with another executable altogether. So there is no way the function will ever return, as the original process is gone. It’s almost as if you called exit()in the first process.
If it *does*return, then that means obviously the current process image was not replaced, because something went wrong. errno tells you what went wrong.