1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44:
45:
46: 47: 48: 49:
50:
51: #ifndef __ERRNO_H__
52: #define __ERRNO_H__
53:
54: #include <tk/errno.h>
55:
56: #ifdef __cplusplus
57: extern "C" {
58: #endif
59:
60:
61: #define TSK_ALL (-1)
62:
63:
64: typedef int errno_t;
65:
66:
67: #ifndef ERCD
68: #define ERCD(mer, ser) ( ((mer) << 16) | ((ser) & 0xffff) )
69: #endif
70:
71:
72: #ifndef EC_ERRNO
73: #define EC_ERRNO (-73)
74: #endif
75:
76:
77: #ifndef ERRNO
78: #define ERRNO(er) (MERCD(er) == EC_ERRNO ? SERCD(er) : 0)
79: #endif
80:
81:
82: #ifndef ERRNOtoER
83: #define ERRNOtoER(eno) (ERCD(EC_ERRNO, (eno)))
84: #endif
85:
86: 87: 88: 89:
90: #define EPERM 1
91: #define ENOENT 2
92: #define ESRCH 3
93: #define EINTR 4
94: #define EIO 5
95: #define ENXIO 6
96: #define E2BIG 7
97: #define ENOEXEC 8
98: #define EBADF 9
99: #define ECHILD 10
100: #define EDEADLK 11
101: #define ENOMEM 12
102: #define EACCES 13
103: #define EFAULT 14
104:
105: #define EBUSY 16
106: #define EEXIST 17
107: #define EXDEV 18
108: #define ENODEV 19
109: #define ENOTDIR 20
110: #define EISDIR 21
111: #define EINVAL 22
112: #define ENFILE 23
113: #define EMFILE 24
114: #define ENOTTY 25
115:
116: #define EFBIG 27
117: #define ENOSPC 28
118: #define ESPIPE 29
119: #define EROFS 30
120: #define EMLINK 31
121: #define EPIPE 32
122: #define EDOM 33 123:
124: #define ERANGE 34
125: #define EAGAIN 35
126: #define EWOULDBLOCK EAGAIN
127: #define EINPROGRESS 36
128: #define EALREADY 37
129: #define ENOTSOCK 38
130: #define EDESTADDRREQ 39
131: #define EMSGSIZE 40
132: #define EPROTOTYPE 41
133: #define ENOPROTOOPT 42
134: #define EPROTONOSUPPORT 43
135: #define ESOCKTNOSUPPORT 44
136: #define EOPNOTSUPP 45
137: #define EPFNOSUPPORT 46
138: #define EAFNOSUPPORT 47
139: #define EADDRINUSE 48
140: #define EADDRNOTAVAIL 49
141: #define ENETDOWN 50
142: #define ENETUNREACH 51
143: #define ENETRESET 52
144: #define ECONNABORTED 53 145:
146: #define ECONNRESET 54
147: #define ENOBUFS 55
148: #define EISCONN 56
149: #define ENOTCONN 57
150: #define ESHUTDOWN 58 151:
152:
153: #define ETIMEDOUT 60
154: #define ECONNREFUSED 61
155: #define ELOOP 62
156: #define ENAMETOOLONG 63
157: #define EHOSTDOWN 64
158: #define EHOSTUNREACH 65
159: #define ENOTEMPTY 66
160:
161: #define EDQUOT 69
162:
163: #define ENOLCK 77
164: #define ENOSYS 78
165: #define EFTYPE 79
166:
167: #define EOVERFLOW 84
168: #define EILSEQ 85
169: #define ENOTSUP 86
170:
171: #define ELAST 86
172:
173:
174: 175: 176:
177: #define EAI_OFFSET 256
178: #define EAI_AGAIN (EAI_OFFSET + 2)
179: #define EAI_BADFLAGS (EAI_OFFSET + 3)
180: #define EAI_FAIL (EAI_OFFSET + 4)
181: #define EAI_FAMILY (EAI_OFFSET + 5)
182: #define EAI_MEMORY (EAI_OFFSET + 6)
183: #define EAI_NODATA (EAI_OFFSET + 7)
184: #define EAI_NONAME (EAI_OFFSET + 8)
185: #define EAI_SERVICE (EAI_OFFSET + 9)
186: #define EAI_SOCKTYPE (EAI_OFFSET + 10)
187: #define EAI_SYSTEM (EAI_OFFSET + 11)
188: #define EAI_BADHINTS (EAI_OFFSET + 12)
189: #define EAI_OVERFLOW (EAI_OFFSET + 14)
190: #define EAI_MAX (EAI_OFFSET + 15)
191:
192:
193: 194: 195:
196: #define EX_PERM ERCD(EC_ERRNO, EPERM)
197: #define EX_NOENT ERCD(EC_ERRNO, ENOENT)
198: #define EX_SRCH ERCD(EC_ERRNO, ESRCH)
199: #define EX_IO ERCD(EC_ERRNO, EIO)
200: #define EX_NXIO ERCD(EC_ERRNO, ENXIO)
201: #define EX_2BIG ERCD(EC_ERRNO, E2BIG)
202: #define EX_NOEXEC ERCD(EC_ERRNO, ENOEXEC)
203: #define EX_BADF ERCD(EC_ERRNO, EBADF)
204: #define EX_CHILD ERCD(EC_ERRNO, ECHILD)
205: #define EX_AGAIN ERCD(EC_ERRNO, EAGAIN)
206: #define EX_DEADLK ERCD(EC_ERRNO, EDEADLK)
207: #define EX_NOMEM ERCD(EC_ERRNO, ENOMEM)
208: #define EX_ACCES ERCD(EC_ERRNO, EACCES)
209: #define EX_FAULT ERCD(EC_ERRNO, EFAULT)
210: #define EX_BUSY ERCD(EC_ERRNO, EBUSY)
211: #define EX_EXIST ERCD(EC_ERRNO, EEXIST)
212: #define EX_XDEV ERCD(EC_ERRNO, EXDEV)
213: #define EX_NODEV ERCD(EC_ERRNO, ENODEV)
214: #define EX_NOTDIR ERCD(EC_ERRNO, ENOTDIR)
215: #define EX_ISDIR ERCD(EC_ERRNO, EISDIR)
216: #define EX_INVAL ERCD(EC_ERRNO, EINVAL)
217: #define EX_NFILE ERCD(EC_ERRNO, ENFILE)
218: #define EX_MFILE ERCD(EC_ERRNO, EMFILE)
219: #define EX_NOTTY ERCD(EC_ERRNO, ENOTTY)
220: #define EX_FBIG ERCD(EC_ERRNO, EFBIG)
221: #define EX_NOSPC ERCD(EC_ERRNO, ENOSPC)
222: #define EX_SPIPE ERCD(EC_ERRNO, ESPIPE)
223: #define EX_ROFS ERCD(EC_ERRNO, EROFS)
224: #define EX_MLINK ERCD(EC_ERRNO, EMLINK)
225: #define EX_PIPE ERCD(EC_ERRNO, EPIPE)
226: #define EX_DOM ERCD(EC_ERRNO, EDOM)
227: #define EX_RANGE ERCD(EC_ERRNO, ERANGE)
228: #define EX_WOULDBLOCK ERCD(EC_ERRNO, EWOULDBLOCK)
229: #define EX_INPROGRESS ERCD(EC_ERRNO, EINPROGRESS)
230: #define EX_ALREADY ERCD(EC_ERRNO, EALREADY)
231: #define EX_NOTSOCK ERCD(EC_ERRNO, ENOTSOCK)
232: #define EX_DESTADDRREQ ERCD(EC_ERRNO, EDESTADDRREQ)
233: #define EX_MSGSIZE ERCD(EC_ERRNO, EMSGSIZE)
234: #define EX_PROTOTYPE ERCD(EC_ERRNO, EPROTOTYPE)
235: #define EX_NOPROTOOPT ERCD(EC_ERRNO, ENOPROTOOPT)
236: #define EX_PROTONOSUPPORT ERCD(EC_ERRNO, EPROTONOSUPPORT)
237: #define EX_SOCKTNOSUPPORT ERCD(EC_ERRNO, ESOCKTNOSUPPORT)
238: #define EX_OPNOTSUPP ERCD(EC_ERRNO, EOPNOTSUPP)
239: #define EX_PFNOSUPPORT ERCD(EC_ERRNO, EPFNOSUPPORT)
240: #define EX_AFNOSUPPORT ERCD(EC_ERRNO, EAFNOSUPPORT)
241: #define EX_ADDRINUSE ERCD(EC_ERRNO, EADDRINUSE)
242: #define EX_ADDRNOTAVAIL ERCD(EC_ERRNO, EADDRNOTAVAIL)
243: #define EX_NETDOWN ERCD(EC_ERRNO, ENETDOWN)
244: #define EX_NETUNREACH ERCD(EC_ERRNO, ENETUNREACH)
245: #define EX_NETRESET ERCD(EC_ERRNO, ENETRESET)
246: #define EX_CONNABORTED ERCD(EC_ERRNO, ECONNABORTED)
247: #define EX_CONNRESET ERCD(EC_ERRNO, ECONNRESET)
248: #define EX_NOBUFS ERCD(EC_ERRNO, ENOBUFS)
249: #define EX_ISCONN ERCD(EC_ERRNO, EISCONN)
250: #define EX_NOTCONN ERCD(EC_ERRNO, ENOTCONN)
251: #define EX_SHUTDOWN ERCD(EC_ERRNO, ESHUTDOWN)
252: #define EX_TIMEDOUT ERCD(EC_ERRNO, ETIMEDOUT)
253: #define EX_CONNREFUSED ERCD(EC_ERRNO, ECONNREFUSED)
254: #define EX_LOOP ERCD(EC_ERRNO, ELOOP)
255: #define EX_NAMETOOLONG ERCD(EC_ERRNO, ENAMETOOLONG)
256: #define EX_HOSTDOWN ERCD(EC_ERRNO, EHOSTDOWN)
257: #define EX_HOSTUNREACH ERCD(EC_ERRNO, EHOSTUNREACH)
258: #define EX_NOTEMPTY ERCD(EC_ERRNO, ENOTEMPTY)
259: #define EX_DQUOT ERCD(EC_ERRNO, EDQUOT)
260: #define EX_NOLCK ERCD(EC_ERRNO, ENOLCK)
261: #define EX_NOSYS ERCD(EC_ERRNO, ENOSYS)
262: #define EX_FTYPE ERCD(EC_ERRNO, EFTYPE)
263: #define EX_ILSEQ ERCD(EC_ERRNO, EILSEQ)
264: #define EX_NOTSUP ERCD(EC_ERRNO, ENOTSUP)
265: #define EX_INTR ERCD(EC_ERRNO, EINTR)
266: #define EX_OVERFLOW ERCD(EC_ERRNO, EOVERFLOW)
267: #define EX_AI_AGAIN ERCD(EC_ERRNO, EAI_AGAIN)
268: #define EX_AI_BADFLAGS ERCD(EC_ERRNO, EAI_BADFLAGS)
269: #define EX_AI_FAIL ERCD(EC_ERRNO, EAI_FAIL)
270: #define EX_AI_FAMILY ERCD(EC_ERRNO, EAI_FAMILY)
271: #define EX_AI_MEMORY ERCD(EC_ERRNO, EAI_MEMORY)
272: #define EX_AI_NODATA ERCD(EC_ERRNO, EAI_NODATA)
273: #define EX_AI_NONAME ERCD(EC_ERRNO, EAI_NONAME)
274: #define EX_AI_SERVICE ERCD(EC_ERRNO, EAI_SERVICE)
275: #define EX_AI_SOCKTYPE ERCD(EC_ERRNO, EAI_SOCKTYPE)
276: #define EX_AI_SYSTEM ERCD(EC_ERRNO, EAI_SYSTEM)
277: #define EX_AI_BADHINTS ERCD(EC_ERRNO, EAI_BADHINTS)
278: #define EX_AI_OVERFLOW ERCD(EC_ERRNO, EAI_OVERFLOW)
279:
280: #ifdef __cplusplus
281: }
282: #endif
283:
284: #endif
285: