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] |
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.
- Switch over to use MISSING_SYSCALL_NAMES or REENTRANT_SYSCALLS_PROVIDED (_r routine additions needed with this choice) - Modify the reent functions to add a new scenario (__SINGLE_THREAD__ and __SYSCALLS_USE_ERRNO_H__). You would have to set these flags for arm and the new scenario would have to be documented in libc/include/reent.h. (In the case of __DYNAMIC_REENT__ described earlier, one would go with MISSING_SYSCALL_NAMES since the _r routines aren't needed). - Use the external errno and add _r versions of the syscall functions not found in libc/reent
Cheers, Shaun
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |