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

272 lines
6.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of UNLOCKED_STDIO</TITLE>
</HEAD><BODY>
<H1>UNLOCKED_STDIO</H1>
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<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>
getc_unlocked, getchar_unlocked, putc_unlocked,
putchar_unlocked - nonlocking stdio functions
<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>int getc_unlocked(FILE *</B><I>stream</I><B>);</B>
<B>int getchar_unlocked(void);</B>
<B>int putc_unlocked(int </B><I>c</I><B>, FILE *</B><I>stream</I><B>);</B>
<B>int putchar_unlocked(int </B><I>c</I><B>);</B>
<B>void clearerr_unlocked(FILE *</B><I>stream</I><B>);</B>
<B>int feof_unlocked(FILE *</B><I>stream</I><B>);</B>
<B>int ferror_unlocked(FILE *</B><I>stream</I><B>);</B>
<B>int fileno_unlocked(FILE *</B><I>stream</I><B>);</B>
<B>int fflush_unlocked(FILE *</B><I>stream</I><B>);</B>
<B>int fgetc_unlocked(FILE *</B><I>stream</I><B>);</B>
<B>int fputc_unlocked(int </B><I>c</I><B>, FILE *</B><I>stream</I><B>);</B>
<B>size_t fread_unlocked(void *</B><I>ptr</I><B>, size_t </B><I>size</I><B>, size_t </B><I>n</I><B>,</B>
<B> FILE *</B><I>stream</I><B>);</B>
<B>size_t fwrite_unlocked(const void *</B><I>ptr</I><B>, size_t </B><I>size</I><B>, size_t </B><I>n</I><B>,</B>
<B> FILE *</B><I>stream</I><B>);</B>
<B>char *fgets_unlocked(char *</B><I>s</I><B>, int </B><I>n</I><B>, FILE *</B><I>stream</I><B>);</B>
<B>int fputs_unlocked(const char *</B><I>s</I><B>, FILE *</B><I>stream</I><B>);</B>
<B>#include &lt;<A HREF="file:///usr/include/wchar.h">wchar.h</A>&gt;</B>
<B>wint_t getwc_unlocked(FILE *</B><I>stream</I><B>);</B>
<B>wint_t getwchar_unlocked(void);</B>
<B>wint_t fgetwc_unlocked(FILE *</B><I>stream</I><B>);</B>
<B>wint_t fputwc_unlocked(wchar_t </B><I>wc</I><B>, FILE *</B><I>stream</I><B>);</B>
<B>wint_t putwc_unlocked(wchar_t </B><I>wc</I><B>, FILE *</B><I>stream</I><B>);</B>
<B>wint_t putwchar_unlocked(wchar_t </B><I>wc</I><B>);</B>
<B>wchar_t *fgetws_unlocked(wchar_t *</B><I>ws</I><B>, int </B><I>n</I><B>, FILE *</B><I>stream</I><B>);</B>
<B>int fputws_unlocked(const wchar_t *</B><I>ws</I><B>, FILE *</B><I>stream</I><B>);</B>
</PRE>
<P>
Feature Test Macro Requirements for glibc (see
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
<P>
<B>getc_unlocked</B>(),
<B>getchar_unlocked</B>(),
<B>putc_unlocked</B>(),
<B>putchar_unlocked</B>():
<DL COMPACT><DT id="1"><DD>
/* Since glibc 2.24: */ _POSIX_C_SOURCE&nbsp;&gt;=&nbsp;199309L
<BR>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Glibc&nbsp;versions&nbsp;&lt;=&nbsp;2.23:&nbsp;*/&nbsp;_POSIX_C_SOURCE
<BR>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Glibc&nbsp;versions&nbsp;&lt;=&nbsp;2.19:&nbsp;*/&nbsp;_SVID_SOURCE&nbsp;||&nbsp;_BSD_SOURCE
</DL>
<P>
<B>clearerr_unlocked</B>(),
<B>feof_unlocked</B>(),
<B>ferror_unlocked</B>(),
<B>fileno_unlocked</B>(),
<B>fflush_unlocked</B>(),
<B>fgetc_unlocked</B>(),
<B>fputc_unlocked</B>(),
<B>fread_unlocked</B>(),
<B>fwrite_unlocked</B>():
<DL COMPACT><DT id="2"><DD>
/* Glibc since 2.19: */ _DEFAULT_SOURCE
<BR>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Glibc&nbsp;versions&nbsp;&lt;=&nbsp;2.19:&nbsp;*/&nbsp;_SVID_SOURCE&nbsp;||&nbsp;_BSD_SOURCE
</DL>
<P>
<B>fgets_unlocked</B>(),
<B>fputs_unlocked</B>(),
<B>getwc_unlocked</B>(),
<B>getwchar_unlocked</B>(),
<B>fgetwc_unlocked</B>(),
<B>fputwc_unlocked</B>(),
<B>putwchar_unlocked</B>(),
<B>fgetws_unlocked</B>(),
<B>fputws_unlocked</B>():
<DL COMPACT><DT id="3"><DD>
_GNU_SOURCE
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Each of these functions has the same behavior as its counterpart
without the &quot;_unlocked&quot; suffix, except that they do not use locking
(they do not set locks themselves, and do not test for the presence
of locks set by others) and hence are thread-unsafe.
See
<B><A HREF="/cgi-bin/man/man2html?3+flockfile">flockfile</A></B>(3).
<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>getc_unlocked</B>(),
<B>putc_unlocked</B>(),
<B>clearerr_unlocked</B>(),
<B>fflush_unlocked</B>(),
<B>fgetc_unlocked</B>(),
<B>fputc_unlocked</B>(),
<B>fread_unlocked</B>(),
<B>fwrite_unlocked</B>(),
<B>fgets_unlocked</B>(),
<B>fputs_unlocked</B>(),
<B>getwc_unlocked</B>(),
<B>fgetwc_unlocked</B>(),
<B>fputwc_unlocked</B>(),
<B>putwc_unlocked</B>(),
<B>fgetws_unlocked</B>(),
<B>fputws_unlocked</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe race:stream<BR></TD></TR>
<TR VALIGN=top><TD>
<B>getchar_unlocked</B>(),
<B>getwchar_unlocked</B>()
</TD><TD>Thread safety</TD><TD>MT-Unsafe race:stdin<BR></TD></TR>
<TR VALIGN=top><TD>
<B>putchar_unlocked</B>(),
<B>putwchar_unlocked</B>()
</TD><TD>Thread safety</TD><TD>MT-Unsafe race:stdout<BR></TD></TR>
<TR VALIGN=top><TD>
<B>feof_unlocked</B>(),
<B>ferror_unlocked</B>(),
<B>fileno_unlocked</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
</TABLE>
<A NAME="lbAF">&nbsp;</A>
<H2>CONFORMING TO</H2>
The four functions
<B>getc_unlocked</B>(),
<B>getchar_unlocked</B>(),
<B>putc_unlocked</B>(),
<B>putchar_unlocked</B>()
are in POSIX.1-2001 and POSIX.1-2008.
<P>
The nonstandard
<B>*_unlocked</B>()
variants occur on a few UNIX systems, and are available in recent glibc.
They should probably not be used.
<A NAME="lbAG">&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+stdio">stdio</A></B>(3)
<A NAME="lbAH">&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">CONFORMING TO</A><DD>
<DT id="9"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="10"><A HREF="#lbAH">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:59 GMT, March 31, 2021
</BODY>
</HTML>