Summary of the Effects on Process Attributes by EXECVE(2) (Note: execve for scripts is not covered) The current program is aborted. The text, data, bss, and stack of calling process are overwritten by new program If the setuid bit is set on the new program file (and filesystem is not mounted nosuid) the effective user ID of the calling process is changed to that of the owner of the program file. Similarly for the set-group-ID bit. If the new program requires any shared libraries, the libraries are loaded into memory and linked to the new program. POSIX STANDARD All process attributes are preserved during an execve(), except the following: * The dispositions of any signals that are being caught are reset to the default(signal handlers are not preserved). * Dispositions of any signals that are ignored are still ignored (the signal mask is preserved) * Any alternate signal stack is not preserved. * Memory mappings are not preserved. * Attached System V shared memory segments are detached * POSIX shared memory regions are unmapped * Open POSIX message queue descriptors are closed * Any open POSIX named semaphores are closed * POSIX timers are not preserved * Any open directory streams are closed * Memory locks are not preserved * Exit handlers are not preserved * The floating-point environment is reset to the default * All threads other than the calling thread are destroyed during an execve() * Mutexes, condition variables, and other pthreads objects are not preserved * The equivalent of setlocale(LC_ALL, "C") is executed at program start-up. * Any outstanding asynchronous I/O operations are canceled * File descriptors remain open across an execve() unless descriptor are marked close-on-exec in fcntl(2). * On success, execve() does not return, on error -1 is returned, and errno is set appropriately. LINUX SPECIFIC * The process name is reset to the name of the new executable file. * The termination signal is reset to SIGCHLD * On Linux, argv can be specified as NULL, which has the same effect as specifying this argument as a pointer to a list containing a single NULL pointer. This is non-standard and nonportable!