Index of Section 2 Manual Pages

Interix / SUAvfork.2Interix / SUA

vfork(2)                                                       vfork(2)

  vfork()

  NAME

    vfork() - spawn a new process efficiently, sharing virtual memory

  SYNOPSIS

    #include 

    pid_t vfork(void)

  DESCRIPTION

    The vfork(2) call creates a new process, just as fork(2) does, but it
    doesn't fully copy the address space of the parent process. By sharing the
    space, process creation is much faster in a paged environment. Normally,
    vfork(2) is a faster way to create a new process before an exec-family
    call.

    However, the greater speed has a greater risk to the parent process if the
    child process does not immediately exec(2) or _exit(2). (Leaving with
    exit(3) isn't recommened because exit(3) flushes and closes the I/O data
    structures of the parent.)

  RETURN VALUE

    On success, vfork(2) call returns with 0 to the child process and it
    returns the process ID of the child process to the parent process. If the
    call fails, it returns -1 to the parent process, does not create a new
    process, and sets errno to indicate the error.

  ERRORS

    The vfork(2) call can fail for the following reasons:

    [EAGAIN]
        Creating the new process would exceed the limit on running processes,
        either a system-wide limit or a per-user limit.

    [ENOMEM]
        There is not enough swap space for the new process.

  NOTES

    After a program executes a call to vfork() but before the resulting child
    process executes an exec call, all signals are processed in the context of
    the parent process. As a result, if a SIGSTOP signal is issued to a
    process created by vfork(), the parent process is stopped instead. This
    can be exploited to create a denial-of-service attack against the parent
    process.

    In addition, pthread and realtime semaphore functions can be called in a
    child process created by vfork only after an exec function has been called
    in the child process. Until then, the behavior of pthread and realtime
    semaphore functions in the child process is undefined. For this reason,
    under these circumstances in Interix, these functions return the ENOTSUP
    error.

  SEE ALSO

    exec(2)

    exit(3)

    fork(2)

    wait(2)

  USAGE NOTES

    The vfork function is thread safe.

    The vfork function is not async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA