cloudmail 发表于 2013-2-4 13:38:53

Linux errno.h


 

22:参数错误,比如ip地址不合法,没有目标端口等
101:网络不可达,比如不能ping通
111:链接被拒绝,比如目标关闭链接等
115:当链接设置为非阻塞时,目标没有及时应答,返回此错误,socket可以继续使用
 
 
Linux通过errno这个变量来记录最近一次出错的内容,类似Windows下的GetLastError()函数的返回值。
 
 
/* errno is not a global variable, because that would make using it   non-reentrant.Instead, its address is returned by the function   __errno.*/#ifndef _SYS_ERRNO_H_#ifdef __cplusplusextern "C" {#endif#define _SYS_ERRNO_H_#include <sys/reent.h>#ifndef _REENT_ONLY#define errno (*__errno())extern int *__errno _PARAMS ((void));#endif/* Please don't use these variables directly.   Use strerror instead. */extern __IMPORT _CONST char * _CONST _sys_errlist[];extern __IMPORT int _sys_nerr;#ifdef __CYGWIN__extern __IMPORT const char * const sys_errlist[];extern __IMPORT int sys_nerr;#endif#define __errno_r(ptr) ((ptr)->_errno)#defineEPERM 1/* Not super-user */#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/* Arg list too long */#defineENOEXEC 8/* Exec format error */#defineEBADF 9/* Bad file number */#defineECHILD 10/* No children */#defineEAGAIN 11/* No more processes */#defineENOMEM 12/* Not enough core */#defineEACCES 13/* Permission denied */#defineEFAULT 14/* Bad address */#ifdef __LINUX_ERRNO_EXTENSIONS__#defineENOTBLK 15/* Block device required */#endif#defineEBUSY 16/* Mount device busy */#defineEEXIST 17/* File exists */#defineEXDEV 18/* Cross-device link */#defineENODEV 19/* No such device */#defineENOTDIR 20/* Not a directory */#defineEISDIR 21/* Is a directory */#defineEINVAL 22/* Invalid argument */#defineENFILE 23/* Too many open files in system */#defineEMFILE 24/* Too many open files */#defineENOTTY 25/* Not a typewriter */#defineETXTBSY 26/* Text file busy */#defineEFBIG 27/* File too large */#defineENOSPC 28/* No space left on device */#defineESPIPE 29/* Illegal seek */#defineEROFS 30/* Read only file system */#defineEMLINK 31/* Too many links */#defineEPIPE 32/* Broken pipe */#defineEDOM 33/* Math arg out of domain of func */#defineERANGE 34/* Math result not representable */#defineENOMSG 35/* No message of desired type */#defineEIDRM 36/* Identifier removed */#ifdef __LINUX_ERRNO_EXTENSIONS__#defineECHRNG 37/* Channel number out of range */#defineEL2NSYNC 38/* Level 2 not synchronized */#defineEL3HLT 39/* Level 3 halted */#defineEL3RST 40/* Level 3 reset */#defineELNRNG 41/* Link number out of range */#defineEUNATCH 42/* Protocol driver not attached */#defineENOCSI 43/* No CSI structure available */#defineEL2HLT 44/* Level 2 halted */#endif#defineEDEADLK 45/* Deadlock condition */#defineENOLCK 46/* No record locks available */#ifdef __LINUX_ERRNO_EXTENSIONS__#define EBADE 50/* Invalid exchange */#define EBADR 51/* Invalid request descriptor */#define EXFULL 52/* Exchange full */#define ENOANO 53/* No anode */#define EBADRQC 54/* Invalid request code */#define EBADSLT 55/* Invalid slot */#define EDEADLOCK 56/* File locking deadlock error */#define EBFONT 57/* Bad font file fmt */#endif#define ENOSTR 60/* Device not a stream */#define ENODATA 61/* No data (for no delay io) */#define ETIME 62/* Timer expired */#define ENOSR 63/* Out of streams resources */#ifdef __LINUX_ERRNO_EXTENSIONS__#define ENONET 64/* Machine is not on the network */#define ENOPKG 65/* Package not installed */#define EREMOTE 66/* The object is remote */#endif#define ENOLINK 67/* The link has been severed */#ifdef __LINUX_ERRNO_EXTENSIONS__#define EADV 68/* Advertise error */#define ESRMNT 69/* Srmount error */#defineECOMM 70/* Communication error on send */#endif#define EPROTO 71/* Protocol error */#defineEMULTIHOP 74/* Multihop attempted */#ifdef __LINUX_ERRNO_EXTENSIONS__#defineELBIN 75/* Inode is remote (not really error) */#defineEDOTDOT 76/* Cross mount point (not really error) */#endif#define EBADMSG 77/* Trying to read unreadable message */#define EFTYPE 79/* Inappropriate file type or format */#ifdef __LINUX_ERRNO_EXTENSIONS__#define ENOTUNIQ 80/* Given log. name not unique */#define EBADFD 81/* f.d. invalid for this operation */#define EREMCHG 82/* Remote address changed */#define ELIBACC 83/* Can't access a needed shared lib */#define ELIBBAD 84/* Accessing a corrupted shared lib */#define ELIBSCN 85/* .lib section in a.out corrupted */#define ELIBMAX 86/* Attempting to link in too many libs */#define ELIBEXEC 87/* Attempting to exec a shared library */#endif#define ENOSYS 88/* Function not implemented */#ifdef __CYGWIN__#define ENMFILE 89      /* No more files */#endif#define ENOTEMPTY 90/* Directory not empty */#define ENAMETOOLONG 91/* File or path name too long */#define ELOOP 92/* Too many symbolic links */#define EOPNOTSUPP 95/* Operation not supported on transport endpoint */#define EPFNOSUPPORT 96 /* Protocol family not supported */#define ECONNRESET 104/* Connection reset by peer */#define ENOBUFS 105/* No buffer space available */#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */#define EPROTOTYPE 107/* Protocol wrong type for socket */#define ENOTSOCK 108/* Socket operation on non-socket */#define ENOPROTOOPT 109/* Protocol not available */#ifdef __LINUX_ERRNO_EXTENSIONS__#define ESHUTDOWN 110/* Can't send after socket shutdown */#endif#define ECONNREFUSED 111/* Connection refused */#define EADDRINUSE 112/* Address already in use */#define ECONNABORTED 113/* Connection aborted */#define ENETUNREACH 114/* Network is unreachable */#define ENETDOWN 115/* Network interface is not configured */#define ETIMEDOUT 116/* Connection timed out */#define EHOSTDOWN 117/* Host is down */#define EHOSTUNREACH 118/* Host is unreachable */#define EINPROGRESS 119/* Connection already in progress */#define EALREADY 120/* Socket already connected */#define EDESTADDRREQ 121/* Destination address required */#define EMSGSIZE 122/* Message too long */#define EPROTONOSUPPORT 123/* Unknown protocol */#ifdef __LINUX_ERRNO_EXTENSIONS__#define ESOCKTNOSUPPORT 124/* Socket type not supported */#endif#define EADDRNOTAVAIL 125/* Address not available */#define ENETRESET 126#define EISCONN 127/* Socket is already connected */#define ENOTCONN 128/* Socket is not connected */#define ETOOMANYREFS 129#ifdef __LINUX_ERRNO_EXTENSIONS__#define EPROCLIM 130#define EUSERS 131#endif#define EDQUOT 132#define ESTALE 133#define ENOTSUP 134/* Not supported */#ifdef __LINUX_ERRNO_EXTENSIONS__#define ENOMEDIUM 135   /* No medium (in tape drive) */#endif#ifdef __CYGWIN__#define ENOSHARE 136    /* No such host or network path */#define ECASECLASH 137/* Filename exists with different case */#endif#define EILSEQ 138#define EOVERFLOW 139/* Value too large for defined data type */#define ECANCELED 140/* Operation canceled */#define ENOTRECOVERABLE 141/* State not recoverable */#define EOWNERDEAD 142/* Previous owner died */#ifdef __LINUX_ERRNO_EXTENSIONS__#define ESTRPIPE 143/* Streams pipe error */#endif#define EWOULDBLOCK EAGAIN/* Operation would block */#define __ELASTERROR 2000/* Users can add values starting here */#ifdef __cplusplus}#endif#endif /* _SYS_ERRNO_H */  
页: [1]
查看完整版本: Linux errno.h