14.21 已知errno如何获取错误描述 http://scz.617.cn:8/unix/202211151428.txt Q: Windows中可以这样查看指定错误码的描述信息 $ net helpmsg 5 Linux中如何达到同样目的? A: scz 2022-11-15 aptitude install moreutils 该包带有/usr/bin/errno,参看errno(1)、errno(3)。 显示所有errno的数值及描述 $ /usr/bin/errno -l 显示5号错误描述 $ /usr/bin/errno 5 显示所有描述信息包含"access"的错误码,大小写不敏感 $ /usr/bin/errno -s access /usr/bin/errno可用于SHELL编程,若只是交互式查询,检查这两个文件即可 /usr/include/asm-generic/errno-base.h $ grep -hw 1 /usr/include/asm-generic/errno* $ grep -hw 5 /usr/include/asm-generic/errno* A: scz 2022-11-15 pip3 install pwn 该模块会安装/usr/local/bin/errno,这其实是个Python脚本 $ errno 2 $ errno 5
Access is denied.
EPERM 1 Operation not permitted
ENOENT 2 No such file or directory
ESRCH 3 No such process
...
EIO 5 Input/output error
ELIBACC 79 Can not access a needed shared library
ELIBBAD 80 Accessing a corrupted shared library
/usr/include/asm-generic/errno.h
#define EPERM 1 /* Operation not permitted */
#define EIO 5 /* I/O error */
#define ENOENT 2
No such file or directory
#define EIO 5
Input/output error