When I was working on projects recently , The program pops up an error number when it crashes , Then search for error information based on the error number , It will be solved soon , It is hereby recorded .

When the program fails , We use the global variable error number errno and perror Function can quickly locate the cause of the error .
Linux Error code and its meaning

C Name Value Description meaning
Success 0 Success success
EPERM 1 Operation not permitted operation not permitted
ENOENT 2 No such file or directory There is no such file or directory
ESRCH 3 No such process There is no such process
EINTR 4 Interrupted system call The system call was interrupted
EIO 5 I/O error I/O error
ENXIO 6 No such device or address There is no such device or address
E2BIG 7 Arg list too long Parameter list too long
ENOEXEC 8 Exec format error Execution format error
EBADF 9 Bad file number bad file descriptor
ECHILD 10 No child processes There are no child processes
EAGAIN 11 Try again resource temporarily unavailable
ENOMEM 12 Out of memory out of memory
EACCES 13 Permission denied permission refused
EFAULT 14 Bad address bad address
ENOTBLK 15 Block device required Block device request
EBUSY 16 Device or resource busy Device or resource busy
EEXIST 17 File exists File exists
EXDEV 18 Cross-device link Invalid cross link
ENODEV 19 No such device Device does not exist
ENOTDIR 20 Not a directory Not a directory
EISDIR 21 Is a directory It's a directory
EINVAL 22 Invalid argument Invalid parameter for
ENFILE* 23 File table overflow Open too many file systems
EMFILE 24 Too many open files Too many open files
ENOTTY 25 Not a tty device no tty equipment
ETXTBSY 26 Text file busy Text file busy
EFBIG 27 File too large The file is too large
ENOSPC 28 No space left on device There is no space on the device
ESPIPE 29 Illegal seek Illegal displacement
EROFS 30 Read-only file system Read-only file system
EMLINK 31 Too many links Too many links
EPIPE 32 Broken pipe Pipeline rupture
EDOM 33 Math argument out of domain The numerical result is out of range
ERANGE 34 Math result not representable The numerical results are not representative
EDEADLK 35 Resource deadlock would occur Resource deadlock error
ENAMETOOLONG 36 Filename too long file name is too long
ENOLCK 37 No record locks available No locks available
ENOSYS 38 Function not implemented The function is not implemented
ENOTEMPTY 39 Directory not empty directory is not empty
ELOOP 40 Too many symbolic links encountered Too many levels of symbolic links
EWOULDBLOCK 41 Same as EAGAIN and EAGAIN equally
ENOMSG 42 No message of desired type There is no message of the expected type
EIDRM 43 Identifier removed Identifier deletion
ECHRNG 44 Channel number out of range Number of channels out of range
EL2NSYNC 45 Level 2 not synchronized 2 Level out of sync
EL3HLT 46 Level 3 halted 3 Level interrupt
EL3RST 47 Level 3 reset 3 Stage reset
ELNRNG 48 Link number out of range The number of links is out of range
EUNATCH 49 Protocol driver not attached The protocol driver is not connected
ENOCSI 50 No CSI structure available No available CSI structure
EL2HLT 51 Level 2 halted 2 Level interrupt
EBADE 52 Invalid exchange Invalid exchange
EBADR 53 Invalid request descriptor Invalid request descriptor
EXFULL 54 Exchange full Commutative complete
ENOANO 55 No anode There is no anode
EBADRQC 56 Invalid request code Invalid request code
EBADSLT 57 Invalid slot Invalid slot
EDEADLOCK 58 Same as EDEADLK and EDEADLK equally
EBFONT 59 Bad font file format bad font file format
ENOSTR 60 Device not a stream Device is not a character stream
ENODATA 61 No data available No data available
ETIME 62 Timer expired Timer expired
ENOSR 63 Out of streams resources Stream resource overflow
ENONET 64 Machine is not on the network The machine is not connected to the Internet
ENOPKG 65 Package not installed The package is not installed
EREMOTE 66 Object is remote Object is remote
ENOLINK 67 Link has been severed The connection is cut off
EADV 68 Advertise error Mistakes in advertising
ESRMNT 69 Srmount error srmount error
ECOMM 70 Communication error on send Communication error while sending
EPROTO 71 Protocol error Protocol error
EMULTIHOP 72 Multihop attempted Multi hop attempt
EDOTDOT 73 RFS specific error RFS Specific errors
EBADMSG 74 Not a data message Non data message
EOVERFLOW 75 Value too large for defined data type The value is too large , For defining data types
ENOTUNIQ 76 Name not unique on network Name is not the only network
EBADFD 77 File descriptor in bad state The file descriptor is in a bad state
EREMCHG 78 Remote address changed The remote address has changed
ELIBACC 79 Cannot access a needed shared library Unable to access the necessary shared library
ELIBBAD 80 Accessing a corrupted shared library Accessing a corrupted shared library
ELIBSCN 81 A .lib section in an .out is corrupted Reservoir section . out damage
ELIBMAX 82 Linking in too many shared libraries Attempt to link too many shared libraries
ELIBEXEC 83 Cannot exec a shared library directly Cannot execute a shared library directly
EILSEQ 84 Illegal byte sequence Invalid or incomplete multibyte or wide character
ERESTART 85 Interrupted system call should be restarted Interrupted system calls should be restarted
ESTRPIPE 86 Streams pipe error Flow tube error
EUSERS 87 Too many users Too many users
ENOTSOCK 88 Socket operation on non-socket Socket operation on non socket
EDESTADDRREQ 89 Destination address required Destination address required
EMSGSIZE 90 Message too long message too long
EPROTOTYPE 91 Protocol wrong type for socket socket Protocol type error
ENOPROTOOPT 92 Protocol not available Protocol not available
EPROTONOSUPPORT 93 Protocol not supported Protocol not supported
ESOCKTNOSUPPORT 94 Socket type not supported Socket type is not supported
EOPNOTSUPP 95 Operation not supported on transport Operation not supported
EPFNOSUPPORT 96 Protocol family not supported Protocol family not supported
EAFNOSUPPORT 97 Address family not supported by protocol Address not supported by protocol
EADDRINUSE 98 Address already in use The address is already in use
EADDRNOTAVAIL 99 Cannot assign requested address The requested address could not be assigned
ENETDOWN 100 Network is down Network paralysis
ENETUNREACH 101 Network is unreachable Network unreachable
ENETRESET 102 Network dropped Network connection lost
ECONNABORTED 103 Software caused connection The software caused the connection to be broken
ECONNRESET 104 Connection reset by Connection is reset
ENOBUFS 105 No buffer space available No buffer space available
EISCONN 106 Transport endpoint The transport endpoint is already connected
ENOTCONN 107 Transport endpoint There is no connection at the end of the transmission
ESHUTDOWN 108 Cannot send after transport Unable to send after transmission
ETOOMANYREFS 109 Too many references Too many references
ETIMEDOUT 110 Connection timed connection timed out
ECONNREFUSED 111 Connection refused connection denied
EHOSTDOWN 112 Host is down The host is down
EHOSTUNREACH 113 No route to host Route without host
EALREADY 114 Operation already Running
EINPROGRESS 115 Operation now in Running
ESTALE 116 Stale NFS file handle Old NFS File handle
EUCLEAN 117 Structure needs cleaning The structure needs cleaning
ENOTNAM 118 Not a XENIX-named no XENIX Named
ENAVAIL 119 No XENIX semaphores No, XENIX Semaphore
EISNAM 120 Is a named type file Is a named file type
EREMOTEIO 121 Remote I/O error Remote input / Output error
EDQUOT 122 Quota exceeded disk quota exceeded
ENOMEDIUM 123 No medium found No disks were found
EMEDIUMTYPE 124 Wrong medium type Wrong media type
ECANCELED 125 Operation Canceled Cancel the operation
ENOKEY 126 Required key not available The required key is not available
EKEYEXPIRED 127 Key has expired Expired key
EKEYREVOKED 128 Key has been revoked Key cancelled
EKEYREJECTED 129 Key was rejected by service Critical denial of service
EOWNERDEAD 130 Owner died Death of owner
ENOTRECOVERABLE 131 State not recoverable State not recoverable
ERFKILL 132 Operation not possible due to RF-kill because RF-kill It cannot be operated
So much for the time being ,133-255 All of them Unknown error

Two , Error handling function

Many different function libraries set global variables on failure errno To indicate the cause of the failure . It is important to note that the function must be checked immediately after it reports an error errno variable , Because it may be overridden by the next function call .
There are two very useful functions that can be used to report errors that have occurred :
#include <string.> char *strerror(int errnum);
This function maps the error code to a string , Describe the type of error .
#include <stdio.h> void perror(const char *s);
This function also puts the errno Error reported in variable should be to a string , And output it to the standard error output stream .

Technology
©2019-2020 Toolsou All rights reserved,
( Essence )2020 year 8 month 9 day C# Basic knowledge reflex MySql sentence Recursively find all subordinate departments of an input department mybatis-config.xml Set default value configuration mysql Recursively finds all child nodes of the parent class keras from dataframe Read data and enhance the data for training ( classification + division )shiro-oauth Enable third party authentication login ToastUtils Use of airflow Question series 2 —— task keep running Suspended animation Fiddler Simulate request sending and modifying response data Front end to background 5 Summary of different ways