1 | /* |
---|
2 | * stdio_ext.h |
---|
3 | * |
---|
4 | * Definitions for I/O internal operations, originally from Solaris. |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _STDIO_EXT_H_ |
---|
8 | #define _STDIO_EXT_H_ |
---|
9 | |
---|
10 | #ifdef __rtems__ |
---|
11 | #error "<stdio_ext.h> not supported" |
---|
12 | #endif |
---|
13 | |
---|
14 | #include <stdio.h> |
---|
15 | |
---|
16 | #define FSETLOCKING_QUERY 0 |
---|
17 | #define FSETLOCKING_INTERNAL 1 |
---|
18 | #define FSETLOCKING_BYCALLER 2 |
---|
19 | |
---|
20 | _BEGIN_STD_C |
---|
21 | |
---|
22 | void __fpurge (FILE *); |
---|
23 | int __fsetlocking (FILE *, int); |
---|
24 | |
---|
25 | /* TODO: |
---|
26 | |
---|
27 | void _flushlbf (void); |
---|
28 | */ |
---|
29 | |
---|
30 | #ifdef __GNUC__ |
---|
31 | |
---|
32 | _ELIDABLE_INLINE size_t |
---|
33 | __fbufsize (FILE *__fp) { return (size_t) __fp->_bf._size; } |
---|
34 | |
---|
35 | _ELIDABLE_INLINE int |
---|
36 | __freading (FILE *__fp) { return (__fp->_flags & __SRD) != 0; } |
---|
37 | |
---|
38 | _ELIDABLE_INLINE int |
---|
39 | __fwriting (FILE *__fp) { return (__fp->_flags & __SWR) != 0; } |
---|
40 | |
---|
41 | _ELIDABLE_INLINE int |
---|
42 | __freadable (FILE *__fp) { return (__fp->_flags & (__SRD | __SRW)) != 0; } |
---|
43 | |
---|
44 | _ELIDABLE_INLINE int |
---|
45 | __fwritable (FILE *__fp) { return (__fp->_flags & (__SWR | __SRW)) != 0; } |
---|
46 | |
---|
47 | _ELIDABLE_INLINE int |
---|
48 | __flbf (FILE *__fp) { return (__fp->_flags & __SLBF) != 0; } |
---|
49 | |
---|
50 | _ELIDABLE_INLINE size_t |
---|
51 | __fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; } |
---|
52 | |
---|
53 | #else |
---|
54 | |
---|
55 | size_t __fbufsize (FILE *); |
---|
56 | int __freading (FILE *); |
---|
57 | int __fwriting (FILE *); |
---|
58 | int __freadable (FILE *); |
---|
59 | int __fwritable (FILE *); |
---|
60 | int __flbf (FILE *); |
---|
61 | size_t __fpending (FILE *); |
---|
62 | |
---|
63 | #ifndef __cplusplus |
---|
64 | |
---|
65 | #define __fbufsize(__fp) ((size_t) (__fp)->_bf._size) |
---|
66 | #define __freading(__fp) (((__fp)->_flags & __SRD) != 0) |
---|
67 | #define __fwriting(__fp) (((__fp)->_flags & __SWR) != 0) |
---|
68 | #define __freadable(__fp) (((__fp)->_flags & (__SRD | __SRW)) != 0) |
---|
69 | #define __fwritable(__fp) (((__fp)->_flags & (__SWR | __SRW)) != 0) |
---|
70 | #define __flbf(__fp) (((__fp)->_flags & __SLBF) != 0) |
---|
71 | #define __fpending(__fp) ((size_t) ((__fp)->_p - (__fp)->_bf._base)) |
---|
72 | |
---|
73 | #endif /* __cplusplus */ |
---|
74 | |
---|
75 | #endif /* __GNUC__ */ |
---|
76 | |
---|
77 | _END_STD_C |
---|
78 | |
---|
79 | #endif /* _STDIO_EXT_H_ */ |
---|