xref: /haiku/headers/os/support/Errors.h (revision e5430a086c769ea76c3944046b1f07cf049c1ae0)
1 /******************************************************************************
2 /
3 /	File:			Errors.h
4 /
5 /	Description:	Error code constants.
6 /
7 /	Copyright 1993-98, Be Incorporated
8 /
9 ******************************************************************************/
10 
11 
12 #ifndef _ERRORS_H
13 #define _ERRORS_H
14 
15 #include <limits.h>
16 
17 /*-------------------------------------------------------------*/
18 /*----- Error baselines ---------------------------------------*/
19 
20 #define B_GENERAL_ERROR_BASE		LONG_MIN
21 #define B_OS_ERROR_BASE				B_GENERAL_ERROR_BASE + 0x1000
22 #define B_APP_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x2000
23 #define B_INTERFACE_ERROR_BASE		B_GENERAL_ERROR_BASE + 0x3000
24 #define B_MEDIA_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x4000 /* - 0x41ff */
25 #define B_TRANSLATION_ERROR_BASE	B_GENERAL_ERROR_BASE + 0x4800 /* - 0x48ff */
26 #define B_MIDI_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x5000
27 #define B_STORAGE_ERROR_BASE		B_GENERAL_ERROR_BASE + 0x6000
28 #define B_POSIX_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x7000
29 #define B_MAIL_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x8000
30 #define B_PRINT_ERROR_BASE			B_GENERAL_ERROR_BASE + 0x9000
31 #define B_DEVICE_ERROR_BASE			B_GENERAL_ERROR_BASE + 0xa000
32 
33 /*--- Developer-defined errors start at (B_ERRORS_END+1)----*/
34 
35 #define B_ERRORS_END		(B_GENERAL_ERROR_BASE + 0xffff)
36 
37 
38 /*-------------------------------------------------------------*/
39 /*----- General Errors ----------------------------------------*/
40 enum {
41 	B_NO_MEMORY = B_GENERAL_ERROR_BASE,
42 	B_IO_ERROR,
43 	B_PERMISSION_DENIED,
44 	B_BAD_INDEX,
45 	B_BAD_TYPE,
46 	B_BAD_VALUE,
47 	B_MISMATCHED_VALUES,
48 	B_NAME_NOT_FOUND,
49 	B_NAME_IN_USE,
50 	B_TIMED_OUT,
51     B_INTERRUPTED,
52 	B_WOULD_BLOCK,
53     B_CANCELED,
54 	B_NO_INIT,
55 	B_BUSY,
56 	B_NOT_ALLOWED,
57 	B_BAD_DATA,
58 
59 	B_ERROR = -1,
60 	B_OK = 0,
61 	B_NO_ERROR = 0
62 };
63 
64 /*-------------------------------------------------------------*/
65 /*----- Kernel Kit Errors -------------------------------------*/
66 enum {
67 	B_BAD_SEM_ID = B_OS_ERROR_BASE,
68 	B_NO_MORE_SEMS,
69 
70 	B_BAD_THREAD_ID = B_OS_ERROR_BASE + 0x100,
71 	B_NO_MORE_THREADS,
72 	B_BAD_THREAD_STATE,
73 	B_BAD_TEAM_ID,
74 	B_NO_MORE_TEAMS,
75 
76 	B_BAD_PORT_ID = B_OS_ERROR_BASE + 0x200,
77 	B_NO_MORE_PORTS,
78 
79 	B_BAD_IMAGE_ID = B_OS_ERROR_BASE + 0x300,
80 	B_BAD_ADDRESS,
81 	B_NOT_AN_EXECUTABLE,
82 	B_MISSING_LIBRARY,
83 	B_MISSING_SYMBOL,
84 
85 	B_DEBUGGER_ALREADY_INSTALLED = B_OS_ERROR_BASE + 0x400
86 };
87 
88 
89 /*-------------------------------------------------------------*/
90 /*----- Application Kit Errors --------------------------------*/
91 enum
92 {
93 	B_BAD_REPLY = B_APP_ERROR_BASE,
94 	B_DUPLICATE_REPLY,
95 	B_MESSAGE_TO_SELF,
96 	B_BAD_HANDLER,
97 	B_ALREADY_RUNNING,
98 	B_LAUNCH_FAILED,
99 	B_AMBIGUOUS_APP_LAUNCH,
100 	B_UNKNOWN_MIME_TYPE,
101 	B_BAD_SCRIPT_SYNTAX,
102 	B_LAUNCH_FAILED_NO_RESOLVE_LINK,
103 	B_LAUNCH_FAILED_EXECUTABLE,
104 	B_LAUNCH_FAILED_APP_NOT_FOUND,
105 	B_LAUNCH_FAILED_APP_IN_TRASH,
106 	B_LAUNCH_FAILED_NO_PREFERRED_APP,
107 	B_LAUNCH_FAILED_FILES_APP_NOT_FOUND,
108 	B_BAD_MIME_SNIFFER_RULE,
109 	B_NOT_A_MESSAGE
110 };
111 
112 
113 /*-------------------------------------------------------------*/
114 /*----- Storage Kit/File System Errors ------------------------*/
115 enum {
116 	B_FILE_ERROR = B_STORAGE_ERROR_BASE,
117 	B_FILE_NOT_FOUND,	/* discouraged; use B_ENTRY_NOT_FOUND in new code*/
118 	B_FILE_EXISTS,
119 	B_ENTRY_NOT_FOUND,
120 	B_NAME_TOO_LONG,
121 	B_NOT_A_DIRECTORY,
122 	B_DIRECTORY_NOT_EMPTY,
123 	B_DEVICE_FULL,
124 	B_READ_ONLY_DEVICE,
125 	B_IS_A_DIRECTORY,
126 	B_NO_MORE_FDS,
127 	B_CROSS_DEVICE_LINK,
128 	B_LINK_LIMIT,
129 	B_BUSTED_PIPE,
130 	B_UNSUPPORTED,
131 	B_PARTITION_TOO_SMALL
132 };
133 
134 
135 /*-------------------------------------------------------------*/
136 /*----- POSIX Errors ------------------------------------------*/
137 #define E2BIG			(B_POSIX_ERROR_BASE + 1)
138 #define ECHILD			(B_POSIX_ERROR_BASE + 2)
139 #define EDEADLK			(B_POSIX_ERROR_BASE + 3)
140 #define EFBIG			(B_POSIX_ERROR_BASE + 4)
141 #define EMLINK			(B_POSIX_ERROR_BASE + 5)
142 #define ENFILE			(B_POSIX_ERROR_BASE + 6)
143 #define ENODEV			(B_POSIX_ERROR_BASE + 7)
144 #define ENOLCK			(B_POSIX_ERROR_BASE + 8)
145 #define ENOSYS			(B_POSIX_ERROR_BASE + 9)
146 #define ENOTTY			(B_POSIX_ERROR_BASE + 10)
147 #define ENXIO			(B_POSIX_ERROR_BASE + 11)
148 #define ESPIPE			(B_POSIX_ERROR_BASE + 12)
149 #define ESRCH			(B_POSIX_ERROR_BASE + 13)
150 #define EFPOS			(B_POSIX_ERROR_BASE + 14)
151 #define ESIGPARM		(B_POSIX_ERROR_BASE + 15)
152 #define EDOM			(B_POSIX_ERROR_BASE + 16)
153 #define ERANGE			(B_POSIX_ERROR_BASE + 17)
154 #define EPROTOTYPE		(B_POSIX_ERROR_BASE + 18)
155 #define EPROTONOSUPPORT	(B_POSIX_ERROR_BASE + 19)
156 #define EPFNOSUPPORT	(B_POSIX_ERROR_BASE + 20)
157 #define EAFNOSUPPORT	(B_POSIX_ERROR_BASE + 21)
158 #define EADDRINUSE		(B_POSIX_ERROR_BASE + 22)
159 #define EADDRNOTAVAIL	(B_POSIX_ERROR_BASE + 23)
160 #define ENETDOWN		(B_POSIX_ERROR_BASE + 24)
161 #define ENETUNREACH		(B_POSIX_ERROR_BASE + 25)
162 #define ENETRESET		(B_POSIX_ERROR_BASE + 26)
163 #define ECONNABORTED	(B_POSIX_ERROR_BASE + 27)
164 #define ECONNRESET		(B_POSIX_ERROR_BASE + 28)
165 #define EISCONN			(B_POSIX_ERROR_BASE + 29)
166 #define ENOTCONN		(B_POSIX_ERROR_BASE + 30)
167 #define ESHUTDOWN		(B_POSIX_ERROR_BASE + 31)
168 #define ECONNREFUSED	(B_POSIX_ERROR_BASE + 32)
169 #define EHOSTUNREACH	(B_POSIX_ERROR_BASE + 33)
170 #define ENOPROTOOPT		(B_POSIX_ERROR_BASE + 34)
171 #define ENOBUFS			(B_POSIX_ERROR_BASE + 35)
172 #define EINPROGRESS		(B_POSIX_ERROR_BASE + 36)
173 #define EALREADY		(B_POSIX_ERROR_BASE + 37)
174 #define EILSEQ          (B_POSIX_ERROR_BASE + 38)
175 #define ENOMSG          (B_POSIX_ERROR_BASE + 39)
176 #define ESTALE          (B_POSIX_ERROR_BASE + 40)
177 #define EOVERFLOW       (B_POSIX_ERROR_BASE + 41)
178 #define EMSGSIZE        (B_POSIX_ERROR_BASE + 42)
179 #define EOPNOTSUPP      (B_POSIX_ERROR_BASE + 43)
180 #define ENOTSOCK		(B_POSIX_ERROR_BASE + 44)
181 #define EHOSTDOWN		(B_POSIX_ERROR_BASE + 45)
182 
183 /*---- POSIX errors that can be mapped to BeOS error codes ----*/
184 #define ENOMEM			B_NO_MEMORY
185 #define EACCES			B_PERMISSION_DENIED
186 #define EINTR			B_INTERRUPTED
187 #define EIO				B_IO_ERROR
188 #define EBUSY			B_BUSY
189 #define EFAULT			B_BAD_ADDRESS
190 #define ETIMEDOUT		B_TIMED_OUT
191 #define EAGAIN 			B_WOULD_BLOCK	/* SysV compatibility */
192 #define EWOULDBLOCK 	B_WOULD_BLOCK	/* BSD compatibility */
193 #define EBADF			B_FILE_ERROR
194 #define EEXIST			B_FILE_EXISTS
195 #define EINVAL			B_BAD_VALUE
196 #define ENAMETOOLONG	B_NAME_TOO_LONG
197 #define ENOENT			B_ENTRY_NOT_FOUND
198 #define EPERM			B_NOT_ALLOWED
199 #define ENOTDIR			B_NOT_A_DIRECTORY
200 #define EISDIR			B_IS_A_DIRECTORY
201 #define ENOTEMPTY		B_DIRECTORY_NOT_EMPTY
202 #define ENOSPC			B_DEVICE_FULL
203 #define EROFS			B_READ_ONLY_DEVICE
204 #define EMFILE			B_NO_MORE_FDS
205 #define EXDEV			B_CROSS_DEVICE_LINK
206 #define ELOOP			B_LINK_LIMIT
207 #define ENOEXEC			B_NOT_AN_EXECUTABLE
208 #define EPIPE			B_BUSTED_PIPE
209 
210 /*---- new error codes that can be mapped to POSIX errors ----*/
211 #define	B_BUFFER_OVERFLOW	EOVERFLOW
212 #define B_TOO_MANY_ARGS		E2BIG
213 #define	B_FILE_TOO_LARGE	EFBIG
214 #define B_RESULT_NOT_REPRESENTABLE	ERANGE
215 #define	B_DEVICE_NOT_FOUND	ENODEV
216 
217 /*-------------------------------------------------------------*/
218 /*----- Media Kit Errors --------------------------------------*/
219 enum {
220   B_STREAM_NOT_FOUND = B_MEDIA_ERROR_BASE,
221   B_SERVER_NOT_FOUND,
222   B_RESOURCE_NOT_FOUND,
223   B_RESOURCE_UNAVAILABLE,
224   B_BAD_SUBSCRIBER,
225   B_SUBSCRIBER_NOT_ENTERED,
226   B_BUFFER_NOT_AVAILABLE,
227   B_LAST_BUFFER_ERROR
228 };
229 
230 /*-------------------------------------------------------------*/
231 /*----- Mail Kit Errors ---------------------------------------*/
232 enum
233 {
234 	B_MAIL_NO_DAEMON = B_MAIL_ERROR_BASE,
235 	B_MAIL_UNKNOWN_USER,
236 	B_MAIL_WRONG_PASSWORD,
237 	B_MAIL_UNKNOWN_HOST,
238 	B_MAIL_ACCESS_ERROR,
239 	B_MAIL_UNKNOWN_FIELD,
240 	B_MAIL_NO_RECIPIENT,
241 	B_MAIL_INVALID_MAIL
242 };
243 
244 /*-------------------------------------------------------------*/
245 /*----- Printing Errors --------------------------------------*/
246 enum
247 {
248 	B_NO_PRINT_SERVER = B_PRINT_ERROR_BASE
249 };
250 
251 /*-------------------------------------------------------------*/
252 /*----- Device Kit Errors -------------------------------------*/
253 enum
254 {
255 	B_DEV_INVALID_IOCTL = B_DEVICE_ERROR_BASE,
256 	B_DEV_NO_MEMORY,
257 	B_DEV_BAD_DRIVE_NUM,
258 	B_DEV_NO_MEDIA,
259 	B_DEV_UNREADABLE,
260 	B_DEV_FORMAT_ERROR,
261 	B_DEV_TIMEOUT,
262 	B_DEV_RECALIBRATE_ERROR,
263 	B_DEV_SEEK_ERROR,
264 	B_DEV_ID_ERROR,
265 	B_DEV_READ_ERROR,
266 	B_DEV_WRITE_ERROR,
267 	B_DEV_NOT_READY,
268 	B_DEV_MEDIA_CHANGED,
269 	B_DEV_MEDIA_CHANGE_REQUESTED,
270 	B_DEV_RESOURCE_CONFLICT,
271 	B_DEV_CONFIGURATION_ERROR,
272 	B_DEV_DISABLED_BY_USER,
273 	B_DEV_DOOR_OPEN
274 };
275 
276 /*-------------------------------------------------------------*/
277 /*-------------------------------------------------------------*/
278 
279 #endif /* _DERRORS_H */
280