xref: /haiku/headers/private/fs_shell/fssh_errors.h (revision 1214ef1b2100f2b3299fc9d8d6142e46f70a4c3f)
1 /*
2  * Copyright 2007, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _FSSH_ERRORS_H
6 #define _FSSH_ERRORS_H
7 
8 
9 #include <limits.h>
10 
11 
12 /* Error baselines */
13 #define FSSH_B_GENERAL_ERROR_BASE		INT_MIN
14 #define FSSH_B_OS_ERROR_BASE			FSSH_B_GENERAL_ERROR_BASE + 0x1000
15 #define FSSH_B_APP_ERROR_BASE			FSSH_B_GENERAL_ERROR_BASE + 0x2000
16 #define FSSH_B_INTERFACE_ERROR_BASE		FSSH_B_GENERAL_ERROR_BASE + 0x3000
17 #define FSSH_B_MEDIA_ERROR_BASE			FSSH_B_GENERAL_ERROR_BASE + 0x4000 /* - 0x41ff */
18 #define FSSH_B_TRANSLATION_ERROR_BASE	FSSH_B_GENERAL_ERROR_BASE + 0x4800 /* - 0x48ff */
19 #define FSSH_B_MIDI_ERROR_BASE			FSSH_B_GENERAL_ERROR_BASE + 0x5000
20 #define FSSH_B_STORAGE_ERROR_BASE		FSSH_B_GENERAL_ERROR_BASE + 0x6000
21 #define FSSH_B_POSIX_ERROR_BASE			FSSH_B_GENERAL_ERROR_BASE + 0x7000
22 #define FSSH_B_MAIL_ERROR_BASE			FSSH_B_GENERAL_ERROR_BASE + 0x8000
23 #define FSSH_B_PRINT_ERROR_BASE			FSSH_B_GENERAL_ERROR_BASE + 0x9000
24 #define FSSH_B_DEVICE_ERROR_BASE		FSSH_B_GENERAL_ERROR_BASE + 0xa000
25 
26 /* Developer-defined errors start at (B_ERRORS_END+1) */
27 #define FSSH_B_ERRORS_END		(FSSH_B_GENERAL_ERROR_BASE + 0xffff)
28 
29 /* General Errors */
30 enum {
31 	FSSH_B_NO_MEMORY = FSSH_B_GENERAL_ERROR_BASE,
32 	FSSH_B_IO_ERROR,
33 	FSSH_B_PERMISSION_DENIED,
34 	FSSH_B_BAD_INDEX,
35 	FSSH_B_BAD_TYPE,
36 	FSSH_B_BAD_VALUE,
37 	FSSH_B_MISMATCHED_VALUES,
38 	FSSH_B_NAME_NOT_FOUND,
39 	FSSH_B_NAME_IN_USE,
40 	FSSH_B_TIMED_OUT,
41     FSSH_B_INTERRUPTED,
42 	FSSH_B_WOULD_BLOCK,
43     FSSH_B_CANCELED,
44 	FSSH_B_NO_INIT,
45 	FSSH_B_BUSY,
46 	FSSH_B_NOT_ALLOWED,
47 	FSSH_B_BAD_DATA,
48 	FSSH_B_DONT_DO_THAT,
49 
50 	FSSH_B_ERROR = -1,
51 	FSSH_B_OK = 0,
52 	FSSH_B_NO_ERROR = 0
53 };
54 
55 /* Kernel Kit Errors */
56 enum {
57 	FSSH_B_BAD_SEM_ID = FSSH_B_OS_ERROR_BASE,
58 	FSSH_B_NO_MORE_SEMS,
59 
60 	FSSH_B_BAD_THREAD_ID = FSSH_B_OS_ERROR_BASE + 0x100,
61 	FSSH_B_NO_MORE_THREADS,
62 	FSSH_B_BAD_THREAD_STATE,
63 	FSSH_B_BAD_TEAM_ID,
64 	FSSH_B_NO_MORE_TEAMS,
65 
66 	FSSH_B_BAD_PORT_ID = FSSH_B_OS_ERROR_BASE + 0x200,
67 	FSSH_B_NO_MORE_PORTS,
68 
69 	FSSH_B_BAD_IMAGE_ID = FSSH_B_OS_ERROR_BASE + 0x300,
70 	FSSH_B_BAD_ADDRESS,
71 	FSSH_B_NOT_AN_EXECUTABLE,
72 	FSSH_B_MISSING_LIBRARY,
73 	FSSH_B_MISSING_SYMBOL,
74 
75 	FSSH_B_DEBUGGER_ALREADY_INSTALLED = FSSH_B_OS_ERROR_BASE + 0x400
76 };
77 
78 /* Application Kit Errors */
79 enum {
80 	FSSH_B_BAD_REPLY = FSSH_B_APP_ERROR_BASE,
81 	FSSH_B_DUPLICATE_REPLY,
82 	FSSH_B_MESSAGE_TO_SELF,
83 	FSSH_B_BAD_HANDLER,
84 	FSSH_B_ALREADY_RUNNING,
85 	FSSH_B_LAUNCH_FAILED,
86 	FSSH_B_AMBIGUOUS_APP_LAUNCH,
87 	FSSH_B_UNKNOWN_MIME_TYPE,
88 	FSSH_B_BAD_SCRIPT_SYNTAX,
89 	FSSH_B_LAUNCH_FAILED_NO_RESOLVE_LINK,
90 	FSSH_B_LAUNCH_FAILED_EXECUTABLE,
91 	FSSH_B_LAUNCH_FAILED_APP_NOT_FOUND,
92 	FSSH_B_LAUNCH_FAILED_APP_IN_TRASH,
93 	FSSH_B_LAUNCH_FAILED_NO_PREFERRED_APP,
94 	FSSH_B_LAUNCH_FAILED_FILES_APP_NOT_FOUND,
95 	FSSH_B_BAD_MIME_SNIFFER_RULE,
96 	FSSH_B_NOT_A_MESSAGE,
97 	FSSH_B_SHUTDOWN_CANCELLED,
98 	FSSH_B_SHUTTING_DOWN
99 };
100 
101 /* Storage Kit/File System Errors */
102 enum {
103 	FSSH_B_FILE_ERROR = FSSH_B_STORAGE_ERROR_BASE,
104 	FSSH_B_FILE_NOT_FOUND,	/* deprecated: use FSSH_B_ENTRY_NOT_FOUND instead */
105 	FSSH_B_FILE_EXISTS,
106 	FSSH_B_ENTRY_NOT_FOUND,
107 	FSSH_B_NAME_TOO_LONG,
108 	FSSH_B_NOT_A_DIRECTORY,
109 	FSSH_B_DIRECTORY_NOT_EMPTY,
110 	FSSH_B_DEVICE_FULL,
111 	FSSH_B_READ_ONLY_DEVICE,
112 	FSSH_B_IS_A_DIRECTORY,
113 	FSSH_B_NO_MORE_FDS,
114 	FSSH_B_CROSS_DEVICE_LINK,
115 	FSSH_B_LINK_LIMIT,
116 	FSSH_B_BUSTED_PIPE,
117 	FSSH_B_UNSUPPORTED,
118 	FSSH_B_PARTITION_TOO_SMALL
119 };
120 
121 /* POSIX Errors */
122 #define FSSH_E2BIG				(FSSH_B_POSIX_ERROR_BASE + 1)
123 #define FSSH_ECHILD				(FSSH_B_POSIX_ERROR_BASE + 2)
124 #define FSSH_EDEADLK			(FSSH_B_POSIX_ERROR_BASE + 3)
125 #define FSSH_EFBIG				(FSSH_B_POSIX_ERROR_BASE + 4)
126 #define FSSH_EMLINK				(FSSH_B_POSIX_ERROR_BASE + 5)
127 #define FSSH_ENFILE				(FSSH_B_POSIX_ERROR_BASE + 6)
128 #define FSSH_ENODEV				(FSSH_B_POSIX_ERROR_BASE + 7)
129 #define FSSH_ENOLCK				(FSSH_B_POSIX_ERROR_BASE + 8)
130 #define FSSH_ENOSYS				(FSSH_B_POSIX_ERROR_BASE + 9)
131 #define FSSH_ENOTTY				(FSSH_B_POSIX_ERROR_BASE + 10)
132 #define FSSH_ENXIO				(FSSH_B_POSIX_ERROR_BASE + 11)
133 #define FSSH_ESPIPE				(FSSH_B_POSIX_ERROR_BASE + 12)
134 #define FSSH_ESRCH				(FSSH_B_POSIX_ERROR_BASE + 13)
135 #define FSSH_EFPOS				(FSSH_B_POSIX_ERROR_BASE + 14)
136 #define FSSH_ESIGPARM			(FSSH_B_POSIX_ERROR_BASE + 15)
137 #define FSSH_EDOM				(FSSH_B_POSIX_ERROR_BASE + 16)
138 #define FSSH_ERANGE				(FSSH_B_POSIX_ERROR_BASE + 17)
139 #define FSSH_EPROTOTYPE			(FSSH_B_POSIX_ERROR_BASE + 18)
140 #define FSSH_EPROTONOSUPPORT	(FSSH_B_POSIX_ERROR_BASE + 19)
141 #define FSSH_EPFNOSUPPORT		(FSSH_B_POSIX_ERROR_BASE + 20)
142 #define FSSH_EAFNOSUPPORT		(FSSH_B_POSIX_ERROR_BASE + 21)
143 #define FSSH_EADDRINUSE			(FSSH_B_POSIX_ERROR_BASE + 22)
144 #define FSSH_EADDRNOTAVAIL		(FSSH_B_POSIX_ERROR_BASE + 23)
145 #define FSSH_ENETDOWN			(FSSH_B_POSIX_ERROR_BASE + 24)
146 #define FSSH_ENETUNREACH		(FSSH_B_POSIX_ERROR_BASE + 25)
147 #define FSSH_ENETRESET			(FSSH_B_POSIX_ERROR_BASE + 26)
148 #define FSSH_ECONNABORTED		(FSSH_B_POSIX_ERROR_BASE + 27)
149 #define FSSH_ECONNRESET			(FSSH_B_POSIX_ERROR_BASE + 28)
150 #define FSSH_EISCONN			(FSSH_B_POSIX_ERROR_BASE + 29)
151 #define FSSH_ENOTCONN			(FSSH_B_POSIX_ERROR_BASE + 30)
152 #define FSSH_ESHUTDOWN			(FSSH_B_POSIX_ERROR_BASE + 31)
153 #define FSSH_ECONNREFUSED		(FSSH_B_POSIX_ERROR_BASE + 32)
154 #define FSSH_EHOSTUNREACH		(FSSH_B_POSIX_ERROR_BASE + 33)
155 #define FSSH_ENOPROTOOPT		(FSSH_B_POSIX_ERROR_BASE + 34)
156 #define FSSH_ENOBUFS			(FSSH_B_POSIX_ERROR_BASE + 35)
157 #define FSSH_EINPROGRESS		(FSSH_B_POSIX_ERROR_BASE + 36)
158 #define FSSH_EALREADY			(FSSH_B_POSIX_ERROR_BASE + 37)
159 #define FSSH_EILSEQ     	    (FSSH_B_POSIX_ERROR_BASE + 38)
160 #define FSSH_ENOMSG         	(FSSH_B_POSIX_ERROR_BASE + 39)
161 #define FSSH_ESTALE				(FSSH_B_POSIX_ERROR_BASE + 40)
162 #define FSSH_EOVERFLOW			(FSSH_B_POSIX_ERROR_BASE + 41)
163 #define FSSH_EMSGSIZE			(FSSH_B_POSIX_ERROR_BASE + 42)
164 #define FSSH_EOPNOTSUPP			(FSSH_B_POSIX_ERROR_BASE + 43)
165 #define FSSH_ENOTSOCK			(FSSH_B_POSIX_ERROR_BASE + 44)
166 #define FSSH_EHOSTDOWN			(FSSH_B_POSIX_ERROR_BASE + 45)
167 #define	FSSH_EBADMSG			(FSSH_B_POSIX_ERROR_BASE + 46)
168 #define FSSH_ECANCELED			(FSSH_B_POSIX_ERROR_BASE + 47)
169 #define FSSH_EDESTADDRREQ		(FSSH_B_POSIX_ERROR_BASE + 48)
170 #define FSSH_EDQUOT				(FSSH_B_POSIX_ERROR_BASE + 49)
171 #define FSSH_EIDRM				(FSSH_B_POSIX_ERROR_BASE + 50)
172 #define FSSH_EMULTIHOP			(FSSH_B_POSIX_ERROR_BASE + 51)
173 #define FSSH_ENODATA			(FSSH_B_POSIX_ERROR_BASE + 52)
174 #define FSSH_ENOLINK			(FSSH_B_POSIX_ERROR_BASE + 53)
175 #define FSSH_ENOSR				(FSSH_B_POSIX_ERROR_BASE + 54)
176 #define FSSH_ENOSTR				(FSSH_B_POSIX_ERROR_BASE + 55)
177 #define FSSH_ENOTSUP			(FSSH_B_POSIX_ERROR_BASE + 56)
178 #define FSSH_EPROTO				(FSSH_B_POSIX_ERROR_BASE + 57)
179 #define FSSH_ETIME				(FSSH_B_POSIX_ERROR_BASE + 58)
180 #define FSSH_ETXTBSY			(FSSH_B_POSIX_ERROR_BASE + 59)
181 
182 /* POSIX errors that can be mapped to BeOS error codes */
183 #define FSSH_ENOMEM				FSSH_B_NO_MEMORY
184 #define FSSH_EACCES				FSSH_B_PERMISSION_DENIED
185 #define FSSH_EINTR				FSSH_B_INTERRUPTED
186 #define FSSH_EIO				FSSH_B_IO_ERROR
187 #define FSSH_EBUSY				FSSH_B_BUSY
188 #define FSSH_EFAULT				FSSH_B_BAD_ADDRESS
189 #define FSSH_ETIMEDOUT			FSSH_B_TIMED_OUT
190 #define FSSH_EAGAIN 			FSSH_B_WOULD_BLOCK	/* SysV compatibility */
191 #define FSSH_EWOULDBLOCK	 	FSSH_B_WOULD_BLOCK	/* BSD compatibility */
192 #define FSSH_EBADF				FSSH_B_FILE_ERROR
193 #define FSSH_EEXIST				FSSH_B_FILE_EXISTS
194 #define FSSH_EINVAL				FSSH_B_BAD_VALUE
195 #define FSSH_ENAMETOOLONG		FSSH_B_NAME_TOO_LONG
196 #define FSSH_ENOENT				FSSH_B_ENTRY_NOT_FOUND
197 #define FSSH_EPERM				FSSH_B_NOT_ALLOWED
198 #define FSSH_ENOTDIR			FSSH_B_NOT_A_DIRECTORY
199 #define FSSH_EISDIR				FSSH_B_IS_A_DIRECTORY
200 #define FSSH_ENOTEMPTY			FSSH_B_DIRECTORY_NOT_EMPTY
201 #define FSSH_ENOSPC				FSSH_B_DEVICE_FULL
202 #define FSSH_EROFS				FSSH_B_READ_ONLY_DEVICE
203 #define FSSH_EMFILE				FSSH_B_NO_MORE_FDS
204 #define FSSH_EXDEV				FSSH_B_CROSS_DEVICE_LINK
205 #define FSSH_ELOOP				FSSH_B_LINK_LIMIT
206 #define FSSH_ENOEXEC			FSSH_B_NOT_AN_EXECUTABLE
207 #define FSSH_EPIPE				FSSH_B_BUSTED_PIPE
208 
209 /* new error codes that can be mapped to POSIX errors */
210 #define	FSSH_B_BUFFER_OVERFLOW	FSSH_EOVERFLOW
211 #define FSSH_B_TOO_MANY_ARGS	FSSH_E2BIG
212 #define	FSSH_B_FILE_TOO_LARGE	FSSH_EFBIG
213 #define FSSH_B_RESULT_NOT_REPRESENTABLE FSSH_ERANGE
214 #define	FSSH_B_DEVICE_NOT_FOUND	FSSH_ENODEV
215 #define FSSH_B_NOT_SUPPORTED	FSSH_EOPNOTSUPP
216 
217 /* Media Kit Errors */
218 enum {
219 	FSSH_B_STREAM_NOT_FOUND = FSSH_B_MEDIA_ERROR_BASE,
220 	FSSH_B_SERVER_NOT_FOUND,
221 	FSSH_B_RESOURCE_NOT_FOUND,
222 	FSSH_B_RESOURCE_UNAVAILABLE,
223 	FSSH_B_BAD_SUBSCRIBER,
224 	FSSH_B_SUBSCRIBER_NOT_ENTERED,
225 	FSSH_B_BUFFER_NOT_AVAILABLE,
226 	FSSH_B_LAST_BUFFER_ERROR
227 };
228 
229 /* Mail Kit Errors */
230 enum {
231 	FSSH_B_MAIL_NO_DAEMON = FSSH_B_MAIL_ERROR_BASE,
232 	FSSH_B_MAIL_UNKNOWN_USER,
233 	FSSH_B_MAIL_WRONG_PASSWORD,
234 	FSSH_B_MAIL_UNKNOWN_HOST,
235 	FSSH_B_MAIL_ACCESS_ERROR,
236 	FSSH_B_MAIL_UNKNOWN_FIELD,
237 	FSSH_B_MAIL_NO_RECIPIENT,
238 	FSSH_B_MAIL_INVALID_MAIL
239 };
240 
241 /* Printing Errors */
242 enum {
243 	FSSH_B_NO_PRINT_SERVER = FSSH_B_PRINT_ERROR_BASE
244 };
245 
246 /* Device Kit Errors */
247 enum {
248 	FSSH_B_DEV_INVALID_IOCTL = FSSH_B_DEVICE_ERROR_BASE,
249 	FSSH_B_DEV_NO_MEMORY,
250 	FSSH_B_DEV_BAD_DRIVE_NUM,
251 	FSSH_B_DEV_NO_MEDIA,
252 	FSSH_B_DEV_UNREADABLE,
253 	FSSH_B_DEV_FORMAT_ERROR,
254 	FSSH_B_DEV_TIMEOUT,
255 	FSSH_B_DEV_RECALIBRATE_ERROR,
256 	FSSH_B_DEV_SEEK_ERROR,
257 	FSSH_B_DEV_ID_ERROR,
258 	FSSH_B_DEV_READ_ERROR,
259 	FSSH_B_DEV_WRITE_ERROR,
260 	FSSH_B_DEV_NOT_READY,
261 	FSSH_B_DEV_MEDIA_CHANGED,
262 	FSSH_B_DEV_MEDIA_CHANGE_REQUESTED,
263 	FSSH_B_DEV_RESOURCE_CONFLICT,
264 	FSSH_B_DEV_CONFIGURATION_ERROR,
265 	FSSH_B_DEV_DISABLED_BY_USER,
266 	FSSH_B_DEV_DOOR_OPEN,
267 
268 	FSSH_B_DEV_INVALID_PIPE,
269 	FSSH_B_DEV_CRC_ERROR,
270 	FSSH_B_DEV_STALLED,
271 	FSSH_B_DEV_BAD_PID,
272 	FSSH_B_DEV_UNEXPECTED_PID,
273 	FSSH_B_DEV_DATA_OVERRUN,
274 	FSSH_B_DEV_DATA_UNDERRUN,
275 	FSSH_B_DEV_FIFO_OVERRUN,
276 	FSSH_B_DEV_FIFO_UNDERRUN,
277 	FSSH_B_DEV_PENDING,
278 	FSSH_B_DEV_MULTIPLE_ERRORS,
279 	FSSH_B_DEV_TOO_LATE
280 };
281 
282 
283 #endif	/* _FSSH_ERRORS_H */
284