]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/unlocked_stdio.3
Many pages: Fix style issues reported by `make lint-groff`
[thirdparty/man-pages.git] / man3 / unlocked_stdio.3
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH UNLOCKED_STDIO 3 2021-03-22 GNU "Linux Programmer's Manual"
6 .SH NAME
7 getc_unlocked, getchar_unlocked, putc_unlocked,
8 putchar_unlocked \- nonlocking stdio functions
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <stdio.h>
15 .PP
16 .BI "int getc_unlocked(FILE *" stream );
17 .B "int getchar_unlocked(void);"
18 .BI "int putc_unlocked(int " c ", FILE *" stream );
19 .BI "int putchar_unlocked(int " c );
20 .PP
21 .BI "void clearerr_unlocked(FILE *" stream );
22 .BI "int feof_unlocked(FILE *" stream );
23 .BI "int ferror_unlocked(FILE *" stream );
24 .BI "int fileno_unlocked(FILE *" stream );
25 .BI "int fflush_unlocked(FILE *" stream );
26 .PP
27 .BI "int fgetc_unlocked(FILE *" stream );
28 .BI "int fputc_unlocked(int " c ", FILE *" stream );
29 .PP
30 .BI "size_t fread_unlocked(void *restrict " ptr ", size_t " size ", size_t " n ,
31 .BI " FILE *restrict " stream );
32 .BI "size_t fwrite_unlocked(const void *restrict " ptr ", size_t " size \
33 ", size_t " n ,
34 .BI " FILE *restrict " stream );
35 .PP
36 .BI "char *fgets_unlocked(char *restrict " s ", int " n \
37 ", FILE *restrict " stream );
38 .BI "int fputs_unlocked(const char *restrict " s ", FILE *restrict " stream );
39 .PP
40 .B #include <wchar.h>
41 .PP
42 .BI "wint_t getwc_unlocked(FILE *" stream );
43 .B "wint_t getwchar_unlocked(void);"
44 .BI "wint_t fgetwc_unlocked(FILE *" stream );
45 .PP
46 .BI "wint_t fputwc_unlocked(wchar_t " wc ", FILE *" stream );
47 .BI "wint_t putwc_unlocked(wchar_t " wc ", FILE *" stream );
48 .BI "wint_t putwchar_unlocked(wchar_t " wc );
49 .PP
50 .BI "wchar_t *fgetws_unlocked(wchar_t *restrict " ws ", int " n ,
51 .BI " FILE *restrict " stream );
52 .BI "int fputws_unlocked(const wchar_t *restrict " ws ,
53 .BI " FILE *restrict " stream );
54 .fi
55 .PP
56 .RS -4
57 Feature Test Macro Requirements for glibc (see
58 .BR feature_test_macros (7)):
59 .nh
60 .RE
61 .ad l
62 .PP
63 .BR getc_unlocked (),
64 .BR getchar_unlocked (),
65 .BR putc_unlocked (),
66 .BR putchar_unlocked ():
67 .nf
68 /* Since glibc 2.24: */ _POSIX_C_SOURCE >= 199309L
69 || /* Glibc <= 2.23: */ _POSIX_C_SOURCE
70 || /* Glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
71 .fi
72 .PP
73 .BR clearerr_unlocked (),
74 .BR feof_unlocked (),
75 .BR ferror_unlocked (),
76 .BR fileno_unlocked (),
77 .BR fflush_unlocked (),
78 .BR fgetc_unlocked (),
79 .BR fputc_unlocked (),
80 .BR fread_unlocked (),
81 .BR fwrite_unlocked ():
82 .nf
83 /* Glibc since 2.19: */ _DEFAULT_SOURCE
84 || /* Glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
85 .fi
86 .PP
87 .BR fgets_unlocked (),
88 .BR fputs_unlocked (),
89 .BR getwc_unlocked (),
90 .BR getwchar_unlocked (),
91 .BR fgetwc_unlocked (),
92 .BR fputwc_unlocked (),
93 .BR putwchar_unlocked (),
94 .BR fgetws_unlocked (),
95 .BR fputws_unlocked ():
96 .nf
97 _GNU_SOURCE
98 .fi
99 .hy
100 .ad
101 .SH DESCRIPTION
102 Each of these functions has the same behavior as its counterpart
103 without the "_unlocked" suffix, except that they do not use locking
104 (they do not set locks themselves, and do not test for the presence
105 of locks set by others) and hence are thread-unsafe.
106 See
107 .BR flockfile (3).
108 .SH ATTRIBUTES
109 For an explanation of the terms used in this section, see
110 .BR attributes (7).
111 .ad l
112 .nh
113 .TS
114 allbox;
115 lb lb lbx
116 l l l.
117 Interface Attribute Value
118 T{
119 .BR getc_unlocked (),
120 .BR putc_unlocked (),
121 .BR clearerr_unlocked (),
122 .BR fflush_unlocked (),
123 .BR fgetc_unlocked (),
124 .BR fputc_unlocked (),
125 .BR fread_unlocked (),
126 .BR fwrite_unlocked (),
127 .BR fgets_unlocked (),
128 .BR fputs_unlocked (),
129 .BR getwc_unlocked (),
130 .BR fgetwc_unlocked (),
131 .BR fputwc_unlocked (),
132 .BR putwc_unlocked (),
133 .BR fgetws_unlocked (),
134 .BR fputws_unlocked ()
135 T} Thread safety T{
136 MT-Safe race:stream
137 T}
138 T{
139 .BR getchar_unlocked (),
140 .BR getwchar_unlocked ()
141 T} Thread safety T{
142 MT-Unsafe race:stdin
143 T}
144 T{
145 .BR putchar_unlocked (),
146 .BR putwchar_unlocked ()
147 T} Thread safety T{
148 MT-Unsafe race:stdout
149 T}
150 T{
151 .BR feof_unlocked (),
152 .BR ferror_unlocked (),
153 .BR fileno_unlocked ()
154 T} Thread safety MT-Safe
155 .TE
156 .hy
157 .ad
158 .sp 1
159 .SH CONFORMING TO
160 The four functions
161 .BR getc_unlocked (),
162 .BR getchar_unlocked (),
163 .BR putc_unlocked (),
164 .BR putchar_unlocked ()
165 are in POSIX.1-2001 and POSIX.1-2008.
166 .PP
167 The nonstandard
168 .BR *_unlocked ()
169 variants occur on a few UNIX systems, and are available in recent glibc.
170 .\" E.g., in HP-UX 10.0. In HP-UX 10.30 they are called obsolescent, and
171 .\" moved to a compatibility library.
172 .\" Available in HP-UX 10.0: clearerr_unlocked, fclose_unlocked,
173 .\" feof_unlocked, ferror_unlocked, fflush_unlocked, fgets_unlocked,
174 .\" fgetwc_unlocked, fgetws_unlocked, fileno_unlocked, fputs_unlocked,
175 .\" fputwc_unlocked, fputws_unlocked, fread_unlocked, fseek_unlocked,
176 .\" ftell_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked,
177 .\" getw_unlocked, getwc_unlocked, getwchar_unlocked, putc_unlocked,
178 .\" putchar_unlocked, puts_unlocked, putws_unlocked, putw_unlocked,
179 .\" putwc_unlocked, putwchar_unlocked, rewind_unlocked, setvbuf_unlocked,
180 .\" ungetc_unlocked, ungetwc_unlocked.
181 They should probably not be used.
182 .SH SEE ALSO
183 .BR flockfile (3),
184 .BR stdio (3)