perror(3) Library Functions Manual perror(3) perror - (libc -lc) #include void perror(const char *s); #include int errno; /* Not really declared this way; see errno(3) */ [[deprecated]] const char *const sys_errlist[]; [[deprecated]] int sys_nerr; glibc ( feature_test_macros(7)): sys_errlist, sys_nerr: glibc 2.19 glibc 2.31: _DEFAULT_SOURCE glibc 2.19 : _BSD_SOURCE perror() . ( s NULL *s ('\0')) s . errno . . sys_errlist[] errno . sys_nerr-1. sys_errlist[]. sys_errlist[] strerror(3) . -1 errno . ( .) . perror() . errno : . perror() errno. attributes(7). +-----------+------------------------------------+---------------------+ || | | +-----------+------------------------------------+---------------------+ |perror() | | MT-Safe race:stderr | +-----------+------------------------------------+---------------------+ errno perror() C11, POSIX.1-2008. sys_nerr sys_errlist BSD. errno perror() POSIX.1-2001, C89, 4.3BSD. sys_nerr sys_errlist glibc 2.32. err(3), errno(3), error(3), strerror(3) 3 . . : . 6.18 8 2026 perror(3)