#include <unistd.h>
int execve(const char *pathname, char *const argv[], char *const envp[]);
executes the program referred to by pathname.
This causes the program that is currently being run by the calling process to be replaced with a new program, with newly initialized stack, heap, and (initialized and uninitialized) data segments.
#!interpreter [optional-arg]
: execve() does not return on success.
the text, initialized data, uninitialized data (bss), and stack of the calling process are overwritten according to the contents of the newly loaded program.
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(7)).
Any alternate signal stack is not preserved (sigaltstack(2)).
Memory mappings are not preserved (mmap(2)).
Attached System V shared memory segments are detached (shmat(2)).
POSIX shared memory regions are unmapped(shm_open(3)).
Open POSIX message queue descriptors are closed (mq_overview(7).
Any open POSIX named semaphores are closed (sem_overview(7))).
POSIX timers are not preserved (timer_create(2)).
Any open directory streams are closed (opendir(3)).
Memory locks are not preserved (mlock(2), mlockall(2)).
Exit handlers are not preserved (atexit(3), on_exit(3)).
The floating-point environment is reset to the default (see fenv(3)).
the use of a third argument to the main function is not specified in POSIX.1; according to POSIX.1, the environment should be accessed via the external variable environ(7).
All threads other than the calling thread are destroyed during an execve(). Mutexes, condition variables, and other pthreads objects are not preserved.
Any outstanding asynchronous I/O operations are canceled (aio_read(3), aio_write(3)).
By default, file descriptors remain open across an execve(). File descriptors that are marked close-on-exec are closed.