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 2015-12-28 "" "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
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 Illegal byte sequence (POSIX.1, C99)
213 Operation in progress (POSIX.1)
216 Interrupted function call (POSIX.1); see
220 Invalid argument (POSIX.1)
223 Input/output error (POSIX.1)
226 Socket is connected (POSIX.1)
229 Is a directory (POSIX.1)
238 Key was rejected by service
247 Level 2 not synchronized
256 Cannot access a needed shared library
259 Accessing a corrupted shared library
262 Attempting to link in too many shared libraries
265 lib section in a.out corrupted
268 Cannot exec a shared library directly
271 Too many levels of symbolic links (POSIX.1)
272 .\" ELNRNG is defined but appears to be unused
278 Too many open files (POSIX.1);
279 commonly caused by exceeding the
281 resource limit described in
285 Too many links (POSIX.1)
288 Message too long (POSIX.1)
291 .\" POSIX says "Reserved"
292 Multihop attempted (POSIX.1)
295 Filename too long (POSIX.1)
296 .\" ENAVAIL is defined, but appears not to be used
299 Network is down (POSIX.1)
302 Connection aborted by network (POSIX.1)
305 Network unreachable (POSIX.1)
308 Too many open files in system (POSIX.1);
309 on Linux, this is probably a result of encountering the
310 .IR /proc/sys/fs/file-max
313 .\" ENOANO is defined but appears to be unused.
316 No buffer space available (POSIX.1 (XSI STREAMS option))
317 .\" ENOCSI is defined but appears to be unused.
320 No message is available on the STREAM head read queue (POSIX.1)
323 No such device (POSIX.1)
326 No such file or directory (POSIX.1)
329 Exec format error (POSIX.1)
332 Required key not available
335 No locks available (POSIX.1)
338 .\" POSIX says "Reserved"
339 Link has been severed (POSIX.1)
345 Not enough space (POSIX.1)
348 No message of the desired type (POSIX.1)
351 Machine is not on the network
354 Package not installed
357 Protocol not available (POSIX.1)
360 No space left on device (POSIX.1)
363 No STREAM resources (POSIX.1 (XSI STREAMS option))
366 Not a STREAM (POSIX.1 (XSI STREAMS option))
369 Function not implemented (POSIX.1)
372 Block device required
375 The socket is not connected (POSIX.1)
378 Not a directory (POSIX.1)
381 Directory not empty (POSIX.1)
382 .\" ENOTNAM is defined but appears to be unused.
385 Not a socket (POSIX.1)
388 Operation not supported (POSIX.1)
391 Inappropriate I/O control operation (POSIX.1)
394 Name not unique on network
397 No such device or address (POSIX.1)
400 Operation not supported on socket (POSIX.1)
405 have the same value on Linux, but
406 according to POSIX.1 these error values should be distinct.)
409 Value too large to be stored in data type (POSIX.1)
412 Operation not permitted (POSIX.1)
415 Protocol family not supported
418 Broken pipe (POSIX.1)
421 Protocol error (POSIX.1)
424 Protocol not supported (POSIX.1)
427 Protocol wrong type for socket (POSIX.1)
430 Result too large (POSIX.1, C99)
433 Remote address changed
442 Interrupted system call should be restarted
445 Read-only filesystem (POSIX.1)
448 Cannot send after transport endpoint shutdown
451 Invalid seek (POSIX.1)
454 Socket type not supported
457 No such process (POSIX.1)
458 .\" ESRMNT is defined but appears not to be used
461 Stale file handle (POSIX.1)
463 This error can occur for NFS and for other filesystems
470 (POSIX.1 (XSI STREAMS option))
472 (POSIX.1 says "STREAM
477 Connection timed out (POSIX.1)
478 .\" ETOOMANYREFS is defined, but appears not to be used.
481 Text file busy (POSIX.1)
484 Structure needs cleaning
487 Protocol driver not attached
493 Operation would block (may be same value as
498 Improper link (POSIX.1)
503 A common mistake is to do
507 if (somecall() == \-1) {
508 printf("somecall() failed\en");
509 if (errno == ...) { ... }
516 no longer needs to have the value it had upon return from
518 (i.e., it may have been changed by the
522 should be preserved across a library call, it must be saved:
526 if (somecall() == \-1) {
528 printf("somecall() failed\en");
529 if (errsv == ...) { ... }
534 It was common in traditional C to declare
538 .IR "extern int errno" )
541 .BR "Do not do this" .
542 It will not work with modern versions of the C library.
543 However, on (very) old UNIX systems, there may be no
545 and the declaration is needed.
547 .BR errno (1), \" In the moreutils package