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-access 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.
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.
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.
SEE ALSO
execve(2), fork(2), and wait(2).
Printed 4/6/89 1
%%index%%
na:264,111;
sy:375,303;
de:678,1123;
di:1801,756;
rv:2557,537;
se:3094,153;
%%index%%000000000109