Merge pull request #15130 from ziglang/macos-13.3

macos: update to latest libc headers macOS SDK 13.3
This commit is contained in:
Jakub Konka
2023-04-01 08:23:13 +02:00
committed by GitHub
31 changed files with 4779 additions and 33 deletions

View File

@@ -76,6 +76,11 @@
#define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) 0
#endif
#define FLAVOR_MODIFIES_CORE_CPU_REGISTERS(x) \
((x == ARM_THREAD_STATE) || \
(x == ARM_THREAD_STATE32) || \
(x == ARM_THREAD_STATE64))
#define VALID_THREAD_STATE_FLAVOR(x) \
((x == ARM_THREAD_STATE) || \
(x == ARM_VFP_STATE) || \

View File

@@ -55,7 +55,7 @@
#ifdef __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__
/* compiler sets __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ when -mtvos-version-min is used */
#define __TV_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__
#define __TV_OS_VERSION_MAX_ALLOWED __TVOS_16_2
#define __TV_OS_VERSION_MAX_ALLOWED __TVOS_16_4
/* for compatibility with existing code. New code should use platform specific checks */
#define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
#endif
@@ -65,7 +65,7 @@
#ifdef __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__
/* compiler sets __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ when -mwatchos-version-min is used */
#define __WATCH_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__
#define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_9_2
#define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_9_4
/* for compatibility with existing code. New code should use platform specific checks */
#define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
#endif
@@ -75,7 +75,7 @@
#ifdef __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__
#define __BRIDGE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__
#define __BRIDGE_OS_VERSION_MAX_ALLOWED 70100
#define __BRIDGE_OS_VERSION_MAX_ALLOWED 70300
/* for compatibility with existing code. New code should use platform specific checks */
#define __IPHONE_OS_VERSION_MIN_REQUIRED 110000
#endif
@@ -90,14 +90,14 @@
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
/* make sure a default max version is set */
#ifndef __MAC_OS_X_VERSION_MAX_ALLOWED
#define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_13_1
#define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_13_3
#endif
#endif /* __MAC_OS_X_VERSION_MIN_REQUIRED */
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
/* make sure a default max version is set */
#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED
#define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_16_2
#define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_16_4
#endif
/* make sure a valid min is set */
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0

View File

@@ -123,6 +123,7 @@
#define MAC_OS_VERSION_12_0 120000
#define MAC_OS_VERSION_13_0 130000
#define MAC_OS_VERSION_13_1 130100
#define MAC_OS_VERSION_13_3 130300
/*
* If min OS not specified, assume 10.4 for intel
@@ -149,10 +150,10 @@
* if max OS not specified, assume larger of (10.15, min)
*/
#ifndef MAC_OS_X_VERSION_MAX_ALLOWED
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_13_1
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_13_3
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_MIN_REQUIRED
#else
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_13_1
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_13_3
#endif
#endif

View File

@@ -69,6 +69,8 @@
#define __MAC_12_3 120300
#define __MAC_13_0 130000
#define __MAC_13_1 130100
#define __MAC_13_2 130200
#define __MAC_13_3 130300
/* __MAC_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */
#define __IPHONE_2_0 20000
@@ -134,6 +136,8 @@
#define __IPHONE_16_0 160000
#define __IPHONE_16_1 160100
#define __IPHONE_16_2 160200
#define __IPHONE_16_3 160300
#define __IPHONE_16_4 160400
/* __IPHONE_NA is not defined to a value but is used as a token by macros to indicate that the API is unavailable */
#define __TVOS_9_0 90000
@@ -172,6 +176,8 @@
#define __TVOS_16_0 160000
#define __TVOS_16_1 160100
#define __TVOS_16_2 160200
#define __TVOS_16_3 160300
#define __TVOS_16_4 160400
#define __WATCHOS_1_0 10000
#define __WATCHOS_2_0 20000
@@ -207,6 +213,8 @@
#define __WATCHOS_9_0 90000
#define __WATCHOS_9_1 90100
#define __WATCHOS_9_2 90200
#define __WATCHOS_9_3 90300
#define __WATCHOS_9_4 90400
/*
* Set up standard Mac OS X versions

View File

@@ -18,7 +18,12 @@
# endif
#endif
#if __has_include(<Availability.h>)
#include <Availability.h>
#else
#define __OSX_AVAILABLE_STARTING(m,i)
#endif
#include <TargetConditionals.h>
#include <sys/cdefs.h>
@@ -58,8 +63,8 @@ BLOCK_EXPORT void * _NSConcreteStackBlock[32]
// Type correct macros
#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))
#define Block_release(...) _Block_release((const void *)(__VA_ARGS__))
#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy(__unsafe_forge_single(const void *, (const void *)(__VA_ARGS__))))
#define Block_release(...) _Block_release(__unsafe_forge_single(const void *, (const void *)(__VA_ARGS__)))
#endif

View File

@@ -0,0 +1,572 @@
/*
* Copyright (c) 2008 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _LIBKERN_OSKEXTLIB_H
#define _LIBKERN_OSKEXTLIB_H
#include <sys/cdefs.h>
__BEGIN_DECLS
#include <stdint.h>
#include <mach/kmod.h>
#include <mach/vm_types.h>
#include <uuid/uuid.h>
#include <libkern/OSReturn.h>
/*!
* @header
*
* Declares functions, basic return values, and other constants
* related to kernel extensions (kexts).
*/
#if PRAGMA_MARK
#pragma mark -
/********************************************************************/
#pragma mark OSReturn Values for Kernel Extensions
/********************************************************************/
#endif
/*!
* @group OSReturn Values for Kernel Extensions
* Many kext-related functions return these values,
* as well as those defined under
* <code>@link //apple_ref/c/tdef/OSReturn OSReturn@/link</code>
* and other variants of <code>kern_return_t</code>.
*/
#define sub_libkern_kext err_sub(2)
#define libkern_kext_err(code) (sys_libkern|sub_libkern_kext|(code))
/*!
* @define kOSKextReturnInternalError
* @abstract An internal error in the kext library.
* Contrast with <code>@link //apple_ref/c/econst/OSReturnError
* OSReturnError@/link</code>.
*/
#define kOSKextReturnInternalError libkern_kext_err(0x1)
/*!
* @define kOSKextReturnNoMemory
* @abstract Memory allocation failed.
*/
#define kOSKextReturnNoMemory libkern_kext_err(0x2)
/*!
* @define kOSKextReturnNoResources
* @abstract Some resource other than memory (such as available load tags)
* is exhausted.
*/
#define kOSKextReturnNoResources libkern_kext_err(0x3)
/*!
* @define kOSKextReturnNotPrivileged
* @abstract The caller lacks privileges to perform the requested operation.
*/
#define kOSKextReturnNotPrivileged libkern_kext_err(0x4)
/*!
* @define kOSKextReturnInvalidArgument
* @abstract Invalid argument.
*/
#define kOSKextReturnInvalidArgument libkern_kext_err(0x5)
/*!
* @define kOSKextReturnNotFound
* @abstract Search item not found.
*/
#define kOSKextReturnNotFound libkern_kext_err(0x6)
/*!
* @define kOSKextReturnBadData
* @abstract Malformed data (not used for XML).
*/
#define kOSKextReturnBadData libkern_kext_err(0x7)
/*!
* @define kOSKextReturnSerialization
* @abstract Error converting or (un)serializing URL, string, or XML.
*/
#define kOSKextReturnSerialization libkern_kext_err(0x8)
/*!
* @define kOSKextReturnUnsupported
* @abstract Operation is no longer or not yet supported.
*/
#define kOSKextReturnUnsupported libkern_kext_err(0x9)
/*!
* @define kOSKextReturnDisabled
* @abstract Operation is currently disabled.
*/
#define kOSKextReturnDisabled libkern_kext_err(0xa)
/*!
* @define kOSKextReturnNotAKext
* @abstract Bundle is not a kernel extension.
*/
#define kOSKextReturnNotAKext libkern_kext_err(0xb)
/*!
* @define kOSKextReturnValidation
* @abstract Validation failures encountered; check diagnostics for details.
*/
#define kOSKextReturnValidation libkern_kext_err(0xc)
/*!
* @define kOSKextReturnAuthentication
* @abstract Authetication failures encountered; check diagnostics for details.
*/
#define kOSKextReturnAuthentication libkern_kext_err(0xd)
/*!
* @define kOSKextReturnDependencies
* @abstract Dependency resolution failures encountered; check diagnostics for details.
*/
#define kOSKextReturnDependencies libkern_kext_err(0xe)
/*!
* @define kOSKextReturnArchNotFound
* @abstract Kext does not contain code for the requested architecture.
*/
#define kOSKextReturnArchNotFound libkern_kext_err(0xf)
/*!
* @define kOSKextReturnCache
* @abstract An error occurred processing a system kext cache.
*/
#define kOSKextReturnCache libkern_kext_err(0x10)
/*!
* @define kOSKextReturnDeferred
* @abstract Operation has been posted asynchronously to user space (kernel only).
*/
#define kOSKextReturnDeferred libkern_kext_err(0x11)
/*!
* @define kOSKextReturnBootLevel
* @abstract Kext not loadable or operation not allowed at current boot level.
*/
#define kOSKextReturnBootLevel libkern_kext_err(0x12)
/*!
* @define kOSKextReturnNotLoadable
* @abstract Kext cannot be loaded; check diagnostics for details.
*/
#define kOSKextReturnNotLoadable libkern_kext_err(0x13)
/*!
* @define kOSKextReturnLoadedVersionDiffers
* @abstract A different version (or executable UUID, or executable by checksum)
* of the requested kext is already loaded.
*/
#define kOSKextReturnLoadedVersionDiffers libkern_kext_err(0x14)
/*!
* @define kOSKextReturnDependencyLoadError
* @abstract A load error occurred on a dependency of the kext being loaded.
*/
#define kOSKextReturnDependencyLoadError libkern_kext_err(0x15)
/*!
* @define kOSKextReturnLinkError
* @abstract A link failure occured with this kext or a dependency.
*/
#define kOSKextReturnLinkError libkern_kext_err(0x16)
/*!
* @define kOSKextReturnStartStopError
* @abstract The kext start or stop routine returned an error.
*/
#define kOSKextReturnStartStopError libkern_kext_err(0x17)
/*!
* @define kOSKextReturnInUse
* @abstract The kext is currently in use or has outstanding references,
* and cannot be unloaded.
*/
#define kOSKextReturnInUse libkern_kext_err(0x18)
/*!
* @define kOSKextReturnTimeout
* @abstract A kext request has timed out.
*/
#define kOSKextReturnTimeout libkern_kext_err(0x19)
/*!
* @define kOSKextReturnStopping
* @abstract The kext is in the process of stopping; requests cannot be made.
*/
#define kOSKextReturnStopping libkern_kext_err(0x1a)
/*!
* @define kOSKextReturnSystemPolicy
* @abstract The kext was prevented from loading due to system policy.
*/
#define kOSKextReturnSystemPolicy libkern_kext_err(0x1b)
/*!
* @define kOSKextReturnKCLoadFailure
* @abstract Loading of the System KC failed
*/
#define kOSKextReturnKCLoadFailure libkern_kext_err(0x1c)
/*!
* @define kOSKextReturnKCLoadFailureSystemKC
* @abstract Loading of the System KC failed
*
* This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
* with: kOSKextReturnKCLoadFailureAuxKC
*
* If both the System and Aux KCs fail to load, then the error code will be:
* libkern_kext_err(0x1f)
*/
#define kOSKextReturnKCLoadFailureSystemKC libkern_kext_err(0x1d)
/*!
* @define kOSKextReturnKCLoadFailureAuxKC
* @abstract Loading of the Aux KC failed
*
* This a sub-code of kOSKextReturnKCLoadFailure. It can be OR'd together
* with: kOSKextReturnKCLoadFailureSystemKC
*
* If both the System and Aux KCs fail to load, then the error code will be:
* libkern_kext_err(0x1f)
*/
#define kOSKextReturnKCLoadFailureAuxKC libkern_kext_err(0x1e)
/* next available error is: libkern_kext_err(0x20) */
#if PRAGMA_MARK
#pragma mark -
/********************************************************************/
#pragma mark Kext/OSBundle Property List Keys
/********************************************************************/
#endif
/*!
* @group Kext Property List Keys
* These constants cover CFBundle properties defined for kernel extensions.
* Because they are used in the kernel, if you want to use one with
* CFBundle APIs you'll need to wrap it in a <code>CFSTR()</code> macro.
*/
/*!
* @define kOSBundleCompatibleVersionKey
* @abstract A string giving the backwards-compatible version of a library kext
* in extended Mac OS 'vers' format (####.##.##s{1-255} where 's'
* is a build stage 'd', 'a', 'b', 'f' or 'fc').
*/
#define kOSBundleCompatibleVersionKey "OSBundleCompatibleVersion"
/*!
* @define kOSBundleEnableKextLoggingKey
* @abstract Set to true to have the kernel kext logging spec applied
* to the kext.
* See <code>@link //apple_ref/c/econst/OSKextLogSpec
* OSKextLogSpec@/link</code>.
*/
#define kOSBundleEnableKextLoggingKey "OSBundleEnableKextLogging"
/*!
* @define kOSBundleIsInterfaceKey
* @abstract A boolean value indicating whether the kext executable
* contains only symbol references.
*/
#define kOSBundleIsInterfaceKey "OSBundleIsInterface"
/*!
* @define kOSBundleLibrariesKey
* @abstract A dictionary listing link dependencies for this kext.
* Keys are bundle identifiers, values are version strings.
*/
#define kOSBundleLibrariesKey "OSBundleLibraries"
/*!
* @define kOSBundleRequiredKey
* @abstract A string indicating in which kinds of startup this kext
* may need to load during early startup (before
* <code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>).
* @discussion
* The value is one of:
* <ul>
* <li>@link kOSBundleRequiredRoot "OSBundleRequiredRoot"@/link</li>
* <li>@link kOSBundleRequiredLocalRoot "OSBundleRequiredLocalRoot"@/link</li>
* <li>@link kOSBundleRequiredNetworkRoot "OSBundleRequiredNetworkRoot"@/link</li>
* <li>@link kOSBundleRequiredSafeBoot "OSBundleRequiredSafeBoot"@/link</li>
* <li>@link kOSBundleRequiredConsole "OSBundleRequiredConsole"@/link</li>
* </ul>
*
* Use this property judiciously.
* Every kext that declares a value other than "OSBundleRequiredSafeBoot"
* increases startup time, as the booter must read it into memory,
* or startup kext caches must include it.
*/
#define kOSBundleRequiredKey "OSBundleRequired"
/*!
* @define kOSBundleRequireExplicitLoadKey
* @abstract A boolean value indicating whether the kext requires an
* explicit kextload in order to start/match.
*/
#define kOSBundleRequireExplicitLoadKey "OSBundleRequireExplicitLoad"
/*!
* @define kOSBundleAllowUserLoadKey
* @abstract A boolean value indicating whether
* <code>@link //apple_ref/doc/man/8/kextd kextcache(8)@/link</code>
* will honor a non-root process's request to load a kext.
* @discussion
* See <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithURL
* KextManagerLoadKextWithURL@/link</code>
* and <code>@link //apple_ref/doc/compositePage/c/func/KextManagerLoadKextWithIdentifier
* KextManagerLoadKextWithIdentifier@/link</code>.
*/
#define kOSBundleAllowUserLoadKey "OSBundleAllowUserLoad"
/*!
* @define kOSBundleAllowUserTerminateKey
* @abstract A boolean value indicating whether the kextunload tool
* is allowed to issue IOService terminate to classes defined in this kext.
* @discussion A boolean value indicating whether the kextunload tool
* is allowed to issue IOService terminate to classes defined in this kext.
*/
#define kOSBundleAllowUserTerminateKey "OSBundleAllowUserTerminate"
/*!
* @define kOSKernelResourceKey
* @abstract A boolean value indicating whether the kext represents a built-in
* component of the kernel.
*/
#define kOSKernelResourceKey "OSKernelResource"
/*!
* @define kOSKextVariantOverrideKey
* @abstract A dictionary with target names as key and a target-specific variant
* name as value.
*/
#define kOSKextVariantOverrideKey "OSKextVariantOverride"
/*!
* @define kIOKitPersonalitiesKey
* @abstract A dictionary of dictionaries used in matching for I/O Kit drivers.
*/
#define kIOKitPersonalitiesKey "IOKitPersonalities"
/*
* @define kIOPersonalityPublisherKey
* @abstract Used in personalities sent to the I/O Kit,
* contains the CFBundleIdentifier of the kext
* that the personality originated in.
*/
#define kIOPersonalityPublisherKey "IOPersonalityPublisher"
#if CONFIG_KEC_FIPS
/*
* @define kAppleTextHashesKey
* @abstract A dictionary conataining hashes for corecrypto kext.
*/
#define kAppleTextHashesKey "AppleTextHashes"
#endif
/*!
* @define kOSMutableSegmentCopy
* @abstract A boolean value indicating whether the kext requires a copy of
* its mutable segments to be kept in memory, and then reset when the kext
* unloads. This should be used with caution as it will increase the
* amount of memory used by the kext.
*/
#define kOSMutableSegmentCopy "OSMutableSegmentCopy"
#if PRAGMA_MARK
/********************************************************************/
#pragma mark Kext/OSBundle Property Deprecated Keys
/********************************************************************/
#endif
/*
* @define kOSBundleDebugLevelKey
* @abstract
* Deprecated (used on some releases of Mac OS X prior to 10.6 Snow Leopard).
* Value is an integer from 1-6, corresponding to the verbose levels
* of kext tools on those releases.
* On 10.6 Snow Leopard, use <code>@link OSKextEnableKextLogging
* OSKextEnableKextLogging@/link</code>.
*/
#define kOSBundleDebugLevelKey "OSBundleDebugLevel"
/*!
* @define kOSBundleSharedExecutableIdentifierKey
* @abstract Deprecated (used on some releases of Mac OS X
* prior to 10.6 Snow Leopard).
* Value is the bundle identifier of the pseudokext
* that contains an executable shared by this kext.
*/
#define kOSBundleSharedExecutableIdentifierKey "OSBundleSharedExecutableIdentifier"
#if PRAGMA_MARK
/********************************************************************/
#pragma mark Kext/OSBundle Property List Values
/********************************************************************/
#endif
/*!
* @group Kext Property List Values
* These constants encompass established values
* for kernel extension bundle properties.
*/
/*!
* @define kOSKextKernelIdentifier
* @abstract
* This is the CFBundleIdentifier user for the kernel itself.
*/
#define kOSKextKernelIdentifier "__kernel__"
/*!
* @define kOSKextBundlePackageTypeKext
* @abstract
* The bundle type value for Kernel Extensions.
*/
#define kOSKextBundlePackageTypeKext "KEXT"
/*!
* @define kOSKextBundlePackageTypeDriverKit
* @abstract
* The bundle type value for Driver Extensions.
*/
#define kOSKextBundlePackageTypeDriverKit "DEXT"
/*!
* @define kOSBundleRequiredRoot
* @abstract
* This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
* value indicates that the kext may be needed to mount the root filesystem
* whether starting from a local or a network volume.
*/
#define kOSBundleRequiredRoot "Root"
/*!
* @define kOSBundleRequiredLocalRoot
* @abstract
* This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
* value indicates that the kext may be needed to mount the root filesystem
* when starting from a local disk.
*/
#define kOSBundleRequiredLocalRoot "Local-Root"
/*!
* @define kOSBundleRequiredNetworkRoot
* @abstract
* This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
* value indicates that the kext may be needed to mount the root filesystem
* when starting over a network connection.
*/
#define kOSBundleRequiredNetworkRoot "Network-Root"
/*!
* @define kOSBundleRequiredSafeBoot
* @abstract
* This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
* value indicates that the kext can be loaded during a safe startup.
* This value does not normally cause the kext to be read by the booter
* or included in startup kext caches.
*/
#define kOSBundleRequiredSafeBoot "Safe Boot"
/*!
* @define kOSBundleRequiredConsole
* @abstract
* This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
* value indicates that the kext may be needed for console access
* (specifically in a single-user startup when
* <code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code>.
* does not run)
* and should be loaded during early startup.
*/
#define kOSBundleRequiredConsole "Console"
/*!
* @define kOSBundleRequiredDriverKit
* @abstract
* This <code>@link kOSBundleRequiredKey OSBundleRequired@/link</code>
* value indicates that the driver extension's (DriverKit driver's)
* personalities must be present in the kernel at early boot (specifically
* before <code>@link //apple_ref/doc/man/8/kextd kextd(8)@/link</code> starts)
* in order to compete with kexts built into the prelinkedkernel. Note that
* kextd is still required to launch the user space driver binary. The IOKit
* matching will happen during early boot, and the actual driver launch
* will happen after kextd starts.
*/
#define kOSBundleRequiredDriverKit "DriverKit"
#if PRAGMA_MARK
#pragma mark -
/********************************************************************/
#pragma mark Kext Information
/********************************************************************/
#endif
/*!
* @group Kext Information
* Types, constants, and macros providing a kext with information
* about itself.
*/
/*!
* @typedef OSKextLoadTag
*
* @abstract
* A unique identifier assigned to a loaded instanace of a kext.
*
* @discussion
* If a kext is unloaded and later reloaded, the new instance
* has a different load tag.
*
* A kext can get its own load tag in the <code>kmod_info_t</code>
* structure passed into its module start routine, as the
* <code>id</code> field (cast to this type).
*/
typedef uint32_t OSKextLoadTag;
/*!
* @define kOSKextInvalidLoadTag
*
* @abstract
* A load tag value that will never be used for a loaded kext;
* indicates kext not found.
*/
#define kOSKextInvalidLoadTag ((OSKextLoadTag)(-1))
__END_DECLS
#endif /* _LIBKERN_OSKEXTLIB_H */

View File

@@ -0,0 +1,254 @@
/*
* Copyright (c) 2010 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _MACHO_ARM64_RELOC_H_
#define _MACHO_ARM64_RELOC_H_
/*
* Relocations for arm64 are a bit different than for other architectures in
* Mach-O: Scattered relocations are not used. Almost all relocations produced
* by the compiler are external relocations. An external relocation has the
* r_extern bit set to 1 and the r_symbolnum field contains the symbol table
* index of the target label.
*
* When the assembler is generating relocations, if the target label is a local
* label (begins with 'L'), then the previous non-local label in the same
* section is used as the target of the external relocation. An addend is used
* with the distance from that non-local label to the target label. Only when
* there is no previous non-local label in the section is an internal
* relocation used.
*
* The addend (i.e. the 4 in _foo+4) is encoded either in the instruction or
* in the r_symbolnum of ARM64_RELOC_ADDEND.
* For ARM64_RELOC_UNSIGNED and ARM64_RELOC_AUTHENTICATED_POINTER, the addend
* is stored in the instruction. ARM64_RELOC_PAGE21, ARM64_RELOC_PAGEOFF12 and
* ARM64_RELOC_BRANCH26 must be preceded by an ARM64_RELOC_ADDEND if they need
* an addend. No other relocations support addends.
*
* The relocation types are:
*
* ARM64_RELOC_UNSIGNED // For pointer sized fixups
* ARM64_RELOC_SUBTRACTOR // must be followed by a ARM64_RELOC_UNSIGNED
* ARM64_RELOC_BRANCH26 // a BL instruction with pc-relative +-128MB displacement
* ARM64_RELOC_PAGE21 // pc-rel distance to page of target
* ARM64_RELOC_PAGEOFF12 // offset within page, scaled by r_length
* ARM64_RELOC_GOT_LOAD_PAGE21 // load with a pc-rel distance to page of a GOT entry
* ARM64_RELOC_GOT_LOAD_PAGEOFF12 // load with an offset within page, scaled by r_length, of GOT entry
* ARM64_RELOC_POINTER_TO_GOT // 32-bit pc-rel (or 64-bit absolute) offset to a GOT entry
* ARM64_RELOC_TLVP_LOAD_PAGE21 // tlv load with a pc-rel distance to page of a GOT entry
* ARM64_RELOC_TLVP_LOAD_PAGEOFF12 // tlv load with an offset within page, scaled by r_length, of GOT entry
* ARM64_RELOC_ADDEND // must be followed by ARM64_RELOC_BRANCH26/ARM64_RELOC_PAGE21/ARM64_RELOC_PAGEOFF12
* ARM64_RELOC_AUTHENTICATED_POINTER // 64-bit pointer with authentication
*
* The following are sample assembly instructions, followed by the relocation
* and section content they generate in an object file:
*
* (arm64_32 only)
* .long _foo
* r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 00 00 00 00
*
* (arm64_32 only)
* .long _foo + 4
* r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 04 00 00 00
*
* .quad _foo
* r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 00 00 00 00 00 00 00 00
*
* .quad _foo + 16
* r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 10 00 00 00 00 00 00 00
*
* .quad L1
* r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev
* 10 00 00 00 00 00 00 00
* // assumes _prev is the first non-local label 0x10 bytes before L1
* 10 00 00 00 00 00 00 00
*
* (arm64_32 only)
* .long _foo - _bar
* r_type=ARM64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_bar
* r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 00 00 00 00
*
* (arm64_32 only)
* .long _foo - _bar + 4
* r_type=ARM64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_bar
* r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 04 00 00 00
*
* .quad _foo - _bar
* r_type=ARM64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_bar
* r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 00 00 00 00 00 00 00 00
*
* .quad _foo - _bar + 4
* r_type=ARM64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_bar
* r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 04 00 00 00 00 00 00 00
*
* .long _foo - .
* r_type=ARM64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_prev
* r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* f8 ff ff ff
* // assumes _prev is the first non-local label 0x8 bytes before this
* // .quad
*
* .long _foo - L1
* r_type=ARM64_RELOC_SUBTRACTOR, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_prev
* r_type=ARM64_RELOC_UNSIGNED, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* f8 ff ff ff
* // assumes _prev is the first non-local label 0x8 bytes before L1
*
* .quad _foo - .
* r_type=ARM64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev
* r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* f8 ff ff ff ff ff ff ff
* // assumes _prev is the first non-local label 0x8 bytes before this
* // .quad
*
* .quad _foo - L1
* r_type=ARM64_RELOC_SUBTRACTOR, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_prev
* r_type=ARM64_RELOC_UNSIGNED, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* f8 ff ff ff ff ff ff ff
* // assumes _prev is the first non-local label 0x8 bytes before L1
*
* .long L1 - _prev
* // No relocations. This is an assembly time constant.
* 12 00 00 00 00 00 00 00
* // assumes _prev is the first non-local label 0x12 bytes before L1
*
* .quad L1 - _prev
* // No relocations. This is an assembly time constant.
* 12 00 00 00 00 00 00 00
* // assumes _prev is the first non-local label 0x12 bytes before L1
*
* bl _foo
* r_type=ARM64_RELOC_BRANCH26, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
* 0x14000000
*
* bl _foo + 4
* r_type=ARM64_RELOC_ADDEND, r_length=2, r_extern=0, r_pcrel=0, r_symbolnum=0x000004
* r_type=ARM64_RELOC_BRANCH26, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
* 0x14000000
*
* adrp x0, _foo@PAGE
* r_type=ARM64_RELOC_PAGE21, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
* 0x90000000
*
* ldr x0, [x0, _foo@PAGEOFF]
* r_type=ARM64_RELOC_PAGEOFF12, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 0xf9400000
*
* adrp x0, _foo@PAGE + 0x24
* r_type=ARM64_RELOC_ADDEND, r_length=2, r_extern=0, r_pcrel=0, r_symbolnum=0x000024
* r_type=ARM64_RELOC_PAGE21, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
* 0x90000000
*
* ldr x0, [x0, _foo@PAGEOFF + 0x24]
* r_type=ARM64_RELOC_ADDEND, r_length=2, r_extern=0, r_pcrel=0, r_symbolnum=0x000024
* r_type=ARM64_RELOC_PAGEOFF12, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 0xf9400000
*
* adrp x0, _foo@GOTPAGE
* r_type=ARM64_RELOC_GOT_LOAD_PAGE21, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
* 0x90000000
*
* ldr x0, [x0, _foo@GOTPAGEOFF]
* r_type=ARM64_RELOC_GOT_LOAD_PAGEOFF12, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 0xf9400000
*
* adrp x0, _foo@TLVPPAGE
* r_type=ARM64_RELOC_TLVP_LOAD_PAGE21, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
* 0x90000000
*
* ldr x0, [x0, _foo@TLVPPAGEOFF]
* r_type=ARM64_RELOC_TLVP_LOAD_PAGEOFF12, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 0xf9400000
*
* .long _foo@GOT - .
* r_type=ARM64_RELOC_POINTER_TO_GOT, r_length=2, r_extern=1, r_pcrel=1, r_symbolnum=_foo
* 00 00 00 00
*
* (arm64_32 only)
* .long _foo@GOT
* r_type=ARM64_RELOC_POINTER_TO_GOT, r_length=2, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 00 00 00 00
*
* .quad _foo@GOT
* r_type=ARM64_RELOC_POINTER_TO_GOT, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 00 00 00 00 00 00 00 00
*
* (arm64e only)
* .quad _foo@AUTH(da,5,addr)
* r_type=ARM64_RELOC_AUTHENTICATED_POINTER, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 00 00 00 00 05 00 05 80
*
* (arm64e only)
* .quad (_foo + 0x10)@AUTH(da,5,addr)
* r_type=ARM64_RELOC_AUTHENTICATED_POINTER, r_length=3, r_extern=1, r_pcrel=0, r_symbolnum=_foo
* 10 00 00 00 05 00 05 80
*
*
*/
enum reloc_type_arm64
{
ARM64_RELOC_UNSIGNED, // for pointers
ARM64_RELOC_SUBTRACTOR, // must be followed by a ARM64_RELOC_UNSIGNED
ARM64_RELOC_BRANCH26, // a B/BL instruction with 26-bit displacement
ARM64_RELOC_PAGE21, // pc-rel distance to page of target
ARM64_RELOC_PAGEOFF12, // offset within page, scaled by r_length
ARM64_RELOC_GOT_LOAD_PAGE21, // pc-rel distance to page of GOT slot
ARM64_RELOC_GOT_LOAD_PAGEOFF12, // offset within page of GOT slot,
// scaled by r_length
ARM64_RELOC_POINTER_TO_GOT, // for pointers to GOT slots
ARM64_RELOC_TLVP_LOAD_PAGE21, // pc-rel distance to page of TLVP slot
ARM64_RELOC_TLVP_LOAD_PAGEOFF12, // offset within page of TLVP slot,
// scaled by r_length
ARM64_RELOC_ADDEND, // must be followed by PAGE21 or PAGEOFF12
// An arm64e authenticated pointer.
//
// Represents a pointer to a symbol (like ARM64_RELOC_UNSIGNED).
// Additionally, the resulting pointer is signed. The signature is
// specified in the target location: the addend is restricted to the lower
// 32 bits (instead of the full 64 bits for ARM64_RELOC_UNSIGNED):
//
// |63|62|61-51|50-49| 48 |47 - 32|31 - 0|
// | 1| 0| 0 | key | addr | discriminator | addend |
//
// The key is one of:
// IA: 00 IB: 01
// DA: 10 DB: 11
//
// The discriminator field is used as extra signature diversification.
//
// The addr field indicates whether the target address should be blended
// into the discriminator.
//
ARM64_RELOC_AUTHENTICATED_POINTER,
};
#endif /* #ifndef _MACHO_ARM64_RELOC_H_ */

View File

@@ -0,0 +1,532 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
// Darwin's alternative to DWARF based unwind encodings.
//
//===----------------------------------------------------------------------===//
#ifndef __COMPACT_UNWIND_ENCODING__
#define __COMPACT_UNWIND_ENCODING__
#include <stdint.h>
//
// Compilers can emit standard DWARF FDEs in the __TEXT,__eh_frame section
// of object files. Or compilers can emit compact unwind information in
// the __LD,__compact_unwind section.
//
// When the linker creates a final linked image, it will create a
// __TEXT,__unwind_info section. This section is a small and fast way for the
// runtime to access unwind info for any given function. If the compiler
// emitted compact unwind info for the function, that compact unwind info will
// be encoded in the __TEXT,__unwind_info section. If the compiler emitted
// DWARF unwind info, the __TEXT,__unwind_info section will contain the offset
// of the FDE in the __TEXT,__eh_frame section in the final linked image.
//
// Note: Previously, the linker would transform some DWARF unwind infos into
// compact unwind info. But that is fragile and no longer done.
//
// The compact unwind endoding is a 32-bit value which encoded in an
// architecture specific way, which registers to restore from where, and how
// to unwind out of the function.
//
typedef uint32_t compact_unwind_encoding_t;
// architecture independent bits
enum {
UNWIND_IS_NOT_FUNCTION_START = 0x80000000,
UNWIND_HAS_LSDA = 0x40000000,
UNWIND_PERSONALITY_MASK = 0x30000000,
};
//
// x86
//
// 1-bit: start
// 1-bit: has lsda
// 2-bit: personality index
//
// 4-bits: 0=old, 1=ebp based, 2=stack-imm, 3=stack-ind, 4=DWARF
// ebp based:
// 15-bits (5*3-bits per reg) register permutation
// 8-bits for stack offset
// frameless:
// 8-bits stack size
// 3-bits stack adjust
// 3-bits register count
// 10-bits register permutation
//
enum {
UNWIND_X86_MODE_MASK = 0x0F000000,
UNWIND_X86_MODE_EBP_FRAME = 0x01000000,
UNWIND_X86_MODE_STACK_IMMD = 0x02000000,
UNWIND_X86_MODE_STACK_IND = 0x03000000,
UNWIND_X86_MODE_DWARF = 0x04000000,
UNWIND_X86_EBP_FRAME_REGISTERS = 0x00007FFF,
UNWIND_X86_EBP_FRAME_OFFSET = 0x00FF0000,
UNWIND_X86_FRAMELESS_STACK_SIZE = 0x00FF0000,
UNWIND_X86_FRAMELESS_STACK_ADJUST = 0x0000E000,
UNWIND_X86_FRAMELESS_STACK_REG_COUNT = 0x00001C00,
UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF,
UNWIND_X86_DWARF_SECTION_OFFSET = 0x00FFFFFF,
};
enum {
UNWIND_X86_REG_NONE = 0,
UNWIND_X86_REG_EBX = 1,
UNWIND_X86_REG_ECX = 2,
UNWIND_X86_REG_EDX = 3,
UNWIND_X86_REG_EDI = 4,
UNWIND_X86_REG_ESI = 5,
UNWIND_X86_REG_EBP = 6,
};
//
// For x86 there are four modes for the compact unwind encoding:
// UNWIND_X86_MODE_EBP_FRAME:
// EBP based frame where EBP is push on stack immediately after return address,
// then ESP is moved to EBP. Thus, to unwind ESP is restored with the current
// EPB value, then EBP is restored by popping off the stack, and the return
// is done by popping the stack once more into the pc.
// All non-volatile registers that need to be restored must have been saved
// in a small range in the stack that starts EBP-4 to EBP-1020. The offset/4
// is encoded in the UNWIND_X86_EBP_FRAME_OFFSET bits. The registers saved
// are encoded in the UNWIND_X86_EBP_FRAME_REGISTERS bits as five 3-bit entries.
// Each entry contains which register to restore.
// UNWIND_X86_MODE_STACK_IMMD:
// A "frameless" (EBP not used as frame pointer) function with a small
// constant stack size. To return, a constant (encoded in the compact
// unwind encoding) is added to the ESP. Then the return is done by
// popping the stack into the pc.
// All non-volatile registers that need to be restored must have been saved
// on the stack immediately after the return address. The stack_size/4 is
// encoded in the UNWIND_X86_FRAMELESS_STACK_SIZE (max stack size is 1024).
// The number of registers saved is encoded in UNWIND_X86_FRAMELESS_STACK_REG_COUNT.
// UNWIND_X86_FRAMELESS_STACK_REG_PERMUTATION constains which registers were
// saved and their order.
// UNWIND_X86_MODE_STACK_IND:
// A "frameless" (EBP not used as frame pointer) function large constant
// stack size. This case is like the previous, except the stack size is too
// large to encode in the compact unwind encoding. Instead it requires that
// the function contains "subl $nnnnnnnn,ESP" in its prolog. The compact
// encoding contains the offset to the nnnnnnnn value in the function in
// UNWIND_X86_FRAMELESS_STACK_SIZE.
// UNWIND_X86_MODE_DWARF:
// No compact unwind encoding is available. Instead the low 24-bits of the
// compact encoding is the offset of the DWARF FDE in the __eh_frame section.
// This mode is never used in object files. It is only generated by the
// linker in final linked images which have only DWARF unwind info for a
// function.
//
// The permutation encoding is a Lehmer code sequence encoded into a
// single variable-base number so we can encode the ordering of up to
// six registers in a 10-bit space.
//
// The following is the algorithm used to create the permutation encoding used
// with frameless stacks. It is passed the number of registers to be saved and
// an array of the register numbers saved.
//
//uint32_t permute_encode(uint32_t registerCount, const uint32_t registers[6])
//{
// uint32_t renumregs[6];
// for (int i=6-registerCount; i < 6; ++i) {
// int countless = 0;
// for (int j=6-registerCount; j < i; ++j) {
// if ( registers[j] < registers[i] )
// ++countless;
// }
// renumregs[i] = registers[i] - countless -1;
// }
// uint32_t permutationEncoding = 0;
// switch ( registerCount ) {
// case 6:
// permutationEncoding |= (120*renumregs[0] + 24*renumregs[1]
// + 6*renumregs[2] + 2*renumregs[3]
// + renumregs[4]);
// break;
// case 5:
// permutationEncoding |= (120*renumregs[1] + 24*renumregs[2]
// + 6*renumregs[3] + 2*renumregs[4]
// + renumregs[5]);
// break;
// case 4:
// permutationEncoding |= (60*renumregs[2] + 12*renumregs[3]
// + 3*renumregs[4] + renumregs[5]);
// break;
// case 3:
// permutationEncoding |= (20*renumregs[3] + 4*renumregs[4]
// + renumregs[5]);
// break;
// case 2:
// permutationEncoding |= (5*renumregs[4] + renumregs[5]);
// break;
// case 1:
// permutationEncoding |= (renumregs[5]);
// break;
// }
// return permutationEncoding;
//}
//
//
// x86_64
//
// 1-bit: start
// 1-bit: has lsda
// 2-bit: personality index
//
// 4-bits: 0=old, 1=rbp based, 2=stack-imm, 3=stack-ind, 4=DWARF
// rbp based:
// 15-bits (5*3-bits per reg) register permutation
// 8-bits for stack offset
// frameless:
// 8-bits stack size
// 3-bits stack adjust
// 3-bits register count
// 10-bits register permutation
//
enum {
UNWIND_X86_64_MODE_MASK = 0x0F000000,
UNWIND_X86_64_MODE_RBP_FRAME = 0x01000000,
UNWIND_X86_64_MODE_STACK_IMMD = 0x02000000,
UNWIND_X86_64_MODE_STACK_IND = 0x03000000,
UNWIND_X86_64_MODE_DWARF = 0x04000000,
UNWIND_X86_64_RBP_FRAME_REGISTERS = 0x00007FFF,
UNWIND_X86_64_RBP_FRAME_OFFSET = 0x00FF0000,
UNWIND_X86_64_FRAMELESS_STACK_SIZE = 0x00FF0000,
UNWIND_X86_64_FRAMELESS_STACK_ADJUST = 0x0000E000,
UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT = 0x00001C00,
UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION = 0x000003FF,
UNWIND_X86_64_DWARF_SECTION_OFFSET = 0x00FFFFFF,
};
enum {
UNWIND_X86_64_REG_NONE = 0,
UNWIND_X86_64_REG_RBX = 1,
UNWIND_X86_64_REG_R12 = 2,
UNWIND_X86_64_REG_R13 = 3,
UNWIND_X86_64_REG_R14 = 4,
UNWIND_X86_64_REG_R15 = 5,
UNWIND_X86_64_REG_RBP = 6,
};
//
// For x86_64 there are four modes for the compact unwind encoding:
// UNWIND_X86_64_MODE_RBP_FRAME:
// RBP based frame where RBP is push on stack immediately after return address,
// then RSP is moved to RBP. Thus, to unwind RSP is restored with the current
// EPB value, then RBP is restored by popping off the stack, and the return
// is done by popping the stack once more into the pc.
// All non-volatile registers that need to be restored must have been saved
// in a small range in the stack that starts RBP-8 to RBP-2040. The offset/8
// is encoded in the UNWIND_X86_64_RBP_FRAME_OFFSET bits. The registers saved
// are encoded in the UNWIND_X86_64_RBP_FRAME_REGISTERS bits as five 3-bit entries.
// Each entry contains which register to restore.
// UNWIND_X86_64_MODE_STACK_IMMD:
// A "frameless" (RBP not used as frame pointer) function with a small
// constant stack size. To return, a constant (encoded in the compact
// unwind encoding) is added to the RSP. Then the return is done by
// popping the stack into the pc.
// All non-volatile registers that need to be restored must have been saved
// on the stack immediately after the return address. The stack_size/8 is
// encoded in the UNWIND_X86_64_FRAMELESS_STACK_SIZE (max stack size is 2048).
// The number of registers saved is encoded in UNWIND_X86_64_FRAMELESS_STACK_REG_COUNT.
// UNWIND_X86_64_FRAMELESS_STACK_REG_PERMUTATION constains which registers were
// saved and their order.
// UNWIND_X86_64_MODE_STACK_IND:
// A "frameless" (RBP not used as frame pointer) function large constant
// stack size. This case is like the previous, except the stack size is too
// large to encode in the compact unwind encoding. Instead it requires that
// the function contains "subq $nnnnnnnn,RSP" in its prolog. The compact
// encoding contains the offset to the nnnnnnnn value in the function in
// UNWIND_X86_64_FRAMELESS_STACK_SIZE.
// UNWIND_X86_64_MODE_DWARF:
// No compact unwind encoding is available. Instead the low 24-bits of the
// compact encoding is the offset of the DWARF FDE in the __eh_frame section.
// This mode is never used in object files. It is only generated by the
// linker in final linked images which have only DWARF unwind info for a
// function.
//
// ARM64
//
// 1-bit: start
// 1-bit: has lsda
// 2-bit: personality index
//
// 4-bits: 4=frame-based, 3=DWARF, 2=frameless
// frameless:
// 12-bits of stack size
// frame-based:
// 4-bits D reg pairs saved
// 5-bits X reg pairs saved
// DWARF:
// 24-bits offset of DWARF FDE in __eh_frame section
//
enum {
UNWIND_ARM64_MODE_MASK = 0x0F000000,
UNWIND_ARM64_MODE_FRAMELESS = 0x02000000,
UNWIND_ARM64_MODE_DWARF = 0x03000000,
UNWIND_ARM64_MODE_FRAME = 0x04000000,
UNWIND_ARM64_FRAME_X19_X20_PAIR = 0x00000001,
UNWIND_ARM64_FRAME_X21_X22_PAIR = 0x00000002,
UNWIND_ARM64_FRAME_X23_X24_PAIR = 0x00000004,
UNWIND_ARM64_FRAME_X25_X26_PAIR = 0x00000008,
UNWIND_ARM64_FRAME_X27_X28_PAIR = 0x00000010,
UNWIND_ARM64_FRAME_D8_D9_PAIR = 0x00000100,
UNWIND_ARM64_FRAME_D10_D11_PAIR = 0x00000200,
UNWIND_ARM64_FRAME_D12_D13_PAIR = 0x00000400,
UNWIND_ARM64_FRAME_D14_D15_PAIR = 0x00000800,
UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK = 0x00FFF000,
UNWIND_ARM64_DWARF_SECTION_OFFSET = 0x00FFFFFF,
};
// For arm64 there are three modes for the compact unwind encoding:
// UNWIND_ARM64_MODE_FRAME:
// This is a standard arm64 prolog where FP/LR are immediately pushed on the
// stack, then SP is copied to FP. If there are any non-volatile registers
// saved, then are copied into the stack frame in pairs in a contiguous
// range right below the saved FP/LR pair. Any subset of the five X pairs
// and four D pairs can be saved, but the memory layout must be in register
// number order.
// UNWIND_ARM64_MODE_FRAMELESS:
// A "frameless" leaf function, where FP/LR are not saved. The return address
// remains in LR throughout the function. If any non-volatile registers
// are saved, they must be pushed onto the stack before any stack space is
// allocated for local variables. The stack sized (including any saved
// non-volatile registers) divided by 16 is encoded in the bits
// UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK.
// UNWIND_ARM64_MODE_DWARF:
// No compact unwind encoding is available. Instead the low 24-bits of the
// compact encoding is the offset of the DWARF FDE in the __eh_frame section.
// This mode is never used in object files. It is only generated by the
// linker in final linked images which have only DWARF unwind info for a
// function.
//
#ifndef __OPEN_SOURCE__
//
// armv7k
//
// 1-bit: start
// 1-bit: has lsda
// 2-bit: personality index
//
// 4-bits: 1=frame, 2=frame+dregs, 4=dwarf
//
enum {
UNWIND_ARM_MODE_MASK = 0x0F000000,
UNWIND_ARM_MODE_FRAME = 0x01000000,
UNWIND_ARM_MODE_FRAME_D = 0x02000000,
UNWIND_ARM_MODE_DWARF = 0x04000000,
UNWIND_ARM_FRAME_STACK_ADJUST_MASK = 0x00C00000,
UNWIND_ARM_FRAME_FIRST_PUSH_R4 = 0x00000001,
UNWIND_ARM_FRAME_FIRST_PUSH_R5 = 0x00000002,
UNWIND_ARM_FRAME_FIRST_PUSH_R6 = 0x00000004,
UNWIND_ARM_FRAME_SECOND_PUSH_R8 = 0x00000008,
UNWIND_ARM_FRAME_SECOND_PUSH_R9 = 0x00000010,
UNWIND_ARM_FRAME_SECOND_PUSH_R10 = 0x00000020,
UNWIND_ARM_FRAME_SECOND_PUSH_R11 = 0x00000040,
UNWIND_ARM_FRAME_SECOND_PUSH_R12 = 0x00000080,
UNWIND_ARM_FRAME_D_REG_COUNT_MASK = 0x00000700,
UNWIND_ARM_DWARF_SECTION_OFFSET = 0x00FFFFFF,
};
// For armv7k there are three modes for the compact unwind encoding:
// UNWIND_ARM_MODE_FRAME:
// This is a standard arm prolog where lr/r7 are immediately pushed on the
// stack. As part of that first push r4, r5, or r6 can be also pushed
// and if so the FIRST_PUSH bit is set in the compact unwind. Additionally
// there can be a second push multiple which can save r8 through r12.
// If that is used, the registers saved is recorded with a SECOND_PUSH bit.
// Lastly, for var-args support, the prolog may save r1, r2, r3 to the
// stack before the frame push. If that is done the STACK_ADJUST_MASK
// records that the stack pointer must be adjust (e.g 0x00800000 means
// the stack pointer was adjusted 8 bytes down and the unwinder would
// need to add back 8 bytes to SP when unwinding through this function.
// UNWIND_ARM_MODE_FRAME_D:
// This is the same as UNWIND_ARM_MODE_FRAME, except that additionally
// some D registers were saved. The D_REG_COUNT_MASK contains which
// set if D registers were saved and where. There are currently 8 (0-7)
// possible D register save patterns supported.
// UNWIND_ARM_MODE_DWARF:
// No compact unwind encoding is available. Instead the low 24-bits of the
// compact encoding is the offset of the dwarf FDE in the __eh_frame section.
// The offset only exists in final linked images. It is zero in object files.
#endif
////////////////////////////////////////////////////////////////////////////////
//
// Relocatable Object Files: __LD,__compact_unwind
//
////////////////////////////////////////////////////////////////////////////////
//
// A compiler can generated compact unwind information for a function by adding
// a "row" to the __LD,__compact_unwind section. This section has the
// S_ATTR_DEBUG bit set, so the section will be ignored by older linkers.
// It is removed by the new linker, so never ends up in final executables.
// This section is a table, initially with one row per function (that needs
// unwind info). The table columns and some conceptual entries are:
//
// range-start pointer to start of function/range
// range-length
// compact-unwind-encoding 32-bit encoding
// personality-function or zero if no personality function
// lsda or zero if no LSDA data
//
// The length and encoding fields are 32-bits. The other are all pointer sized.
//
// In x86_64 assembly, these entry would look like:
//
// .section __LD,__compact_unwind,regular,debug
//
// #compact unwind for _foo
// .quad _foo
// .set L1,LfooEnd-_foo
// .long L1
// .long 0x01010001
// .quad 0
// .quad 0
//
// #compact unwind for _bar
// .quad _bar
// .set L2,LbarEnd-_bar
// .long L2
// .long 0x01020011
// .quad __gxx_personality
// .quad except_tab1
//
//
// Notes: There is no need for any labels in the the __compact_unwind section.
// The use of the .set directive is to force the evaluation of the
// range-length at assembly time, instead of generating relocations.
//
// To support future compiler optimizations where which non-volatile registers
// are saved changes within a function (e.g. delay saving non-volatiles until
// necessary), there can by multiple lines in the __compact_unwind table for one
// function, each with a different (non-overlapping) range and each with
// different compact unwind encodings that correspond to the non-volatiles
// saved at that range of the function.
//
// If a particular function is so wacky that there is no compact unwind way
// to encode it, then the compiler can emit traditional DWARF unwind info.
// The runtime will use which ever is available.
//
// Runtime support for compact unwind encodings are only available on 10.6
// and later. So, the compiler should not generate it when targeting pre-10.6.
////////////////////////////////////////////////////////////////////////////////
//
// Final Linked Images: __TEXT,__unwind_info
//
////////////////////////////////////////////////////////////////////////////////
//
// The __TEXT,__unwind_info section is laid out for an efficient two level lookup.
// The header of the section contains a coarse index that maps function address
// to the page (4096 byte block) containing the unwind info for that function.
//
#define UNWIND_SECTION_VERSION 1
struct unwind_info_section_header
{
uint32_t version; // UNWIND_SECTION_VERSION
uint32_t commonEncodingsArraySectionOffset;
uint32_t commonEncodingsArrayCount;
uint32_t personalityArraySectionOffset;
uint32_t personalityArrayCount;
uint32_t indexSectionOffset;
uint32_t indexCount;
// compact_unwind_encoding_t[]
// uint32_t personalities[]
// unwind_info_section_header_index_entry[]
// unwind_info_section_header_lsda_index_entry[]
};
struct unwind_info_section_header_index_entry
{
uint32_t functionOffset;
uint32_t secondLevelPagesSectionOffset; // section offset to start of regular or compress page
uint32_t lsdaIndexArraySectionOffset; // section offset to start of lsda_index array for this range
};
struct unwind_info_section_header_lsda_index_entry
{
uint32_t functionOffset;
uint32_t lsdaOffset;
};
//
// There are two kinds of second level index pages: regular and compressed.
// A compressed page can hold up to 1021 entries, but it cannot be used
// if too many different encoding types are used. The regular page holds
// 511 entries.
//
struct unwind_info_regular_second_level_entry
{
uint32_t functionOffset;
compact_unwind_encoding_t encoding;
};
#define UNWIND_SECOND_LEVEL_REGULAR 2
struct unwind_info_regular_second_level_page_header
{
uint32_t kind; // UNWIND_SECOND_LEVEL_REGULAR
uint16_t entryPageOffset;
uint16_t entryCount;
// entry array
};
#define UNWIND_SECOND_LEVEL_COMPRESSED 3
struct unwind_info_compressed_second_level_page_header
{
uint32_t kind; // UNWIND_SECOND_LEVEL_COMPRESSED
uint16_t entryPageOffset;
uint16_t entryCount;
uint16_t encodingsPageOffset;
uint16_t encodingsCount;
// 32-bit entry array
// encodings array
};
#define UNWIND_INFO_COMPRESSED_ENTRY_FUNC_OFFSET(entry) (entry & 0x00FFFFFF)
#define UNWIND_INFO_COMPRESSED_ENTRY_ENCODING_INDEX(entry) ((entry >> 24) & 0xFF)
#endif

View File

@@ -42,7 +42,10 @@
* and contains the constants for the possible values of these types.
*/
#include <stdint.h>
#if __has_include(<mach/machine.h>)
#include <mach/machine.h>
#endif
#if __has_include(<architecture/byte_order.h>)
#include <architecture/byte_order.h>
@@ -57,8 +60,8 @@ struct fat_header {
};
struct fat_arch {
cpu_type_t cputype; /* cpu specifier (int) */
cpu_subtype_t cpusubtype; /* machine specifier (int) */
int32_t cputype; /* cpu specifier (int) */
int32_t cpusubtype; /* machine specifier (int) */
uint32_t offset; /* file offset to this object file */
uint32_t size; /* size of this object file */
uint32_t align; /* alignment as a power of 2 */
@@ -75,8 +78,8 @@ struct fat_arch {
#define FAT_CIGAM_64 0xbfbafeca /* NXSwapLong(FAT_MAGIC_64) */
struct fat_arch_64 {
cpu_type_t cputype; /* cpu specifier (int) */
cpu_subtype_t cpusubtype; /* machine specifier (int) */
int32_t cputype; /* cpu specifier (int) */
int32_t cpusubtype; /* machine specifier (int) */
uint64_t offset; /* file offset to this object file */
uint64_t size; /* size of this object file */
uint32_t align; /* alignment as a power of 2 */

View File

@@ -297,7 +297,7 @@ extern
#endif /* mig_external */
kern_return_t mach_zone_info
(
host_priv_t host,
mach_port_t host,
mach_zone_name_array_t *names,
mach_msg_type_number_t *namesCnt,
mach_zone_info_array_t *info,
@@ -385,7 +385,7 @@ extern
#endif /* mig_external */
kern_return_t mach_memory_info
(
host_priv_t host,
mach_port_t host,
mach_zone_name_array_t *names,
mach_msg_type_number_t *namesCnt,
mach_zone_info_array_t *info,

View File

@@ -217,8 +217,12 @@ typedef clock_ctrl_t clock_ctrl_port_t;
typedef exception_handler_t exception_port_t;
typedef exception_handler_array_t exception_port_arrary_t;
typedef char vfs_path_t[4096];
typedef char nspace_path_t[1024]; /* 1024 == PATH_MAX */
typedef char nspace_name_t[1024]; /* 1024 == PATH_MAX */
/*
* 8K, c.f. FSGETPATH_MAXBUFLEN in bsd/vfs/vfs_syscalls.c.
* These types should NEVER be allocated on the stack.
*/
typedef char nspace_path_t[8192];
typedef char nspace_name_t[8192];
#define TASK_NULL ((task_t) 0)
#define TASK_NAME_NULL ((task_name_t) 0)

View File

@@ -400,6 +400,7 @@ enum mach_port_guard_exception_codes {
kGUARD_EXC_MOD_REFS = 2,
kGUARD_EXC_INVALID_OPTIONS = 3,
kGUARD_EXC_SET_CONTEXT = 4,
kGUARD_EXC_THREAD_SET_STATE = 5,
kGUARD_EXC_UNGUARDED = 1u << 3,
kGUARD_EXC_INCORRECT_GUARD = 1u << 4,
kGUARD_EXC_IMMOVABLE = 1u << 5,

View File

@@ -284,11 +284,12 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
#define VM_FLAGS_RETURN_4K_DATA_ADDR 0x00800000 /* Return 4K aligned address of target data */
#define VM_FLAGS_ALIAS_MASK 0xFF000000
#define VM_GET_FLAGS_ALIAS(flags, alias) \
(alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24
(alias) = (((flags) >> 24) & 0xff)
#define VM_SET_FLAGS_ALIAS(flags, alias) \
(flags) = (((flags) & ~VM_FLAGS_ALIAS_MASK) | \
(((alias) & ~VM_FLAGS_ALIAS_MASK) << 24))
/* These are the flags that we accept from user-space */
#define VM_FLAGS_USER_ALLOCATE (VM_FLAGS_FIXED | \
VM_FLAGS_ANYWHERE | \
@@ -301,9 +302,11 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
VM_FLAGS_SUPERPAGE_MASK | \
VM_FLAGS_TPRO | \
VM_FLAGS_ALIAS_MASK)
#define VM_FLAGS_USER_MAP (VM_FLAGS_USER_ALLOCATE | \
VM_FLAGS_RETURN_4K_DATA_ADDR | \
VM_FLAGS_RETURN_DATA_ADDR)
#define VM_FLAGS_USER_REMAP (VM_FLAGS_FIXED | \
VM_FLAGS_ANYWHERE | \
VM_FLAGS_RANDOM_ADDR | \

View File

@@ -66,7 +66,7 @@ typedef uint32_t reg64_t;
* addresses (that are page aligned) as 32-bit page numbers.
* This limits the physical address space to 16TB of RAM.
*/
typedef uint32_t ppnum_t; /* Physical page number */
typedef uint32_t ppnum_t __kernel_ptr_semantics; /* Physical page number */
#define PPNUM_MAX UINT32_MAX

View File

@@ -75,6 +75,7 @@
#endif
#ifdef __APPLE__
#define APPLE_IF_FAM_LOOPBACK 1
#define APPLE_IF_FAM_ETHERNET 2

View File

@@ -0,0 +1,115 @@
/* NSObject.h
Copyright (c) 1994-2012, Apple Inc. All rights reserved.
*/
#ifndef _OBJC_NSOBJECT_H_
#define _OBJC_NSOBJECT_H_
#if __OBJC__
#include <objc/objc.h>
#include <objc/NSObjCRuntime.h>
@class NSString, NSMethodSignature, NSInvocation;
@protocol NSObject
- (BOOL)isEqual:(id)object;
@property (readonly) NSUInteger hash;
@property (readonly) Class superclass;
- (Class)class OBJC_SWIFT_UNAVAILABLE("use 'type(of: anObject)' instead");
- (instancetype)self;
- (id)performSelector:(SEL)aSelector;
- (id)performSelector:(SEL)aSelector withObject:(id)object;
- (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2;
- (BOOL)isProxy;
- (BOOL)isKindOfClass:(Class)aClass;
- (BOOL)isMemberOfClass:(Class)aClass;
- (BOOL)conformsToProtocol:(Protocol *)aProtocol;
- (BOOL)respondsToSelector:(SEL)aSelector;
- (instancetype)retain OBJC_ARC_UNAVAILABLE;
- (oneway void)release OBJC_ARC_UNAVAILABLE;
- (instancetype)autorelease OBJC_ARC_UNAVAILABLE;
- (NSUInteger)retainCount OBJC_ARC_UNAVAILABLE;
- (struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
@property (readonly, copy) NSString *description;
@optional
@property (readonly, copy) NSString *debugDescription;
@end
OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0)
OBJC_ROOT_CLASS
OBJC_EXPORT
@interface NSObject <NSObject> {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-interface-ivars"
Class isa OBJC_ISA_AVAILABILITY;
#pragma clang diagnostic pop
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-load-method"
+ (void)load;
#pragma clang diagnostic pop
+ (void)initialize;
- (instancetype)init
#if NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER
NS_DESIGNATED_INITIALIZER
#endif
;
+ (instancetype)new OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
+ (instancetype)allocWithZone:(struct _NSZone *)zone OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
+ (instancetype)alloc OBJC_SWIFT_UNAVAILABLE("use object initializers instead");
- (void)dealloc OBJC_SWIFT_UNAVAILABLE("use 'deinit' to define a de-initializer");
- (void)finalize OBJC_DEPRECATED("Objective-C garbage collection is no longer supported");
- (id)copy;
- (id)mutableCopy;
+ (id)copyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
+ (id)mutableCopyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE;
+ (BOOL)instancesRespondToSelector:(SEL)aSelector;
+ (BOOL)conformsToProtocol:(Protocol *)protocol;
- (IMP)methodForSelector:(SEL)aSelector;
+ (IMP)instanceMethodForSelector:(SEL)aSelector;
- (void)doesNotRecognizeSelector:(SEL)aSelector;
- (id)forwardingTargetForSelector:(SEL)aSelector OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
- (void)forwardInvocation:(NSInvocation *)anInvocation OBJC_SWIFT_UNAVAILABLE("");
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector OBJC_SWIFT_UNAVAILABLE("");
+ (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)aSelector OBJC_SWIFT_UNAVAILABLE("");
- (BOOL)allowsWeakReference UNAVAILABLE_ATTRIBUTE;
- (BOOL)retainWeakReference UNAVAILABLE_ATTRIBUTE;
+ (BOOL)isSubclassOfClass:(Class)aClass;
+ (BOOL)resolveClassMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
+ (BOOL)resolveInstanceMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
+ (NSUInteger)hash;
+ (Class)superclass;
+ (Class)class OBJC_SWIFT_UNAVAILABLE("use 'aClass.self' instead");
+ (NSString *)description;
+ (NSString *)debugDescription;
@end
#endif
#endif

View File

@@ -542,7 +542,7 @@ class_getInstanceMethod(Class _Nullable cls, SEL _Nonnull name)
*
* @return A pointer to the \c Method data structure that corresponds to the implementation of the
* selector specified by aSelector for the class specified by aClass, or NULL if the specified
* class or its superclasses do not contain an instance method with the specified selector.
* class or its superclasses do not contain a class method with the specified selector.
*
* @note Note that this function searches superclasses for implementations,
* whereas \c class_copyMethodList does not.
@@ -1898,6 +1898,17 @@ _objc_realizeClassFromSwift(Class _Nullable cls, void * _Nullable previously)
struct objc_method_list;
/* Used for testing only */
OBJC_EXPORT void
_objc_flush_caches(Class _Nullable cls)
__OSX_DEPRECATED(10.0, 10.5, "not recommended")
__IOS_DEPRECATED(2.0, 2.0, "not recommended")
__TVOS_DEPRECATED(9.0, 9.0, "not recommended")
__WATCHOS_DEPRECATED(1.0, 1.0, "not recommended")
;
/* Obsolete functions */
#if !0
@@ -1919,15 +1930,6 @@ class_respondsToMethod(Class _Nullable cls, SEL _Nonnull sel)
;
OBJC_EXPORT void
_objc_flush_caches(Class _Nullable cls)
__OSX_DEPRECATED(10.0, 10.5, "not recommended")
__IOS_DEPRECATED(2.0, 2.0, "not recommended")
__TVOS_DEPRECATED(9.0, 9.0, "not recommended")
__WATCHOS_DEPRECATED(1.0, 1.0, "not recommended")
;
OBJC_EXPORT id _Nullable
object_copyFromZone(id _Nullable anObject, size_t nBytes, void * _Nullable z)
OBJC_OSX_DEPRECATED_OTHERS_UNAVAILABLE(10.0, 10.5, "use object_copy instead");

View File

@@ -0,0 +1,30 @@
/* Copyright (c) 2014 Apple, Inc. All rights reserved.
*
* This header provides small vector (simd) and matrix types, and basic
* arithmetic and mathematical functions for them. The vast majority of these
* operations are implemented as header inlines, as they can be performed
* using just a few instructions on most processors.
*
* These functions are broken into two groups; vector and matrix. This header
* includes all of them, but these may also be included separately. Consult
* these two headers for detailed documentation of what types and operations
* are available.
*/
#ifndef __SIMD_HEADER__
#define __SIMD_HEADER__
#if __has_include(<realtime_safety/realtime_safety.h>)
#include <realtime_safety/realtime_safety.h>
REALTIME_SAFE_BEGIN
#endif
#include <simd/vector.h>
#include <simd/matrix.h>
#include <simd/quaternion.h>
#if __has_include(<realtime_safety/realtime_safety.h>)
REALTIME_SAFE_END
#endif
#endif

View File

@@ -389,6 +389,18 @@
#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_2(x)
#endif
#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 160300
#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_3(x) x
#else
#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_3(x)
#endif
#if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 160400
#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_4(x) x
#else
#define __DARWIN_ALIAS_STARTING_IPHONE___IPHONE_16_4(x)
#endif
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1000
#define __DARWIN_ALIAS_STARTING_MAC___MAC_10_0(x) x
#else
@@ -645,4 +657,16 @@
#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_1(x) x
#else
#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_1(x)
#endif
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 130200
#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_2(x) x
#else
#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_2(x)
#endif
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 130300
#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_3(x) x
#else
#define __DARWIN_ALIAS_STARTING_MAC___MAC_13_3(x)
#endif

View File

@@ -0,0 +1,594 @@
/*
* Copyright (c) 2000-2018 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* attr.h - attribute data structures and interfaces
*
* Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved.
*/
#ifndef _SYS_ATTR_H_
#define _SYS_ATTR_H_
#include <sys/appleapiopts.h>
#ifdef __APPLE_API_UNSTABLE
#include <sys/types.h>
#include <sys/ucred.h>
#include <sys/time.h>
#include <sys/cdefs.h>
#define FSOPT_NOFOLLOW 0x00000001
#define FSOPT_NOINMEMUPDATE 0x00000002
#define FSOPT_REPORT_FULLSIZE 0x00000004
/* The following option only valid when requesting ATTR_CMN_RETURNED_ATTRS */
#define FSOPT_PACK_INVAL_ATTRS 0x00000008
#define FSOPT_ATTR_CMN_EXTENDED 0x00000020
#define FSOPT_RETURN_REALDEV 0x00000200
#define FSOPT_NOFOLLOW_ANY 0x00000800
/* we currently aren't anywhere near this amount for a valid
* fssearchblock.sizeofsearchparams1 or fssearchblock.sizeofsearchparams2
* but we put a sanity check in to avoid abuse of the value passed in from
* user land.
*/
#define SEARCHFS_MAX_SEARCHPARMS 4096
typedef u_int32_t text_encoding_t;
typedef u_int32_t fsobj_type_t;
typedef u_int32_t fsobj_tag_t;
typedef u_int32_t fsfile_type_t;
typedef u_int32_t fsvolid_t;
#include <sys/_types/_fsobj_id_t.h> /* file object id type */
typedef u_int32_t attrgroup_t;
struct attrlist {
u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */
u_int16_t reserved; /* (to maintain 4-byte alignment) */
attrgroup_t commonattr; /* common attribute group */
attrgroup_t volattr; /* Volume attribute group */
attrgroup_t dirattr; /* directory attribute group */
attrgroup_t fileattr; /* file attribute group */
attrgroup_t forkattr; /* fork attribute group */
};
#define ATTR_BIT_MAP_COUNT 5
typedef struct attribute_set {
attrgroup_t commonattr; /* common attribute group */
attrgroup_t volattr; /* Volume attribute group */
attrgroup_t dirattr; /* directory attribute group */
attrgroup_t fileattr; /* file attribute group */
attrgroup_t forkattr; /* fork attribute group */
} attribute_set_t;
#define ATTRIBUTE_SET_INIT(a) do {(a)->commonattr = (a)->volattr = (a)->dirattr = (a)->fileattr = (a)->forkattr = 0; } while(0)
typedef struct attrreference {
int32_t attr_dataoffset;
u_int32_t attr_length;
} attrreference_t;
/* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */
struct diskextent {
u_int32_t startblock; /* first block allocated */
u_int32_t blockcount; /* number of blocks allocated */
};
typedef struct diskextent extentrecord[8];
typedef u_int32_t vol_capabilities_set_t[4];
#define VOL_CAPABILITIES_FORMAT 0
#define VOL_CAPABILITIES_INTERFACES 1
#define VOL_CAPABILITIES_RESERVED1 2
#define VOL_CAPABILITIES_RESERVED2 3
typedef struct vol_capabilities_attr {
vol_capabilities_set_t capabilities;
vol_capabilities_set_t valid;
} vol_capabilities_attr_t;
/*
* XXX this value needs to be raised - 3893388
*/
#define ATTR_MAX_BUFFER 8192
/*
* VOL_CAP_FMT_PERSISTENTOBJECTIDS: When set, the volume has object IDs
* that are persistent (retain their values even when the volume is
* unmounted and remounted), and a file or directory can be looked up
* by ID. Volumes that support VolFS and can support Carbon File ID
* references should set this bit.
*
* VOL_CAP_FMT_SYMBOLICLINKS: When set, the volume supports symbolic
* links. The symlink(), readlink(), and lstat() calls all use this
* symbolic link.
*
* VOL_CAP_FMT_HARDLINKS: When set, the volume supports hard links.
* The link() call creates hard links.
*
* VOL_CAP_FMT_JOURNAL: When set, the volume is capable of supporting
* a journal used to speed recovery in case of unplanned shutdown
* (such as a power outage or crash). This bit does not necessarily
* mean the volume is actively using a journal for recovery.
*
* VOL_CAP_FMT_JOURNAL_ACTIVE: When set, the volume is currently using
* a journal for use in speeding recovery after an unplanned shutdown.
* This bit can be set only if VOL_CAP_FMT_JOURNAL is also set.
*
* VOL_CAP_FMT_NO_ROOT_TIMES: When set, the volume format does not
* store reliable times for the root directory, so you should not
* depend on them to detect changes, etc.
*
* VOL_CAP_FMT_SPARSE_FILES: When set, the volume supports sparse files.
* That is, files which can have "holes" that have never been written
* to, and are not allocated on disk. Sparse files may have an
* allocated size that is less than the file's logical length.
*
* VOL_CAP_FMT_ZERO_RUNS: For security reasons, parts of a file (runs)
* that have never been written to must appear to contain zeroes. When
* this bit is set, the volume keeps track of allocated but unwritten
* runs of a file so that it can substitute zeroes without actually
* writing zeroes to the media. This provides performance similar to
* sparse files, but not the space savings.
*
* VOL_CAP_FMT_CASE_SENSITIVE: When set, file and directory names are
* case sensitive (upper and lower case are different). When clear,
* an upper case character is equivalent to a lower case character,
* and you can't have two names that differ solely in the case of
* the characters.
*
* VOL_CAP_FMT_CASE_PRESERVING: When set, file and directory names
* preserve the difference between upper and lower case. If clear,
* the volume may change the case of some characters (typically
* making them all upper or all lower case). A volume that sets
* VOL_CAP_FMT_CASE_SENSITIVE should also set VOL_CAP_FMT_CASE_PRESERVING.
*
* VOL_CAP_FMT_FAST_STATFS: This bit is used as a hint to upper layers
* (especially Carbon) that statfs() is fast enough that its results
* need not be cached by those upper layers. A volume that caches
* the statfs information in its in-memory structures should set this bit.
* A volume that must always read from disk or always perform a network
* transaction should not set this bit.
*
* VOL_CAP_FMT_2TB_FILESIZE: If this bit is set the volume format supports
* file sizes larger than 4GB, and potentially up to 2TB; it does not
* indicate whether the filesystem supports files larger than that.
*
* VOL_CAP_FMT_OPENDENYMODES: When set, the volume supports open deny
* modes (e.g. "open for read write, deny write"; effectively, mandatory
* file locking based on open modes).
*
* VOL_CAP_FMT_HIDDEN_FILES: When set, the volume supports the UF_HIDDEN
* file flag, and the UF_HIDDEN flag is mapped to that volume's native
* "hidden" or "invisible" bit (which may be the invisible bit from the
* Finder Info extended attribute).
*
* VOL_CAP_FMT_PATH_FROM_ID: When set, the volume supports the ability
* to derive a pathname to the root of the file system given only the
* id of an object. This also implies that object ids on this file
* system are persistent and not recycled. This is a very specialized
* capability and it is assumed that most file systems will not support
* it. Its use is for legacy non-posix APIs like ResolveFileIDRef.
*
* VOL_CAP_FMT_NO_VOLUME_SIZES: When set, the volume does not support
* returning values for total data blocks, available blocks, or free blocks
* (as in f_blocks, f_bavail, or f_bfree in "struct statfs"). Historically,
* those values were set to 0xFFFFFFFF for volumes that did not support them.
*
* VOL_CAP_FMT_DECMPFS_COMPRESSION: When set, the volume supports transparent
* decompression of compressed files using decmpfs.
*
* VOL_CAP_FMT_64BIT_OBJECT_IDS: When set, the volume uses object IDs that
* are 64-bit. This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the
* only legitimate attributes for obtaining object IDs from this volume and the
* 32-bit fid_objno fields of the fsobj_id_t returned by ATTR_CMN_OBJID,
* ATTR_CMN_OBJPERMID, and ATTR_CMN_PAROBJID are undefined.
*
* VOL_CAP_FMT_DIR_HARDLINKS: When set, the volume supports directory
* hard links.
*
* VOL_CAP_FMT_DOCUMENT_ID: When set, the volume supports document IDs
* (an ID which persists across object ID changes) for document revisions.
*
* VOL_CAP_FMT_WRITE_GENERATION_COUNT: When set, the volume supports write
* generation counts (a count of how many times an object has been modified)
*
* VOL_CAP_FMT_NO_IMMUTABLE_FILES: When set, the volume does not support
* setting the UF_IMMUTABLE flag.
*
* VOL_CAP_FMT_NO_PERMISSIONS: When set, the volume does not support setting
* permissions.
*
* VOL_CAP_FMT_SHARED_SPACE: When set, the volume supports sharing space with
* other filesystems i.e. multiple logical filesystems can exist in the same
* "partition". An implication of this is that the filesystem which sets
* this capability treats waitfor arguments to VFS_SYNC as bit flags.
*
* VOL_CAP_FMT_VOL_GROUPS: When set, this volume is part of a volume-group
* that implies multiple volumes must be mounted in order to boot and root the
* operating system. Typically, this means a read-only system volume and a
* writable data volume.
*
* VOL_CAP_FMT_SEALED: When set, this volume is cryptographically sealed.
* Any modifications to volume data or metadata will be detected and may
* render the volume unusable.
*/
#define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001
#define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002
#define VOL_CAP_FMT_HARDLINKS 0x00000004
#define VOL_CAP_FMT_JOURNAL 0x00000008
#define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010
#define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020
#define VOL_CAP_FMT_SPARSE_FILES 0x00000040
#define VOL_CAP_FMT_ZERO_RUNS 0x00000080
#define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100
#define VOL_CAP_FMT_CASE_PRESERVING 0x00000200
#define VOL_CAP_FMT_FAST_STATFS 0x00000400
#define VOL_CAP_FMT_2TB_FILESIZE 0x00000800
#define VOL_CAP_FMT_OPENDENYMODES 0x00001000
#define VOL_CAP_FMT_HIDDEN_FILES 0x00002000
#define VOL_CAP_FMT_PATH_FROM_ID 0x00004000
#define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000
#define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000
#define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000
#define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000
#define VOL_CAP_FMT_DOCUMENT_ID 0x00080000
#define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000
#define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000
#define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000
#define VOL_CAP_FMT_SHARED_SPACE 0x00800000
#define VOL_CAP_FMT_VOL_GROUPS 0x01000000
#define VOL_CAP_FMT_SEALED 0x02000000
/*
* VOL_CAP_INT_SEARCHFS: When set, the volume implements the
* searchfs() system call (the vnop_searchfs vnode operation).
*
* VOL_CAP_INT_ATTRLIST: When set, the volume implements the
* getattrlist() and setattrlist() system calls (vnop_getattrlist
* and vnop_setattrlist vnode operations) for the volume, files,
* and directories. The volume may or may not implement the
* readdirattr() system call. XXX Is there any minimum set
* of attributes that should be supported? To determine the
* set of supported attributes, get the ATTR_VOL_ATTRIBUTES
* attribute of the volume.
*
* VOL_CAP_INT_NFSEXPORT: When set, the volume implements exporting
* of NFS volumes.
*
* VOL_CAP_INT_READDIRATTR: When set, the volume implements the
* readdirattr() system call (vnop_readdirattr vnode operation).
*
* VOL_CAP_INT_EXCHANGEDATA: When set, the volume implements the
* exchangedata() system call (VNOP_EXCHANGE vnode operation).
*
* VOL_CAP_INT_COPYFILE: When set, the volume implements the
* VOP_COPYFILE vnode operation. (XXX There should be a copyfile()
* system call in <unistd.h>.)
*
* VOL_CAP_INT_ALLOCATE: When set, the volume implements the
* VNOP_ALLOCATE vnode operation, which means it implements the
* F_PREALLOCATE selector of fcntl(2).
*
* VOL_CAP_INT_VOL_RENAME: When set, the volume implements the
* ATTR_VOL_NAME attribute for both getattrlist() and setattrlist().
* The volume can be renamed by setting ATTR_VOL_NAME with setattrlist().
*
* VOL_CAP_INT_ADVLOCK: When set, the volume implements POSIX style
* byte range locks via vnop_advlock (accessible from fcntl(2)).
*
* VOL_CAP_INT_FLOCK: When set, the volume implements whole-file flock(2)
* style locks via vnop_advlock. This includes the O_EXLOCK and O_SHLOCK
* flags of the open(2) call.
*
* VOL_CAP_INT_EXTENDED_SECURITY: When set, the volume implements
* extended security (ACLs).
*
* VOL_CAP_INT_USERACCESS: When set, the volume supports the
* ATTR_CMN_USERACCESS attribute (used to get the user's access
* mode to the file).
*
* VOL_CAP_INT_MANLOCK: When set, the volume supports AFP-style
* mandatory byte range locks via an ioctl().
*
* VOL_CAP_INT_EXTENDED_ATTR: When set, the volume implements
* native extended attribues.
*
* VOL_CAP_INT_NAMEDSTREAMS: When set, the volume supports
* native named streams.
*
* VOL_CAP_INT_CLONE: When set, the volume supports clones.
*
* VOL_CAP_INT_SNAPSHOT: When set, the volume supports snapshots.
*
* VOL_CAP_INT_RENAME_SWAP: When set, the volume supports swapping
* file system objects.
*
* VOL_CAP_INT_RENAME_EXCL: When set, the volume supports an
* exclusive rename operation.
*
* VOL_CAP_INT_RENAME_OPENFAIL: When set, the volume may fail rename
* operations on files that are open.
*/
#define VOL_CAP_INT_SEARCHFS 0x00000001
#define VOL_CAP_INT_ATTRLIST 0x00000002
#define VOL_CAP_INT_NFSEXPORT 0x00000004
#define VOL_CAP_INT_READDIRATTR 0x00000008
#define VOL_CAP_INT_EXCHANGEDATA 0x00000010
#define VOL_CAP_INT_COPYFILE 0x00000020
#define VOL_CAP_INT_ALLOCATE 0x00000040
#define VOL_CAP_INT_VOL_RENAME 0x00000080
#define VOL_CAP_INT_ADVLOCK 0x00000100
#define VOL_CAP_INT_FLOCK 0x00000200
#define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400
#define VOL_CAP_INT_USERACCESS 0x00000800
#define VOL_CAP_INT_MANLOCK 0x00001000
#define VOL_CAP_INT_NAMEDSTREAMS 0x00002000
#define VOL_CAP_INT_EXTENDED_ATTR 0x00004000
#define VOL_CAP_INT_CLONE 0x00010000
#define VOL_CAP_INT_SNAPSHOT 0x00020000
#define VOL_CAP_INT_RENAME_SWAP 0x00040000
#define VOL_CAP_INT_RENAME_EXCL 0x00080000
#define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000
typedef struct vol_attributes_attr {
attribute_set_t validattr;
attribute_set_t nativeattr;
} vol_attributes_attr_t;
#define ATTR_CMN_NAME 0x00000001
#define ATTR_CMN_DEVID 0x00000002
#define ATTR_CMN_FSID 0x00000004
#define ATTR_CMN_OBJTYPE 0x00000008
#define ATTR_CMN_OBJTAG 0x00000010
#define ATTR_CMN_OBJID 0x00000020
#define ATTR_CMN_OBJPERMANENTID 0x00000040
#define ATTR_CMN_PAROBJID 0x00000080
#define ATTR_CMN_SCRIPT 0x00000100
#define ATTR_CMN_CRTIME 0x00000200
#define ATTR_CMN_MODTIME 0x00000400
#define ATTR_CMN_CHGTIME 0x00000800
#define ATTR_CMN_ACCTIME 0x00001000
#define ATTR_CMN_BKUPTIME 0x00002000
#define ATTR_CMN_FNDRINFO 0x00004000
#define ATTR_CMN_OWNERID 0x00008000
#define ATTR_CMN_GRPID 0x00010000
#define ATTR_CMN_ACCESSMASK 0x00020000
#define ATTR_CMN_FLAGS 0x00040000
/* The following were defined as: */
/* #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 */
/* #define ATTR_CMN_NAMEDATTRLIST 0x00100000 */
/* These bits have been salvaged for use as: */
/* #define ATTR_CMN_GEN_COUNT 0x00080000 */
/* #define ATTR_CMN_DOCUMENT_ID 0x00100000 */
/* They can only be used with the FSOPT_ATTR_CMN_EXTENDED */
/* option flag. */
#define ATTR_CMN_GEN_COUNT 0x00080000
#define ATTR_CMN_DOCUMENT_ID 0x00100000
#define ATTR_CMN_USERACCESS 0x00200000
#define ATTR_CMN_EXTENDED_SECURITY 0x00400000
#define ATTR_CMN_UUID 0x00800000
#define ATTR_CMN_GRPUUID 0x01000000
#define ATTR_CMN_FILEID 0x02000000
#define ATTR_CMN_PARENTID 0x04000000
#define ATTR_CMN_FULLPATH 0x08000000
#define ATTR_CMN_ADDEDTIME 0x10000000
#define ATTR_CMN_ERROR 0x20000000
#define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000
/*
* ATTR_CMN_RETURNED_ATTRS is only valid with getattrlist(2) and
* getattrlistbulk(2). It is always the first attribute in the return buffer.
*/
#define ATTR_CMN_RETURNED_ATTRS 0x80000000
#define ATTR_CMN_VALIDMASK 0xFFFFFFFF
/*
* The settable ATTR_CMN_* attributes include the following:
* ATTR_CMN_SCRIPT
* ATTR_CMN_CRTIME
* ATTR_CMN_MODTIME
* ATTR_CMN_CHGTIME
*
* ATTR_CMN_ACCTIME
* ATTR_CMN_BKUPTIME
* ATTR_CMN_FNDRINFO
* ATTR_CMN_OWNERID
*
* ATTR_CMN_GRPID
* ATTR_CMN_ACCESSMASK
* ATTR_CMN_FLAGS
*
* ATTR_CMN_EXTENDED_SECURITY
* ATTR_CMN_UUID
*
* ATTR_CMN_GRPUUID
*
* ATTR_CMN_DATA_PROTECT_FLAGS
*/
#define ATTR_CMN_SETMASK 0x51C7FF00
#define ATTR_CMN_VOLSETMASK 0x00006700
#define ATTR_VOL_FSTYPE 0x00000001
#define ATTR_VOL_SIGNATURE 0x00000002
#define ATTR_VOL_SIZE 0x00000004
#define ATTR_VOL_SPACEFREE 0x00000008
#define ATTR_VOL_SPACEAVAIL 0x00000010
#define ATTR_VOL_MINALLOCATION 0x00000020
#define ATTR_VOL_ALLOCATIONCLUMP 0x00000040
#define ATTR_VOL_IOBLOCKSIZE 0x00000080
#define ATTR_VOL_OBJCOUNT 0x00000100
#define ATTR_VOL_FILECOUNT 0x00000200
#define ATTR_VOL_DIRCOUNT 0x00000400
#define ATTR_VOL_MAXOBJCOUNT 0x00000800
#define ATTR_VOL_MOUNTPOINT 0x00001000
#define ATTR_VOL_NAME 0x00002000
#define ATTR_VOL_MOUNTFLAGS 0x00004000
#define ATTR_VOL_MOUNTEDDEVICE 0x00008000
#define ATTR_VOL_ENCODINGSUSED 0x00010000
#define ATTR_VOL_CAPABILITIES 0x00020000
#define ATTR_VOL_UUID 0x00040000
#define ATTR_VOL_FSTYPENAME 0x00100000
#define ATTR_VOL_FSSUBTYPE 0x00200000
#define ATTR_VOL_SPACEUSED 0x00800000
#define ATTR_VOL_QUOTA_SIZE 0x10000000
#define ATTR_VOL_RESERVED_SIZE 0x20000000
#define ATTR_VOL_ATTRIBUTES 0x40000000
#define ATTR_VOL_INFO 0x80000000
#define ATTR_VOL_VALIDMASK 0xF0B7FFFF
/*
* The list of settable ATTR_VOL_* attributes include the following:
* ATTR_VOL_NAME
* ATTR_VOL_INFO
*/
#define ATTR_VOL_SETMASK 0x80002000
/* File/directory attributes: */
#define ATTR_DIR_LINKCOUNT 0x00000001
#define ATTR_DIR_ENTRYCOUNT 0x00000002
#define ATTR_DIR_MOUNTSTATUS 0x00000004
#define ATTR_DIR_ALLOCSIZE 0x00000008
#define ATTR_DIR_IOBLOCKSIZE 0x00000010
#define ATTR_DIR_DATALENGTH 0x00000020
/* ATTR_DIR_MOUNTSTATUS Flags: */
#define DIR_MNTSTATUS_MNTPOINT 0x00000001
#define DIR_MNTSTATUS_TRIGGER 0x00000002
#define ATTR_DIR_VALIDMASK 0x0000003f
#define ATTR_DIR_SETMASK 0x00000000
#define ATTR_FILE_LINKCOUNT 0x00000001
#define ATTR_FILE_TOTALSIZE 0x00000002
#define ATTR_FILE_ALLOCSIZE 0x00000004
#define ATTR_FILE_IOBLOCKSIZE 0x00000008
#define ATTR_FILE_DEVTYPE 0x00000020
#define ATTR_FILE_FORKCOUNT 0x00000080
#define ATTR_FILE_FORKLIST 0x00000100
#define ATTR_FILE_DATALENGTH 0x00000200
#define ATTR_FILE_DATAALLOCSIZE 0x00000400
#define ATTR_FILE_RSRCLENGTH 0x00001000
#define ATTR_FILE_RSRCALLOCSIZE 0x00002000
#define ATTR_FILE_VALIDMASK 0x000037FF
/*
* Settable ATTR_FILE_* attributes include:
* ATTR_FILE_DEVTYPE
*/
#define ATTR_FILE_SETMASK 0x00000020
/* CMNEXT attributes extend the common attributes, but in the forkattr field */
#define ATTR_CMNEXT_RELPATH 0x00000004
#define ATTR_CMNEXT_PRIVATESIZE 0x00000008
#define ATTR_CMNEXT_LINKID 0x00000010
#define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020
#define ATTR_CMNEXT_REALDEVID 0x00000040
#define ATTR_CMNEXT_REALFSID 0x00000080
#define ATTR_CMNEXT_CLONEID 0x00000100
#define ATTR_CMNEXT_EXT_FLAGS 0x00000200
#define ATTR_CMNEXT_RECURSIVE_GENCOUNT 0x00000400
#define ATTR_CMNEXT_VALIDMASK 0x000007fc
#define ATTR_CMNEXT_SETMASK 0x00000000
/* Deprecated fork attributes */
#define ATTR_FORK_TOTALSIZE 0x00000001
#define ATTR_FORK_ALLOCSIZE 0x00000002
#define ATTR_FORK_RESERVED 0xffffffff
#define ATTR_FORK_VALIDMASK 0x00000003
#define ATTR_FORK_SETMASK 0x00000000
/* Obsolete, implemented, not supported */
#define ATTR_CMN_NAMEDATTRCOUNT 0x00080000
#define ATTR_CMN_NAMEDATTRLIST 0x00100000
#define ATTR_FILE_CLUMPSIZE 0x00000010 /* obsolete */
#define ATTR_FILE_FILETYPE 0x00000040 /* always zero */
#define ATTR_FILE_DATAEXTENTS 0x00000800 /* obsolete, HFS-specific */
#define ATTR_FILE_RSRCEXTENTS 0x00004000 /* obsolete, HFS-specific */
/* Required attributes for getattrlistbulk(2) */
#define ATTR_BULK_REQUIRED (ATTR_CMN_NAME | ATTR_CMN_RETURNED_ATTRS)
/*
* Searchfs
*/
#define SRCHFS_START 0x00000001
#define SRCHFS_MATCHPARTIALNAMES 0x00000002
#define SRCHFS_MATCHDIRS 0x00000004
#define SRCHFS_MATCHFILES 0x00000008
#define SRCHFS_SKIPLINKS 0x00000010
#define SRCHFS_SKIPINVISIBLE 0x00000020
#define SRCHFS_SKIPPACKAGES 0x00000040
#define SRCHFS_SKIPINAPPROPRIATE 0x00000080
#define SRCHFS_NEGATEPARAMS 0x80000000
#define SRCHFS_VALIDOPTIONSMASK 0x800000FF
struct fssearchblock {
struct attrlist *returnattrs;
void *returnbuffer;
size_t returnbuffersize;
u_long maxmatches;
struct timeval timelimit;
void *searchparams1;
size_t sizeofsearchparams1;
void *searchparams2;
size_t sizeofsearchparams2;
struct attrlist searchattrs;
};
struct searchstate {
uint32_t ss_union_flags; // for SRCHFS_START
uint32_t ss_union_layer; // 0 = top
u_char ss_fsstate[548]; // fs private
} __attribute__((packed));
#define FST_EOF (-1) /* end-of-file offset */
#endif /* __APPLE_API_UNSTABLE */
#endif /* !_SYS_ATTR_H_ */

View File

@@ -0,0 +1,265 @@
/*
* Copyright (c) 2000-2020 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
/*-
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)mman.h 8.1 (Berkeley) 6/2/93
*/
/*
* Currently unsupported:
*
* [TYM] POSIX_TYPED_MEM_ALLOCATE
* [TYM] POSIX_TYPED_MEM_ALLOCATE_CONTIG
* [TYM] POSIX_TYPED_MEM_MAP_ALLOCATABLE
* [TYM] struct posix_typed_mem_info
* [TYM] posix_mem_offset()
* [TYM] posix_typed_mem_get_info()
* [TYM] posix_typed_mem_open()
*/
#ifndef _SYS_MMAN_H_
#define _SYS_MMAN_H_
#include <sys/appleapiopts.h>
#include <sys/cdefs.h>
#include <sys/_types.h>
/*
* [various] The mode_t, off_t, and size_t types shall be defined as
* described in <sys/types.h>
*/
#include <sys/_types/_mode_t.h>
#include <sys/_types/_off_t.h>
#include <sys/_types/_size_t.h>
#if __DARWIN_C_LEVEL >= 200809L
#include <Availability.h>
#endif /* __DARWIN_C_LEVEL */
/*
* Protections are chosen from these bits, or-ed together
*/
#define PROT_NONE 0x00 /* [MC2] no permissions */
#define PROT_READ 0x01 /* [MC2] pages can be read */
#define PROT_WRITE 0x02 /* [MC2] pages can be written */
#define PROT_EXEC 0x04 /* [MC2] pages can be executed */
/*
* Flags contain sharing type and options.
* Sharing types; choose one.
*/
#define MAP_SHARED 0x0001 /* [MF|SHM] share changes */
#define MAP_PRIVATE 0x0002 /* [MF|SHM] changes are private */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define MAP_COPY MAP_PRIVATE /* Obsolete */
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/*
* Other flags
*/
#define MAP_FIXED 0x0010 /* [MF|SHM] interpret addr exactly */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */
#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */
#define MAP_RESERVED0080 0x0080 /* previously unimplemented MAP_INHERIT */
#define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */
#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
#define MAP_NOCACHE 0x0400 /* don't cache pages for this mapping */
#define MAP_JIT 0x0800 /* Allocate a region that will be used for JIT purposes */
/*
* Mapping type
*/
#define MAP_FILE 0x0000 /* map from file (default) */
#define MAP_ANON 0x1000 /* allocated from memory, swap space */
#define MAP_ANONYMOUS MAP_ANON
/*
* The MAP_RESILIENT_* flags can be used when the caller wants to map some
* possibly unreliable memory and be able to access it safely, possibly
* getting the wrong contents rather than raising any exception.
* For safety reasons, such mappings have to be read-only (PROT_READ access
* only).
*
* MAP_RESILIENT_CODESIGN:
* accessing this mapping will not generate code-signing violations,
* even if the contents are tainted.
* MAP_RESILIENT_MEDIA:
* accessing this mapping will not generate an exception if the contents
* are not available (unreachable removable or remote media, access beyond
* end-of-file, ...). Missing contents will be replaced with zeroes.
*/
#define MAP_RESILIENT_CODESIGN 0x2000 /* no code-signing failures */
#define MAP_RESILIENT_MEDIA 0x4000 /* no backing-store failures */
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
#define MAP_32BIT 0x8000 /* Return virtual addresses <4G only */
#endif /* defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500 */
/*
* Flags used to support translated processes.
*/
#define MAP_TRANSLATED_ALLOW_EXECUTE 0x20000 /* allow execute in translated processes */
#define MAP_UNIX03 0x40000 /* UNIX03 compliance */
#define MAP_TPRO 0x80000 /* Allocate a region that will be protected by TPRO */
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/*
* Process memory locking
*/
#define MCL_CURRENT 0x0001 /* [ML] Lock only current memory */
#define MCL_FUTURE 0x0002 /* [ML] Lock all future memory as well */
/*
* Error return from mmap()
*/
#define MAP_FAILED ((void *)-1) /* [MF|SHM] mmap failed */
/*
* msync() flags
*/
#define MS_ASYNC 0x0001 /* [MF|SIO] return immediately */
#define MS_INVALIDATE 0x0002 /* [MF|SIO] invalidate all cached data */
#define MS_SYNC 0x0010 /* [MF|SIO] msync synchronously */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define MS_KILLPAGES 0x0004 /* invalidate pages, leave mapped */
#define MS_DEACTIVATE 0x0008 /* deactivate pages, leave mapped */
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/*
* Advice to madvise
*/
#define POSIX_MADV_NORMAL 0 /* [MC1] no further special treatment */
#define POSIX_MADV_RANDOM 1 /* [MC1] expect random page refs */
#define POSIX_MADV_SEQUENTIAL 2 /* [MC1] expect sequential page refs */
#define POSIX_MADV_WILLNEED 3 /* [MC1] will need these pages */
#define POSIX_MADV_DONTNEED 4 /* [MC1] dont need these pages */
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define MADV_NORMAL POSIX_MADV_NORMAL
#define MADV_RANDOM POSIX_MADV_RANDOM
#define MADV_SEQUENTIAL POSIX_MADV_SEQUENTIAL
#define MADV_WILLNEED POSIX_MADV_WILLNEED
#define MADV_DONTNEED POSIX_MADV_DONTNEED
#define MADV_FREE 5 /* pages unneeded, discard contents */
#define MADV_ZERO_WIRED_PAGES 6 /* zero the wired pages that have not been unwired before the entry is deleted */
#define MADV_FREE_REUSABLE 7 /* pages can be reused (by anyone) */
#define MADV_FREE_REUSE 8 /* caller wants to reuse those pages */
#define MADV_CAN_REUSE 9
#define MADV_PAGEOUT 10 /* page out now (internal only) */
/*
* Return bits from mincore
*/
#define MINCORE_INCORE 0x1 /* Page is incore */
#define MINCORE_REFERENCED 0x2 /* Page has been referenced by us */
#define MINCORE_MODIFIED 0x4 /* Page has been modified by us */
#define MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */
#define MINCORE_MODIFIED_OTHER 0x10 /* Page has been modified */
#define MINCORE_PAGED_OUT 0x20 /* Page has been paged out */
#define MINCORE_COPIED 0x40 /* Page has been copied */
#define MINCORE_ANONYMOUS 0x80 /* Page belongs to an anonymous object */
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
__BEGIN_DECLS
/* [ML] */
int mlockall(int);
int munlockall(void);
/* [MR] */
int mlock(const void *, size_t);
#ifndef _MMAP
#define _MMAP
/* [MC3]*/
void * mmap(void *, size_t, int, int, int, off_t) __DARWIN_ALIAS(mmap);
#endif
/* [MPR] */
int mprotect(void *, size_t, int) __DARWIN_ALIAS(mprotect);
/* [MF|SIO] */
int msync(void *, size_t, int) __DARWIN_ALIAS_C(msync);
/* [MR] */
int munlock(const void *, size_t);
/* [MC3]*/
int munmap(void *, size_t) __DARWIN_ALIAS(munmap);
/* [SHM] */
int shm_open(const char *, int, ...);
int shm_unlink(const char *);
/* [ADV] */
int posix_madvise(void *, size_t, int);
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
int madvise(void *, size_t, int);
int mincore(const void *, size_t, char *);
int minherit(void *, size_t, int);
#endif
__END_DECLS
#endif /* !_SYS_MMAN_H_ */

View File

@@ -404,12 +404,27 @@ struct fhandle {
};
typedef struct fhandle fhandle_t;
/*
* Cryptex authentication
* Note: these 2 enums are used in conjunction, graftdmg_type is used for authentication while grafting
* cryptexes and cryptex_auth_type is currently used for authentication while mounting generic
* cryptexes. We need to make sure we do not use the reserved values in each for a new authentication type.
*/
OS_ENUM(graftdmg_type, uint32_t,
GRAFTDMG_CRYPTEX_BOOT = 1,
GRAFTDMG_CRYPTEX_PREBOOT = 2,
GRAFTDMG_CRYPTEX_DOWNLEVEL = 3);
GRAFTDMG_CRYPTEX_DOWNLEVEL = 3
// Reserved: CRYPTEX1_AUTH_ENV_GENERIC = 4,
// Reserved: CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL = 5
);
OS_ENUM(cryptex_auth_type, uint32_t,
// Reserved: GRAFTDMG_CRYPTEX_BOOT = 1,
// Reserved: GRAFTDMG_CRYPTEX_PREBOOT = 2,
// Reserved: GRAFTDMG_CRYPTEX_DOWNLEVEL = 3,
CRYPTEX1_AUTH_ENV_GENERIC = 4,
CRYPTEX1_AUTH_ENV_GENERIC_SUPPLEMENTAL = 5);
__BEGIN_DECLS

1381
lib/libc/include/any-macos.13-any/tgmath.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,791 @@
/*
* Copyright (c) 2000, 2002-2006, 2008-2010, 2012 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*-
* Copyright (c) 1998-1999 Apple Computer, Inc. All Rights Reserved
* Copyright (c) 1991, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)unistd.h 8.12 (Berkeley) 4/27/95
*
* Copyright (c) 1998 Apple Compter, Inc.
* All Rights Reserved
*/
/* History:
7/14/99 EKN at Apple fixed getdirentriesattr from getdirentryattr
3/26/98 CHW at Apple added real interface to searchfs call
3/5/98 CHW at Apple added hfs semantic system calls headers
*/
#ifndef _UNISTD_H_
#define _UNISTD_H_
#include <_types.h>
#include <sys/unistd.h>
#include <Availability.h>
#include <sys/_types/_gid_t.h>
#include <sys/_types/_intptr_t.h>
#include <sys/_types/_off_t.h>
#include <sys/_types/_pid_t.h>
/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
* _GCC_SIZE_T */
#include <sys/_types/_size_t.h>
#include <sys/_types/_ssize_t.h>
#include <sys/_types/_uid_t.h>
#include <sys/_types/_useconds_t.h>
#include <sys/_types/_null.h>
#define STDIN_FILENO 0 /* standard input file descriptor */
#define STDOUT_FILENO 1 /* standard output file descriptor */
#define STDERR_FILENO 2 /* standard error file descriptor */
/* Version test macros */
/* _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h */
#define _XOPEN_VERSION 600 /* [XSI] */
#define _XOPEN_XCU_VERSION 4 /* Older standard */
/* Please keep this list in the same order as the applicable standard */
#define _POSIX_ADVISORY_INFO (-1) /* [ADV] */
#define _POSIX_ASYNCHRONOUS_IO (-1) /* [AIO] */
#define _POSIX_BARRIERS (-1) /* [BAR] */
#define _POSIX_CHOWN_RESTRICTED 200112L
#define _POSIX_CLOCK_SELECTION (-1) /* [CS] */
#define _POSIX_CPUTIME (-1) /* [CPT] */
#define _POSIX_FSYNC 200112L /* [FSC] */
#define _POSIX_IPV6 200112L
#define _POSIX_JOB_CONTROL 200112L
#define _POSIX_MAPPED_FILES 200112L /* [MF] */
#define _POSIX_MEMLOCK (-1) /* [ML] */
#define _POSIX_MEMLOCK_RANGE (-1) /* [MR] */
#define _POSIX_MEMORY_PROTECTION 200112L /* [MPR] */
#define _POSIX_MESSAGE_PASSING (-1) /* [MSG] */
#define _POSIX_MONOTONIC_CLOCK (-1) /* [MON] */
#define _POSIX_NO_TRUNC 200112L
#define _POSIX_PRIORITIZED_IO (-1) /* [PIO] */
#define _POSIX_PRIORITY_SCHEDULING (-1) /* [PS] */
#define _POSIX_RAW_SOCKETS (-1) /* [RS] */
#define _POSIX_READER_WRITER_LOCKS 200112L /* [THR] */
#define _POSIX_REALTIME_SIGNALS (-1) /* [RTS] */
#define _POSIX_REGEXP 200112L
#define _POSIX_SAVED_IDS 200112L /* XXX required */
#define _POSIX_SEMAPHORES (-1) /* [SEM] */
#define _POSIX_SHARED_MEMORY_OBJECTS (-1) /* [SHM] */
#define _POSIX_SHELL 200112L
#define _POSIX_SPAWN 200112L /* [SPN] */
#define _POSIX_SPIN_LOCKS (-1) /* [SPI] */
#define _POSIX_SPORADIC_SERVER (-1) /* [SS] */
#define _POSIX_SYNCHRONIZED_IO (-1) /* [SIO] */
#define _POSIX_THREAD_ATTR_STACKADDR 200112L /* [TSA] */
#define _POSIX_THREAD_ATTR_STACKSIZE 200112L /* [TSS] */
#define _POSIX_THREAD_CPUTIME (-1) /* [TCT] */
#define _POSIX_THREAD_PRIO_INHERIT (-1) /* [TPI] */
#define _POSIX_THREAD_PRIO_PROTECT (-1) /* [TPP] */
#define _POSIX_THREAD_PRIORITY_SCHEDULING (-1) /* [TPS] */
#define _POSIX_THREAD_PROCESS_SHARED 200112L /* [TSH] */
#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L /* [TSF] */
#define _POSIX_THREAD_SPORADIC_SERVER (-1) /* [TSP] */
#define _POSIX_THREADS 200112L /* [THR] */
#define _POSIX_TIMEOUTS (-1) /* [TMO] */
#define _POSIX_TIMERS (-1) /* [TMR] */
#define _POSIX_TRACE (-1) /* [TRC] */
#define _POSIX_TRACE_EVENT_FILTER (-1) /* [TEF] */
#define _POSIX_TRACE_INHERIT (-1) /* [TRI] */
#define _POSIX_TRACE_LOG (-1) /* [TRL] */
#define _POSIX_TYPED_MEMORY_OBJECTS (-1) /* [TYM] */
#ifndef _POSIX_VDISABLE
#define _POSIX_VDISABLE 0xff /* same as sys/termios.h */
#endif /* _POSIX_VDISABLE */
#if __DARWIN_C_LEVEL >= 199209L
#define _POSIX2_C_BIND 200112L
#define _POSIX2_C_DEV 200112L /* c99 command */
#define _POSIX2_CHAR_TERM 200112L
#define _POSIX2_FORT_DEV (-1) /* fort77 command */
#define _POSIX2_FORT_RUN 200112L
#define _POSIX2_LOCALEDEF 200112L /* localedef command */
#define _POSIX2_PBS (-1)
#define _POSIX2_PBS_ACCOUNTING (-1)
#define _POSIX2_PBS_CHECKPOINT (-1)
#define _POSIX2_PBS_LOCATE (-1)
#define _POSIX2_PBS_MESSAGE (-1)
#define _POSIX2_PBS_TRACK (-1)
#define _POSIX2_SW_DEV 200112L
#define _POSIX2_UPE 200112L /* XXXX no fc, newgrp, tabs */
#endif /* __DARWIN_C_LEVEL */
#define __ILP32_OFF32 (-1)
#define __ILP32_OFFBIG (-1)
#define __LP64_OFF64 (1)
#define __LPBIG_OFFBIG (1)
#if __DARWIN_C_LEVEL >= 200112L
#define _POSIX_V6_ILP32_OFF32 __ILP32_OFF32
#define _POSIX_V6_ILP32_OFFBIG __ILP32_OFFBIG
#define _POSIX_V6_LP64_OFF64 __LP64_OFF64
#define _POSIX_V6_LPBIG_OFFBIG __LPBIG_OFFBIG
#endif /* __DARWIN_C_LEVEL >= 200112L */
#if __DARWIN_C_LEVEL >= 200809L
#define _POSIX_V7_ILP32_OFF32 __ILP32_OFF32
#define _POSIX_V7_ILP32_OFFBIG __ILP32_OFFBIG
#define _POSIX_V7_LP64_OFF64 __LP64_OFF64
#define _POSIX_V7_LPBIG_OFFBIG __LPBIG_OFFBIG
#endif /* __DARWIN_C_LEVEL >= 200809L */
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define _V6_ILP32_OFF32 __ILP32_OFF32
#define _V6_ILP32_OFFBIG __ILP32_OFFBIG
#define _V6_LP64_OFF64 __LP64_OFF64
#define _V6_LPBIG_OFFBIG __LPBIG_OFFBIG
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
/* Removed in Issue 7 */
#define _XBS5_ILP32_OFF32 __ILP32_OFF32
#define _XBS5_ILP32_OFFBIG __ILP32_OFFBIG
#define _XBS5_LP64_OFF64 __LP64_OFF64
#define _XBS5_LPBIG_OFFBIG __LPBIG_OFFBIG
#endif /* __DARWIN_C_LEVEL < 200809L */
#if __DARWIN_C_LEVEL >= 199506L /* This really should be XSI */
#define _XOPEN_CRYPT (1)
#define _XOPEN_ENH_I18N (1) /* XXX required */
#define _XOPEN_LEGACY (-1) /* no ftime gcvt, wcswcs */
#define _XOPEN_REALTIME (-1) /* no q'ed signals, mq_* */
#define _XOPEN_REALTIME_THREADS (-1) /* no posix_spawn, et. al. */
#define _XOPEN_SHM (1)
#define _XOPEN_STREAMS (-1) /* Issue 6 */
#define _XOPEN_UNIX (1)
#endif /* XSI */
/* configurable system variables */
#define _SC_ARG_MAX 1
#define _SC_CHILD_MAX 2
#define _SC_CLK_TCK 3
#define _SC_NGROUPS_MAX 4
#define _SC_OPEN_MAX 5
#define _SC_JOB_CONTROL 6
#define _SC_SAVED_IDS 7
#define _SC_VERSION 8
#define _SC_BC_BASE_MAX 9
#define _SC_BC_DIM_MAX 10
#define _SC_BC_SCALE_MAX 11
#define _SC_BC_STRING_MAX 12
#define _SC_COLL_WEIGHTS_MAX 13
#define _SC_EXPR_NEST_MAX 14
#define _SC_LINE_MAX 15
#define _SC_RE_DUP_MAX 16
#define _SC_2_VERSION 17
#define _SC_2_C_BIND 18
#define _SC_2_C_DEV 19
#define _SC_2_CHAR_TERM 20
#define _SC_2_FORT_DEV 21
#define _SC_2_FORT_RUN 22
#define _SC_2_LOCALEDEF 23
#define _SC_2_SW_DEV 24
#define _SC_2_UPE 25
#define _SC_STREAM_MAX 26
#define _SC_TZNAME_MAX 27
#if __DARWIN_C_LEVEL >= 199309L
#define _SC_ASYNCHRONOUS_IO 28
#define _SC_PAGESIZE 29
#define _SC_MEMLOCK 30
#define _SC_MEMLOCK_RANGE 31
#define _SC_MEMORY_PROTECTION 32
#define _SC_MESSAGE_PASSING 33
#define _SC_PRIORITIZED_IO 34
#define _SC_PRIORITY_SCHEDULING 35
#define _SC_REALTIME_SIGNALS 36
#define _SC_SEMAPHORES 37
#define _SC_FSYNC 38
#define _SC_SHARED_MEMORY_OBJECTS 39
#define _SC_SYNCHRONIZED_IO 40
#define _SC_TIMERS 41
#define _SC_AIO_LISTIO_MAX 42
#define _SC_AIO_MAX 43
#define _SC_AIO_PRIO_DELTA_MAX 44
#define _SC_DELAYTIMER_MAX 45
#define _SC_MQ_OPEN_MAX 46
#define _SC_MAPPED_FILES 47 /* swap _SC_PAGESIZE vs. BSD */
#define _SC_RTSIG_MAX 48
#define _SC_SEM_NSEMS_MAX 49
#define _SC_SEM_VALUE_MAX 50
#define _SC_SIGQUEUE_MAX 51
#define _SC_TIMER_MAX 52
#endif /* __DARWIN_C_LEVEL >= 199309L */
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define _SC_NPROCESSORS_CONF 57
#define _SC_NPROCESSORS_ONLN 58
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
#if __DARWIN_C_LEVEL >= 200112L
#define _SC_2_PBS 59
#define _SC_2_PBS_ACCOUNTING 60
#define _SC_2_PBS_CHECKPOINT 61
#define _SC_2_PBS_LOCATE 62
#define _SC_2_PBS_MESSAGE 63
#define _SC_2_PBS_TRACK 64
#define _SC_ADVISORY_INFO 65
#define _SC_BARRIERS 66
#define _SC_CLOCK_SELECTION 67
#define _SC_CPUTIME 68
#define _SC_FILE_LOCKING 69
#define _SC_GETGR_R_SIZE_MAX 70
#define _SC_GETPW_R_SIZE_MAX 71
#define _SC_HOST_NAME_MAX 72
#define _SC_LOGIN_NAME_MAX 73
#define _SC_MONOTONIC_CLOCK 74
#define _SC_MQ_PRIO_MAX 75
#define _SC_READER_WRITER_LOCKS 76
#define _SC_REGEXP 77
#define _SC_SHELL 78
#define _SC_SPAWN 79
#define _SC_SPIN_LOCKS 80
#define _SC_SPORADIC_SERVER 81
#define _SC_THREAD_ATTR_STACKADDR 82
#define _SC_THREAD_ATTR_STACKSIZE 83
#define _SC_THREAD_CPUTIME 84
#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85
#define _SC_THREAD_KEYS_MAX 86
#define _SC_THREAD_PRIO_INHERIT 87
#define _SC_THREAD_PRIO_PROTECT 88
#define _SC_THREAD_PRIORITY_SCHEDULING 89
#define _SC_THREAD_PROCESS_SHARED 90
#define _SC_THREAD_SAFE_FUNCTIONS 91
#define _SC_THREAD_SPORADIC_SERVER 92
#define _SC_THREAD_STACK_MIN 93
#define _SC_THREAD_THREADS_MAX 94
#define _SC_TIMEOUTS 95
#define _SC_THREADS 96
#define _SC_TRACE 97
#define _SC_TRACE_EVENT_FILTER 98
#define _SC_TRACE_INHERIT 99
#define _SC_TRACE_LOG 100
#define _SC_TTY_NAME_MAX 101
#define _SC_TYPED_MEMORY_OBJECTS 102
#define _SC_V6_ILP32_OFF32 103
#define _SC_V6_ILP32_OFFBIG 104
#define _SC_V6_LP64_OFF64 105
#define _SC_V6_LPBIG_OFFBIG 106
#define _SC_IPV6 118
#define _SC_RAW_SOCKETS 119
#define _SC_SYMLOOP_MAX 120
#endif /* __DARWIN_C_LEVEL >= 200112L */
#if __DARWIN_C_LEVEL >= 199506L /* Really XSI */
#define _SC_ATEXIT_MAX 107
#define _SC_IOV_MAX 56
#define _SC_PAGE_SIZE _SC_PAGESIZE
#define _SC_XOPEN_CRYPT 108
#define _SC_XOPEN_ENH_I18N 109
#define _SC_XOPEN_LEGACY 110 /* Issue 6 */
#define _SC_XOPEN_REALTIME 111 /* Issue 6 */
#define _SC_XOPEN_REALTIME_THREADS 112 /* Issue 6 */
#define _SC_XOPEN_SHM 113
#define _SC_XOPEN_STREAMS 114 /* Issue 6 */
#define _SC_XOPEN_UNIX 115
#define _SC_XOPEN_VERSION 116
#define _SC_XOPEN_XCU_VERSION 121
#endif /* XSI */
#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
/* Removed in Issue 7 */
#define _SC_XBS5_ILP32_OFF32 122
#define _SC_XBS5_ILP32_OFFBIG 123
#define _SC_XBS5_LP64_OFF64 124
#define _SC_XBS5_LPBIG_OFFBIG 125
#endif /* __DARWIN_C_LEVEL <= 200809L */
#if __DARWIN_C_LEVEL >= 200112L
#define _SC_SS_REPL_MAX 126
#define _SC_TRACE_EVENT_NAME_MAX 127
#define _SC_TRACE_NAME_MAX 128
#define _SC_TRACE_SYS_MAX 129
#define _SC_TRACE_USER_EVENT_MAX 130
#endif
#if __DARWIN_C_LEVEL < 200112L || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
/* Removed in Issue 6 */
#define _SC_PASS_MAX 131
#endif
/* 132-199 available for future use */
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define _SC_PHYS_PAGES 200
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
#if __DARWIN_C_LEVEL >= 199209L
#ifndef _CS_PATH /* Defined in <sys/unistd.h> */
#define _CS_PATH 1
#endif
#endif
#if __DARWIN_C_LEVEL >= 200112
#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
#define _CS_POSIX_V6_LP64_OFF64_LIBS 10
#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
#endif
#if (__DARWIN_C_LEVEL >= 199506L && __DARWIN_C_LEVEL < 200809L) || __DARWIN_C_LEVEL >= __DARWIN_C_FULL
/* Removed in Issue 7 */
#define _CS_XBS5_ILP32_OFF32_CFLAGS 20
#define _CS_XBS5_ILP32_OFF32_LDFLAGS 21
#define _CS_XBS5_ILP32_OFF32_LIBS 22
#define _CS_XBS5_ILP32_OFF32_LINTFLAGS 23
#define _CS_XBS5_ILP32_OFFBIG_CFLAGS 24
#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 25
#define _CS_XBS5_ILP32_OFFBIG_LIBS 26
#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 27
#define _CS_XBS5_LP64_OFF64_CFLAGS 28
#define _CS_XBS5_LP64_OFF64_LDFLAGS 29
#define _CS_XBS5_LP64_OFF64_LIBS 30
#define _CS_XBS5_LP64_OFF64_LINTFLAGS 31
#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 32
#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 33
#define _CS_XBS5_LPBIG_OFFBIG_LIBS 34
#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 35
#endif
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define _CS_DARWIN_USER_DIR 65536
#define _CS_DARWIN_USER_TEMP_DIR 65537
#define _CS_DARWIN_USER_CACHE_DIR 65538
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
#ifdef _DARWIN_UNLIMITED_GETGROUPS
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -miphoneos-version-min version does not support it."
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6
#error "_DARWIN_UNLIMITED_GETGROUPS specified, but -mmacosx-version-min version does not support it."
#endif
#endif
/* POSIX.1-1990 */
__BEGIN_DECLS
void _exit(int) __dead2;
int access(const char *, int);
unsigned int
alarm(unsigned int);
int chdir(const char *);
int chown(const char *, uid_t, gid_t);
int close(int) __DARWIN_ALIAS_C(close);
int dup(int);
int dup2(int, int);
int execl(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
int execle(const char * __path, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
int execlp(const char * __file, const char * __arg0, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
int execv(const char * __path, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
int execve(const char * __file, char * const * __argv, char * const * __envp) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
int execvp(const char * __file, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
pid_t fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
long fpathconf(int, int);
char *getcwd(char *, size_t);
gid_t getegid(void);
uid_t geteuid(void);
gid_t getgid(void);
#if defined(_DARWIN_UNLIMITED_GETGROUPS) || defined(_DARWIN_C_SOURCE)
int getgroups(int, gid_t []) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_3_2, __DARWIN_EXTSN(getgroups));
#else /* !_DARWIN_UNLIMITED_GETGROUPS && !_DARWIN_C_SOURCE */
int getgroups(int, gid_t []);
#endif /* _DARWIN_UNLIMITED_GETGROUPS || _DARWIN_C_SOURCE */
char *getlogin(void);
pid_t getpgrp(void);
pid_t getpid(void);
pid_t getppid(void);
uid_t getuid(void);
int isatty(int);
int link(const char *, const char *);
off_t lseek(int, off_t, int);
long pathconf(const char *, int);
int pause(void) __DARWIN_ALIAS_C(pause);
int pipe(int [2]);
ssize_t read(int, void *, size_t) __DARWIN_ALIAS_C(read);
int rmdir(const char *);
int setgid(gid_t);
int setpgid(pid_t, pid_t);
pid_t setsid(void);
int setuid(uid_t);
unsigned int
sleep(unsigned int) __DARWIN_ALIAS_C(sleep);
long sysconf(int);
pid_t tcgetpgrp(int);
int tcsetpgrp(int, pid_t);
char *ttyname(int);
#if __DARWIN_UNIX03
int ttyname_r(int, char *, size_t) __DARWIN_ALIAS(ttyname_r);
#else /* !__DARWIN_UNIX03 */
char *ttyname_r(int, char *, size_t);
#endif /* __DARWIN_UNIX03 */
int unlink(const char *);
ssize_t write(int __fd, const void * __buf, size_t __nbyte) __DARWIN_ALIAS_C(write);
__END_DECLS
/* Additional functionality provided by:
* POSIX.2-1992 C Language Binding Option
*/
#if __DARWIN_C_LEVEL >= 199209L
__BEGIN_DECLS
size_t confstr(int, char *, size_t) __DARWIN_ALIAS(confstr);
int getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt);
extern char *optarg; /* getopt(3) external variables */
extern int optind, opterr, optopt;
__END_DECLS
#endif /* __DARWIN_C_LEVEL >= 199209L */
/* Additional functionality provided by:
* POSIX.1c-1995,
* POSIX.1i-1995,
* and the omnibus ISO/IEC 9945-1: 1996
*/
#if __DARWIN_C_LEVEL >= 199506L
#include <_ctermid.h>
/* These F_* are really XSI or Issue 6 */
#define F_ULOCK 0 /* unlock locked section */
#define F_LOCK 1 /* lock a section for exclusive use */
#define F_TLOCK 2 /* test and lock a section for exclusive use */
#define F_TEST 3 /* test a section for locks by other procs */
__BEGIN_DECLS
/* Begin XSI */
/* Removed in Issue 6 */
#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
#if !defined(_POSIX_C_SOURCE)
__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
#endif
void *brk(const void *);
int chroot(const char *) __POSIX_C_DEPRECATED(199506L);
#endif
char *crypt(const char *, const char *);
#if __DARWIN_UNIX03
void encrypt(char *, int) __DARWIN_ALIAS(encrypt);
#else /* !__DARWIN_UNIX03 */
int encrypt(char *, int);
#endif /* __DARWIN_UNIX03 */
int fchdir(int);
long gethostid(void);
pid_t getpgid(pid_t);
pid_t getsid(pid_t);
/* Removed in Issue 6 */
#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
int getdtablesize(void) __POSIX_C_DEPRECATED(199506L);
int getpagesize(void) __pure2 __POSIX_C_DEPRECATED(199506L);
char *getpass(const char *) __POSIX_C_DEPRECATED(199506L);
#endif
/* Removed in Issue 7 */
#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L
char *getwd(char *) __POSIX_C_DEPRECATED(200112L); /* obsoleted by getcwd() */
#endif
int lchown(const char *, uid_t, gid_t) __DARWIN_ALIAS(lchown);
int lockf(int, int, off_t) __DARWIN_ALIAS_C(lockf);
int nice(int) __DARWIN_ALIAS(nice);
ssize_t pread(int __fd, void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pread);
ssize_t pwrite(int __fd, const void * __buf, size_t __nbyte, off_t __offset) __DARWIN_ALIAS_C(pwrite);
/* Removed in Issue 6 */
#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
/* Note that Issue 5 changed the argument as intprt_t,
* but we keep it as int for binary compatability. */
#if !defined(_POSIX_C_SOURCE)
__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED
#endif
void *sbrk(int);
#endif
#if __DARWIN_UNIX03
pid_t setpgrp(void) __DARWIN_ALIAS(setpgrp);
#else /* !__DARWIN_UNIX03 */
int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
#endif /* __DARWIN_UNIX03 */
int setregid(gid_t, gid_t) __DARWIN_ALIAS(setregid);
int setreuid(uid_t, uid_t) __DARWIN_ALIAS(setreuid);
void swab(const void * __restrict, void * __restrict, ssize_t);
void sync(void);
int truncate(const char *, off_t);
useconds_t ualarm(useconds_t, useconds_t);
int usleep(useconds_t) __DARWIN_ALIAS_C(usleep);
#if !defined(_POSIX_C_SOURCE)
__deprecated_msg("Use posix_spawn or fork")
#endif
pid_t vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
/* End XSI */
int fsync(int) __DARWIN_ALIAS_C(fsync);
int ftruncate(int, off_t);
int getlogin_r(char *, size_t);
__END_DECLS
#endif /* __DARWIN_C_LEVEL >= 199506L */
/* Additional functionality provided by:
* POSIX.1-2001
* ISO C99
*/
#if __DARWIN_C_LEVEL >= 200112L
__BEGIN_DECLS
int fchown(int, uid_t, gid_t);
int gethostname(char *, size_t);
ssize_t readlink(const char * __restrict, char * __restrict, size_t);
int setegid(gid_t);
int seteuid(uid_t);
int symlink(const char *, const char *);
__END_DECLS
#endif /* __DARWIN_C_LEVEL >= 200112L */
/* Darwin extensions */
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#include <sys/select.h>
#include <sys/_types/_dev_t.h>
#include <sys/_types/_mode_t.h>
#include <sys/_types/_uuid_t.h>
__BEGIN_DECLS
void _Exit(int) __dead2;
int accessx_np(const struct accessx_descriptor *, size_t, int *, uid_t);
int acct(const char *);
int add_profil(char *, size_t, unsigned long, unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
void endusershell(void);
int execvP(const char * __file, const char * __searchpath, char * const * __argv) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
char *fflagstostr(unsigned long);
int getdomainname(char *, int);
int getgrouplist(const char *, int, int *, int *);
#if defined(__has_include)
#if __has_include(<gethostuuid_private.h>)
#include <gethostuuid_private.h>
#else
#include <gethostuuid.h>
#endif
#else
#include <gethostuuid.h>
#endif
mode_t getmode(const void *, mode_t);
int getpeereid(int, uid_t *, gid_t *);
int getsgroups_np(int *, uuid_t);
char *getusershell(void);
int getwgroups_np(int *, uuid_t);
int initgroups(const char *, int);
int issetugid(void);
char *mkdtemp(char *);
int mknod(const char *, mode_t, dev_t);
int mkpath_np(const char *path, mode_t omode) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_5_0); /* returns errno */
int mkpathat_np(int dfd, const char *path, mode_t omode) /* returns errno */
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
int mkstemp(char *);
int mkstemps(char *, int);
char *mktemp(char *);
int mkostemp(char *path, int oflags)
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
int mkostemps(char *path, int slen, int oflags)
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
/* Non-portable mkstemp that uses open_dprotected_np */
int mkstemp_dprotected_np(char *path, int dpclass, int dpflags)
__OSX_UNAVAILABLE __IOS_AVAILABLE(10.0)
__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
char *mkdtempat_np(int dfd, char *path)
__OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
__TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
int mkstempsat_np(int dfd, char *path, int slen)
__OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
__TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
int mkostempsat_np(int dfd, char *path, int slen, int oflags)
__OSX_AVAILABLE(10.13) __IOS_AVAILABLE(11.0)
__TVOS_AVAILABLE(11.0) __WATCHOS_AVAILABLE(4.0);
int nfssvc(int, void *);
int profil(char *, size_t, unsigned long, unsigned int);
__deprecated_msg("Use of per-thread security contexts is error-prone and discouraged.")
int pthread_setugid_np(uid_t, gid_t);
int pthread_getugid_np( uid_t *, gid_t *);
int reboot(int);
int revoke(const char *);
__deprecated int rcmd(char **, int, const char *, const char *, const char *, int *);
__deprecated int rcmd_af(char **, int, const char *, const char *, const char *, int *,
int);
__deprecated int rresvport(int *);
__deprecated int rresvport_af(int *, int);
__deprecated int iruserok(unsigned long, int, const char *, const char *);
__deprecated int iruserok_sa(const void *, int, int, const char *, const char *);
__deprecated int ruserok(const char *, int, const char *, const char *);
int setdomainname(const char *, int);
int setgroups(int, const gid_t *);
void sethostid(long);
int sethostname(const char *, int);
#if __DARWIN_UNIX03
void setkey(const char *) __DARWIN_ALIAS(setkey);
#else /* !__DARWIN_UNIX03 */
int setkey(const char *);
#endif /* __DARWIN_UNIX03 */
int setlogin(const char *);
void *setmode(const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(setmode));
int setrgid(gid_t);
int setruid(uid_t);
int setsgroups_np(int, const uuid_t);
void setusershell(void);
int setwgroups_np(int, const uuid_t);
int strtofflags(char **, unsigned long *, unsigned long *);
int swapon(const char *);
int ttyslot(void);
int undelete(const char *);
int unwhiteout(const char *);
void *valloc(size_t);
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
__OS_AVAILABILITY_MSG(ios,deprecated=10.0,"syscall(2) is unsupported; "
"please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
__OS_AVAILABILITY_MSG(macosx,deprecated=10.12,"syscall(2) is unsupported; "
"please switch to a supported interface. For SYS_kdebug_trace use kdebug_signpost().")
int syscall(int, ...);
extern char *suboptarg; /* getsubopt(3) external variable */
int getsubopt(char **, char * const *, char **);
/* HFS & HFS Plus semantics system calls go here */
#ifdef __LP64__
int fgetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
int fsetattrlist(int,void*,void*,size_t,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
int getattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(getattrlist);
int setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(setattrlist);
int exchangedata(const char*,const char*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
#else /* __LP64__ */
int fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
int fsetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
int getattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(getattrlist);
int setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(setattrlist);
int exchangedata(const char*,const char*,unsigned long)
__OSX_DEPRECATED(10.0, 10.13, "use renamex_np with the RENAME_SWAP flag")
__IOS_DEPRECATED(2.0, 11.0, "use renamex_np with the RENAME_SWAP flag")
__WATCHOS_PROHIBITED __TVOS_PROHIBITED;
int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
#endif /* __LP64__ */
struct fssearchblock;
struct searchstate;
int searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
int fsctl(const char *,unsigned long,void*,unsigned int);
int ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
#define SYNC_VOLUME_FULLSYNC 0x01 /* Flush data and metadata to platter, not just to disk cache */
#define SYNC_VOLUME_WAIT 0x02 /* Wait for sync to complete */
int fsync_volume_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
int sync_volume_np(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
extern int optreset;
__END_DECLS
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
#endif /* _UNISTD_H_ */

View File

@@ -0,0 +1,134 @@
#ifndef __XPC_AVAILABILITY_H__
#define __XPC_AVAILABILITY_H__
#include <Availability.h>
// Certain parts of the project use all the project's headers but have to build
// against newer OSX SDKs than ebuild uses -- liblaunch_host being the example.
// So we need to define these.
#ifndef __MAC_10_16
#define __MAC_10_16 101600
#endif // __MAC_10_16
#ifndef __MAC_10_15
#define __MAC_10_15 101500
#define __AVAILABILITY_INTERNAL__MAC_10_15 \
__attribute__((availability(macosx, introduced=10.15)))
#endif // __MAC_10_15
#ifndef __MAC_10_14
#define __MAC_10_14 101400
#define __AVAILABILITY_INTERNAL__MAC_10_14 \
__attribute__((availability(macosx, introduced=10.14)))
#endif // __MAC_10_14
#ifndef __MAC_10_13
#define __MAC_10_13 101300
#define __AVAILABILITY_INTERNAL__MAC_10_13 \
__attribute__((availability(macosx, introduced=10.13)))
#endif // __MAC_10_13
#ifndef __MAC_10_12
#define __MAC_10_12 101200
#define __AVAILABILITY_INTERNAL__MAC_10_12 \
__attribute__((availability(macosx, introduced=10.12)))
#endif // __MAC_10_12
#ifndef __MAC_10_11
#define __MAC_10_11 101100
#define __AVAILABILITY_INTERNAL__MAC_10_11 \
__attribute__((availability(macosx, introduced=10.11)))
#endif // __MAC_10_11
#ifndef __MAC_12_0
#define __MAC_12_0 120000
#define __AVAILABILITY_INTERNAL__MAC_12_0 \
__attribute__((availability(macosx, introduced=12.0)))
#endif // __MAC_12_0
#ifndef __MAC_13_3
#define __MAC_13_3 130300
#endif // __MAC_13_3
#ifndef __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
#define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
#endif // __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11
#ifndef __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
#define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
#endif // __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_13
#if __has_include(<simulator_host.h>)
#include <simulator_host.h>
#else // __has_include(<simulator_host.h>)
#ifndef IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED
#define IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED 999999
#endif // IPHONE_SIMULATOR_HOST_MIN_VERSION_REQUIRED
#endif // __has_include(<simulator_host.h>)
#ifndef __WATCHOS_UNAVAILABLE
#define __WATCHOS_UNAVAILABLE
#endif
#ifndef __TVOS_UNAVAILABLE
#define __TVOS_UNAVAILABLE
#endif
// simulator host-side bits build against SDKs not having __*_AVAILABLE() yet
#ifndef __OSX_AVAILABLE
#define __OSX_AVAILABLE(...)
#endif
#ifndef __IOS_AVAILABLE
#define __IOS_AVAILABLE(...)
#endif
#ifndef __TVOS_AVAILABLE
#define __TVOS_AVAILABLE(...)
#endif
#ifndef __WATCHOS_AVAILABLE
#define __WATCHOS_AVAILABLE(...)
#endif
#ifndef __API_AVAILABLE
#define __API_AVAILABLE(...)
#endif
#endif // __XPC_AVAILABILITY_H__

View File

@@ -132,6 +132,12 @@
*/
#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
#define FLAVOR_MODIFIES_CORE_CPU_REGISTERS(x) \
((x == x86_THREAD_STATE) || \
(x == x86_THREAD_STATE32) || \
(x == x86_THREAD_STATE64) || \
(x == x86_THREAD_FULL_STATE64))
/*
* VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed
* an exception flavor will return if that is a defined flavor for that

View File

@@ -280,13 +280,13 @@ pub const Target = struct {
.aarch64 => VersionRange{
.semver = .{
.min = .{ .major = 11, .minor = 7, .patch = 1 },
.max = .{ .major = 13, .minor = 0 },
.max = .{ .major = 13, .minor = 3 },
},
},
.x86_64 => VersionRange{
.semver = .{
.min = .{ .major = 11, .minor = 7, .patch = 1 },
.max = .{ .major = 13, .minor = 0 },
.max = .{ .major = 13, .minor = 3 },
},
},
else => unreachable,