xref: /NextBSD/sys/sys/mach/kern_return.h (revision 33da5adc555b3bc29986eeadca03829e4ad06b1e)
1 /*
2  * Copyright 1991-1998 by Open Software Foundation, Inc.
3  *              All Rights Reserved
4  *
5  * Permission to use, copy, modify, and distribute this software and
6  * its documentation for any purpose and without fee is hereby granted,
7  * provided that the above copyright notice appears in all copies and
8  * that both the copyright notice and this permission notice appear in
9  * supporting documentation.
10  *
11  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
12  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13  * FOR A PARTICULAR PURPOSE.
14  *
15  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
16  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
18  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
19  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  */
21 /*
22  * MkLinux
23  */
24 /* CMU_HIST */
25 /*
26  * Revision 2.5.2.1  92/09/15  17:23:24  jeffreyh
27  * 	Added KERN_RETURN_MAX, an upper bound on return values
28  * 	[92/07/28            sjs]
29  *
30  * Revision 2.5  91/05/14  16:54:08  mrt
31  * 	Correcting copyright
32  *
33  * Revision 2.4  91/02/05  17:33:06  mrt
34  * 	Changed to new Mach copyright
35  * 	[91/02/01  17:17:20  mrt]
36  *
37  * Revision 2.3  90/08/07  18:00:17  rpd
38  * 	Added KERN_MEMORY_PRESENT (not used yet).
39  * 	[90/08/06            rpd]
40  *
41  * Revision 2.2  90/06/02  14:58:03  rpd
42  * 	Added codes for new IPC.
43  * 	[90/03/26  22:30:08  rpd]
44  *
45  * Revision 2.1  89/08/03  16:02:22  rwd
46  * Created.
47  *
48  * Revision 2.6  89/02/25  18:13:36  gm0w
49  * 	Changes for cleanup.
50  *
51  * Revision 2.5  89/02/07  00:52:16  mwyoung
52  * Relocated from sys/kern_return.h
53  *
54  * Revision 2.4  88/08/24  02:31:47  mwyoung
55  * 	Adjusted include file references.
56  * 	[88/08/17  02:15:07  mwyoung]
57  *
58  * Revision 2.3  88/07/20  16:48:31  rpd
59  * Added KERN_NAME_EXISTS.
60  * Added KERN_ALREADY_IN_SET, KERN_NOT_IN_SET.
61  * Made comments legible.
62  *
63  *  3-Feb-88  Michael Young (mwyoung) at Carnegie-Mellon University
64  *	Added memory management error conditions.
65  *	Documented.
66  *
67  * 23-Feb-87  Avadis Tevanian (avie) at Carnegie-Mellon University
68  *	Deleted kern_return_t casts on error codes so that they may be
69  *	used in assembly code.
70  *
71  * 17-Sep-85  Avadis Tevanian (avie) at Carnegie-Mellon University
72  *	Created.
73  */
74 /* CMU_ENDHIST */
75 /*
76  * Mach Operating System
77  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
78  * All Rights Reserved.
79  *
80  * Permission to use, copy, modify and distribute this software and its
81  * documentation is hereby granted, provided that both the copyright
82  * notice and this permission notice appear in all copies of the
83  * software, derivative works or modified versions, and any portions
84  * thereof, and that both notices appear in supporting documentation.
85  *
86  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
87  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
88  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
89  *
90  * Carnegie Mellon requests users of this software to return to
91  *
92  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
93  *  School of Computer Science
94  *  Carnegie Mellon University
95  *  Pittsburgh PA 15213-3890
96  *
97  * any improvements or extensions that they make and grant Carnegie Mellon
98  * the rights to redistribute these changes.
99  */
100 /*
101  */
102 /*
103  *	File:	h/kern_return.h
104  *	Author:	Avadis Tevanian, Jr.
105  *	Date:	1985
106  *
107  *	Kernel return codes.
108  *
109  */
110 
111 #ifndef	_MACH_KERN_RETURN_H_
112 #define _MACH_KERN_RETURN_H_
113 
114 typedef int kern_return_t;
115 
116 /*
117  * N.B.:	If you add errors, please update
118  *			mach_services/lib/libmach/err_kern.sub
119  */
120 
121 #define KERN_SUCCESS			0
122 
123 #define KERN_INVALID_ADDRESS		1
124 		/* Specified address is not currently valid.
125 		 */
126 
127 #define KERN_PROTECTION_FAILURE		2
128 		/* Specified memory is valid, but does not permit the
129 		 * required forms of access.
130 		 */
131 
132 #define KERN_NO_SPACE			3
133 		/* The address range specified is already in use, or
134 		 * no address range of the size specified could be
135 		 * found.
136 		 */
137 
138 #define KERN_INVALID_ARGUMENT		4
139 		/* The function requested was not applicable to this
140 		 * type of argument, or an argument
141 		 */
142 
143 #define KERN_FAILURE			5
144 		/* The function could not be performed.  A catch-all.
145 		 */
146 
147 #define KERN_RESOURCE_SHORTAGE		6
148 		/* A system resource could not be allocated to fulfill
149 		 * this request.  This failure may not be permanent.
150 		 */
151 
152 #define KERN_NOT_RECEIVER		7
153 		/* The task in question does not hold receive rights
154 		 * for the port argument.
155 		 */
156 
157 #define KERN_NO_ACCESS			8
158 		/* Bogus access restriction.
159 		 */
160 
161 #define KERN_MEMORY_FAILURE		9
162 		/* During a page fault, the target address refers to a
163 		 * memory object that has been destroyed.  This
164 		 * failure is permanent.
165 		 */
166 
167 #define KERN_MEMORY_ERROR		10
168 		/* During a page fault, the memory object indicated
169 		 * that the data could not be returned.  This failure
170 		 * may be temporary; future attempts to access this
171 		 * same data may succeed, as defined by the memory
172 		 * object.
173 		 */
174 
175 /*	KERN_ALREADY_IN_SET		11	obsolete */
176 
177 #define KERN_NOT_IN_SET			12
178 		/* The receive right is not a member of a port set.
179 		 */
180 
181 #define KERN_NAME_EXISTS		13
182 		/* The name already denotes a right in the task.
183 		 */
184 
185 #define KERN_ABORTED			14
186 		/* The operation was aborted.  Ipc code will
187 		 * catch this and reflect it as a message error.
188 		 */
189 
190 #define KERN_INVALID_NAME		15
191 		/* The name doesn't denote a right in the task.
192 		 */
193 
194 #define	KERN_INVALID_TASK		16
195 		/* Target task isn't an active task.
196 		 */
197 
198 #define KERN_INVALID_RIGHT		17
199 		/* The name denotes a right, but not an appropriate right.
200 		 */
201 
202 #define KERN_INVALID_VALUE		18
203 		/* A blatant range error.
204 		 */
205 
206 #define	KERN_UREFS_OVERFLOW		19
207 		/* Operation would overflow limit on user-references.
208 		 */
209 
210 #define	KERN_INVALID_CAPABILITY		20
211 		/* The supplied (port) capability is improper.
212 		 */
213 
214 #define KERN_RIGHT_EXISTS		21
215 		/* The task already has send or receive rights
216 		 * for the port under another name.
217 		 */
218 
219 #define	KERN_INVALID_HOST		22
220 		/* Target host isn't actually a host.
221 		 */
222 
223 #define KERN_MEMORY_PRESENT		23
224 		/* An attempt was made to supply "precious" data
225 		 * for memory that is already present in a
226 		 * memory object.
227 		 */
228 
229 #define KERN_MEMORY_DATA_MOVED		24
230 		/* A page was requested of a memory manager via
231 		 * memory_object_data_request for an object using
232 		 * a MEMORY_OBJECT_COPY_CALL strategy, with the
233 		 * VM_PROT_WANTS_COPY flag being used to specify
234 		 * that the page desired is for a copy of the
235 		 * object, and the memory manager has detected
236 		 * the page was pushed into a copy of the object
237 		 * while the kernel was walking the shadow chain
238 		 * from the copy to the object. This error code
239 		 * is delivered via memory_object_data_error
240 		 * and is handled by the kernel (it forces the
241 		 * kernel to restart the fault). It will not be
242 		 * seen by users.
243 		 */
244 
245 #define KERN_MEMORY_RESTART_COPY	25
246 		/* A strategic copy was attempted of an object
247 		 * upon which a quicker copy is now possible.
248 		 * The caller should retry the copy using
249 		 * vm_object_copy_quickly. This error code
250 		 * is seen only by the kernel.
251 		 */
252 
253 #define KERN_INVALID_PROCESSOR_SET	26
254 		/* An argument applied to assert processor set privilege
255 		 * was not a processor set control port.
256 		 */
257 
258 #define KERN_POLICY_LIMIT		27
259 		/* The specified scheduling attributes exceed the thread's
260 		 * limits.
261 		 */
262 
263 #define KERN_INVALID_POLICY		28
264 		/* The specified scheduling policy is not currently
265 		 * enabled for the processor set.
266 		 */
267 
268 #define KERN_INVALID_OBJECT		29
269 		/* The external memory manager failed to initialize the
270 		 * memory object.
271 		 */
272 
273 #define KERN_ALREADY_WAITING		30
274 		/* A thread is attempting to wait for an event for which
275 		 * there is already a waiting thread.
276 		 */
277 
278 #define KERN_DEFAULT_SET		31
279 		/* An attempt was made to destroy the default processor
280 		 * set.
281 		 */
282 
283 #define KERN_EXCEPTION_PROTECTED	32
284 		/* An attempt was made to fetch an exception port that is
285 		 * protected, or to abort a thread while processing a
286 		 * protected exception.
287 		 */
288 
289 #define KERN_INVALID_LEDGER		33
290 		/* A ledger was required but not supplied.
291 		 */
292 
293 #define KERN_INVALID_MEMORY_CONTROL	34
294 		/* The port was not a memory cache control port.
295 		 */
296 
297 #define KERN_INVALID_SECURITY		35
298 		/* An argument supplied to assert security privilege
299 		 * was not a host security port.
300 		 */
301 
302 #define KERN_NOT_DEPRESSED		36
303 		/* thread_depress_abort was called on a thread which
304 		 * was not currently depressed.
305 		 */
306 
307 #define KERN_TERMINATED			37
308 		/* Object has been terminated and is no longer available
309 		 */
310 
311 #define KERN_LOCK_SET_DESTROYED		38
312 		/* Lock set has been destroyed and is no longer available.
313 		 */
314 
315 #define KERN_LOCK_UNSTABLE		39
316 		/* The thread holding the lock terminated before releasing
317 		 * the lock
318 		 */
319 
320 #define KERN_LOCK_OWNED			40
321 		/* The lock is already owned by another thread
322 		 */
323 
324 #define KERN_LOCK_OWNED_SELF		41
325 		/* The lock is already owned by the calling thread
326 		 */
327 
328 #define KERN_SEMAPHORE_DESTROYED	42
329 		/* Semaphore has been destroyed and is no longer available.
330 		 */
331 
332 #define KERN_RPC_SERVER_TERMINATED	43
333 		/* Return from RPC indicating the target server was
334 		 * terminated before it successfully replied
335 		 */
336 
337 #define KERN_RPC_TERMINATE_ORPHAN	44
338 		/* Terminate an orphaned activation.
339 		 */
340 
341 #define KERN_RPC_CONTINUE_ORPHAN	45
342 		/* Allow an orphaned activation to continue executing.
343 		 */
344 
345 #define	KERN_NOT_SUPPORTED			46
346 		/* Unsupported operation
347 		 */
348 
349 #define	KERN_NODE_DOWN			47
350 		/* Remote node down or inaccessible.
351 		 */
352 
353 #define KERN_NOT_WAITING		48
354 		/* A signalled thread was not actually waiting. */
355 
356 #define	KERN_OPERATION_TIMED_OUT        49
357 		/* Some thread-oriented operation (semaphore_wait) timed out
358 		 */
359 
360 #define	KERN_RETURN_MAX			0x100
361 		/* Maximum return value allowable
362 		 */
363 
364 #endif	/* _MACH_KERN_RETURN_H_ */
365