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