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 2013-06-21 "" "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 );
37 .BI "size_t __fpending(FILE *" stream );
39 .BI "int __flbf(FILE *" stream );
41 .BI "int __freadable(FILE *" stream );
43 .BI "int __fwritable(FILE *" stream );
45 .BI "int __freading(FILE *" stream );
47 .BI "int __fwriting(FILE *" stream );
49 .BI "int __fsetlocking(FILE *" stream ", int " type );
51 .B "void _flushlbf(void);"
53 .BI "void __fpurge(FILE *" stream );
55 Solaris introduced routines to allow portable access to the
58 structure, and glibc also implemented these.
62 function returns the size of the buffer currently used
67 function returns the number of bytes in the output buffer.
68 For wide-oriented streams the unit is wide characters.
69 This function is undefined on buffers in reading mode,
74 function returns a nonzero value if the stream is line-buffered,
79 function returns a nonzero value if the stream allows reading,
84 function returns a nonzero value if the stream allows writing,
89 function returns a nonzero value if the stream is read-only, or
90 if the last operation on the stream was a read operation,
95 function returns a nonzero value if the stream is write-only (or
96 append-only), or if the last operation on the stream was a write
97 operation, and zero otherwise.
101 function can be used to select the desired type of locking on the stream.
102 It returns the current type.
105 argument can take the following three values:
107 .B FSETLOCKING_INTERNAL
108 Perform implicit locking around every operation on the given stream
109 (except for the *_unlocked ones).
112 .B FSETLOCKING_BYCALLER
113 The caller will take care of the locking (possibly using
115 in case there is more than one thread), and the stdio routines
116 will not do locking until the state is reset to
117 .BR FSETLOCKING_INTERNAL .
120 Don't change the type of locking.
125 function flushes all line-buffered streams.
127 output to a terminal is forced out, say before reading keyboard input.)
131 function discards the contents of the stream's buffer.
133 .SS Multithreading (see pthreads(7))
140 functions do not lock the stream, so they are not thread-safe.
150 functions are thread-safe.