1 update for glibc libio.h removal in 2.28+
4 https://src.fedoraproject.org/rpms/m4/c/814d592134fad36df757f9a61422d164ea2c6c9b?branch=master
6 Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a718]
7 Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
16 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
18 /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
20 @@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
24 -#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
25 +#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
27 # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
28 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
29 @@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
30 if (stream == NULL || ! freading (stream))
31 return fflush (stream);
33 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
34 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
36 clear_ungetc_buffer_preserving_position (stream);
40 @@ -32,7 +32,7 @@ __fpending (FILE *fp)
41 /* Most systems provide FILE as a struct and the necessary bitmask in
42 <stdio.h>, because they need it for implementing getc() and putc() as
44 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
45 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
46 return fp->_IO_write_ptr - fp->_IO_write_base;
47 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
48 /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
51 @@ -62,7 +62,7 @@ fpurge (FILE *fp)
52 /* Most systems provide FILE as a struct and the necessary bitmask in
53 <stdio.h>, because they need it for implementing getc() and putc() as
55 -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
56 +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
57 fp->_IO_read_end = fp->_IO_read_ptr;
58 fp->_IO_write_ptr = fp->_IO_write_base;
59 /* Avoid memory leak when there is an active ungetc buffer. */
60 --- a/lib/freadahead.c
61 +++ b/lib/freadahead.c
66 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
67 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
68 if (fp->_IO_write_ptr > fp->_IO_write_base)
70 return (fp->_IO_read_end - fp->_IO_read_ptr)
73 @@ -31,7 +31,7 @@ freading (FILE *fp)
74 /* Most systems provide FILE as a struct and the necessary bitmask in
75 <stdio.h>, because they need it for implementing getc() and putc() as
77 -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
78 +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
79 return ((fp->_flags & _IO_NO_WRITES) != 0
80 || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
81 && fp->_IO_read_base != NULL));
84 @@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int when
87 /* These tests are based on fpurge.c. */
88 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
89 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
90 if (fp->_IO_read_end == fp->_IO_read_ptr
91 && fp->_IO_write_ptr == fp->_IO_write_base
92 && fp->_IO_save_base == NULL)
93 @@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int when
97 -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
98 +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
99 fp->_flags &= ~_IO_EOF_SEEN;
101 #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
102 --- a/lib/stdio-impl.h
103 +++ b/lib/stdio-impl.h
105 the same implementation of stdio extension API, except that some fields
106 have different naming conventions, or their access requires some casts. */
108 +/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
109 + problem by defining it ourselves. FIXME: Do not rely on glibc
111 +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
112 +# define _IO_IN_BACKUP 0x100
115 /* BSD stdio derived implementations. */