2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 #ifndef _KERN_KERN_TYPES_H_
27 #define _KERN_KERN_TYPES_H_
30 #include <mach/mach_types.h>
31 #include <mach/machine/vm_types.h>
35 #ifndef MACH_KERNEL_PRIVATE
39 struct wait_queue
{ unsigned int opaque
[2]; uintptr_t opaquep
[2]; } ;
41 #endif /* MACH_KERNEL_PRIVATE */
43 typedef struct zone
*zone_t
;
44 #define ZONE_NULL ((zone_t) 0)
46 typedef struct wait_queue
*wait_queue_t
;
47 #define WAIT_QUEUE_NULL ((wait_queue_t) 0)
48 #define SIZEOF_WAITQUEUE sizeof(struct wait_queue)
50 typedef vm_offset_t ipc_kobject_t
;
51 #define IKO_NULL ((ipc_kobject_t) 0)
53 #endif /* KERNEL_PRIVATE */
55 typedef void *event_t
; /* wait event */
56 #define NO_EVENT ((event_t) 0)
58 typedef uint64_t event64_t
; /* 64 bit wait event */
59 #define NO_EVENT64 ((event64_t) 0)
62 * Possible wait_result_t values.
64 typedef int wait_result_t
;
65 #define THREAD_WAITING -1 /* thread is waiting */
66 #define THREAD_AWAKENED 0 /* normal wakeup */
67 #define THREAD_TIMED_OUT 1 /* timeout expired */
68 #define THREAD_INTERRUPTED 2 /* aborted/interrupted */
69 #define THREAD_RESTART 3 /* restart operation entirely */
72 typedef void (*thread_continue_t
)(void *, wait_result_t
);
73 #define THREAD_CONTINUE_NULL ((thread_continue_t) 0)
76 * Interruptible flag for waits.
78 typedef int wait_interrupt_t
;
79 #define THREAD_UNINT 0 /* not interruptible */
80 #define THREAD_INTERRUPTIBLE 1 /* may not be restartable */
81 #define THREAD_ABORTSAFE 2 /* abortable safely */
85 #ifdef MACH_KERNEL_PRIVATE
87 #include <kern/misc_protos.h>
88 typedef struct clock
*clock_t;
90 typedef struct mig_object
*mig_object_t
;
91 #define MIG_OBJECT_NULL ((mig_object_t) 0)
93 typedef struct mig_notify
*mig_notify_t
;
94 #define MIG_NOTIFY_NULL ((mig_notify_t) 0)
96 typedef boolean_t (*thread_roust_t
)(thread_t
, wait_result_t
);
97 #define THREAD_ROUST_NULL ((thread_roust_t) 0)
99 #else /* MACH_KERNEL_PRIVATE */
101 struct wait_queue_set
;
102 struct wait_queue_link
;
104 #endif /* MACH_KERNEL_PRIVATE */
106 typedef struct wait_queue_set
*wait_queue_set_t
;
107 #define WAIT_QUEUE_SET_NULL ((wait_queue_set_t)0)
108 #define SIZEOF_WAITQUEUE_SET wait_queue_set_size()
110 typedef struct wait_queue_link
*wait_queue_link_t
;
111 #define WAIT_QUEUE_LINK_NULL ((wait_queue_link_t)0)
112 #define SIZEOF_WAITQUEUE_LINK wait_queue_link_size()
114 /* legacy definitions - going away */
115 struct wait_queue_sub
;
116 typedef struct wait_queue_sub
*wait_queue_sub_t
;
117 #define WAIT_QUEUE_SUB_NULL ((wait_queue_sub_t)0)
118 #define SIZEOF_WAITQUEUE_SUB wait_queue_set_size()
120 #endif /* KERNEL_PRIVATE */
122 #endif /* _KERN_KERN_TYPES_H_ */