]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/stdio_ext.3
ffix
[thirdparty/man-pages.git] / man3 / stdio_ext.3
CommitLineData
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
52Solaris introduced routines to allow portable access to the
2f0af33b
MK
53internals of the
54.B FILE
55structure, and glibc also implemented these.
fea681da
MK
56.LP
57The
63aa9df0 58.BR __fbufsize ()
fea681da
MK
59function returns the size of the buffer currently used
60by the given stream.
61.LP
62The
63aa9df0 63.BR __fpending ()
fea681da
MK
64function returns the number of bytes in the output buffer.
65For wide-oriented streams the unit is wide characters.
66This function is undefined on buffers in reading mode,
67or opened read-only.
68.LP
69The
63aa9df0 70.BR __flbf ()
f59a3f19 71function returns a non-zero value if the stream is line-buffered,
fea681da
MK
72and zero otherwise.
73.LP
74The
63aa9df0 75.BR __freadable ()
f59a3f19 76function returns a non-zero value if the stream allows reading,
fea681da
MK
77and zero otherwise.
78.LP
79The
63aa9df0 80.BR __fwritable ()
f59a3f19 81function returns a non-zero value if the stream allows writing,
fea681da
MK
82and zero otherwise.
83.LP
84The
63aa9df0 85.BR __freading ()
f59a3f19 86function returns a non-zero value if the stream is read-only, or
fea681da
MK
87if the last operation on the stream was a read operation,
88and zero otherwise.
89.LP
90The
63aa9df0 91.BR __fwriting ()
f59a3f19 92function returns a non-zero value if the stream is write-only (or
fea681da
MK
93append-only), or if the last operation on the stream was a write
94operation, and zero otherwise.
95.LP
96The
63aa9df0 97.BR __fsetlocking ()
fea681da 98function can be used to select the desired type of locking on the stream.
c13182ef
MK
99It returns the current type.
100The
fea681da
MK
101.I type
102parameter can take the following three values:
103.TP
104.B FSETLOCKING_INTERNAL
105Perform implicit locking around every operation on the given stream
c13182ef
MK
106(except for the *_unlocked ones).
107This is the default.
fea681da
MK
108.TP
109.B FSETLOCKING_BYCALLER
110The caller will take care of the locking (possibly using
111.BR flockfile (3)
112in case there is more than one thread), and the stdio routines
113will not do locking until the state is reset to FSETLOCKING_INTERNAL.
114.TP
115.B FSETLOCKING_QUERY
c13182ef
MK
116Don't change the type of locking.
117(Only return it.)
fea681da
MK
118.LP
119The
63aa9df0 120.BR _flushlbf ()
c13182ef
MK
121function flushes all line-buffered streams.
122(Presumably so that
fea681da
MK
123output to a terminal is forced out, say before reading keyboard input.)
124.LP
125The
63aa9df0 126.BR __fpurge ()
fea681da
MK
127function discards the contents of the stream's buffer.
128.SH "SEE ALSO"
129.BR flockfile (3),
130.BR fpurge (3)