Exemple #1
0
void __libc_wrapup()
{
	if(!__sys_state_up(__sys_state_get())) return;
	if(_REENT!=&libc_globl_reent) {
		_wrapup_reent(&libc_globl_reent);
		_REENT = &libc_globl_reent;
	}
}
Exemple #2
0
int __libc_delete_hook(lwp_cntrl *curr_thr, lwp_cntrl *delete_thr)
{
	struct _reent *ptr;

	if(curr_thr==delete_thr)
		ptr = _REENT;
	else
		ptr = (struct _reent*)delete_thr->libc_reent;
	
	if(ptr && ptr!=&libc_globl_reent) {
		_wrapup_reent(ptr);
		_reclaim_reent(ptr);
		free(ptr);
	}
	delete_thr->libc_reent = 0;

	if(curr_thr==delete_thr) _REENT = 0;

	return 1;
}
Exemple #3
0
void libc_wrapup(void)
{
  /*
   *  In case RTEMS is already down, don't do this.  It could be
   *  dangerous.
   */

  if (!_System_state_Is_up(_System_state_Get()))
     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?
   *    _fwalk (_REENT, fclose);
   */

  fclose (stdin);
  fclose (stdout);
  fclose (stderr);
}