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