1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH STDIO_EXT 3 2021-03-22 "" "Linux Programmer's Manual"
7 __fbufsize, __flbf, __fpending, __fpurge, __freadable,
8 __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \-
9 interfaces to stdio FILE structure
12 .RI ( libc ", " \-lc )
16 .B #include <stdio_ext.h>
18 .BI "size_t __fbufsize(FILE *" stream );
19 .BI "size_t __fpending(FILE *" stream );
20 .BI "int __flbf(FILE *" stream );
21 .BI "int __freadable(FILE *" stream );
22 .BI "int __fwritable(FILE *" stream );
23 .BI "int __freading(FILE *" stream );
24 .BI "int __fwriting(FILE *" stream );
25 .BI "int __fsetlocking(FILE *" stream ", int " type );
26 .B "void _flushlbf(void);"
27 .BI "void __fpurge(FILE *" stream );
30 Solaris introduced routines to allow portable access to the
33 structure, and glibc also implemented these.
37 function returns the size of the buffer currently used
42 function returns the number of bytes in the output buffer.
43 For wide-oriented streams the unit is wide characters.
44 This function is undefined on buffers in reading mode,
49 function returns a nonzero value if the stream is line-buffered,
54 function returns a nonzero value if the stream allows reading,
59 function returns a nonzero value if the stream allows writing,
64 function returns a nonzero value if the stream is read-only, or
65 if the last operation on the stream was a read operation,
70 function returns a nonzero value if the stream is write-only (or
71 append-only), or if the last operation on the stream was a write
72 operation, and zero otherwise.
76 function can be used to select the desired type of locking on the stream.
77 It returns the current type.
80 argument can take the following three values:
82 .B FSETLOCKING_INTERNAL
83 Perform implicit locking around every operation on the given stream
84 (except for the *_unlocked ones).
87 .B FSETLOCKING_BYCALLER
88 The caller will take care of the locking (possibly using
90 in case there is more than one thread), and the stdio routines
91 will not do locking until the state is reset to
92 .BR FSETLOCKING_INTERNAL .
95 Don't change the type of locking.
100 function flushes all line-buffered streams.
102 output to a terminal is forced out, say before reading keyboard input.)
106 function discards the contents of the stream's buffer.
108 For an explanation of the terms used in this section, see
116 Interface Attribute Value
122 T} Thread safety MT-Safe race:stream
130 T} Thread safety MT-Safe