天天看点

Linux errno.h

Linux通过errno这个变量来记录最近一次出错的内容,类似Windows下的GetLastError()函数的返回值。

#ifndef _SYS_ERRNO_H_

#ifdef __cplusplus

extern "C" {

#endif

#define _SYS_ERRNO_H_

#include <sys/reent.h>

#ifndef _REENT_ONLY

#define errno (*__errno())

extern int *__errno _PARAMS ((void));

#endif

extern __IMPORT _CONST char * _CONST _sys_errlist[];

extern __IMPORT int _sys_nerr;

#ifdef __CYGWIN__

extern __IMPORT const char * const sys_errlist[];

extern __IMPORT int sys_nerr;

#endif

#define __errno_r(ptr) ((ptr)->_errno)

#define EPERM 1

#define ENOENT 2

#define ESRCH 3

#define EINTR 4

#define EIO 5

#define ENXIO 6

#define E2BIG 7

#define ENOEXEC 8

#define EBADF 9

#define ECHILD 10

#define EAGAIN 11

#define ENOMEM 12

#define EACCES 13

#define EFAULT 14

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define ENOTBLK 15

#endif

#define EBUSY 16

#define EEXIST 17

#define EXDEV 18

#define ENODEV 19

#define ENOTDIR 20

#define EISDIR 21

#define EINVAL 22

#define ENFILE 23

#define EMFILE 24

#define ENOTTY 25

#define ETXTBSY 26

#define EFBIG 27

#define ENOSPC 28

#define ESPIPE 29

#define EROFS 30

#define EMLINK 31

#define EPIPE 32

#define EDOM 33

#define ERANGE 34

#define ENOMSG 35

#define EIDRM 36

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define ECHRNG 37

#define EL2NSYNC 38

#define EL3HLT 39

#define EL3RST 40

#define ELNRNG 41

#define EUNATCH 42

#define ENOCSI 43

#define EL2HLT 44

#endif

#define EDEADLK 45

#define ENOLCK 46

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define EBADE 50

#define EBADR 51

#define EXFULL 52

#define ENOANO 53

#define EBADRQC 54

#define EBADSLT 55

#define EDEADLOCK 56

#define EBFONT 57

#endif

#define ENOSTR 60

#define ENODATA 61

#define ETIME 62

#define ENOSR 63

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define ENONET 64

#define ENOPKG 65

#define EREMOTE 66

#endif

#define ENOLINK 67

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define EADV 68

#define ESRMNT 69

#define ECOMM 70

#endif

#define EPROTO 71

#define EMULTIHOP 74

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define ELBIN 75

#define EDOTDOT 76

#endif

#define EBADMSG 77

#define EFTYPE 79

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define ENOTUNIQ 80

#define EBADFD 81

#define EREMCHG 82

#define ELIBACC 83

#define ELIBBAD 84

#define ELIBSCN 85

#define ELIBMAX 86

#define ELIBEXEC 87

#endif

#define ENOSYS 88

#ifdef __CYGWIN__

#define ENMFILE 89      

#endif

#define ENOTEMPTY 90

#define ENAMETOOLONG 91

#define ELOOP 92

#define EOPNOTSUPP 95

#define EPFNOSUPPORT 96

#define ECONNRESET 104  

#define ENOBUFS 105

#define EAFNOSUPPORT 106

#define EPROTOTYPE 107

#define ENOTSOCK 108

#define ENOPROTOOPT 109

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define ESHUTDOWN 110

#endif

#define ECONNREFUSED 111

#define EADDRINUSE 112

#define ECONNABORTED 113

#define ENETUNREACH 114

#define ENETDOWN 115

#define ETIMEDOUT 116

#define EHOSTDOWN 117

#define EHOSTUNREACH 118

#define EINPROGRESS 119

#define EALREADY 120

#define EDESTADDRREQ 121

#define EMSGSIZE 122

#define EPROTONOSUPPORT 123

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define ESOCKTNOSUPPORT 124

#endif

#define EADDRNOTAVAIL 125

#define ENETRESET 126

#define EISCONN 127

#define ENOTCONN 128

#define ETOOMANYREFS 129

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define EPROCLIM 130

#define EUSERS 131

#endif

#define EDQUOT 132

#define ESTALE 133

#define ENOTSUP 134

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define ENOMEDIUM 135  

#endif

#ifdef __CYGWIN__

#define ENOSHARE 136    

#define ECASECLASH 137  

#endif

#define EILSEQ 138

#define EOVERFLOW 139

#define ECANCELED 140

#define ENOTRECOVERABLE 141

#define EOWNERDEAD 142

#ifdef __LINUX_ERRNO_EXTENSIONS__

#define ESTRPIPE 143

#endif

#define EWOULDBLOCK EAGAIN

#define __ELASTERROR 2000

#ifdef __cplusplus

}

#endif

#endif

继续阅读