Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (t) tdm_execve(2)
macros and error codes, see the Guardian header file |
$SYSTEM.ZSPIDEF.ZGRDC or the summary of process-creation errors in the |
Guardian Procedure Calls Reference Manual (see the table entitled "Summary |
of Process Creation Errors").
DESCRIPTION
The tdm_execve() function replaces the current process image with a new process image. The
new image is constructed from a regular executable file, called a new process image file. The
new process image file is formatted as an executable text or binary file in one of the formats
recognized by the tdm_execve() function.
The tdm_execve() function is similar to the tdm_execvep() function. The main difference is the
way the pathname for the process image file is resolved. tdm_execve() always resolves relative
pathnames by using the current working directory; see Identifying the Process Image File, later
in this reference page. tdm_execvep() sometimes uses the PATH environment variable to
resolve pathnames.
A successful tdm_execve() function call does not return, because the calling process image is
overlaid by the new process image.
When a program is executed as a result of a tdm_execve() call, it is entered as a function call:
int main(
int argc,
char ∗∗argv[],
char ∗∗envp);
Here, the argc parameter is the argument count, the argv[]parameter is an array of character
pointers to the arguments themselves, and the envp parameter 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 counted in argc.
The arguments specified by a program using the tdm_execve() function are passed on to the new
process image in the corresponding arguments to the main() function.
Use From the Guardian Environment
If called from a Guardian process, the actions of this function are undefined, and errno is set to
[ENOTOSS].
Identifying the Process Image File
The tdm_execve() function uses the path parameter to identify the process image file. This
parameter points to the absolute pathname if the pathname starts with a slash (/) character. Other-
wise, the pathname is relative and is resolved by prefixing the current working directory.
Passing the Arguments
The argv[]parameter is an array of character pointers to null-terminated strings. The last
member of this array is a null pointer. These strings constitute the argument list available to the
new process image. The value in argv[0] should point to a filename that is associated with the
process being started by the tdm_execve() function.
Specifying the Environment
The envp[]parameter is an array of character pointers to null-terminated strings. These strings
constitute the environment for the new process image. The environment array is terminated with
a null pointer.
The number of bytes available for the new process’s combined argument and environment lists
has a system-imposed limit. This limit, which includes the pointers and the null terminators on
the strings, is available by calling the sysconf(_SC_ARG_MAX) function.
527186-003 Hewlett-Packard Company 8−3