getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - nonlocking stdio functions
Contents
Attributes
For an explanation of the terms used in this section, see attributes(7).
┌──────────────────────┬───────────────┬────────────────────────────────────────────────────────────────┐
│ Interface │ Attribute │ Value │
├──────────────────────┼───────────────┼────────────────────────────────────────────────────────────────┤
│ getc_unlocked(), │ Thread safety │ MT-Safe race:stream │
│ putc_unlocked(), │ │ │
│ clearerr_unlocked(), │ │ │
│ fflush_unlocked(), │ │ │
│ fgetc_unlocked(), │ │ │
│ fputc_unlocked(), │ │ │
│ fread_unlocked(), │ │ │
│ fwrite_unlocked(), │ │ │
│ fgets_unlocked(), │ │ │
│ fputs_unlocked(), │ │ │
│ getwc_unlocked(), │ │ │
│ fgetwc_unlocked(), │ │ │
│ fputwc_unlocked(), │ │ │
│ putwc_unlocked(), │ │ │
│ fgetws_unlocked(), │ │ │
│ fputws_unlocked() │ │ │
├──────────────────────┼───────────────┼────────────────────────────────────────────────────────────────┤
│ getchar_unlocked(), │ Thread safety │ MT-Unsafe race:stdin │
│ getwchar_unlocked() │ │ │
├──────────────────────┼───────────────┼────────────────────────────────────────────────────────────────┤
│ putchar_unlocked(), │ Thread safety │ MT-Unsafe race:stdout │
│ putwchar_unlocked() │ │ │
├──────────────────────┼───────────────┼────────────────────────────────────────────────────────────────┤
│ feof_unlocked(), │ Thread safety │ MT-Safe │
│ ferror_unlocked(), │ │ │
│ fileno_unlocked() │ │ │
└──────────────────────┴───────────────┴────────────────────────────────────────────────────────────────┘
Description
Each of these functions has the same behavior as its counterpart without the "_unlocked" suffix, except
that they do not use locking (they do not set locks themselves, and do not test for the presence of locks
set by others) and hence are thread-unsafe. See flockfile(3).
History
getc_unlocked()
getchar_unlocked()
putc_unlocked()
putchar_unlocked()
POSIX.1-2001.
Library
Standard C library (libc, -lc)
Name
getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - nonlocking stdio functions
See Also
flockfile(3), stdio(3) Linux man-pages 6.9.1 2024-05-02 unlocked_stdio(3)
Standards
getc_unlocked()
getchar_unlocked()
putc_unlocked()
putchar_unlocked()
POSIX.1-2008.
Others:
None.
Synopsis
#include<stdio.h>intgetc_unlocked(FILE*stream);intgetchar_unlocked(void);intputc_unlocked(intc,FILE*stream);intputchar_unlocked(intc);voidclearerr_unlocked(FILE*stream);intfeof_unlocked(FILE*stream);intferror_unlocked(FILE*stream);intfileno_unlocked(FILE*stream);intfflush_unlocked(FILE*_Nullablestream);intfgetc_unlocked(FILE*stream);intfputc_unlocked(intc,FILE*stream);size_tfread_unlocked(voidptr[restrict.size*.n],size_tsize,size_tn,FILE*restrictstream);size_tfwrite_unlocked(constvoidptr[restrict.size*.n],size_tsize,size_tn,FILE*restrictstream);char*fgets_unlocked(chars[restrict.n],intn,FILE*restrictstream);intfputs_unlocked(constchar*restricts,FILE*restrictstream);#include<wchar.h>wint_tgetwc_unlocked(FILE*stream);wint_tgetwchar_unlocked(void);wint_tfgetwc_unlocked(FILE*stream);wint_tfputwc_unlocked(wchar_twc,FILE*stream);wint_tputwc_unlocked(wchar_twc,FILE*stream);wint_tputwchar_unlocked(wchar_twc);wchar_t*fgetws_unlocked(wchar_tws[restrict.n],intn,FILE*restrictstream);intfputws_unlocked(constwchar_t*restrictws,FILE*restrictstream); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): getc_unlocked(), getchar_unlocked(), putc_unlocked(), putchar_unlocked(): /* glibc >= 2.24: */ _POSIX_C_SOURCE >= 199309L || /* glibc <= 2.23: */ _POSIX_C_SOURCE || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE clearerr_unlocked(), feof_unlocked(), ferror_unlocked(), fileno_unlocked(), fflush_unlocked(), fgetc_unlocked(), fputc_unlocked(), fread_unlocked(), fwrite_unlocked(): /* glibc >= 2.19: */ _DEFAULT_SOURCE || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE fgets_unlocked(), fputs_unlocked(), getwc_unlocked(), getwchar_unlocked(), fgetwc_unlocked(), fputwc_unlocked(), putwchar_unlocked(), fgetws_unlocked(), fputws_unlocked(): _GNU_SOURCE
