linux 错误码

Linux中系统调用的错误都存储于errno中,errno由操作系统维护,存储就近发生的错误,下一次的错误码会覆盖掉上一次的错误。

一、错误处理函数

#include <string.h>
//该函数把错误代码映射为一个字符串,对错误类型进行说明
char *strerror(int errnum);
#include <stdio.h>
//用来将上一个函数发生错误的原因输出到标准设备(stderr),参数s所指的字符串会先打印出,后面再加上错误原因字符串
void perror(const char *s);

2、错误码

1 - 34错误码在/usr/include/asm-generic/errno-base.h文件中
35 - 133错误码在/usr/include/asm-generic/errno.h文件中

namevalueDescription翻译
Success0Success成功
EPERM1Operation not permitted操作不允许
ENOENT2No such file or directory没有这样的文件或目录
ESRCH3No such process没有这样的过程
EINTR4Interrupted system call中断系统调用
EIO5I/O errorI/O错误
ENXIO6No such device or address没有这样的设备或地址
E2BIG7Argument list too long参数列表太长
ENOEXEC8Exec format errorExec格式错误
EBADF9Bad file number错误的文件描述符
ECHILD10No child processes没有子进程
EAGAIN11Try again资源暂时不可用
ENOMEM12Out of memory内存溢出
EACCES13Permission denied拒绝许可
EFAULT14Bad address错误的地址
ENOTBLK15Block device required块设备要求
EBUSY16Device or resource busy设备或资源忙
EEXIST17File exists文件已经存在
EXDEV18Invalid Cross-device link无效的交叉链接
ENODEV19No such device设备不存在
ENOTDIR20Not a directory不是一个目录
EISDIR21Is a directory是一个目录
EINVAL22Invalid argument无效的参数
ENFILE23File table overflow文件表溢出
EMFILE24Too many open files打开的文件太多
ENOTTY25Not a typewriter在不支持 I/O 控制操作的文件或特殊文件上执行该操作。例如,不要尝试在目录上设置波特率。
ETXTBSY26Text file busy文本文件忙
EFBIG27File too large文件太大
ENOSPC28No space left on device设备上没有空间
ESPIPE29Illegal seek非法的寻求
EROFS30Read-only file system只读文件系统
EMLINK31Too many links太多的链接
EPIPE32Broken pipe管道破裂
EDOM33Math argument out of domain of func数值结果超出范围
ERANGE34Math result not representable数值结果不具代表性
EDEADLK35Resource deadlock would occur出现资源死锁
ENAMETOOLONG36File name too long文件名太长
ENOLCK37No record locks available没有可用的记录锁
ENOSYS38Function not implemented功能没有实现
ENOTEMPTY39Directory not empty目录非空
ELOOP40Too many symbolic links encountered遇到太多的符号链接
EWOULDBLOCK41Operation would block ;as EAGAIN操作将阻止
ENOMSG42No message of desired type没有所需类型的消息
EIDRM43Identifier removed标识符删除
ECHRNG44Channel number out of range频道数超出范围
EL2NSYNC45Level 2 not synchronized2级不同步
EL3HLT46Level 3 halted3级中断
EL3RST47Level 3 reset三级重置
ELNRNG48Link number out of range链接数超出范围
EUNATCH49Protocol driver not attached协议驱动程序没有连接
ENOCSI50No CSI structure available没有CSI结构可用
EL2HLT51Level 2 halted2级中断
EBADE52Invalid exchange无效的交换
EBADR53Invalid request descriptor无效的请求描述符
EXFULL54Exchange full交换完整的
ENOANO55No anode没有阳极
EBADRQC56Invalid request code无效的请求代码
EBADSLT57Invalid slot无效的槽
EDEADLOCK58as EDEADLK和EDEADLK一样
EBFONT59Bad font file format字体文件格式错误
ENOSTR60Device not a stream设备不是字符流
ENODATA61No data available无可用数据
ETIME62Timer expired计时器过期
ENOSR63Out of streams resources流资源溢出
ENONET64Machine is not on the network机器不上网
ENOPKG65Package not installed没有安装软件包
EREMOTE66Object is remote对象是远程的
ENOLINK67Link has been severed链路已被切断
EADV68Advertise error广告的错误
ESRMNT69Srmount errorSrmount错误
ECOMM70Communication error on send发送时通信错误
EPROTO71Protocol error协议错误
EMULTIHOP72Multihop attempted多跳尝试
EDOTDOT73RFS specific errorRFS特定的错误
EBADMSG74Not a data message非数据消息
EOVERFLOW75Value too large for defined data type值对于定义的数据类型来说太大
ENOTUNIQ76Name not unique on network名称在网络上不唯一
EBADFD77File descriptor in bad state文件描述符在坏状态
EREMCHG78Remote address changed远程地址改变了
ELIBACC79Can not access a needed shared library无法访问所需的共享库
ELIBBAD80Accessing a corrupted shared library访问损坏的共享库
ELIBSCN81.lib section in a.out corrupted.lib部分在.out上损坏的
ELIBMAX82Attempting to link in too many shared libraries试图链接太多的共享库
ELIBEXEC83Cannot exec a shared library directly无法直接执行共享库
EILSEQ84Illegal byte sequence非法字节序列
ERESTART85Interrupted system call should be restarted应重新启动中断的系统调用
ESTRPIPE86Streams pipe error流管错误
EUSERS87Too many users太多的用户
ENOTSOCK88Socket operation on non-socket非套接字上的套接字操作
EDESTADDRREQ89Destination address required需要目的地址
EMSGSIZE90Message too long消息太长
EPROTOTYPE91Protocol wrong type for socket套接字的协议类型错误
ENOPROTOOPT92Protocol not available协议不可用
EPROTONOSUPPORT93Protocol not supported协议不支持
ESOCKTNOSUPPORT94Socket type not supported套接字类型不受支持
EOPNOTSUPP95Operation not supported on transport endpoint传输端点上不支持的操作
EPFNOSUPPORT96Protocol family not supported不支持协议族
EAFNOSUPPORT97Address family not supported by protocol协议不支持的地址族
EADDRINUSE98Address already in use地址已在使用
EADDRNOTAVAIL99Cannot assign requested address无法分配请求的地址
ENETDOWN100Network is down网络中瘫痪
ENETUNREACH101Network is unreachable网络是不可达
ENETRESET102Network dropped connection because of reset网络由于复位而断开连接
ECONNABORTED103Software caused connection abort软件导致连接中止
ECONNRESET104Connection reset by peer对等点重置连接
ENOBUFS105No buffer space available没有可用的缓冲区空间
EISCONN106Transport endpoint is already connected传输端点已经连接
ENOTCONN107Transport endpoint is not connected传输端点未连接
ESHUTDOWN108Cannot send after transport endpoint shutdown传输端点关闭后无法发送
ETOOMANYREFS109Too many references: cannot splice引用太多:不能拼接
ETIMEDOUT110Connection timed out连接超时
ECONNREFUSED111Connection refused连接拒绝
EHOSTDOWN112Host is down主机已关闭
EHOSTUNREACH113No route to host没有路由到主机
EALREADY114Operation already in progress已运行
EINPROGRESS115Operation now in progress正在运行
ESTALE116Stale file handle过期文件句柄
EUCLEAN117Structure needs cleaning结构需要清洗
ENOTNAM118Not a XENIX named type file不是一个命名类型文件的XENIX
ENAVAIL119No XENIX semaphores available没有XENIX信号量可用
EISNAM120Is a named type file是一个命名的文件类型
EREMOTEIO121Remote I/O error远程I/O错误
EDQUOT122Quota exceeded超出磁盘配额
ENOMEDIUM123No medium found没有发现介质
EMEDIUMTYPE124Wrong medium type错误的媒体类型
ECANCELED125Operation Canceled操作取消
ENOKEY126Required key not available所需键不可用
EKEYEXPIRED127Key has expired键已经过期
EKEYREVOKED128Key has been revoked键已被撤销
EKEYREJECTED129Key was rejected by service键被服务拒绝
EOWNERDEAD130Owner died所有者死亡
ENOTRECOVERABLE131State not recoverable状态不可恢复的
ERFKILL132Operation not possible due to RF-kill由于RF-kill而无法操作
EHWPOISON133Memory page has hardware error内存页有硬件错误
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值