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

tdm_spawn(2) OSS System Calls Reference Manual
envp[] Specifies an array of character pointers to null-terminated strings that describe
the environment for the new process.
pe_parms Points to the input structure containing Guardian process attributes to be
assigned to the new process. The structure is defined in the tdmext.h header file.
When this parameter contains a null pointer, the tdm_spawn( ) function assumes
default Guardian attributes. Otherwise, the structure must be defined locally and
initialized before its first use. Initialization is done using the #define
DEFAULT_PROCESS_EXTENSION, as defined in the tdmext.h header file.
The initialized values can then be modified as appropriate for the call.
pr_results Points to the output structure containing optional process identification and error
information. In case of error, this structure provides additional information,
including the PROCESS_LAUNCH_ procedure error and error detail. The struc-
ture is defined in the tdmext.h header file.
The structure must be defined locally and initialized before its first use. Initiali-
zation is done by using the #define
DEFAULT_PROCESS_EXTENSION_RESULTS, as defined in the tdmext.h
header file.
See the process_extension_results(5) reference page for information about the
content of the structure. The tdmext.h header file is not kept current when new
error codes are defined for process creation functions. The list of _TPC_ macros
described in that reference page is not complete; for a current description of error
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_spawn( ) function creates 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_spawn() func-
tion.
The tdm_spawn( ) function is similar to the tdm_spawnp() function. The main difference is the
way the pathname for the process image file is resolved. tdm_spawn() always resolves relative
pathnames by prefixing the current working directory; see Identifying the Process Image File,
later in this reference page. tdm_spawnp() sometimes uses the PATH environment variable to
resolve pathnames.
The tdm_spawn( ) function provides a different way to create a new process than the way pro-
vided by the tdm_fork( ) and tdm_execve() functions. tdm_spawn() provides a more efficient
way to create a new process to execute a new program file. However, tdm_spawn( ) does not
provide all the function provided by tdm_fork() and tdm_execve().
When a program is executed as a result of a tdm_spawn( ) 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.
844 Hewlett-Packard Company 527186-023