1stdio_ext(3)               Library Functions 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

LIBRARY

11       Standard C library (libc, -lc)
12

SYNOPSIS

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

DESCRIPTION

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

ATTRIBUTES

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

SEE ALSO

95       flockfile(3), fpurge(3)
96
97
98
99Linux man-pages 6.04              2023-01-07                      stdio_ext(3)
Impressum