Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fork(2) — A/UX 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

nice(2)

phys(2)

plock(2)

ptrace(2)

semop(2)

setcompat(2)

shmop(2)

times(2)

wait(2)

wait3(2N)

nal(3)




fork(2) fork(2)
NAME fork - create a new process SYNOPSIS #include <sys/types.h> pid_t fork() DESCRIPTION fork causes creation of a new process. The new process, or child process, is an exact copy of the calling process or parent process. The child process inherits the following attributes from the parent process: environment close-on-exec flag (see exec(2)) signal-handling settings (such as SIG_DFL, SIG_IGN, func- tion address) set-user-ID mode bit set-group-ID mode bit process compatibility flags (see setcompat(2)) profiling on/off status access groups (see getgroups(2)) nice value (see nice(2)) all attached shared-memory segments (see shmop(2)) process group ID tty group ID (see exit(2) and signal(3)) trace flag (see ptrace(2) request 0) time left until an alarm clock signal (see alarm(2)) current working directory root directory file-mode-creation mask (see umask(2)) file size limit (see ulimit(2)) phys regions (see phys(2)). The child process differs from the parent process in the following ways: The child process has a unique process ID. The child process has a different parent process ID (that is, the process ID of the parent process). The child process has its own copy of the parent's file descriptors. Each of the child's file descriptors shares a common file pointer with the corresponding file descriptor of the parent. The child process also has its own copy of the parent's open directory streams. The child and parent share directory stream positioning. The set of signals pending for the child process is cleared. April, 1990 1



fork(2) fork(2)
All semadj values are cleared (see semop(2)). Process locks, text locks, and data locks are not inher- ited by the child (see plock(2)). The child process's utime, stime, cutime, and cstime are set to 0 (see times(2)). The time left until an alarm clock signal is reset to 0. RETURN VALUE On successful completion, fork returns a value of 0 to the child process and returns the process ID of the child pro- cess to the parent process. Otherwise, a value of -1 is re- turned to the parent process, no child process is created, and errno is set to indicate the error. ERRORS fork will fail and no child process will be created if one or more of the following are true: [EAGAIN] The system-imposed limit on the total number of processes under execution was exceeded. [EAGAIN] The system-imposed limit on the total number of processes under execution by a single user was exceeded. [EAGAIN] The system has temporarily exhausted its available memory or swap space. SEE ALSO exec(2), nice(2), phys(2), plock(2), ptrace(2), semop(2), setcompat(2), shmop(2), times(2), wait(2), wait3(2N), sig- nal(3). 2 April, 1990

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026