xref: /haiku/headers/build/os/support/Errors.h (revision 6e82e428596071bbde44e296d04740f1f5d54d03)
1 /*
2  * Copyright 2007-2014 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _BUILD_ERRORS_H
6 #define _BUILD_ERRORS_H
7 
8 
9 #include <errno.h> /* build-specific overrides errno */
10 #include <limits.h>
11 
12 
13 /* Error baselines */
14 #define B_GENERAL_ERROR_BASE		INT_MIN
15 #define B_OS_ERROR_BASE				(B_GENERAL_ERROR_BASE + 0x1000)
16 #define B_APP_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x2000)
17 #define B_INTERFACE_ERROR_BASE		(B_GENERAL_ERROR_BASE + 0x3000)
18 #define B_MEDIA_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x4000)
19 										/* - 0x41ff */
20 #define B_TRANSLATION_ERROR_BASE	(B_GENERAL_ERROR_BASE + 0x4800)
21 										/* - 0x48ff */
22 #define B_MIDI_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x5000)
23 #define B_STORAGE_ERROR_BASE		(B_GENERAL_ERROR_BASE + 0x6000)
24 #define B_POSIX_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x7000)
25 #define B_MAIL_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x8000)
26 #define B_PRINT_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x9000)
27 #define B_DEVICE_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0xa000)
28 
29 /* Developer-defined errors start at (B_ERRORS_END+1) */
30 #define B_ERRORS_END				(B_GENERAL_ERROR_BASE + 0xffff)
31 
32 /* General Errors */
33 #define B_NO_MEMORY					(B_GENERAL_ERROR_BASE + 0)
34 #define B_IO_ERROR					(B_GENERAL_ERROR_BASE + 1)
35 #define B_PERMISSION_DENIED			(B_GENERAL_ERROR_BASE + 2)
36 #define B_BAD_INDEX					(B_GENERAL_ERROR_BASE + 3)
37 #define B_BAD_TYPE					(B_GENERAL_ERROR_BASE + 4)
38 #define B_BAD_VALUE					(B_GENERAL_ERROR_BASE + 5)
39 #define B_MISMATCHED_VALUES			(B_GENERAL_ERROR_BASE + 6)
40 #define B_NAME_NOT_FOUND			(B_GENERAL_ERROR_BASE + 7)
41 #define B_NAME_IN_USE				(B_GENERAL_ERROR_BASE + 8)
42 #define B_TIMED_OUT					(B_GENERAL_ERROR_BASE + 9)
43 #define B_INTERRUPTED				(B_GENERAL_ERROR_BASE + 10)
44 #define B_WOULD_BLOCK				(B_GENERAL_ERROR_BASE + 11)
45 #define B_CANCELED					(B_GENERAL_ERROR_BASE + 12)
46 #define B_NO_INIT					(B_GENERAL_ERROR_BASE + 13)
47 #define B_NOT_INITIALIZED			(B_GENERAL_ERROR_BASE + 13)
48 #define B_BUSY						(B_GENERAL_ERROR_BASE + 14)
49 #define B_NOT_ALLOWED				(B_GENERAL_ERROR_BASE + 15)
50 #define B_BAD_DATA					(B_GENERAL_ERROR_BASE + 16)
51 #define B_DONT_DO_THAT				(B_GENERAL_ERROR_BASE + 17)
52 
53 #define B_ERROR						(-1)
54 #define B_OK						((int)0)
55 #define B_NO_ERROR					((int)0)
56 
57 /* Kernel Kit Errors */
58 #define B_BAD_SEM_ID				(B_OS_ERROR_BASE + 0)
59 #define B_NO_MORE_SEMS				(B_OS_ERROR_BASE + 1)
60 
61 #define B_BAD_THREAD_ID				(B_OS_ERROR_BASE + 0x100)
62 #define B_NO_MORE_THREADS			(B_OS_ERROR_BASE + 0x101)
63 #define B_BAD_THREAD_STATE			(B_OS_ERROR_BASE + 0x102)
64 #define B_BAD_TEAM_ID				(B_OS_ERROR_BASE + 0x103)
65 #define B_NO_MORE_TEAMS				(B_OS_ERROR_BASE + 0x104)
66 
67 #define B_BAD_PORT_ID				(B_OS_ERROR_BASE + 0x200)
68 #define B_NO_MORE_PORTS				(B_OS_ERROR_BASE + 0x201)
69 
70 #define B_BAD_IMAGE_ID				(B_OS_ERROR_BASE + 0x300)
71 #define B_BAD_ADDRESS				(B_OS_ERROR_BASE + 0x301)
72 #define B_NOT_AN_EXECUTABLE			(B_OS_ERROR_BASE + 0x302)
73 #define B_MISSING_LIBRARY			(B_OS_ERROR_BASE + 0x303)
74 #define B_MISSING_SYMBOL			(B_OS_ERROR_BASE + 0x304)
75 #define B_UNKNOWN_EXECUTABLE		(B_OS_ERROR_BASE + 0x305)
76 #define B_LEGACY_EXECUTABLE			(B_OS_ERROR_BASE + 0x306)
77 
78 #define B_DEBUGGER_ALREADY_INSTALLED	(B_OS_ERROR_BASE + 0x400)
79 
80 /* Application Kit Errors */
81 #define B_BAD_REPLY							(B_APP_ERROR_BASE + 0)
82 #define B_DUPLICATE_REPLY					(B_APP_ERROR_BASE + 1)
83 #define B_MESSAGE_TO_SELF					(B_APP_ERROR_BASE + 2)
84 #define B_BAD_HANDLER						(B_APP_ERROR_BASE + 3)
85 #define B_ALREADY_RUNNING					(B_APP_ERROR_BASE + 4)
86 #define B_LAUNCH_FAILED						(B_APP_ERROR_BASE + 5)
87 #define B_AMBIGUOUS_APP_LAUNCH				(B_APP_ERROR_BASE + 6)
88 #define B_UNKNOWN_MIME_TYPE					(B_APP_ERROR_BASE + 7)
89 #define B_BAD_SCRIPT_SYNTAX					(B_APP_ERROR_BASE + 8)
90 #define B_LAUNCH_FAILED_NO_RESOLVE_LINK		(B_APP_ERROR_BASE + 9)
91 #define B_LAUNCH_FAILED_EXECUTABLE			(B_APP_ERROR_BASE + 10)
92 #define B_LAUNCH_FAILED_APP_NOT_FOUND		(B_APP_ERROR_BASE + 11)
93 #define B_LAUNCH_FAILED_APP_IN_TRASH		(B_APP_ERROR_BASE + 12)
94 #define B_LAUNCH_FAILED_NO_PREFERRED_APP	(B_APP_ERROR_BASE + 13)
95 #define B_LAUNCH_FAILED_FILES_APP_NOT_FOUND	(B_APP_ERROR_BASE + 14)
96 #define B_BAD_MIME_SNIFFER_RULE				(B_APP_ERROR_BASE + 15)
97 #define B_NOT_A_MESSAGE						(B_APP_ERROR_BASE + 16)
98 #define B_SHUTDOWN_CANCELLED				(B_APP_ERROR_BASE + 17)
99 #define B_SHUTTING_DOWN						(B_APP_ERROR_BASE + 18)
100 
101 /* Storage Kit/File System Errors */
102 #define B_FILE_ERROR						(B_STORAGE_ERROR_BASE + 0)
103 #define B_FILE_NOT_FOUND					(B_STORAGE_ERROR_BASE + 1)
104 			/* deprecated: use B_ENTRY_NOT_FOUND instead */
105 #define B_FILE_EXISTS						(B_STORAGE_ERROR_BASE + 2)
106 #define B_ENTRY_NOT_FOUND					(B_STORAGE_ERROR_BASE + 3)
107 #define B_NAME_TOO_LONG						(B_STORAGE_ERROR_BASE + 4)
108 #define B_NOT_A_DIRECTORY					(B_STORAGE_ERROR_BASE + 5)
109 #define B_DIRECTORY_NOT_EMPTY				(B_STORAGE_ERROR_BASE + 6)
110 #define B_DEVICE_FULL						(B_STORAGE_ERROR_BASE + 7)
111 #define B_READ_ONLY_DEVICE					(B_STORAGE_ERROR_BASE + 8)
112 #define B_IS_A_DIRECTORY					(B_STORAGE_ERROR_BASE + 9)
113 #define B_NO_MORE_FDS						(B_STORAGE_ERROR_BASE + 10)
114 #define B_CROSS_DEVICE_LINK					(B_STORAGE_ERROR_BASE + 11)
115 #define B_LINK_LIMIT						(B_STORAGE_ERROR_BASE + 12)
116 #define B_BUSTED_PIPE						(B_STORAGE_ERROR_BASE + 13)
117 #define B_UNSUPPORTED						(B_STORAGE_ERROR_BASE + 14)
118 #define B_PARTITION_TOO_SMALL				(B_STORAGE_ERROR_BASE + 15)
119 #define B_PARTIAL_READ						(B_STORAGE_ERROR_BASE + 16)
120 #define B_PARTIAL_WRITE						(B_STORAGE_ERROR_BASE + 17)
121 
122 /* POSIX Errors */
123 #define B_TO_POSIX_ERROR(error)		(error)
124 #define B_FROM_POSIX_ERROR(error)	(error)
125 
126 #define B_POSIX_ENOMEM		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 0)
127 #define HAIKU_E2BIG			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 1)
128 #define HAIKU_ECHILD		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 2)
129 #define HAIKU_EDEADLK		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 3)
130 #define HAIKU_EFBIG			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 4)
131 #define HAIKU_EMLINK		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 5)
132 #define HAIKU_ENFILE		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 6)
133 #define HAIKU_ENODEV		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 7)
134 #define HAIKU_ENOLCK		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 8)
135 #define HAIKU_ENOSYS		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 9)
136 #define HAIKU_ENOTTY		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 10)
137 #define HAIKU_ENXIO			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 11)
138 #define HAIKU_ESPIPE		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 12)
139 #define HAIKU_ESRCH			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 13)
140 #define HAIKU_EFPOS			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 14)
141 #define HAIKU_ESIGPARM		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 15)
142 #define HAIKU_EDOM			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 16)
143 #define HAIKU_ERANGE		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 17)
144 #define HAIKU_EPROTOTYPE	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 18)
145 #define HAIKU_EPROTONOSUPPORT	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 19)
146 #define HAIKU_EPFNOSUPPORT	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 20)
147 #define HAIKU_EAFNOSUPPORT	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 21)
148 #define HAIKU_EADDRINUSE	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 22)
149 #define HAIKU_EADDRNOTAVAIL	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 23)
150 #define HAIKU_ENETDOWN		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 24)
151 #define HAIKU_ENETUNREACH	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 25)
152 #define HAIKU_ENETRESET		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 26)
153 #define HAIKU_ECONNABORTED	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 27)
154 #define HAIKU_ECONNRESET	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 28)
155 #define HAIKU_EISCONN		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 29)
156 #define HAIKU_ENOTCONN		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 30)
157 #define HAIKU_ESHUTDOWN		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 31)
158 #define HAIKU_ECONNREFUSED	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 32)
159 #define HAIKU_EHOSTUNREACH	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 33)
160 #define HAIKU_ENOPROTOOPT	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 34)
161 #define HAIKU_ENOBUFS		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 35)
162 #define HAIKU_EINPROGRESS	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 36)
163 #define HAIKU_EALREADY		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 37)
164 #define HAIKU_EILSEQ		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 38)
165 #define HAIKU_ENOMSG		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 39)
166 #define HAIKU_ESTALE		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 40)
167 #define HAIKU_EOVERFLOW		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 41)
168 #define HAIKU_EMSGSIZE		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 42)
169 #define HAIKU_EOPNOTSUPP	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 43)
170 #define HAIKU_ENOTSOCK		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 44)
171 #define HAIKU_EHOSTDOWN		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 45)
172 #define HAIKU_EBADMSG		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 46)
173 #define HAIKU_ECANCELED		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 47)
174 #define HAIKU_EDESTADDRREQ	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 48)
175 #define HAIKU_EDQUOT		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 49)
176 #define HAIKU_EIDRM			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 50)
177 #define HAIKU_EMULTIHOP		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 51)
178 #define HAIKU_ENODATA		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 52)
179 #define HAIKU_ENOLINK		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 53)
180 #define HAIKU_ENOSR			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 54)
181 #define HAIKU_ENOSTR		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 55)
182 #define HAIKU_ENOTSUP		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 56)
183 #define HAIKU_EPROTO		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 57)
184 #define HAIKU_ETIME			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 58)
185 #define HAIKU_ETXTBSY		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 59)
186 #define HAIKU_ENOATTR		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 60)
187 
188 /* B_NO_MEMORY (0x80000000) can't be negated, so it needs special handling */
189 #define HAIKU_ENOMEM		B_NO_MEMORY
190 
191 /* POSIX errors that can be mapped to BeOS error codes */
192 #define HAIKU_EACCES		B_TO_POSIX_ERROR(B_PERMISSION_DENIED)
193 #define HAIKU_EINTR			B_TO_POSIX_ERROR(B_INTERRUPTED)
194 #define HAIKU_EIO			B_TO_POSIX_ERROR(B_IO_ERROR)
195 #define HAIKU_EBUSY			B_TO_POSIX_ERROR(B_BUSY)
196 #define HAIKU_EFAULT		B_TO_POSIX_ERROR(B_BAD_ADDRESS)
197 #define HAIKU_ETIMEDOUT		B_TO_POSIX_ERROR(B_TIMED_OUT)
198 #define HAIKU_EAGAIN 		B_TO_POSIX_ERROR(B_WOULD_BLOCK)	/* SysV compatibility */
199 #define HAIKU_EWOULDBLOCK 	B_TO_POSIX_ERROR(B_WOULD_BLOCK)	/* BSD compatibility */
200 #define HAIKU_EBADF			B_TO_POSIX_ERROR(B_FILE_ERROR)
201 #define HAIKU_EEXIST		B_TO_POSIX_ERROR(B_FILE_EXISTS)
202 #define HAIKU_EINVAL		B_TO_POSIX_ERROR(B_BAD_VALUE)
203 #define HAIKU_ENAMETOOLONG	B_TO_POSIX_ERROR(B_NAME_TOO_LONG)
204 #define HAIKU_ENOENT		B_TO_POSIX_ERROR(B_ENTRY_NOT_FOUND)
205 #define HAIKU_EPERM			B_TO_POSIX_ERROR(B_NOT_ALLOWED)
206 #define HAIKU_ENOTDIR		B_TO_POSIX_ERROR(B_NOT_A_DIRECTORY)
207 #define HAIKU_EISDIR		B_TO_POSIX_ERROR(B_IS_A_DIRECTORY)
208 #define HAIKU_ENOTEMPTY		B_TO_POSIX_ERROR(B_DIRECTORY_NOT_EMPTY)
209 #define HAIKU_ENOSPC		B_TO_POSIX_ERROR(B_DEVICE_FULL)
210 #define HAIKU_EROFS			B_TO_POSIX_ERROR(B_READ_ONLY_DEVICE)
211 #define HAIKU_EMFILE		B_TO_POSIX_ERROR(B_NO_MORE_FDS)
212 #define HAIKU_EXDEV			B_TO_POSIX_ERROR(B_CROSS_DEVICE_LINK)
213 #define HAIKU_ELOOP			B_TO_POSIX_ERROR(B_LINK_LIMIT)
214 #define HAIKU_ENOEXEC		B_TO_POSIX_ERROR(B_NOT_AN_EXECUTABLE)
215 #define HAIKU_EPIPE			B_TO_POSIX_ERROR(B_BUSTED_PIPE)
216 
217 /* new error codes that can be mapped to POSIX errors */
218 #define B_BUFFER_OVERFLOW			B_FROM_POSIX_ERROR(HAIKU_EOVERFLOW)
219 #define B_TOO_MANY_ARGS				B_FROM_POSIX_ERROR(HAIKU_E2BIG)
220 #define B_FILE_TOO_LARGE			B_FROM_POSIX_ERROR(HAIKU_EFBIG)
221 #define B_RESULT_NOT_REPRESENTABLE	B_FROM_POSIX_ERROR(HAIKU_ERANGE)
222 #define B_DEVICE_NOT_FOUND			B_FROM_POSIX_ERROR(HAIKU_ENODEV)
223 #define B_NOT_SUPPORTED				B_FROM_POSIX_ERROR(HAIKU_EOPNOTSUPP)
224 
225 /* Media Kit Errors */
226 #define B_STREAM_NOT_FOUND				(B_MEDIA_ERROR_BASE + 0)
227 #define B_SERVER_NOT_FOUND				(B_MEDIA_ERROR_BASE + 1)
228 #define B_RESOURCE_NOT_FOUND			(B_MEDIA_ERROR_BASE + 2)
229 #define B_RESOURCE_UNAVAILABLE			(B_MEDIA_ERROR_BASE + 3)
230 #define B_BAD_SUBSCRIBER				(B_MEDIA_ERROR_BASE + 4)
231 #define B_SUBSCRIBER_NOT_ENTERED		(B_MEDIA_ERROR_BASE + 5)
232 #define B_BUFFER_NOT_AVAILABLE			(B_MEDIA_ERROR_BASE + 6)
233 #define B_LAST_BUFFER_ERROR				(B_MEDIA_ERROR_BASE + 7)
234 
235 #define B_MEDIA_SYSTEM_FAILURE			(B_MEDIA_ERROR_BASE + 100)
236 #define B_MEDIA_BAD_NODE				(B_MEDIA_ERROR_BASE + 101)
237 #define B_MEDIA_NODE_BUSY				(B_MEDIA_ERROR_BASE + 102)
238 #define B_MEDIA_BAD_FORMAT				(B_MEDIA_ERROR_BASE + 103)
239 #define B_MEDIA_BAD_BUFFER				(B_MEDIA_ERROR_BASE + 104)
240 #define B_MEDIA_TOO_MANY_NODES			(B_MEDIA_ERROR_BASE + 105)
241 #define B_MEDIA_TOO_MANY_BUFFERS		(B_MEDIA_ERROR_BASE + 106)
242 #define B_MEDIA_NODE_ALREADY_EXISTS		(B_MEDIA_ERROR_BASE + 107)
243 #define B_MEDIA_BUFFER_ALREADY_EXISTS	(B_MEDIA_ERROR_BASE + 108)
244 #define B_MEDIA_CANNOT_SEEK				(B_MEDIA_ERROR_BASE + 109)
245 #define B_MEDIA_CANNOT_CHANGE_RUN_MODE	(B_MEDIA_ERROR_BASE + 110)
246 #define B_MEDIA_APP_ALREADY_REGISTERED	(B_MEDIA_ERROR_BASE + 111)
247 #define B_MEDIA_APP_NOT_REGISTERED		(B_MEDIA_ERROR_BASE + 112)
248 #define B_MEDIA_CANNOT_RECLAIM_BUFFERS	(B_MEDIA_ERROR_BASE + 113)
249 #define B_MEDIA_BUFFERS_NOT_RECLAIMED	(B_MEDIA_ERROR_BASE + 114)
250 #define B_MEDIA_TIME_SOURCE_STOPPED		(B_MEDIA_ERROR_BASE + 115)
251 #define B_MEDIA_TIME_SOURCE_BUSY		(B_MEDIA_ERROR_BASE + 116)
252 #define B_MEDIA_BAD_SOURCE				(B_MEDIA_ERROR_BASE + 117)
253 #define B_MEDIA_BAD_DESTINATION			(B_MEDIA_ERROR_BASE + 118)
254 #define B_MEDIA_ALREADY_CONNECTED		(B_MEDIA_ERROR_BASE + 119)
255 #define B_MEDIA_NOT_CONNECTED			(B_MEDIA_ERROR_BASE + 120)
256 #define B_MEDIA_BAD_CLIP_FORMAT			(B_MEDIA_ERROR_BASE + 121)
257 #define B_MEDIA_ADDON_FAILED			(B_MEDIA_ERROR_BASE + 122)
258 #define B_MEDIA_ADDON_DISABLED			(B_MEDIA_ERROR_BASE + 123)
259 #define B_MEDIA_CHANGE_IN_PROGRESS		(B_MEDIA_ERROR_BASE + 124)
260 #define B_MEDIA_STALE_CHANGE_COUNT		(B_MEDIA_ERROR_BASE + 125)
261 #define B_MEDIA_ADDON_RESTRICTED		(B_MEDIA_ERROR_BASE + 126)
262 #define B_MEDIA_NO_HANDLER				(B_MEDIA_ERROR_BASE + 127)
263 #define B_MEDIA_DUPLICATE_FORMAT		(B_MEDIA_ERROR_BASE + 128)
264 #define B_MEDIA_REALTIME_DISABLED		(B_MEDIA_ERROR_BASE + 129)
265 #define B_MEDIA_REALTIME_UNAVAILABLE	(B_MEDIA_ERROR_BASE + 130)
266 
267 /* Mail Kit Errors */
268 #define B_MAIL_NO_DAEMON				(B_MAIL_ERROR_BASE + 0)
269 #define B_MAIL_UNKNOWN_USER				(B_MAIL_ERROR_BASE + 1)
270 #define B_MAIL_WRONG_PASSWORD			(B_MAIL_ERROR_BASE + 2)
271 #define B_MAIL_UNKNOWN_HOST				(B_MAIL_ERROR_BASE + 3)
272 #define B_MAIL_ACCESS_ERROR				(B_MAIL_ERROR_BASE + 4)
273 #define B_MAIL_UNKNOWN_FIELD			(B_MAIL_ERROR_BASE + 5)
274 #define B_MAIL_NO_RECIPIENT				(B_MAIL_ERROR_BASE + 6)
275 #define B_MAIL_INVALID_MAIL				(B_MAIL_ERROR_BASE + 7)
276 
277 /* Printing Errors */
278 #define B_NO_PRINT_SERVER				(B_PRINT_ERROR_BASE + 0)
279 
280 /* Device Kit Errors */
281 #define B_DEV_INVALID_IOCTL				(B_DEVICE_ERROR_BASE + 0)
282 #define B_DEV_NO_MEMORY					(B_DEVICE_ERROR_BASE + 1)
283 #define B_DEV_BAD_DRIVE_NUM				(B_DEVICE_ERROR_BASE + 2)
284 #define B_DEV_NO_MEDIA					(B_DEVICE_ERROR_BASE + 3)
285 #define B_DEV_UNREADABLE				(B_DEVICE_ERROR_BASE + 4)
286 #define B_DEV_FORMAT_ERROR				(B_DEVICE_ERROR_BASE + 5)
287 #define B_DEV_TIMEOUT					(B_DEVICE_ERROR_BASE + 6)
288 #define B_DEV_RECALIBRATE_ERROR			(B_DEVICE_ERROR_BASE + 7)
289 #define B_DEV_SEEK_ERROR				(B_DEVICE_ERROR_BASE + 8)
290 #define B_DEV_ID_ERROR					(B_DEVICE_ERROR_BASE + 9)
291 #define B_DEV_READ_ERROR				(B_DEVICE_ERROR_BASE + 10)
292 #define B_DEV_WRITE_ERROR				(B_DEVICE_ERROR_BASE + 11)
293 #define B_DEV_NOT_READY					(B_DEVICE_ERROR_BASE + 12)
294 #define B_DEV_MEDIA_CHANGED				(B_DEVICE_ERROR_BASE + 13)
295 #define B_DEV_MEDIA_CHANGE_REQUESTED	(B_DEVICE_ERROR_BASE + 14)
296 #define B_DEV_RESOURCE_CONFLICT			(B_DEVICE_ERROR_BASE + 15)
297 #define B_DEV_CONFIGURATION_ERROR		(B_DEVICE_ERROR_BASE + 16)
298 #define B_DEV_DISABLED_BY_USER			(B_DEVICE_ERROR_BASE + 17)
299 #define B_DEV_DOOR_OPEN					(B_DEVICE_ERROR_BASE + 18)
300 
301 #define B_DEV_INVALID_PIPE				(B_DEVICE_ERROR_BASE + 19)
302 #define B_DEV_CRC_ERROR					(B_DEVICE_ERROR_BASE + 20)
303 #define B_DEV_STALLED					(B_DEVICE_ERROR_BASE + 21)
304 #define B_DEV_BAD_PID					(B_DEVICE_ERROR_BASE + 22)
305 #define B_DEV_UNEXPECTED_PID			(B_DEVICE_ERROR_BASE + 23)
306 #define B_DEV_DATA_OVERRUN				(B_DEVICE_ERROR_BASE + 24)
307 #define B_DEV_DATA_UNDERRUN				(B_DEVICE_ERROR_BASE + 25)
308 #define B_DEV_FIFO_OVERRUN				(B_DEVICE_ERROR_BASE + 26)
309 #define B_DEV_FIFO_UNDERRUN				(B_DEVICE_ERROR_BASE + 27)
310 #define B_DEV_PENDING					(B_DEVICE_ERROR_BASE + 28)
311 #define B_DEV_MULTIPLE_ERRORS			(B_DEVICE_ERROR_BASE + 29)
312 #define B_DEV_TOO_LATE					(B_DEVICE_ERROR_BASE + 30)
313 
314 /* Translation Kit Errors */
315 #define B_TRANSLATION_BASE_ERROR		(B_TRANSLATION_ERROR_BASE + 0)
316 #define B_NO_TRANSLATOR					(B_TRANSLATION_ERROR_BASE + 1)
317 #define B_ILLEGAL_DATA					(B_TRANSLATION_ERROR_BASE + 2)
318 
319 
320 /* build-specific code */
321 #ifndef BUILDING_HAIKU_ERROR_MAPPER
322 	#undef E2BIG
323 	#undef ECHILD
324 	#undef EDEADLK
325 	#undef EFBIG
326 	#undef EMLINK
327 	#undef ENFILE
328 	#undef ENODEV
329 	#undef ENOLCK
330 	#undef ENOSYS
331 	#undef ENOTTY
332 	#undef ENXIO
333 	#undef ESPIPE
334 	#undef ESRCH
335 	#undef EFPOS
336 	#undef ESIGPARM
337 	#undef EDOM
338 	#undef ERANGE
339 	#undef EPROTOTYPE
340 	#undef EPROTONOSUPPORT
341 	#undef EPFNOSUPPORT
342 	#undef EAFNOSUPPORT
343 	#undef EADDRINUSE
344 	#undef EADDRNOTAVAIL
345 	#undef ENETDOWN
346 	#undef ENETUNREACH
347 	#undef ENETRESET
348 	#undef ECONNABORTED
349 	#undef ECONNRESET
350 	#undef EISCONN
351 	#undef ENOTCONN
352 	#undef ESHUTDOWN
353 	#undef ECONNREFUSED
354 	#undef EHOSTUNREACH
355 	#undef ENOPROTOOPT
356 	#undef ENOBUFS
357 	#undef EINPROGRESS
358 	#undef EALREADY
359 	#undef EILSEQ
360 	#undef ENOMSG
361 	#undef ESTALE
362 	#undef EOVERFLOW
363 	#undef EMSGSIZE
364 	#undef EOPNOTSUPP
365 	#undef ENOTSOCK
366 	#undef EHOSTDOWN
367 	#undef EBADMSG
368 	#undef ECANCELED
369 	#undef EDESTADDRREQ
370 	#undef EDQUOT
371 	#undef EIDRM
372 	#undef EMULTIHOP
373 	#undef ENODATA
374 	#undef ENOLINK
375 	#undef ENOSR
376 	#undef ENOSTR
377 	#undef ENOTSUP
378 	#undef EPROTO
379 	#undef ETIME
380 	#undef ETXTBSY
381 	#undef ENOMEM
382 	#undef EACCES
383 	#undef EINTR
384 	#undef EIO
385 	#undef EBUSY
386 	#undef EFAULT
387 	#undef ETIMEDOUT
388 	#undef EAGAIN
389 	#undef EWOULDBLOCK
390 	#undef EBADF
391 	#undef EEXIST
392 	#undef EINVAL
393 	#undef ENAMETOOLONG
394 	#undef ENOENT
395 	#undef EPERM
396 	#undef ENOTDIR
397 	#undef EISDIR
398 	#undef ENOTEMPTY
399 	#undef ENOSPC
400 	#undef EROFS
401 	#undef EMFILE
402 	#undef EXDEV
403 	#undef ELOOP
404 	#undef ENOEXEC
405 	#undef EPIPE
406 	#undef ENOATTR
407 
408 	#define E2BIG HAIKU_E2BIG
409 	#define ECHILD HAIKU_ECHILD
410 	#define EDEADLK HAIKU_EDEADLK
411 	#define EFBIG HAIKU_EFBIG
412 	#define EMLINK HAIKU_EMLINK
413 	#define ENFILE HAIKU_ENFILE
414 	#define ENODEV HAIKU_ENODEV
415 	#define ENOLCK HAIKU_ENOLCK
416 	#define ENOSYS HAIKU_ENOSYS
417 	#define ENOTTY HAIKU_ENOTTY
418 	#define ENXIO HAIKU_ENXIO
419 	#define ESPIPE HAIKU_ESPIPE
420 	#define ESRCH HAIKU_ESRCH
421 	#define EFPOS HAIKU_EFPOS
422 	#define ESIGPARM HAIKU_ESIGPARM
423 	#define EDOM HAIKU_EDOM
424 	#define ERANGE HAIKU_ERANGE
425 	#define EPROTOTYPE HAIKU_EPROTOTYPE
426 	#define EPROTONOSUPPORT HAIKU_EPROTONOSUPPORT
427 	#define EPFNOSUPPORT HAIKU_EPFNOSUPPORT
428 	#define EAFNOSUPPORT HAIKU_EAFNOSUPPORT
429 	#define EADDRINUSE HAIKU_EADDRINUSE
430 	#define EADDRNOTAVAIL HAIKU_EADDRNOTAVAIL
431 	#define ENETDOWN HAIKU_ENETDOWN
432 	#define ENETUNREACH HAIKU_ENETUNREACH
433 	#define ENETRESET HAIKU_ENETRESET
434 	#define ECONNABORTED HAIKU_ECONNABORTED
435 	#define ECONNRESET HAIKU_ECONNRESET
436 	#define EISCONN HAIKU_EISCONN
437 	#define ENOTCONN HAIKU_ENOTCONN
438 	#define ESHUTDOWN HAIKU_ESHUTDOWN
439 	#define ECONNREFUSED HAIKU_ECONNREFUSED
440 	#define EHOSTUNREACH HAIKU_EHOSTUNREACH
441 	#define ENOPROTOOPT HAIKU_ENOPROTOOPT
442 	#define ENOBUFS HAIKU_ENOBUFS
443 	#define EINPROGRESS HAIKU_EINPROGRESS
444 	#define EALREADY HAIKU_EALREADY
445 	#define EILSEQ HAIKU_EILSEQ
446 	#define ENOMSG HAIKU_ENOMSG
447 	#define ESTALE HAIKU_ESTALE
448 	#define EOVERFLOW HAIKU_EOVERFLOW
449 	#define EMSGSIZE HAIKU_EMSGSIZE
450 	#define EOPNOTSUPP HAIKU_EOPNOTSUPP
451 	#define ENOTSOCK HAIKU_ENOTSOCK
452 	#define EHOSTDOWN HAIKU_EHOSTDOWN
453 	#define	EBADMSG HAIKU_EBADMSG
454 	#define ECANCELED HAIKU_ECANCELED
455 	#define EDESTADDRREQ HAIKU_EDESTADDRREQ
456 	#define EDQUOT HAIKU_EDQUOT
457 	#define EIDRM HAIKU_EIDRM
458 	#define EMULTIHOP HAIKU_EMULTIHOP
459 	#define ENODATA HAIKU_ENODATA
460 	#define ENOLINK HAIKU_ENOLINK
461 	#define ENOSR HAIKU_ENOSR
462 	#define ENOSTR HAIKU_ENOSTR
463 	#define ENOTSUP HAIKU_ENOTSUP
464 	#define EPROTO HAIKU_EPROTO
465 	#define ETIME HAIKU_ETIME
466 	#define ETXTBSY HAIKU_ETXTBSY
467 	#define ENOMEM HAIKU_ENOMEM
468 	#define EACCES HAIKU_EACCES
469 	#define EINTR HAIKU_EINTR
470 	#define EIO HAIKU_EIO
471 	#define EBUSY HAIKU_EBUSY
472 	#define EFAULT HAIKU_EFAULT
473 	#define ETIMEDOUT HAIKU_ETIMEDOUT
474 	#define EAGAIN HAIKU_EAGAIN
475 	#define EWOULDBLOCK HAIKU_EWOULDBLOCK
476 	#define EBADF HAIKU_EBADF
477 	#define EEXIST HAIKU_EEXIST
478 	#define EINVAL HAIKU_EINVAL
479 	#define ENAMETOOLONG HAIKU_ENAMETOOLONG
480 	#define ENOENT HAIKU_ENOENT
481 	#define EPERM HAIKU_EPERM
482 	#define ENOTDIR HAIKU_ENOTDIR
483 	#define EISDIR HAIKU_EISDIR
484 	#define ENOTEMPTY HAIKU_ENOTEMPTY
485 	#define ENOSPC HAIKU_ENOSPC
486 	#define EROFS HAIKU_EROFS
487 	#define EMFILE HAIKU_EMFILE
488 	#define EXDEV HAIKU_EXDEV
489 	#define ELOOP HAIKU_ELOOP
490 	#define ENOEXEC HAIKU_ENOEXEC
491 	#define EPIPE HAIKU_EPIPE
492 	#define ENOATTR HAIKU_ENOATTR
493 
494 	#undef errno
495 	#define errno (*_haiku_build_errno())
496 #elif defined(HAIKU_HOST_PLATFORM_HAIKU)
497 #	include <../os/support/Errors.h>
498 #endif	// ! BUILDING_HAIKU_ERROR_MAPPER
499 
500 #ifdef __cplusplus
501 extern "C" {
502 #endif
503 
504 extern int *_haiku_build_errno();
505 extern int _haiku_to_host_error(int error);
506 
507 #ifdef __cplusplus
508 }
509 #endif
510 
511 
512 #endif	/* _BUILD_ERRORS_H */
513