c++ - execve : convert execve call to fork -


i have execve system call overlay curernt program one. code works fine requirement change execve system call fork system call. trying below:

pid_t child_pid; child_pid = fork(); if(child_pid == 0) {        if (-1 == execve(...)) //normal previous execve call        {           .............        } } else { //fork parent process exit(0); } 

i not sure when replacing execve system call fork things should take care. in child process calling existing execve call let original flow maintained (as if without fork) should parent - should exit or need wait child process exit/die. execve call overlays current process new 1 there no question of parent / child process.

if exit status of child needs known, or if there operation performed after child process exits, call wait() in parent.

if there no need either of above, can exit parent process. orphaned process re-parented init, , hence have no adverse effects.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -