Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

execve(2)

fork(2)

sigvec(2)

wait(2)



VFORK(2)                COMMAND REFERENCE                VFORK(2)



NAME
     vfork - spawn new process in a virtual memory efficient way

SYNOPSIS
     pid = vfork()
     int pid;

DESCRIPTION
     Vfork is identical to fork(2).  It is provided here for
     compatibility with other systems.  On those systems, vfork
     creates new processes without copying the address space of
     the old process, borrowing the parent's memory and thread of
     control until a call to execve(2) or an exit (either by a
     call to exit(2) or abnormally).

     Here, with both vfork and fork the address space is not
     copied; data and stack are made copy-on-write so neither the
     parent nor the child can modify the other's memory.  The new
     process is created without the overhead of copying the whole
     process.

     Vfork returns 0 in pid in the child's context and (later) in
     pid the pid of the child in the parent's context.

     Vfork can normally be used just like fork. It does not work,
     however, to return while running in the child's context from
     the procedure which called vfork since the eventual return
     from vfork would then return to a no-longer-existent stack
     frame.  Be careful, also, to call _exit rather than exit if
     you can't execve, since exit will flush and close standard
     I/O channels, and thereby mess up the parent processes
     standard I/O data structures.  (Even with fork it is wrong
     to call exit since buffered data would then be flushed
     twice.)

DIAGNOSTICS
     Vfork 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, NPROC, would be exceeded.

     [EAGAIN]
         The system-imposed limit on the total number of
         processes under execution by a single user, MAXUPRC,
         defined in <sys/param.h>, would be exceeded.

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




Printed 10/17/86                                                1





VFORK(2)                COMMAND REFERENCE                VFORK(2)



RETURN VALUE
     Upon successful completion, vfork 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.

CAVEATS
     To avoid a possible deadlock situation, processes which are
     children in the middle of a vfork are never sent SIGTTOU or
     SIGTTIN signals; rather, output or ioctls are allowed and
     input attempts result in an end-of-file indication.

SEE ALSO
     execve(2), fork(2), sigvec(2), wait(2).







































Printed 10/17/86                                                2



%%index%%
na:72,95;
sy:167,199;
de:366,1735;
di:2101,635;
rv:2880,473;
ca:3353,341;
se:3694,180;
%%index%%000000000120

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