summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-04-23 15:04:42 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-04-25 11:15:49 +0200
commit45c9b7d4974d31d26e584702101cf2608670cd51 (patch)
treea5c2a016b8aefd8a92fdcb81f8956b7f3d0158b4 /cpukit
parentREADME: Update README and INSTALL to try to be GNU'ish. (diff)
downloadrtems-45c9b7d4974d31d26e584702101cf2608670cd51.tar.bz2
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.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libcsupport/src/newlibc_exit.c89
1 files changed, 3 insertions, 86 deletions
diff --git a/cpukit/libcsupport/src/newlibc_exit.c b/cpukit/libcsupport/src/newlibc_exit.c
index 8e47b17425..8dbbfce0d2 100644
--- a/cpukit/libcsupport/src/newlibc_exit.c
+++ b/cpukit/libcsupport/src/newlibc_exit.c
@@ -1,8 +1,4 @@
/*
- * Implementation of hooks for the CYGNUS newlib libc
- * These hooks set things up so that:
- * + '_REENT' is switched at task switch time.
- *
* COPYRIGHT (c) 1994 by Division Incorporated
*
* The license and distribution terms for this file may be
@@ -21,35 +17,10 @@
#if defined(RTEMS_NEWLIB)
#include <rtems/libcsupport.h>
-/* Since we compile with strict ANSI we need to undef it to get
- * prototypes for extensions
- */
-#undef __STRICT_ANSI__
-
-#include <stdlib.h> /* for free() */
-#include <string.h> /* for memset() */
-
-#include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */
-#include <errno.h>
-
#include <stdio.h>
+#include <unistd.h>
-int _fwalk(struct _reent *ptr, int (*function) (FILE *) );
-
-/* do we think we are reentrant? */
-extern int libc_reentrant;
-extern struct _reent * const _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
-
-/*
- * CYGNUS newlib routine that does atexit() processing and flushes
- * stdio streams
- * undocumented
- */
-
-extern void _wrapup_reent(struct _reent *);
-extern void _reclaim_reent(struct _reent *);
-
-void libc_wrapup(void)
+static void libc_wrapup(void)
{
/*
* In case RTEMS is already down, don't do this. It could be
@@ -60,22 +31,6 @@ void libc_wrapup(void)
return;
/*
- * This was already done if the user called exit() directly .
- _wrapup_reent(0);
- */
-
- if (_REENT != _global_impure_ptr) {
- _wrapup_reent(_global_impure_ptr);
-#if 0
- /* Don't reclaim this one, just in case we do printfs
- * on the way out to ROM.
- */
- _reclaim_reent(&libc_global_reent);
-#endif
- _REENT = _global_impure_ptr;
- }
-
- /*
* Try to drain output buffers.
*
* Should this be changed to do *all* file streams?
@@ -87,38 +42,7 @@ void libc_wrapup(void)
fclose (stderr);
}
-/*
- * Function: _exit
- * Created: 94/12/10
- *
- * Description:
- * Called from exit() after it does atexit() processing and stdio fflush's
- *
- * called from bottom of exit() to really delete the task.
- * If we are using reentrant libc, then let the delete extension
- * do all the work, otherwise if a shutdown is in progress,
- * then just do it.
- *
- * Parameters:
- * exit status
- *
- * Returns:
- * does not return
- *
- * Side Effects:
- *
- * Notes:
- *
- *
- * Deficiencies/ToDo:
- *
- *
- */
-
-#include <unistd.h>
-
/* FIXME: These defines are a blatant hack */
- #define EXIT_SYMBOL _exit
#if defined(__USE_INIT_FINI__)
#if defined(__m32r__)
@@ -132,7 +56,7 @@ void libc_wrapup(void)
extern void FINI_SYMBOL( void );
#endif
-void EXIT_SYMBOL(int status)
+void _exit(int status)
{
/*
* If the toolset uses init/fini sections, then we need to
@@ -142,16 +66,9 @@ void EXIT_SYMBOL(int status)
FINI_SYMBOL();
#endif
- /*
- * We need to do the exit processing on the global reentrancy structure.
- * This has already been done on the per task reentrancy structure
- * associated with this task.
- */
-
libc_wrapup();
rtems_shutdown_executive(status);
for (;;) ; /* to avoid warnings */
}
-
#endif