Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (f - i) fork(2)
NAME
fork - Creates a new process
LIBRARY
G-series native OSS processes: system library
H-series and J-series OSS processes: implicit libraries
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/yputdll
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <unistd.h>
pid_t fork(void);
DESCRIPTION
The fork() function creates a new OSS process. The created process is referred to as the child
and the caller as the parent. The child process executes the same program file as the parent and
retains many other Guardian attributes as well as OSS attributes of the parent.
The _POSIX_SAVED_IDS flag is defined TRUE. The saved-set-user-ID and saved-set-group-
ID fields of the parent process are therefore inherited by the child.
Use From the Guardian Environment
If called from a Guardian process, the actions of this function are undefined and errno is set to
[ENOTOSS].
OSS Attributes
The child process inherits the following OSS attributes from the parent process:
Environment
Close-on-exec flags
Signal handling settings
Saved-set-user-ID mode bit
Saved-set-group-ID mode bit
Process group ID
Current directory
Root directory
File mode creation mask
File size limit (see the ulimit(2) reference page)
Attached shared memory segments
Attached semaphore set IDs
The OSS attributes of the child process differ from those of the parent process in the following
ways:
The child process has a unique OSS process ID (PID) and does not match any active pro-
cess group ID.
527186-023 Hewlett-Packard Company 319