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