Executes the program pointed to by the path parameter.
#include <unistd.h> int execve ( const char *path, char *const argv[], char *const envp[]);
Points to the path of a file to execute. The executable file must be either a binary executable or a script (with a maximum line length of 127 characters) starting with a line in the following format:
#1 interpreter [arg]
The interpreter must be a valid pathname for an executable file, which is invoked as
interpreter [arg] filename
Points to an array of null-terminated strings that represent the parameter list that is available to the new program. The first array entry points to the file name that is associated with the file to execute. The array must be null terminated.
Points to an array of null-terminated strings, usually in the form key=value, that represent the environment of the program to execute. This array must be terminated by a NULL pointer.
If an error occurs, returns -1 and errno is set to indicate the error. Otherwise, nothing is returned.
IMPORTANT:This function is only available to NLMs that link with the POSIX semantics flag and load into protected address space (ring3). If these requirements are not met, errno is set to ENOSYS.
The execve function overwrites the text, data, and stack of the calling process with those of the new program. It also clears any pending signals and sets any signals that are set to be caught by the calling process back to their default behavior. When the SIGCHLD signal is set to SIG_IGN, it can be reset to SIG_DFL.
The executed program inherits the PID of the calling process and any open file descriptors that are not set to close when the exec functions run. For any open file descriptors, all attributes remain unchanged.
If the executed program is being ptraced, SIGTRAP is sent after the execve function returns successfully.
If the set-uid bit is set on the new program file, the effective user ID of the calling processed is changed to be the same as the owner of the program file. Similarly, when the set_gid bit of the file is set, the effective group ID of the calling process is set to the group of the program file.
The number of bytes available for the combined parameters of the new process and the environment lists is defined by ARG_MAX.