source: rtems/cpukit/libcsupport/src/newlibc_exit.c @ f64c6b4

5
Last change on this file since f64c6b4 was f64c6b4, checked in by Sebastian Huber <sebastian.huber@…>, on 01/25/16 at 20:23:53

Use atexit() handler to close std file descriptors

  • Property mode set to 100644
File size: 870 bytes
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.org/license/LICENSE.
7 *
8 */
9
10#if HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <rtems.h>
15
16#if defined(RTEMS_NEWLIB)
17#include <stdio.h>
18#include <unistd.h>
19
20/* FIXME: These defines are a blatant hack */
21
22  #if defined(__USE_INIT_FINI__)
23    #if defined(__ARM_EABI__)
24      #define FINI_SYMBOL __libc_fini_array
25    #else
26      #define FINI_SYMBOL _fini
27    #endif
28
29    extern void FINI_SYMBOL( void );
30  #endif
31
32void _exit(int status)
33{
34  /*
35   *  If the toolset uses init/fini sections, then we need to
36   *  run the global destructors now.
37   */
38  #if defined(FINI_SYMBOL)
39    FINI_SYMBOL();
40  #endif
41
42  rtems_shutdown_executive(status);
43  /* does not return */
44}
45
46#endif
Note: See TracBrowser for help on using the repository browser.