Open System Services System Calls Reference Manual (G06.25+, H06.03+)

System Functions (e) execv(2)
NAME
execv - Executes a le using a pathname, an argv array, and **environ
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossksrl
H-series OSS processes: /G/system/zdllnnn/zosskdll
SYNOPSIS
#include <unistd.h>
extern char ∗∗environ;
int execv(
const char path,
char const argv[ ]);
PARAMETERS
**environ Points to an array of character pointers to environment strings. The environment
strings dene the OSS environment for the new process. The environ array is
terminated by a null pointer.
The **environ array of the new process is also passed as the env[]array in the
call to the main() function of the new process. Refer to Entering the New Pro-
cess later in this reference page.
path Points to a null-terminated string containing a pathname that identies the new
process image le. The pathname is absolute if it starts with a slash (/) character.
Otherwise, the pathname is relative and is resolved by prexing the current
working directory.
If the nal component of the path parameter names a symbolic link, the link is
traversed and pathname resolution continues.
argv[] Species an array of character pointers to null-terminated strings containing
arguments to be passed to the main function of the new program. argv[0] should
point to the null-terminated string containing the lename of the new process
image. The last member of this array must be a null pointer.
These strings constitute the argument list available to the new process image.
DESCRIPTION
The execv() function is one of the exec set of functions. The exec set of functions replace the
current process image with a new process image. The new image is constructed from a regular
executable le, called a new process image le. The new process image le is formatted as an
executable text or binary le in one of the formats recognized by the exec set of functions.
A successful execv() function call does not return, because the calling process image is overlaid
by the new process image.
Entering the New Process
When a program is executed as a result of a call to a function in the exec set of functions, it is
entered as a function call as follows:
int main(
int argc,
char argv[],
char env[]);
Here, the argc parameter is the argument count, the argv[]parameter is an array of character
pointers to the arguments themselves, and env[]is a pointer to a character array listing the
environment variables. The argv[]array is terminated by a null pointer. The null pointer is not
527186-003 Hewlett-Packard Company 227