arosc.library: Centralized exit handling code in __arosc_startup.c
[AROS.git] / compiler / clib / _exit.c
blobb35c82c5eaa2ee90690f1c378873b213ed851c3b
1 /*
2 Copyright © 2003, The AROS Development Team. All rights reserved.
3 $Id$
5 POSIX function _exit().
6 */
8 #include <aros/debug.h>
10 #include "__arosc_privdata.h"
12 #include <exec/types.h>
13 #include <setjmp.h>
14 #include <assert.h>
15 #include <aros/startup.h>
17 /*****************************************************************************
19 NAME */
20 #include <unistd.h>
22 void _exit (
24 /* SYNOPSIS */
25 int code)
27 /* FUNCTION
28 Terminates the running program immediately. The code is returned to
29 the program which has called the running program. In contrast to
30 exit(), this function does not call user exit-handlers added with
31 atexit() or on_exit(). It does, however, close open filehandles.
33 INPUTS
34 code - Exit code. 0 for success, other values for failure.
36 RESULT
37 None. This function does not return.
39 NOTES
40 This function must not be used in a shared library or in a threaded
41 application.
43 EXAMPLE
45 BUGS
46 Currently, this function *does* trigger user exit-handlers to be
47 called.
49 SEE ALSO
50 exit()
52 INTERNALS
54 ******************************************************************************/
56 __arosc_jmp2exit(0, code);
58 /* never reached */
59 assert(0);
60 } /* _exit */