why "Reentrant covers for OS subroutines" use global errno?
Tue Aug 9 10:13:00 GMT 2011
I am studying the reentrancy mechanism in newlib/libgloss, and read
several threads in newlib mail archive,
I still cannot understand following question.
Why do "Reentrant covers for OS subroutines"(in libc/reent/) use
global errno variable with codes like:
extern int errno;
It is said the system can achieve reentrancy by implementing its own
defining macro __DYNAMIC_REENT__ and implementing libgloss with
However, with routines in libc/reent directory, system won't be
reentrant unless defining macro
REENTRANT_SYSCALLS_PROVIDED and implementing _r versions of syscalls
Think about calling sequence of a simple case for arm:
fwrite --> __swrite --> _write_r(in libc/reent) --> _write(in libgloss/arm)
routine _write_r uses global errno variable, which breaks the
reentrancy in the calling sequence.
Did I misunderstand the reentrancy mechanism in newlib/libgloss or
Please help, thanks in advance.
More information about the Newlib