]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/stdio_ext.3
rename.2: SEE ALSO: add rename(1)
[thirdparty/man-pages.git] / man3 / stdio_ext.3
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
2 .\"
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.
7 .\"
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.
12 .\"
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
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH STDIO_EXT 3 2015-03-02 "" "Linux Programmer's Manual"
26 .SH NAME
27 __fbufsize, __flbf, __fpending, __fpurge, __freadable,
28 __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \-
29 interfaces to stdio FILE structure
30 .SH SYNOPSIS
31 .nf
32 .B #include <stdio.h>
33 .B #include <stdio_ext.h>
34 .PP
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 );
45 .fi
46 .SH DESCRIPTION
47 Solaris introduced routines to allow portable access to the
48 internals of the
49 .I FILE
50 structure, and glibc also implemented these.
51 .PP
52 The
53 .BR __fbufsize ()
54 function returns the size of the buffer currently used
55 by the given stream.
56 .PP
57 The
58 .BR __fpending ()
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,
62 or opened read-only.
63 .PP
64 The
65 .BR __flbf ()
66 function returns a nonzero value if the stream is line-buffered,
67 and zero otherwise.
68 .PP
69 The
70 .BR __freadable ()
71 function returns a nonzero value if the stream allows reading,
72 and zero otherwise.
73 .PP
74 The
75 .BR __fwritable ()
76 function returns a nonzero value if the stream allows writing,
77 and zero otherwise.
78 .PP
79 The
80 .BR __freading ()
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,
83 and zero otherwise.
84 .PP
85 The
86 .BR __fwriting ()
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.
90 .PP
91 The
92 .BR __fsetlocking ()
93 function can be used to select the desired type of locking on the stream.
94 It returns the current type.
95 The
96 .I type
97 argument can take the following three values:
98 .TP
99 .B FSETLOCKING_INTERNAL
100 Perform implicit locking around every operation on the given stream
101 (except for the *_unlocked ones).
102 This is the default.
103 .TP
104 .B FSETLOCKING_BYCALLER
105 The caller will take care of the locking (possibly using
106 .BR flockfile (3)
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 .
110 .TP
111 .B FSETLOCKING_QUERY
112 Don't change the type of locking.
113 (Only return it.)
114 .PP
115 The
116 .BR _flushlbf ()
117 function flushes all line-buffered streams.
118 (Presumably so that
119 output to a terminal is forced out, say before reading keyboard input.)
120 .PP
121 The
122 .BR __fpurge ()
123 function discards the contents of the stream's buffer.
124 .SH ATTRIBUTES
125 For an explanation of the terms used in this section, see
126 .BR attributes (7).
127 .TS
128 allbox;
129 lbw28 lb lb
130 l l l.
131 Interface Attribute Value
132 T{
133 .BR __fbufsize (),
134 .BR __fpending (),
135 .br
136 .BR __fpurge (),
137 .BR __fsetlocking ()
138 T} Thread safety MT-Safe race:stream
139 T{
140 .BR __flbf (),
141 .BR __freadable (),
142 .br
143 .BR __freading (),
144 .BR __fwritable (),
145 .br
146 .BR __fwriting (),
147 .BR _flushlbf ()
148 T} Thread safety MT-Safe
149 .TE
150 .SH SEE ALSO
151 .BR flockfile (3),
152 .BR fpurge (3)