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

System Functions (t) tdm_spawnp(2)
compatibility with older RVUs. Any specified value is checked for validity but
otherwise ignored.
pe_ver Specifies the version of the process_extension structure. This value is set by
#define DEFAULT_PROCESS_EXTENSION and should not be changed.
For detailed information about Guardian process attributes, see the PROCESS_LAUNCH_ pro-
cedure in the Guardian Procedure Calls Reference Manual.
Output Structure Information
If the pr_results parameter does not contain a null pointer, it points to an output structure defined
in the tdmext.h header file. This structure can contain fields that vary from RVU to RVU,
including reserved and filler fields.
First, the output structure must be initialized by using the #define
DEFAULT_PROCESS_EXTENSION_RESULTS. This initialization sets the value of the
pr_len field to the correct value for the current RVU. The value of the pr_len field should not be
modified after being set by #define DEFAULT_PROCESS_EXTENSION_RESULTS.
The process_extension_results output structure is described in the
process_extension_results(5) reference page.
EXAMPLES
This example uses the tdm_spawnp( ) function to perform I/O redirection in a new process:
if ((NewStdOut = open ("newout", ...)) != -1)
/* process the error */
fd_map[0] = 0;
fd_map[1] = NewStdOut;
fd_map[2] = 2;
fd_count = 3;
tdm_spawnp(..., fd_count, fd_map, ...);
close(NewStdOut);
This example creates a new process under a different user ID:
save = getuid();
setuid(newid);
tdm_spawnp(...);
setuid(save);
RETURN VALUES
Upon successful completion, the tdm_spawnp() function returns the OSS process ID of the child
process to the parent process. If the pr_results parameter does not contain a null pointer, it
returns the Guardian process handle of the new process in addition to the OSS process ID.
If the tdm_spawnp() function fails, the value -1 is returned to the parent process, no child pro-
cess is created, and errno is set to indicate the error. If the pr_results parameter does not contain
a null pointer, the structure it points to returns additional error information including the
PROCESS_LAUNCH_ error and error detail.
527186-023 Hewlett-Packard Company 873