VFORK(2) HP Integral PC VFORK(2) VFORK(2) HP Integral PC VFORK(2) VFORK(2) HP Integral PC VFORK(2) VFORK(2) HP Integral PC VFORK(2) NAME NAME NAME NAME vfork - spawn a new process in a memory efficient manner SYNOPSIS SYNOPSIS SYNOPSIS SYNOPSIS vfork() HP-UX COMPATABILITY HP-UX COMPATABILITY HP-UX COMPATABILITY HP-UX COMPATABILITY Level: HP-UX/RT Origin: UCB DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION Vfork can be used to create a new process without fully copying the address space of the old process. It is useful when the purpose of fork(2) would have been to create a new system context for an exec. Vfork differs from fork in that the child process borrows the parent's memory and thread of control until a call to exec(2) or an exit occurs (either by a call to exit(2) or abnormally.) The parent process is suspended while the child is using its resources. Vfork returns 0 in the child's context and (later) the pid of the child in the parent's process. 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 parent's eventual return from vfork would then return to a no longer existant stack frame. Be careful, also, to call _exit rather than exit if you can't exec, since exit will flush and close standard IO channels, and thereby mess up the parent process's standard IO data structure. (Even with fork it is wrong to call exit since buffered data would then be flushed twice.) ERRORS ERRORS ERRORS ERRORS Vfork will fail, return -1, and no child process will be created if the system-imposed limit on the total number of processes under execution would be exceeded [EAGAIN]; if the single user process limit would be exceeded [EAGAIN]; or if there is not enough system memory for the child process [ENOMEM]. SEE ALSO SEE ALSO SEE ALSO SEE ALSO fork(2), exec(2), wait(2) NOTES NOTES NOTES NOTES To avoid possible deadlock situations, 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. This call is peculiar to this version of HP-UX. Hewlett-Packard - 1 - (printed 12/12/84) VFORK(2) HP Integral PC VFORK(2) VFORK(2) HP Integral PC VFORK(2) VFORK(2) HP Integral PC VFORK(2) VFORK(2) HP Integral PC VFORK(2) On the HP Integral PC vforked children have a unique 2k stack allocated to them. Stack used beyond this 2k limit is shared between child and parent. Hewlett-Packard - 2 - (printed 12/12/84)