.th K_spawn II 4/21/86
.sh NAME
K_spawn - start new process with new program
.sh "MODULA SYNOPSIS"
.nh
.na
 CONST immSeid: seid;
.br
 CONST arg: seg_des;
.br
 VAR child: seid;
.br
 VAR stat: K_err_num;
.br
 . . .
.br
 stat := NK_spawn(immSeid, arg, child);
.br
.hy
.ad
.sp
.sh "C SYNOPSIS"
.nh
.na
 seid immSeid;
.br
 seg_des arg;
.br
 seid child;
.br
 int stat;
.br
 . . .
.br
 stat = K_spawn (immSeid, arg, &child);
.br
.hy
.ad
.sh DESCRIPTION
The Kernel primitive K_spawn combines the functions of K_fork and
K_invoke into one operation.  The K_spawn primitive permits process
creation without the cost of copying the parent process image to the
child process.  The effect of K_spawn is to create a new process and to
force the effect of a K_invoke call upon the newly created process.
The parent process may therefore completely specify the contents of the
child process image.
.sp
The parameters to K_spawn are the same as the parameters to the
K_invoke primitive.  These parameters are used to determine the effect
of the K_invoke call forced upon the child process.  (See K_invoke
above for a discussion of this primitive.) The full semantics of
K_invoke are implemented.  Hence, a child process may acquire more
privilege than the parent and may operate in a different discretionary
access domain.
.sh EXCEPTIONS
.lp 22 15
XbLcArgSg	Bad location of argument segment. Argument segment is not
located in proper virtual memory domain.
.lp 22 15
XbSgDes	Bad segment descriptor. Segment descriptor of argument segment is
invalid.
.lp 22 15
XncnDo	System Resource exhaustion. Cannot create more segments. (LEAK)
.lp 22 15
XnSgDes	segDes is not a valid segment descriptor.
.lp 22 15
XnWrtArgSeg	Cannot write to argument segment.
.lp 22 15
XnoProc	System Resource exhaustion. Cannot create another process. (LEAK)
.lp 22 15
XsgNoAcc	No access to segment.
.lp 22 15
XshSg	Process has a shared segment, cannot fork process.
.i0
.sh "SEE ALSO"
K_invoke(II),
K_fork(II)
