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-01-22 "" "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
100 indicating that the name is defined by C99.
103 Argument list too long (POSIX.1)
106 Permission denied (POSIX.1)
109 Address already in use (POSIX.1)
112 Address not available (POSIX.1)
113 .\" EADV is only an error on HURD(?)
116 Address family not supported (POSIX.1)
119 Resource temporarily unavailable (may be the same value as
124 Connection already in progress (POSIX.1)
130 Bad file descriptor (POSIX.1)
133 File descriptor in bad state
136 Bad message (POSIX.1)
139 Invalid request descriptor
146 .\" EBFONT is defined but appears not to be used by kernel or glibc.
149 Device or resource busy (POSIX.1)
152 Operation canceled (POSIX.1)
155 No child processes (POSIX.1)
158 Channel number out of range
161 Communication error on send
164 Connection aborted (POSIX.1)
167 Connection refused (POSIX.1)
170 Connection reset (POSIX.1)
173 Resource deadlock avoided (POSIX.1)
180 Destination address required (POSIX.1)
183 Mathematics argument out of domain of function (POSIX.1, C99)
184 .\" EDOTDOT is defined but appears to be unused
187 .\" POSIX just says "Reserved"
188 Disk quota exceeded (POSIX.1)
191 File exists (POSIX.1)
194 Bad address (POSIX.1)
197 File too large (POSIX.1)
203 Host is unreachable (POSIX.1)
206 Identifier removed (POSIX.1)
209 Illegal byte sequence (POSIX.1, C99)
212 Operation in progress (POSIX.1)
215 Interrupted function call (POSIX.1); see
219 Invalid argument (POSIX.1)
222 Input/output error (POSIX.1)
225 Socket is connected (POSIX.1)
228 Is a directory (POSIX.1)
237 Key was rejected by service
246 Level 2 not synchronized
255 Cannot access a needed shared library
258 Accessing a corrupted shared library
261 Attempting to link in too many shared libraries
264 lib section in a.out corrupted
267 Cannot exec a shared library directly
270 Too many levels of symbolic links (POSIX.1)
271 .\" ELNRNG is defined but appears to be unused
277 Too many open files (POSIX.1);
278 commonly caused by exceeding the
280 resource limit described in
284 Too many links (POSIX.1)
287 Message too long (POSIX.1)
290 .\" POSIX says "Reserved"
291 Multihop attempted (POSIX.1)
294 Filename too long (POSIX.1)
295 .\" ENAVAIL is defined, but appears not to be used
298 Network is down (POSIX.1)
301 Connection aborted by network (POSIX.1)
304 Network unreachable (POSIX.1)
307 Too many open files in system (POSIX.1)
308 .\" ENOANO is defined but appears to be unused.
311 No buffer space available (POSIX.1 (XSI STREAMS option))
312 .\" ENOCSI is defined but appears to be unused.
315 No message is available on the STREAM head read queue (POSIX.1)
318 No such device (POSIX.1)
321 No such file or directory (POSIX.1)
324 Exec format error (POSIX.1)
327 Required key not available
330 No locks available (POSIX.1)
333 .\" POSIX says "Reserved"
334 Link has been severed (POSIX.1)
340 Not enough space (POSIX.1)
343 No message of the desired type (POSIX.1)
346 Machine is not on the network
349 Package not installed
352 Protocol not available (POSIX.1)
355 No space left on device (POSIX.1)
358 No STREAM resources (POSIX.1 (XSI STREAMS option))
361 Not a STREAM (POSIX.1 (XSI STREAMS option))
364 Function not implemented (POSIX.1)
367 Block device required
370 The socket is not connected (POSIX.1)
373 Not a directory (POSIX.1)
376 Directory not empty (POSIX.1)
377 .\" ENOTNAM is defined but appears to be unused.
380 Not a socket (POSIX.1)
383 Operation not supported (POSIX.1)
386 Inappropriate I/O control operation (POSIX.1)
389 Name not unique on network
392 No such device or address (POSIX.1)
395 Operation not supported on socket (POSIX.1)
400 have the same value on Linux, but
401 according to POSIX.1 these error values should be distinct.)
404 Value too large to be stored in data type (POSIX.1)
407 Operation not permitted (POSIX.1)
410 Protocol family not supported
413 Broken pipe (POSIX.1)
416 Protocol error (POSIX.1)
419 Protocol not supported (POSIX.1)
422 Protocol wrong type for socket (POSIX.1)
425 Result too large (POSIX.1, C99)
428 Remote address changed
437 Interrupted system call should be restarted
440 Read-only filesystem (POSIX.1)
443 Cannot send after transport endpoint shutdown
446 Invalid seek (POSIX.1)
449 Socket type not supported
452 No such process (POSIX.1)
453 .\" ESRMNT is defined but appears not to be used
456 Stale file handle (POSIX.1)
458 This error can occur for NFS and for other filesystems
465 (POSIX.1 (XSI STREAMS option))
467 (POSIX.1 says "STREAM
472 Connection timed out (POSIX.1)
473 .\" ETOOMANYREFS is defined, but appears not to be used.
476 Text file busy (POSIX.1)
479 Structure needs cleaning
482 Protocol driver not attached
488 Operation would block (may be same value as
493 Improper link (POSIX.1)
498 A common mistake is to do
502 if (somecall() == \-1) {
503 printf("somecall() failed\en");
504 if (errno == ...) { ... }
511 no longer needs to have the value it had upon return from
513 (i.e., it may have been changed by the
517 should be preserved across a library call, it must be saved:
521 if (somecall() == \-1) {
523 printf("somecall() failed\en");
524 if (errsv == ...) { ... }
529 It was common in traditional C to declare
533 .IR "extern int errno" )
536 .BR "Do not do this" .
537 It will not work with modern versions of the C library.
538 However, on (very) old UNIX systems, there may be no
540 and the declaration is needed.
542 .BR errno (1), \" In the moreutils package
548 This page is part of release 3.79 of the Linux
551 A description of the project,
552 information about reporting bugs,
553 and the latest version of this page,
555 \%http://www.kernel.org/doc/man\-pages/.