EXIT(3)

NAME
exit, _exit, rexit - perform normal program termination

SYNOPSIS
#include <stdlib.h>

void exit (int status);
void rexit (int status);

#include <unistd.h>

void _exit (int status);

DESCRIPTION
exit terminates a process.

Before termination exit performs the following functions in the order listed:

    Call the functions registered with the atexit(3) function, in the reverse order of their registration.

    Flush all open output streams.

    Close all open streams.

    Unlink all files created with the tmpfile(3) function.

rexit is identical to exit, except that the process image will be flagged to GS/OS as restartable.

_exit is similar to exit, except that no clean up is done except for the flushing and closing of any open streams. _exit is the proper function to call when a child process exits while still executing in the address space of its parent process, such as after a failed execve(2) call.

Passing arbitrary values back to the environment as status is considered bad style. Instead, use the values as described in sysexits(3).

RETURN VALUES
The exit function never returns.

SEE ALSO
atexit(3), intro(3), tmpfile(3), sysexits(3)

STANDARDS
The exit function conforms to ANSI/C. The _exit function is defined by POSIX 1003.1-88.