xref: /haiku/headers/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 _ERRORS_H
6 #define _ERRORS_H
7 
8 
9 #include <limits.h>
10 
11 
12 /* Error baselines */
13 #define B_GENERAL_ERROR_BASE		INT_MIN
14 #define B_OS_ERROR_BASE				(B_GENERAL_ERROR_BASE + 0x1000)
15 #define B_APP_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x2000)
16 #define B_INTERFACE_ERROR_BASE		(B_GENERAL_ERROR_BASE + 0x3000)
17 #define B_MEDIA_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x4000)
18 										/* - 0x41ff */
19 #define B_TRANSLATION_ERROR_BASE	(B_GENERAL_ERROR_BASE + 0x4800)
20 										/* - 0x48ff */
21 #define B_MIDI_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x5000)
22 #define B_STORAGE_ERROR_BASE		(B_GENERAL_ERROR_BASE + 0x6000)
23 #define B_POSIX_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x7000)
24 #define B_MAIL_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x8000)
25 #define B_PRINT_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0x9000)
26 #define B_DEVICE_ERROR_BASE			(B_GENERAL_ERROR_BASE + 0xa000)
27 
28 /* Developer-defined errors start at (B_ERRORS_END+1) */
29 #define B_ERRORS_END				(B_GENERAL_ERROR_BASE + 0xffff)
30 
31 /* General Errors */
32 #define B_NO_MEMORY					(B_GENERAL_ERROR_BASE + 0)
33 #define B_IO_ERROR					(B_GENERAL_ERROR_BASE + 1)
34 #define B_PERMISSION_DENIED			(B_GENERAL_ERROR_BASE + 2)
35 #define B_BAD_INDEX					(B_GENERAL_ERROR_BASE + 3)
36 #define B_BAD_TYPE					(B_GENERAL_ERROR_BASE + 4)
37 #define B_BAD_VALUE					(B_GENERAL_ERROR_BASE + 5)
38 #define B_MISMATCHED_VALUES			(B_GENERAL_ERROR_BASE + 6)
39 #define B_NAME_NOT_FOUND			(B_GENERAL_ERROR_BASE + 7)
40 #define B_NAME_IN_USE				(B_GENERAL_ERROR_BASE + 8)
41 #define B_TIMED_OUT					(B_GENERAL_ERROR_BASE + 9)
42 #define B_INTERRUPTED				(B_GENERAL_ERROR_BASE + 10)
43 #define B_WOULD_BLOCK				(B_GENERAL_ERROR_BASE + 11)
44 #define B_CANCELED					(B_GENERAL_ERROR_BASE + 12)
45 #define B_NO_INIT					(B_GENERAL_ERROR_BASE + 13)
46 #define B_NOT_INITIALIZED			(B_GENERAL_ERROR_BASE + 13)
47 #define B_BUSY						(B_GENERAL_ERROR_BASE + 14)
48 #define B_NOT_ALLOWED				(B_GENERAL_ERROR_BASE + 15)
49 #define B_BAD_DATA					(B_GENERAL_ERROR_BASE + 16)
50 #define B_DONT_DO_THAT				(B_GENERAL_ERROR_BASE + 17)
51 
52 #define B_ERROR						(-1)
53 #define B_OK						((int)0)
54 #define B_NO_ERROR					((int)0)
55 
56 /* Kernel Kit Errors */
57 #define B_BAD_SEM_ID				(B_OS_ERROR_BASE + 0)
58 #define B_NO_MORE_SEMS				(B_OS_ERROR_BASE + 1)
59 
60 #define B_BAD_THREAD_ID				(B_OS_ERROR_BASE + 0x100)
61 #define B_NO_MORE_THREADS			(B_OS_ERROR_BASE + 0x101)
62 #define B_BAD_THREAD_STATE			(B_OS_ERROR_BASE + 0x102)
63 #define B_BAD_TEAM_ID				(B_OS_ERROR_BASE + 0x103)
64 #define B_NO_MORE_TEAMS				(B_OS_ERROR_BASE + 0x104)
65 
66 #define B_BAD_PORT_ID				(B_OS_ERROR_BASE + 0x200)
67 #define B_NO_MORE_PORTS				(B_OS_ERROR_BASE + 0x201)
68 
69 #define B_BAD_IMAGE_ID				(B_OS_ERROR_BASE + 0x300)
70 #define B_BAD_ADDRESS				(B_OS_ERROR_BASE + 0x301)
71 #define B_NOT_AN_EXECUTABLE			(B_OS_ERROR_BASE + 0x302)
72 #define B_MISSING_LIBRARY			(B_OS_ERROR_BASE + 0x303)
73 #define B_MISSING_SYMBOL			(B_OS_ERROR_BASE + 0x304)
74 #define B_UNKNOWN_EXECUTABLE		(B_OS_ERROR_BASE + 0x305)
75 #define B_LEGACY_EXECUTABLE			(B_OS_ERROR_BASE + 0x306)
76 
77 #define B_DEBUGGER_ALREADY_INSTALLED	(B_OS_ERROR_BASE + 0x400)
78 
79 /* Application Kit Errors */
80 #define B_BAD_REPLY							(B_APP_ERROR_BASE + 0)
81 #define B_DUPLICATE_REPLY					(B_APP_ERROR_BASE + 1)
82 #define B_MESSAGE_TO_SELF					(B_APP_ERROR_BASE + 2)
83 #define B_BAD_HANDLER						(B_APP_ERROR_BASE + 3)
84 #define B_ALREADY_RUNNING					(B_APP_ERROR_BASE + 4)
85 #define B_LAUNCH_FAILED						(B_APP_ERROR_BASE + 5)
86 #define B_AMBIGUOUS_APP_LAUNCH				(B_APP_ERROR_BASE + 6)
87 #define B_UNKNOWN_MIME_TYPE					(B_APP_ERROR_BASE + 7)
88 #define B_BAD_SCRIPT_SYNTAX					(B_APP_ERROR_BASE + 8)
89 #define B_LAUNCH_FAILED_NO_RESOLVE_LINK		(B_APP_ERROR_BASE + 9)
90 #define B_LAUNCH_FAILED_EXECUTABLE			(B_APP_ERROR_BASE + 10)
91 #define B_LAUNCH_FAILED_APP_NOT_FOUND		(B_APP_ERROR_BASE + 11)
92 #define B_LAUNCH_FAILED_APP_IN_TRASH		(B_APP_ERROR_BASE + 12)
93 #define B_LAUNCH_FAILED_NO_PREFERRED_APP	(B_APP_ERROR_BASE + 13)
94 #define B_LAUNCH_FAILED_FILES_APP_NOT_FOUND	(B_APP_ERROR_BASE + 14)
95 #define B_BAD_MIME_SNIFFER_RULE				(B_APP_ERROR_BASE + 15)
96 #define B_NOT_A_MESSAGE						(B_APP_ERROR_BASE + 16)
97 #define B_SHUTDOWN_CANCELLED				(B_APP_ERROR_BASE + 17)
98 #define B_SHUTTING_DOWN						(B_APP_ERROR_BASE + 18)
99 
100 /* Storage Kit/File System Errors */
101 #define B_FILE_ERROR						(B_STORAGE_ERROR_BASE + 0)
102 /* 1 was B_FILE_NOT_FOUND (deprecated) */
103 #define B_FILE_EXISTS						(B_STORAGE_ERROR_BASE + 2)
104 #define B_ENTRY_NOT_FOUND					(B_STORAGE_ERROR_BASE + 3)
105 #define B_NAME_TOO_LONG						(B_STORAGE_ERROR_BASE + 4)
106 #define B_NOT_A_DIRECTORY					(B_STORAGE_ERROR_BASE + 5)
107 #define B_DIRECTORY_NOT_EMPTY				(B_STORAGE_ERROR_BASE + 6)
108 #define B_DEVICE_FULL						(B_STORAGE_ERROR_BASE + 7)
109 #define B_READ_ONLY_DEVICE					(B_STORAGE_ERROR_BASE + 8)
110 #define B_IS_A_DIRECTORY					(B_STORAGE_ERROR_BASE + 9)
111 #define B_NO_MORE_FDS						(B_STORAGE_ERROR_BASE + 10)
112 #define B_CROSS_DEVICE_LINK					(B_STORAGE_ERROR_BASE + 11)
113 #define B_LINK_LIMIT						(B_STORAGE_ERROR_BASE + 12)
114 #define B_BUSTED_PIPE						(B_STORAGE_ERROR_BASE + 13)
115 #define B_UNSUPPORTED						(B_STORAGE_ERROR_BASE + 14)
116 #define B_PARTITION_TOO_SMALL				(B_STORAGE_ERROR_BASE + 15)
117 #define B_PARTIAL_READ						(B_STORAGE_ERROR_BASE + 16)
118 #define B_PARTIAL_WRITE						(B_STORAGE_ERROR_BASE + 17)
119 
120 /* POSIX Errors */
121 #ifdef B_USE_POSITIVE_POSIX_ERRORS
122 #	define B_TO_POSIX_ERROR(error)		(-(error))
123 #	define B_FROM_POSIX_ERROR(error)	(-(error))
124 #else
125 #	define B_TO_POSIX_ERROR(error)		(error)
126 #	define B_FROM_POSIX_ERROR(error)	(error)
127 #endif
128 
129 #define B_POSIX_ENOMEM	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 0)
130 #define E2BIG			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 1)
131 #define ECHILD			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 2)
132 #define EDEADLK			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 3)
133 #define EFBIG			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 4)
134 #define EMLINK			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 5)
135 #define ENFILE			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 6)
136 #define ENODEV			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 7)
137 #define ENOLCK			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 8)
138 #define ENOSYS			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 9)
139 #define ENOTTY			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 10)
140 #define ENXIO			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 11)
141 #define ESPIPE			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 12)
142 #define ESRCH			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 13)
143 #define EFPOS			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 14)
144 #define ESIGPARM		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 15)
145 #define EDOM			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 16)
146 #define ERANGE			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 17)
147 #define EPROTOTYPE		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 18)
148 #define EPROTONOSUPPORT	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 19)
149 #define EPFNOSUPPORT	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 20)
150 #define EAFNOSUPPORT	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 21)
151 #define EADDRINUSE		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 22)
152 #define EADDRNOTAVAIL	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 23)
153 #define ENETDOWN		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 24)
154 #define ENETUNREACH		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 25)
155 #define ENETRESET		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 26)
156 #define ECONNABORTED	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 27)
157 #define ECONNRESET		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 28)
158 #define EISCONN			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 29)
159 #define ENOTCONN		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 30)
160 #define ESHUTDOWN		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 31)
161 #define ECONNREFUSED	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 32)
162 #define EHOSTUNREACH	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 33)
163 #define ENOPROTOOPT		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 34)
164 #define ENOBUFS			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 35)
165 #define EINPROGRESS		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 36)
166 #define EALREADY		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 37)
167 #define EILSEQ			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 38)
168 #define ENOMSG			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 39)
169 #define ESTALE			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 40)
170 #define EOVERFLOW		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 41)
171 #define EMSGSIZE		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 42)
172 #define EOPNOTSUPP		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 43)
173 #define ENOTSOCK		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 44)
174 #define EHOSTDOWN		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 45)
175 #define EBADMSG			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 46)
176 #define ECANCELED		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 47)
177 #define EDESTADDRREQ	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 48)
178 #define EDQUOT			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 49)
179 #define EIDRM			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 50)
180 #define EMULTIHOP		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 51)
181 #define ENODATA			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 52)
182 #define ENOLINK			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 53)
183 #define ENOSR			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 54)
184 #define ENOSTR			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 55)
185 #define ENOTSUP			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 56)
186 #define EPROTO			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 57)
187 #define ETIME			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 58)
188 #define ETXTBSY			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 59)
189 #define ENOATTR			B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 60)
190 #define ENOTRECOVERABLE	B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 61)
191 #define EOWNERDEAD		B_TO_POSIX_ERROR(B_POSIX_ERROR_BASE + 62)
192 
193 /* B_NO_MEMORY (0x80000000) can't be negated, so it needs special handling */
194 #ifdef B_USE_POSITIVE_POSIX_ERRORS
195 #	define ENOMEM		B_POSIX_ENOMEM
196 #else
197 #	define ENOMEM		B_NO_MEMORY
198 #endif
199 
200 /* POSIX errors that can be mapped to BeOS error codes */
201 #define EACCES			B_TO_POSIX_ERROR(B_PERMISSION_DENIED)
202 #define EINTR			B_TO_POSIX_ERROR(B_INTERRUPTED)
203 #define EIO				B_TO_POSIX_ERROR(B_IO_ERROR)
204 #define EBUSY			B_TO_POSIX_ERROR(B_BUSY)
205 #define EFAULT			B_TO_POSIX_ERROR(B_BAD_ADDRESS)
206 #define ETIMEDOUT		B_TO_POSIX_ERROR(B_TIMED_OUT)
207 #define EAGAIN 			B_TO_POSIX_ERROR(B_WOULD_BLOCK)	/* SysV compatibility */
208 #define EWOULDBLOCK 	B_TO_POSIX_ERROR(B_WOULD_BLOCK)	/* BSD compatibility */
209 #define EBADF			B_TO_POSIX_ERROR(B_FILE_ERROR)
210 #define EEXIST			B_TO_POSIX_ERROR(B_FILE_EXISTS)
211 #define EINVAL			B_TO_POSIX_ERROR(B_BAD_VALUE)
212 #define ENAMETOOLONG	B_TO_POSIX_ERROR(B_NAME_TOO_LONG)
213 #define ENOENT			B_TO_POSIX_ERROR(B_ENTRY_NOT_FOUND)
214 #define EPERM			B_TO_POSIX_ERROR(B_NOT_ALLOWED)
215 #define ENOTDIR			B_TO_POSIX_ERROR(B_NOT_A_DIRECTORY)
216 #define EISDIR			B_TO_POSIX_ERROR(B_IS_A_DIRECTORY)
217 #define ENOTEMPTY		B_TO_POSIX_ERROR(B_DIRECTORY_NOT_EMPTY)
218 #define ENOSPC			B_TO_POSIX_ERROR(B_DEVICE_FULL)
219 #define EROFS			B_TO_POSIX_ERROR(B_READ_ONLY_DEVICE)
220 #define EMFILE			B_TO_POSIX_ERROR(B_NO_MORE_FDS)
221 #define EXDEV			B_TO_POSIX_ERROR(B_CROSS_DEVICE_LINK)
222 #define ELOOP			B_TO_POSIX_ERROR(B_LINK_LIMIT)
223 #define ENOEXEC			B_TO_POSIX_ERROR(B_NOT_AN_EXECUTABLE)
224 #define EPIPE			B_TO_POSIX_ERROR(B_BUSTED_PIPE)
225 
226 /* new error codes that can be mapped to POSIX errors */
227 #define B_BUFFER_OVERFLOW			B_FROM_POSIX_ERROR(EOVERFLOW)
228 #define B_TOO_MANY_ARGS				B_FROM_POSIX_ERROR(E2BIG)
229 #define B_FILE_TOO_LARGE			B_FROM_POSIX_ERROR(EFBIG)
230 #define B_RESULT_NOT_REPRESENTABLE	B_FROM_POSIX_ERROR(ERANGE)
231 #define B_DEVICE_NOT_FOUND			B_FROM_POSIX_ERROR(ENODEV)
232 #define B_NOT_SUPPORTED				B_FROM_POSIX_ERROR(EOPNOTSUPP)
233 
234 /* Media Kit Errors */
235 #define B_STREAM_NOT_FOUND				(B_MEDIA_ERROR_BASE + 0)
236 #define B_SERVER_NOT_FOUND				(B_MEDIA_ERROR_BASE + 1)
237 #define B_RESOURCE_NOT_FOUND			(B_MEDIA_ERROR_BASE + 2)
238 #define B_RESOURCE_UNAVAILABLE			(B_MEDIA_ERROR_BASE + 3)
239 #define B_BAD_SUBSCRIBER				(B_MEDIA_ERROR_BASE + 4)
240 #define B_SUBSCRIBER_NOT_ENTERED		(B_MEDIA_ERROR_BASE + 5)
241 #define B_BUFFER_NOT_AVAILABLE			(B_MEDIA_ERROR_BASE + 6)
242 #define B_LAST_BUFFER_ERROR				(B_MEDIA_ERROR_BASE + 7)
243 
244 #define B_MEDIA_SYSTEM_FAILURE			(B_MEDIA_ERROR_BASE + 100)
245 #define B_MEDIA_BAD_NODE				(B_MEDIA_ERROR_BASE + 101)
246 #define B_MEDIA_NODE_BUSY				(B_MEDIA_ERROR_BASE + 102)
247 #define B_MEDIA_BAD_FORMAT				(B_MEDIA_ERROR_BASE + 103)
248 #define B_MEDIA_BAD_BUFFER				(B_MEDIA_ERROR_BASE + 104)
249 #define B_MEDIA_TOO_MANY_NODES			(B_MEDIA_ERROR_BASE + 105)
250 #define B_MEDIA_TOO_MANY_BUFFERS		(B_MEDIA_ERROR_BASE + 106)
251 #define B_MEDIA_NODE_ALREADY_EXISTS		(B_MEDIA_ERROR_BASE + 107)
252 #define B_MEDIA_BUFFER_ALREADY_EXISTS	(B_MEDIA_ERROR_BASE + 108)
253 #define B_MEDIA_CANNOT_SEEK				(B_MEDIA_ERROR_BASE + 109)
254 #define B_MEDIA_CANNOT_CHANGE_RUN_MODE	(B_MEDIA_ERROR_BASE + 110)
255 #define B_MEDIA_APP_ALREADY_REGISTERED	(B_MEDIA_ERROR_BASE + 111)
256 #define B_MEDIA_APP_NOT_REGISTERED		(B_MEDIA_ERROR_BASE + 112)
257 #define B_MEDIA_CANNOT_RECLAIM_BUFFERS	(B_MEDIA_ERROR_BASE + 113)
258 #define B_MEDIA_BUFFERS_NOT_RECLAIMED	(B_MEDIA_ERROR_BASE + 114)
259 #define B_MEDIA_TIME_SOURCE_STOPPED		(B_MEDIA_ERROR_BASE + 115)
260 #define B_MEDIA_TIME_SOURCE_BUSY		(B_MEDIA_ERROR_BASE + 116)
261 #define B_MEDIA_BAD_SOURCE				(B_MEDIA_ERROR_BASE + 117)
262 #define B_MEDIA_BAD_DESTINATION			(B_MEDIA_ERROR_BASE + 118)
263 #define B_MEDIA_ALREADY_CONNECTED		(B_MEDIA_ERROR_BASE + 119)
264 #define B_MEDIA_NOT_CONNECTED			(B_MEDIA_ERROR_BASE + 120)
265 #define B_MEDIA_BAD_CLIP_FORMAT			(B_MEDIA_ERROR_BASE + 121)
266 #define B_MEDIA_ADDON_FAILED			(B_MEDIA_ERROR_BASE + 122)
267 #define B_MEDIA_ADDON_DISABLED			(B_MEDIA_ERROR_BASE + 123)
268 #define B_MEDIA_CHANGE_IN_PROGRESS		(B_MEDIA_ERROR_BASE + 124)
269 #define B_MEDIA_STALE_CHANGE_COUNT		(B_MEDIA_ERROR_BASE + 125)
270 #define B_MEDIA_ADDON_RESTRICTED		(B_MEDIA_ERROR_BASE + 126)
271 #define B_MEDIA_NO_HANDLER				(B_MEDIA_ERROR_BASE + 127)
272 #define B_MEDIA_DUPLICATE_FORMAT		(B_MEDIA_ERROR_BASE + 128)
273 #define B_MEDIA_REALTIME_DISABLED		(B_MEDIA_ERROR_BASE + 129)
274 #define B_MEDIA_REALTIME_UNAVAILABLE	(B_MEDIA_ERROR_BASE + 130)
275 
276 /* Mail Kit Errors */
277 #define B_MAIL_NO_DAEMON				(B_MAIL_ERROR_BASE + 0)
278 #define B_MAIL_UNKNOWN_USER				(B_MAIL_ERROR_BASE + 1)
279 #define B_MAIL_WRONG_PASSWORD			(B_MAIL_ERROR_BASE + 2)
280 #define B_MAIL_UNKNOWN_HOST				(B_MAIL_ERROR_BASE + 3)
281 #define B_MAIL_ACCESS_ERROR				(B_MAIL_ERROR_BASE + 4)
282 #define B_MAIL_UNKNOWN_FIELD			(B_MAIL_ERROR_BASE + 5)
283 #define B_MAIL_NO_RECIPIENT				(B_MAIL_ERROR_BASE + 6)
284 #define B_MAIL_INVALID_MAIL				(B_MAIL_ERROR_BASE + 7)
285 
286 /* Printing Errors */
287 #define B_NO_PRINT_SERVER				(B_PRINT_ERROR_BASE + 0)
288 
289 /* Device Kit Errors */
290 #define B_DEV_INVALID_IOCTL				(B_DEVICE_ERROR_BASE + 0)
291 #define B_DEV_NO_MEMORY					(B_DEVICE_ERROR_BASE + 1)
292 #define B_DEV_BAD_DRIVE_NUM				(B_DEVICE_ERROR_BASE + 2)
293 #define B_DEV_NO_MEDIA					(B_DEVICE_ERROR_BASE + 3)
294 #define B_DEV_UNREADABLE				(B_DEVICE_ERROR_BASE + 4)
295 #define B_DEV_FORMAT_ERROR				(B_DEVICE_ERROR_BASE + 5)
296 #define B_DEV_TIMEOUT					(B_DEVICE_ERROR_BASE + 6)
297 #define B_DEV_RECALIBRATE_ERROR			(B_DEVICE_ERROR_BASE + 7)
298 #define B_DEV_SEEK_ERROR				(B_DEVICE_ERROR_BASE + 8)
299 #define B_DEV_ID_ERROR					(B_DEVICE_ERROR_BASE + 9)
300 #define B_DEV_READ_ERROR				(B_DEVICE_ERROR_BASE + 10)
301 #define B_DEV_WRITE_ERROR				(B_DEVICE_ERROR_BASE + 11)
302 #define B_DEV_NOT_READY					(B_DEVICE_ERROR_BASE + 12)
303 #define B_DEV_MEDIA_CHANGED				(B_DEVICE_ERROR_BASE + 13)
304 #define B_DEV_MEDIA_CHANGE_REQUESTED	(B_DEVICE_ERROR_BASE + 14)
305 #define B_DEV_RESOURCE_CONFLICT			(B_DEVICE_ERROR_BASE + 15)
306 #define B_DEV_CONFIGURATION_ERROR		(B_DEVICE_ERROR_BASE + 16)
307 #define B_DEV_DISABLED_BY_USER			(B_DEVICE_ERROR_BASE + 17)
308 #define B_DEV_DOOR_OPEN					(B_DEVICE_ERROR_BASE + 18)
309 
310 #define B_DEV_INVALID_PIPE				(B_DEVICE_ERROR_BASE + 19)
311 #define B_DEV_CRC_ERROR					(B_DEVICE_ERROR_BASE + 20)
312 #define B_DEV_STALLED					(B_DEVICE_ERROR_BASE + 21)
313 #define B_DEV_BAD_PID					(B_DEVICE_ERROR_BASE + 22)
314 #define B_DEV_UNEXPECTED_PID			(B_DEVICE_ERROR_BASE + 23)
315 #define B_DEV_DATA_OVERRUN				(B_DEVICE_ERROR_BASE + 24)
316 #define B_DEV_DATA_UNDERRUN				(B_DEVICE_ERROR_BASE + 25)
317 #define B_DEV_FIFO_OVERRUN				(B_DEVICE_ERROR_BASE + 26)
318 #define B_DEV_FIFO_UNDERRUN				(B_DEVICE_ERROR_BASE + 27)
319 #define B_DEV_PENDING					(B_DEVICE_ERROR_BASE + 28)
320 #define B_DEV_MULTIPLE_ERRORS			(B_DEVICE_ERROR_BASE + 29)
321 #define B_DEV_TOO_LATE					(B_DEVICE_ERROR_BASE + 30)
322 
323 /* Translation Kit Errors */
324 #define B_TRANSLATION_BASE_ERROR		(B_TRANSLATION_ERROR_BASE + 0)
325 #define B_NO_TRANSLATOR					(B_TRANSLATION_ERROR_BASE + 1)
326 #define B_ILLEGAL_DATA					(B_TRANSLATION_ERROR_BASE + 2)
327 
328 
329 #define B_TO_POSITIVE_ERROR(error)	_to_positive_error(error)
330 #define B_TO_NEGATIVE_ERROR(error)	_to_negative_error(error)
331 
332 
333 #ifdef __cplusplus
334 extern "C" {
335 #endif
336 
337 int _to_positive_error(int error);
338 int _to_negative_error(int error);
339 
340 #ifdef __cplusplus
341 }
342 #endif
343 
344 #endif	/* _ERRORS_H */
345