exit, _exit

Terminate execution of the program from which they are called. These functions are nonreentrant.

Format

#include  <stdlib.h>

void exit  (int status);

#include  <unistd.h>

void _exit  (int status);

Argument

status
A status value of EXIT_SUCCESS (0), EXIT_FAILURE (1), or a number from 2 to 255:

To use these status values as described, include <unistd.h> and compile with the _POSIX_EXIT feature-test macro set (either with /DEFINE=_POSIX_EXIT or with #define _POSIX_EXIT at the top of your file, before any file inclusions). This behavior is available only on OpenVMS Version 7.0 and higher systems.

Description

If the process was invoked by the DIGITAL Command Language (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.


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 2 to 255 can be used by a child process to communicate a small amount of data to the parent. The parent retreives this data using the wait, wait3, wait4, or waitpid functions.


Previous Page | Next Page | Table of Contents | Index