Reentrancy support for multiprocessor systems
J. Johnston
jjohnstn@redhat.com
Tue Mar 18 18:56:00 GMT 2003
Likely, Grant wrote:
> What about for the back end BSP? The functions in libnosys put errno values
> into the global definition of errno instead of using the macro. Is there a
> way to make the library use reentrant versions of errno for BSP calls, or do
> I need to replace _write_r, _read_r, etc with my own versions. If so, how
> do I tell the library not to include the functions in libc/reent when
> building?
>
Yes, you will have to supply the _r routines. If based on libnosys, this
is relatively easy. To tell newlib not to use its own _r routines, turn on the
REENTRANT_SYSCALLS_PROVIDED flag. There is some information about all of this
in the libc/include/reent.h header file.
-- Jeff J.
> If DYNAMIC_REENT could become an configuration option in a future release,
> that would be wonderful. In the mean time I'll manage it as a patch.
>
> Thanks,
> g.
>
> -----Original Message-----
> From: J. Johnston [mailto:jjohnstn@redhat.com]
> Sent: Tuesday, March 18, 2003 9:59 AM
> To: Likely, Grant
> Cc: 'newlib@sources.redhat.com'
> Subject: Re: Reentrancy support for multiprocessor systems
>
>
>>Is it safe to modify the _impure_ptr pointer to be a macro that calls a
>>function and returns the correct pointer? (just like the errno macro?)
>
> Is
>
>>there a better way to do this?
>>
>
>
> This is already done for you in libc/include/sys/reent.h. If you set the
> __DYNAMIC_REENT__
> flag on while compiling newlib, then all references to _REENT will call a
> function __getreent(). You will need to supply a version of this function
> that
> can figure out which thread it is running under and pass back the
> appropriate
> reentrancy structure.
>
> The flag currently must be set on manually and is meant to be set on in
> either
> configure.host or libc/include/sys/config.h but it could be modified to be a
> newlib configuration option.
>
> -- Jeff J.
More information about the Newlib
mailing list