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

tdm_spawn(2) OSS System Calls Reference Manual
The arguments specied 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 undened, and errno is set to
[ENOTOSS].
Identifying the Process Image File
The tdm_spawn() function uses the path parameter to identify the process image le. 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 prexing 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 lename 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 le specied as the new process image le is a binary executable le, the tdm_spawn()
function loads the le directly.
Executing a Text File
If the le specied as the new process image le is not a binary executable le, the
tdm_spawn() function examines the le to determine whether it is an executable text le. It
checks for a header line in this format:
#! interpreter_name [optional_string]
The #! notation identies the le as an executable text le. The new process image lename is
constructed from the process image lename 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 le.
The arguments passed to the new process are modied 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 le are ignored.
842 Hewlett-Packard Company 527186-003