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