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 2014-09-06 "" "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)
280 Too many links (POSIX.1)
283 Message too long (POSIX.1)
286 .\" POSIX says "Reserved"
287 Multihop attempted (POSIX.1)
290 Filename too long (POSIX.1)
291 .\" ENAVAIL is defined, but appears not to be used
294 Network is down (POSIX.1)
297 Connection aborted by network (POSIX.1)
300 Network unreachable (POSIX.1)
303 Too many open files in system (POSIX.1)
304 .\" ENOANO is defined but appears to be unused.
307 No buffer space available (POSIX.1 (XSI STREAMS option))
308 .\" ENOCSI is defined but appears to be unused.
311 No message is available on the STREAM head read queue (POSIX.1)
314 No such device (POSIX.1)
317 No such file or directory (POSIX.1)
320 Exec format error (POSIX.1)
323 Required key not available
326 No locks available (POSIX.1)
329 .\" POSIX says "Reserved"
330 Link has been severed (POSIX.1)
336 Not enough space (POSIX.1)
339 No message of the desired type (POSIX.1)
342 Machine is not on the network
345 Package not installed
348 Protocol not available (POSIX.1)
351 No space left on device (POSIX.1)
354 No STREAM resources (POSIX.1 (XSI STREAMS option))
357 Not a STREAM (POSIX.1 (XSI STREAMS option))
360 Function not implemented (POSIX.1)
363 Block device required
366 The socket is not connected (POSIX.1)
369 Not a directory (POSIX.1)
372 Directory not empty (POSIX.1)
373 .\" ENOTNAM is defined but appears to be unused.
376 Not a socket (POSIX.1)
379 Operation not supported (POSIX.1)
382 Inappropriate I/O control operation (POSIX.1)
385 Name not unique on network
388 No such device or address (POSIX.1)
391 Operation not supported on socket (POSIX.1)
396 have the same value on Linux, but
397 according to POSIX.1 these error values should be distinct.)
400 Value too large to be stored in data type (POSIX.1)
403 Operation not permitted (POSIX.1)
406 Protocol family not supported
409 Broken pipe (POSIX.1)
412 Protocol error (POSIX.1)
415 Protocol not supported (POSIX.1)
418 Protocol wrong type for socket (POSIX.1)
421 Result too large (POSIX.1, C99)
424 Remote address changed
433 Interrupted system call should be restarted
436 Read-only filesystem (POSIX.1)
439 Cannot send after transport endpoint shutdown
442 Invalid seek (POSIX.1)
445 Socket type not supported
448 No such process (POSIX.1)
449 .\" ESRMNT is defined but appears not to be used
452 Stale file handle (POSIX.1)
454 This error can occur for NFS and for other filesystems
461 (POSIX.1 (XSI STREAMS option))
463 (POSIX.1 says "STREAM
468 Connection timed out (POSIX.1)
469 .\" ETOOMANYREFS is defined, but appears not to be used.
472 Text file busy (POSIX.1)
475 Structure needs cleaning
478 Protocol driver not attached
484 Operation would block (may be same value as
489 Improper link (POSIX.1)
494 A common mistake is to do
498 if (somecall() == \-1) {
499 printf("somecall() failed\en");
500 if (errno == ...) { ... }
507 no longer needs to have the value it had upon return from
509 (i.e., it may have been changed by the
513 should be preserved across a library call, it must be saved:
517 if (somecall() == \-1) {
519 printf("somecall() failed\en");
520 if (errsv == ...) { ... }
525 It was common in traditional C to declare
529 .IR "extern int errno" )
532 .BR "Do not do this" .
533 It will not work with modern versions of the C library.
534 However, on (very) old UNIX systems, there may be no
536 and the declaration is needed.
538 .BR errno (1), \" In the moreutils package