1/* 2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_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. 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. 14 * 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 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 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. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28/* 29 * @OSF_COPYRIGHT@ 30 */ 31 32#ifndef _KERN_KERN_TYPES_H_ 33#define _KERN_KERN_TYPES_H_ 34 35#include <stdint.h> 36#include <mach/mach_types.h> 37#include <mach/machine/vm_types.h> 38 39#ifdef KERNEL_PRIVATE 40 41#ifndef MACH_KERNEL_PRIVATE 42 43struct zone ; 44 45#ifndef __LP64__ 46struct wait_queue { unsigned int opaque[2]; uintptr_t opaquep[2]; } ; 47#else 48struct wait_queue { unsigned char opaque[32]; }; 49#endif 50 51#endif /* MACH_KERNEL_PRIVATE */ 52 53typedef struct zone *zone_t; 54#define ZONE_NULL ((zone_t) 0) 55 56typedef struct wait_queue *wait_queue_t; 57#define WAIT_QUEUE_NULL ((wait_queue_t) 0) 58#define SIZEOF_WAITQUEUE sizeof(struct wait_queue) 59 60typedef vm_offset_t ipc_kobject_t; 61#define IKO_NULL ((ipc_kobject_t) 0) 62 63#endif /* KERNEL_PRIVATE */ 64 65typedef void *event_t; /* wait event */ 66#define NO_EVENT ((event_t) 0) 67 68typedef uint64_t event64_t; /* 64 bit wait event */ 69#define NO_EVENT64 ((event64_t) 0) 70#define CAST_EVENT64_T(a_ptr) ((event64_t)((uintptr_t)(a_ptr))) 71 72/* 73 * Possible wait_result_t values. 74 */ 75typedef int wait_result_t; 76#define THREAD_WAITING -1 /* thread is waiting */ 77#define THREAD_AWAKENED 0 /* normal wakeup */ 78#define THREAD_TIMED_OUT 1 /* timeout expired */ 79#define THREAD_INTERRUPTED 2 /* aborted/interrupted */ 80#define THREAD_RESTART 3 /* restart operation entirely */ 81#define THREAD_NOT_WAITING 10 /* thread didn't need to wait */ 82 83typedef void (*thread_continue_t)(void *, wait_result_t); 84#define THREAD_CONTINUE_NULL ((thread_continue_t) 0) 85 86/* 87 * Interruptible flag for waits. 88 */ 89typedef int wait_interrupt_t; 90#define THREAD_UNINT 0 /* not interruptible */ 91#define THREAD_INTERRUPTIBLE 1 /* may not be restartable */ 92#define THREAD_ABORTSAFE 2 /* abortable safely */ 93 94#ifdef KERNEL_PRIVATE 95 96#ifdef MACH_KERNEL_PRIVATE 97 98#include <kern/misc_protos.h> 99typedef struct clock *clock_t; 100 101typedef struct mig_object *mig_object_t; 102#define MIG_OBJECT_NULL ((mig_object_t) 0) 103 104typedef struct mig_notify *mig_notify_t; 105#define MIG_NOTIFY_NULL ((mig_notify_t) 0) 106 107typedef struct pset_node *pset_node_t; 108#define PSET_NODE_NULL ((pset_node_t) 0) 109 110typedef struct affinity_set *affinity_set_t; 111#define AFFINITY_SET_NULL ((affinity_set_t) 0) 112 113typedef struct run_queue *run_queue_t; 114#define RUN_QUEUE_NULL ((run_queue_t) 0) 115 116typedef struct grrr_run_queue *grrr_run_queue_t; 117#define GRRR_RUN_QUEUE_NULL ((grrr_run_queue_t) 0) 118 119typedef struct grrr_group *grrr_group_t; 120#define GRRR_GROUP_NULL ((grrr_group_t) 0) 121 122#else /* MACH_KERNEL_PRIVATE */ 123 124struct wait_queue_set ; 125struct _wait_queue_link ; 126 127#endif /* MACH_KERNEL_PRIVATE */ 128 129typedef struct wait_queue_set *wait_queue_set_t; 130#define WAIT_QUEUE_SET_NULL ((wait_queue_set_t)0) 131#define SIZEOF_WAITQUEUE_SET wait_queue_set_size() 132 133typedef struct _wait_queue_link *wait_queue_link_t; 134#define WAIT_QUEUE_LINK_NULL ((wait_queue_link_t)0) 135#define SIZEOF_WAITQUEUE_LINK wait_queue_link_size() 136 137/* legacy definitions - going away */ 138struct wait_queue_sub ; 139typedef struct wait_queue_sub *wait_queue_sub_t; 140#define WAIT_QUEUE_SUB_NULL ((wait_queue_sub_t)0) 141#define SIZEOF_WAITQUEUE_SUB wait_queue_set_size() 142 143#endif /* KERNEL_PRIVATE */ 144 145#endif /* _KERN_KERN_TYPES_H_ */ 146