Linux常见错误码声明_VMware, Unix及操作系统讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  VMware, Unix及操作系统讨论区 »
总帖数
7
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 4990 | 回复: 6   主题:  Linux常见错误码声明        上一篇   下一篇 
张伟
注册用户
等级:列兵
经验:110
发帖:81
精华:0
注册:2011-12-22
状态:离线
发送短消息息给张伟 加好友    发送短消息息给张伟 发消息
发表于: IP:您无权察看 2016-2-17 11:44:53 | [全部帖] [楼主帖] 楼主

下面的列表显示常见的 Linux 系统错误代码。

1 EPERM
Operation not permitted
操作不许可 
2 ENOENT
No such file or directory
无此文件或目录 
3 ESRCH
No such process
无此过程 
4 EINTR 
Interrupted system call
系统调用被禁止 
5 EIO 
I/O error
I/O 错误 
6 ENXIO 
No such device or address
无此器件或地址 
7 E2BIG 
Arg list too long
Arg 列表太长 
8 ENOEXEC 
Exec format error
Exec 格式错误 
9 EBADF 
Bad file number
文件数目错误
10 ECHILD
No child processes
无子过程
11 EAGAIN
Try again
再试一遍
12 ENOMEM
Out of memory 
内存溢出
13 EACCES
Permission denied 
许可拒绝
14 EFAULT
Bad address 
错误的地址
15 ENOTBLK
Block device required 
需要块设备
16 EBUSY
Device or resource busy 
设备或资源忙
17 EEXIST
File exists 
文件已存在
18 EXDEV
Cross-device link 
跨器链接
19 ENODEV
No such device 
无此设备
20 ENOTDIR
Not a directory 
不是一个目录
21 EISDIR
Is a directory 
是一个目录
22 EINVAL
Invalid argument 
无效的函数自变量
23 ENFILE
File table overflow 
文件表溢出
24 EMFILE
Too many open files
打开的文件太多
25 ENOTTY
Inappropriate ioctl for device 
26 ETXTBSY
Text file busy 
文本文件忙
27 EFBIG
File too large
文件太大
28 ENOSPC
No space left on device 
磁盘空间不足
29 ESPIPE 
Illegal seek 
不合法的寻找
30 EROFS 
Read-only file system 
只读文件系统
31 EMLINK 
Too many links
太多的链接






--转自



赞(0)    操作        顶端 
beefly
注册用户
等级:上尉
经验:758
发帖:1
精华:0
注册:2015-7-27
状态:离线
发送短消息息给beefly 加好友    发送短消息息给beefly 发消息
发表于: IP:您无权察看 2016-2-18 10:10:11 | [全部帖] [楼主帖] 2  楼

学习学习



赞(0)    操作        顶端 
Mr_Captain
注册用户
等级:上士
经验:293
发帖:9
精华:0
注册:2016-2-2
状态:离线
发送短消息息给Mr_Captain 加好友    发送短消息息给Mr_Captain 发消息
发表于: IP:您无权察看 2016-2-18 14:47:51 | [全部帖] [楼主帖] 3  楼

学习,学习!



赞(0)    操作        顶端 
filogra
注册用户
等级:少校
经验:1408
发帖:13
精华:0
注册:2015-6-2
状态:离线
发送短消息息给filogra 加好友    发送短消息息给filogra 发消息
发表于: IP:您无权察看 2016-3-15 9:07:53 | [全部帖] [楼主帖] 4  楼

经常看见好多提示不懂什么意思,感谢楼主分享!值得收藏~~



赞(0)    操作        顶端 
jinggege
注册用户
等级:中士
经验:241
发帖:0
精华:0
注册:2016-2-26
状态:离线
发送短消息息给jinggege 加好友    发送短消息息给jinggege 发消息
发表于: IP:您无权察看 2016-3-16 19:56:16 | [全部帖] [楼主帖] 5  楼

查看错误代码errno是调试程序的一个重要方法。当linuc C api函数发生异常时,一般会将errno变量(需include errno.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


#defineEPERM1/* Operation not permitted */

#defineENOENT2/* No such file or directory */

#defineESRCH3/* No such process */

#defineEINTR4/* Interrupted system call */

#defineEIO5/* I/O error */

#defineENXIO6/* No such device or address */

#defineE2BIG7/* Argument list too long */

#defineENOEXEC8/* Exec format error */

#defineEBADF9/* Bad file number */

#defineECHILD10/* No child processes */

#defineEAGAIN11/* Try again */

#defineENOMEM12/* Out of memory */

#defineEACCES13/* Permission denied */

#defineEFAULT14/* Bad address */

#defineENOTBLK15/* Block device required */

#defineEBUSY16/* Device or resource busy */

#defineEEXIST17/* File exists */

#defineEXDEV18/* Cross-device link */

#defineENODEV19/* No such device */

#defineENOTDIR20/* Not a directory */

#defineEISDIR21/* Is a directory */

#defineEINVAL22/* Invalid argument */

#defineENFILE23/* File table overflow */

#defineEMFILE24/* Too many open files */

#defineENOTTY25/* Not a typewriter */

#defineETXTBSY26/* Text file busy */

#defineEFBIG27/* File too large */

#defineENOSPC28/* No space left on device */

#defineESPIPE29/* Illegal seek */

#defineEROFS30/* Read-only file system */

#defineEMLINK31/* Too many links */

#defineEPIPE32/* Broken pipe */

#defineEDOM33/* Math argument out of domain of func */

#defineERANGE34/* Math result not representable */


#endif



#include <asm-generic/errno-base.h>


#defineEDEADLK35/* Resource deadlock would occur */

#defineENAMETOOLONG36/* File name too long */

#defineENOLCK37/* No record locks available */

#defineENOSYS38/* Function not implemented */

#defineENOTEMPTY39/* Directory not empty */

#defineELOOP40/* Too many symbolic links encountered */

#defineEWOULDBLOCKEAGAIN/* Operation would block */

#defineENOMSG42/* No message of desired type */

#defineEIDRM43/* Identifier removed */

#defineECHRNG44/* Channel number out of range */

#defineEL2NSYNC45/* Level 2 not synchronized */

#defineEL3HLT46/* Level 3 halted */

#defineEL3RST47/* Level 3 reset */

#defineELNRNG48/* Link number out of range */

#defineEUNATCH49/* Protocol driver not attached */

#defineENOCSI50/* No CSI structure available */

#defineEL2HLT51/* Level 2 halted */

#defineEBADE52/* Invalid exchange */

#defineEBADR53/* Invalid request descriptor */

#defineEXFULL54/* Exchange full */

#defineENOANO55/* No anode */

#defineEBADRQC56/* Invalid request code */

#defineEBADSLT57/* Invalid slot */


#defineEDEADLOCKEDEADLK


#defineEBFONT59/* Bad font file format */

#defineENOSTR60/* Device not a stream */

#defineENODATA61/* No data available */

#defineETIME62/* Timer expired */

#defineENOSR63/* Out of streams resources */

#defineENONET64/* Machine is not on the network */

#defineENOPKG65/* Package not installed */

#defineEREMOTE66/* Object is remote */

#defineENOLINK67/* Link has been severed */

#defineEADV68/* Advertise error */

#defineESRMNT69/* Srmount error */

#defineECOMM70/* Communication error on send */

#defineEPROTO71/* Protocol error */

#defineEMULTIHOP72/* Multihop attempted */

#defineEDOTDOT73/* RFS specific error */

#defineEBADMSG74/* Not a data message */

#defineEOVERFLOW75/* Value too large for defined data type */

#defineENOTUNIQ76/* Name not unique on network */

#defineEBADFD77/* File descriptor in bad state */

#defineEREMCHG78/* Remote address changed */

#defineELIBACC79/* Can not access a needed shared library */

#defineELIBBAD80/* Accessing a corrupted shared library */

#defineELIBSCN81/* .lib section in a.out corrupted */

#defineELIBMAX82/* Attempting to link in too many shared libraries */

#defineELIBEXEC83/* Cannot exec a shared library directly */

#defineEILSEQ84/* Illegal byte sequence */

#defineERESTART85/* Interrupted system call should be restarted */

#defineESTRPIPE86/* Streams pipe error */

#defineEUSERS87/* Too many users */

#defineENOTSOCK88/* Socket operation on non-socket */

#defineEDESTADDRREQ89/* Destination address required */

#defineEMSGSIZE90/* Message too long */

#defineEPROTOTYPE91/* Protocol wrong type for socket */

#defineENOPROTOOPT92/* Protocol not available */

#defineEPROTONOSUPPORT93/* Protocol not supported */

#defineESOCKTNOSUPPORT94/* Socket type not supported */

#defineEOPNOTSUPP95/* Operation not supported on transport endpoint */

#defineEPFNOSUPPORT96/* Protocol family not supported */

#defineEAFNOSUPPORT97/* Address family not supported by protocol */

#defineEADDRINUSE98/* Address already in use */

#defineEADDRNOTAVAIL99/* Cannot assign requested address */

#defineENETDOWN100/* Network is down */

#defineENETUNREACH101/* Network is unreachable */

#defineENETRESET102/* Network dropped connection because of reset */

#defineECONNABORTED103/* Software caused connection abort */

#defineECONNRESET104/* Connection reset by peer */

#defineENOBUFS105/* No buffer space available */

#defineEISCONN106/* Transport endpoint is already connected */

#defineENOTCONN107/* Transport endpoint is not connected */

#defineESHUTDOWN108/* Cannot send after transport endpoint shutdown */

#defineETOOMANYREFS109/* Too many references: cannot splice */

#defineETIMEDOUT110/* Connection timed out */

#defineECONNREFUSED111/* Connection refused */

#defineEHOSTDOWN112/* Host is down */

#defineEHOSTUNREACH113/* No route to host */

#defineEALREADY114/* Operation already in progress */

#defineEINPROGRESS115/* Operation now in progress */

#defineESTALE116/* Stale NFS file handle */

#defineEUCLEAN117/* Structure needs cleaning */

#defineENOTNAM118/* Not a XENIX named type file */

#defineENAVAIL119/* No XENIX semaphores available */

#defineEISNAM120/* Is a named type file */

#defineEREMOTEIO121/* Remote I/O error */

#defineEDQUOT122/* Quota exceeded */


#defineENOMEDIUM123/* No medium found */

#defineEMEDIUMTYPE124/* Wrong medium type */

#defineECANCELED125/* Operation Canceled */

#defineENOKEY126/* Required key not available */

#defineEKEYEXPIRED127/* Key has expired */

#defineEKEYREVOKED128/* Key has been revoked */

#defineEKEYREJECTED129/* Key was rejected by service */


/* for robust mutexes */

#defineEOWNERDEAD130/* Owner died */

#defineENOTRECOVERABLE131/* State not recoverable */


#define ERFKILL132/* Operation not possible due to RF-kill */



#ifdef __KERNEL__


/*

* These should never be seen by 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 debugged user

* process to see.

*/

#define ERESTARTSYS512

#define ERESTARTNOINTR513

#define ERESTARTNOHAND514/* restart if no handler.. */

#define ENOIOCTLCMD515/* No ioctl command */

#define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */


/* Defined for the NFSv3 protocol */

#define EBADHANDLE521/* Illegal NFS file handle */

#define ENOTSYNC522/* Update synchronization mismatch */

#define EBADCOOKIE523/* Cookie is stale */

#define ENOTSUPP524/* Operation is not supported */

#define ETOOSMALL525/* Buffer or request is too small */

#define ESERVERFAULT526/* An untranslatable error occurred */

#define EBADTYPE527/* Type not supported by server */

#define EJUKEBOX528/* Request initiated, but will not complete before timeout */

#define EIOCBQUEUED529/* iocb queued, will get completion event */

#define EIOCBRETRY530/* iocb queued, will trigger a retry */


#endif




赞(0)    操作        顶端 
beefly
注册用户
等级:上尉
经验:758
发帖:1
精华:0
注册:2015-7-27
状态:离线
发送短消息息给beefly 加好友    发送短消息息给beefly 发消息
发表于: IP:您无权察看 2016-3-16 20:54:28 | [全部帖] [楼主帖] 6  楼



赞(0)    操作        顶端 
masuce
版主
等级:少校
经验:1166
发帖:59
精华:0
注册:2015-4-13
状态:离线
发送短消息息给masuce 加好友    发送短消息息给masuce 发消息
发表于: IP:您无权察看 2016-3-17 8:42:10 | [全部帖] [楼主帖] 7  楼

马克一下,以后有需要就来这里看



赞(0)    操作        顶端 
总帖数
7
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论