1UNLOCKED_STDIO(3) Linux Programmer's Manual UNLOCKED_STDIO(3)
2
3
4
6 getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - non‐
7 locking stdio functions
8
10 #include <stdio.h>
11
12 int getc_unlocked(FILE *stream);
13 int getchar_unlocked(void);
14 int putc_unlocked(int c, FILE *stream);
15 int putchar_unlocked(int c);
16
17 void clearerr_unlocked(FILE *stream);
18 int feof_unlocked(FILE *stream);
19 int ferror_unlocked(FILE *stream);
20 int fileno_unlocked(FILE *stream);
21 int fflush_unlocked(FILE *stream);
22 int fgetc_unlocked(FILE *stream);
23 int fputc_unlocked(int c, FILE *stream);
24 size_t fread_unlocked(void *ptr, size_t size, size_t n,
25 FILE *stream);
26 size_t fwrite_unlocked(const void *ptr, size_t size, size_t n,
27 FILE *stream);
28
29 char *fgets_unlocked(char *s, int n, FILE *stream);
30 int fputs_unlocked(const char *s, FILE *stream);
31
32 #include <wchar.h>
33
34 wint_t getwc_unlocked(FILE *stream);
35 wint_t getwchar_unlocked(void);
36 wint_t fgetwc_unlocked(FILE *stream);
37 wint_t fputwc_unlocked(wchar_t wc, FILE *stream);
38 wint_t putwc_unlocked(wchar_t wc, FILE *stream);
39 wint_t putwchar_unlocked(wchar_t wc);
40 wchar_t *fgetws_unlocked(wchar_t *ws, int n, FILE *stream);
41 int fputws_unlocked(const wchar_t *ws, FILE *stream);
42
43 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
44
45 getc_unlocked(), getchar_unlocked(), putc_unlocked(),
46 putchar_unlocked(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE ||
47 _POSIX_SOURCE || _BSD_SOURCE || _SVID_SOURCE
48
49 clearerr_unlocked(), feof_unlocked(), ferror_unlocked(),
50 fileno_unlocked(), fflush_unlocked(), fgetc_unlocked(),
51 fputc_unlocked(), fread_unlocked(), fwrite_unlocked(): _BSD_SOURCE ||
52 _SVID_SOURCE
53
54 fgets_unlocked(), fputs_unlocked(), getwc_unlocked(),
55 getwchar_unlocked(), fgetwc_unlocked(), fputwc_unlocked(),
56 putwchar_unlocked(), fgetws_unlocked(), fputws_unlocked(): _GNU_SOURCE
57
59 Each of these functions has the same behavior as its counterpart with‐
60 out the "_unlocked" suffix, except that they do not use locking (they
61 do not set locks themselves, and do not test for the presence of locks
62 set by others) and hence are thread-unsafe. See flockfile(3).
63
65 The four functions getc_unlocked(), getchar_unlocked(),
66 putc_unlocked(), putchar_unlocked() are in POSIX.1-2001.
67
68 The nonstandard *_unlocked() variants occur on a few Unix systems, and
69 are available in recent glibc. They should probably not be used.
70
72 flockfile(3), stdio(3), feature_test_macros(7)
73
75 This page is part of release 3.25 of the Linux man-pages project. A
76 description of the project, and information about reporting bugs, can
77 be found at http://www.kernel.org/doc/man-pages/.
78
79
80
81 2008-08-29 UNLOCKED_STDIO(3)