4.115
Last change
on this file since 62aa318 was
45c9b7d4,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/23/13 at 13:04:42
|
libcsupport: POSIX conformance for _exit()
According to POSIX the _exit() function shall not call functions
registered with atexit() nor any registered signal handlers.
See also tests libtests/exit01 and libtests/exit02.
Make libc_wrapup() static. Remove out of date comments. Remove
superfluous declarations, defines and includes.
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | /* |
---|
2 | * COPYRIGHT (c) 1994 by Division Incorporated |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.com/license/LICENSE. |
---|
7 | * |
---|
8 | */ |
---|
9 | |
---|
10 | #if HAVE_CONFIG_H |
---|
11 | #include "config.h" |
---|
12 | #endif |
---|
13 | |
---|
14 | #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ |
---|
15 | #include <rtems.h> |
---|
16 | |
---|
17 | #if defined(RTEMS_NEWLIB) |
---|
18 | #include <rtems/libcsupport.h> |
---|
19 | |
---|
20 | #include <stdio.h> |
---|
21 | #include <unistd.h> |
---|
22 | |
---|
23 | static void libc_wrapup(void) |
---|
24 | { |
---|
25 | /* |
---|
26 | * In case RTEMS is already down, don't do this. It could be |
---|
27 | * dangerous. |
---|
28 | */ |
---|
29 | |
---|
30 | if (!_System_state_Is_up(_System_state_Get())) |
---|
31 | return; |
---|
32 | |
---|
33 | /* |
---|
34 | * Try to drain output buffers. |
---|
35 | * |
---|
36 | * Should this be changed to do *all* file streams? |
---|
37 | * _fwalk (_REENT, fclose); |
---|
38 | */ |
---|
39 | |
---|
40 | fclose (stdin); |
---|
41 | fclose (stdout); |
---|
42 | fclose (stderr); |
---|
43 | } |
---|
44 | |
---|
45 | /* FIXME: These defines are a blatant hack */ |
---|
46 | |
---|
47 | #if defined(__USE_INIT_FINI__) |
---|
48 | #if defined(__m32r__) |
---|
49 | #define FINI_SYMBOL __fini |
---|
50 | #elif defined(__ARM_EABI__) |
---|
51 | #define FINI_SYMBOL __libc_fini_array |
---|
52 | #else |
---|
53 | #define FINI_SYMBOL _fini |
---|
54 | #endif |
---|
55 | |
---|
56 | extern void FINI_SYMBOL( void ); |
---|
57 | #endif |
---|
58 | |
---|
59 | void _exit(int status) |
---|
60 | { |
---|
61 | /* |
---|
62 | * If the toolset uses init/fini sections, then we need to |
---|
63 | * run the global destructors now. |
---|
64 | */ |
---|
65 | #if defined(FINI_SYMBOL) |
---|
66 | FINI_SYMBOL(); |
---|
67 | #endif |
---|
68 | |
---|
69 | libc_wrapup(); |
---|
70 | rtems_shutdown_executive(status); |
---|
71 | for (;;) ; /* to avoid warnings */ |
---|
72 | } |
---|
73 | |
---|
74 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.