1UNLOCKED_STDIO(3) Linux Programmer's Manual UNLOCKED_STDIO(3)
2
3
4
6 *_unlocked - non-locking stdio functions
7
9 #include <stdio.h>
10
11 int getc_unlocked(FILE *stream);
12 int getchar_unlocked(void);
13 int putc_unlocked(int c, FILE *stream);
14 int putchar_unlocked(int c);
15
16 #define _BSD_SOURCE /* or _SVID_SOURCE or _GNU_SOURCE */
17 #include <stdio.h>
18
19 void clearerr_unlocked(FILE *stream);
20 int feof_unlocked(FILE *stream);
21 int ferror_unlocked(FILE *stream);
22 int fileno_unlocked(FILE *stream);
23 int fflush_unlocked(FILE *stream);
24 int fgetc_unlocked(FILE *stream);
25 int fputc_unlocked(int c, FILE *stream);
26 size_t fread_unlocked(void *ptr, size_t size, size_t n,
27 FILE *stream);
28 size_t fwrite_unlocked(const void *ptr, size_t size, size_t n,
29 FILE *stream);
30
31 #define _GNU_SOURCE
32 #include <stdio.h>
33
34 char *fgets_unlocked(char *s, int n, FILE *stream);
35 int fputs_unlocked(const char *s, FILE *stream);
36
37 #define _GNU_SOURCE
38 #include <wchar.h>
39
40 wint_t getwc_unlocked(FILE *stream);
41 wint_t getwchar_unlocked(void);
42 wint_t fgetwc_unlocked(FILE *stream);
43 wint_t fputwc_unlocked(wchar_t wc, FILE *stream);
44 wint_t putwc_unlocked(wchar_t wc, FILE *stream);
45 wint_t putwchar_unlocked(wchar_t wc);
46 wchar_t *fgetws_unlocked(wchar_t *ws, int n, FILE *stream);
47 int fputws_unlocked(const wchar_t *ws, FILE *stream);
48
50 Each of these functions has the same behaviour as its counterpart with‐
51 out the `_unlocked' suffix, except that they do not use locking (they
52 do not set locks themselves, and do not test for the presence of locks
53 set by others) and hence are thread-unsafe. See flockfile(3).
54
56 The four functions getc_unlocked(), getchar_unlocked(),
57 putc_unlocked(), putchar_unlocked() are in POSIX.1-2001.
58
59 The nonstandard *_unlocked() variants occur on a few Unix systems, and
60 are available in recent glibc. They should probably not be used.
61
63 flockfile(3), stdio(3), feature_test_macros(7)
64
65
66
67 2001-10-18 UNLOCKED_STDIO(3)