Linux c/c++编程--知识点(11)errno,strerror
文章原文:
返回知识列表:Linux c/c++编程-- 知识点汇总
#include <errno.h> 声明了errno
NAMEerrno - number of last errorSYNOPSIS#include <errno.h>
errorno 的使用比较简单,只要include 这个头文件 errno.h 就可以了。
同时,#include <string.h> 声明了strerror(errno) 函数,用于打印错误码对应的字符串描述。
#include <string.h>char *strerror(int errnum);
将errno 贴在下面,供查看:
errno.00 is: Success
errno.01 is: Operation not permitted
errno.02 is: No such file or directory
errno.03 is: No such process
errno.04 is: Interrupted system call
errno.05 is: Input/output error
errno.06 is: No such device or address
errno.07 is: Argument list too long
errno.08 is: Exec format error
errno.09 is: Bad file descriptor
errno.10 is: No child processes
errno.11 is: Resource temporarily unavailable[资源临时不可用](连续发送数据时候回出此错,加延时)
errno.12 is: Cannot allocate memory
errno.13 is: Permission denied 做android时候,经常遇到这个错误。权限受限,socket connect() 失败。
errno.14 is: Bad address
errno.15 is: Block device required
errno.16 is: Device or resource busy
errno.17 is: File exists
errno.18 is: Invalid cross-device link
errno.19 is: No such device
errno.20 is: Not a directory
errno.21 is: Is a directory
errno.22 is: Invalid argument
errno.23 is: Too many open files in system
errno.24 is: Too many open files
errno.25 is: Inappropriate ioctl for device
errno.26 is: Text file busy
errno.27 is: File too large
errno.28 is: No space left on device
errno.29 is: Illegal seek
errno.30 is: Read-only file system
errno.31 is: Too many links
errno.32 is: Broken pipe[断开的管道](原因:the broken pipe error occurs if one end of the
TCP socket closes connection(using disconnect) or gets killed and the other
end tries to still write to it. An indication of a closed/terminated
connection is a return value of 0 when you try to read from that socket
using recv. After receiving such an error, if you try to still write to the
socket, your process gets sent the SIGPIPE signal which kills it.
)
errno.33 is: Numerical argument out of domain
errno.34 is: Numerical result out of range
errno.35 is: Resource deadlock avoided
errno.36 is: File name too long
errno.37 is: No locks available
errno.38 is: Function not implemented
errno.39 is: Directory not empty
errno.40 is: Too many levels of symbolic links
errno.41 is: Unknown error 41
errno.42 is: No message of desired type
errno.43 is: Identifier removed
errno.44 is: Channel number out of range
errno.45 is: Level 2 not synchronized
errno.46 is: Level 3 halted
errno.47 is: Level 3 reset
errno.48 is: Link number out of range
errno.49 is: Protocol driver not attached
errno.50 is: No CSI structure available
errno.51 is: Level 2 halted
errno.52 is: Invalid exchange
errno.53 is: Invalid request descriptor
errno.54 is: Exchange full
errno.55 is: No anode
errno.56 is: Invalid request code
errno.57 is: Invalid slot
errno.58 is: Unknown error 58
errno.59 is: Bad font file format
errno.60 is: Device not a stream
errno.61 is: No data available
errno.62 is: Timer expired
errno.63 is: Out of streams resources
errno.64 is: Machine is not on the network
errno.65 is: Package not installed
errno.66 is: Object is remote
errno.67 is: Link has been severed
errno.68 is: Advertise error
errno.69 is: Srmount error
errno.70 is: Communication error on send
errno.71 is: Protocol error
errno.72 is: Multihop attempted
errno.73 is: RFS specific error
errno.74 is: Bad message
errno.75 is: Value too large for defined data type
errno.76 is: Name not unique on network
errno.77 is: File descriptor in bad state
errno.78 is: Remote address changed
errno.79 is: Can not access a needed shared library
errno.80 is: Accessing a corrupted shared library
errno.81 is: .lib section in a.out corrupted
errno.82 is: Attempting to link in too many shared libraries
errno.83 is: Cannot exec a shared library directly
errno.84 is: Invalid or incomplete multibyte or wide character
errno.85 is: Interrupted system call should be restarted
errno.86 is: Streams pipe error
errno.87 is: Too many users
errno.88 is: Socket operation on non-socket
errno.89 is: Destination address required
errno.90 is: Message too long
errno.91 is: Protocol wrong type for socket
errno.92 is: Protocol not available
errno.93 is: Protocol not supported
errno.94 is: Socket type not supported
errno.95 is: Operation not supported
errno.96 is: Protocol family not supported
errno.97 is: Address family not supported by protocol
errno.98 is: Address already in use
errno.99 is: Cannot assign requested address
errno.100 is: Network is down
errno.101 is: Network is unreachable
errno.102 is: Network dropped connection on reset
errno.103 is: Software caused connection abort
errno.104 is: Connection reset by peer[l连接被对端重置]
errno.105 is: No buffer space available
errno.106 is: Transport endpoint is already connected
errno.107 is: Transport endpoint is not connected
errno.108 is: Cannot send after transport endpoint shutdown
errno.109 is: Too many references: cannot splice
errno.110 is: Connection timed out
errno.111 is: Connection refused
errno.112 is: Host is down
errno.113 is: No route to host
errno.114 is: Operation already in progress
errno.115 is: Operation now in progress
errno.116 is: Stale NFS file handle
errno.117 is: Structure needs cleaning
errno.118 is: Not a XENIX named type file
errno.119 is: No XENIX semaphores available
errno.120 is: Is a named type file
errno.121 is: Remote I/O error
errno.122 is: Disk quota exceeded
errno.123 is: No medium found
errno.124 is: Wrong medium type
errno.125 is: Operation canceled
errno.126 is: Required key not available
errno.127 is: Key has expired
errno.128 is: Key has been revoked
errno.129 is: Key was rejected by service
errno.130 is: Owner died
errno.131 is: State not recoverable
errno.132 is: Unknown error 132
132-255 全是Unknown error
附上一段中文的:
1 #define EPERM 1 // Operation not permitted 操作不允许
2 #define ENOENT 2 // No such file or directory 文件/路径不存在
3 #define ESRCH 3 // No such process 进程不存在
4 #define EINTR 4 // Interrupted system call 中断的系统调用
5 #define EIO 5 // I/O error I/O错误
6 #define ENXIO 6 // No such device or address 设备/地址不存在
7 #define E2BIG 7 // Arg list too long 参数列表过长
8 #define ENOEXEC 8 // Exec format error 执行格式错误
9 #define EBADF 9 // Bad file number 错误文件编号
10 #define ECHILD 10 // No child processes 子进程不存在
11 #define EAGAIN 11 // Try again 重试
12 #define ENOMEM 12 // Out of memory 内存不足
13 #define EACCES 13 // Permission denied 无权限
14 #define EFAULT 14 // Bad address 地址错误
15 #define ENOTBLK 15 // Block device required 需要块设备
16 #define EBUSY 16 // Device or resource busy 设备或资源忙
17 #define EEXIST 17 // File exists 文件已存在
18 #define EXDEV 18 // Cross-device link 跨设备链路
19 #define ENODEV 19 // No such device 设备不存在
20 #define ENOTDIR 20 // Not a directory 路径不存在
21 #define EISDIR 21 // Is a directory 是路径
22 #define EINVAL 22 // Invalid argument 无效参数
23 #define ENFILE 23 // File table overflow 文件表溢出
24 #define EMFILE 24 // Too many open files 打开的文件过多
25 #define ENOTTY 25 // Not a typewriter 非打字机
26 #define ETXTBSY 26 // Text file busy 文本文件忙
27 #define EFBIG 27 // File too large 文件太大
28 #define ENOSPC 28 // No space left on device 设备无空间
29 #define ESPIPE 29 // Illegal seek 非法查询
30 #define EROFS 30 // Read-only file system 只读文件系统
31 #define EMLINK 31 // Too many links 链接太多
32 #define EPIPE 32 // Broken pipe 管道破裂
33 #define EDOM 33 // Math argument out of domain of func 参数超出函数域
34 #define ERANGE 34 // Math result not representable 结果无法表示
35 #define EDEADLK 35 // Resource deadlock would occur 资源将发生死锁
36 #define ENAMETOOLONG 36 // File name too long 文件名太长
37 #define ENOLCK 37 // No record locks available 没有可用的记录锁
38 #define ENOSYS 38 // Function not implemented 函数未实现
39 #define ENOTEMPTY 39 // Directory not empty 目录非空
40 #define ELOOP 40 // Too many symbolic links encountered 遇到太多符号链接
41 #define EWOULDBLOCK EAGAIN // Operation would block 操作会阻塞
42 #define ENOMSG 42 // No message of desired type 没有符合需求类型的消息
43 #define EIDRM 43 // Identifier removed 标识符已删除
44 #define ECHRNG 44 // Channel number out of range 通道编号超出范围
45 #define EL2NSYNC 45 // Level 2 not synchronized level2不同步
46 #define EL3HLT 46 // Level 3 halted 3级停止
47 #define EL3RST 47 // Level 3 reset 3级重置
48 #define ELNRNG 48 // Link number out of range 链接编号超出范围
49 #define EUNATCH 49 // Protocol driver not attached 协议驱动程序没有连接
50 #define ENOCSI 50 // No CSI structure available 没有可用的CSI结构
51 #define EL2HLT 51 // Level 2 halted 2级停止
52 #define EBADE 52 // Invalid exchange 无效交换
53 #define EBADR 53 // Invalid request descriptor 无效请求描述
54 #define EXFULL 54 // Exchange full 交换完全
55 #define ENOANO 55 // No anode 无阳极
56 #define EBADRQC 56 // Invalid request code 无效请求码
57 #define EBADSLT 57 // Invalid slot 无效插槽
58 #define EDEADLOCK EDEADLK
59 #define EBFONT 59 // Bad font file format 错误的字体文件格式
60 #define ENOSTR 60 // Device not a stream 设备不是流
61 #define ENODATA 61 // No data available 无数据
62 #define ETIME 62 // Timer expired 计时器到期
63 #define ENOSR 63 // Out of streams resources 流资源不足
64 #define ENONET 64 // Machine is not on the network 机器不在网络上
65 #define ENOPKG 65 // Package not installed 包未安装
66 #define EREMOTE 66 // Object is remote 对象是远程
67 #define ENOLINK 67 // Link has been severed 链接正在服务中
68 #define EADV 68 // Advertise error 广告错误
69 #define ESRMNT 69 // Srmount error ?
70 #define ECOMM 70 // Communication error on send 发送过程中通讯错误
71 #define EPROTO 71 // Protocol error 协议错误
72 #define EMULTIHOP 72 // Multihop attempted 多跳尝试
73 #define EDOTDOT 73 // RFS specific error RFS特定错误
74 #define EBADMSG 74 // Not a data message 不是数据类型消息
75 #define EOVERFLOW 75 // Value too large for defined data type 对指定的数据类型来说值太大
76 #define ENOTUNIQ 76 // Name not unique on network 网络上名字不唯一
77 #define EBADFD 77 // File descriptor in bad state 文件描述符状态错误
78 #define EREMCHG 78 // Remote address changed 远程地址改变
79 #define ELIBACC 79 // Can not access a needed shared library 无法访问需要的共享库
80 #define ELIBBAD 80 // Accessing a corrupted shared library 访问损坏的共享库
81 #define ELIBSCN 81 // .lib section in a.out corrupted 库部分在a.out损坏
82 #define ELIBMAX 82 // Attempting to link in too many shared libraries 试图链接太多的共享库
83 #define ELIBEXEC 83 // Cannot exec a shared library directly 不能直接运行共享库
84 #define EILSEQ 84 // Illegal byte sequence 非法字节序
85 #define ERESTART 85 // Interrupted system call should be restarted 应重新启动被中断的系统调用
86 #define ESTRPIPE 86 // Streams pipe error 流管错误
87 #define EUSERS 87 // Too many users 用户太多
88 #define ENOTSOCK 88 // Socket operation on non-socket 在非套接字上进行套接字操作
89 #define EDESTADDRREQ 89 // Destination address required 需要目的地址
90 #define EMSGSIZE 90 // Message too long 消息太长
91 #define EPROTOTYPE 91 // Protocol wrong type for socket 错误协议类型
92 #define ENOPROTOOPT 92 // Protocol not available 协议不可用
93 #define EPROTONOSUPPORT 93 // Protocol not supported 不支持协议
94 #define ESOCKTNOSUPPORT 94 // Socket type not supported 不支持套接字类型
95 #define EOPNOTSUPP 95 // Operation not supported on transport endpoint 操作上不支持传输端点
96 #define EPFNOSUPPORT 96 // Protocol family not supported 不支持协议族
97 #define EAFNOSUPPORT 97 // Address family not supported by protocol 协议不支持地址群
98 #define EADDRINUSE 98 // Address already in use 地址已被使用
99 #define EADDRNOTAVAIL 99 // Cannot assign requested address 无法分配请求的地址
100 #define ENETDOWN 100 // Network is down 网络已关闭
101 #define ENETUNREACH 101 // Network is unreachable 网络不可达
102 #define ENETRESET 102 // Network dropped connection because of reset 网络由于复位断开连接
103 #define ECONNABORTED 103 // Software caused connection abort 软件导致连接终止
104 #define ECONNRESET 104 // Connection reset by peer 连接被对方复位
105 #define ENOBUFS 105 // No buffer space available 没有可用的缓存空间
106 #define EISCONN 106 // Transport endpoint is already connected 传输端点已连接
107 #define ENOTCONN 107 // Transport endpoint is not connected 传输端点未连接
108 #define ESHUTDOWN 108 // Cannot send after transport endpoint shutdown 传输端点关闭后不能在发送
109 #define ETOOMANYREFS 109 // Too many references: cannot splice 太多的引用:无法接合
110 #define ETIMEDOUT 110 // Connection timed out 连接超时
111 #define ECONNREFUSED 111 // Connection refused 连接被拒绝
112 #define EHOSTDOWN 112 // Host is down 主机已关闭
113 #define EHOSTUNREACH 113 // No route to host 无法路由到主机
114 #define EALREADY 114 // Operation already in progress 操作已在进程中
115 #define EINPROGRESS 115 // Operation now in progress 进程中正在进行的操作
116 #define ESTALE 116 // Stale NFS file handle
117 #define EUCLEAN 117 // Structure needs cleaning
118 #define ENOTNAM 118 // Not a XENIX named type file
119 #define ENAVAIL 119 // No XENIX semaphores available
120 #define EISNAM 120 // Is a named type file
121 #define EREMOTEIO 121 // Remote I/O error
122 #define EDQUOT 122 // Quota exceeded
123 #define ENOMEDIUM 123 // No medium found
124 #define EMEDIUMTYPE 124 // Wrong medium type
Linux c/c++编程--知识点(11)errno,strerror相关推荐
- linux bash脚本编程知识点
bash变量类型: 环境变量 本地变量(局部变量) 位置变量 特殊变量 本地变量: set VARNAME=VALUE: 作用域为整个bash进程: 引用变量 $(varname) 局部变量: loc ...
- Linux Shell脚本编程基础(11)
实际上Shell是一个命令解释器,它解释由用户输入的命令并且把它们送到内核,不仅如此,Shell有自己的编程语言用于对命令的编辑,它允许用户编写由shell命令组成的程序.Shel编程语言具有普通编程 ...
- 实习秋招linux和网络编程知识点总结
实习/秋招时按自己需求总结的知识点,内容并不十分详细,建议选择性阅读. 部分图片已失效. git常用命令速查表 git回滚 https://www.jianshu.com/p/f7451177476a ...
- Linux串口应用编程
目录 Demo 串口应用编程介绍 终端Terminal 串口应用编程(配置.读取.写入) struct termios 结构体配置 输入模式: c_iflag 输出模式: c_oflag 控制模式: ...
- Linux C高级编程——文件操作之系统调用
Linux C高级编程文件操作之系统调用 宗旨:技术的学习是有限的,分享的精神是无限的! 库函数是一些完成特定功能的函数,一般由某个标准组织制作发布,并形成一定的标准.使用库函数编写的函数一般可以应用 ...
- Linux的网络编程面试题汇总
1:tcp和udp的区别 2:流量控制和拥塞控制的实现机制 3:滑动窗口的实现机制 4:多线程如何同步. 5:进程间通讯的方式有哪些,各有什么优缺点 6:tcp连接建立的时候3次握手的具体过程,以及其 ...
- 【正点原子Linux连载】第二十章 V4L2摄像头应用编程-摘自【正点原子】I.MX6U嵌入式Linux C应用编程指南V1.1
1)实验平台:正点原子阿尔法Linux开发板 2)平台购买地址:https://item.taobao.com/item.htm?id=603672744434 2)全套实验源码+手册+视频下载地址: ...
- 【正点原子Linux连载】第二十三章 音频应用编程-摘自【正点原子】I.MX6U嵌入式Linux C应用编程指南V1.1
第二十三章 音频应用编程 ALPHA I.MX6U开发板支持音频,板上搭载了音频编解码芯片WM8960,支持播放以及录音功能! 本章我们来学习Linux下的音频应用编程,音频应用编程相比于前面几个章节 ...
- linux c语言编程(转)
linux操作系统下 c语言编程入门 整理编写:007xiong 原文:Hoyt等 (一)目录介绍 1)Linux程序设计入门--基础知识 2)Linux程序设计入门--进程介绍 3)Linux程序设 ...
最新文章
- 基于EM算法的高斯混合模型参数估计
- Python3有效括号问题
- 安装配置 radicale
- h5链接加上 vconsole_又出爆款!凯美瑞和红旗H5没法比!
- 云计算的概念_云计算概念掀起涨停潮 美利云奠定板块龙头地位
- ext get id js_Ext.getCmp(“id”) 简单应用 | 学步园
- mysql master or master copy
- iphone开机白苹果_「手机维修自学教程」苹果6PLUS的DFU模式故障维修技巧思路决定速度...
- std string与线程安全_是std :: regex线程安全吗?
- vmware 官方下载
- 四元数与欧拉角的转换关系
- 华硕天选笔记本电脑启动机器后搜索不到网络
- 瑞典计算机最好的大学排名,瑞典前十大学一览表
- 学会感谢--谈辞职信的写法
- python dataframe删除重复行_2.3.10 DataFrame 查看删除重复项
- Java List和String互相转换
- 【VBA编程】Sub过程
- matplotlib画各种图的方法(2)
- win10 wsl 调用ST-LINK_CLI.exe 遇到的问题总结
- mac好用的软件推荐之程序员篇