[RTEMS Project] #3870: libc_reent set up is broken

RTEMS trac trac at rtems.org
Tue Feb 11 06:35:41 UTC 2020


#3870: libc_reent set up is broken
-------------------------+---------------------
 Reporter:  Chris Johns  |       Owner:  (none)
     Type:  defect       |      Status:  new
 Priority:  high         |   Milestone:  5.1
Component:  score        |     Version:  5
 Severity:  normal       |  Resolution:
 Keywords:               |  Blocked By:
 Blocking:  3859         |
-------------------------+---------------------

Comment (by Chris Johns):

 Replying to [comment:3 Sebastian Huber]:
 > Replying to [comment:1 Chris Johns]:
 > The re-entrant struct is initialized by newlib_create_hook() and
 destroyed by newlib_terminate_hook(). There is a test case for this area:
 libtests/newlib01.

 Sure, that maybe a better place.

 > The `__getreent()` should not do any initialization steps.

 Sure.

 > Sorry, I don't know the problem you want to solve.

 Telnet is broken with `joel` script. This is compounded by the shell's
 main loop handling of `stdout` and `stdin` also being broken. See #3859.
 You see it when you create a new thread in the telnet shell thread, ie a
 `joel` command, and you want the IO to inherit the parent's `stdin` and
 `stdout`.

 Create a thread and do not access any libc calls then do ...
 {{{
   stdin = fopen("a-file", "r");
   stdout = my_stdout;
   setvbuf(stdout, NULL, _IONBF, 0);
   printf("hello will appear on the global stdout\n");
 }}}
 The `stdin` and `stdout` files pointers well be initialised to the
 globals. If you make a libc call before this type of logic, for example
 `fflush(stdout);` things work.

--
Ticket URL: <http://devel.rtems.org/ticket/3870#comment:4>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list