菜鸟笔记
提升您的技术认知

linux错误码大全-ag真人游戏

linux错误码大全

查看错误代码errno是调试程序的一个重要方法。当linuc capi函数发生异常时,一般会将errno变量(需includeerrno.h)赋一个整数值,不同的值表示不同的含义,可以通过查看该值推测出错的原因。在实际编程中用这一招解决了不少原本看来莫名其妙的问题。比较麻烦的是每次都要去linux源代码里面查找错误代码的含义,现在把它贴出来,以后需要查时就来这里看了。

1-34号错误号是在内核源码的include/asm-generic/errno-base.h定义

35-132则是在include/asm-generic/errno.h中定义

剩下还有一些更大的错误号是留给内核级别的,如系统调用等,用户程序一般是看不见的这些号的,ubuntu9.10中/usr/src/linux-headers-2.6.31-21-generic/include/linux/errno.h

#ifndef_asm_generic_errno_base_h
#define_asm_generic_errno_base_h

#define eperm 1 /* operation not permitted*/
#define enoent 2 /* no such file or directory*/
#define esrch 3 /* no such process*/
#define eintr 4 /* interrupted system call*/
#define eio 5 /* i/o error*/
#define enxio 6 /* no such device or address*/
#define e2big 7 /* argument list too long*/
#define enoexec 8 /* exec format error*/
#define ebadf 9 /* bad file number*/
#define echild 10 /* no child processes*/
#define eagain 11 /* try again*/
#define enomem 12 /* out of memory*/
#define eacces 13 /* permission denied*/
#define efault 14 /* bad address*/
#define enotblk 15 /* block device required*/
#define ebusy 16 /* device or resource busy*/
#define eexist 17 /* file exists*/
#define exdev 18 /* cross-device link*/
#define enodev 19 /* no such device*/
#define enotdir 20 /* not a directory*/
#define eisdir 21 /* is a directory*/
#define einval 22 /* invalid argument*/
#define enfile 23 /* file table overflow*/
#define emfile 24 /* too many open files*/
#define enotty 25 /* not a typewriter*/
#define etxtbsy 26 /* text file busy*/
#define efbig 27 /* file too large*/
#define enospc 28 /* no space left on device*/
#define espipe 29 /* illegal seek*/
#define erofs 30 /* read-only file system*/
#define emlink 31 /* too many links*/
#define epipe 32 /* broken pipe*/
#define edom 33 /* math argument out of domainof func */
#define erange 34 /* math result notrepresentable */

#endif

#include

#define edeadlk 35 /* resource deadlock wouldoccur */
#define enametoolong 36 /* file name too long */
#define enolck 37 /* no record locks available*/
#define enosys 38 /* function not implemented*/
#define enotempty 39 /*directory not empty */
#define eloop 40 /* too many symbolic linksencountered */
#define ewouldblock eagain /*operation would block */
#define enomsg 42 /* no message of desired type*/
#define eidrm 43 /* identifier removed*/
#define echrng 44 /* channel number out of range*/
#define el2nsync 45 /* level2 not synchronized */
#define el3hlt 46 /* level 3 halted*/
#define el3rst 47 /* level 3 reset*/
#define elnrng 48 /* link number out of range*/
#define eunatch 49 /* protocol driver notattached */
#define enocsi 50 /* no csi structure available*/
#define el2hlt 51 /* level 2 halted*/
#define ebade 52 /* invalid exchange*/
#define ebadr 53 /* invalid request descriptor*/
#define exfull 54 /* exchange full*/
#define enoano 55 /* no anode*/
#define ebadrqc 56 /* invalid request code*/
#define ebadslt 57 /* invalid slot*/

#define edeadlock edeadlk
#define ebfont 59 /* bad font file format*/
#define enostr 60 /* device not a stream*/
#define enodata 61 /* no data available*/
#define etime 62 /* timer expired*/
#define enosr 63 /* out of streams resources*/
#define enonet 64 /* machine is not on thenetwork */
#define enopkg 65 /* package not installed*/
#define eremote 66 /* object is remote*/
#define enolink 67 /* link has been severed*/
#define eadv 68 /* advertise error*/
#define esrmnt 69 /* srmount error*/
#define ecomm 70 /* communication error on send*/
#define eproto 71 /* protocol error*/
#define emultihop 72 /*multihop attempted */
#define edotdot 73 /* rfs specific error*/
#define ebadmsg 74 /* not a data message*/
#define eoverflow 75 /* valuetoo large for defined data type */
#define enotuniq 76 /* namenot unique on network */
#define ebadfd 77 /* file descriptor in badstate */
#define eremchg 78 /* remote address changed*/
#define elibacc 79 /* can not access a neededshared library */
#define elibbad 80 /* accessing a corruptedshared library */
#define elibscn 81 /* .lib section in a.outcorrupted */
#define elibmax 82 /* attempting to link in toomany shared libraries */
#define elibexec 83 /* cannotexec a shared library directly */
#define eilseq 84 /* illegal byte sequence*/
#define erestart 85 /*interrupted system call should be restarted */
#define estrpipe 86 /*streams pipe error */
#define eusers 87 /* too many users*/
#define enotsock 88 /* socketoperation on non-socket */
#define edestaddrreq 89 /* destination address required*/
#define emsgsize 90 /*message too long */
#define eprototype 91 /*protocol wrong type for socket */
#define enoprotoopt 92 /*protocol not available */
#define eprotonosupport 93 /* protocol not supported */
#define esocktnosupport 94 /* socket type not supported*/
#define eopnotsupp 95 /*operation not supported on transport endpoint*/
#define epfnosupport 96 /* protocol family not supported*/
#define eafnosupport 97 /* address family not supported by protocol*/
#define eaddrinuse 98 /*address already in use */
#define eaddrnotavail 99 /* cannot assign requested address*/
#define enetdown 100 /*network is down */
#define enetunreach 101 /*network is unreachable */
#define enetreset 102 /*network dropped connection because of reset */
#define econnaborted 103 /* software caused connection abort*/
#define econnreset 104 /*connection reset by peer */
#define enobufs 105 /* no buffer space available*/
#define eisconn 106 /* transport endpoint isalready connected */
#define enotconn 107 /*transport endpoint is not connected */
#define eshutdown 108 /*cannot send after transport endpoint shutdown*/
#define etoomanyrefs 109 /* too many references: cannot splice*/
#define etimedout 110 /*connection timed out */
#define econnrefused 111 /* connection refused */
#define ehostdown 112 /* hostis down */
#define ehostunreach 113 /* no route to host */
#define ealready 114 /*operation already in progress */
#define einprogress 115 /*operation now in progress */
#define estale 116 /* stale nfs file handle*/
#define euclean 117 /* structure needs cleaning*/
#define enotnam 118 /* not a xenix named type file*/
#define enavail 119 /* no xenix semaphoresavailable */
#define eisnam 120 /* is a named type file*/
#define eremoteio 121 /*remote i/o error */
#define edquot 122 /* quota exceeded*/
#define enomedium 123 /* nomedium found */
#define emediumtype 124 /* wrongmedium type */
#define ecanceled 125 /*operation canceled */
#define enokey 126 /* required key not available*/
#define ekeyexpired 127 /* keyhas expired */
#define ekeyrevoked 128 /* keyhas been revoked */
#define ekeyrejected 129 /* key was rejected by service*/

/* forrobust mutexes */
#define eownerdead 130 /* ownerdied */
#define enotrecoverable 131 /* state not recoverable */

#defineerfkill 132 /*operation not possible due to rf-kill */

#ifdef__kernel__

/*
* these should never be seenby user programs. to return one of erestart*
* codes, signal_pending()must be set. note that ptrace can observe these
* at syscall exit tracing,but they will never be left for the debuggeduser
* process tosee.
*/
#defineerestartsys 512
#defineerestartnointr 513
#defineerestartnohand 514 /* restart if no handler..*/
#defineenoioctlcmd 515 /* no ioctl command*/
#defineerestart_restartblock 516 /* restart by calling sys_restart_syscall*/

/*defined for the nfsv3 protocol */
#defineebadhandle 521 /* illegal nfs file handle*/
#defineenotsync 522 /* update synchronizationmismatch */
#defineebadcookie 523 /* cookie is stale*/
#defineenotsupp 524 /* operation is not supported*/
#defineetoosmall 525 /* buffer or request is toosmall */
#defineeserverfault 526 /* an untranslatable erroroccurred */
#defineebadtype 527 /* type not supported byserver */
#defineejukebox 528 /* request initiated, but willnot complete before timeout */
#defineeiocbqueued 529 /* iocb queued, will getcompletion event */
#defineeiocbretry 530 /* iocb queued, will trigger aretry */

#endif

网站地图