rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2013 Corey Tabaka |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a copy of this software and associated documentation files |
| 6 | * (the "Software"), to deal in the Software without restriction, |
| 7 | * including without limitation the rights to use, copy, modify, merge, |
| 8 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 | * and to permit persons to whom the Software is furnished to do so, |
| 10 | * subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be |
| 13 | * included in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | #ifndef __ERRNO_H |
| 24 | #define __ERRNO_H |
| 25 | |
| 26 | #include <compiler.h> |
| 27 | |
| 28 | __BEGIN_CDECLS |
| 29 | |
| 30 | extern int *__geterrno(void); |
| 31 | |
| 32 | #define errno (*__geterrno()) |
| 33 | |
| 34 | #define EPERM 1 /* Not super-user */ |
| 35 | #define ENOENT 2 /* No such file or directory */ |
| 36 | #define ESRCH 3 /* No such process */ |
| 37 | #define EINTR 4 /* Interrupted system call */ |
| 38 | #define EIO 5 /* I/O error */ |
| 39 | #define ENXIO 6 /* No such device or address */ |
| 40 | #define E2BIG 7 /* Arg list too long */ |
| 41 | #define ENOEXEC 8 /* Exec format error */ |
| 42 | #define EBADF 9 /* Bad file number */ |
| 43 | #define ECHILD 10 /* No children */ |
| 44 | #define EAGAIN 11 /* No more processes */ |
| 45 | #define ENOMEM 12 /* Not enough core */ |
| 46 | #define EACCES 13 /* Permission denied */ |
| 47 | #define EFAULT 14 /* Bad address */ |
| 48 | #define ENOTBLK 15 /* Block device required */ |
| 49 | #define EBUSY 16 /* Mount device busy */ |
| 50 | #define EEXIST 17 /* File exists */ |
| 51 | #define EXDEV 18 /* Cross-device link */ |
| 52 | #define ENODEV 19 /* No such device */ |
| 53 | #define ENOTDIR 20 /* Not a directory */ |
| 54 | #define EISDIR 21 /* Is a directory */ |
| 55 | #define EINVAL 22 /* Invalid argument */ |
| 56 | #define ENFILE 23 /* Too many open files in system */ |
| 57 | #define EMFILE 24 /* Too many open files */ |
| 58 | #define ENOTTY 25 /* Not a typewriter */ |
| 59 | #define ETXTBSY 26 /* Text file busy */ |
| 60 | #define EFBIG 27 /* File too large */ |
| 61 | #define ENOSPC 28 /* No space left on device */ |
| 62 | #define ESPIPE 29 /* Illegal seek */ |
| 63 | #define EROFS 30 /* Read only file system */ |
| 64 | #define EMLINK 31 /* Too many links */ |
| 65 | #define EPIPE 32 /* Broken pipe */ |
| 66 | #define EDOM 33 /* Math arg out of domain of func */ |
| 67 | #define ERANGE 34 /* Math result not representable */ |
| 68 | #define ENOMSG 35 /* No message of desired type */ |
| 69 | #define EIDRM 36 /* Identifier removed */ |
| 70 | #define ECHRNG 37 /* Channel number out of range */ |
| 71 | #define EL2NSYNC 38 /* Level 2 not synchronized */ |
| 72 | #define EL3HLT 39 /* Level 3 halted */ |
| 73 | #define EL3RST 40 /* Level 3 reset */ |
| 74 | #define ELNRNG 41 /* Link number out of range */ |
| 75 | #define EUNATCH 42 /* Protocol driver not attached */ |
| 76 | #define ENOCSI 43 /* No CSI structure available */ |
| 77 | #define EL2HLT 44 /* Level 2 halted */ |
| 78 | #define EDEADLK 45 /* Deadlock condition */ |
| 79 | #define ENOLCK 46 /* No record locks available */ |
| 80 | #define EBADE 50 /* Invalid exchange */ |
| 81 | #define EBADR 51 /* Invalid request descriptor */ |
| 82 | #define EXFULL 52 /* Exchange full */ |
| 83 | #define ENOANO 53 /* No anode */ |
| 84 | #define EBADRQC 54 /* Invalid request code */ |
| 85 | #define EBADSLT 55 /* Invalid slot */ |
| 86 | #define EDEADLOCK 56 /* File locking deadlock error */ |
| 87 | #define EBFONT 57 /* Bad font file fmt */ |
| 88 | #define ENOSTR 60 /* Device not a stream */ |
| 89 | #define ENODATA 61 /* No data (for no delay io) */ |
| 90 | #define ETIME 62 /* Timer expired */ |
| 91 | #define ENOSR 63 /* Out of streams resources */ |
| 92 | #define ENONET 64 /* Machine is not on the network */ |
| 93 | #define ENOPKG 65 /* Package not installed */ |
| 94 | #define EREMOTE 66 /* The object is remote */ |
| 95 | #define ENOLINK 67 /* The link has been severed */ |
| 96 | #define EADV 68 /* Advertise error */ |
| 97 | #define ESRMNT 69 /* Srmount error */ |
| 98 | #define ECOMM 70 /* Communication error on send */ |
| 99 | #define EPROTO 71 /* Protocol error */ |
| 100 | #define EMULTIHOP 74 /* Multihop attempted */ |
| 101 | #define ELBIN 75 /* Inode is remote (not really error) */ |
| 102 | #define EDOTDOT 76 /* Cross mount point (not really error) */ |
| 103 | #define EBADMSG 77 /* Trying to read unreadable message */ |
| 104 | #define EFTYPE 79 /* Inappropriate file type or format */ |
| 105 | #define ENOTUNIQ 80 /* Given log. name not unique */ |
| 106 | #define EBADFD 81 /* f.d. invalid for this operation */ |
| 107 | #define EREMCHG 82 /* Remote address changed */ |
| 108 | #define ELIBACC 83 /* Can't access a needed shared lib */ |
| 109 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ |
| 110 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ |
| 111 | #define ELIBMAX 86 /* Attempting to link in too many libs */ |
| 112 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ |
| 113 | #define ENOSYS 88 /* Function not implemented */ |
| 114 | #define ENMFILE 89 /* No more files */ |
| 115 | #define ENOTEMPTY 90 /* Directory not empty */ |
| 116 | #define ENAMETOOLONG 91 /* File or path name too long */ |
| 117 | #define ELOOP 92 /* Too many symbolic links */ |
| 118 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ |
| 119 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ |
| 120 | #define ECONNRESET 104 /* Connection reset by peer */ |
| 121 | #define ENOBUFS 105 /* No buffer space available */ |
| 122 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ |
| 123 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ |
| 124 | #define ENOTSOCK 108 /* Socket operation on non-socket */ |
| 125 | #define ENOPROTOOPT 109 /* Protocol not available */ |
| 126 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ |
| 127 | #define ECONNREFUSED 111 /* Connection refused */ |
| 128 | #define EADDRINUSE 112 /* Address already in use */ |
| 129 | #define ECONNABORTED 113 /* Connection aborted */ |
| 130 | #define ENETUNREACH 114 /* Network is unreachable */ |
| 131 | #define ENETDOWN 115 /* Network interface is not configured */ |
| 132 | #define ETIMEDOUT 116 /* Connection timed out */ |
| 133 | #define EHOSTDOWN 117 /* Host is down */ |
| 134 | #define EHOSTUNREACH 118 /* Host is unreachable */ |
| 135 | #define EINPROGRESS 119 /* Connection already in progress */ |
| 136 | #define EALREADY 120 /* Socket already connected */ |
| 137 | #define EDESTADDRREQ 121 /* Destination address required */ |
| 138 | #define EMSGSIZE 122 /* Message too long */ |
| 139 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ |
| 140 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ |
| 141 | #define EADDRNOTAVAIL 125 /* Address not available */ |
| 142 | #define ENETRESET 126 |
| 143 | #define EISCONN 127 /* Socket is already connected */ |
| 144 | #define ENOTCONN 128 /* Socket is not connected */ |
| 145 | #define ETOOMANYREFS 129 |
| 146 | #define EPROCLIM 130 |
| 147 | #define EUSERS 131 |
| 148 | #define EDQUOT 132 |
| 149 | #define ESTALE 133 |
| 150 | #define ENOTSUP 134 /* Not supported */ |
| 151 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ |
| 152 | #define ENOSHARE 136 /* No such host or network path */ |
| 153 | #define ECASECLASH 137 /* Filename exists with different case */ |
| 154 | #define EILSEQ 138 |
| 155 | #define EOVERFLOW 139 /* Value too large for defined data type */ |
| 156 | |
| 157 | #define EWOULDBLOCK EAGAIN /* Operation would block */ |
| 158 | |
| 159 | #define __ELASTERROR 2000 /* Users can add values starting here */ |
| 160 | |
| 161 | __END_CDECLS |
| 162 | |
| 163 | #endif |