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