Changeset 45c9b7d4 in rtems
- Timestamp:
- 04/23/13 13:04:42 (9 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 62aa318
- Parents:
- ea123ca
- git-author:
- Sebastian Huber <sebastian.huber@…> (04/23/13 13:04:42)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (04/25/13 09:15:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libcsupport/src/newlibc_exit.c
rea123ca r45c9b7d4 1 1 /* 2 * Implementation of hooks for the CYGNUS newlib libc3 * These hooks set things up so that:4 * + '_REENT' is switched at task switch time.5 *6 2 * COPYRIGHT (c) 1994 by Division Incorporated 7 3 * … … 22 18 #include <rtems/libcsupport.h> 23 19 24 /* Since we compile with strict ANSI we need to undef it to get 25 * prototypes for extensions 26 */ 27 #undef __STRICT_ANSI__ 20 #include <stdio.h> 21 #include <unistd.h> 28 22 29 #include <stdlib.h> /* for free() */ 30 #include <string.h> /* for memset() */ 31 32 #include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */ 33 #include <errno.h> 34 35 #include <stdio.h> 36 37 int _fwalk(struct _reent *ptr, int (*function) (FILE *) ); 38 39 /* do we think we are reentrant? */ 40 extern int libc_reentrant; 41 extern struct _reent * const _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__; 42 43 /* 44 * CYGNUS newlib routine that does atexit() processing and flushes 45 * stdio streams 46 * undocumented 47 */ 48 49 extern void _wrapup_reent(struct _reent *); 50 extern void _reclaim_reent(struct _reent *); 51 52 void libc_wrapup(void) 23 static void libc_wrapup(void) 53 24 { 54 25 /* … … 59 30 if (!_System_state_Is_up(_System_state_Get())) 60 31 return; 61 62 /*63 * This was already done if the user called exit() directly .64 _wrapup_reent(0);65 */66 67 if (_REENT != _global_impure_ptr) {68 _wrapup_reent(_global_impure_ptr);69 #if 070 /* Don't reclaim this one, just in case we do printfs71 * on the way out to ROM.72 */73 _reclaim_reent(&libc_global_reent);74 #endif75 _REENT = _global_impure_ptr;76 }77 32 78 33 /* … … 88 43 } 89 44 90 /*91 * Function: _exit92 * Created: 94/12/1093 *94 * Description:95 * Called from exit() after it does atexit() processing and stdio fflush's96 *97 * called from bottom of exit() to really delete the task.98 * If we are using reentrant libc, then let the delete extension99 * do all the work, otherwise if a shutdown is in progress,100 * then just do it.101 *102 * Parameters:103 * exit status104 *105 * Returns:106 * does not return107 *108 * Side Effects:109 *110 * Notes:111 *112 *113 * Deficiencies/ToDo:114 *115 *116 */117 118 #include <unistd.h>119 120 45 /* FIXME: These defines are a blatant hack */ 121 #define EXIT_SYMBOL _exit122 46 123 47 #if defined(__USE_INIT_FINI__) … … 133 57 #endif 134 58 135 void EXIT_SYMBOL(int status)59 void _exit(int status) 136 60 { 137 61 /* … … 143 67 #endif 144 68 145 /*146 * We need to do the exit processing on the global reentrancy structure.147 * This has already been done on the per task reentrancy structure148 * associated with this task.149 */150 151 69 libc_wrapup(); 152 70 rtems_shutdown_executive(status); … … 154 72 } 155 73 156 157 74 #endif
Note: See TracChangeset
for help on using the changeset viewer.