ffoorrkk() -- System Call (libc)

Create a new process
#iinncclluuddee <uunniissttdd.hh>
ffoorrkk()

In  the  COHERENT  system, many  processes  may  be active  simultaneously.
ffoorrkk()  creates a  new  process; the  new  process is  a  duplicate of  the
requesting process.   In practice, the  new process often issues  a call to
execute yet another new program.

The process that  issues the ffoorrkk() call is termed  the _p_a_r_e_n_t process, and
the newly  forked process is termed the _c_h_i_l_d  process.  ffoorrkk() returns the
process id  of the newly created  child to the parent  process, and returns
zero to  the child process.  The  parent may call wwaaiitt()  to suspend itself
until the child terminates.

The following parts of the  environment of a process are exactly duplicated
by a ffoorrkk() call:

-> Open files and their seek positions

-> Current working and root directories

-> The file creation mask

-> The values of all signals

-> The alarm clock setting

-> Code, data, and stack segments

The  system normally  makes  a fresh  copy  of the  code,  data, and  stack
segments for the child process.   One advantage of _s_h_a_r_e_d _t_e_x_t processes is
that they do not need to copy the code segment.  It is write protected, and
therefore may be shared.

_E_x_a_m_p_l_e
For examples of how to use this call, see mmssggggeett(), ppiippee(), and ssiiggnnaall().

_S_e_e _A_l_s_o
aallaarrmm(), eexxeeccll(), eexxiitt(), lliibbcc, sshhnn, uummaasskk(), uunniissttdd.hh, wwaaiitt()
POSIX Standard, section 3.1.1

_D_i_a_g_n_o_s_t_i_c_s
ffoorrkk() returns  -1 on failure,  which usually involves  insufficient system
resources.  On  successful calls, ffoorrkk() returns zero to  the child and the
process id of the child to the parent.
