Cygwin: mmap: use 64K pages for bookkeeping, second attempt
[newlib-cygwin.git] / newlib / libc / reent / isattyr.c
blobf76945519589d7dd364b76bb8860f4af496094a0
1 /* Reentrant versions of isatty system call. */
3 #include <reent.h>
4 #include <unistd.h>
5 #include <_syslist.h>
7 /* Some targets provides their own versions of these functions. Those
8 targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
10 #ifdef _REENT_ONLY
11 #ifndef REENTRANT_SYSCALLS_PROVIDED
12 #define REENTRANT_SYSCALLS_PROVIDED
13 #endif
14 #endif
16 #ifdef REENTRANT_SYSCALLS_PROVIDED
18 int _dummy_isatty_syscalls = 1;
20 #else
22 /* We use the errno variable used by the system dependent layer. */
23 #undef errno
24 extern int errno;
27 FUNCTION
28 <<_isatty_r>>---Reentrant version of isatty
30 INDEX
31 _isatty_r
33 SYNOPSIS
34 #include <reent.h>
35 int _isatty_r(struct _reent *<[ptr]>,
36 int <[fd]>);
38 DESCRIPTION
39 This is a reentrant version of <<isatty>>. It
40 takes a pointer to the global data block, which holds
41 <<errno>>.
44 int
45 _isatty_r (ptr, fd)
46 struct _reent *ptr;
47 int fd;
49 int ret;
51 errno = 0;
52 if ((ret = _isatty (fd)) == -1 && errno != 0)
53 _REENT_ERRNO(ptr) = errno;
54 return ret;
57 #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */