26: execve(prog[0],prog,env);
27: return 0;
execve() does not return on success, and the text, data, bss, and
stack of the calling process are overwritten by that of the program
loaded
我運行了幾個程序,使用fork(),接着是execve()來自第三個程序。所有這些程序都是要完成的,但最後第三個程序不會返回,即不顯示命令提示符。 如果我在調用程序中使用wait()命令,那麼execve的程序只有在等待語句的順序與execve程序的結尾順序匹配時纔會返回。爲什麼會這樣? 這裏的簡化代碼: int main()
{
int child1,child2,status;