admin管理员组

文章数量:1531365

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

#define

#define

#define

#define

#define

#define

#define

#define

#define

E2BIG

ENOEXEC

EBADF

ECHILD

EAGAIN

ENOMEM

EACCES

EFAULT

ENOTBLK

EBUSY

7 /* Argument list too long */

8 /* Exec format error */

9 /* Bad file number */

10 /* No child processes */

11 /* Try again */

12 /* Out of memory */

13 /* Permission denied */

14 /* Bad address */

15 /* Block device required */

/* Device or resource busy */

16

本文标签: 错误代码内核原因查看看来