|Skip Navigation Links|
|Exit Print View|
|man pages section 2: System Calls Oracle Solaris 11.1 Information Library|
- execute a file
#include <sys/execx.h> int execvex(uintptr_t file, char *const argv, char *const envp, int flags);
All of the interfaces described in exec() are implemented using calls to the fundamental execvex() system call described here. See exec(2) for details of process execution and return values from the system call.
The interpretation of the file argument depends on the value of the flags argument. The value of the flags argument must be an inclusive-OR of zero or more of these values:
If EXEC_DESCRIPTOR is set in flags, the file argument must be an open file descriptor for a regular file that is executable by the calling process. The file may have been opened with any of these access modes (see open(2)):
If EXEC_DESCRIPTOR is not set in flags, the file argument must be a pointer to a pathname for a file that is executable by the calling process.
If EXEC_RETAINNAME is set in flags, the process's name, contained in the kernel user structure u_comm member, fetched in the /proc/pid/psinfo pr_fname member, reported by ps(1) and interrogated by pgrep(1), remains unchanged across the exec() of the new image.
If EXEC_DESCRIPTOR or EXEC_ARGVNAME is set in flags and EXEC_RETAINNAME is not set, the process's name becomes the last component of the pathname-like argv argument.
If none of the EXEC_DESCRIPTOR, EXEC_RETAINNAME or EXEC_ARGVNAME flags are set in flags, the name of the process becomes the last component of the pathname passed in the file argument.
A call to execvex() with no flags:
execvex((uintptr_t)pathname, argv, envp, 0);
is equivalent to a call to execve():
execve(pathname, argv, envp);
A call to execvex() with only the EXEC_DESCRIPTOR flag:
execvex(fd, argv, envp, EXEC_DESCRIPTOR);
is equivalent to a call to fexecve():
fexecve(fd, argv, envp);
If the execvex() function returns to the calling process image, an error has occurred; the return value is -1 and errno is set to indicate the error.
In addition to the failures described in exec(2), the execvex() function will fail if:
The flags argument is invalid.
See attributes(5) for descriptions of the following attributes: