]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>. |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
c13182ef | 12 | .\" |
fea681da MK |
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. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da | 24 | .\" |
fe0fefbf | 25 | .TH STDIO_EXT 3 2015-03-02 "" "Linux Programmer's Manual" |
fea681da | 26 | .SH NAME |
35478399 | 27 | __fbufsize, __flbf, __fpending, __fpurge, __freadable, |
3d54a910 MK |
28 | __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \- |
29 | interfaces to stdio FILE structure | |
fea681da | 30 | .SH SYNOPSIS |
b4830340 | 31 | .nf |
fea681da | 32 | .B #include <stdio.h> |
fea681da | 33 | .B #include <stdio_ext.h> |
68e4db0a | 34 | .PP |
fea681da | 35 | .BI "size_t __fbufsize(FILE *" stream ); |
fea681da | 36 | .BI "size_t __fpending(FILE *" stream ); |
fea681da | 37 | .BI "int __flbf(FILE *" stream ); |
fea681da | 38 | .BI "int __freadable(FILE *" stream ); |
fea681da | 39 | .BI "int __fwritable(FILE *" stream ); |
fea681da | 40 | .BI "int __freading(FILE *" stream ); |
fea681da | 41 | .BI "int __fwriting(FILE *" stream ); |
fea681da | 42 | .BI "int __fsetlocking(FILE *" stream ", int " type ); |
0daa9e92 | 43 | .B "void _flushlbf(void);" |
fea681da | 44 | .BI "void __fpurge(FILE *" stream ); |
b4830340 | 45 | .fi |
fea681da MK |
46 | .SH DESCRIPTION |
47 | Solaris introduced routines to allow portable access to the | |
2f0af33b | 48 | internals of the |
097585ed | 49 | .I FILE |
2f0af33b | 50 | structure, and glibc also implemented these. |
dd3568a1 | 51 | .PP |
fea681da | 52 | The |
63aa9df0 | 53 | .BR __fbufsize () |
fea681da MK |
54 | function returns the size of the buffer currently used |
55 | by the given stream. | |
dd3568a1 | 56 | .PP |
fea681da | 57 | The |
63aa9df0 | 58 | .BR __fpending () |
fea681da MK |
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. | |
dd3568a1 | 63 | .PP |
fea681da | 64 | The |
63aa9df0 | 65 | .BR __flbf () |
c7094399 | 66 | function returns a nonzero value if the stream is line-buffered, |
fea681da | 67 | and zero otherwise. |
dd3568a1 | 68 | .PP |
fea681da | 69 | The |
63aa9df0 | 70 | .BR __freadable () |
c7094399 | 71 | function returns a nonzero value if the stream allows reading, |
fea681da | 72 | and zero otherwise. |
dd3568a1 | 73 | .PP |
fea681da | 74 | The |
63aa9df0 | 75 | .BR __fwritable () |
c7094399 | 76 | function returns a nonzero value if the stream allows writing, |
fea681da | 77 | and zero otherwise. |
dd3568a1 | 78 | .PP |
fea681da | 79 | The |
63aa9df0 | 80 | .BR __freading () |
c7094399 | 81 | function returns a nonzero value if the stream is read-only, or |
fea681da MK |
82 | if the last operation on the stream was a read operation, |
83 | and zero otherwise. | |
dd3568a1 | 84 | .PP |
fea681da | 85 | The |
63aa9df0 | 86 | .BR __fwriting () |
c7094399 | 87 | function returns a nonzero value if the stream is write-only (or |
fea681da MK |
88 | append-only), or if the last operation on the stream was a write |
89 | operation, and zero otherwise. | |
dd3568a1 | 90 | .PP |
fea681da | 91 | The |
63aa9df0 | 92 | .BR __fsetlocking () |
fea681da | 93 | function can be used to select the desired type of locking on the stream. |
c13182ef MK |
94 | It returns the current type. |
95 | The | |
fea681da | 96 | .I type |
c4bb193f | 97 | argument can take the following three values: |
fea681da MK |
98 | .TP |
99 | .B FSETLOCKING_INTERNAL | |
100 | Perform implicit locking around every operation on the given stream | |
c13182ef MK |
101 | (except for the *_unlocked ones). |
102 | This is the default. | |
fea681da MK |
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 | |
ec5a588f MK |
108 | will not do locking until the state is reset to |
109 | .BR FSETLOCKING_INTERNAL . | |
fea681da MK |
110 | .TP |
111 | .B FSETLOCKING_QUERY | |
c13182ef MK |
112 | Don't change the type of locking. |
113 | (Only return it.) | |
dd3568a1 | 114 | .PP |
fea681da | 115 | The |
63aa9df0 | 116 | .BR _flushlbf () |
c13182ef MK |
117 | function flushes all line-buffered streams. |
118 | (Presumably so that | |
fea681da | 119 | output to a terminal is forced out, say before reading keyboard input.) |
dd3568a1 | 120 | .PP |
fea681da | 121 | The |
63aa9df0 | 122 | .BR __fpurge () |
fea681da | 123 | function discards the contents of the stream's buffer. |
cbdd5ebe | 124 | .SH ATTRIBUTES |
3ba48039 PH |
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{ | |
cbdd5ebe PH |
133 | .BR __fbufsize (), |
134 | .BR __fpending (), | |
3ba48039 PH |
135 | .br |
136 | .BR __fpurge (), | |
cbdd5ebe | 137 | .BR __fsetlocking () |
b4a2fb21 | 138 | T} Thread safety MT-Safe race:stream |
3ba48039 | 139 | T{ |
cbdd5ebe PH |
140 | .BR __flbf (), |
141 | .BR __freadable (), | |
3ba48039 | 142 | .br |
cbdd5ebe PH |
143 | .BR __freading (), |
144 | .BR __fwritable (), | |
3ba48039 PH |
145 | .br |
146 | .BR __fwriting (), | |
cbdd5ebe | 147 | .BR _flushlbf () |
3ba48039 PH |
148 | T} Thread safety MT-Safe |
149 | .TE | |
47297adb | 150 | .SH SEE ALSO |
fea681da MK |
151 | .BR flockfile (3), |
152 | .BR fpurge (3) |