home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / vfork.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  1.8 KB  |  67 lines

  1.  
  2.  
  3.  
  4. VFORK(3)            MINTLIB LIBRARY FUNCTIONS            VFORK(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        vfork - spawn new process in a memory efficient way
  9.  
  10. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  11.        #include <unistd.h>
  12.  
  13.        int vfork(void);
  14.  
  15. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  16.        vfork  can  be  used to create new processes without fully
  17.        copying the address space of the parent process, which  is
  18.        unnecessary in many cases. It is useful when the only pur-
  19.        pose of fork would have been to create a new process  just
  20.        in  order to do an exec.. call. vfork differs from fork in
  21.        that the child borrows the parent's memory and  thread  of
  22.        control  until  a  call to exec.., or an exit (either by a
  23.        call to _exit or abnormally). The parent process  is  sus-
  24.        pended while the child is using its resources.
  25.  
  26.        vfork returns zero to the child and (later) the process ID
  27.        of the child to the parent.
  28.  
  29. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  30.        e✓ex✓xe✓ec✓c.✓..✓.(✓(3✓3)✓),✓, f✓fo✓or✓rk✓k(✓(3✓3)✓),✓, t✓tf✓fo✓or✓rk✓k(✓(3✓3)✓),✓, w✓wa✓ai✓it✓t(✓(3✓3)✓)
  31.  
  32. N✓NO✓OT✓TE✓ES✓S
  33.        The child should never  return  from  the  procedure  that
  34.        called  vfork, since that will mess up the stack frame for
  35.        the parent on its return from vfork.
  36.  
  37.        The vfork call is not available in UN*X  System  V.3.   It
  38.        will disappear from SunOS in the future (in fact, it would
  39.        have disappeared if it weren't for the  program  mentioned
  40.        below).   So,  if  you  want to write portable code, fork,
  41.        don't vfork.
  42.  
  43.        Changes the child makes to  the  parents'  variables  will
  44.        have  effect  on the parent. Do not rely on this, since it
  45.        is a disgusting habit. (Presumably, this is why the Berke-
  46.        ley C-Shell has been implemented this way.)
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.