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的意义的更多相关文章

  1. linux 下各errno的意义(转)

    linux 下各errno的意义(转)   本文转自:http://blog.csdn.net/kofiory/article/details/5790409 strerror(errno):获取er ...

  2. linux 下信号处理命令trap && linux下各种信号的意义

    1.用途说明 trap是一个shell内建命令,它用来在脚本中指定信号如何处理.比如,按Ctrl+C会使脚本终止执行,实际上系统发送了SIGINT信号给脚本进程,SIGINT信号的默认处理方式就是退出 ...

  3. linux下错误的捕获:errno(errno.h)和strerror(string.h)的使用

    参考:http://blog.csdn.net/starstar1992/article/details/52756387 linux下错误的捕获:errno和strerror的使用 经常在调用lin ...

  4. linux下各种颜色文件的意义

    linux下的文件颜色的意义 蓝色表示目录;绿色表示可执行文件;红色表示压缩文件;浅蓝色表示链接文件;灰色表示其它文件;红色闪烁表示链接的文件有问题了;黄色是设备文件,包括block, char, f ...

  5. Linux下文件的三个时间意义及用法

    Linux下文件的三个时间参数: (1)modification time(mtime):内容修改时间        这里的修改时间指的是文件的内容发生变化,而更新的时间. (2)change tim ...

  6. Linux下c开发 之 线程通信(转)

    Linux下c开发 之 线程通信(转) 1.Linux“线程” 进程与线程之间是有区别的,不过Linux内核只提供了轻量进程的支持,未实现线程模型.Linux是一种“多进程单线程”的操作系统.Linu ...

  7. Linux下的C编程实战

    Linux下的C编程实战(一) ――开发平台搭建 1.引言 Linux操作系统在服务器领域的应用和普及已经有较长的历史,这源于它的开源特点以及其超越Windows的安全性和稳定性.而近年来, Linu ...

  8. Linux下串口编制【转】

    串行口是计算机一种常用的接口,具有连接线少,通讯简单,得到广泛的使用.常用的串口是RS-232-C接口(又称EIA RS-232-C)它是在1970年由美国电子工业协会(EIA)联合贝尔系统.调制解调 ...

  9. linux下的struct sigaction

    工作中使用案例: struct sigaction act; act.sa_sigaction = handleSignal; act.sa_flags = SA_SIGINFO; sigemptys ...

随机推荐

  1. Oracle通过主键id删除记录很慢

    问题描述: Oracle通过主键id删除2000条记录很慢,需要花费十二分钟. 解决过程: 1.首先查看SQL的执行计划,执行计划正常,cost只有4,用到了主键索引. 2.查看等待事件, selec ...

  2. php 之 查询 投票练习(0508)

    练习题目: 解题: 方法一: 1. 投票主页面: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...

  3. CPU与外设传送数据方式

    7.2 CPU与外设之间数据传送的方式 在微型计算机系统中,CPU与外设之间的数据传送方式主要有程序传送方式.中断传送方式和直接存储器存取(DMA)传送方式,分别介绍如下.     7.2.1 程序传 ...

  4. VIM中文乱码

    下面是关于VIM中文乱码问题的解决方法: 打开VIM的配制文件在里面加上一段这样的代码就可以了: set encoding=prc

  5. ARM的BIN文件反汇编方法

    最近在调试uboot的代码时,用的新版本的uboot,lowlevel_init函数里是空的,而且在链接文件中也没有发现对lowlevel_init.o的链接.在bl lowlevel_init 之前 ...

  6. iOS利用响应链机制点击tableview空白处关闭键盘-可以作为参考

    http://www.jianshu.com/p/9717b792599c   是原文地址 处理关闭键盘的做法一般分为两种:1.放弃第一响应者身份:2.当前视图结束编辑.通常情况下只要我们在合适的时机 ...

  7. TCP/IP 三次握手和四次握手

    三次握手建立连接: 第一次握手:客户端发送syn包(seq=x)到服务器,并进入SYN_SEND状态,等待服务器确认: 第二次握手:服务器收到syn包,必须确认客户的SYN(ack=x+1),同时自己 ...

  8. 151111 sqlite3数据库学习

    最近在学习数据库,想起去年做的项目里用到了sqlite3.那时候,没有任何的数据库经验,误打误撞,找到了sqlite3,然后参考网络上零碎的信息,把它嵌入到工程里,并且成功了.可惜,那时候没有好好保存 ...

  9. yum仅下载RPM包不安装

    http://www.ttlsa.com/linux/howto-yum-download-rpm-without-install/

  10. 【算法Everyday】第三日 KMP算法

    题目 你知道的. 分析 分析不来. 代码 void OutputArray(int* pArr, int iLen) { ; i < iLen; i++) { printf("%d\t ...