]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 1996 Andries Brouwer (aeb@cwi.nl) |
2 | .\" | |
e4a74ca8 | 3 | .\" SPDX-License-Identifier: GPL-2.0-or-later |
fea681da | 4 | .\" |
c11b1abf | 5 | .\" 5 Oct 2002, Modified by Michael Kerrisk <mtk.manpages@gmail.com> |
68e1685c | 6 | .\" Updated for POSIX.1 2001 |
05432883 MK |
7 | .\" 2004-12-17 Martin Schulze <joey@infodrom.org>, mtk |
8 | .\" Removed errno declaration prototype, added notes | |
a0ddea87 MK |
9 | .\" 2006-02-09 Kurt Wall, mtk |
10 | .\" Added non-POSIX errors | |
fea681da | 11 | .\" |
45186a5d | 12 | .TH ERRNO 3 2021-03-22 "Linux man-pages (unreleased)" |
fea681da MK |
13 | .SH NAME |
14 | errno \- number of last error | |
afa8db94 AC |
15 | .SH LIBRARY |
16 | Standard C library | |
17 | .RI ( libc ", " \-lc ) | |
fea681da | 18 | .SH SYNOPSIS |
c7db92b9 | 19 | .nf |
fea681da | 20 | .B #include <errno.h> |
68e4db0a | 21 | .\".PP |
05432883 | 22 | .\".BI "extern int " errno ; |
c7db92b9 | 23 | .fi |
fea681da | 24 | .SH DESCRIPTION |
c13182ef | 25 | The |
05432883 MK |
26 | .I <errno.h> |
27 | header file defines the integer variable | |
09b235db | 28 | .IR errno , |
05432883 MK |
29 | which is set by system calls and some library functions in the event |
30 | of an error to indicate what went wrong. | |
b89ec852 MK |
31 | .\" |
32 | .SS errno | |
a9641f84 MK |
33 | The value in |
34 | .I errno | |
35 | is significant only when the return value of | |
929ccaa3 MK |
36 | the call indicated an error |
37 | (i.e., \-1 from most system calls; | |
38 | \-1 or NULL from most library functions); | |
39 | a function that succeeds | |
40 | .I is | |
41 | allowed to change | |
09b235db | 42 | .IR errno . |
b89ec852 MK |
43 | The value of |
44 | .I errno | |
45 | is never set to zero by any system call or library function. | |
847e0d88 | 46 | .PP |
929ccaa3 MK |
47 | For some system calls and library functions (e.g., |
48 | .BR getpriority (2)), | |
49 | \-1 is a valid return on success. | |
50 | In such cases, a successful return can be distinguished from an error | |
51 | return by setting | |
09b235db | 52 | .I errno |
929ccaa3 MK |
53 | to zero before the call, and then, |
54 | if the call returns a status that indicates that an error | |
55 | may have occurred, checking to see if | |
56 | .I errno | |
c7094399 | 57 | has a nonzero value. |
847e0d88 | 58 | .PP |
c6fa0841 MK |
59 | .I errno |
60 | is defined by the ISO C standard to be a modifiable lvalue | |
61 | of type | |
62 | .IR int , | |
63 | and must not be explicitly declared; | |
64 | .I errno | |
be7fff26 | 65 | may be a macro. |
c6fa0841 MK |
66 | .I errno |
67 | is thread-local; setting it in one thread | |
fea681da | 68 | does not affect its value in any other thread. |
b89ec852 MK |
69 | .\" |
70 | .SS Error numbers and names | |
9d1a5fa6 | 71 | Valid error numbers are all positive numbers. |
b89ec852 MK |
72 | The |
73 | .I <errno.h> | |
74 | header file defines symbolic names for each | |
75 | of the possible error numbers that may appear in | |
76 | .IR errno . | |
847e0d88 | 77 | .PP |
c13182ef | 78 | All the error names specified by POSIX.1 |
05432883 MK |
79 | must have distinct values, with the exception of |
80 | .B EAGAIN | |
c13182ef | 81 | and |
05432883 | 82 | .BR EWOULDBLOCK , |
07b973b2 MK |
83 | which may be the same. |
84 | On Linux, these two have the same value on all architectures. | |
847e0d88 | 85 | .PP |
f7921478 MK |
86 | The error numbers that correspond to each symbolic name |
87 | vary across UNIX systems, | |
88 | and even across different architectures on Linux. | |
b01ecc5e | 89 | Therefore, numeric values are not included as part of the list of |
bf3683a1 | 90 | error names below. |
5a99c722 MK |
91 | The |
92 | .BR perror (3) | |
93 | and | |
94 | .BR strerror (3) | |
95 | functions can be used to convert these names to | |
96 | corresponding textual error messages. | |
afde18c0 MK |
97 | .PP |
98 | On any particular Linux system, | |
44a35dc8 MK |
99 | one can obtain a list of all symbolic error names and |
100 | the corresponding error numbers using the | |
101 | .BR errno (1) | |
385a5b3d MK |
102 | command (part of the |
103 | .I moreutils | |
104 | package): | |
44a35dc8 MK |
105 | .PP |
106 | .in +4n | |
107 | .EX | |
108 | $ \fBerrno \-l\fP | |
109 | EPERM 1 Operation not permitted | |
110 | ENOENT 2 No such file or directory | |
111 | ESRCH 3 No such process | |
112 | EINTR 4 Interrupted system call | |
113 | EIO 5 Input/output error | |
114 | \&... | |
115 | .EE | |
116 | .in | |
117 | .PP | |
118 | The | |
119 | .BR errno (1) | |
d2cd4588 MK |
120 | command can also be used to look up individual error numbers and names, |
121 | and to search for errors using strings from the error description, | |
44a35dc8 MK |
122 | as in the following examples: |
123 | .PP | |
124 | .in +4n | |
125 | .EX | |
126 | $ \fBerrno 2\fP | |
127 | ENOENT 2 No such file or directory | |
128 | $ \fBerrno ESRCH\fP | |
129 | ESRCH 3 No such process | |
d2cd4588 MK |
130 | $ \fBerrno \-s permission\fP |
131 | EACCES 13 Permission denied | |
44a35dc8 MK |
132 | .EE |
133 | .in | |
7f740303 | 134 | .\".PP |
a0ddea87 | 135 | .\" POSIX.1 (2001 edition) lists the following symbolic error names. Of |
a8d55537 MK |
136 | .\" these, \fBEDOM\fP and \fBERANGE\fP are in the ISO C standard. ISO C |
137 | .\" Amendment 1 defines the additional error number \fBEILSEQ\fP for | |
a0ddea87 | 138 | .\" coding errors in multibyte or wide characters. |
c13182ef | 139 | .\" |
b89ec852 | 140 | .SS List of error names |
e4a5b662 MK |
141 | In the list of the symbolic error names below, |
142 | various names are marked as follows: | |
5a63455f MK |
143 | .IP * 3 |
144 | .IR POSIX.1-2001 : | |
145 | The name is defined by POSIX.1-2001, | |
146 | and is defined in later POSIX.1 versions, unless otherwise indicated. | |
147 | .IP * | |
148 | .IR POSIX.1-2008 : | |
149 | The name is defined in POSIX.1-2008, | |
150 | but was not present in earlier POSIX.1 standards. | |
151 | .IP * | |
152 | .IR C99 : | |
153 | The name is defined by C99. | |
6c525d1c | 154 | .PP |
e4a5b662 | 155 | Below is a list of the symbolic error names that are defined on Linux: |
dbb8ac51 | 156 | .TP 16 |
0daa9e92 | 157 | .B E2BIG |
5a63455f | 158 | Argument list too long (POSIX.1-2001). |
fea681da | 159 | .TP |
0daa9e92 | 160 | .B EACCES |
5a63455f | 161 | Permission denied (POSIX.1-2001). |
fea681da | 162 | .TP |
0daa9e92 | 163 | .B EADDRINUSE |
5a63455f | 164 | Address already in use (POSIX.1-2001). |
fea681da | 165 | .TP |
0daa9e92 | 166 | .B EADDRNOTAVAIL |
5a63455f | 167 | Address not available (POSIX.1-2001). |
a0ddea87 | 168 | .\" EADV is only an error on HURD(?) |
fea681da | 169 | .TP |
0daa9e92 | 170 | .B EAFNOSUPPORT |
5a63455f | 171 | Address family not supported (POSIX.1-2001). |
fea681da | 172 | .TP |
0daa9e92 | 173 | .B EAGAIN |
c13182ef | 174 | Resource temporarily unavailable (may be the same value as |
a0ddea87 | 175 | .BR EWOULDBLOCK ) |
5a63455f | 176 | (POSIX.1-2001). |
a0ddea87 | 177 | .TP |
0daa9e92 | 178 | .B EALREADY |
5a63455f | 179 | Connection already in progress (POSIX.1-2001). |
a0ddea87 | 180 | .TP |
0daa9e92 | 181 | .B EBADE |
31071798 | 182 | Invalid exchange. |
a0ddea87 | 183 | .TP |
0daa9e92 | 184 | .B EBADF |
5a63455f | 185 | Bad file descriptor (POSIX.1-2001). |
a0ddea87 | 186 | .TP |
0daa9e92 | 187 | .B EBADFD |
31071798 | 188 | File descriptor in bad state. |
fea681da | 189 | .TP |
0daa9e92 | 190 | .B EBADMSG |
5a63455f | 191 | Bad message (POSIX.1-2001). |
fea681da | 192 | .TP |
0daa9e92 | 193 | .B EBADR |
31071798 | 194 | Invalid request descriptor. |
fea681da | 195 | .TP |
0daa9e92 | 196 | .B EBADRQC |
31071798 | 197 | Invalid request code. |
fea681da | 198 | .TP |
0daa9e92 | 199 | .B EBADSLT |
31071798 | 200 | Invalid slot. |
a0ddea87 | 201 | .\" EBFONT is defined but appears not to be used by kernel or glibc. |
fea681da | 202 | .TP |
0daa9e92 | 203 | .B EBUSY |
5a63455f | 204 | Device or resource busy (POSIX.1-2001). |
fea681da | 205 | .TP |
0daa9e92 | 206 | .B ECANCELED |
5a63455f | 207 | Operation canceled (POSIX.1-2001). |
fea681da | 208 | .TP |
0daa9e92 | 209 | .B ECHILD |
5a63455f | 210 | No child processes (POSIX.1-2001). |
fea681da | 211 | .TP |
a0ddea87 | 212 | .B ECHRNG |
31071798 | 213 | Channel number out of range. |
fea681da | 214 | .TP |
a0ddea87 | 215 | .B ECOMM |
31071798 | 216 | Communication error on send. |
fea681da | 217 | .TP |
0daa9e92 | 218 | .B ECONNABORTED |
5a63455f | 219 | Connection aborted (POSIX.1-2001). |
a0ddea87 | 220 | .TP |
0daa9e92 | 221 | .B ECONNREFUSED |
5a63455f | 222 | Connection refused (POSIX.1-2001). |
a0ddea87 | 223 | .TP |
0daa9e92 | 224 | .B ECONNRESET |
5a63455f | 225 | Connection reset (POSIX.1-2001). |
a0ddea87 | 226 | .TP |
0daa9e92 | 227 | .B EDEADLK |
5a63455f | 228 | Resource deadlock avoided (POSIX.1-2001). |
a0ddea87 | 229 | .TP |
0daa9e92 | 230 | .B EDEADLOCK |
07b973b2 | 231 | On most architectures, a synonym for |
31071798 | 232 | .BR EDEADLK . |
07b973b2 MK |
233 | On some architectures (e.g., Linux MIPS, PowerPC, SPARC), |
234 | it is a separate error code "File locking deadlock error". | |
fea681da | 235 | .TP |
0daa9e92 | 236 | .B EDESTADDRREQ |
5a63455f | 237 | Destination address required (POSIX.1-2001). |
a0ddea87 | 238 | .TP |
0daa9e92 | 239 | .B EDOM |
31071798 | 240 | Mathematics argument out of domain of function (POSIX.1, C99). |
a0ddea87 MK |
241 | .\" EDOTDOT is defined but appears to be unused |
242 | .TP | |
0daa9e92 | 243 | .B EDQUOT |
a0ddea87 | 244 | .\" POSIX just says "Reserved" |
5a63455f | 245 | Disk quota exceeded (POSIX.1-2001). |
a0ddea87 | 246 | .TP |
0daa9e92 | 247 | .B EEXIST |
5a63455f | 248 | File exists (POSIX.1-2001). |
a0ddea87 | 249 | .TP |
0daa9e92 | 250 | .B EFAULT |
5a63455f | 251 | Bad address (POSIX.1-2001). |
a0ddea87 | 252 | .TP |
0daa9e92 | 253 | .B EFBIG |
5a63455f | 254 | File too large (POSIX.1-2001). |
a0ddea87 | 255 | .TP |
0daa9e92 | 256 | .B EHOSTDOWN |
31071798 | 257 | Host is down. |
a0ddea87 | 258 | .TP |
0daa9e92 | 259 | .B EHOSTUNREACH |
5a63455f | 260 | Host is unreachable (POSIX.1-2001). |
a0ddea87 | 261 | .TP |
975c0f87 MK |
262 | .B EHWPOISON |
263 | Memory page has hardware error. | |
264 | .TP | |
0daa9e92 | 265 | .B EIDRM |
5a63455f | 266 | Identifier removed (POSIX.1-2001). |
a0ddea87 | 267 | .TP |
0daa9e92 | 268 | .B EILSEQ |
d411041b | 269 | Invalid or incomplete multibyte or wide character (POSIX.1, C99). |
847e0d88 | 270 | .IP |
d411041b MK |
271 | The text shown here is the glibc error description; |
272 | in POSIX.1, this error is described as "Illegal byte sequence". | |
a0ddea87 | 273 | .TP |
0daa9e92 | 274 | .B EINPROGRESS |
5a63455f | 275 | Operation in progress (POSIX.1-2001). |
a0ddea87 | 276 | .TP |
0daa9e92 | 277 | .B EINTR |
5a63455f | 278 | Interrupted function call (POSIX.1-2001); see |
0b6d88cf | 279 | .BR signal (7). |
a0ddea87 | 280 | .TP |
0daa9e92 | 281 | .B EINVAL |
5a63455f | 282 | Invalid argument (POSIX.1-2001). |
fea681da | 283 | .TP |
0daa9e92 | 284 | .B EIO |
5a63455f | 285 | Input/output error (POSIX.1-2001). |
fea681da | 286 | .TP |
0daa9e92 | 287 | .B EISCONN |
5a63455f | 288 | Socket is connected (POSIX.1-2001). |
fea681da | 289 | .TP |
0daa9e92 | 290 | .B EISDIR |
5a63455f | 291 | Is a directory (POSIX.1-2001). |
fea681da | 292 | .TP |
0daa9e92 | 293 | .B EISNAM |
31071798 | 294 | Is a named type file. |
fea681da | 295 | .TP |
0daa9e92 | 296 | .B EKEYEXPIRED |
31071798 | 297 | Key has expired. |
fea681da | 298 | .TP |
0daa9e92 | 299 | .B EKEYREJECTED |
31071798 | 300 | Key was rejected by service. |
fea681da | 301 | .TP |
0daa9e92 | 302 | .B EKEYREVOKED |
31071798 | 303 | Key has been revoked. |
fea681da | 304 | .TP |
a0ddea87 | 305 | .B EL2HLT |
31071798 | 306 | Level 2 halted. |
fea681da | 307 | .TP |
a0ddea87 | 308 | .B EL2NSYNC |
31071798 | 309 | Level 2 not synchronized. |
fea681da | 310 | .TP |
a0ddea87 | 311 | .B EL3HLT |
31071798 | 312 | Level 3 halted. |
fea681da | 313 | .TP |
a0ddea87 | 314 | .B EL3RST |
14ecabec | 315 | Level 3 reset. |
fea681da | 316 | .TP |
0daa9e92 | 317 | .B ELIBACC |
31071798 | 318 | Cannot access a needed shared library. |
fea681da | 319 | .TP |
0daa9e92 | 320 | .B ELIBBAD |
31071798 | 321 | Accessing a corrupted shared library. |
fea681da | 322 | .TP |
0daa9e92 | 323 | .B ELIBMAX |
31071798 | 324 | Attempting to link in too many shared libraries. |
fea681da | 325 | .TP |
0daa9e92 | 326 | .B ELIBSCN |
e1f3482c | 327 | \&.lib section in a.out corrupted |
fea681da | 328 | .TP |
0daa9e92 | 329 | .B ELIBEXEC |
31071798 | 330 | Cannot exec a shared library directly. |
fea681da | 331 | .TP |
975c0f87 MK |
332 | .B ELNRANGE |
333 | .\" ELNRNG appears to be used by a few drivers | |
334 | Link number out of range. | |
335 | .TP | |
0daa9e92 | 336 | .B ELOOP |
5a63455f | 337 | Too many levels of symbolic links (POSIX.1-2001). |
fea681da | 338 | .TP |
0daa9e92 | 339 | .B EMEDIUMTYPE |
31071798 | 340 | Wrong medium type. |
fea681da | 341 | .TP |
0daa9e92 | 342 | .B EMFILE |
5a63455f | 343 | Too many open files (POSIX.1-2001). |
31071798 | 344 | Commonly caused by exceeding the |
1ae6b2c7 | 345 | .B RLIMIT_NOFILE |
0c38aa2c | 346 | resource limit described in |
31071798 | 347 | .BR getrlimit (2). |
2b851e6f MK |
348 | Can also be caused by exceeding the limit specified in |
349 | .IR /proc/sys/fs/nr_open . | |
fea681da | 350 | .TP |
0daa9e92 | 351 | .B EMLINK |
5a63455f | 352 | Too many links (POSIX.1-2001). |
fea681da | 353 | .TP |
0daa9e92 | 354 | .B EMSGSIZE |
5a63455f | 355 | Message too long (POSIX.1-2001). |
fea681da | 356 | .TP |
0daa9e92 | 357 | .B EMULTIHOP |
a0ddea87 | 358 | .\" POSIX says "Reserved" |
5a63455f | 359 | Multihop attempted (POSIX.1-2001). |
fea681da | 360 | .TP |
0daa9e92 | 361 | .B ENAMETOOLONG |
5a63455f | 362 | Filename too long (POSIX.1-2001). |
a0ddea87 | 363 | .\" ENAVAIL is defined, but appears not to be used |
fea681da | 364 | .TP |
0daa9e92 | 365 | .B ENETDOWN |
5a63455f | 366 | Network is down (POSIX.1-2001). |
fea681da | 367 | .TP |
0daa9e92 | 368 | .B ENETRESET |
5a63455f | 369 | Connection aborted by network (POSIX.1-2001). |
fea681da | 370 | .TP |
0daa9e92 | 371 | .B ENETUNREACH |
5a63455f | 372 | Network unreachable (POSIX.1-2001). |
fea681da | 373 | .TP |
0daa9e92 | 374 | .B ENFILE |
5a63455f | 375 | Too many open files in system (POSIX.1-2001). |
31071798 | 376 | On Linux, this is probably a result of encountering the |
1ae6b2c7 | 377 | .I /proc/sys/fs/file\-max |
4a5c6f9f MK |
378 | limit (see |
379 | .BR proc (5)). | |
975c0f87 MK |
380 | .TP |
381 | .B ENOANO | |
382 | .\" ENOANO appears to be used by a few drivers | |
383 | No anode. | |
fea681da | 384 | .TP |
0daa9e92 | 385 | .B ENOBUFS |
31071798 | 386 | No buffer space available (POSIX.1 (XSI STREAMS option)). |
a0ddea87 | 387 | .\" ENOCSI is defined but appears to be unused. |
fea681da | 388 | .TP |
0daa9e92 | 389 | .B ENODATA |
a60b5d45 AC |
390 | The named attribute does not exist, |
391 | or the process has no access to this attribute; see | |
392 | .BR xattr (7). | |
393 | .IP | |
394 | In POSIX.1-2001 (XSI STREAMS option), | |
395 | this error was described as | |
396 | "No message is available on the STREAM head read queue". | |
fea681da | 397 | .TP |
0daa9e92 | 398 | .B ENODEV |
5a63455f | 399 | No such device (POSIX.1-2001). |
fea681da | 400 | .TP |
0daa9e92 | 401 | .B ENOENT |
5a63455f | 402 | No such file or directory (POSIX.1-2001). |
847e0d88 | 403 | .IP |
9f895e62 MK |
404 | Typically, this error results when a specified pathname does not exist, |
405 | or one of the components in the directory prefix of a pathname does not exist, | |
406 | or the specified pathname is a dangling symbolic link. | |
fea681da | 407 | .TP |
0daa9e92 | 408 | .B ENOEXEC |
5a63455f | 409 | Exec format error (POSIX.1-2001). |
fea681da | 410 | .TP |
0daa9e92 | 411 | .B ENOKEY |
31071798 | 412 | Required key not available. |
fea681da | 413 | .TP |
0daa9e92 | 414 | .B ENOLCK |
5a63455f | 415 | No locks available (POSIX.1-2001). |
fea681da | 416 | .TP |
0daa9e92 | 417 | .B ENOLINK |
a0ddea87 | 418 | .\" POSIX says "Reserved" |
5a63455f | 419 | Link has been severed (POSIX.1-2001). |
fea681da | 420 | .TP |
0daa9e92 | 421 | .B ENOMEDIUM |
31071798 | 422 | No medium found. |
fea681da | 423 | .TP |
0daa9e92 | 424 | .B ENOMEM |
6386c0c8 | 425 | Not enough space/cannot allocate memory (POSIX.1-2001). |
fea681da | 426 | .TP |
0daa9e92 | 427 | .B ENOMSG |
5a63455f | 428 | No message of the desired type (POSIX.1-2001). |
fea681da | 429 | .TP |
0daa9e92 | 430 | .B ENONET |
31071798 | 431 | Machine is not on the network. |
fea681da | 432 | .TP |
0daa9e92 | 433 | .B ENOPKG |
31071798 | 434 | Package not installed. |
fea681da | 435 | .TP |
0daa9e92 | 436 | .B ENOPROTOOPT |
5a63455f | 437 | Protocol not available (POSIX.1-2001). |
fea681da | 438 | .TP |
0daa9e92 | 439 | .B ENOSPC |
5a63455f | 440 | No space left on device (POSIX.1-2001). |
fea681da | 441 | .TP |
0daa9e92 | 442 | .B ENOSR |
31071798 | 443 | No STREAM resources (POSIX.1 (XSI STREAMS option)). |
fea681da | 444 | .TP |
0daa9e92 | 445 | .B ENOSTR |
31071798 | 446 | Not a STREAM (POSIX.1 (XSI STREAMS option)). |
fea681da | 447 | .TP |
0daa9e92 | 448 | .B ENOSYS |
5a63455f | 449 | Function not implemented (POSIX.1-2001). |
fea681da | 450 | .TP |
0daa9e92 | 451 | .B ENOTBLK |
31071798 | 452 | Block device required. |
fea681da | 453 | .TP |
0daa9e92 | 454 | .B ENOTCONN |
5a63455f | 455 | The socket is not connected (POSIX.1-2001). |
fea681da | 456 | .TP |
0daa9e92 | 457 | .B ENOTDIR |
5a63455f | 458 | Not a directory (POSIX.1-2001). |
fea681da | 459 | .TP |
0daa9e92 | 460 | .B ENOTEMPTY |
5a63455f | 461 | Directory not empty (POSIX.1-2001). |
a0ddea87 | 462 | .\" ENOTNAM is defined but appears to be unused. |
fea681da | 463 | .TP |
975c0f87 | 464 | .B ENOTRECOVERABLE |
5a63455f | 465 | State not recoverable (POSIX.1-2008). |
975c0f87 | 466 | .TP |
0daa9e92 | 467 | .B ENOTSOCK |
5a63455f | 468 | Not a socket (POSIX.1-2001). |
fea681da | 469 | .TP |
0daa9e92 | 470 | .B ENOTSUP |
5a63455f | 471 | Operation not supported (POSIX.1-2001). |
fea681da | 472 | .TP |
0daa9e92 | 473 | .B ENOTTY |
5a63455f | 474 | Inappropriate I/O control operation (POSIX.1-2001). |
fea681da | 475 | .TP |
0daa9e92 | 476 | .B ENOTUNIQ |
31071798 | 477 | Name not unique on network. |
fea681da | 478 | .TP |
0daa9e92 | 479 | .B ENXIO |
5a63455f | 480 | No such device or address (POSIX.1-2001). |
fea681da | 481 | .TP |
0daa9e92 | 482 | .B EOPNOTSUPP |
5a63455f | 483 | Operation not supported on socket (POSIX.1-2001). |
ba39b288 | 484 | .IP |
2f0af33b MK |
485 | .RB ( ENOTSUP |
486 | and | |
487 | .B EOPNOTSUPP | |
488 | have the same value on Linux, but | |
a0ddea87 | 489 | according to POSIX.1 these error values should be distinct.) |
fea681da | 490 | .TP |
0daa9e92 | 491 | .B EOVERFLOW |
5a63455f | 492 | Value too large to be stored in data type (POSIX.1-2001). |
fea681da | 493 | .TP |
975c0f87 MK |
494 | .B EOWNERDEAD |
495 | .\" Used at least by the user-space side of rubost mutexes | |
5a63455f | 496 | Owner died (POSIX.1-2008). |
975c0f87 | 497 | .TP |
0daa9e92 | 498 | .B EPERM |
5a63455f | 499 | Operation not permitted (POSIX.1-2001). |
fea681da | 500 | .TP |
0daa9e92 | 501 | .B EPFNOSUPPORT |
31071798 | 502 | Protocol family not supported. |
a0ddea87 | 503 | .TP |
0daa9e92 | 504 | .B EPIPE |
5a63455f | 505 | Broken pipe (POSIX.1-2001). |
a0ddea87 | 506 | .TP |
0daa9e92 | 507 | .B EPROTO |
5a63455f | 508 | Protocol error (POSIX.1-2001). |
a0ddea87 | 509 | .TP |
0daa9e92 | 510 | .B EPROTONOSUPPORT |
5a63455f | 511 | Protocol not supported (POSIX.1-2001). |
a0ddea87 | 512 | .TP |
0daa9e92 | 513 | .B EPROTOTYPE |
5a63455f | 514 | Protocol wrong type for socket (POSIX.1-2001). |
a0ddea87 | 515 | .TP |
0daa9e92 | 516 | .B ERANGE |
31071798 | 517 | Result too large (POSIX.1, C99). |
a0ddea87 | 518 | .TP |
0daa9e92 | 519 | .B EREMCHG |
31071798 | 520 | Remote address changed. |
a0ddea87 | 521 | .TP |
0daa9e92 | 522 | .B EREMOTE |
31071798 | 523 | Object is remote. |
a0ddea87 | 524 | .TP |
0daa9e92 | 525 | .B EREMOTEIO |
31071798 | 526 | Remote I/O error. |
a0ddea87 | 527 | .TP |
0daa9e92 | 528 | .B ERESTART |
31071798 | 529 | Interrupted system call should be restarted. |
a0ddea87 | 530 | .TP |
975c0f87 MK |
531 | .B ERFKILL |
532 | .\" ERFKILL appears to be used by various drivers | |
533 | Operation not possible due to RF-kill. | |
534 | .TP | |
0daa9e92 | 535 | .B EROFS |
5a63455f | 536 | Read-only filesystem (POSIX.1-2001). |
a0ddea87 | 537 | .TP |
0daa9e92 | 538 | .B ESHUTDOWN |
31071798 | 539 | Cannot send after transport endpoint shutdown. |
a0ddea87 | 540 | .TP |
0daa9e92 | 541 | .B ESPIPE |
5a63455f | 542 | Invalid seek (POSIX.1-2001). |
a0ddea87 | 543 | .TP |
0daa9e92 | 544 | .B ESOCKTNOSUPPORT |
31071798 | 545 | Socket type not supported. |
a0ddea87 | 546 | .TP |
0daa9e92 | 547 | .B ESRCH |
5a63455f | 548 | No such process (POSIX.1-2001). |
a0ddea87 MK |
549 | .\" ESRMNT is defined but appears not to be used |
550 | .TP | |
0daa9e92 | 551 | .B ESTALE |
5a63455f | 552 | Stale file handle (POSIX.1-2001). |
ba39b288 | 553 | .IP |
31071798 | 554 | This error can occur for NFS and for other filesystems. |
a0ddea87 | 555 | .TP |
0daa9e92 | 556 | .B ESTRPIPE |
31071798 | 557 | Streams pipe error. |
a0ddea87 | 558 | .TP |
0daa9e92 | 559 | .B ETIME |
5db92f96 MK |
560 | Timer expired |
561 | (POSIX.1 (XSI STREAMS option)). | |
ba39b288 | 562 | .IP |
c13182ef | 563 | (POSIX.1 says "STREAM |
363a3cc9 | 564 | .BR ioctl (2) |
5db92f96 | 565 | timeout".) |
a0ddea87 | 566 | .TP |
0daa9e92 | 567 | .B ETIMEDOUT |
5a63455f | 568 | Connection timed out (POSIX.1-2001). |
975c0f87 MK |
569 | .TP |
570 | .B ETOOMANYREFS | |
571 | .\" ETOOMANYREFS seems to be used in net/unix/af_unix.c | |
572 | Too many references: cannot splice. | |
a0ddea87 | 573 | .TP |
0daa9e92 | 574 | .B ETXTBSY |
5a63455f | 575 | Text file busy (POSIX.1-2001). |
fea681da | 576 | .TP |
0daa9e92 | 577 | .B EUCLEAN |
31071798 | 578 | Structure needs cleaning. |
fea681da | 579 | .TP |
0daa9e92 | 580 | .B EUNATCH |
31071798 | 581 | Protocol driver not attached. |
fea681da | 582 | .TP |
0daa9e92 | 583 | .B EUSERS |
31071798 | 584 | Too many users. |
a0ddea87 | 585 | .TP |
0daa9e92 | 586 | .B EWOULDBLOCK |
fea681da | 587 | Operation would block (may be same value as |
c13182ef | 588 | .BR EAGAIN ) |
5a63455f | 589 | (POSIX.1-2001). |
a0ddea87 | 590 | .TP |
0daa9e92 | 591 | .B EXDEV |
5a63455f | 592 | Improper link (POSIX.1-2001). |
fea681da | 593 | .TP |
a0ddea87 | 594 | .B EXFULL |
31071798 | 595 | Exchange full. |
05432883 | 596 | .SH NOTES |
fea681da | 597 | A common mistake is to do |
e646a1ba | 598 | .PP |
a6e2f128 | 599 | .in +4n |
e646a1ba | 600 | .EX |
2bc2f479 | 601 | if (somecall() == \-1) { |
31a6818e | 602 | printf("somecall() failed\en"); |
fea681da MK |
603 | if (errno == ...) { ... } |
604 | } | |
e646a1ba | 605 | .EE |
a6e2f128 | 606 | .in |
e646a1ba | 607 | .PP |
fea681da MK |
608 | where |
609 | .I errno | |
610 | no longer needs to have the value it had upon return from | |
63aa9df0 | 611 | .IR somecall () |
05432883 | 612 | (i.e., it may have been changed by the |
fb186734 | 613 | .BR printf (3)). |
fea681da MK |
614 | If the value of |
615 | .I errno | |
616 | should be preserved across a library call, it must be saved: | |
e646a1ba | 617 | .PP |
a6e2f128 | 618 | .in +4n |
e646a1ba | 619 | .EX |
2bc2f479 | 620 | if (somecall() == \-1) { |
fea681da | 621 | int errsv = errno; |
31a6818e | 622 | printf("somecall() failed\en"); |
fea681da MK |
623 | if (errsv == ...) { ... } |
624 | } | |
b8302363 | 625 | .EE |
a6e2f128 | 626 | .in |
05432883 | 627 | .PP |
7497e9d8 MK |
628 | Note that the POSIX threads APIs do |
629 | .I not | |
630 | set | |
631 | .I errno | |
632 | on error. | |
633 | Instead, on failure they return an error number as the function result. | |
634 | These error numbers have the same meanings as the error numbers returned in | |
635 | .I errno | |
636 | by other APIs. | |
637 | .PP | |
6eb4b782 MK |
638 | On some ancient systems, |
639 | .I <errno.h> | |
640 | was not present or did not declare | |
641 | .IR errno , | |
642 | so that it was necessary to declare | |
05432883 MK |
643 | .I errno |
644 | manually | |
c13182ef | 645 | (i.e., |
6eb4b782 | 646 | .IR "extern int errno" ). |
05432883 | 647 | .BR "Do not do this" . |
6eb4b782 MK |
648 | It long ago ceased to be necessary, |
649 | and it will cause problems with modern versions of the C library. | |
47297adb | 650 | .SH SEE ALSO |
00f3b66d | 651 | .BR errno (1), \" In the moreutils package |
d7871cf9 | 652 | .BR err (3), |
37b6aec3 | 653 | .BR error (3), |
fea681da MK |
654 | .BR perror (3), |
655 | .BR strerror (3) |