isatty()
Jeff Johnston
jjohnstn@redhat.com
Thu Jan 3 16:29:00 GMT 2008
Vincent Rivière wrote:
> Hello.
>
> I see in the sources that isatty() is not handled as the other syscalls:
> - there is no _isatty_r() in reent
> - there is no _isatty() at all
> - there is no isatty() in syscalls
> - libgloss implements directly isatty(), not _isatty()
>
> There is the usual errno problem:
> For example, the implementation of isatty() in libnosys fills "extern
> int errno", but the user applications will read __errno_r(_REENT)
> instead. Usually, the errno translation occurs in the _r function, but
> in this case, the _r function does not exist.
>
> However, this is not a big issue, because errno is rarely read after
> calling isatty().
>
> Is there a reason for the spacial handling of isatty() ?
>
_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.
-- Jeff J.
-- Jeff J.
More information about the Newlib
mailing list