alex.lin 发表于 2017-10-17 17:54:36

Linux Socker errno

经常有同事问我,socket 错误之后打印的错误码是什么意思,每次都要解释,所以,索性整理一下,供大家查看

errno 是记录系统的最后一次错误代码。代码是一个int型的值,在errno.h中定义


注意:只有当一个库函数失败时,errno才会被设置。当函数成功运行时,errno的值不会被修改。这意味着我们不能通过测试errno的值来判断是否有错误存在。反之,只有当被调用的函数提示有错误发生时检查errno的值才有意义。





错误数描述
errno0Success
errno1Operation not permitted
errno2No such file or directory
errno3No such process
errno4Interrupted system call
errno5Input/output error
errno6No such device or address
errno7Argument list too long
errno8Exec format error
errno9Bad file descriptor
errno10No child processe
errno11Resource temporarily unavailable
errno12Cannot allocate memory
errno13Permission denied
errno14Bad address
errno15Block device required
errno16Device or resource busy
errno17File exists
errno18Invalid cross-device link
errno19No such device
errno20Not a directory
errno21Is a directory
errno22Invalid argument
errno23Too many open files in system
errno24Too many open files
errno25Inappropriate ioctl for device
errno26Text file busy
errno27File too large
errno28No space left on device
errno29Illegal seek
errno30Read-only file system
errno31Too many links
errno32Broken pipe
errno33Numerical argument out of domain
errno34Numerical result out of range
errno35Resource deadlock avoided
errno36File name too long
errno37No locks available
errno38Function not implemented
errno39Directory not empty
errno40Too many levels of symbolic links
errno41Unknown error 41
errno42No message of desired type
errno43Identifier removed
errno44Channel number out of range
errno45Level 2 not synchronized
errno46Level 3 halted
errno47Level 3 reset
errno48Link number out of range
errno49Protocol driver not attached
errno50No CSI structure available
errno51Level 2 halted
errno52Invalid exchange
errno53Invalid request descriptor
errno54Exchange full
errno55No anode
errno56Invalid request code
errno57Invalid slot
errno58Unknown error 58
errno59Bad font file format
errno60Device not a stream
errno61No data available
errno62Timer expired
errno63Out of streams resources
errno64Machine is not on the network
errno65Package not installed
errno66Object is remote
errno67Link has been severed
errno68Advertise error
errno69Srmount error
errno70Communication error on send
errno71Protocol error
errno72Multihop attempted
errno73RFS specific error
errno74Bad message
errno75Value too large for defined datatype
errno76Name not unique on network
errno77File descriptor in bad state
errno78Remote address changed
errno79Can not access a needed sharedlibrary
errno80Accessing a corrupted sharedlibrary
errno81.lib section in a.out corrupted
errno82Attempting to link in too manyshared libraries
errno83Cannot exec a shared librarydirectly
errno84Invalid or incomplete multibyte orwide character
errno85Interrupted system call should berestarted
errno86Streams pipe error
errno87Too many users
errno88Socket operation on non-socket
errno89Destinationaddress required
errno90Message too long
errno91Protocol wrong type for socket
errno92Protocol not available
errno93Protocol not supported
errno94Socket type not supported
errno95Operation not supported
errno96Protocol family not supported
errno97Address family not supported byprotocol
errno98Address already in use
errno99Cannot assign requested address
errno100Network is down
errno101Network is unreachable
errno102Network dropped connection onreset
errno103Software caused connection abort
errno104Connection reset by peer
errno105No buffer space available
errno106Transport endpoint is alreadyconnected
errno107Transport endpoint is notconnected
errno108Cannot send after transportendpoint shutdown
errno109Too many references: cannot splice
errno110Connection timed out
errno111Connection refused
errno112Host is down
errno113No route to host
errno114Operation already in progress
errno115Operation now in progress
errno116Stale NFS file handle
errno117Structure needs cleaning
errno118Not a XENIX named type file
errno119No XENIX semaphores available
errno120Is a named type file
errno121Remote I/O error
errno122Disk quota exceeded
errno123No medium found
errno124Wrong medium type
errno125Operation canceled
errno126Required key not available
errno127Key has expired
errno128Key has been revoked
errno129Key was rejected by service
errno130Owner died
errno131State not recoverable
errno132Operation not possible due toRF-kill
errno133Unknown error 133
errno134Unknown error 134
errno135Unknown error 135
errno136Unknown error 136
errno137Unknown error 137
errno138Unknown error 138
errno139Unknown error 139

页: [1]
查看完整版本: Linux Socker errno