Use errno to get the error code in the header file Errno.h
Error description can be obtained using strerror (errno), prototype: char *strerror (int errnum), header file String.h
Listed below
/usr/include/asm-generic/errno-base.h
#ifndef _asm_generic_errno_base_h#define_asm_generic_errno_base_h#defineEperm 1/* Operation not permitted */#defineENOENT 2/* No such file or directory */#defineEsrch 3/* No such process */#defineEINTR 4/* Interrupted system call */#defineEIO 5 */I/O error */#defineEnxio 6/* No such device or address */#defineE2big 7/* Argument list too long */#defineEnoexec 8/* Exec format Error */#defineEBADF 9/* Bad file number */#defineEchild/* No child processes */#defineEagain/* Try again */#defineENOMEM/* Out of memory */#defineEacces/* Permission denied */#defineEfault/* Bad address */#defineENOTBLK/* Block Device required */#defineEbusy/* Device or resource busy */#defineEexist/* File exists */#defineExdev */* cross-device link */#defineEnodev/* No such device */#defineEnotdir/* Not a directory */#defineEisdir/* is a directory */#defineEINVAL */* Invalid argument */#defineEnfile/* File table overflow */#defineEmfile/* Too many open files */#defineEnotty/* Not a typewriter */#defineEtxtbsy/* Text file Busy */#defineEfbig/* File too large */#defineENOSPC/* No space left on device */#defineEspipe/* Illegal seek * *#defineErofs/* read-only File System */#defineEmlink/* Too many links * *#defineEpipe/* Broken pipe */#defineEDOM/* Math argument out of domain of func * *#defineErange/* Math result not representable */#endif
/usr/include/asm-generic/errno.h
#ifndef _asm_generic_errno_h#define_asm_generic_errno_h#include<asm-generic/errno-Base.h>#defineEDEADLK//Resource deadlock would occur * *#defineEnametoolong/* File name too long */#defineEnolck Notoginseng */No record locks available */#defineEnosys/* Function not implemented */#defineEnotempty/* Directory not empty */#defineEloop/* Too Many symbolic links encountered * *#defineEwouldblock Eagain/* operation would block */#defineENOMSG * * No message of desired type */#defineEIDRM */Identifier removed */#defineECHRNG */* Channel number out of range */#defineEl2nsync */Level 2 not synchronized */#defineEL3HLT/* Level 3 halted */#defineEl3rst/* Level 3 Reset */#defineELNRNG/* Link number out of range */#defineEunatch */Protocol driver not attached */#defineENOCSI/* NO CSI structure available */#defineEL2HLT/* Level 2 halted */#defineEbade/* Invalid Exchange * *#defineEBADR-*/Invalid Request Descriptor */#defineExfull/* Exchange full */#defineEnoano/* No anode */#defineEBADRQC */Invalid Request code */#defineEBADSLT/* Invalid slot */#defineEdeadlock Edeadlk#defineEbfont/* Bad font file format */#defineENOSTR/* Device not a stream */#defineEnodata/* NO data available */#defineETime */* Timer expired */#defineENOSR */* out of streams resources * *#defineEnonet */Machine was not on the network */#defineENOPKG/* Package not installed */#defineEremote/* Object is remote */#defineEnolink/* Link has been severed */#defineEADV/* Advertise Error */#defineESRMNT/* Srmount Error */#defineECOMM/* Communication error on Send */#defineEproto/* Protocol Error */#defineEmultihop */Multihop attempted * *#defineEdotdot/* RFS specific Error */#defineEBADMSG-*/Not a data message */#defineEoverflow */Value too large for defined data type */#defineEnotuniq/* Name not unique on network */#defineEBADFD */* File descriptor in Bad state */#defineEREMCHG/* Remote address changed */#defineELIBACC/* Can not access a needed shared library */#defineElibbad */Accessing a corrupted shared library */#defineELIBSCN Bayi/* lib section in a.out corrupted */#defineElibmax/attempting to link in too many shared libraries */#defineElibexec */cannot exec a shared library directly */#defineEILSEQ/* Illegal byte sequence */#defineErestart/* Interrupted system call should be restarted */#defineEstrpipe */* Streams pipe Error */#defineEusers */Too Many users * *#defineEnotsock */* Socket operation on Non-socket */#defineEdestaddrreq/* Destination address required */#defineEmsgsize/* Message too long */#defineEprototype/* Protocol wrong type for socket */#defineEnoprotoopt */Protocol Not available */#defineEprotonosupport */Protocol not supported */#defineEsocktnosupport 94/* Socket type not supported */#defineEopnotsupp */Operation not supported on transport endpoint * *#defineEpfnosupport */Protocol family not supported */#defineEafnosupport/* Address family not supported by protocol */#defineEaddrinuse 98/* Address already in use */#defineEaddrnotavail/* Cannot assign requested address * *#defineEnetdown/* Network is down */#defineEnetunreach 101/* Network is unreachable */#defineEnetreset 102/* Network dropped connection because of reset */#defineEconnaborted 103/* Software caused connection abort */#defineEconnreset 104/* Connection Reset by Peer */#defineENOBUFS * * No buffer space Available */#defineEisconn 106/* Transport endpoint is already connected * *#defineEnotconn 107/* Transport endpoint is not connected */#defineEshutdown 108/* Cannot send after transport endpoint shutdown */#defineEtoomanyrefs 109/* Too many references:cannot splice * *#defineEtimedout */Connection timed out */#defineEconnrefused 111/* Connection refused */#defineEhostdown * * * Host is down */#defineEhostunreach 113/* No route to host */#defineEalready */Operation already in progress */#defineEinprogress-*/Operation now in progress */#defineEstale */* Stale NFS file handle */#defineEuclean 117/* Structure needs cleaning * *#defineEnotnam 118/* Not a XENIX named type file */#defineEnavail 119 */No XENIX semaphores Available * *#defineEisnam/* is a named type file */#defineEremoteio 121/* Remote I/O error */#defineEdquot 122/* Quota exceeded */#defineEnomedium 123 */No medium found */#defineEmediumtype 124/* Wrong medium type */#defineecanceled/* Operation Canceled */#defineEnokey 126/* Required key not available */#defineEkeyexpired 127/* Key has expired */#defineekeyrevoked/* Key has been revoked */#defineEkeyrejected 129/* Key was rejected by service *//*For robust mutexes*/#defineEownerdead/* Owner died */#defineEnotrecoverable 131/* State not recoverable */#endif
Linux error code