Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

execve(2)

setrlimit(2)

vfork(2)

wait(2)



FORK(2)                 COMMAND REFERENCE                 FORK(2)



NAME
     fork - create a new process

SYNOPSIS
     pid = fork()
     int pid;

     pid = vfork()
     int pid;

DESCRIPTION
     A new process is created with fork.  The new process (child
     process) is an exact copy of the calling process (parent
     process) except for the following:

          The child process has a unique process ID.

          The child process has a different parent process ID
          (i.e., the process ID of the parent process).

          Locks set by fcntl(2) are not inherited by the child
          process of a fork call.

          The child process has its own copy of the parent's
          descriptors.  These descriptors reference the same
          underlying objects, so that, for instance, file
          pointers in file objects are shared between the child
          and the parent, so that a lseek(2) on a descriptor in
          the child process can affect a subsequent read or write
          by the parent.  This descriptor copying is also used by
          the shell to establish standard input and output for
          newly-created processes as well as to set up pipes.

          The child's process resource utilizations are set to 0;
          see setrlimit(2).

     The call vfork also creates a new process.  On workstation
     versions of UTek vfork does exactly what fork does.  A
     separate manual page is provided for vfork for machines
     which operate differently. On workstation versions use fork
     unless source compatibility with vfork is desired.

DIAGNOSTICS
     The fork call fails and no child process is created if one
     or more of the following are true:

     [EAGAIN]     The system-imposed limit on the total number of
                  processes under execution, NPROC, would be
                  exceeded.

     [EAGAIN]     The system-imposed limit on the total number of
                  processes under execution by a single user,



Printed 4/6/89                                                  1





FORK(2)                 COMMAND REFERENCE                 FORK(2)



                  MAXUPRC, defined in <sys/param.h>, would be
                  exceeded.

     [ENOMEM]     Insufficient space exists in the swap area for
                  the child process.

RETURN VALUE
     Upon successful completion, fork returns a value of 0 in pid
     to the child process and returns the process ID of the child
     process in pid to the parent process.  Otherwise, a value of
     -1 is returned to the parent process, no child process is
     created, and the global variable errno is set to indicate
     the error.

SEE ALSO
     execve(2), setrlimit(2), vfork(2), and wait(2).







































Printed 4/6/89                                                  2



%%index%%
na:240,79;
sy:319,506;
de:825,1951;
di:2776,551;3639,212;
rv:3851,526;
se:4377,224;
%%index%%000000000117

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