1 .\" Copyright (c) 1996 Andries Brouwer (aeb@cwi.nl)
3 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
24 .\" 5 Oct 2002, Modified by Michael Kerrisk <mtk.manpages@gmail.com>
25 .\" Updated for POSIX.1 2001
26 .\" 2004-12-17 Martin Schulze <joey@infodrom.org>, mtk
27 .\" Removed errno declaration prototype, added notes
28 .\" 2006-02-09 Kurt Wall, mtk
29 .\" Added non-POSIX errors
31 .TH ERRNO 3 2016-12-12 "" "Linux Programmer's Manual"
33 errno \- number of last error
37 .\".BI "extern int " errno ;
41 header file defines the integer variable
43 which is set by system calls and some library functions in the event
44 of an error to indicate what went wrong.
45 Its value is significant only when the return value of
46 the call indicated an error
47 (i.e., \-1 from most system calls;
48 \-1 or NULL from most library functions);
49 a function that succeeds
54 Valid error numbers are all nonzero;
57 by any system call or library function.
59 For some system calls and library functions (e.g.,
61 \-1 is a valid return on success.
62 In such cases, a successful return can be distinguished from an error
65 to zero before the call, and then,
66 if the call returns a status that indicates that an error
67 may have occurred, checking to see if
72 is defined by the ISO C standard to be a modifiable lvalue
75 and must not be explicitly declared;
79 is thread-local; setting it in one thread
80 does not affect its value in any other thread.
82 All the error names specified by POSIX.1
83 must have distinct values, with the exception of
87 which may be the same.
89 .\" The following is now
90 .\" POSIX.1 (2001 edition) lists the following symbolic error names. Of
91 .\" these, \fBEDOM\fP and \fBERANGE\fP are in the ISO C standard. ISO C
92 .\" Amendment 1 defines the additional error number \fBEILSEQ\fP for
93 .\" coding errors in multibyte or wide characters.
95 Below is a list of the symbolic error names that are defined on Linux.
96 Some of these are marked
98 indicating that the name is defined by POSIX.1-2001, or
99 .\" FIXME This list should be updated for POSIX.1-2008
101 indicating that the name is defined by C99.
104 Argument list too long (POSIX.1).
107 Permission denied (POSIX.1).
110 Address already in use (POSIX.1).
113 Address not available (POSIX.1).
114 .\" EADV is only an error on HURD(?)
117 Address family not supported (POSIX.1).
120 Resource temporarily unavailable (may be the same value as
125 Connection already in progress (POSIX.1).
131 Bad file descriptor (POSIX.1).
134 File descriptor in bad state.
137 Bad message (POSIX.1).
140 Invalid request descriptor.
143 Invalid request code.
147 .\" EBFONT is defined but appears not to be used by kernel or glibc.
150 Device or resource busy (POSIX.1).
153 Operation canceled (POSIX.1).
156 No child processes (POSIX.1).
159 Channel number out of range.
162 Communication error on send.
165 Connection aborted (POSIX.1).
168 Connection refused (POSIX.1).
171 Connection reset (POSIX.1).
174 Resource deadlock avoided (POSIX.1).
181 Destination address required (POSIX.1).
184 Mathematics argument out of domain of function (POSIX.1, C99).
185 .\" EDOTDOT is defined but appears to be unused
188 .\" POSIX just says "Reserved"
189 Disk quota exceeded (POSIX.1).
192 File exists (POSIX.1).
195 Bad address (POSIX.1).
198 File too large (POSIX.1).
204 Host is unreachable (POSIX.1).
207 Identifier removed (POSIX.1).
210 Invalid or incomplete multibyte or wide character (POSIX.1, C99).
212 The text shown here is the glibc error description;
213 in POSIX.1, this error is described as "Illegal byte sequence".
216 Operation in progress (POSIX.1).
219 Interrupted function call (POSIX.1); see
223 Invalid argument (POSIX.1).
226 Input/output error (POSIX.1).
229 Socket is connected (POSIX.1).
232 Is a directory (POSIX.1).
235 Is a named type file.
241 Key was rejected by service.
244 Key has been revoked.
250 Level 2 not synchronized.
259 Cannot access a needed shared library.
262 Accessing a corrupted shared library.
265 Attempting to link in too many shared libraries.
268 \&.lib section in a.out corrupted
271 Cannot exec a shared library directly.
274 Too many levels of symbolic links (POSIX.1).
275 .\" ELNRNG is defined but appears to be unused
281 Too many open files (POSIX.1).
282 Commonly caused by exceeding the
284 resource limit described in
288 Too many links (POSIX.1).
291 Message too long (POSIX.1).
294 .\" POSIX says "Reserved"
295 Multihop attempted (POSIX.1).
298 Filename too long (POSIX.1).
299 .\" ENAVAIL is defined, but appears not to be used
302 Network is down (POSIX.1).
305 Connection aborted by network (POSIX.1).
308 Network unreachable (POSIX.1).
311 Too many open files in system (POSIX.1).
312 On Linux, this is probably a result of encountering the
313 .IR /proc/sys/fs/file-max
316 .\" ENOANO is defined but appears to be unused.
319 No buffer space available (POSIX.1 (XSI STREAMS option)).
320 .\" ENOCSI is defined but appears to be unused.
323 No message is available on the STREAM head read queue (POSIX.1).
326 No such device (POSIX.1).
329 No such file or directory (POSIX.1).
331 Typically, this error results when a specified pathname does not exist,
332 or one of the components in the directory prefix of a pathname does not exist,
333 or the specified pathname is a dangling symbolic link.
336 Exec format error (POSIX.1).
339 Required key not available.
342 No locks available (POSIX.1).
345 .\" POSIX says "Reserved"
346 Link has been severed (POSIX.1).
352 Not enough space (POSIX.1).
355 No message of the desired type (POSIX.1).
358 Machine is not on the network.
361 Package not installed.
364 Protocol not available (POSIX.1).
367 No space left on device (POSIX.1).
370 No STREAM resources (POSIX.1 (XSI STREAMS option)).
373 Not a STREAM (POSIX.1 (XSI STREAMS option)).
376 Function not implemented (POSIX.1).
379 Block device required.
382 The socket is not connected (POSIX.1).
385 Not a directory (POSIX.1).
388 Directory not empty (POSIX.1).
389 .\" ENOTNAM is defined but appears to be unused.
392 Not a socket (POSIX.1).
395 Operation not supported (POSIX.1).
398 Inappropriate I/O control operation (POSIX.1).
401 Name not unique on network.
404 No such device or address (POSIX.1).
407 Operation not supported on socket (POSIX.1).
412 have the same value on Linux, but
413 according to POSIX.1 these error values should be distinct.)
416 Value too large to be stored in data type (POSIX.1).
419 Operation not permitted (POSIX.1).
422 Protocol family not supported.
425 Broken pipe (POSIX.1).
428 Protocol error (POSIX.1).
431 Protocol not supported (POSIX.1).
434 Protocol wrong type for socket (POSIX.1).
437 Result too large (POSIX.1, C99).
440 Remote address changed.
449 Interrupted system call should be restarted.
452 Read-only filesystem (POSIX.1).
455 Cannot send after transport endpoint shutdown.
458 Invalid seek (POSIX.1).
461 Socket type not supported.
464 No such process (POSIX.1).
465 .\" ESRMNT is defined but appears not to be used
468 Stale file handle (POSIX.1).
470 This error can occur for NFS and for other filesystems.
477 (POSIX.1 (XSI STREAMS option))
479 (POSIX.1 says "STREAM
484 Connection timed out (POSIX.1).
485 .\" ETOOMANYREFS is defined, but appears not to be used.
488 Text file busy (POSIX.1).
491 Structure needs cleaning.
494 Protocol driver not attached.
500 Operation would block (may be same value as
505 Improper link (POSIX.1).
510 A common mistake is to do
514 if (somecall() == \-1) {
515 printf("somecall() failed\en");
516 if (errno == ...) { ... }
523 no longer needs to have the value it had upon return from
525 (i.e., it may have been changed by the
529 should be preserved across a library call, it must be saved:
533 if (somecall() == \-1) {
535 printf("somecall() failed\en");
536 if (errsv == ...) { ... }
541 It was common in traditional C to declare
545 .IR "extern int errno" )
548 .BR "Do not do this" .
549 It will not work with modern versions of the C library.
550 However, on (very) old UNIX systems, there may be no
552 and the declaration is needed.
554 .BR errno (1), \" In the moreutils package