vfork(2)
_________________________________________________________________
vfork System Call
Spawn new process in a virtual memory efficient way.
_________________________________________________________________
SYNTAX
int vfork ( )
PARAMETERS
None.
DESCRIPTION
Vfork creates a new process in the same way that fork() 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.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
vfork(2)
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.
EXCEPTIONS
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.
ENOMEM The process requires more space than the system is
able to supply.
SEE ALSO
The related system calls: exec, fork, nice, plock, ptrace,
semop, shmop, signal, sigset, times, ulimit, umask, wait.
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.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)