This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
_REENT->_errno v. extern int errno
- From: Shaun Jackman <sjackman at gmail dot com>
- To: newlib at sources dot redhat dot com
- Date: Tue, 6 Dec 2005 08:42:22 -0700
- Subject: _REENT->_errno v. extern int errno
- Reply-to: Shaun Jackman <sjackman at gmail dot com>
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