This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Re-entrancy problems


Mats Liljegren wrote:
> 
> Hi all,
> 
> I'm having some problems, which might be re-entrancy problems somewhere.
> This has to do with writes to stdout and stderr.
> I have implemented the get_pid() function so that it will call the OS
> asking for the current process ID.
> I'm using Newlib 1.8.2 release on powerpc-eabi platform. I'm compiling
> with GNU GCC 2.95.2.

Unless you stick with XXX_r() functions, reentrancy support must
be provided as part of the by the underlying libgloss layer.
Powerpc-eabi probably does not have per-thread/process reentrancy
support.
 
> 1) When asking for line buffering of output (which is default, as far as
> I understand), is this done per process?
> 
> 2) Could one process destroy the output buffer for another process in
> any situation? It is when starting or stopping processes multiple
> processes "simultaneously" (i.e. within a short time interval) that I
> loose characters.

Yes.  Unless target specific arrangements are made, there is only
one copy of the shared global structures.

newlib 1.8.2 has some support locking that with a mutex but that
requires target specific glue also.

> 3) When will get_pid() be used? Is there a need to tell Newlib that
> there has popped up a new process?
> 
> Thanks in advance for any help!
> 
> Regards,
>   Mats

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]