man-pages/man3/stdio_ext.3.html
2021-03-31 01:06:50 +01:00

221 lines
5.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of STDIO_EXT</TITLE>
</HEAD><BODY>
<H1>STDIO_EXT</H1>
Section: Linux Programmer's Manual (3)<BR>Updated: 2015-03-02<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
__fbufsize, __flbf, __fpending, __fpurge, __freadable,
__freading, __fsetlocking, __fwritable, __fwriting, _flushlbf -
interfaces to stdio FILE structure
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/stdio.h">stdio.h</A>&gt;</B>
<B>#include &lt;<A HREF="file:///usr/include/stdio_ext.h">stdio_ext.h</A>&gt;</B>
<B>size_t __fbufsize(FILE *</B><I>stream</I><B>);</B>
<B>size_t __fpending(FILE *</B><I>stream</I><B>);</B>
<B>int __flbf(FILE *</B><I>stream</I><B>);</B>
<B>int __freadable(FILE *</B><I>stream</I><B>);</B>
<B>int __fwritable(FILE *</B><I>stream</I><B>);</B>
<B>int __freading(FILE *</B><I>stream</I><B>);</B>
<B>int __fwriting(FILE *</B><I>stream</I><B>);</B>
<B>int __fsetlocking(FILE *</B><I>stream</I><B>, int </B><I>type</I><B>);</B>
<B>void _flushlbf(void);</B>
<B>void __fpurge(FILE *</B><I>stream</I><B>);</B>
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Solaris introduced routines to allow portable access to the
internals of the
<I>FILE</I>
structure, and glibc also implemented these.
<P>
The
<B>__fbufsize</B>()
function returns the size of the buffer currently used
by the given stream.
<P>
The
<B>__fpending</B>()
function returns the number of bytes in the output buffer.
For wide-oriented streams the unit is wide characters.
This function is undefined on buffers in reading mode,
or opened read-only.
<P>
The
<B>__flbf</B>()
function returns a nonzero value if the stream is line-buffered,
and zero otherwise.
<P>
The
<B>__freadable</B>()
function returns a nonzero value if the stream allows reading,
and zero otherwise.
<P>
The
<B>__fwritable</B>()
function returns a nonzero value if the stream allows writing,
and zero otherwise.
<P>
The
<B>__freading</B>()
function returns a nonzero value if the stream is read-only, or
if the last operation on the stream was a read operation,
and zero otherwise.
<P>
The
<B>__fwriting</B>()
function returns a nonzero value if the stream is write-only (or
append-only), or if the last operation on the stream was a write
operation, and zero otherwise.
<P>
The
<B>__fsetlocking</B>()
function can be used to select the desired type of locking on the stream.
It returns the current type.
The
<I>type</I>
argument can take the following three values:
<DL COMPACT>
<DT id="1"><B>FSETLOCKING_INTERNAL</B>
<DD>
Perform implicit locking around every operation on the given stream
(except for the *_unlocked ones).
This is the default.
<DT id="2"><B>FSETLOCKING_BYCALLER</B>
<DD>
The caller will take care of the locking (possibly using
<B><A HREF="/cgi-bin/man/man2html?3+flockfile">flockfile</A></B>(3)
in case there is more than one thread), and the stdio routines
will not do locking until the state is reset to
<B>FSETLOCKING_INTERNAL</B>.
<DT id="3"><B>FSETLOCKING_QUERY</B>
<DD>
Don't change the type of locking.
(Only return it.)
</DL>
<P>
The
<B>_flushlbf</B>()
function flushes all line-buffered streams.
(Presumably so that
output to a terminal is forced out, say before reading keyboard input.)
<P>
The
<B>__fpurge</B>()
function discards the contents of the stream's buffer.
<A NAME="lbAE">&nbsp;</A>
<H2>ATTRIBUTES</H2>
For an explanation of the terms used in this section, see
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
<TABLE BORDER>
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
<TR VALIGN=top><TD>
<B>__fbufsize</B>(),
<B>__fpending</B>(),
<BR>
<B>__fpurge</B>(),
<B>__fsetlocking</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe race:stream<BR></TD></TR>
<TR VALIGN=top><TD>
<B>__flbf</B>(),
<B>__freadable</B>(),
<BR>
<B>__freading</B>(),
<B>__fwritable</B>(),
<BR>
<B>__fwriting</B>(),
<B>_flushlbf</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
</TABLE>
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+flockfile">flockfile</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+fpurge">fpurge</A></B>(3)
<A NAME="lbAG">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="7"><A HREF="#lbAE">ATTRIBUTES</A><DD>
<DT id="8"><A HREF="#lbAF">SEE ALSO</A><DD>
<DT id="9"><A HREF="#lbAG">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:57 GMT, March 31, 2021
</BODY>
</HTML>