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

System Functions (t) tdm_spawnp(2)
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.
ERRORS
If any of the following conditions occurs, the tdm_spawnp() function sets errno to the
corresponding value, le 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
The pointers contained within the global variable environ
The elements pointed to by environ pointers
The effective user ID of the current process
The effective group ID of the current process
[E2BIG] The number of bytes used by the new process images argument list and environ-
ment list is greater than the system-imposed limit. The limit can be obtained by
calling the sysconf(_SC_ARG_MAX) function.
[EACCES] One of these conditions exists:
Search permission is denied for the directory components of the path-
name prex to the process image le.
The new process image le, any library le, or script le denies execu-
tion permission.
Create access on the extended swap le on a disk under Safeguard pro-
tection is denied.
This error occurs only for G-series TNS or accelerated new process
image les.
The new process image le is not a regular le.
527186-003 Hewlett-Packard Company 869