]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/kern_types.h
8e0ed1a015fd3663a06c6c20a292ec5c897a8c77
[apple/xnu.git] / osfmk / kern / kern_types.h
1 /*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_COPYRIGHT@
32 */
33
34 #ifndef _KERN_KERN_TYPES_H_
35 #define _KERN_KERN_TYPES_H_
36
37 #include <stdint.h>
38 #include <mach/mach_types.h>
39 #include <mach/machine/vm_types.h>
40
41 #ifdef KERNEL_PRIVATE
42
43 #ifndef MACH_KERNEL_PRIVATE
44
45 struct zone ;
46
47 struct wait_queue { unsigned int opaque[2]; uintptr_t opaquep[2]; } ;
48
49 #endif /* MACH_KERNEL_PRIVATE */
50
51 typedef struct zone *zone_t;
52 #define ZONE_NULL ((zone_t) 0)
53
54 typedef struct wait_queue *wait_queue_t;
55 #define WAIT_QUEUE_NULL ((wait_queue_t) 0)
56 #define SIZEOF_WAITQUEUE sizeof(struct wait_queue)
57
58 typedef vm_offset_t ipc_kobject_t;
59 #define IKO_NULL ((ipc_kobject_t) 0)
60
61 #endif /* KERNEL_PRIVATE */
62
63 typedef void *event_t; /* wait event */
64 #define NO_EVENT ((event_t) 0)
65
66 typedef uint64_t event64_t; /* 64 bit wait event */
67 #define NO_EVENT64 ((event64_t) 0)
68
69 /*
70 * Possible wait_result_t values.
71 */
72 typedef int wait_result_t;
73 #define THREAD_WAITING -1 /* thread is waiting */
74 #define THREAD_AWAKENED 0 /* normal wakeup */
75 #define THREAD_TIMED_OUT 1 /* timeout expired */
76 #define THREAD_INTERRUPTED 2 /* aborted/interrupted */
77 #define THREAD_RESTART 3 /* restart operation entirely */
78
79
80 typedef void (*thread_continue_t)(void *, wait_result_t);
81 #define THREAD_CONTINUE_NULL ((thread_continue_t) 0)
82
83 /*
84 * Interruptible flag for waits.
85 */
86 typedef int wait_interrupt_t;
87 #define THREAD_UNINT 0 /* not interruptible */
88 #define THREAD_INTERRUPTIBLE 1 /* may not be restartable */
89 #define THREAD_ABORTSAFE 2 /* abortable safely */
90
91 #ifdef KERNEL_PRIVATE
92
93 #ifdef MACH_KERNEL_PRIVATE
94
95 #include <kern/misc_protos.h>
96 typedef struct clock *clock_t;
97
98 typedef struct mig_object *mig_object_t;
99 #define MIG_OBJECT_NULL ((mig_object_t) 0)
100
101 typedef struct mig_notify *mig_notify_t;
102 #define MIG_NOTIFY_NULL ((mig_notify_t) 0)
103
104 typedef boolean_t (*thread_roust_t)(thread_t, wait_result_t);
105 #define THREAD_ROUST_NULL ((thread_roust_t) 0)
106
107 #else /* MACH_KERNEL_PRIVATE */
108
109 struct wait_queue_set ;
110 struct wait_queue_link ;
111
112 #endif /* MACH_KERNEL_PRIVATE */
113
114 typedef struct wait_queue_set *wait_queue_set_t;
115 #define WAIT_QUEUE_SET_NULL ((wait_queue_set_t)0)
116 #define SIZEOF_WAITQUEUE_SET wait_queue_set_size()
117
118 typedef struct wait_queue_link *wait_queue_link_t;
119 #define WAIT_QUEUE_LINK_NULL ((wait_queue_link_t)0)
120 #define SIZEOF_WAITQUEUE_LINK wait_queue_link_size()
121
122 /* legacy definitions - going away */
123 struct wait_queue_sub ;
124 typedef struct wait_queue_sub *wait_queue_sub_t;
125 #define WAIT_QUEUE_SUB_NULL ((wait_queue_sub_t)0)
126 #define SIZEOF_WAITQUEUE_SUB wait_queue_set_size()
127
128 #endif /* KERNEL_PRIVATE */
129
130 #endif /* _KERN_KERN_TYPES_H_ */