sl@0: /* EXIT.C sl@0: * sl@0: * Portions Copyright (c) 1990-1999 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: */ sl@0: sl@0: /* sl@0: * Copyright (c) 1990 Regents of the University of California. sl@0: * All rights reserved. sl@0: * sl@0: * %sccs.include.redist.c% sl@0: */ sl@0: sl@0: /* sl@0: FUNCTION sl@0: <>---end program execution sl@0: sl@0: INDEX sl@0: exit sl@0: sl@0: ANSI_SYNOPSIS sl@0: #include sl@0: void exit(int <[code]>); sl@0: sl@0: TRAD_SYNOPSIS sl@0: #include sl@0: void exit(<[code]>) sl@0: int <[code]>; sl@0: sl@0: DESCRIPTION sl@0: Use <> to return control from a program to the host operating sl@0: environment. Use the argument <[code]> to pass an exit status to the sl@0: operating environment: two particular values, <> and sl@0: <>, are defined in `<>' to indicate success or sl@0: failure in a portable fashion. sl@0: sl@0: <> does two kinds of cleanup before ending execution of your sl@0: program. First, it calls all application-defined cleanup functions sl@0: you have enrolled with <>. Second, files and streams are sl@0: cleaned up: any pending output is delivered to the host system, each sl@0: open file or stream is closed, and files created by <> are sl@0: deleted. sl@0: sl@0: RETURNS sl@0: <> does not return to its caller. sl@0: sl@0: PORTABILITY sl@0: ANSI C requires <>, and specifies that <> and sl@0: <> must be defined. sl@0: sl@0: Supporting OS subroutines required: <<_exit>>. sl@0: */ sl@0: sl@0: #include sl@0: #include /* for _exit() declaration */ sl@0: #include sl@0: #include /* for _atexit_processing() */ sl@0: sl@0: #ifndef _REENT_ONLY sl@0: sl@0: /* GCC knows that exit() should not return, but prior to GCC 2.5 there is sl@0: * no way of declaring the function as __attribute__ ((noreturn)). sl@0: * Expect to be warned about this function in MARM builds. sl@0: */ sl@0: EXPORT_C void sl@0: exit (int code) _ATTRIBUTE((noreturn)) sl@0: { sl@0: _atexit_processing_r(_REENT); sl@0: _exit (code); sl@0: sl@0: /* GCC may insert a call to abort() here. */ sl@0: } sl@0: sl@0: #endif