linux系统中errno与error对照表

时间:2022-07-16 12:44:46

1、使用了一个小程序输出所有的errno对应的error字符串,代码如下

#include <errno.h>

void showError(int err)
{
  printf("errno : %5d , error : %s\n", err, strerror(err));
}

void showAllErr() 
{
  int i = 0; 
  for(;i < 256; i++)
  {
    showError(i);
  }
}

int main(int argc, char * argv[])
{
  showAllErr();

  return 0;
}

2、运行上面代码,结果如下

errno : 0 , error : Success
errno : 1 , error : Operation not permitted
errno : 2 , error : No such file or directory
errno : 3 , error : No such process
errno : 4 , error : Interrupted system call
errno : 5 , error : Input/output error
errno : 6 , error : No such device or address
errno : 7 , error : Argument list too long
errno : 8 , error : Exec format error
errno : 9 , error : Bad file descriptor
errno : 10 , error : No child processes
errno : 11 , error : Resource temporarily unavailable
errno : 12 , error : Cannot allocate memory
errno : 13 , error : Permission denied
errno : 14 , error : Bad address
errno : 15 , error : Block device required
errno : 16 , error : Device or resource busy
errno : 17 , error : File exists
errno : 18 , error : Invalid cross-device link
errno : 19 , error : No such device
errno : 20 , error : Not a directory
errno : 21 , error : Is a directory
errno : 22 , error : Invalid argument
errno : 23 , error : Too many open files in system
errno : 24 , error : Too many open files
errno : 25 , error : Inappropriate ioctl for device
errno : 26 , error : Text file busy
errno : 27 , error : File too large
errno : 28 , error : No space left on device
errno : 29 , error : Illegal seek
errno : 30 , error : Read-only file system
errno : 31 , error : Too many links
errno : 32 , error : Broken pipe
errno : 33 , error : Numerical argument out of domain
errno : 34 , error : Numerical result out of range
errno : 35 , error : Resource deadlock avoided
errno : 36 , error : File name too long
errno : 37 , error : No locks available
errno : 38 , error : Function not implemented
errno : 39 , error : Directory not empty
errno : 40 , error : Too many levels of symbolic links
errno : 41 , error : Unknown error 41
errno : 42 , error : No message of desired type
errno : 43 , error : Identifier removed
errno : 44 , error : Channel number out of range
errno : 45 , error : Level 2 not synchronized
errno : 46 , error : Level 3 halted
errno : 47 , error : Level 3 reset
errno : 48 , error : Link number out of range
errno : 49 , error : Protocol driver not attached
errno : 50 , error : No CSI structure available
errno : 51 , error : Level 2 halted
errno : 52 , error : Invalid exchange
errno : 53 , error : Invalid request descriptor
errno : 54 , error : Exchange full
errno : 55 , error : No anode
errno : 56 , error : Invalid request code
errno : 57 , error : Invalid slot
errno : 58 , error : Unknown error 58
errno : 59 , error : Bad font file format
errno : 60 , error : Device not a stream
errno : 61 , error : No data available
errno : 62 , error : Timer expired
errno : 63 , error : Out of streams resources
errno : 64 , error : Machine is not on the network
errno : 65 , error : Package not installed
errno : 66 , error : Object is remote
errno : 67 , error : Link has been severed
errno : 68 , error : Advertise error
errno : 69 , error : Srmount error
errno : 70 , error : Communication error on send
errno : 71 , error : Protocol error
errno : 72 , error : Multihop attempted
errno : 73 , error : RFS specific error
errno : 74 , error : Bad message
errno : 75 , error : Value too large for defined data type
errno : 76 , error : Name not unique on network
errno : 77 , error : File descriptor in bad state
errno : 78 , error : Remote address changed
errno : 79 , error : Can not access a needed shared library
errno : 80 , error : Accessing a corrupted shared library
errno : 81 , error : .lib section in a.out corrupted
errno : 82 , error : Attempting to link in too many shared libraries
errno : 83 , error : Cannot exec a shared library directly
errno : 84 , error : Invalid or incomplete multibyte or wide character
errno : 85 , error : Interrupted system call should be restarted
errno : 86 , error : Streams pipe error
errno : 87 , error : Too many users
errno : 88 , error : Socket operation on non-socket
errno : 89 , error : Destination address required
errno : 90 , error : Message too long
errno : 91 , error : Protocol wrong type for socket
errno : 92 , error : Protocol not available
errno : 93 , error : Protocol not supported
errno : 94 , error : Socket type not supported
errno : 95 , error : Operation not supported
errno : 96 , error : Protocol family not supported
errno : 97 , error : Address family not supported by protocol
errno : 98 , error : Address already in use
errno : 99 , error : Cannot assign requested address
errno : 100 , error : Network is down
errno : 101 , error : Network is unreachable
errno : 102 , error : Network dropped connection on reset
errno : 103 , error : Software caused connection abort
errno : 104 , error : Connection reset by peer
errno : 105 , error : No buffer space available
errno : 106 , error : Transport endpoint is already connected
errno : 107 , error : Transport endpoint is not connected
errno : 108 , error : Cannot send after transport endpoint shutdown
errno : 109 , error : Too many references: cannot splice
errno : 110 , error : Connection timed out
errno : 111 , error : Connection refused
errno : 112 , error : Host is down
errno : 113 , error : No route to host
errno : 114 , error : Operation already in progress
errno : 115 , error : Operation now in progress
errno : 116 , error : Stale file handle
errno : 117 , error : Structure needs cleaning
errno : 118 , error : Not a XENIX named type file
errno : 119 , error : No XENIX semaphores available
errno : 120 , error : Is a named type file
errno : 121 , error : Remote I/O error
errno : 122 , error : Disk quota exceeded
errno : 123 , error : No medium found
errno : 124 , error : Wrong medium type
errno : 125 , error : Operation canceled
errno : 126 , error : Required key not available
errno : 127 , error : Key has expired
errno : 128 , error : Key has been revoked
errno : 129 , error : Key was rejected by service
errno : 130 , error : Owner died
errno : 131 , error : State not recoverable
errno : 132 , error : Operation not possible due to RF-kill
errno : 133 , error : Unknown error 133
.

.

.

errno : 255 , error : Unknown error 255

当errno到达134的时候就没有错误了~