Files
rtems/cpukit/libcsupport/src/newlibc_exit.c
Sebastian Huber b7cf1ff717 libcsupport: Delete libc_wrapup()
Add and use rtems_libio_exit_helper.  Add rtems_libio_exit().

The fclose(stdin) etc. makes no sense during exit.  This would use the
_REENT structure of the thread calling _exit().
2013-04-26 10:57:08 +02:00

52 lines
1002 B
C

/*
* COPYRIGHT (c) 1994 by Division Incorporated
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems.h>
#if defined(RTEMS_NEWLIB)
#include <rtems/libio.h>
#include <stdio.h>
#include <unistd.h>
/* FIXME: These defines are a blatant hack */
#if defined(__USE_INIT_FINI__)
#if defined(__m32r__)
#define FINI_SYMBOL __fini
#elif defined(__ARM_EABI__)
#define FINI_SYMBOL __libc_fini_array
#else
#define FINI_SYMBOL _fini
#endif
extern void FINI_SYMBOL( void );
#endif
void _exit(int status)
{
/*
* If the toolset uses init/fini sections, then we need to
* run the global destructors now.
*/
#if defined(FINI_SYMBOL)
FINI_SYMBOL();
#endif
(*rtems_libio_exit_helper)();
rtems_shutdown_executive(status);
for (;;) ; /* to avoid warnings */
}
#endif