#include <errno.h>
下面是error相关的返回值errno 值是常数分配给 errno 在各种错误状态的情况下。
ERRNO.H 包含 errno 值的定义。 但是,并非在 ERRNO.H 提供的所有定义用于 32 位 windows 操作系统。 在某些 ERRNO.H 的值存在保持与操作系统 UNIX 系列的兼容性。
在 32 位 windows 操作系统的 errno 值是的子集 errno 中 XENIX 系统。 因此, errno 值不一定是实际错误代码返回从 windows 操作系统调用的相同。 访问实际操作系统错误代码,使用 _doserrno 变量,包含该值。
下面 errno 值支持:
以下值对使用 POSIX 的兼容性支持。 它们是在非 POSIX 系统需要的值。
#define E2BIG [argument list too long] #define EACCES [permission denied] #define EADDRINUSE [address in use] #define EADDRNOTAVAIL [address not available] #define EAFNOSUPPORT [address family not supported] #define EAGAIN [resource unavailable try again] #define EALREADY [connection already in progress] #define EBADF [bad file descriptor] #define EBADMSG [bad message] #define EBUSY [device or resource busy] #define ECANCELED [operation canceled] #define ECHILD [no child process] #define ECONNABORTED [connection aborted] #define ECONNREFUSED [connection refused] #define ECONNRESET [connection reset] #define EDEADLK [resource deadlock would occur] #define EDESTADDRREQ [destination address required] #define EDOM [argument out of domain] #define EEXIST [file exists] #define EFAULT [bad address] #define EFBIG [file too large] #define EHOSTUNREACH [host unreachable] #define EIDRM [identifier removed] #define EILSEQ [illegal byte sequence] #define EINPROGRESS [operation in progress] #define EINTR [interrupted] #define EINVAL [invalid argument] #define EIO [io error] #define EISCONN [already connected] #define EISDIR [is a directory] #define ELOOP [too many synbolic link levels] #define EMFILE [too many files open] #define EMLINK [too many links] #define EMSGSIZE [message size] #define ENAMETOOLONG [filename too long] #define ENETDOWN [network down] #define ENETRESET [network reset] #define ENETUNREACH [network unreachable] #define ENFILE [too many files open in system] #define ENOBUFS [no buffer space] #define ENODATA [no message available] #define ENODEV [no such device] #define ENOENT [no such file or directory] #define ENOEXEC [executable format error] #define ENOLCK [no lock available] #define ENOLINK [no link] #define ENOMEM [not enough memory] #define ENOMSG [no message] #define ENOPROTOOPT [no protocol option] #define ENOSPC [no space on device] #define ENOSR [no stream resources] #define ENOSTR [not a stream] #define ENOSYS [function not supported] #define ENOTCONN [not connected] #define ENOTDIR [not a directory] #define ENOTEMPTY [directory not empty] #define ENOTRECOVERABLE [state not recoverable] #define ENOTSOCK [not a socket] #define ENOTSUP [not supported] #define ENOTTY [inappropriate io control operation] #define ENXIO [no such device or address] #define EOPNOTSUPP [operation not supported] #define EOTHER [other] #define EOVERFLOW [value too large] #define EOWNERDEAD [owner dead] #define EPERM [operation not permitted] #define EPIPE [broken pipe] #define EPROTO [protocol error] #define EPROTONOSUPPORT [protocol not supported] #define EPROTOTYPE [wrong protocol type] #define ERANGE [result out of range] #define EROFS [read only file system] #define ESPIPE [invalid seek] #define ESRCH [no such process] #define ETIME [stream timeout] #define ETIMEDOUT [timed out] #define ETXTBSY [text file busy] #define EWOULDBLOCK [operation would block] #define EXDEV [cross device link]
1#ifndef _ASM_GENERIC_ERRNO_BASE_H
2#define _ASM_GENERIC_ERRNO_BASE_H
3
4#define EPERM 1 /* Operation not permitted */操作禁止
5#define ENOENT 2 /* No such file or directory */文件或者目录不存在
6#define ESRCH 3 /* No such process */相应的进程不存在
7#define EINTR 4 /* Interrupted system call */中断系统调用
8#define EIO 5 /* I/O error */I/O错误
9#define ENXIO 6 /* No such device or address */相应设备或者地址不存在
10#define E2BIG 7 /* Argument list too long */参数列表太长
11#define ENOEXEC 8 /* Exec format error */Exec格式错误
12#define EBADF 9 /* Bad file number */错误的文档编号
13#define ECHILD 10 /* No child processes */没有子进程
14#define EAGAIN 11 /* Try again */ 重试
15#define ENOMEM 12 /* Out of memory */溢出内存
16#define EACCES 13 /* Permission denied */没有权限
17#define EFAULT 14 /* Bad address */错误的地址
18#define ENOTBLK 15 /* Block device required */块设备需求
19#define EBUSY 16 /* Device or resource busy */设备或者资源繁忙
20#define EEXIST 17 /* File exists */文件已经存在
21#define EXDEV 18 /* Cross-device link */交叉链接设备
22#define ENODEV 19 /* No such device */没有对应的设备
23#define ENOTDIR 20 /* Not a directory */不是路径
24#define EISDIR 21 /* Is a directory */是路径,与上面意思相反
25#define EINVAL 22 /* Invalid argument */无效参数
26#define ENFILE 23 /* File table overflow */文件表溢出
27#define EMFILE 24 /* Too many open files */打开的文件太多了
28#define ENOTTY 25 /* Not a typewriter */非打印机
29#define ETXTBSY 26 /* Text file busy */文本文件繁忙
30#define EFBIG 27 /* File too large */文件太大
31#define ENOSPC 28 /* No space left on device */没有足够的空间留给设备使用
32#define ESPIPE 29 /* Illegal seek */非法定位
33#define EROFS 30 /* Read-only file system */只读文件系统
34#define EMLINK 31 /* Too many links */太多的链接
35#define EPIPE 32 /* Broken pipe */管道中断
36#define EDOM 33 /* Math argument out of domain of func */??
37#define ERANGE 34 /* Math result not representable */非数字结果
38
39#endif
40