libroot/glibc: Add missing stdio_ext methods needed by gnulib.

Otherwise it needs to use libio internals to implement these,
which we don't want. musl also exports all these methods for
the same reason.

Implementations taken from glibc 2.15, current gnulib (5077f67), and
in a few cases tweaked for better Haiku support.

Should fix #19479.
This commit is contained in:
Augustin Cavalier
2025-03-18 22:03:10 -04:00
parent 0796aaabfc
commit a5854d713e
14 changed files with 291 additions and 109 deletions
+13 -11
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2008-2012 Haiku, Inc. All Rights Reserved.
* Copyright 2008-2025, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _STDIO_EXT_H_
@@ -16,19 +16,21 @@ extern "C" {
#define FSETLOCKING_INTERNAL 1
#define FSETLOCKING_BYCALLER 2
/* The following stdio extensions are not implemented yet */
/* extern size_t __fufsize(FILE* stream); */
extern int __freading(FILE* stream);
/* extern int __fwriting(FILE* stream); */
/* extern int __freadable(FILE* stream); */
/* extern int __fwritable(FILE* stream); */
/* extern int __flbf(FILE* stream); */
extern void __fpurge(FILE* stream);
/* extern size_t __fpending(FILE* stream); */
extern void _flushlbf(void);
extern int __fsetlocking(FILE* stream, int type);
extern int __freading(FILE* stream);
extern int __fwriting(FILE* stream);
extern int __freadable(FILE* stream);
extern int __fwritable(FILE* stream);
extern size_t __freadahead(FILE* stream);
extern const char* __freadptr(FILE* stream, size_t* size);
extern void __freadptrinc(FILE* stream, size_t inc);
extern int __flbf(FILE* stream);
extern size_t __fbufsize(FILE* stream);
extern size_t __fpending(FILE* stream);
extern void __fpurge(FILE* stream);
#ifdef __cplusplus
}
#endif