Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (t) tdm_spawn(2)
The arguments specified by a program using the tdm_spawn() 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_spawn( ) 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. Oth-
erwise, 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_spawn() 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 processs 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_spawn( )
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_spawn() 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
path 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 path.
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 ignored.
527186-023 Hewlett-Packard Company 845