Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / include / stdio_ext.h
blob231262d473df3beaffeeb088ecfd8f8ab6b6eeb2
1 /*
2 * stdio_ext.h
4 * Definitions for I/O internal operations, originally from Solaris.
5 */
7 #ifndef _STDIO_EXT_H_
8 #define _STDIO_EXT_H_
10 #ifdef __rtems__
11 #error "<stdio_ext.h> not supported"
12 #endif
14 #include <stdio.h>
16 #define FSETLOCKING_QUERY 0
17 #define FSETLOCKING_INTERNAL 1
18 #define FSETLOCKING_BYCALLER 2
20 _BEGIN_STD_C
22 void __fpurge (FILE *);
23 int __fsetlocking (FILE *, int);
25 /* TODO:
27 void _flushlbf (void);
30 #ifdef __GNUC__
32 _ELIDABLE_INLINE size_t
33 __fbufsize (FILE *__fp) { return (size_t) __fp->_bf._size; }
35 _ELIDABLE_INLINE int
36 __freading (FILE *__fp) { return (__fp->_flags & __SRD) != 0; }
38 _ELIDABLE_INLINE int
39 __fwriting (FILE *__fp) { return (__fp->_flags & __SWR) != 0; }
41 _ELIDABLE_INLINE int
42 __freadable (FILE *__fp) { return (__fp->_flags & (__SRD | __SRW)) != 0; }
44 _ELIDABLE_INLINE int
45 __fwritable (FILE *__fp) { return (__fp->_flags & (__SWR | __SRW)) != 0; }
47 _ELIDABLE_INLINE int
48 __flbf (FILE *__fp) { return (__fp->_flags & __SLBF) != 0; }
50 _ELIDABLE_INLINE size_t
51 __fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; }
53 #else
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 *);
63 #ifndef __cplusplus
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))
73 #endif /* __cplusplus */
75 #endif /* __GNUC__ */
77 _END_STD_C
79 #endif /* _STDIO_EXT_H_ */