Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
System Functions (t) tdm_fork(2)
Shared Memory
Any attached shared memory segments are attached to both the child process and the parent pro-
cess when both processes execute in the same processor. Any attached shared memory segments
are detached from the child process by a successful call to the tdm_fork( ) function when the
child process executes in a different processor than that used by the parent. Refer to the
shmat(2) reference page for additional information about shared memory segment use.
Semaphores
Semaphore set IDs attached to a parent process are also attached to the child process if the child
process executes in the same processor as the parent.
A semaphore set cannot be shared when a semadj value exists for the parent process and the
child process is created in a different processor. When that condition exists, a call to the
tdm_fork() function fails and errno is set to [EHLDSEM].
Refer to the semget(2) reference page for additional information about semaphore use.
Open Files
File descriptors open in the parent process remain open in the child process, except for those
opened using a Guardian function or procedure call. For those file descriptors that remain open,
all attributes of the open file descriptor, including file locks, remain unchanged.
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.
Existing Sockets
A socket 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 pro-
cessor that runs the child process must also be running a socket transport agent process.
If no socket transport agent process is running in the new processor, the child process cannot use
the socket; calls specifying the file descriptor for the socket fail with errno set to [EWRONGID].
The child process can only close the invalid file descriptor.
Sharing Guardian Files
After a successful call to the tdm_fork() function, the initial position within an open EDIT file
(file code 101) in the Guardian file system (a file 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.
Floating-Point Data
If the parent process uses IEEE floating-point data, the child process inherits all the floating-point
register contents of the parent process and any computation that was started before the
tdm_fork() function call finishes in the child process. The contents of the status and control
register also are inherited.
RETURN VALUES
Upon successful completion, the tdm_fork( ) function returns the value 0 (zero) to the child pro-
cess and 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 child pro-
cess in addition to the OSS process ID.
527186-023 Hewlett-Packard Company 8−41