carta
fread_unlocked(3)

fread_unlocked3

Nonlocking stdio functions

Part of unlocked_stdio(3).

Usage

int getc_unlocked(FILE *stream); int getchar_unlocked(void); int putc_unlocked(int c, FILE *stream); int putchar_unlocked(int c);

void clearerr_unlocked(FILE *stream); int feof_unlocked(FILE *stream); int ferror_unlocked(FILE *stream); int fileno_unlocked(FILE *stream); int fflush_unlocked(FILE *_Nullable stream);

int fgetc_unlocked(FILE *stream); int fputc_unlocked(int c, FILE *stream);

char *fgets_unlocked(int n; char s [restrict n] , int n, FILE *restrict stream); int fputs_unlocked(const char *restrict s, FILE *restrict stream);

wint_t getwc_unlocked(FILE *stream); wint_t getwchar_unlocked(void); wint_t fgetwc_unlocked(FILE *stream);

_GNU_SOURCE

Library

Standard C library (libc, -lc)

Overview

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).

Attributes

For an explanation of the terms used in this section, see attributes(7).

InterfaceAttributeValue
getc_unlocked(), 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()Thread safetyMT-Safe race:stream
getchar_unlocked(), getwchar_unlocked()Thread safetyMT-Unsafe race:stdin
putchar_unlocked(), putwchar_unlocked()Thread safetyMT-Unsafe race:stdout
feof_unlocked(), ferror_unlocked(), fileno_unlocked()Thread safetyMT-Safe

History

  • Arch Linux 2026-11-01: the text shown here
  • Debian 13 (Trixie)
  • Debian 12 (Bookworm)
  • Debian 11 (Bullseye)
  • Debian 10 (Buster)
  • Debian 9 (Stretch)
  • Debian 8 (Jessie)
  • Debian 7 (Wheezy)
  • Debian 6.0 (Squeeze)
  • Debian 5.0 (Lenny)
  • Debian 4.0 (Etch)
  • Debian 3.1 (Sarge)

Standards

getc_unlocked()
getchar_unlocked()
putc_unlocked()
putchar_unlocked()

POSIX.1-2008.

Others:

None.

History

getc_unlocked()
getchar_unlocked()
putc_unlocked()
putchar_unlocked()

POSIX.1-2001.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.