Open System Services System Calls Reference Manual (G06.27+, H06.04+)
tdm_spawn(2) OSS System 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_spawn() 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_spawn(..., fd_count, fd_map, ...);
close(NewStdOut);
This example creates a new process under a different user ID:
save = getuid();
setuid(newid);
tdm_spawn(...);
setuid(save);
RETURN VALUES
Upon successful completion, the tdm_spawn() 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_spawn( ) function fails, the value -1 is returned to the parent process, no child process
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.
ERRORS
If any of the following conditions occurs, the tdm_spawn() function sets errno to the
corresponding value, file descriptors marked close-on-exec are not closed, signals set to be
caught are not set to the default action, and none of these are changed:
• The argv[] array of pointers
• The envp[] array of pointers
• The elements pointed to by these arrays
• The value of the global variable environ
8−52 Hewlett-Packard Company 527186-004