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] |
Vincent Rivière wrote:Ok, I have checked in patches to both libgloss and newlib. I have tested x86-linux and mn10300. It should work the same as before for Cygwin and powerpcle-*-pe because the libc/posix directory supplies isatty which calls _isatty which is also supplied in libc/posix. The two stdio routines now call _isatty_r which is always supplied in libc/reent and calls either _isatty_r or _isatty. Again, Cygwin should not see a change since it will end up calling the _isatty implementation in libc/posix.Jeff Johnston a wrote :Hmm, there are huge inconsistencies here. The isatty syscall hasn't been made compulsory like the other newlib syscalls in that there is neither _isatty or _isatty_r calls in the library, but it should have been or at the very least, something like the libc/posix isatty implementation should have been exposed to be overridden if desired._isatty is not one of the fundamental syscalls required by newlib. Remember that newlib's historical origin was to support embedded platforms and it only required a small set of syscalls to support the ANSI C plus miscellaneous functions. There is a rough isatty() implementation in libc/posix that uses fstat, not _isatty.
Platforms that have wanted it have typically just done so directly in their libgloss implementation or libc/sys (used before libgloss was created) or they use the libc/posix implementation or they use the default libgloss/isatty.c version (always returns 1) or they let libnosys resolve it (always returns 0) just to allow tests to link/run.
I understand. But there are 2 problems :
1) isatty() is currently fundamental, because without it, a simple printf() cannot link !
isatty() is used at the bottom of libc/stdio/makebuf.c
2) The isatty() implementation in libgloss/libnosys/isatty.c uses the wrong errno. It should only #include <errno.h>, without #undef errno, extern int errno.
The isatty in libnosys should probably be changed to be consistent with other libnosys syscalls and implement _isatty.
It will take some unravelling to see if adding _isatty_r will break things or not for existing platforms. For example, Cygwin is using the libc/posix isatty and also uses libc/syscalls which would override libc/posix in the case of the same object name.
I need to look at this a bit.
-- Jeff J.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |