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