Last change
on this file since 471 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.0 KB
|
Line | |
---|
1 | /* Reentrant versions of isatty system call. */ |
---|
2 | |
---|
3 | #include <reent.h> |
---|
4 | #include <unistd.h> |
---|
5 | #include <_syslist.h> |
---|
6 | |
---|
7 | /* Some targets provides their own versions of these functions. Those |
---|
8 | targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */ |
---|
9 | |
---|
10 | #ifdef _REENT_ONLY |
---|
11 | #ifndef REENTRANT_SYSCALLS_PROVIDED |
---|
12 | #define REENTRANT_SYSCALLS_PROVIDED |
---|
13 | #endif |
---|
14 | #endif |
---|
15 | |
---|
16 | #ifdef REENTRANT_SYSCALLS_PROVIDED |
---|
17 | |
---|
18 | int _dummy_isatty_syscalls = 1; |
---|
19 | |
---|
20 | #else |
---|
21 | |
---|
22 | /* We use the errno variable used by the system dependent layer. */ |
---|
23 | #undef errno |
---|
24 | extern int errno; |
---|
25 | |
---|
26 | /* |
---|
27 | FUNCTION |
---|
28 | <<_isatty_r>>---Reentrant version of isatty |
---|
29 | |
---|
30 | INDEX |
---|
31 | _isatty_r |
---|
32 | |
---|
33 | SYNOPSIS |
---|
34 | #include <reent.h> |
---|
35 | int _isatty_r(struct _reent *<[ptr]>, |
---|
36 | int <[fd]>); |
---|
37 | |
---|
38 | DESCRIPTION |
---|
39 | This is a reentrant version of <<isatty>>. It |
---|
40 | takes a pointer to the global data block, which holds |
---|
41 | <<errno>>. |
---|
42 | */ |
---|
43 | |
---|
44 | int |
---|
45 | _isatty_r (ptr, fd) |
---|
46 | struct _reent *ptr; |
---|
47 | int fd; |
---|
48 | { |
---|
49 | int ret; |
---|
50 | |
---|
51 | errno = 0; |
---|
52 | if ((ret = _isatty (fd)) == -1 && errno != 0) |
---|
53 | ptr->_errno = errno; |
---|
54 | return ret; |
---|
55 | } |
---|
56 | |
---|
57 | #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */ |
---|
Note: See
TracBrowser
for help on using the repository browser.