[RTEMS Project] #1247: RTEMS does not implement locks needed by multithreaded newlib

RTEMS trac trac at rtems.org
Tue Feb 10 15:16:34 UTC 2015


#1247: RTEMS does not implement locks needed by multithreaded newlib
------------------------+-----------------------
 Reporter:  strauman    |       Owner:  chrisj
     Type:  defect      |      Status:  assigned
 Priority:  highest     |   Milestone:  4.11
Component:  filesystem  |     Version:  4.11
 Severity:  critical    |  Resolution:
 Keywords:              |
------------------------+-----------------------

Old description:

> multi-threaded newlib protects a number of internal data structures
> (as of newlib-1.15 these comprise:
>  - global list of FILE objects
>  - stdio FILE object initializer
>  - individual FILEs [since FILEs with the exception of
>    stdin/stdout/stderr are per-process entities]
>  - global hash table used by telldir/seekdir
>  - individual DIR structures (opendir/readdir)
>  - atexit list
>  - list of environment variables
>  - global timezone variable
> )
> using mutexes. It expects the OS to implement these locks but defaults
> to not using locking if the OS does not provide an implementation.
> Currently, RTEMS does *not* provide its own implementation of
> 'sys/lock.h'
> and therefore vital data structures in newlib are currently *unprotected*
> (with the exception of environment variables -- 'envlock.c' had been
> added to RTEMS a while ago but since then, newlib has introduced more
> locks and a general OS interface which - once implemented - will obsolete
> 'envlock.c').
>
> Note that while semantics of having no protection for individual FILE
> objects may be tolerable, having no protection for global newlib data
> structures such as lists of FILEs is not acceptable.
>
> I am currently working on an implementation which should be available
> shortly.

New description:

 multi-threaded newlib protects a number of internal data structures
 (as of newlib-1.15 these comprise:
  - global list of FILE objects
  - stdio FILE object initializer
  - individual FILEs [since FILEs with the exception of
    stdin/stdout/stderr are per-process entities]
  - global hash table used by telldir/seekdir
  - individual DIR structures (opendir/readdir)
  - atexit list
  - list of environment variables
  - global timezone variable
 )
 using mutexes. It expects the OS to implement these locks but defaults
 to not using locking if the OS does not provide an implementation.
 Currently, RTEMS does *not* provide its own implementation of 'sys/lock.h'
 and therefore vital data structures in newlib are currently *unprotected*
 (with the exception of environment variables -- 'envlock.c' had been
 added to RTEMS a while ago but since then, newlib has introduced more
 locks and a general OS interface which - once implemented - will obsolete
 'envlock.c').

 Note that while semantics of having no protection for individual FILE
 objects may be tolerable, having no protection for global newlib data
 structures such as lists of FILEs is not acceptable.

 I am currently working on an implementation which should be available
 shortly.

--

Comment (by gedare):

 Sebastian/Chris: Is this still a valid problem?

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


More information about the bugs mailing list