VMS Help  —  CRTL  exit,_exit, Description
    If the process was invoked by DCL, the status is interpreted by
    DCL, and a message is displayed.

    If the process was a child process created using vfork or an exec
    function, then the child process exits and control returns to the
    parent. The two functions are identical; the _exit function is
    retained for reasons of compatibility with VAX C.

    The exit and _exit functions make use of the $EXIT system
    service. If your process is being invoked by the RUN command
    using any of the hibernation and scheduled wakeup qualifiers, the
    process might not correctly return to hibernation state when an
    exit or _exit call is made.

    The C compiler command-line qualifier /[NO]MAIN=POSIX_EXIT can be
    used to direct the compiler to call __posix_exit instead of exit
    when returning from main. The default is /NOMAIN.

    Beginning with OpenVMS Version 8.3, C RTL contains a fix for
    the problem in which a call to _exit after a failed execl really
    exits but must not.

    In the OpenVMS implementation of vfork, a child process is not
    actually started as it is started on most UNIX systems. However,
    the C RTL creates some internal data structures intended to mimic
    child-process functionality (called the "child context").

    A bug occurred whereby after a vfork while in the child context,
    a call to an exec function justifiably fails, then calls _exit.
    On UNIX systems, after the failed exec call, the child process
    continues to execute. A subsequent call to _exit terminates
    the child. In the OpenVMS implementation, after the failed exec
    call, the child context terminates. A subsequent call to _exit
    terminates the parent. The C RTL fix is enabled by a feature
    logical switch, DECC$EXIT_AFTER_ FAILED_EXEC. Enabling this
    feature logical allows the child context to continue execution.

    With DECC$EXIT_AFTER_FAILED_EXEC disabled or not defined, the
    current behavior remains the default.

                                   NOTE

       EXIT_SUCCESS and EXIT_FAILURE are portable across any
       ANSI C compiler to indicate success or failure. On OpenVMS
       systems, they are mapped to OpenVMS condition codes with
       the severity set to success or failure, respectively. Values
       in the range of 3 to 255 can be used by a child process to
       communicate a small amount of data to the parent. The parent
       retrieves this data using the wait, wait3, wait4, or waitpid
       functions.
Close Help