]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>. |
2 | .\" | |
3 | .\" Permission is granted to make and distribute verbatim copies of this | |
4 | .\" manual provided the copyright notice and this permission notice are | |
5 | .\" preserved on all copies. | |
6 | .\" | |
7 | .\" Permission is granted to copy and distribute modified versions of this | |
8 | .\" manual under the conditions for verbatim copying, provided that the | |
9 | .\" entire resulting derived work is distributed under the terms of a | |
10 | .\" permission notice identical to this one. | |
c13182ef | 11 | .\" |
fea681da MK |
12 | .\" Since the Linux kernel and libraries are constantly changing, this |
13 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
14 | .\" responsibility for errors or omissions, or for damages resulting from | |
15 | .\" the use of the information contained herein. The author(s) may not | |
16 | .\" have taken the same level of care in the production of this manual, | |
17 | .\" which is licensed free of charge, as they might when working | |
18 | .\" professionally. | |
c13182ef | 19 | .\" |
fea681da MK |
20 | .\" Formatted or processed versions of this manual, if unaccompanied by |
21 | .\" the source, must acknowledge the copyright and authors of this work. | |
22 | .\" | |
23 | .TH STDIO_EXT 3 2001-12-16 "" "Linux Programmer's Manual" | |
24 | .SH NAME | |
35478399 MK |
25 | __fbufsize, __flbf, __fpending, __fpurge, __freadable, |
26 | __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \- interfaces to stdio FILE structure | |
fea681da MK |
27 | .SH SYNOPSIS |
28 | .B #include <stdio.h> | |
29 | .br | |
30 | .B #include <stdio_ext.h> | |
31 | .sp | |
32 | .BI "size_t __fbufsize(FILE *" stream ); | |
33 | .br | |
34 | .BI "size_t __fpending(FILE *" stream ); | |
35 | .br | |
36 | .BI "int __flbf(FILE *" stream ); | |
37 | .br | |
38 | .BI "int __freadable(FILE *" stream ); | |
39 | .br | |
40 | .BI "int __fwritable(FILE *" stream ); | |
41 | .br | |
42 | .BI "int __freading(FILE *" stream ); | |
43 | .br | |
44 | .BI "int __fwriting(FILE *" stream ); | |
45 | .br | |
46 | .BI "int __fsetlocking(FILE *" stream ", int " type ); | |
47 | .br | |
c10859eb | 48 | .BI "void _flushlbf(void);" |
fea681da MK |
49 | .br |
50 | .BI "void __fpurge(FILE *" stream ); | |
51 | .SH DESCRIPTION | |
52 | Solaris introduced routines to allow portable access to the | |
2f0af33b MK |
53 | internals of the |
54 | .B FILE | |
55 | structure, and glibc also implemented these. | |
fea681da MK |
56 | .LP |
57 | The | |
63aa9df0 | 58 | .BR __fbufsize () |
fea681da MK |
59 | function returns the size of the buffer currently used |
60 | by the given stream. | |
61 | .LP | |
62 | The | |
63aa9df0 | 63 | .BR __fpending () |
fea681da MK |
64 | function returns the number of bytes in the output buffer. |
65 | For wide-oriented streams the unit is wide characters. | |
66 | This function is undefined on buffers in reading mode, | |
67 | or opened read-only. | |
68 | .LP | |
69 | The | |
63aa9df0 | 70 | .BR __flbf () |
f59a3f19 | 71 | function returns a non-zero value if the stream is line-buffered, |
fea681da MK |
72 | and zero otherwise. |
73 | .LP | |
74 | The | |
63aa9df0 | 75 | .BR __freadable () |
f59a3f19 | 76 | function returns a non-zero value if the stream allows reading, |
fea681da MK |
77 | and zero otherwise. |
78 | .LP | |
79 | The | |
63aa9df0 | 80 | .BR __fwritable () |
f59a3f19 | 81 | function returns a non-zero value if the stream allows writing, |
fea681da MK |
82 | and zero otherwise. |
83 | .LP | |
84 | The | |
63aa9df0 | 85 | .BR __freading () |
f59a3f19 | 86 | function returns a non-zero value if the stream is read-only, or |
fea681da MK |
87 | if the last operation on the stream was a read operation, |
88 | and zero otherwise. | |
89 | .LP | |
90 | The | |
63aa9df0 | 91 | .BR __fwriting () |
f59a3f19 | 92 | function returns a non-zero value if the stream is write-only (or |
fea681da MK |
93 | append-only), or if the last operation on the stream was a write |
94 | operation, and zero otherwise. | |
95 | .LP | |
96 | The | |
63aa9df0 | 97 | .BR __fsetlocking () |
fea681da | 98 | function can be used to select the desired type of locking on the stream. |
c13182ef MK |
99 | It returns the current type. |
100 | The | |
fea681da MK |
101 | .I type |
102 | parameter can take the following three values: | |
103 | .TP | |
104 | .B FSETLOCKING_INTERNAL | |
105 | Perform implicit locking around every operation on the given stream | |
c13182ef MK |
106 | (except for the *_unlocked ones). |
107 | This is the default. | |
fea681da MK |
108 | .TP |
109 | .B FSETLOCKING_BYCALLER | |
110 | The caller will take care of the locking (possibly using | |
111 | .BR flockfile (3) | |
112 | in case there is more than one thread), and the stdio routines | |
113 | will not do locking until the state is reset to FSETLOCKING_INTERNAL. | |
114 | .TP | |
115 | .B FSETLOCKING_QUERY | |
c13182ef MK |
116 | Don't change the type of locking. |
117 | (Only return it.) | |
fea681da MK |
118 | .LP |
119 | The | |
63aa9df0 | 120 | .BR _flushlbf () |
c13182ef MK |
121 | function flushes all line-buffered streams. |
122 | (Presumably so that | |
fea681da MK |
123 | output to a terminal is forced out, say before reading keyboard input.) |
124 | .LP | |
125 | The | |
63aa9df0 | 126 | .BR __fpurge () |
fea681da MK |
127 | function discards the contents of the stream's buffer. |
128 | .SH "SEE ALSO" | |
129 | .BR flockfile (3), | |
130 | .BR fpurge (3) |