vfork(2) DG/UX 5.4.2 vfork(2)
NAME
vfork - spawn new process in a virtual memory efficient way
SYNOPSIS
#include <unistd.h>
int vfork ()
DESCRIPTION
Vfork creates a new process in the same way that fork(2) does except
that the new process (the child) shares the address space of the
parent rather than being given his own address space that is a copy
of the parent's. The vfork call does not return in the parent
process until the child does an exec, an exit, or terminates
abnormally. The vfork call does return in the child process,
whereupon it is expected the child will call exec very soon.
Vfork can normally be used just like fork, except after the vfork
call the child must be careful about modifying the user address space
and any per-process state, since the changes will be reflected in the
parent when he continues. It does not work, for example, for the
child process to return from the procedure which called vfork because
the parent would return to a no-longer-existent stack frame.
If the following process attributes are changed by the child, those
changes will be visible to the parent:
⊕ The shared memory segments (see shmat and shmdt).
⊕ The unshared data segment as a result of changing the break
value (see brk and sbrk).
⊕ The text or data segment locks (see plock).
ACCESS CONTROL
No access checking is performed.
RETURN VALUE
Upon successful completion, vfork returns a value of 0 to the child
process and (later) returns the process ID of the child process to
the parent process. Otherwise a value of -1 is returned to the
parent process, no child process is created, and errno is set to
indicate the error.
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 would be exceeded.
EAGAIN The calling process is not a superuser and there already
exists cf_pm_max_processes_per_real_user_id processes with
the same real user id as the calling process.
Licensed material--property of copyright holder(s) 1
vfork(2) DG/UX 5.4.2 vfork(2)
ENOMEM The process requires more space than the system is able to
supply.
SEE ALSO
exec(2), fork(2), nice(2), plock(2), ptrace(2), semop(2), signal(2),
sigset(2), times(2), ulimit(2), umask(2), wait(2).
NOTES
To avoid a possible deadlock, child processes 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.
STANDARDS
When using m88kbcs as the Software Development Environment target,
the vfork function will be an incomplete emulation of Berkeley
semantics. This emulation does not support the virtual fork
capability but is simply a call to fork.
Licensed material--property of copyright holder(s) 2