Open System Services Porting Guide (G06.24+, H06.03+)

Table Of Contents
Porting UNIX Applications to the OSS Environment
Open System Services Porting Guide520573-006
7-27
Calling Guardian Procedures
Calls on page 6-13 provides information about when to use these process-creation
functions. The HP extension process-creation functions are as follows:
Using the tdm_fork() and tdm_execve Set of Functions
The tdm_fork() function and the tdm_execve set of functions perform the same
actions as fork() and the exec set of functions with the addition that many Guardian
process attributes and OSS process attributes can be specified when the new process
is created or the new program is executed.
tdm_fork() and the tdm_exec set of functions use the same parameters as fork()
and the exec set of functions, respectively, plus two new parameters. The first new
parameter is a pointer to an input structure, containing Guardian process attributes to
assign to the new process. The input structure is defined in the tdmext.h header file,
including default initialization values for this structure. The initialized values can then
be modified as appropriate for the call. The second new parameter is a pointer to an
output structure, which is defined along with its default initialization values in the
tdmext.h header file.
Upon successful execution of tdm_fork() or the tdm_execve set of functions, the
output structure contains the Guardian process handle and OSS process ID (PID) of
the created process. If the call is not successful, detailed error information is included
in the output structure. The default OSS attributes and default Guardian attributes are
inherited by the child process. Some Guardian attributes that can be specified for the
child process include process priority, processor number, process name (system
generated or programmer specified), home terminal, swap files, and debug options.
Using the tdm_spawn Set of Functions
The tdm_spawn set of functions uses the same input parameters used by the
tdm_execve set of functions with the addition of two parameters. The first parameter
specifies which file descriptors that were open in the parent process remain open in the
child process. The second parameter points to an inheritance structure that specifies
which OSS process attributes are inherited by the child process, including default
signals, signal mask, and process group.
Calling Guardian Procedures
Many of the more than 300 Guardian procedures can be called directly from an OSS
C program by including sections from the cextdecs.h header file in the source code
of the program. You must declare system procedures before calling them so the OSS
tdm_execve() Executes a file with HP extensions
tdm_execvep() Executes a file with HP extensions
tdm_fork() Creates a new process with HP extensions
tdm_spawn() Executes a new process with HP extensions
tdm_spawnp() Executes a new process with HP extensions