summaryrefslogtreecommitdiff
path: root/lib/stdio-impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdio-impl.h')
-rw-r--r--lib/stdio-impl.h60
1 files changed, 51 insertions, 9 deletions
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 4abf9e68..c90f64df 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -1,5 +1,5 @@
/* Implementation details of FILE streams.
- Copyright (C) 2007-2008, 2010-2025 Free Software Foundation, Inc.
+ Copyright (C) 2007-2008, 2010-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -108,15 +108,59 @@
# define _flags pub._flags
# define _r pub._r
# define _w pub._w
-# elif defined __ANDROID__ || defined __OpenBSD__ /* Android, OpenBSD */
-# if defined __LP64__ && !defined __OpenBSD__
+# elif defined __OpenBSD__ /* OpenBSD */
+# if defined __sferror /* OpenBSD <= 7.7 */
+# define _gl_flags_file_t short
+# else /* OpenBSD >= 7.8 */
+# define _gl_flags_file_t int
+# endif
+ /* Up to this commit from 2025-07-16
+ <https://github.com/openbsd/src/commit/b7f6c2eb760a2da367dd51d539ef06f5f3553790>
+ the innards of FILE were public. After this commit, the innards of FILE
+ are hidden. In this commit
+ <https://github.com/openbsd/src/commit/9063a2f1ec94013fb0e2c7ec851495108e788a6e>
+ they were reshuffled. */
+# if defined __sferror /* OpenBSD <= 7.7 */
+# define fp_ ((struct { unsigned char *_p; \
+ int _r; \
+ int _w; \
+ _gl_flags_file_t _flags; \
+ _gl_flags_file_t _file; \
+ struct { unsigned char *_base; size_t _size; } _bf; \
+ int _lbfsize; \
+ void *_cookie; \
+ void *_close; \
+ void *_read; \
+ void *_seek; \
+ void *_write; \
+ struct { unsigned char *_base; size_t _size; } _ext; \
+ unsigned char *_up; \
+ int _ur; \
+ unsigned char _ubuf[3]; \
+ unsigned char _nbuf[1]; \
+ struct { unsigned char *_base; size_t _size; } _lb; \
+ int _blksize; \
+ fpos_t _offset; \
+ /* More fields, not relevant here. */ \
+ } *) fp)
+# else /* OpenBSD >= 7.8 */
+# define fp_ ((struct { _gl_flags_file_t _flags; \
+ _gl_flags_file_t _file; \
+ unsigned char *_p; \
+ int _r; \
+ int _w; \
+ struct { unsigned char *_base; size_t _size; } _bf; \
+ int _lbfsize; \
+ /* More fields, not relevant here. */ \
+ } *) fp)
+# endif
+# elif defined __ANDROID__ /* Android */
+# if defined __LP64__
# define _gl_flags_file_t int
# else
# define _gl_flags_file_t short
# endif
-# if defined __OpenBSD__
-# define _gl_file_offset_t fpos_t
-# elif defined __LP64__
+# if defined __LP64__
# define _gl_file_offset_t int64_t
# else
/* see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
@@ -127,9 +171,7 @@
the innards of FILE were public,
see <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/fileext.h>
and <https://android.googlesource.com/platform/bionic.git/+/e78392637d5086384a5631ddfdfa8d7ec8326ee3/libc/stdio/local.h>.
- After this commit, the innards of FILE are hidden. Likewise for OpenBSD
- up to this commit from 2025-07-16
- <https://github.com/openbsd/src/commit/b7f6c2eb760a2da367dd51d539ef06f5f3553790>. */
+ After this commit, the innards of FILE are hidden. */
# define fp_ ((struct { unsigned char *_p; \
int _r; \
int _w; \