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

System Functions (t) tdm_spawn(2)
When the File Is Invalid
If the process image le is not a valid executable object, or if the text le does not contain the
header line, the tdm_spawn() function returns and sets errno to [ENOEXEC].
Open Files
The fd_count and fd_map[]parameters determine which le descriptors that were open in the
calling process remain open in the new process.
fd_count species the number of le descriptors to be designated by the fd_map[]parameter.
fd_map[]species how le descriptors in the parent process map to le descriptors in the new
process. That is, the le descriptor in fd_map[0] is copied to le descriptor 0 (zero) in the new
process, the le descriptor in fd_map[1] is copied to le descriptor 1 in the new process, and so
on. If fd_map[]has a null value, the fd_count parameter is ignored and all open le descriptors
in the parent (except for les opened by Guardian function or procedure calls and those with the
FD_CLOEXEC attribute ag set) are inherited without mapping by the new process. Such
inherited le descriptors behave here as they do for the tdm_execve() function.
If fd_map[]does not have a null value, le descriptors from fd_count to OPEN_MAX are closed
in the new process, as are entries in fd_map[]that are identied with the value
SPAWN_FDCLOSED.
If a le descriptor specied in fd_map[]is invalid, the function call fails. (Any le 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 only, if the process le seg-
ment (PFS) of the new process image is smaller than the process le segment of the calling pro-
cess image and if the calling process image has a large number of le descriptors open, then the
system might not be able to propagate all the open le 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 le 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 le descriptor for the pipe or FIFO fail with errno set to
[EWRONGID]. The child process can only close the invalid le descriptor.
Existing Sockets
A socket associated with an open le descriptor in the calling process remains connected in the
new process when the new process runs in the same processor as the calling process.
When the new process runs in a different processor than the calling process, the processor that
runs the new process must also be running a socket transport agent process. If no socket tran-
sport agent process is running in the new processor, the new process cannot use the socket; calls
specifying the le descriptor for the socket fail with errno set to [EWRONGID]. The new pro-
cess can only close the invalid le descriptor.
Sharing Guardian Files
After a successful call to the tdm_spawn() function, the initial position within an open EDIT le
(le code 101) in the Guardian le system (a le in /G) that was opened by a call to the OSS
open() function is the same for both the parent and child processes. However, the position is not
shared; that is, changing the position used by one process does not change the position used by
the other process.
527186-003 Hewlett-Packard Company 843