Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:15

0001 /**
0002  *  @file
0003  *
0004  *  @brief Newlib Support
0005  *  @ingroup libcsupport
0006  */
0007 
0008 /*
0009  *  COPYRIGHT (c) 1994 by Division Incorporated
0010  *
0011  *  The license and distribution terms for this file may be
0012  *  found in the file LICENSE in this distribution or at
0013  *  http://www.rtems.org/license/LICENSE.
0014  *
0015  */
0016 
0017 #ifdef HAVE_CONFIG_H
0018 #include "config.h"
0019 #endif
0020 
0021 #include <rtems.h>
0022 
0023 #if defined(RTEMS_NEWLIB)
0024 
0025 #include <sys/reent.h>
0026 #include <stdlib.h>
0027 #include <string.h>
0028 
0029 #include <rtems/libcsupport.h>
0030 #include <rtems/score/threadimpl.h>
0031 
0032 #ifndef _REENT_THREAD_LOCAL
0033 bool newlib_create_hook(
0034   rtems_tcb *current_task RTEMS_UNUSED,
0035   rtems_tcb *creating_task
0036 )
0037 {
0038   _REENT_INIT_PTR((creating_task->libc_reent)); /* GCC extension: structure constants */
0039 
0040   return true;
0041 }
0042 #endif
0043 
0044 void newlib_terminate_hook(
0045   rtems_tcb *current_task
0046 )
0047 {
0048 #ifdef _REENT_THREAD_LOCAL
0049   _reclaim_reent(NULL);
0050 #else
0051   _reclaim_reent(current_task->libc_reent);
0052 #endif
0053 }
0054 
0055 #endif