README: Update links
[man-pages.git] / man3 / stdio_ext.3
blob815135dd10cbabe4d0a62ff6abdc91772c98b9db
1 '\" t
2 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH stdio_ext 3 (date) "Linux man-pages (unreleased)"
7 .SH NAME
8 __fbufsize, __flbf, __fpending, __fpurge, __freadable,
9 __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \-
10 interfaces to stdio FILE structure
11 .SH LIBRARY
12 Standard C library
13 .RI ( libc ", " \-lc )
14 .SH SYNOPSIS
15 .nf
16 .B #include <stdio.h>
17 .B #include <stdio_ext.h>
19 .BI "size_t __fbufsize(FILE *" stream );
20 .BI "size_t __fpending(FILE *" stream );
21 .BI "int __flbf(FILE *" stream );
22 .BI "int __freadable(FILE *" stream );
23 .BI "int __fwritable(FILE *" stream );
24 .BI "int __freading(FILE *" stream );
25 .BI "int __fwriting(FILE *" stream );
26 .BI "int __fsetlocking(FILE *" stream ", int " type );
27 .B "void _flushlbf(void);"
28 .BI "void __fpurge(FILE *" stream );
29 .fi
30 .SH DESCRIPTION
31 Solaris introduced routines to allow portable access to the
32 internals of the
33 .I FILE
34 structure, and glibc also implemented these.
36 The
37 .BR __fbufsize ()
38 function returns the size of the buffer currently used
39 by the given stream.
41 The
42 .BR __fpending ()
43 function returns the number of bytes in the output buffer.
44 For wide-oriented streams the unit is wide characters.
45 This function is undefined on buffers in reading mode,
46 or opened read-only.
48 The
49 .BR __flbf ()
50 function returns a nonzero value if the stream is line-buffered,
51 and zero otherwise.
53 The
54 .BR __freadable ()
55 function returns a nonzero value if the stream allows reading,
56 and zero otherwise.
58 The
59 .BR __fwritable ()
60 function returns a nonzero value if the stream allows writing,
61 and zero otherwise.
63 The
64 .BR __freading ()
65 function returns a nonzero value if the stream is read-only, or
66 if the last operation on the stream was a read operation,
67 and zero otherwise.
69 The
70 .BR __fwriting ()
71 function returns a nonzero value if the stream is write-only (or
72 append-only), or if the last operation on the stream was a write
73 operation, and zero otherwise.
75 The
76 .BR __fsetlocking ()
77 function can be used to select the desired type of locking on the stream.
78 It returns the current type.
79 The
80 .I type
81 argument can take the following three values:
82 .TP
83 .B FSETLOCKING_INTERNAL
84 Perform implicit locking around every operation on the given stream
85 (except for the *_unlocked ones).
86 This is the default.
87 .TP
88 .B FSETLOCKING_BYCALLER
89 The caller will take care of the locking (possibly using
90 .BR flockfile (3)
91 in case there is more than one thread), and the stdio routines
92 will not do locking until the state is reset to
93 .BR FSETLOCKING_INTERNAL .
94 .TP
95 .B FSETLOCKING_QUERY
96 Don't change the type of locking.
97 (Only return it.)
99 The
100 .BR _flushlbf ()
101 function flushes all line-buffered streams.
102 (Presumably so that
103 output to a terminal is forced out, say before reading keyboard input.)
106 .BR __fpurge ()
107 function discards the contents of the stream's buffer.
108 .SH ATTRIBUTES
109 For an explanation of the terms used in this section, see
110 .BR attributes (7).
112 allbox;
113 lbx lb lb
114 l l l.
115 Interface       Attribute       Value
119 .BR __fbufsize (),
120 .BR __fpending (),
121 .BR __fpurge (),
122 .BR __fsetlocking ()
123 T}      Thread safety   MT-Safe race:stream
127 .BR __flbf (),
128 .BR __freadable (),
129 .BR __freading (),
130 .BR __fwritable (),
131 .BR __fwriting (),
132 .BR _flushlbf ()
133 T}      Thread safety   MT-Safe
135 .SH SEE ALSO
136 .BR flockfile (3),
137 .BR fpurge (3)