Commit | Line | Data |
---|---|---|
95895d53 MB |
1 | Adjust the bundled gnulib to cope with removal of libio interface in |
2 | glibc 2.28. | |
3 | ||
4 | Based on this upstream patch, without hunks that do not apply to m4: | |
5 | https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=4af4a4a71827c0bc5e0ec67af23edef4f15cee8e | |
6 | ||
7 | diff --git a/lib/fflush.c b/lib/fflush.c | |
8 | index 983ade0..a6edfa1 100644 | |
9 | --- a/lib/fflush.c | |
10 | +++ b/lib/fflush.c | |
11 | @@ -33,7 +33,7 @@ | |
12 | #undef fflush | |
13 | ||
14 | ||
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 */ | |
17 | ||
18 | /* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */ | |
19 | static void | |
20 | @@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp) | |
21 | ||
22 | #endif | |
23 | ||
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 */) | |
26 | ||
27 | # if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT | |
28 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | |
29 | @@ -148,7 +148,7 @@ rpl_fflush (FILE *stream) | |
30 | if (stream == NULL || ! freading (stream)) | |
31 | return fflush (stream); | |
32 | ||
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 */ | |
35 | ||
36 | clear_ungetc_buffer_preserving_position (stream); | |
37 | ||
38 | diff --git a/lib/fpending.c b/lib/fpending.c | |
39 | index c84e3a5..789f50e 100644 | |
40 | --- a/lib/fpending.c | |
41 | +++ b/lib/fpending.c | |
42 | @@ -32,7 +32,7 @@ __fpending (FILE *fp) | |
43 | /* Most systems provide FILE as a struct and the necessary bitmask in | |
44 | <stdio.h>, because they need it for implementing getc() and putc() as | |
45 | fast macros. */ | |
46 | -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
47 | +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
48 | return fp->_IO_write_ptr - fp->_IO_write_base; | |
49 | #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ | |
50 | /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ | |
51 | diff --git a/lib/fpurge.c b/lib/fpurge.c | |
52 | index b1d417c..3aedcc3 100644 | |
53 | --- a/lib/fpurge.c | |
54 | +++ b/lib/fpurge.c | |
55 | @@ -62,7 +62,7 @@ fpurge (FILE *fp) | |
56 | /* Most systems provide FILE as a struct and the necessary bitmask in | |
57 | <stdio.h>, because they need it for implementing getc() and putc() as | |
58 | fast macros. */ | |
59 | -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
60 | +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
61 | fp->_IO_read_end = fp->_IO_read_ptr; | |
62 | fp->_IO_write_ptr = fp->_IO_write_base; | |
63 | /* Avoid memory leak when there is an active ungetc buffer. */ | |
64 | diff --git a/lib/freadahead.c b/lib/freadahead.c | |
65 | index c2ecb5b..23ec76e 100644 | |
66 | --- a/lib/freadahead.c | |
67 | +++ b/lib/freadahead.c | |
68 | @@ -30,7 +30,7 @@ extern size_t __sreadahead (FILE *); | |
69 | size_t | |
70 | freadahead (FILE *fp) | |
71 | { | |
72 | -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
73 | +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
74 | if (fp->_IO_write_ptr > fp->_IO_write_base) | |
75 | return 0; | |
76 | return (fp->_IO_read_end - fp->_IO_read_ptr) | |
77 | diff --git a/lib/freading.c b/lib/freading.c | |
78 | index 73c28ac..c24d0c8 100644 | |
79 | --- a/lib/freading.c | |
80 | +++ b/lib/freading.c | |
81 | @@ -31,7 +31,7 @@ freading (FILE *fp) | |
82 | /* Most systems provide FILE as a struct and the necessary bitmask in | |
83 | <stdio.h>, because they need it for implementing getc() and putc() as | |
84 | fast macros. */ | |
85 | -# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
86 | +# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
87 | return ((fp->_flags & _IO_NO_WRITES) != 0 | |
88 | || ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0 | |
89 | && fp->_IO_read_base != NULL)); | |
90 | diff --git a/lib/fseeko.c b/lib/fseeko.c | |
91 | index 0101ab5..193f4e8 100644 | |
92 | --- a/lib/fseeko.c | |
93 | +++ b/lib/fseeko.c | |
94 | @@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence) | |
95 | #endif | |
96 | ||
97 | /* These tests are based on fpurge.c. */ | |
98 | -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
99 | +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
100 | if (fp->_IO_read_end == fp->_IO_read_ptr | |
101 | && fp->_IO_write_ptr == fp->_IO_write_base | |
102 | && fp->_IO_save_base == NULL) | |
103 | @@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence) | |
104 | return -1; | |
105 | } | |
106 | ||
107 | -#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
108 | +#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ | |
109 | fp->_flags &= ~_IO_EOF_SEEN; | |
110 | fp->_offset = pos; | |
111 | #elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ | |
112 | diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h | |
113 | index 78d896e..05c5752 100644 | |
114 | --- a/lib/stdio-impl.h | |
115 | +++ b/lib/stdio-impl.h | |
116 | @@ -18,6 +18,12 @@ | |
117 | the same implementation of stdio extension API, except that some fields | |
118 | have different naming conventions, or their access requires some casts. */ | |
119 | ||
120 | +/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this | |
121 | + problem by defining it ourselves. FIXME: Do not rely on glibc | |
122 | + internals. */ | |
123 | +#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN | |
124 | +# define _IO_IN_BACKUP 0x100 | |
125 | +#endif | |
126 | ||
127 | /* BSD stdio derived implementations. */ | |
128 |