This is the mail archive of the newlib@sourceware.org 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]
Other format: [Raw text]

_REENT->_errno v. extern int errno


There's something funny going on with errno. The libgloss ARM
implementation includes <errno.h>, and so stores its errno result
direclty in _REENT->_errno. REENTRANT_SYSCALLS_PROVIDED is not
defined, so write, for example, calls _write in libgloss, and not
_write_r. All is good. However, a function such as __swrite calls
_write_r instead of _write. _write_r does a funny little fix up where
it assumes the OS layer (libgloss) stores the errno result in extern
int errno, and not in _REENT->_errno.

syscalls/syswrite.c assumes the OS layer stores errno in _REENT->_errno.
reent/writer.c assumes the OS layer stores errno in extern int errno.

It seems to me reent/writer.c is broken, or at least should be told
through a define that the errno result is already in _REENT->_errno.

Cheers,
Shaun


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