Programmers should handle all kinds of errors to protect the program from failure.
In C programming language, there is no direct support for error handling. You have to detect the failure and handle the error. In C programming language, return values represents success or failure. Inside a C program, when a function fails, you should handle the errors accordingly, or at least record the errors in a log file.
When you are running some program on Linux environment, you might notice that it gives some error number. For example, “Error no is : 17”, which doesn’t really say much. You really need to know what error number 17 means.
This article shows all available error numbers along with it descriptions. This article might be a handy reference for you, when you encounter an error number and you would like to know what it means.
- In C programming language, there is an external variable called “errno”.
- From this errno variable you can use some error handling functions to find out the error description and handle it appropriately.
- You have to include errno.h header file to use external variable errno.
- perror function prints error description in standard error.
- The strerror function returns a string describing the error code passed in the argument errnum.
The following C code snippet tries to open a file through open system call. There are two flags in the open call. O_CREAT flag is to create a file, if the file does not exist. O_EXCL flag is used with O_CREAT, if the file is already exist open call will fail with the proper error number.
$ cat fileopen.c #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <string.h> main() { // Declaration of a file descriptor int fd; // Opening a file fd = open("/root/sasikala/testing",O_CREAT|O_EXCL); // If Open is failed if ( fd < 0 ) { printf("Opening file : Failedn"); printf ("Error no is : %dn", errno); printf("Error description is : %sn",strerror(errno)); } // If Open is success else printf("Opening file : Successn"); } $ cc -o fileopen fileopen.c $ ./fileopen Opening file : Success $ ./fileopen Opening file : Failed Error no is : 17 Error description is : File exists
At first execution, open got executed successfully, and it created the file since the file was not available. In next execution, it throws an error number 17, which is “File already exist”.
The following table shows list of error numbers and its descriptions in Linux operation system
ERROR CODE TABLE | ||
---|---|---|
Error number | Error Code | Error Description |
1 | EPERM | Operation not permitted |
2 | ENOENT | No such file or directory |
3 | ESRCH | No such process |
4 | EINTR | Interrupted system call |
5 | EIO | I/O error |
6 | ENXIO | No such device or address |
7 | E2BIG | Argument list too long |
8 | ENOEXEC | Exec format error |
9 | EBADF | Bad file number |
10 | ECHILD | No child processes |
11 | EAGAIN | Try again |
12 | ENOMEM | Out of memory |
13 | EACCES | Permission denied |
14 | EFAULT | Bad address |
15 | ENOTBLK | Block device required |
16 | EBUSY | Device or resource busy |
17 | EEXIST | File exists |
18 | EXDEV | Cross-device link |
19 | ENODEV | No such device |
20 | ENOTDIR | Not a directory |
21 | EISDIR | Is a directory |
22 | EINVAL | Invalid argument |
23 | ENFILE | File table overflow |
24 | EMFILE | Too many open files |
25 | ENOTTY | Not a typewriter |
26 | ETXTBSY | Text file busy |
27 | EFBIG | File too large |
28 | ENOSPC | No space left on device |
29 | ESPIPE | Illegal seek |
30 | EROFS | Read-only file system |
31 | EMLINK | Too many links |
32 | EPIPE | Broken pipe |
33 | EDOM | Math argument out of domain of func |
34 | ERANGE | Math result not representable |
35 | EDEADLK | Resource deadlock would occur |
36 | ENAMETOOLONG | File name too long |
37 | ENOLCK | No record locks available |
38 | ENOSYS | Function not implemented |
39 | ENOTEMPTY | Directory not empty |
40 | ELOOP | Too many symbolic links encountered |
42 | ENOMSG | No message of desired type |
43 | EIDRM | Identifier removed |
44 | ECHRNG | Channel number out of range |
45 | EL2NSYNC | Level 2 not synchronized |
46 | EL3HLT | Level 3 halted |
47 | EL3RST | Level 3 reset |
48 | ELNRNG | Link number out of range |
49 | EUNATCH | Protocol driver not attached |
50 | ENOCSI | No CSI structure available |
51 | EL2HLT | Level 2 halted |
52 | EBADE | Invalid exchange |
53 | EBADR | Invalid request descriptor |
54 | EXFULL | Exchange full |
55 | ENOANO | No anode |
56 | EBADRQC | Invalid request code |
57 | EBADSLT | Invalid slot |
59 | EBFONT | Bad font file format |
60 | ENOSTR | Device not a stream |
61 | ENODATA | No data available |
62 | ETIME | Timer expired |
63 | ENOSR | Out of streams resources |
64 | ENONET | Machine is not on the network |
65 | ENOPKG | Package not installed |
66 | EREMOTE | Object is remote |
67 | ENOLINK | Link has been severed |
68 | EADV | Advertise error |
69 | ESRMNT | Srmount error |
70 | ECOMM | Communication error on send |
71 | EPROTO | Protocol error |
72 | EMULTIHOP | Multihop attempted |
73 | EDOTDOT | RFS specific error |
74 | EBADMSG | Not a data message |
75 | EOVERFLOW | Value too large for defined data type |
76 | ENOTUNIQ | Name not unique on network |
77 | EBADFD | File descriptor in bad state |
78 | EREMCHG | Remote address changed |
79 | ELIBACC | Can not access a needed shared library |
80 | ELIBBAD | Accessing a corrupted shared library |
81 | ELIBSCN | .lib section in a.out corrupted |
82 | ELIBMAX | Attempting to link in too many shared libraries |
83 | ELIBEXEC | Cannot exec a shared library directly |
84 | EILSEQ | Illegal byte sequence |
85 | ERESTART | Interrupted system call should be restarted |
86 | ESTRPIPE | Streams pipe error |
87 | EUSERS | Too many users |
88 | ENOTSOCK | Socket operation on non-socket |
89 | EDESTADDRREQ | Destination address required |
90 | EMSGSIZE | Message too long |
91 | EPROTOTYPE | Protocol wrong type for socket |
92 | ENOPROTOOPT | Protocol not available |
93 | EPROTONOSUPPORT | Protocol not supported |
94 | ESOCKTNOSUPPORT | Socket type not supported |
95 | EOPNOTSUPP | Operation not supported on transport endpoint |
96 | EPFNOSUPPORT | Protocol family not supported |
97 | EAFNOSUPPORT | Address family not supported by protocol |
98 | EADDRINUSE | Address already in use |
99 | EADDRNOTAVAIL | Cannot assign requested address |
100 | ENETDOWN | Network is down |
101 | ENETUNREACH | Network is unreachable |
102 | ENETRESET | Network dropped connection because of reset |
103 | ECONNABORTED | Software caused connection abort |
104 | ECONNRESET | Connection reset by peer |
105 | ENOBUFS | No buffer space available |
106 | EISCONN | Transport endpoint is already connected |
107 | ENOTCONN | Transport endpoint is not connected |
108 | ESHUTDOWN | Cannot send after transport endpoint shutdown |
109 | ETOOMANYREFS | Too many references: cannot splice |
110 | ETIMEDOUT | Connection timed out |
111 | ECONNREFUSED | Connection refused |
112 | EHOSTDOWN | Host is down |
113 | EHOSTUNREACH | No route to host |
114 | EALREADY | Operation already in progress |
115 | EINPROGRESS | Operation now in progress |
116 | ESTALE | Stale NFS file handle |
117 | EUCLEAN | Structure needs cleaning |
118 | ENOTNAM | Not a XENIX named type file |
119 | ENAVAIL | No XENIX semaphores available |
120 | EISNAM | Is a named type file |
121 | EREMOTEIO | Remote I/O error |
122 | EDQUOT | Quota exceeded |
123 | ENOMEDIUM | No medium found |
124 | EMEDIUMTYPE | Wrong medium type |
125 | ECANCELED | Operation Canceled |
126 | ENOKEY | Required key not available |
127 | EKEYEXPIRED | Key has expired |
128 | EKEYREVOKED | Key has been revoked |
129 | EKEYREJECTED | Key was rejected by service |
130 | EOWNERDEAD | Owner died |
131 | ENOTRECOVERABLE | State not recoverable |
When you see an error number thrown by a C program on a Linux environment, you might find the above table handy to identify what those error number means. Make sure to bookmark this article for future reference.
Errno 1: Operation not permitted
Errno 2: No such file or directory
Errno 3: No such process
Errno 4: Interrupted system call
Errno 5: Input/output error
Errno 6: No such device or address
Errno 7: Argument list too long
Errno 8: Exec format error
Errno 9: Bad file descriptor
Errno 10: No child processes
Errno 11: Resource temporarily unavailable
Errno 12: Cannot allocate memory
Errno 13: Permission denied
Errno 14: Bad address
Errno 15: Block device required
Errno 16: Device or resource busy
Errno 17: File exists
Errno 18: Invalid cross-device link
Errno 19: No such device
Errno 20: Not a directory
Errno 21: Is a directory
Errno 22: Invalid argument
Errno 23: Too many open files in system
Errno 24: Too many open files
Errno 25: Inappropriate ioctl for device
Errno 26: Text file busy
Errno 27: File too large
Errno 28: No space left on device
Errno 29: Illegal seek
Errno 30: Read-only file system
Errno 31: Too many links
Errno 32: Broken pipe
Errno 33: Numerical argument out of domain
Errno 34: Numerical result out of range
Errno 35: Resource deadlock avoided
Errno 36: File name too long
Errno 37: No locks available
Errno 38: Function not implemented
Errno 39: Directory not empty
Errno 40: Too many levels of symbolic links
Errno 41: Unknown error 41
Errno 42: No message of desired type
Errno 43: Identifier removed
Errno 44: Channel number out of range
Errno 45: Level 2 not synchronized
Errno 46: Level 3 halted
Errno 47: Level 3 reset
Errno 48: Link number out of range
Errno 49: Protocol driver not attached
Errno 50: No CSI structure available
Errno 51: Level 2 halted
Errno 52: Invalid exchange
Errno 53: Invalid request descriptor
Errno 54: Exchange full
Errno 55: No anode
Errno 56: Invalid request code
Errno 57: Invalid slot
Errno 58: Unknown error 58
Errno 59: Bad font file format
Errno 60: Device not a stream
Errno 61: No data available
Errno 62: Timer expired
Errno 63: Out of streams resources
Errno 64: Machine is not on the network
Errno 65: Package not installed
If you find this page
helpful, please consider
visiting my sponsors.
Your ad revenue
supports this site.
Errno 67: Link has been severed
Errno 68: Advertise error
Errno 69: Srmount error
Errno 70: Communication error on send
Errno 71: Protocol error
Errno 72: Multihop attempted
Errno 73: RFS specific error
Errno 74: Bad message
Errno 75: Value too large for defined data type
Errno 76: Name not unique on network
Errno 77: File descriptor in bad state
Errno 78: Remote address changed
Errno 79: Can not access a needed shared library
Errno 80: Accessing a corrupted shared library
Errno 81: .lib section in a.out corrupted
Errno 82: Attempting to link in too many shared libraries
Errno 83: Cannot exec a shared library directly
Errno 84: Invalid or incomplete multibyte or wide character
Errno 85: Interrupted system call should be restarted
Errno 86: Streams pipe error
Errno 87: Too many users
Errno 88: Socket operation on non-socket
Errno 89: Destination address required
Errno 90: Message too long
Errno 91: Protocol wrong type for socket
Errno 92: Protocol not available
Errno 93: Protocol not supported
Errno 94: Socket type not supported
Errno 95: Operation not supported
Errno 96: Protocol family not supported
Errno 97: Address family not supported by protocol
Errno 98: Address already in use
Errno 99: Cannot assign requested address
Errno 100: Network is down
Errno 101: Network is unreachable
Errno 102: Network dropped connection on reset
Errno 103: Software caused connection abort
Errno 104: Connection reset by peer
Errno 105: No buffer space available
Errno 106: Transport endpoint is already connected
Errno 107: Transport endpoint is not connected
Errno 108: Cannot send after transport endpoint shutdown
Errno 109: Too many references: cannot splice
Errno 110: Connection timed out
Errno 111: Connection refused
Errno 112: Host is down
Errno 113: No route to host
Errno 114: Operation already in progress
Errno 115: Operation now in progress
Errno 116: Stale NFS file handle
Errno 117: Structure needs cleaning
Errno 118: Not a XENIX named type file
Errno 119: No XENIX semaphores available
Errno 120: Is a named type file
Errno 121: Remote I/O error
Errno 122: Disk quota exceeded
Errno 123: No medium found
Errno 124: Wrong medium type
Errno 125: Operation canceled
Errno 126: Required key not available
Errno 127: Key has expired
Errno 128: Key has been revoked
Errno 129: Key was rejected by service
Errno 130: Owner died
Errno 131: State not recoverable
Errno 132: Unknown error 132
Each of the macros defined in <errno.h>
expands to an integer constant expression with type int and with a unique positive value. The following constants are defined by ISO C. The implementation may define more, as long as they begin with ‘E’ followed by digits or uppercase letters.
Defined in header |
|
Mathematics argument out of domain of function (macro constant) |
|
Illegal byte sequence (macro constant) |
|
Result too large (macro constant) |
[edit] Notes
Many additional errno constants are defined by POSIX and by the C++ standard library, and individual implementations may define even more, e.g. errno(3)
on Linux or intro(2)
on BSD and OS X.
[edit] Example
#include <stdio.h> #include <math.h> #include <errno.h> #include <string.h> int main(void) { errno = 0; printf("log(-1.0) = %fn", log(-1.0)); printf("%snn",strerror(errno)); errno = 0; printf("log(0.0) = %fn", log(0.0)); printf("%sn",strerror(errno)); }
Possible output:
log(-1.0) = nan Numerical argument out of domain log(0.0) = -inf Numerical result out of range
[edit] References
- C11 standard (ISO/IEC 9899:2011):
-
- 7.5/2 Errors <errno.h> (p: 205)
- C99 standard (ISO/IEC 9899:1999):
-
- 7.5/2 Errors <errno.h> (p: 186)
- C89/C90 standard (ISO/IEC 9899:1990):
-
- 4.1.3 Errors <errno.h>
[edit] See also
NAME¶
errno — number of last error
SYNOPSIS¶
#include <errno.h>
DESCRIPTION¶
The <errno.h> header file defines the integer variable
errno, which is set by system calls and some library functions in the
event of an error to indicate what went wrong.
The value in errno is significant only when the return value of the call
indicated an error (i.e., -1 from most system calls; -1 or NULL from most
library functions); a function that succeeds is allowed to change
errno. The value of errno is never set to zero by any system
call or library function.
For some system calls and library functions (e.g.,
getpriority(2)), -1 is a valid return on success. In such cases, a
successful return can be distinguished from an error return by setting
errno to zero before the call, and then, if the call returns a status
that indicates that an error may have occurred, checking to see if
errno has a nonzero value.
errno is defined by the ISO C standard to be a modifiable
lvalue of type int, and must not be explicitly declared; errno
may be a macro. errno is thread-local; setting it in one thread does
not affect its value in any other thread.
Error numbers and names¶
Valid error numbers are all positive numbers. The <errno.h> header
file defines symbolic names for each of the possible error numbers that may
appear in errno.
All the error names specified by POSIX.1 must have distinct
values, with the exception of EAGAIN and EWOULDBLOCK, which
may be the same. On Linux, these two have the same value on all
architectures.
The error numbers that correspond to each symbolic name vary
across UNIX systems, and even across different architectures on Linux.
Therefore, numeric values are not included as part of the list of error
names below. The perror(3) and strerror(3) functions can be
used to convert these names to corresponding textual error messages.
On any particular Linux system, one can obtain a list of all
symbolic error names and the corresponding error numbers using the
errno(1) command (part of the moreutils package):
$ errno -l EPERM 1 Operation not permitted ENOENT 2 No such file or directory ESRCH 3 No such process EINTR 4 Interrupted system call EIO 5 Input/output error ...
The errno(1) command can also be used to look up individual
error numbers and names, and to search for errors using strings from the
error description, as in the following examples:
$ errno 2 ENOENT 2 No such file or directory $ errno ESRCH ESRCH 3 No such process $ errno -s permission EACCES 13 Permission denied
List of error names¶
In the list of the symbolic error names below, various names are marked as
follows:
- POSIX.1-2001: The name is defined by POSIX.1-2001, and is defined
in later POSIX.1 versions, unless otherwise indicated. - POSIX.1-2008: The name is defined in POSIX.1-2008, but was not
present in earlier POSIX.1 standards. - C99: The name is defined by C99. Below is a list of the symbolic
error names that are defined on Linux:
- E2BIG
- Argument list too long (POSIX.1-2001).
- EACCES
- Permission denied (POSIX.1-2001).
- EADDRINUSE
- Address already in use (POSIX.1-2001).
- EADDRNOTAVAIL
- Address not available (POSIX.1-2001).
- EAFNOSUPPORT
- Address family not supported (POSIX.1-2001).
- EAGAIN
- Resource temporarily unavailable (may be the same value as
EWOULDBLOCK) (POSIX.1-2001). - EALREADY
- Connection already in progress (POSIX.1-2001).
- EBADE
- Invalid exchange.
- EBADF
- Bad file descriptor (POSIX.1-2001).
- EBADFD
- File descriptor in bad state.
- EBADMSG
- Bad message (POSIX.1-2001).
- EBADR
- Invalid request descriptor.
- EBADRQC
- Invalid request code.
- EBADSLT
- Invalid slot.
- EBUSY
- Device or resource busy (POSIX.1-2001).
- ECANCELED
- Operation canceled (POSIX.1-2001).
- ECHILD
- No child processes (POSIX.1-2001).
- ECHRNG
- Channel number out of range.
- ECOMM
- Communication error on send.
- ECONNABORTED
- Connection aborted (POSIX.1-2001).
- ECONNREFUSED
- Connection refused (POSIX.1-2001).
- ECONNRESET
- Connection reset (POSIX.1-2001).
- EDEADLK
- Resource deadlock avoided (POSIX.1-2001).
- EDEADLOCK
- On most architectures, a synonym for EDEADLK. On some architectures
(e.g., Linux MIPS, PowerPC, SPARC), it is a separate error code «File
locking deadlock error». - EDESTADDRREQ
- Destination address required (POSIX.1-2001).
- EDOM
- Mathematics argument out of domain of function (POSIX.1, C99).
- EDQUOT
- Disk quota exceeded (POSIX.1-2001).
- EEXIST
- File exists (POSIX.1-2001).
- EFAULT
- Bad address (POSIX.1-2001).
- EFBIG
- File too large (POSIX.1-2001).
- EHOSTDOWN
- Host is down.
- EHOSTUNREACH
- Host is unreachable (POSIX.1-2001).
- EHWPOISON
- Memory page has hardware error.
- EIDRM
- Identifier removed (POSIX.1-2001).
- EILSEQ
- Invalid or incomplete multibyte or wide character (POSIX.1, C99).
- The text shown here is the glibc error description; in POSIX.1, this error
is described as «Illegal byte sequence».
- EINPROGRESS
- Operation in progress (POSIX.1-2001).
- EINTR
- Interrupted function call (POSIX.1-2001); see signal(7).
- EINVAL
- Invalid argument (POSIX.1-2001).
- EIO
- Input/output error (POSIX.1-2001).
- EISCONN
- Socket is connected (POSIX.1-2001).
- EISDIR
- Is a directory (POSIX.1-2001).
- EISNAM
- Is a named type file.
- EKEYEXPIRED
- Key has expired.
- EKEYREJECTED
- Key was rejected by service.
- EKEYREVOKED
- Key has been revoked.
- EL2HLT
- Level 2 halted.
- EL2NSYNC
- Level 2 not synchronized.
- EL3HLT
- Level 3 halted.
- EL3RST
- Level 3 reset.
- ELIBACC
- Cannot access a needed shared library.
- ELIBBAD
- Accessing a corrupted shared library.
- ELIBMAX
- Attempting to link in too many shared libraries.
- ELIBSCN
- .lib section in a.out corrupted
- ELIBEXEC
- Cannot exec a shared library directly.
- ELNRANGE
- Link number out of range.
- ELOOP
- Too many levels of symbolic links (POSIX.1-2001).
- EMEDIUMTYPE
- Wrong medium type.
- EMFILE
- Too many open files (POSIX.1-2001). Commonly caused by exceeding the
RLIMIT_NOFILE resource limit described in getrlimit(2). - EMLINK
- Too many links (POSIX.1-2001).
- EMSGSIZE
- Message too long (POSIX.1-2001).
- EMULTIHOP
- Multihop attempted (POSIX.1-2001).
- ENAMETOOLONG
- Filename too long (POSIX.1-2001).
- ENETDOWN
- Network is down (POSIX.1-2001).
- ENETRESET
- Connection aborted by network (POSIX.1-2001).
- ENETUNREACH
- Network unreachable (POSIX.1-2001).
- ENFILE
- Too many open files in system (POSIX.1-2001). On Linux, this is probably a
result of encountering the /proc/sys/fs/file-max limit (see
proc(5)). - ENOANO
- No anode.
- ENOBUFS
- No buffer space available (POSIX.1 (XSI STREAMS option)).
- ENODATA
- No message is available on the STREAM head read queue (POSIX.1-2001).
- ENODEV
- No such device (POSIX.1-2001).
- ENOENT
- No such file or directory (POSIX.1-2001).
- Typically, this error results when a specified pathname does not exist, or
one of the components in the directory prefix of a pathname does not
exist, or the specified pathname is a dangling symbolic link.
- ENOEXEC
- Exec format error (POSIX.1-2001).
- ENOKEY
- Required key not available.
- ENOLCK
- No locks available (POSIX.1-2001).
- ENOLINK
- Link has been severed (POSIX.1-2001).
- ENOMEDIUM
- No medium found.
- ENOMEM
- Not enough space/cannot allocate memory (POSIX.1-2001).
- ENOMSG
- No message of the desired type (POSIX.1-2001).
- ENONET
- Machine is not on the network.
- ENOPKG
- Package not installed.
- ENOPROTOOPT
- Protocol not available (POSIX.1-2001).
- ENOSPC
- No space left on device (POSIX.1-2001).
- ENOSR
- No STREAM resources (POSIX.1 (XSI STREAMS option)).
- ENOSTR
- Not a STREAM (POSIX.1 (XSI STREAMS option)).
- ENOSYS
- Function not implemented (POSIX.1-2001).
- ENOTBLK
- Block device required.
- ENOTCONN
- The socket is not connected (POSIX.1-2001).
- ENOTDIR
- Not a directory (POSIX.1-2001).
- ENOTEMPTY
- Directory not empty (POSIX.1-2001).
- ENOTRECOVERABLE
- State not recoverable (POSIX.1-2008).
- ENOTSOCK
- Not a socket (POSIX.1-2001).
- ENOTSUP
- Operation not supported (POSIX.1-2001).
- ENOTTY
- Inappropriate I/O control operation (POSIX.1-2001).
- ENOTUNIQ
- Name not unique on network.
- ENXIO
- No such device or address (POSIX.1-2001).
- EOPNOTSUPP
- Operation not supported on socket (POSIX.1-2001).
- (ENOTSUP and EOPNOTSUPP have the same value on Linux, but
according to POSIX.1 these error values should be distinct.)
- EOVERFLOW
- Value too large to be stored in data type (POSIX.1-2001).
- EOWNERDEAD
- Owner died (POSIX.1-2008).
- EPERM
- Operation not permitted (POSIX.1-2001).
- EPFNOSUPPORT
- Protocol family not supported.
- EPIPE
- Broken pipe (POSIX.1-2001).
- EPROTO
- Protocol error (POSIX.1-2001).
- EPROTONOSUPPORT
- Protocol not supported (POSIX.1-2001).
- EPROTOTYPE
- Protocol wrong type for socket (POSIX.1-2001).
- ERANGE
- Result too large (POSIX.1, C99).
- EREMCHG
- Remote address changed.
- EREMOTE
- Object is remote.
- EREMOTEIO
- Remote I/O error.
- ERESTART
- Interrupted system call should be restarted.
- ERFKILL
- Operation not possible due to RF-kill.
- EROFS
- Read-only filesystem (POSIX.1-2001).
- ESHUTDOWN
- Cannot send after transport endpoint shutdown.
- ESPIPE
- Invalid seek (POSIX.1-2001).
- ESOCKTNOSUPPORT
- Socket type not supported.
- ESRCH
- No such process (POSIX.1-2001).
- ESTALE
- Stale file handle (POSIX.1-2001).
- This error can occur for NFS and for other filesystems.
- ESTRPIPE
- Streams pipe error.
- ETIME
- Timer expired (POSIX.1 (XSI STREAMS option)).
- (POSIX.1 says «STREAM ioctl(2) timeout».)
- ETIMEDOUT
- Connection timed out (POSIX.1-2001).
- ETOOMANYREFS
- Too many references: cannot splice.
- ETXTBSY
- Text file busy (POSIX.1-2001).
- EUCLEAN
- Structure needs cleaning.
- EUNATCH
- Protocol driver not attached.
- EUSERS
- Too many users.
- EWOULDBLOCK
- Operation would block (may be same value as EAGAIN)
(POSIX.1-2001). - EXDEV
- Improper link (POSIX.1-2001).
- EXFULL
- Exchange full.
NOTES¶
A common mistake is to do
if (somecall() == -1) { printf("somecall() failedn"); if (errno == ...) { ... } }
where errno no longer needs to have the value it had upon
return from somecall() (i.e., it may have been changed by the
printf(3)). If the value of errno should be preserved across a
library call, it must be saved:
if (somecall() == -1) { int errsv = errno; printf("somecall() failedn"); if (errsv == ...) { ... } }
On some ancient systems, <errno.h> was not present or
did not declare errno, so that it was necessary to declare
errno manually (i.e., extern int errno). Do not do
this. It long ago ceased to be necessary, and it will cause problems
with modern versions of the C library.
SEE ALSO¶
errno(1), err(3), error(3), perror(3),
strerror(3)
COLOPHON¶
This page is part of release 5.04 of the Linux man-pages project. A
description of the project, information about reporting bugs, and the latest
version of this page, can be found at https://www.kernel.org/doc/man-pages/.