1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH STDIO_EXT 3 2021-03-22 "" "Linux Programmer's Manual"
27 __fbufsize, __flbf, __fpending, __fpurge, __freadable,
28 __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \-
29 interfaces to stdio FILE structure
33 .B #include <stdio_ext.h>
35 .BI "size_t __fbufsize(FILE *" stream );
36 .BI "size_t __fpending(FILE *" stream );
37 .BI "int __flbf(FILE *" stream );
38 .BI "int __freadable(FILE *" stream );
39 .BI "int __fwritable(FILE *" stream );
40 .BI "int __freading(FILE *" stream );
41 .BI "int __fwriting(FILE *" stream );
42 .BI "int __fsetlocking(FILE *" stream ", int " type );
43 .B "void _flushlbf(void);"
44 .BI "void __fpurge(FILE *" stream );
47 Solaris introduced routines to allow portable access to the
50 structure, and glibc also implemented these.
54 function returns the size of the buffer currently used
59 function returns the number of bytes in the output buffer.
60 For wide-oriented streams the unit is wide characters.
61 This function is undefined on buffers in reading mode,
66 function returns a nonzero value if the stream is line-buffered,
71 function returns a nonzero value if the stream allows reading,
76 function returns a nonzero value if the stream allows writing,
81 function returns a nonzero value if the stream is read-only, or
82 if the last operation on the stream was a read operation,
87 function returns a nonzero value if the stream is write-only (or
88 append-only), or if the last operation on the stream was a write
89 operation, and zero otherwise.
93 function can be used to select the desired type of locking on the stream.
94 It returns the current type.
97 argument can take the following three values:
99 .B FSETLOCKING_INTERNAL
100 Perform implicit locking around every operation on the given stream
101 (except for the *_unlocked ones).
104 .B FSETLOCKING_BYCALLER
105 The caller will take care of the locking (possibly using
107 in case there is more than one thread), and the stdio routines
108 will not do locking until the state is reset to
109 .BR FSETLOCKING_INTERNAL .
112 Don't change the type of locking.
117 function flushes all line-buffered streams.
119 output to a terminal is forced out, say before reading keyboard input.)
123 function discards the contents of the stream's buffer.
125 For an explanation of the terms used in this section, see
133 Interface Attribute Value
139 T} Thread safety MT-Safe race:stream
147 T} Thread safety MT-Safe