errno.h

来源:互联网 发布:数据挖掘知乎 编辑:程序博客网 时间:2024/05/19 13:29
errno.h 是C语言C标准函式库里的标头档,定义了透过错误码来回报错误资讯的宏:
  errno宏定义为一个int型态的左值, 包含任何函式使用errno功能所产生的上一个错误码。
  一些表示错误码,定义为整数值的宏:
  EDOM 源自于函式的参数超出范围,例如sqrt(-1)
  ERANGE 源自于函式的结果超出范围,例如strtol("0xfffffffff",NULL,0)
  EILSEQ 源自于不合法的字符顺序,例如wcstombs(str, L"\xffff", 2)
  查看错误代码errno是调试程序的一个重要方法。当linux C api函数发生异常时,一般会将errno变量(需include errno.h)赋一个整数值,不同的值表示不同的含义,可以通过查看该值推测出错的原因。在实际编程中用这一招解决了不少原本看来莫名其妙的问题。比较 麻烦的是每次都要去linux源代码里面查找错误代码的含义,现在把它贴出来,以后需要查时就来这里看了。
  以下来自linux 2.4.20-18的内核代码中的/usr/include/asm/errno.h
  
#ifndef _I386_ERRNO_H  #define _I386_ERRNO_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 /* Arg 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 */  #define ENFILE 23 /* File table overflow */  #define EMFILE 24 /* Too many open files */  #define ENOTTY 25 /* Not a typewriter */  #define ETXTBSY 26 /* Text file busy */  #define EFBIG 27 /* File too large */  #define ENOSPC 28 /* No space left on device */  #define ESPIPE 29 /* Illegal seek */  #define EROFS 30 /* Read-only file system */  #define EMLINK 31 /* Too many links */  #define EPIPE 32 /* Broken pipe */  #define EDOM 33 /* Math argument out of domain of func */  #define ERANGE 34 /* Math result not representable */  #define EDEADLK 35 /* Resource deadlock would occur */  #define ENAMETOOLONG 36 /* File name too long */  #define ENOLCK 37 /* No record locks available */  #define ENOSYS 38 /* Function not implemented */  #define ENOTEMPTY 39 /* Directory not empty */  #define ELOOP 40 /* Too many symbolic links encountered */  #define EWOULDBLOCK EAGAIN /* Operation would block */  #define ENOMSG 42 /* No message of desired type */  #define EIDRM 43 /* Identifier removed */  #define ECHRNG 44 /* Channel number out of range */  #define EL2NSYNC 45 /* Level 2 not synchronized */  #define EL3HLT 46 /* Level 3 halted */  #define EL3RST 47 /* Level 3 reset */  #define ELNRNG 48 /* Link number out of range */  #define EUNATCH 49 /* Protocol driver not attached */  #define ENOCSI 50 /* No CSI structure available */  #define EL2HLT 51 /* Level 2 halted */  #define EBADE 52 /* Invalid exchange */  #define EBADR 53 /* Invalid request descriptor */  #define EXFULL 54 /* Exchange full */  #define ENOANO 55 /* No anode */  #define EBADRQC 56 /* Invalid request code */  #define EBADSLT 57 /* Invalid slot */  #define EDEADLOCK EDEADLK  #define EBFONT 59 /* Bad font file format */  #define ENOSTR 60 /* Device not a stream */  #define ENODATA 61 /* No data available */  #define ETIME 62 /* Timer expired */  #define ENOSR 63 /* Out of streams resources */  #define ENONET 64 /* Machine is not on the network */  #define ENOPKG 65 /* Package not installed */  #define EREMOTE 66 /* Object is remote */  #define ENOLINK 67 /* Link has been severed */  #define EADV 68 /* Advertise error */  #define ESRMNT 69 /* Srmount error */  #define ECOMM 70 /* Communication error on send */  #define EPROTO 71 /* Protocol error */  #define EMULTIHOP 72 /* Multihop attempted */  #define EDOTDOT 73 /* RFS specific error */  #define EBADMSG 74 /* Not a data message */  #define EOVERFLOW 75 /* Value too large for defined data type */  #define ENOTUNIQ 76 /* Name not unique on network */  #define EBADFD 77 /* File descriptor in bad state */  #define EREMCHG 78 /* Remote address changed */  #define ELIBACC 79 /* Can not access a needed shared library */  #define ELIBBAD 80 /* Accessing a corrupted shared library */  #define ELIBSCN 81 /* .lib section in a.out corrupted */  #define ELIBMAX 82 /* Attempting to link in too many shared libraries */  #define ELIBEXEC 83 /* Cannot exec a shared library directly */  #define EILSEQ 84 /* Illegal byte sequence */  #define ERESTART 85 /* Interrupted system call should be restarted */  #define ESTRPIPE 86 /* Streams pipe error */  #define EUSERS 87 /* Too many users */  #define ENOTSOCK 88 /* Socket operation on non-socket */  #define EDESTADDRREQ 89 /* Destination address required */  #define EMSGSIZE 90 /* Message too long */  #define EPROTOTYPE 91 /* Protocol wrong type for socket */  #define ENOPROTOOPT 92 /* Protocol not available */  #define EPROTONOSUPPORT 93 /* Protocol not supported */  #define ESOCKTNOSUPPORT 94 /* Socket type not supported */  #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */  #define EPFNOSUPPORT 96 /* Protocol family not supported */  #define EAFNOSUPPORT 97 /* Address family not supported by protocol */  #define EADDRINUSE 98 /* Address already in use */  #define EADDRNOTAVAIL 99 /* Cannot assign requested address */  #define ENETDOWN 100 /* Network is down */  #define ENETUNREACH 101 /* Network is unreachable */  #define ENETRESET 102 /* Network dropped connection because of reset */  #define ECONNABORTED 103 /* Software caused connection abort */  #define ECONNRESET 104 /* Connection reset by peer */  #define ENOBUFS 105 /* No buffer space available */  #define EISCONN 106 /* Transport endpoint is already connected */  #define ENOTCONN 107 /* Transport endpoint is not connected */  #define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */  #define ETOOMANYREFS 109 /* Too many references: cannot splice */  #define ETIMEDOUT 110 /* Connection timed out */  #define ECONNREFUSED 111 /* Connection refused */  #define EHOSTDOWN 112 /* Host is down */  #define EHOSTUNREACH 113 /* No route to host */  #define EALREADY 114 /* Operation already in progress */  #define EINPROGRESS 115 /* Operation now in progress */  #define ESTALE 116 /* Stale NFS file handle */  #define EUCLEAN 117 /* Structure needs cleaning */  #define ENOTNAM 118 /* Not a XENIX named type file */  #define ENAVAIL 119 /* No XENIX semaphores available */  #define EISNAM 120 /* Is a named type file */  #define EREMOTEIO 121 /* Remote I/O error */  #define EDQUOT 122 /* Quota exceeded */  #define ENOMEDIUM 123 /* No medium found */  #define EMEDIUMTYPE 124 /* Wrong medium type */  #end


原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 淘宝闪电退款了卖家不肯退了怎么办 云视听会员账号账号密码忘了怎么办 移动卡异地补卡忘记服务密码怎么办 欠我钱的人不接电话怎么办 苹果手机换屏升级系统了黑屏怎么办 苹果手机黑屏时接不到电话怎么办 手机上打电话的图标没了怎么办啊 阿巴町手表上的二维码不生成怎么办 速卖通几个月来搜索曝光很差怎么办 你我贷逾期3个月怎么办 手机放声音的地方进水了怎么办 手机放卡的地方坏了怎么办 京东购物申请退款卖家不同意怎么办 京东申请退货退款卖家不处理怎么办 京东自营产品收货地址填错了怎么办 京东快递地址填错了怎么办? 拼多多网上购物收不到东西怎么办 网上购物己签收但东西不好怎么办 孩子在学校学习用具总是被偷怎么办 歌华有线欠费1个月怎么办 唐小僧倒闭了百姓投的钱怎么办? 手机号被别人注册了华为账号怎么办 华为账号手机号显示已被注册怎么办 买了鑫和陌车的怎么办 注册游戏账号时乱输入的邮箱怎么办 yy频道解邦不能开直播怎么办 淘宝的淘金币快过期了怎么办 乐透啦彩票让骗了6万怎么办 交了认筹金不能进抢购平台怎么办 爱奇艺会文学会员办了想退款怎么办 海淘信用卡入账但是砍单怎么办 褐色分泌物流了好几天了怎么办? 淘宝买的衣服一直不发货怎么办 从国外寄东西到国内被税了怎么办 百度网盘上传文件数量有限制怎么办 腾讯视频上传文件过限制大小怎么办 三星s7打网页又卡又慢怎么办 路由器的上网账号和口令忘了怎么办 小米笔记本移动热点连接不上怎么办 移动宽带密码重置后认证失败怎么办 移动光纤不记得账号和密码怎么办?