Open System Services System Calls Reference Manual (G06.25+, H06.03+)
tdm_execvep(2) OSS System Calls Reference Manual
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.
Executing a Binary File
If the file specified as the new process image file is a binary executable file, the tdm_execvep()
function loads the file directly.
Executing a Text File
If the file specified as the new process image file is not a binary executable file, the
tdm_execvep() function examines the file to determine whether it is an executable text file. It
checks for a header line in this format:
#! interpreter_name [optional_string]
The #! notation identifies the file as an executable text file. The new process image filename is
constructed from the process image filename in the interpreter_name string, treating it like the
file parameter. The Guardian input and output structures pointed to by the pe_parms and
pr_results parameters apply to the command interpreter as they would to any process file.
The arguments passed to the new process are modified as listed:
• argv[0] is set to the name of the command interpreter.
• If the optional_string portion is present, argv[1] is set to optional_string.
• The next element of argv[]is set to the original value of file.
• The remaining elements of argv[]are set to the original elements of argv[], starting with
argv[1]. The original argv[0] is discarded.
The S_ISUID and S_ISGID mode bits of an executable text file are honored. Those bits are
ignored for the interpreter_name command interpreter.
When the File Is Invalid
If the process image file is not a valid executable object, or if the text file does not contain the
header line, the tdm_execvep() function invokes the interpreter_name command interpreter as
the new process image and passes these arguments to it:
• argv[0] is set to the string sh.
• argv[1] is set to the original value of the file parameter.
• The remaining elements of argv[]are set to the original elements of argv[], starting with
argv[1].
• The original argv[0] is discarded.
8−18 Hewlett-Packard Company 527186-003