1unlocked_stdio(3)          Library Functions Manual          unlocked_stdio(3)
2
3
4

NAME

6       getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - non‐
7       locking stdio functions
8

LIBRARY

10       Standard C library (libc, -lc)
11

SYNOPSIS

13       #include <stdio.h>
14
15       int getc_unlocked(FILE *stream);
16       int getchar_unlocked(void);
17       int putc_unlocked(int c, FILE *stream);
18       int putchar_unlocked(int c);
19
20       void clearerr_unlocked(FILE *stream);
21       int feof_unlocked(FILE *stream);
22       int ferror_unlocked(FILE *stream);
23       int fileno_unlocked(FILE *stream);
24       int fflush_unlocked(FILE *_Nullable stream);
25
26       int fgetc_unlocked(FILE *stream);
27       int fputc_unlocked(int c, FILE *stream);
28
29       size_t fread_unlocked(void ptr[restrict .size * .n],
30                             size_t size, size_t n,
31                             FILE *restrict stream);
32       size_t fwrite_unlocked(const void ptr[restrict .size * .n],
33                             size_t size, size_t n,
34                             FILE *restrict stream);
35
36       char *fgets_unlocked(char s[restrict .n], int n, FILE *restrict stream);
37       int fputs_unlocked(const char *restrict s, FILE *restrict stream);
38
39       #include <wchar.h>
40
41       wint_t getwc_unlocked(FILE *stream);
42       wint_t getwchar_unlocked(void);
43       wint_t fgetwc_unlocked(FILE *stream);
44
45       wint_t fputwc_unlocked(wchar_t wc, FILE *stream);
46       wint_t putwc_unlocked(wchar_t wc, FILE *stream);
47       wint_t putwchar_unlocked(wchar_t wc);
48
49       wchar_t *fgetws_unlocked(wchar_t ws[restrict .n], int n,
50                             FILE *restrict stream);
51       int fputws_unlocked(const wchar_t *restrict ws,
52                             FILE *restrict stream);
53
54   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
55
56       getc_unlocked(),          getchar_unlocked(),          putc_unlocked(),
57       putchar_unlocked():
58           /* glibc >= 2.24: */ _POSIX_C_SOURCE >= 199309L
59               || /* glibc <= 2.23: */ _POSIX_C_SOURCE
60               || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
61
62       clearerr_unlocked(),         feof_unlocked(),        ferror_unlocked(),
63       fileno_unlocked(),         fflush_unlocked(),         fgetc_unlocked(),
64       fputc_unlocked(), fread_unlocked(), fwrite_unlocked():
65           /* glibc >= 2.19: */ _DEFAULT_SOURCE
66               || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE
67
68       fgets_unlocked(),          fputs_unlocked(),          getwc_unlocked(),
69       getwchar_unlocked(),       fgetwc_unlocked(),        fputwc_unlocked(),
70       putwchar_unlocked(), fgetws_unlocked(), fputws_unlocked():
71           _GNU_SOURCE
72

DESCRIPTION

74       Each  of these functions has the same behavior as its counterpart with‐
75       out the "_unlocked" suffix, except that they do not use  locking  (they
76       do  not set locks themselves, and do not test for the presence of locks
77       set by others) and hence are thread-unsafe.  See flockfile(3).
78

ATTRIBUTES

80       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
81       tributes(7).
82
83       ┌─────────────────────┬───────────────┬────────────────────────────────┐
84Interface            Attribute     Value                          
85       ├─────────────────────┼───────────────┼────────────────────────────────┤
86getc_unlocked(),     │ Thread safety │ MT-Safe race:stream            │
87putc_unlocked(),     │               │                                │
88clearerr_unlocked(), │               │                                │
89fflush_unlocked(),   │               │                                │
90fgetc_unlocked(),    │               │                                │
91fputc_unlocked(),    │               │                                │
92fread_unlocked(),    │               │                                │
93fwrite_unlocked(),   │               │                                │
94fgets_unlocked(),    │               │                                │
95fputs_unlocked(),    │               │                                │
96getwc_unlocked(),    │               │                                │
97fgetwc_unlocked(),   │               │                                │
98fputwc_unlocked(),   │               │                                │
99putwc_unlocked(),    │               │                                │
100fgetws_unlocked(),   │               │                                │
101fputws_unlocked()    │               │                                │
102       ├─────────────────────┼───────────────┼────────────────────────────────┤
103getchar_unlocked(),  │ Thread safety │ MT-Unsafe race:stdin           │
104getwchar_unlocked()  │               │                                │
105       ├─────────────────────┼───────────────┼────────────────────────────────┤
106putchar_unlocked(),  │ Thread safety │ MT-Unsafe race:stdout          │
107putwchar_unlocked()  │               │                                │
108       ├─────────────────────┼───────────────┼────────────────────────────────┤
109feof_unlocked(),     │ Thread safety │ MT-Safe                        │
110ferror_unlocked(),   │               │                                │
111fileno_unlocked()    │               │                                │
112       └─────────────────────┴───────────────┴────────────────────────────────┘
113

STANDARDS

115       getc_unlocked()
116       getchar_unlocked()
117       putc_unlocked()
118       putchar_unlocked()
119              POSIX.1-2008.
120
121       Others:
122              None.
123

HISTORY

125       getc_unlocked()
126       getchar_unlocked()
127       putc_unlocked()
128       putchar_unlocked()
129              POSIX.1-2001.
130

SEE ALSO

132       flockfile(3), stdio(3)
133
134
135
136Linux man-pages 6.05              2023-07-30                 unlocked_stdio(3)
Impressum