Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (f - i) fork(2)
NAME
fork - Creates a new process
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
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.
• The parent process ID of the child process matches the PID of the parent.
527186-003 Hewlett-Packard Company 3−9