1STDIO_EXT(3)               Linux Programmer's Manual              STDIO_EXT(3)
2
3
4

NAME

6       __fbufsize,  __flbf,  __fpending,  __fpurge,  __freadable,  __freading,
7       __fsetlocking, __fwritable, __fwriting, _flushlbf - interfaces to stdio
8       FILE structure
9

SYNOPSIS

11       #include <stdio.h>
12       #include <stdio_ext.h>
13
14       size_t __fbufsize(FILE *stream);
15       size_t __fpending(FILE *stream);
16       int __flbf(FILE *stream);
17       int __freadable(FILE *stream);
18       int __fwritable(FILE *stream);
19       int __freading(FILE *stream);
20       int __fwriting(FILE *stream);
21       int __fsetlocking(FILE *stream, int type);
22       void _flushlbf(void);
23       void __fpurge(FILE *stream);
24

DESCRIPTION

26       Solaris  introduced  routines to allow portable access to the internals
27       of the FILE structure, and glibc also implemented these.
28
29       The __fbufsize() function returns the size of the buffer currently used
30       by the given stream.
31
32       The  __fpending()  function  returns  the number of bytes in the output
33       buffer.  For wide-oriented streams the unit is wide  characters.   This
34       function is undefined on buffers in reading mode, or opened read-only.
35
36       The  __flbf()  function  returns a nonzero value if the stream is line-
37       buffered, and zero otherwise.
38
39       The __freadable() function returns a nonzero value if the stream allows
40       reading, and zero otherwise.
41
42       The __fwritable() function returns a nonzero value if the stream allows
43       writing, and zero otherwise.
44
45       The __freading() function returns a nonzero  value  if  the  stream  is
46       read-only, or if the last operation on the stream was a read operation,
47       and zero otherwise.
48
49       The __fwriting() function returns a nonzero  value  if  the  stream  is
50       write-only (or append-only), or if the last operation on the stream was
51       a write operation, and zero otherwise.
52
53       The __fsetlocking() function can be used to select the desired type  of
54       locking on the stream.  It returns the current type.  The type argument
55       can take the following three values:
56
57       FSETLOCKING_INTERNAL
58              Perform implicit locking around every  operation  on  the  given
59              stream (except for the *_unlocked ones).  This is the default.
60
61       FSETLOCKING_BYCALLER
62              The  caller will take care of the locking (possibly using flock‐
63              file(3) in case there is more than one thread),  and  the  stdio
64              routines  will  not do locking until the state is reset to FSET‐
65              LOCKING_INTERNAL.
66
67       FSETLOCKING_QUERY
68              Don't change the type of locking.  (Only return it.)
69
70       The _flushlbf() function flushes all line-buffered  streams.   (Presum‐
71       ably  so  that  output  to a terminal is forced out, say before reading
72       keyboard input.)
73
74       The __fpurge() function discards the contents of the stream's buffer.
75

ATTRIBUTES

77       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
78       tributes(7).
79
80       ┌─────────────────────────────┬───────────────┬─────────────────────┐
81Interface                    Attribute     Value               
82       ├─────────────────────────────┼───────────────┼─────────────────────┤
83__fbufsize(), __fpending(),  │ Thread safety │ MT-Safe race:stream │
84__fpurge(), __fsetlocking()  │               │                     │
85       ├─────────────────────────────┼───────────────┼─────────────────────┤
86__flbf(), __freadable(),     │ Thread safety │ MT-Safe             │
87__freading(), __fwritable(), │               │                     │
88__fwriting(), _flushlbf()    │               │                     │
89       └─────────────────────────────┴───────────────┴─────────────────────┘

SEE ALSO

91       flockfile(3), fpurge(3)
92

COLOPHON

94       This  page  is  part of release 5.10 of the Linux man-pages project.  A
95       description of the project, information about reporting bugs,  and  the
96       latest     version     of     this    page,    can    be    found    at
97       https://www.kernel.org/doc/man-pages/.
98
99
100
101                                  2015-03-02                      STDIO_EXT(3)
Impressum