]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>. |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da | 24 | .\" |
4b8c67d9 | 25 | .TH UNLOCKED_STDIO 3 2017-09-15 "" "Linux Programmer's Manual" |
fea681da | 26 | .SH NAME |
69b29c78 | 27 | getc_unlocked, getchar_unlocked, putc_unlocked, |
24b74457 | 28 | putchar_unlocked \- nonlocking stdio functions |
fea681da MK |
29 | .SH SYNOPSIS |
30 | .nf | |
31 | .B #include <stdio.h> | |
68e4db0a | 32 | .PP |
fea681da | 33 | .BI "int getc_unlocked(FILE *" stream ); |
0daa9e92 | 34 | .B "int getchar_unlocked(void);" |
fea681da MK |
35 | .BI "int putc_unlocked(int " c ", FILE *" stream ); |
36 | .BI "int putchar_unlocked(int " c ); | |
68e4db0a | 37 | .PP |
fea681da MK |
38 | .BI "void clearerr_unlocked(FILE *" stream ); |
39 | .BI "int feof_unlocked(FILE *" stream ); | |
40 | .BI "int ferror_unlocked(FILE *" stream ); | |
41 | .BI "int fileno_unlocked(FILE *" stream ); | |
42 | .BI "int fflush_unlocked(FILE *" stream ); | |
43 | .BI "int fgetc_unlocked(FILE *" stream ); | |
44 | .BI "int fputc_unlocked(int " c ", FILE *" stream ); | |
45 | .BI "size_t fread_unlocked(void *" ptr ", size_t " size ", size_t " n , | |
62218dc0 | 46 | .BI " FILE *" stream ); |
fea681da | 47 | .BI "size_t fwrite_unlocked(const void *" ptr ", size_t " size ", size_t " n , |
62218dc0 | 48 | .BI " FILE *" stream ); |
68e4db0a | 49 | .PP |
fea681da MK |
50 | .BI "char *fgets_unlocked(char *" s ", int " n ", FILE *" stream ); |
51 | .BI "int fputs_unlocked(const char *" s ", FILE *" stream ); | |
f90f031e | 52 | |
fea681da | 53 | .B #include <wchar.h> |
68e4db0a | 54 | .PP |
fea681da | 55 | .BI "wint_t getwc_unlocked(FILE *" stream ); |
0daa9e92 | 56 | .B "wint_t getwchar_unlocked(void);" |
fea681da MK |
57 | .BI "wint_t fgetwc_unlocked(FILE *" stream ); |
58 | .BI "wint_t fputwc_unlocked(wchar_t " wc ", FILE *" stream ); | |
59 | .BI "wint_t putwc_unlocked(wchar_t " wc ", FILE *" stream ); | |
60 | .BI "wint_t putwchar_unlocked(wchar_t " wc ); | |
61 | .BI "wchar_t *fgetws_unlocked(wchar_t *" ws ", int " n ", FILE *" stream ); | |
62 | .BI "int fputws_unlocked(const wchar_t *" ws ", FILE *" stream ); | |
63 | .fi | |
68e4db0a | 64 | .PP |
0f200f07 MK |
65 | .in -4n |
66 | Feature Test Macro Requirements for glibc (see | |
67 | .BR feature_test_macros (7)): | |
68 | .ad l | |
69 | .in | |
68e4db0a | 70 | .PP |
0f200f07 MK |
71 | .BR getc_unlocked (), |
72 | .BR getchar_unlocked (), | |
73 | .BR putc_unlocked (), | |
74 | .BR putchar_unlocked (): | |
f83d1cca | 75 | .RS 4 |
f83b1bbc MK |
76 | /* Since glibc 2.24: */ _POSIX_C_SOURCE\ >=\ 199309L |
77 | || /* Glibc versions <= 2.23: */ _POSIX_C_SOURCE | |
d59161f9 | 78 | || /* Glibc versions <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE |
f83d1cca | 79 | .RE |
68e4db0a | 80 | .PP |
0f200f07 MK |
81 | .BR clearerr_unlocked (), |
82 | .BR feof_unlocked (), | |
83 | .BR ferror_unlocked (), | |
84 | .BR fileno_unlocked (), | |
85 | .BR fflush_unlocked (), | |
86 | .BR fgetc_unlocked (), | |
87 | .BR fputc_unlocked (), | |
88 | .BR fread_unlocked (), | |
89 | .BR fwrite_unlocked (): | |
f83d1cca | 90 | .RS 4 |
d59161f9 MK |
91 | /* Glibc since 2.19: */ _DEFAULT_SOURCE |
92 | || /* Glibc versions <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE | |
f83d1cca | 93 | .RE |
68e4db0a | 94 | .PP |
0f200f07 MK |
95 | .BR fgets_unlocked (), |
96 | .BR fputs_unlocked (), | |
97 | .BR getwc_unlocked (), | |
98 | .BR getwchar_unlocked (), | |
99 | .BR fgetwc_unlocked (), | |
100 | .BR fputwc_unlocked (), | |
101 | .BR putwchar_unlocked (), | |
102 | .BR fgetws_unlocked (), | |
103 | .BR fputws_unlocked (): | |
f83d1cca | 104 | .RS 4 |
0f200f07 | 105 | _GNU_SOURCE |
f83d1cca | 106 | .RE |
0f200f07 | 107 | .ad b |
fea681da | 108 | .SH DESCRIPTION |
d9bfdb9c | 109 | Each of these functions has the same behavior as its counterpart |
84c517a4 | 110 | without the "_unlocked" suffix, except that they do not use locking |
fea681da MK |
111 | (they do not set locks themselves, and do not test for the presence |
112 | of locks set by others) and hence are thread-unsafe. | |
113 | See | |
114 | .BR flockfile (3). | |
4aefbee8 ZL |
115 | .SH ATTRIBUTES |
116 | For an explanation of the terms used in this section, see | |
117 | .BR attributes (7). | |
74714ea8 | 118 | .ad l |
4aefbee8 ZL |
119 | .TS |
120 | allbox; | |
121 | lbw20 lb lb | |
122 | l l l. | |
123 | Interface Attribute Value | |
124 | T{ | |
125 | .BR getc_unlocked (), | |
126 | .BR putc_unlocked (), | |
127 | .BR clearerr_unlocked (), | |
128 | .BR fflush_unlocked (), | |
129 | .BR fgetc_unlocked (), | |
130 | .BR fputc_unlocked (), | |
131 | .BR fread_unlocked (), | |
132 | .BR fwrite_unlocked (), | |
133 | .BR fgets_unlocked (), | |
134 | .BR fputs_unlocked (), | |
135 | .BR getwc_unlocked (), | |
136 | .BR fgetwc_unlocked (), | |
137 | .BR fputwc_unlocked (), | |
138 | .BR putwc_unlocked (), | |
139 | .BR fgetws_unlocked (), | |
140 | .BR fputws_unlocked () | |
141 | T} Thread safety MT-Safe race:stream | |
142 | T{ | |
143 | .BR getchar_unlocked (), | |
144 | .BR getwchar_unlocked () | |
145 | T} Thread safety MT-Unsafe race:stdin | |
146 | T{ | |
147 | .BR putchar_unlocked (), | |
148 | .BR putwchar_unlocked () | |
149 | T} Thread safety MT-Unsafe race:stdout | |
150 | T{ | |
151 | .BR feof_unlocked (), | |
152 | .BR ferror_unlocked (), | |
153 | .BR fileno_unlocked () | |
154 | T} Thread safety MT-Safe | |
155 | .TE | |
74714ea8 | 156 | .ad |
47297adb | 157 | .SH CONFORMING TO |
d9c1ae64 MK |
158 | The four functions |
159 | .BR getc_unlocked (), | |
160 | .BR getchar_unlocked (), | |
161 | .BR putc_unlocked (), | |
162 | .BR putchar_unlocked () | |
2540a1f9 | 163 | are in POSIX.1-2001 and POSIX.1-2008. |
847e0d88 | 164 | .PP |
c8f2dd47 | 165 | The nonstandard |
4d52e8f8 | 166 | .BR *_unlocked () |
008f1ecc | 167 | variants occur on a few UNIX systems, and are available in recent glibc. |
68e1685c | 168 | .\" E.g., in HP-UX 10.0. In HP-UX 10.30 they are called obsolescent, and |
fea681da | 169 | .\" moved to a compatibility library. |
68e1685c | 170 | .\" Available in HP-UX 10.0: clearerr_unlocked, fclose_unlocked, |
fea681da MK |
171 | .\" feof_unlocked, ferror_unlocked, fflush_unlocked, fgets_unlocked, |
172 | .\" fgetwc_unlocked, fgetws_unlocked, fileno_unlocked, fputs_unlocked, | |
173 | .\" fputwc_unlocked, fputws_unlocked, fread_unlocked, fseek_unlocked, | |
174 | .\" ftell_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked, | |
175 | .\" getw_unlocked, getwc_unlocked, getwchar_unlocked, putc_unlocked, | |
176 | .\" putchar_unlocked, puts_unlocked, putws_unlocked, putw_unlocked, | |
177 | .\" putwc_unlocked, putwchar_unlocked, rewind_unlocked, setvbuf_unlocked, | |
178 | .\" ungetc_unlocked, ungetwc_unlocked. | |
179 | They should probably not be used. | |
47297adb | 180 | .SH SEE ALSO |
50e5322c | 181 | .BR flockfile (3), |
0a4f8b7b | 182 | .BR stdio (3) |