]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/kern_types.h
xnu-344.32.tar.gz
[apple/xnu.git] / osfmk / kern / kern_types.h
CommitLineData
1c79356b 1/*
9bccf70c 2 * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
de355530
A
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.
1c79356b 11 *
de355530
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
de355530
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * @OSF_COPYRIGHT@
24 */
25
26#ifndef _KERN_KERN_TYPES_H_
27#define _KERN_KERN_TYPES_H_
28
0b4e3aa0 29#include <stdint.h>
9bccf70c 30#include <mach/mach_types.h>
1c79356b 31#include <mach/machine/vm_types.h>
9bccf70c
A
32
33#include <sys/appleapiopts.h>
1c79356b
A
34
35#if !defined(MACH_KERNEL_PRIVATE)
36
37/*
38 * Declare empty structure definitions for export to other
39 * kernel components. This lets us still provide some level
40 * of type checking, without exposing our internal data
41 * structures.
42 */
9bccf70c 43
1c79356b 44struct zone ;
9bccf70c
A
45struct wait_queue { unsigned int opaque[2]; uintptr_t opaquep[2]; } ;
46
47
48#endif /* MACH_KERNEL_PRIVATE */
49
1c79356b 50
9bccf70c
A
51typedef struct zone *zone_t;
52#define ZONE_NULL ((zone_t) 0)
53
54typedef struct wait_queue *wait_queue_t;
55#define WAIT_QUEUE_NULL ((wait_queue_t) 0)
56#define SIZEOF_WAITQUEUE sizeof(struct wait_queue)
57
58typedef vm_offset_t ipc_kobject_t;
59#define IKO_NULL ((ipc_kobject_t) 0)
60
61typedef void *event_t; /* wait event */
62#define NO_EVENT ((event_t) 0)
63
64typedef uint64_t event64_t; /* 64 bit wait event */
65#define NO_EVENT64 ((event64_t) 0)
66
67/*
68 * Possible wait_result_t values.
69 */
70typedef int wait_result_t;
71#define THREAD_WAITING -1 /* thread is waiting */
72#define THREAD_AWAKENED 0 /* normal wakeup */
73#define THREAD_TIMED_OUT 1 /* timeout expired */
74#define THREAD_INTERRUPTED 2 /* aborted/interrupted */
75#define THREAD_RESTART 3 /* restart operation entirely */
76
77
78typedef void (*thread_continue_t)(void); /* where to resume it */
79#define THREAD_CONTINUE_NULL ((thread_continue_t) 0)
80
81/*
82 * Interruptible flag for waits.
83 */
84typedef int wait_interrupt_t;
85#define THREAD_UNINT 0 /* not interruptible */
86#define THREAD_INTERRUPTIBLE 1 /* may not be restartable */
87#define THREAD_ABORTSAFE 2 /* abortable safely */
88
89#ifdef __APPLE_API_PRIVATE
90
91#ifdef MACH_KERNEL_PRIVATE
1c79356b
A
92
93#include <kern/misc_protos.h>
9bccf70c 94typedef struct clock *clock_t;
1c79356b 95
9bccf70c
A
96#endif /* MACH_KERNEL_PRIVATE */
97
98#ifdef __APPLE_API_EVOLVING
99
100#ifndef MACH_KERNEL_PRIVATE
101struct wait_queue_set ;
102struct wait_queue_link ;
103#endif
104
105typedef struct wait_queue_set *wait_queue_set_t;
106#define WAIT_QUEUE_SET_NULL ((wait_queue_set_t)0)
107#define SIZEOF_WAITQUEUE_SET wait_queue_set_size()
108
109typedef struct wait_queue_link *wait_queue_link_t;
110#define WAIT_QUEUE_LINK_NULL ((wait_queue_link_t)0)
111#define SIZEOF_WAITQUEUE_LINK wait_queue_link_size()
1c79356b 112
0b4e3aa0 113typedef struct mig_object *mig_object_t;
9bccf70c
A
114#define MIG_OBJECT_NULL ((mig_object_t) 0)
115
0b4e3aa0 116typedef struct mig_notify *mig_notify_t;
9bccf70c 117#define MIG_NOTIFY_NULL ((mig_notify_t) 0)
1c79356b 118
9bccf70c
A
119typedef boolean_t (*thread_roust_t)(wait_result_t); /* how to roust it */
120#define THREAD_ROUST_NULL ((thread_roust_t) 0)
1c79356b 121
9bccf70c 122#endif /* __APPLE_API_EVOLVING */
1c79356b 123
9bccf70c 124#ifdef __APPLE_API_UNSTABLE
0b4e3aa0 125
9bccf70c
A
126typedef struct thread_shuttle *thread_shuttle_t;
127#define THREAD_SHUTTLE_NULL ((thread_shuttle_t)0)
128
129/* legacy definitions - going away */
130struct wait_queue_sub ;
131typedef struct wait_queue_sub *wait_queue_sub_t;
132#define WAIT_QUEUE_SUB_NULL ((wait_queue_sub_t)0)
133#define SIZEOF_WAITQUEUE_SUB wait_queue_set_size()
1c79356b 134
9bccf70c 135#endif /* __APPLE_API_UNSTABLE */
1c79356b 136
9bccf70c 137#endif /* __APPLE_API_PRIVATE */
1c79356b
A
138
139#endif /* _KERN_KERN_TYPES_H_ */