COHERENT manpages

This page displays the COHERENT manpage for exit() [Terminate a program gracefully].

List of available manpages
Index


exit() -- General Function (libc)

Terminate a program gracefully
#include <stdlib.h>
void exit(status) int status;

The library  function exit()  is the normal  method to terminate  a program
directly.   status  information  is  passed  to  the  parent  process.   By
convention,  an exit  status  of zero  indicates success,  whereas an  exit
status greater than zero indicates failure.  If the parent process issued a
wait() call,  it is  notified of  the termination and  is passed  the least
significant eight  bits of  status. As exit()  never returns, it  is always
successful.   Unlike the  system call _exit(),  exit() does  extra cleanup,
such as flushing buffered files and closing open files.

Example

For an example of this function, see the entry for fopen().

See Also

_exit(),
atexit(),
close(),
EXIT_FAILURE,
EXIT_SUCCESS,
libc,
stdlib.h,
wait()
ANSI Standard, §7.10.4.3
POSIX Standard, §8.1

Notes

If  you do  not  explicitly set  status  to a  value,  the program  returns
whatever  value happens  to have  been in  the register  EAX.  You  can set
status to either EXIT_SUCCESS or EXIT_FAILURE.