vfork

Creates a child process.

Library:LibC
Classification:Single UNIX
Service:General C Services

Syntax

  #include <unistd.h>
  
  pid_t vfork (
     void);
  

Return Values

On success, returns the PID of the child process in the parent's thread of execution and 0 is returned in the child's thread of execution.

On failure, returns -1 in the parent's context, no child process is created, and errno is set to the appropriate value.

Decimal

Constant

Description

5

ENOMEM

There is not enough memory to allocate the necessary kernel structures.

24

EAGAIN

There is not enough memory to copy the parent's page tables and allocate a task structure for the child.

Remarks

IMPORTANT:This function is only available to NLMs that link with the POSIX semantics flag and load into protected address space (ring3). If these requirements are not met, errno is set to ENOSYS.

The child process differs from the parent process only in its PID and PPID and in that resource utilizations are set to 0. Also, file locks and pending signals are not inherited.

See Also