| 1 | /* |
| 2 | * Copyright (c) 2023 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * @APPLE_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. Please obtain a copy of the License at |
| 10 | * http://www.opensource.apple.com/apsl/ and read it before using this |
| 11 | * file. |
| 12 | * |
| 13 | * The Original Code and all software distributed under the License are |
| 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
| 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
| 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
| 18 | * Please see the License for the specific language governing rights and |
| 19 | * limitations under the License. |
| 20 | * |
| 21 | * @APPLE_LICENSE_HEADER_END@ |
| 22 | */ |
| 23 | |
| 24 | #ifndef _MALLOC_UNDERSCORE_PLATFORM_H |
| 25 | #define _MALLOC_UNDERSCORE_PLATFORM_H |
| 26 | |
| 27 | #include <malloc/_ptrcheck.h> |
| 28 | __ptrcheck_abi_assume_single() |
| 29 | |
| 30 | #include <stdbool.h> |
| 31 | #include <stddef.h> |
| 32 | #include <stdint.h> |
| 33 | |
| 34 | #include <sys/cdefs.h> |
| 35 | #ifndef __DARWIN_EXTSN |
| 36 | #define __DARWIN_EXTSN(x) |
| 37 | #endif /* __DARWIN_EXTSN */ |
| 38 | |
| 39 | #if __has_include(<mach/boolean.h>) |
| 40 | #include <mach/boolean.h> |
| 41 | #else |
| 42 | typedef int boolean_t; |
| 43 | #endif /* __has_include(<mach/boolean.h>) */ |
| 44 | |
| 45 | #if __has_include(<mach/kern_return.h>) |
| 46 | #include <mach/kern_return.h> |
| 47 | #else |
| 48 | typedef int kern_return_t; |
| 49 | #endif /* __has_include(<mach/kern_return.h>) */ |
| 50 | |
| 51 | #if __has_include(<mach/port.h>) |
| 52 | #include <mach/port.h> |
| 53 | #else |
| 54 | typedef void * __single mach_port_t; |
| 55 | #endif /* __has_include(<mach/port.h>) */ |
| 56 | |
| 57 | #if __has_include(<mach/mach_types.h>) |
| 58 | #include <mach/mach_types.h> |
| 59 | #else |
| 60 | typedef mach_port_t task_t; |
| 61 | #endif /* __has_include(<mach/mach_types.h>) */ |
| 62 | |
| 63 | #if __has_include(<mach/vm_types.h>) |
| 64 | #include <mach/vm_types.h> |
| 65 | #else |
| 66 | typedef uint64_t mach_vm_address_t; |
| 67 | typedef uint64_t mach_vm_offset_t; |
| 68 | typedef uint64_t mach_vm_size_t; |
| 69 | typedef uintptr_t vm_offset_t; |
| 70 | typedef vm_offset_t vm_address_t; |
| 71 | typedef uintptr_t vm_size_t; |
| 72 | #endif /* __has_include(<mach/vm_types.h>) */ |
| 73 | |
| 74 | #if __has_include(<malloc/_malloc_type.h>) && !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) |
| 75 | #include <malloc/_malloc_type.h> |
| 76 | #else |
| 77 | #define _MALLOC_TYPED(override, type_param_pos) |
| 78 | #endif |
| 79 | |
| 80 | #endif /* _MALLOC_UNDERSCORE_PLATFORM_H */ |