admin管理员组文章数量:1531272
2024年6月18日发(作者:)
Linux错误码大全
查看错误代码errno是调试程序的一个重要方法。当linuc C api函数发生异常时,一
般会将errno变量(需include errno.h)赋一个整数值,不同的值表示不同的含义,可以通过
查看该值推测出错的原因。在实际编程中用这一招解决了不少原本看来莫名其妙的问题。
比较麻烦的是每次都要去linux源代码里面查找错误代码的含义,现在把它贴出来,以后
需要查时就来这里看了。
1-34号错误号是在内核源码的include/asm-generic/errno-base.h定义
35-132则是在include/asm-generic/errno.h中定义
剩下还有一些更大的错误号是留给内核级别的,如系统调用等,用户程序一般是看不
见的这些号的,Ubuntu9.10中
/usr/src/linux-headers-2.6.31-21-generic/include/linux/errno.h
#ifndef _ASM_GENERIC_ERRNO_BASE_H
#define _ASM_GENERIC_ERRNO_BASE_H
#define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* 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 ENOEXEC 8 /* Exec format error */ #define
EBADF 9 /* Bad file number */
#define ECHILD 10 /* No child processes */ #define EAGAIN 11 /* Try
again */
#define ENOMEM 12 /* Out of memory */
#define EACCES 13 /* Permission denied */ #define EFAULT 14 /* Bad
address */
#define ENOTBLK 15 /* Block device required */ #define EBUSY 16 /*
Device or resource busy */ #define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
#define ENOTDIR 20 /* Not a directory */
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
版权声明:本文标题:Linux错误码大全(建议收藏) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1718706843a714604.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论