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