Open System Services System Calls Reference Manual (G06.28+)
System Functions (t) tdm_spawnp(2)
• argv[0] is set to the name of the command interpreter.
• If the optional_string portion is present, argv[1] is set to optional_string.
• The next element of argv[]is set to the original value of file.
• The remaining elements of argv[]are set to the original elements of argv[], starting with
argv[1]. The original argv[0] is discarded.
The S_ISUID and S_ISGID mode bits of an executable text file are ignored.
When the File Is Invalid
If the process image file is not a valid executable object, and it is a regular text file that does not
contain the header line, the tdm_spawnp() function invokes the interpreter_name command
interpreter as the new process image and passes these arguments to it:
• argv[0] is set to the string "sh".
• argv[1] is set to the original value of the file parameter.
• The remaining elements of argv[]are set to the original elements of argv[]starting with
argv[1].
• The original argv[0] is discarded.
Open Files
The fd_count and fd_map[]parameters determine which file descriptors that were open in the
calling process remain open in the child process.
fd_count specifies the number of file descriptors to be designated by the fd_map[]parameter.
fd_map[]specifies how file descriptors in the parent process map to file descriptors in the child
process. That is, the file descriptor in fd_map[0] is copied to file descriptor 0 (zero) in the child
process, the file descriptor in fd_map[1] is copied to file descriptor 1 in the child process, and so
on. If fd_map[]has a null value, the fd_count parameter is ignored and all open file descriptors
in the parent (except for files opened by Guardian function or procedure calls and those with the
FD_CLOEXEC attribute flag set) are inherited without mapping by the child process. Such
inherited file descriptors behave here as they do for the tdm_execvep() function.
If fd_map[]does not have a null value, file descriptors from fd_count to OPEN_MAX are closed
in the child process, as are entries in fd_map[]that are identified with the value
SPAWN_FDCLOSED.
If a file descriptor specified in fd_map[]is invalid, the function call fails. (Any file descriptor
created by a Guardian function or procedure call is invalid.) The errno variable is set to
[EBADF].
For a G-series TNS process image or an accelerated process image, if the process file segment
(PFS) of the new process image is smaller than the process file segment of the calling process
image and if the calling process image has a large number of file descriptors open, then the sys-
tem might not be able to propagate all the open file descriptors to the new process image. When
this situation occurs, the function call fails, and errno is set to the value of [EMFILE].
Open Pipes and FIFOs
A pipe or FIFO associated with an open file descriptor in the parent process remains connected in
the child process. If the child process runs in a different processor than the parent process, the
processor that runs the child process must also be running an OSS pipe server process.
If no OSS pipe server process is running in the new processor, the child process cannot use the
pipe or FIFO; calls specifying the file descriptor for the pipe or FIFO fail with errno set to
[EWRONGID]. The child process can only close the invalid file descriptor.
527186-005 Hewlett-Packard Company 8−59