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 ...
随机推荐
- C语言结构体(struct)使用方法
基本定义:结构体,通俗讲就像是打包封装,把一些变量有共同特征(比如同属于某一类事物的属性)的变量封装在内部,通过一定方法访问修改内部变量. 结构体定义: 第一种:只有结构体定义 struct stuf ...
- 2661: [BeiJing wc2012]连连看
Description 凡是考智商的题里面总会有这么一种消除游戏.不过现在面对的这关连连看可不是QQ游戏里那种考眼力的游戏.我们的规则是,给出一个闭区间[a,b]中的全部整数,如果其中某两个数x,y( ...
- Extjs通过structs2生成树结构
Extjs为我们提供了强大的树的生成方式,我们不必通过原始的js去生成树形结构.在这里我做了一个简单的树结构生成.代码如下,同时在后台使用了fastjson-1.1.15.jar的jar包生成json ...
- 45 Useful JavaScript Tips, Tricks and Best Practices(有用的JavaScript技巧,技巧和最佳实践)
As you know, JavaScript is the number one programming language in the world, the language of the web ...
- Count The Carries
hdu:http://acm.hdu.edu.cn/showproblem.php?pid=4588 题意:给你 a,b两个数,然后让a到b之间的数做2进制的加法,问你与多少次进位.例如:1,3,1+ ...
- 一点BPXA的思考
懂的人自然懂... BPXA功能配置 这个概念现在还有印象,记录下来: 一,BPXA是用于BP使用第三方资源的.如使用ORACLE数据库,就是在XA里配置.它的特征是以<xa>开头 二,B ...
- 把消息送到默认窗口函数里,并非一点用都没有,可能会产生新的消息(以WM_WINDOWPOSCHANGED为例)
我在追踪执行: procedure TForm1.Button1Click(Sender: TObject); begin panel1.Left:=panel1.Left-; end; 并且屏蔽TW ...
- netstat详解
Netstat 命令用于显示各种网络相关信息,如网络连接,路由表,接口状态 (Interface Statistics),masquerade 连接,多播成员 (Multicast Membershi ...
- 分页SQL取下一页
20条记录一页,扫描第2页就需要访问40条记录. SQL> select * from ( select * from ( select /*+ index_desc(a idx_page_3) ...
- Qt入门(8)——事件和事件过滤器
在Qt里,一个事件是继承自QEvent的对象.事件通过调用QObject::event(),被发送到继承自 QObject 的对象.事件发送就是一个事件已经产生,由 QEvent正好去表达,且QObj ...