linux 下各errno的意义
strerror(errno):获取errno对应的错误
#include <string.h> /* for strerror */
#include <errno.h>
#include <stdio.h> int main(int argc, char ** argv) {
int i = ;
for(i = ; i < ; i++)
printf("errno.%02d is: %s/n", i, strerror(i));
return ;
}
错误对照表:
errno0 : Success errno1 : Operation not permitted errno2 : No such file or directory errno3 : No such process errno4 : Interrupted system call errno5 : Input/output error errno6 : No such device or address errno7 : Argument list too long errno8 : Exec format error errno9 : Bad file descriptor errno10 : No child processes errno11 : Resource temporarily unavailable errno12 : Cannot allocate memory errno13 : Permission denied errno14 : Bad address errno15 : Block device required errno16 : Device or resource busy errno17 : File exists errno18 : Invalid cross-device link errno19 : No such device errno20 : Not a directory errno21 : Is a directory errno22 : Invalid argument errno23 : Too many open files in system errno24 : Too many open files errno25 : Inappropriate ioctl for device errno26 : Text file busy errno27 : File too large errno28 : No space left on device errno29 : Illegal seek errno30 : Read-only file system errno31 : Too many links errno32 : Broken pipe errno33 : Numerical argument out of domain errno34 : Numerical result out of range errno35 : Resource deadlock avoided errno36 : File name too long errno37 : No locks available errno38 : Function not implemented errno39 : Directory not empty errno40 : Too many levels of symbolic links errno41 : Unknown error errno42 : No message of desired type errno43 : Identifier removed errno44 : Channel number out of range errno45 : Level not synchronized errno46 : Level halted errno47 : Level reset errno48 : Link number out of range errno49 : Protocol driver not attached errno50 : No CSI structure available errno51 : Level halted errno52 : Invalid exchange errno53 : Invalid request descriptor errno54 : Exchange full errno55 : No anode errno56 : Invalid request code errno57 : Invalid slot errno58 : Unknown error errno59 : Bad font file format errno60 : Device not a stream errno61 : No data available errno62 : Timer expired errno63 : Out of streams resources errno64 : Machine is not on the network errno65 : Package not installed errno66 : Object is remote errno67 : Link has been severed errno68 : Advertise error errno69 : Srmount error errno70 : Communication error on send errno71 : Protocol error errno72 : Multihop attempted errno73 : RFS specific error errno74 : Bad message errno75 : Value too large for defined datatype errno76 : Name not unique on network errno77 : File descriptor in bad state errno78 : Remote address changed errno79 : Can not access a needed sharedlibrary errno80 : Accessing a corrupted sharedlibrary errno81 : .lib section in a.out corrupted errno82 : Attempting to link in too manyshared libraries errno83 : Cannot exec a shared librarydirectly errno84 : Invalid or incomplete multibyte orwide character errno85 : Interrupted system call should berestarted errno86 : Streams pipe error errno87 : Too many users errno88 : Socket operation on non-socket errno89 : Destinationaddress required errno90 : Message too long errno91 : Protocol wrong type for socket errno92 : Protocol not available errno93 : Protocol not supported errno94 : Socket type not supported errno95 : Operation not supported errno96 : Protocol family not supported errno97 : Address family not supported byprotocol errno98 : Address already in use errno99 : Cannot assign requested address errno100 : Network is down errno101 : Network is unreachable errno102 : Network dropped connection onreset errno103 : Software caused connection abort errno104 : Connection reset by peer errno105 : No buffer space available errno106 : Transport endpoint is alreadyconnected errno107 : Transport endpoint is notconnected errno108 : Cannot send after transportendpoint shutdown errno109 : Too many references: cannot splice errno110 : Connection timed out errno111 : Connection refused errno112 : Host is down errno113 : No route to host errno114 : Operation already in progress errno115 : Operation now in progress errno116 : Stale NFS file handle errno117 : Structure needs cleaning errno118 : Not a XENIX named type file errno119 : No XENIX semaphores available errno120 : Is a named type file errno121 : Remote I/O error errno122 : Disk quota exceeded errno123 : No medium found errno124 : Wrong medium type errno125 : Operation canceled errno126 : Required key not available errno127 : Key has expired errno128 : Key has been revoked errno129 : Key was rejected by service errno130 : Owner died errno131 : State not recoverable errno132 : Operation not possible due toRF-kill errno133 : Unknown error errno134 : Unknown error errno135 : Unknown error errno136 : Unknown error errno137 : Unknown error errno138 : Unknown error errno139 : Unknown error
具体宏定义如下:
头文件 /usr/include/asm-generic/errno-base.h 的源码:
#ifndef _ASM_GENERIC_ERRNO_BASE_H
#define _ASM_GENERIC_ERRNO_BASE_H #define EPERM 1 /* Operation not permitted */
#define ENOENT2 /* 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 ENOEXEC8 /* Exec format error */
#define EBADF 9 /* Bad file number */
#define ECHILD10 /* No child processes */
#define EAGAIN11 /* Try again */
#define ENOMEM12 /* Out of memory */
#define EACCES13 /* Permission denied */
#define EFAULT14 /* Bad address */
#define ENOTBLK15 /* Block device required */
#define EBUSY 16 /* Device or resource busy */
#define EEXIST17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV19 /* No such device */
#define ENOTDIR20 /* Not a directory */
#define EISDIR21 /* Is a directory */
#define EINVAL22 /* Invalid argument */
#define ENFILE23 /* File table overflow */
#define EMFILE24 /* Too many open files */
#define ENOTTY25 /* Not a typewriter */
#define ETXTBSY26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC28 /* No space left on device */
#define ESPIPE29 /* Illegal seek */
#define EROFS 30 /* Read-only file system */
#define EMLINK31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
#define EDOM 33 /* Math argument out of domain of func */
#define ERANGE34 /* Math result not representable */ #endif
头文件/usr/include/asm-generic/erno.h源码:
#ifndef _ASM_GENERIC_ERRNO_H
#define _ASM_GENERIC_ERRNO_H #include <asm-generic/errno-base.h> #define EDEADLK35 /* Resource deadlock would occur */
#define ENAMETOOLONG36 /* File name too long */
#define ENOLCK37 /* No record locks available */
#define ENOSYS38 /* Function not implemented */
#define ENOTEMPTY39 /* Directory not empty */
#define ELOOP 40 /* Too many symbolic links encountered */
#define EWOULDBLOCKEAGAIN /* Operation would block */
#define ENOMSG42 /* No message of desired type */
#define EIDRM 43 /* Identifier removed */
#define ECHRNG44 /* Channel number out of range */
#define EL2NSYNC45 /* Level 2 not synchronized */
#define EL3HLT46 /* Level 3 halted */
#define EL3RST47 /* Level 3 reset */
#define ELNRNG48 /* Link number out of range */
#define EUNATCH49 /* Protocol driver not attached */
#define ENOCSI50 /* No CSI structure available */
#define EL2HLT51 /* Level 2 halted */
#define EBADE 52 /* Invalid exchange */
#define EBADR 53 /* Invalid request descriptor */
#define EXFULL54 /* Exchange full */
#define ENOANO55 /* No anode */
#define EBADRQC56 /* Invalid request code */
#define EBADSLT57 /* Invalid slot */ #define EDEADLOCKEDEADLK #define EBFONT59 /* Bad font file format */
#define ENOSTR60 /* Device not a stream */
#define ENODATA61 /* No data available */
#define ETIME 62 /* Timer expired */
#define ENOSR 63 /* Out of streams resources */
#define ENONET64 /* Machine is not on the network */
#define ENOPKG65 /* Package not installed */
#define EREMOTE66 /* Object is remote */
#define ENOLINK67 /* Link has been severed */
#define EADV 68 /* Advertise error */
#define ESRMNT69 /* Srmount error */
#define ECOMM 70 /* Communication error on send */
#define EPROTO71 /* Protocol error */
#define EMULTIHOP72 /* Multihop attempted */
#define EDOTDOT73 /* RFS specific error */
#define EBADMSG74 /* Not a data message */
#define EOVERFLOW75 /* Value too large for defined data type */
#define ENOTUNIQ76 /* Name not unique on network */
#define EBADFD77 /* File descriptor in bad state */
#define EREMCHG78 /* Remote address changed */
#define ELIBACC79 /* Can not access a needed shared library */
#define ELIBBAD80 /* Accessing a corrupted shared library */
#define ELIBSCN81 /* .lib section in a.out corrupted */
#define ELIBMAX82 /* Attempting to link in too many shared libraries */
#define ELIBEXEC83 /* Cannot exec a shared library directly */
#define EILSEQ84 /* Illegal byte sequence */
#define ERESTART85 /* Interrupted system call should be restarted */
#define ESTRPIPE86 /* Streams pipe error */
#define EUSERS87 /* Too many users */
#define ENOTSOCK88 /* Socket operation on non-socket */
#define EDESTADDRREQ89 /* Destination address required */
#define EMSGSIZE90 /* Message too long */
#define EPROTOTYPE91 /* Protocol wrong type for socket */
#define ENOPROTOOPT92 /* Protocol not available */
#define EPROTONOSUPPORT93 /* Protocol not supported */
#define ESOCKTNOSUPPORT94 /* Socket type not supported */
#define EOPNOTSUPP95 /* Operation not supported on transport endpoint */
#define EPFNOSUPPORT96 /* Protocol family not supported */
#define EAFNOSUPPORT97 /* Address family not supported by protocol */
#define EADDRINUSE98 /* Address already in use */
#define EADDRNOTAVAIL99 /* Cannot assign requested address */
#define ENETDOWN100 /* Network is down */
#define ENETUNREACH101 /* Network is unreachable */
#define ENETRESET102 /* Network dropped connection because of reset */
#define ECONNABORTED103 /* Software caused connection abort */
#define ECONNRESET104 /* Connection reset by peer */
#define ENOBUFS105 /* No buffer space available */
#define EISCONN106 /* Transport endpoint is already connected */
#define ENOTCONN107 /* Transport endpoint is not connected */
#define ESHUTDOWN108 /* Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS109 /* Too many references: cannot splice */
#define ETIMEDOUT110 /* Connection timed out */
#define ECONNREFUSED111 /* Connection refused */
#define EHOSTDOWN112 /* Host is down */
#define EHOSTUNREACH113 /* No route to host */
#define EALREADY114 /* Operation already in progress */
#define EINPROGRESS115 /* Operation now in progress */
#define ESTALE116 /* Stale NFS file handle */
#define EUCLEAN117 /* Structure needs cleaning */
#define ENOTNAM118 /* Not a XENIX named type file */
#define ENAVAIL119 /* No XENIX semaphores available */
#define EISNAM120 /* Is a named type file */
#define EREMOTEIO121 /* Remote I/O error */
#define EDQUOT122 /* Quota exceeded */
#define ENOMEDIUM123 /* No medium found */
#define EMEDIUMTYPE124 /* Wrong medium type */
#define ECANCELED125 /* Operation Canceled */
#define ENOKEY126 /* Required key not available */
#define EKEYEXPIRED127 /* Key has expired */
#define EKEYREVOKED128 /* Key has been revoked */
#define EKEYREJECTED129 /* Key was rejected by service */ /* for robust mutexes */ #define EOWNERDEAD130 /* Owner died */
#define ENOTRECOVERABLE131 /* State not recoverable */
#define ERFKILL 132/* Operation not possible due to RF-kill */ #endif
linux 下各errno的意义的更多相关文章
- linux 下各errno的意义(转)
linux 下各errno的意义(转) 本文转自:http://blog.csdn.net/kofiory/article/details/5790409 strerror(errno):获取er ...
- linux 下信号处理命令trap && linux下各种信号的意义
1.用途说明 trap是一个shell内建命令,它用来在脚本中指定信号如何处理.比如,按Ctrl+C会使脚本终止执行,实际上系统发送了SIGINT信号给脚本进程,SIGINT信号的默认处理方式就是退出 ...
- linux下错误的捕获:errno(errno.h)和strerror(string.h)的使用
参考:http://blog.csdn.net/starstar1992/article/details/52756387 linux下错误的捕获:errno和strerror的使用 经常在调用lin ...
- linux下各种颜色文件的意义
linux下的文件颜色的意义 蓝色表示目录;绿色表示可执行文件;红色表示压缩文件;浅蓝色表示链接文件;灰色表示其它文件;红色闪烁表示链接的文件有问题了;黄色是设备文件,包括block, char, f ...
- Linux下文件的三个时间意义及用法
Linux下文件的三个时间参数: (1)modification time(mtime):内容修改时间 这里的修改时间指的是文件的内容发生变化,而更新的时间. (2)change tim ...
- Linux下c开发 之 线程通信(转)
Linux下c开发 之 线程通信(转) 1.Linux“线程” 进程与线程之间是有区别的,不过Linux内核只提供了轻量进程的支持,未实现线程模型.Linux是一种“多进程单线程”的操作系统.Linu ...
- Linux下的C编程实战
Linux下的C编程实战(一) ――开发平台搭建 1.引言 Linux操作系统在服务器领域的应用和普及已经有较长的历史,这源于它的开源特点以及其超越Windows的安全性和稳定性.而近年来, Linu ...
- Linux下串口编制【转】
串行口是计算机一种常用的接口,具有连接线少,通讯简单,得到广泛的使用.常用的串口是RS-232-C接口(又称EIA RS-232-C)它是在1970年由美国电子工业协会(EIA)联合贝尔系统.调制解调 ...
- linux下的struct sigaction
工作中使用案例: struct sigaction act; act.sa_sigaction = handleSignal; act.sa_flags = SA_SIGINFO; sigemptys ...
随机推荐
- js 判断时间,满足执行框架
// 8点到早上19点关var curr = new Date();var time = curr.getHours(); if ( time >=0 && time <2 ...
- 拓扑排序-DFS
拓扑排序的DFS算法 输入:一个有向图 输出:顶点的拓扑序列 具体流程: (1) 调用DFS算法计算每一个顶点v的遍历完成时间f[v] (2) 当一个顶点完成遍历时,将该顶点放到一个链表的最前面 (3 ...
- JQUERY1.9学习笔记 之属性选择器(一) 前缀选择器
描述:选择指定属性值的元素,或者是以字符串开始其后跟随“-”符号的. jQuery( "[attribute|='value']" ) 例:查找出所有语言属性为en的链接. < ...
- PHP面向对象(OOP):__toString()方法
我们前面说过在类里面声明“__”开始的方法名的方法(PHP给我们提供的),都是在某一时刻不同情况下自动调用执行的方 法,“__toString()”方法也是一样自动被调用的,是在直接输出对象引用时自动 ...
- opencv之图像腐蚀
最近准备好好学习opencv 这博客就是我的学习笔记. #include <cv.h> #include <highgui.h> using namespace std; vo ...
- python变量不能以数字打头
在编写python函数时,无意中发现一个问题:python中的变量不能以数字打头,以下函数中定义了一个变量3_num_varchar,执行时报错. 函数如下: def database_feild_v ...
- IOS设计模式之三:MVC模式
IOS设计模式之三:MVC模式 模型-视图-控制器 这个模式其实应该叫做MCV,用控制器把model与view隔开才对,也就是model与view互相不知道对方的存在,没有任何瓜葛,他们就像一个团 ...
- win32控制台实现按任意键退出的功能
win7之后的五win32 控制台出现了程序运行完之后就立即结束的问题,程序员根本无法看输出的结果.未来让控制台运行完之后能够等待程序员的操作.可以使用: system("PAUSE&quo ...
- Mongodb2.6升级到Mongodb3.0.2笔记
PS:升级到3版本的Mongodb以后,drop集合是可以直接释放磁盘空间的 停止老版本Mongodb >use admin >db.shutdownServer(); 下载解压新版本Mo ...
- [BZOJ 2165] 大楼 【DP + 倍增 + 二进制】
题目链接:BZOJ - 2165 题目分析: 这道题我读了题之后就想不出来怎么做,题解也找不到,于是就请教了黄学长,黄学长立刻秒掉了这道题,然后我再看他的题解才写出来..Orz 使用 DP + 倍增 ...