errno(3) Library Functions Manual errno(3) errno - LIBRARY Standard C library (libc, -lc) #include errno, , . errno errno , ( : -1 -- ; NULL -- ); errno. errno . (, getpriority(2)), -1. errno , , , , , errno . errno ISO C lvalue int ; errno . errno ; . . , errno. , POSIX.1, , EAGAIN EWOULDBLOCK, . Linux . UNIX , Linux . . perror(3) strerror(3). Linux errno(1)) ( moreutils): $ errno -l EPERM 1 ENOENT 2 ESRCH 3 EINTR 4 EIO 5 / ... errno(1) , , : $ errno 2 ENOENT 2 $ errno ESRCH ESRCH 3 $ errno -s permission EACCES 13 : POSIX.1-2001 The name is defined by POSIX.1-2001, and is defined in later POSIX.1 versions, unless otherwise indicated. POSIX.1-2008 The name is defined in POSIX.1-2008, but was not present in earlier POSIX.1 standards. C99 The name is defined by C99. Below is a list of the symbolic error names that are defined on Linux: E2BIG (POSIX.1-2001). EACCES (POSIX.1-2001). EADDRINUSE (POSIX.1-2001). EADDRNOTAVAIL (POSIX.1-2001). EAFNOSUPPORT (POSIX.1-2001). EAGAIN ( EWOULDBLOCK) (POSIX.1-2001). EALREADY (POSIX.1-2001). EBADE . EBADF (POSIX.1-2001). EBADFD . EBADMSG (POSIX.1-2001). EBADR . EBADRQC . EBADSLT . EBUSY (POSIX.1-2001). ECANCELED (POSIX.1-2001). ECHILD (POSIX.1-2001). ECHRNG . ECOMM . ECONNABORTED (POSIX.1-2001). ECONNREFUSED (POSIX.1-2001). ECONNRESET (POSIX.1-2001). EDEADLK (POSIX.1-2001). EDEADLOCK EDEADLK. (, Linux MIPS, PowerPC, SPARC), << >>. EDESTADDRREQ (POSIX.1-2001). EDOM (POSIX.1, C99). EDQUOT (POSIX.1-2001). EEXIST (POSIX.1-2001). EFAULT (POSIX.1-2001). EFBIG (POSIX.1-2001). EHOSTDOWN . EHOSTUNREACH (POSIX.1-2001). EHWPOISON . EIDRM (POSIX.1-2001). EILSEQ (POSIX.1, C99). glibc; POSIX.1 << >>. EINPROGRESS (POSIX.1-2001). EINTR (POSIX.1-2001); signal(7). EINVAL (POSIX.1-2001). EIO / (POSIX.1-2001). EISCONN (POSIX.1-2001). EISDIR (POSIX.1-2001). EISNAM . EKEYEXPIRED . EKEYREJECTED . EKEYREVOKED . EL2HLT 2 . EL2NSYNC 2 . EL3HLT 3 . EL3RST 3 . ELIBACC . ELIBBAD . ELIBMAX . ELIBSCN .lib a.out ELIBEXEC . ELNRNG . ELOOP (POSIX.1-2001). EMEDIUMTYPE . EMFILE Too many open files (POSIX.1-2001). Commonly caused by exceeding the RLIMIT_NOFILE resource limit described in getrlimit(2). Can also be caused by exceeding the limit specified in /proc/sys/fs/nr_open. EMLINK (POSIX.1-2001). EMSGSIZE (POSIX.1-2001). EMULTIHOP Multihop (POSIX.1-2001). ENAMETOOLONG (POSIX.1-2001). ENETDOWN (POSIX.1-2001). ENETRESET - (POSIX.1-2001). ENETUNREACH (POSIX.1-2001). ENFILE (POSIX.1-2001). Linux , , /proc/sys/fs/file-max ( proc(5)). ENOANO anode. ENOBUFS (POSIX.1 ( XSI STREAMS)). ENODATA The named attribute does not exist, or the process has no access to this attribute; see xattr(7). In POSIX.1-2001 (XSI STREAMS option), this error was described as "No message is available on the STREAM head read queue". ENODEV (POSIX.1-2001). ENOENT (POSIX.1-2001). , , . ENOEXEC (POSIX.1-2001). ENOKEY . ENOLCK (POSIX.1-2001). ENOLINK (POSIX.1-2001). ENOMEDIUM . ENOMEM / (POSIX.1-2001). ENOMSG (POSIX.1-2001). ENONET . ENOPKG . ENOPROTOOPT (POSIX.1-2001). ENOSPC (POSIX.1-2001). ENOSR STREAM (POSIX.1 ( XSI STREAMS)). ENOSTR STREAM (POSIX.1 ( XSI STREAMS)). ENOSYS (POSIX.1-2001). ENOTBLK . ENOTCONN (POSIX.1-2001). ENOTDIR (POSIX.1-2001). ENOTEMPTY (POSIX.1-2001). ENOTRECOVERABLE (POSIX.1-2008). ENOTSOCK (POSIX.1-2001). ENOTSUP (POSIX.1-2001). ENOTTY / (POSIX.1-2001). ENOTUNIQ . ENXIO (POSIX.1-2001). EOPNOTSUPP (POSIX.1-2001). (ENOTSUP EOPNOTSUPP Linux , POSIX.1 .) EOVERFLOW (POSIX.1-2001). EOWNERDEAD (POSIX.1-2008). EPERM (POSIX.1-2001). EPFNOSUPPORT . EPIPE (POSIX.1-2001). EPROTO (POSIX.1-2001). EPROTONOSUPPORT (POSIX.1-2001). EPROTOTYPE (POSIX.1-2001). ERANGE (POSIX.1, C99). EREMCHG . EREMOTE . EREMOTEIO /. ERESTART . ERFKILL - RF-kill. EROFS (POSIX.1-2001). ESHUTDOWN . ESPIPE (POSIX.1-2001). ESOCKTNOSUPPORT . ESRCH (POSIX.1-2001). ESTALE (POSIX.1-2001). NFS . ESTRPIPE . ETIME (POSIX.1 ( XSI STREAMS)). ( POSIX.1 << ioctl(2) STREAM>>) ETIMEDOUT (POSIX.1-2001). ETOOMANYREFS : . ETXTBSY (POSIX.1-2001). EUCLEAN . EUNATCH . EUSERS . EWOULDBLOCK ( EAGAIN) (POSIX.1-2001). EXDEV Invalid cross-device link (POSIX.1-2001). EXFULL . : if (somecall() == -1) { printf("somecall() failed\n"); if (errno == ...) { ... } } errno somecall() (.., - printf(3)). errno , : if (somecall() == -1) { int errsv = errno; printf("somecall() failed\n"); if (errsv == ...) { ... } } Note that the POSIX threads APIs do not set errno on error. Instead, on failure they return an error number as the function result. These error numbers have the same meanings as the error numbers returned in errno by other APIs. errno, (, extern int errno). . , C. . errno(1), err(3), error(3), perror(3), strerror(3) Azamat Hackimov , Yuri Kozlov ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . errno(3)