[PATCH] Require __getreent()

Daniel Gutson daniel.gutson at tallertechnologies.com
Wed Nov 25 13:30:31 UTC 2015


Hi Sebastian,

  sorry for top-posting. How does the lack of this function affect
current RTEMS behavior? What's the impact of not having this? We lived
without this till now, how mandatory is this update?

Thanks!

   Daniel.

On Wed, Nov 25, 2015 at 4:35 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> This function is used by Newlib since 2013-07-09 (Git commit
> 9b51cd8c6b9cdd067d9648a7ab952884019c56a5).
> ---
>  cpukit/configure.ac                           |  4 ++++
>  cpukit/libcsupport/src/newlibc_reent.c        |  9 --------
>  cpukit/sapi/include/confdefs.h                |  2 +-
>  cpukit/score/include/rtems/score/threadimpl.h | 32 ---------------------------
>  cpukit/score/src/threaddispatch.c             | 10 ---------
>  5 files changed, 5 insertions(+), 52 deletions(-)
>
> diff --git a/cpukit/configure.ac b/cpukit/configure.ac
> index cdf9915..f1589a8 100644
> --- a/cpukit/configure.ac
> +++ b/cpukit/configure.ac
> @@ -180,6 +180,10 @@ AC_CHECK_HEADER([signal.h],[
>    AC_CHECK_TYPES([sighandler_t])
>  ])
>
> +if test x"$RTEMS_USE_NEWLIB" = xyes ; then
> +  AC_CHECK_DECLS([__getreent],[],[AC_MSG_ERROR([__getreent() in <sys/reent.h> is mandatory])],[#include <sys/reent.h>])
> +fi
> +
>  RTEMS_CHECK_MULTIPROCESSING
>  RTEMS_CHECK_POSIX_API
>  RTEMS_CHECK_NETWORKING
> diff --git a/cpukit/libcsupport/src/newlibc_reent.c b/cpukit/libcsupport/src/newlibc_reent.c
> index bf8847c..26da252 100644
> --- a/cpukit/libcsupport/src/newlibc_reent.c
> +++ b/cpukit/libcsupport/src/newlibc_reent.c
> @@ -35,15 +35,6 @@ bool newlib_create_hook(
>    rtems_tcb *creating_task
>  )
>  {
> -#if !defined(__DYNAMIC_REENT__)
> -  if (_Thread_libc_reent == 0)
> -  {
> -    _REENT = _GLOBAL_REENT;
> -
> -    _Thread_Set_libc_reent (&_REENT);
> -  }
> -#endif
> -
>    _REENT_INIT_PTR((creating_task->libc_reent)); /* GCC extension: structure constants */
>
>    return true;
> diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
> index 0e83bf1..9ef0bc6 100644
> --- a/cpukit/sapi/include/confdefs.h
> +++ b/cpukit/sapi/include/confdefs.h
> @@ -2417,7 +2417,7 @@ const rtems_libio_helper rtems_fs_init_helper =
>    #define CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
>  #endif
>
> -#if defined(RTEMS_NEWLIB) && defined(__DYNAMIC_REENT__)
> +#if defined(RTEMS_NEWLIB)
>    struct _reent *__getreent(void)
>    {
>      #ifdef CONFIGURE_DISABLE_NEWLIB_REENTRANCY
> diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
> index 906bdb1..cf32082 100644
> --- a/cpukit/score/include/rtems/score/threadimpl.h
> +++ b/cpukit/score/include/rtems/score/threadimpl.h
> @@ -75,16 +75,6 @@ SCORE_EXTERN Thread_Information _Thread_Internal_information;
>  SCORE_EXTERN Thread_Control *_Thread_Allocated_fp;
>  #endif
>
> -#if !defined(__DYNAMIC_REENT__)
> -/**
> - * The C library re-enter-rant global pointer. Some C library implementations
> - * such as newlib have a single global pointer that changed during a context
> - * switch. The pointer points to that global pointer. The Thread control block
> - * holds a pointer to the task specific data.
> - */
> -SCORE_EXTERN struct _reent **_Thread_libc_reent;
> -#endif
> -
>  #define THREAD_CHAIN_NODE_TO_THREAD( node ) \
>    RTEMS_CONTAINER_OF( node, Thread_Control, Wait.Node.Chain )
>
> @@ -1501,28 +1491,6 @@ RTEMS_INLINE_ROUTINE void _Thread_Debug_set_real_processor(
>  #endif
>  }
>
> -#if !defined(__DYNAMIC_REENT__)
> -/**
> - * This routine returns the C library re-enterant pointer.
> - */
> -
> -RTEMS_INLINE_ROUTINE struct _reent **_Thread_Get_libc_reent( void )
> -{
> -  return _Thread_libc_reent;
> -}
> -
> -/**
> - * This routine set the C library re-enterant pointer.
> - */
> -
> -RTEMS_INLINE_ROUTINE void _Thread_Set_libc_reent (
> -  struct _reent **libc_reent
> -)
> -{
> -  _Thread_libc_reent = libc_reent;
> -}
> -#endif
> -
>  /** @}*/
>
>  #ifdef __cplusplus
> diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
> index cce3aff..3ae8335 100644
> --- a/cpukit/score/src/threaddispatch.c
> +++ b/cpukit/score/src/threaddispatch.c
> @@ -104,16 +104,6 @@ void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level )
>        &cpu_self->time_of_last_context_switch
>      );
>
> -#if !defined(__DYNAMIC_REENT__)
> -    /*
> -     * Switch libc's task specific data.
> -     */
> -    if ( _Thread_libc_reent ) {
> -      executing->libc_reent = *_Thread_libc_reent;
> -      *_Thread_libc_reent = heir->libc_reent;
> -    }
> -#endif
> -
>      _User_extensions_Thread_switch( executing, heir );
>      _Thread_Save_fp( executing );
>      _Context_Switch( &executing->Registers, &heir->Registers );
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



-- 

Daniel F. Gutson
Chief Engineering Officer, SPD

San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina

Phone:   +54 351 4217888 / +54 351 4218211
Skype:    dgutson
LinkedIn: http://ar.linkedin.com/in/danielgutson



More information about the devel mailing list