]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/kern_types.h
xnu-1228.15.4.tar.gz
[apple/xnu.git] / osfmk / kern / kern_types.h
CommitLineData
1c79356b 1/*
2d21ac55 2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
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 License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31
32#ifndef _KERN_KERN_TYPES_H_
33#define _KERN_KERN_TYPES_H_
34
0b4e3aa0 35#include <stdint.h>
9bccf70c 36#include <mach/mach_types.h>
1c79356b 37#include <mach/machine/vm_types.h>
9bccf70c 38
91447636 39#ifdef KERNEL_PRIVATE
1c79356b 40
91447636 41#ifndef MACH_KERNEL_PRIVATE
9bccf70c 42
1c79356b 43struct zone ;
9bccf70c 44
91447636 45struct wait_queue { unsigned int opaque[2]; uintptr_t opaquep[2]; } ;
9bccf70c 46
91447636 47#endif /* MACH_KERNEL_PRIVATE */
1c79356b 48
9bccf70c
A
49typedef struct zone *zone_t;
50#define ZONE_NULL ((zone_t) 0)
51
52typedef struct wait_queue *wait_queue_t;
53#define WAIT_QUEUE_NULL ((wait_queue_t) 0)
54#define SIZEOF_WAITQUEUE sizeof(struct wait_queue)
55
56typedef vm_offset_t ipc_kobject_t;
57#define IKO_NULL ((ipc_kobject_t) 0)
58
91447636
A
59#endif /* KERNEL_PRIVATE */
60
9bccf70c
A
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)
cf7d32b8 66#define CAST_EVENT64_T(a_ptr) ((event64_t)((uintptr_t)(a_ptr)))
9bccf70c
A
67
68/*
69 * Possible wait_result_t values.
70 */
71typedef int wait_result_t;
72#define THREAD_WAITING -1 /* thread is waiting */
73#define THREAD_AWAKENED 0 /* normal wakeup */
74#define THREAD_TIMED_OUT 1 /* timeout expired */
75#define THREAD_INTERRUPTED 2 /* aborted/interrupted */
76#define THREAD_RESTART 3 /* restart operation entirely */
77
91447636 78typedef void (*thread_continue_t)(void *, wait_result_t);
9bccf70c
A
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
91447636 89#ifdef KERNEL_PRIVATE
9bccf70c
A
90
91#ifdef MACH_KERNEL_PRIVATE
1c79356b
A
92
93#include <kern/misc_protos.h>
9bccf70c 94typedef struct clock *clock_t;
1c79356b 95
91447636
A
96typedef struct mig_object *mig_object_t;
97#define MIG_OBJECT_NULL ((mig_object_t) 0)
98
99typedef struct mig_notify *mig_notify_t;
100#define MIG_NOTIFY_NULL ((mig_notify_t) 0)
9bccf70c 101
2d21ac55
A
102typedef struct pset_node *pset_node_t;
103#define PSET_NODE_NULL ((pset_node_t) 0)
104
105typedef struct affinity_set *affinity_set_t;
106#define AFFINITY_SET_NULL ((affinity_set_t) 0)
91447636
A
107
108#else /* MACH_KERNEL_PRIVATE */
9bccf70c 109
9bccf70c 110struct wait_queue_set ;
2d21ac55 111struct _wait_queue_link ;
91447636
A
112
113#endif /* MACH_KERNEL_PRIVATE */
9bccf70c
A
114
115typedef struct wait_queue_set *wait_queue_set_t;
116#define WAIT_QUEUE_SET_NULL ((wait_queue_set_t)0)
117#define SIZEOF_WAITQUEUE_SET wait_queue_set_size()
118
2d21ac55 119typedef struct _wait_queue_link *wait_queue_link_t;
9bccf70c
A
120#define WAIT_QUEUE_LINK_NULL ((wait_queue_link_t)0)
121#define SIZEOF_WAITQUEUE_LINK wait_queue_link_size()
1c79356b 122
9bccf70c
A
123/* legacy definitions - going away */
124struct wait_queue_sub ;
125typedef struct wait_queue_sub *wait_queue_sub_t;
126#define WAIT_QUEUE_SUB_NULL ((wait_queue_sub_t)0)
127#define SIZEOF_WAITQUEUE_SUB wait_queue_set_size()
1c79356b 128
91447636 129#endif /* KERNEL_PRIVATE */
1c79356b
A
130
131#endif /* _KERN_KERN_TYPES_H_ */