linux系统中errno与error对照表

简介:

1、使用了一个小程序输出所有的errno对应的error字符串,代码如下

#include <errno.h>

void showError(int err)
{
  printf("errno : %5d , error : %s\n", err, strerror(err));
}

void showAllErr() 
{
  int i = 0; 
  for(;i < 256; i++)
  {
    showError(i);
  }
}

int main(int argc, char * argv[])
{
  showAllErr();

  return 0;
}

 

2、运行上面代码,结果如下

errno : 0 , error : Success
errno : 1 , error : Operation not permitted
errno : 2 , error : No such file or directory
errno : 3 , error : No such process
errno : 4 , error : Interrupted system call
errno : 5 , error : Input/output error
errno : 6 , error : No such device or address
errno : 7 , error : Argument list too long
errno : 8 , error : Exec format error
errno : 9 , error : Bad file descriptor
errno : 10 , error : No child processes
errno : 11 , error : Resource temporarily unavailable
errno : 12 , error : Cannot allocate memory
errno : 13 , error : Permission denied
errno : 14 , error : Bad address
errno : 15 , error : Block device required
errno : 16 , error : Device or resource busy
errno : 17 , error : File exists
errno : 18 , error : Invalid cross-device link
errno : 19 , error : No such device
errno : 20 , error : Not a directory
errno : 21 , error : Is a directory
errno : 22 , error : Invalid argument
errno : 23 , error : Too many open files in system
errno : 24 , error : Too many open files
errno : 25 , error : Inappropriate ioctl for device
errno : 26 , error : Text file busy
errno : 27 , error : File too large
errno : 28 , error : No space left on device
errno : 29 , error : Illegal seek
errno : 30 , error : Read-only file system
errno : 31 , error : Too many links
errno : 32 , error : Broken pipe
errno : 33 , error : Numerical argument out of domain
errno : 34 , error : Numerical result out of range
errno : 35 , error : Resource deadlock avoided
errno : 36 , error : File name too long
errno : 37 , error : No locks available
errno : 38 , error : Function not implemented
errno : 39 , error : Directory not empty
errno : 40 , error : Too many levels of symbolic links
errno : 41 , error : Unknown error 41
errno : 42 , error : No message of desired type
errno : 43 , error : Identifier removed
errno : 44 , error : Channel number out of range
errno : 45 , error : Level 2 not synchronized
errno : 46 , error : Level 3 halted
errno : 47 , error : Level 3 reset
errno : 48 , error : Link number out of range
errno : 49 , error : Protocol driver not attached
errno : 50 , error : No CSI structure available
errno : 51 , error : Level 2 halted
errno : 52 , error : Invalid exchange
errno : 53 , error : Invalid request descriptor
errno : 54 , error : Exchange full
errno : 55 , error : No anode
errno : 56 , error : Invalid request code
errno : 57 , error : Invalid slot
errno : 58 , error : Unknown error 58
errno : 59 , error : Bad font file format
errno : 60 , error : Device not a stream
errno : 61 , error : No data available
errno : 62 , error : Timer expired
errno : 63 , error : Out of streams resources
errno : 64 , error : Machine is not on the network
errno : 65 , error : Package not installed
errno : 66 , error : Object is remote
errno : 67 , error : Link has been severed
errno : 68 , error : Advertise error
errno : 69 , error : Srmount error
errno : 70 , error : Communication error on send
errno : 71 , error : Protocol error
errno : 72 , error : Multihop attempted
errno : 73 , error : RFS specific error
errno : 74 , error : Bad message
errno : 75 , error : Value too large for defined data type
errno : 76 , error : Name not unique on network
errno : 77 , error : File descriptor in bad state
errno : 78 , error : Remote address changed
errno : 79 , error : Can not access a needed shared library
errno : 80 , error : Accessing a corrupted shared library
errno : 81 , error : .lib section in a.out corrupted
errno : 82 , error : Attempting to link in too many shared libraries
errno : 83 , error : Cannot exec a shared library directly
errno : 84 , error : Invalid or incomplete multibyte or wide character
errno : 85 , error : Interrupted system call should be restarted
errno : 86 , error : Streams pipe error
errno : 87 , error : Too many users
errno : 88 , error : Socket operation on non-socket
errno : 89 , error : Destination address required
errno : 90 , error : Message too long
errno : 91 , error : Protocol wrong type for socket
errno : 92 , error : Protocol not available
errno : 93 , error : Protocol not supported
errno : 94 , error : Socket type not supported
errno : 95 , error : Operation not supported
errno : 96 , error : Protocol family not supported
errno : 97 , error : Address family not supported by protocol
errno : 98 , error : Address already in use
errno : 99 , error : Cannot assign requested address
errno : 100 , error : Network is down
errno : 101 , error : Network is unreachable
errno : 102 , error : Network dropped connection on reset
errno : 103 , error : Software caused connection abort
errno : 104 , error : Connection reset by peer
errno : 105 , error : No buffer space available
errno : 106 , error : Transport endpoint is already connected
errno : 107 , error : Transport endpoint is not connected
errno : 108 , error : Cannot send after transport endpoint shutdown
errno : 109 , error : Too many references: cannot splice
errno : 110 , error : Connection timed out
errno : 111 , error : Connection refused
errno : 112 , error : Host is down
errno : 113 , error : No route to host
errno : 114 , error : Operation already in progress
errno : 115 , error : Operation now in progress
errno : 116 , error : Stale file handle
errno : 117 , error : Structure needs cleaning
errno : 118 , error : Not a XENIX named type file
errno : 119 , error : No XENIX semaphores available
errno : 120 , error : Is a named type file
errno : 121 , error : Remote I/O error
errno : 122 , error : Disk quota exceeded
errno : 123 , error : No medium found
errno : 124 , error : Wrong medium type
errno : 125 , error : Operation canceled
errno : 126 , error : Required key not available
errno : 127 , error : Key has expired
errno : 128 , error : Key has been revoked
errno : 129 , error : Key was rejected by service
errno : 130 , error : Owner died
errno : 131 , error : State not recoverable
errno : 132 , error : Operation not possible due to RF-kill
errno : 133 , error : Unknown error 133
.

.

.

errno : 255 , error : Unknown error 255

当errno到达134的时候就没有错误了~



本文转自郝峰波博客园博客,原文链接:http://www.cnblogs.com/fengbohello/p/4692753.html,如需转载请自行联系原作者


相关文章
|
4月前
|
Ubuntu Linux Anolis
Linux系统禁用swap
本文介绍了在新版本Linux系统(如Ubuntu 20.04+、CentOS Stream、openEuler等)中禁用swap的两种方法。传统通过注释/etc/fstab中swap行的方式已失效,现需使用systemd管理swap.target服务或在/etc/fstab中添加noauto参数实现禁用。方法1通过屏蔽swap.target适用于新版系统,方法2通过修改fstab挂载选项更通用,兼容所有系统。
388 3
Linux系统禁用swap
|
4月前
|
Linux
Linux系统修改网卡名为eth0、eth1
在Linux系统中,可通过修改GRUB配置和创建Udev规则或使用systemd链接文件,将网卡名改为`eth0`、`eth1`等传统命名方式,适用于多种发行版并支持多网卡配置。
850 3
|
5月前
|
Ubuntu Linux
计算机基础知识:linux系统怎么安装?
在虚拟机软件中创建一个新的虚拟机,并选择相应操作系统类型和硬盘空间大小等参数。将下载的 ISO 镜像文件加载到虚拟机中。启动虚拟机,进入安装界面,并按照步骤进行安装。安装完成后,可以在虚拟机中使用 Linux 系统。
|
5月前
|
存储 Ubuntu Linux
「正点原子Linux连载」第二章Ubuntu系统入门
在图2.8.2.4中,我们使用命令umount卸载了U盘,卸载以后当我们再去访问文件夹/mnt/tmp的时候发现里面没有任何文件了,说明我们卸载成功了。
|
Ubuntu Linux 网络安全
Linux系统初始化脚本
一款支持Rocky、CentOS、Ubuntu、Debian、openEuler等主流Linux发行版的系统初始化Shell脚本,涵盖网络配置、主机名设置、镜像源更换、安全加固等多项功能,适配单/双网卡环境,支持UEFI引导,提供多版本下载与持续更新。
499 0
Linux系统初始化脚本
|
5月前
|
运维 Linux 开发者
Linux系统中使用Python的ping3库进行网络连通性测试
以上步骤展示了如何利用 Python 的 `ping3` 库来检测网络连通性,并且提供了基本错误处理方法以确保程序能够优雅地处理各种意外情形。通过简洁明快、易读易懂、实操性强等特点使得该方法非常适合开发者或系统管理员快速集成至自动化工具链之内进行日常运维任务之需求满足。
361 18
|
4月前
|
安全 Linux Shell
Linux系统提权方式全面总结:从基础到高级攻防技术
本文全面总结Linux系统提权技术,涵盖权限体系、配置错误、漏洞利用、密码攻击等方法,帮助安全研究人员掌握攻防技术,提升系统防护能力。
426 1
|
4月前
|
监控 安全 Linux
Linux系统提权之计划任务(Cron Jobs)提权
在Linux系统中,计划任务(Cron Jobs)常用于定时执行脚本或命令。若配置不当,攻击者可利用其提权至root权限。常见漏洞包括可写的Cron脚本、目录、通配符注入及PATH变量劫持。攻击者通过修改脚本、创建恶意任务或注入命令实现提权。系统管理员应遵循最小权限原则、使用绝对路径、避免通配符、设置安全PATH并定期审计,以防范此类攻击。
1111 1
|
5月前
|
缓存 监控 Linux
Linux系统清理缓存(buff/cache)的有效方法。
总结而言,在大多数情形下你不必担心Linux中buffer与cache占用过多内存在影响到其他程序运行;因为当程序请求更多内存在没有足够可用资源时,Linux会自行调整其占有量。只有当你明确知道当前环境与需求并希望立即回收这部分资源给即将运行重负载任务之前才考虑上述方法去主动干预。
1792 10
|
5月前
|
安全 Linux 数据安全/隐私保护
为Linux系统的普通账户授予sudo访问权限的过程
完成上述步骤后,你提升的用户就能够使用 `sudo`命令来执行管理员级别的操作,而无需切换到root用户。这是一种更加安全和便捷的权限管理方式,因为它能够留下完整的权限使用记录,并以最小权限的方式工作。需要注意的是,随意授予sudo权限可能会使系统暴露在风险之中,尤其是在用户不了解其所执行命令可能带来的后果的情况下。所以在配置sudo权限时,必须谨慎行事。
849 0