mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Merge pull request #7318 from kubkon/cc-macho
stage1: cross compile to x86_64 and arm64 macOS from anywhere with LLVM
This commit is contained in:
commit
b090451646
482
lib/libc/include/aarch64-macos-gnu/Availability.h
Normal file
482
lib/libc/include/aarch64-macos-gnu/Availability.h
Normal file
@ -0,0 +1,482 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2016 by 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@
|
||||
*/
|
||||
|
||||
#ifndef __AVAILABILITY__
|
||||
#define __AVAILABILITY__
|
||||
/*
|
||||
These macros are for use in OS header files. They enable function prototypes
|
||||
and Objective-C methods to be tagged with the OS version in which they
|
||||
were first available; and, if applicable, the OS version in which they
|
||||
became deprecated.
|
||||
|
||||
The desktop Mac OS X and iOS each have different version numbers.
|
||||
The __OSX_AVAILABLE_STARTING() macro allows you to specify both the desktop
|
||||
and iOS version numbers. For instance:
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0)
|
||||
means the function/method was first available on Mac OS X 10.2 on the desktop
|
||||
and first available in iOS 2.0 on the iPhone.
|
||||
|
||||
If a function is available on one platform, but not the other a _NA (not
|
||||
applicable) parameter is used. For instance:
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA)
|
||||
means that the function/method was first available on Mac OS X 10.3, and it
|
||||
currently not implemented on the iPhone.
|
||||
|
||||
At some point, a function/method may be deprecated. That means Apple
|
||||
recommends applications stop using the function, either because there is a
|
||||
better replacement or the functionality is being phased out. Deprecated
|
||||
functions/methods can be tagged with a __OSX_AVAILABLE_BUT_DEPRECATED()
|
||||
macro which specifies the OS version where the function became available
|
||||
as well as the OS version in which it became deprecated. For instance:
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)
|
||||
means that the function/method was introduced in Mac OS X 10.0, then
|
||||
became deprecated beginning in Mac OS X 10.5. On iOS the function
|
||||
has never been available.
|
||||
|
||||
For these macros to function properly, a program must specify the OS version range
|
||||
it is targeting. The min OS version is specified as an option to the compiler:
|
||||
-mmacosx-version-min=10.x when building for Mac OS X, and -miphoneos-version-min=y.z
|
||||
when building for the iPhone. The upper bound for the OS version is rarely needed,
|
||||
but it can be set on the command line via: -D__MAC_OS_X_VERSION_MAX_ALLOWED=10x0 for
|
||||
Mac OS X and __IPHONE_OS_VERSION_MAX_ALLOWED = y0z00 for iOS.
|
||||
|
||||
Examples:
|
||||
|
||||
A function available in Mac OS X 10.5 and later, but not on the phone:
|
||||
|
||||
extern void mymacfunc() __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
|
||||
|
||||
|
||||
An Objective-C method in Mac OS X 10.5 and later, but not on the phone:
|
||||
|
||||
@interface MyClass : NSObject
|
||||
-(void) mymacmethod __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
|
||||
@end
|
||||
|
||||
|
||||
An enum available on the phone, but not available on Mac OS X:
|
||||
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
enum { myEnum = 1 };
|
||||
#endif
|
||||
Note: this works when targeting the Mac OS X platform because
|
||||
__IPHONE_OS_VERSION_MIN_REQUIRED is undefined which evaluates to zero.
|
||||
|
||||
|
||||
An enum with values added in different iPhoneOS versions:
|
||||
|
||||
enum {
|
||||
myX = 1, // Usable on iPhoneOS 2.1 and later
|
||||
myY = 2, // Usable on iPhoneOS 3.0 and later
|
||||
myZ = 3, // Usable on iPhoneOS 3.0 and later
|
||||
...
|
||||
Note: you do not want to use #if with enumeration values
|
||||
when a client needs to see all values at compile time
|
||||
and use runtime logic to only use the viable values.
|
||||
|
||||
|
||||
It is also possible to use the *_VERSION_MIN_REQUIRED in source code to make one
|
||||
source base that can be compiled to target a range of OS versions. It is best
|
||||
to not use the _MAC_* and __IPHONE_* macros for comparisons, but rather their values.
|
||||
That is because you might get compiled on an old OS that does not define a later
|
||||
OS version macro, and in the C preprocessor undefined values evaluate to zero
|
||||
in expresssions, which could cause the #if expression to evaluate in an unexpected
|
||||
way.
|
||||
|
||||
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
// code only compiled when targeting Mac OS X and not iPhone
|
||||
// note use of 1050 instead of __MAC_10_5
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||
// code in here might run on pre-Leopard OS
|
||||
#else
|
||||
// code here can assume Leopard or later
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* __API_TO_BE_DEPRECATED is used as a version number in API that will be deprecated
|
||||
* in an upcoming release. This soft deprecation is an intermediate step before formal
|
||||
* deprecation to notify developers about the API before compiler warnings are generated.
|
||||
* You can find all places in your code that use soft deprecated API by redefining the
|
||||
* value of this macro to your current minimum deployment target, for example:
|
||||
* (macOS)
|
||||
* clang -D__API_TO_BE_DEPRECATED=10.12 <other compiler flags>
|
||||
* (iOS)
|
||||
* clang -D__API_TO_BE_DEPRECATED=11.0 <other compiler flags>
|
||||
*/
|
||||
|
||||
#ifndef __API_TO_BE_DEPRECATED
|
||||
#define __API_TO_BE_DEPRECATED 100000
|
||||
#endif
|
||||
|
||||
#include <AvailabilityVersions.h>
|
||||
#include <AvailabilityInternal.h>
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_ios
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
|
||||
__AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
|
||||
__AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep##_MSG(_msg)
|
||||
|
||||
#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
|
||||
|
||||
#if defined(__has_builtin)
|
||||
#if __has_builtin(__is_target_arch)
|
||||
#if __has_builtin(__is_target_vendor)
|
||||
#if __has_builtin(__is_target_os)
|
||||
#if __has_builtin(__is_target_environment)
|
||||
#if __has_builtin(__is_target_variant_os)
|
||||
#if __has_builtin(__is_target_variant_environment)
|
||||
#if (__is_target_arch(x86_64) && __is_target_vendor(apple) && ((__is_target_os(ios) && __is_target_environment(macabi)) || (__is_target_variant_os(ios) && __is_target_variant_environment(macabi))))
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_osx __AVAILABILITY_INTERNAL##_ios
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
|
||||
__AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
|
||||
__AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep##_MSG(_msg) __AVAILABILITY_INTERNAL##_iosIntro##_DEP##_iosDep##_MSG(_msg)
|
||||
#endif /* # if __is_target_arch... */
|
||||
#endif /* #if __has_builtin(__is_target_variant_environment) */
|
||||
#endif /* #if __has_builtin(__is_target_variant_os) */
|
||||
#endif /* #if __has_builtin(__is_target_environment) */
|
||||
#endif /* #if __has_builtin(__is_target_os) */
|
||||
#endif /* #if __has_builtin(__is_target_vendor) */
|
||||
#endif /* #if __has_builtin(__is_target_arch) */
|
||||
#endif /* #if defined(__has_builtin) */
|
||||
|
||||
#ifndef __OSX_AVAILABLE_STARTING
|
||||
#if defined(__has_attribute) && defined(__has_feature)
|
||||
#if __has_attribute(availability)
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_osx
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep) \
|
||||
__AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg) \
|
||||
__AVAILABILITY_INTERNAL##_osxIntro##_DEP##_osxDep##_MSG(_msg)
|
||||
#else
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
|
||||
#endif
|
||||
#else
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
|
||||
#endif
|
||||
#endif /* __OSX_AVAILABLE_STARTING */
|
||||
|
||||
#else
|
||||
#define __OSX_AVAILABLE_STARTING(_osx, _ios)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED(_osxIntro, _osxDep, _iosIntro, _iosDep)
|
||||
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(_osxIntro, _osxDep, _iosIntro, _iosDep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_with_message)
|
||||
#define __OS_AVAILABILITY(_target, _availability) __attribute__((availability(_target,_availability)))
|
||||
#define __OS_AVAILABILITY_MSG(_target, _availability, _msg) __attribute__((availability(_target,_availability,message=_msg)))
|
||||
#elif __has_feature(attribute_availability)
|
||||
#define __OS_AVAILABILITY(_target, _availability) __attribute__((availability(_target,_availability)))
|
||||
#define __OS_AVAILABILITY_MSG(_target, _availability, _msg) __attribute__((availability(_target,_availability)))
|
||||
#else
|
||||
#define __OS_AVAILABILITY(_target, _availability)
|
||||
#define __OS_AVAILABILITY_MSG(_target, _availability, _msg)
|
||||
#endif
|
||||
#else
|
||||
#define __OS_AVAILABILITY(_target, _availability)
|
||||
#define __OS_AVAILABILITY_MSG(_target, _availability, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use to document app extension usage */
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_app_extension)
|
||||
#define __OSX_EXTENSION_UNAVAILABLE(_msg) __OS_AVAILABILITY_MSG(macosx_app_extension,unavailable,_msg)
|
||||
#define __IOS_EXTENSION_UNAVAILABLE(_msg) __OS_AVAILABILITY_MSG(ios_app_extension,unavailable,_msg)
|
||||
#else
|
||||
#define __OSX_EXTENSION_UNAVAILABLE(_msg)
|
||||
#define __IOS_EXTENSION_UNAVAILABLE(_msg)
|
||||
#endif
|
||||
#else
|
||||
#define __OSX_EXTENSION_UNAVAILABLE(_msg)
|
||||
#define __IOS_EXTENSION_UNAVAILABLE(_msg)
|
||||
#endif
|
||||
|
||||
#define __OS_EXTENSION_UNAVAILABLE(_msg) __OSX_EXTENSION_UNAVAILABLE(_msg) __IOS_EXTENSION_UNAVAILABLE(_msg)
|
||||
|
||||
|
||||
|
||||
/* for use marking APIs available info for Mac OSX */
|
||||
#if defined(__has_attribute)
|
||||
#if __has_attribute(availability)
|
||||
#define __OSX_UNAVAILABLE __OS_AVAILABILITY(macosx,unavailable)
|
||||
#define __OSX_AVAILABLE(_vers) __OS_AVAILABILITY(macosx,introduced=_vers)
|
||||
#define __OSX_DEPRECATED(_start, _dep, _msg) __OSX_AVAILABLE(_start) __OS_AVAILABILITY_MSG(macosx,deprecated=_dep,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __OSX_UNAVAILABLE
|
||||
#define __OSX_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __OSX_AVAILABLE
|
||||
#define __OSX_AVAILABLE(_vers)
|
||||
#endif
|
||||
|
||||
#ifndef __OSX_DEPRECATED
|
||||
#define __OSX_DEPRECATED(_start, _dep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use marking APIs available info for iOS */
|
||||
#if defined(__has_attribute)
|
||||
#if __has_attribute(availability)
|
||||
#define __IOS_UNAVAILABLE __OS_AVAILABILITY(ios,unavailable)
|
||||
#define __IOS_PROHIBITED __OS_AVAILABILITY(ios,unavailable)
|
||||
#define __IOS_AVAILABLE(_vers) __OS_AVAILABILITY(ios,introduced=_vers)
|
||||
#define __IOS_DEPRECATED(_start, _dep, _msg) __IOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(ios,deprecated=_dep,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __IOS_UNAVAILABLE
|
||||
#define __IOS_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __IOS_PROHIBITED
|
||||
#define __IOS_PROHIBITED
|
||||
#endif
|
||||
|
||||
#ifndef __IOS_AVAILABLE
|
||||
#define __IOS_AVAILABLE(_vers)
|
||||
#endif
|
||||
|
||||
#ifndef __IOS_DEPRECATED
|
||||
#define __IOS_DEPRECATED(_start, _dep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use marking APIs available info for tvOS */
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_tvos)
|
||||
#define __TVOS_UNAVAILABLE __OS_AVAILABILITY(tvos,unavailable)
|
||||
#define __TVOS_PROHIBITED __OS_AVAILABILITY(tvos,unavailable)
|
||||
#define __TVOS_AVAILABLE(_vers) __OS_AVAILABILITY(tvos,introduced=_vers)
|
||||
#define __TVOS_DEPRECATED(_start, _dep, _msg) __TVOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(tvos,deprecated=_dep,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __TVOS_UNAVAILABLE
|
||||
#define __TVOS_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __TVOS_PROHIBITED
|
||||
#define __TVOS_PROHIBITED
|
||||
#endif
|
||||
|
||||
#ifndef __TVOS_AVAILABLE
|
||||
#define __TVOS_AVAILABLE(_vers)
|
||||
#endif
|
||||
|
||||
#ifndef __TVOS_DEPRECATED
|
||||
#define __TVOS_DEPRECATED(_start, _dep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use marking APIs available info for Watch OS */
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_watchos)
|
||||
#define __WATCHOS_UNAVAILABLE __OS_AVAILABILITY(watchos,unavailable)
|
||||
#define __WATCHOS_PROHIBITED __OS_AVAILABILITY(watchos,unavailable)
|
||||
#define __WATCHOS_AVAILABLE(_vers) __OS_AVAILABILITY(watchos,introduced=_vers)
|
||||
#define __WATCHOS_DEPRECATED(_start, _dep, _msg) __WATCHOS_AVAILABLE(_start) __OS_AVAILABILITY_MSG(watchos,deprecated=_dep,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __WATCHOS_UNAVAILABLE
|
||||
#define __WATCHOS_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __WATCHOS_PROHIBITED
|
||||
#define __WATCHOS_PROHIBITED
|
||||
#endif
|
||||
|
||||
#ifndef __WATCHOS_AVAILABLE
|
||||
#define __WATCHOS_AVAILABLE(_vers)
|
||||
#endif
|
||||
|
||||
#ifndef __WATCHOS_DEPRECATED
|
||||
#define __WATCHOS_DEPRECATED(_start, _dep, _msg)
|
||||
#endif
|
||||
|
||||
|
||||
/* for use marking APIs unavailable for swift */
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(attribute_availability_swift)
|
||||
#define __SWIFT_UNAVAILABLE __OS_AVAILABILITY(swift,unavailable)
|
||||
#define __SWIFT_UNAVAILABLE_MSG(_msg) __OS_AVAILABILITY_MSG(swift,unavailable,_msg)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __SWIFT_UNAVAILABLE
|
||||
#define __SWIFT_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#ifndef __SWIFT_UNAVAILABLE_MSG
|
||||
#define __SWIFT_UNAVAILABLE_MSG(_msg)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Macros for defining which versions/platform a given symbol can be used.
|
||||
|
||||
@see http://clang.llvm.org/docs/AttributeReference.html#availability
|
||||
|
||||
* Note that these macros are only compatible with clang compilers that
|
||||
* support the following target selection options:
|
||||
*
|
||||
* -mmacosx-version-min
|
||||
* -miphoneos-version-min
|
||||
* -mwatchos-version-min
|
||||
* -mtvos-version-min
|
||||
*/
|
||||
|
||||
#if defined(__has_feature) && defined(__has_attribute)
|
||||
#if __has_attribute(availability)
|
||||
|
||||
/*
|
||||
* API Introductions
|
||||
*
|
||||
* Use to specify the release that a particular API became available.
|
||||
*
|
||||
* Platform names:
|
||||
* macos, ios, tvos, watchos
|
||||
*
|
||||
* Examples:
|
||||
* __API_AVAILABLE(macos(10.10))
|
||||
* __API_AVAILABLE(macos(10.9), ios(10.0))
|
||||
* __API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0))
|
||||
* __API_AVAILABLE(driverkit(19.0))
|
||||
*/
|
||||
#define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__)
|
||||
|
||||
#define __API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE_BEGIN7, __API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__)
|
||||
#define __API_AVAILABLE_END _Pragma("clang attribute pop")
|
||||
|
||||
/*
|
||||
* API Deprecations
|
||||
*
|
||||
* Use to specify the release that a particular API became unavailable.
|
||||
*
|
||||
* Platform names:
|
||||
* macos, ios, tvos, watchos
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* __API_DEPRECATED("No longer supported", macos(10.4, 10.8))
|
||||
* __API_DEPRECATED("No longer supported", macos(10.4, 10.8), ios(2.0, 3.0), watchos(2.0, 3.0), tvos(9.0, 10.0))
|
||||
*
|
||||
* __API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0))
|
||||
* __API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0))
|
||||
*/
|
||||
#define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__)
|
||||
|
||||
#define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__)
|
||||
#define __API_DEPRECATED_END _Pragma("clang attribute pop")
|
||||
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_END _Pragma("clang attribute pop")
|
||||
|
||||
/*
|
||||
* API Unavailability
|
||||
* Use to specify that an API is unavailable for a particular platform.
|
||||
*
|
||||
* Example:
|
||||
* __API_UNAVAILABLE(macos)
|
||||
* __API_UNAVAILABLE(watchos, tvos)
|
||||
*/
|
||||
#define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
|
||||
|
||||
#define __API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__)
|
||||
#define __API_UNAVAILABLE_END _Pragma("clang attribute pop")
|
||||
#else
|
||||
|
||||
/*
|
||||
* Evaluate to nothing for compilers that don't support availability.
|
||||
*/
|
||||
|
||||
#define __API_AVAILABLE(...)
|
||||
#define __API_AVAILABLE_BEGIN(...)
|
||||
#define __API_AVAILABLE_END
|
||||
#define __API_DEPRECATED(...)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT(...)
|
||||
#define __API_DEPRECATED_BEGIN(...)
|
||||
#define __API_DEPRECATED_END
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_END
|
||||
#define __API_UNAVAILABLE(...)
|
||||
#define __API_UNAVAILABLE_BEGIN(...)
|
||||
#define __API_UNAVAILABLE_END
|
||||
#endif /* __has_attribute(availability) */
|
||||
#else
|
||||
|
||||
/*
|
||||
* Evaluate to nothing for compilers that don't support clang language extensions.
|
||||
*/
|
||||
|
||||
#define __API_AVAILABLE(...)
|
||||
#define __API_AVAILABLE_BEGIN(...)
|
||||
#define __API_AVAILABLE_END
|
||||
#define __API_DEPRECATED(...)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT(...)
|
||||
#define __API_DEPRECATED_BEGIN(...)
|
||||
#define __API_DEPRECATED_END
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...)
|
||||
#define __API_DEPRECATED_WITH_REPLACEMENT_END
|
||||
#define __API_UNAVAILABLE(...)
|
||||
#define __API_UNAVAILABLE_BEGIN(...)
|
||||
#define __API_UNAVAILABLE_END
|
||||
#endif /* #if defined(__has_feature) && defined(__has_attribute) */
|
||||
|
||||
#if __has_include(<AvailabilityProhibitedInternal.h>)
|
||||
#include <AvailabilityProhibitedInternal.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If SPI decorations have not been defined elsewhere, disable them.
|
||||
*/
|
||||
|
||||
#ifndef __SPI_AVAILABLE
|
||||
#define __SPI_AVAILABLE(...)
|
||||
#endif
|
||||
|
||||
#ifndef __SPI_DEPRECATED
|
||||
#define __SPI_DEPRECATED(...)
|
||||
#endif
|
||||
|
||||
#ifndef __SPI_DEPRECATED_WITH_REPLACEMENT
|
||||
#define __SPI_DEPRECATED_WITH_REPLACEMENT(...)
|
||||
#endif
|
||||
|
||||
#endif /* __AVAILABILITY__ */
|
||||
4675
lib/libc/include/aarch64-macos-gnu/AvailabilityInternal.h
Normal file
4675
lib/libc/include/aarch64-macos-gnu/AvailabilityInternal.h
Normal file
File diff suppressed because it is too large
Load Diff
4013
lib/libc/include/aarch64-macos-gnu/AvailabilityMacros.h
Normal file
4013
lib/libc/include/aarch64-macos-gnu/AvailabilityMacros.h
Normal file
File diff suppressed because it is too large
Load Diff
207
lib/libc/include/aarch64-macos-gnu/AvailabilityVersions.h
Normal file
207
lib/libc/include/aarch64-macos-gnu/AvailabilityVersions.h
Normal file
@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Copyright (c) 2019 by 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@
|
||||
*/
|
||||
|
||||
#ifndef __AVAILABILITY_VERSIONS__
|
||||
#define __AVAILABILITY_VERSIONS__
|
||||
|
||||
#define __MAC_10_0 1000
|
||||
#define __MAC_10_1 1010
|
||||
#define __MAC_10_2 1020
|
||||
#define __MAC_10_3 1030
|
||||
#define __MAC_10_4 1040
|
||||
#define __MAC_10_5 1050
|
||||
#define __MAC_10_6 1060
|
||||
#define __MAC_10_7 1070
|
||||
#define __MAC_10_8 1080
|
||||
#define __MAC_10_9 1090
|
||||
#define __MAC_10_10 101000
|
||||
#define __MAC_10_10_2 101002
|
||||
#define __MAC_10_10_3 101003
|
||||
#define __MAC_10_11 101100
|
||||
#define __MAC_10_11_2 101102
|
||||
#define __MAC_10_11_3 101103
|
||||
#define __MAC_10_11_4 101104
|
||||
#define __MAC_10_12 101200
|
||||
#define __MAC_10_12_1 101201
|
||||
#define __MAC_10_12_2 101202
|
||||
#define __MAC_10_12_4 101204
|
||||
#define __MAC_10_13 101300
|
||||
#define __MAC_10_13_1 101301
|
||||
#define __MAC_10_13_2 101302
|
||||
#define __MAC_10_13_4 101304
|
||||
#define __MAC_10_14 101400
|
||||
#define __MAC_10_14_1 101401
|
||||
#define __MAC_10_14_4 101404
|
||||
#define __MAC_10_14_6 101406
|
||||
#define __MAC_10_15 101500
|
||||
#define __MAC_10_15_1 101501
|
||||
#define __MAC_10_15_4 101504
|
||||
#define __MAC_10_16 101600
|
||||
#define __MAC_11_0 110000
|
||||
/* __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
|
||||
#define __IPHONE_2_1 20100
|
||||
#define __IPHONE_2_2 20200
|
||||
#define __IPHONE_3_0 30000
|
||||
#define __IPHONE_3_1 30100
|
||||
#define __IPHONE_3_2 30200
|
||||
#define __IPHONE_4_0 40000
|
||||
#define __IPHONE_4_1 40100
|
||||
#define __IPHONE_4_2 40200
|
||||
#define __IPHONE_4_3 40300
|
||||
#define __IPHONE_5_0 50000
|
||||
#define __IPHONE_5_1 50100
|
||||
#define __IPHONE_6_0 60000
|
||||
#define __IPHONE_6_1 60100
|
||||
#define __IPHONE_7_0 70000
|
||||
#define __IPHONE_7_1 70100
|
||||
#define __IPHONE_8_0 80000
|
||||
#define __IPHONE_8_1 80100
|
||||
#define __IPHONE_8_2 80200
|
||||
#define __IPHONE_8_3 80300
|
||||
#define __IPHONE_8_4 80400
|
||||
#define __IPHONE_9_0 90000
|
||||
#define __IPHONE_9_1 90100
|
||||
#define __IPHONE_9_2 90200
|
||||
#define __IPHONE_9_3 90300
|
||||
#define __IPHONE_10_0 100000
|
||||
#define __IPHONE_10_1 100100
|
||||
#define __IPHONE_10_2 100200
|
||||
#define __IPHONE_10_3 100300
|
||||
#define __IPHONE_11_0 110000
|
||||
#define __IPHONE_11_1 110100
|
||||
#define __IPHONE_11_2 110200
|
||||
#define __IPHONE_11_3 110300
|
||||
#define __IPHONE_11_4 110400
|
||||
#define __IPHONE_12_0 120000
|
||||
#define __IPHONE_12_1 120100
|
||||
#define __IPHONE_12_2 120200
|
||||
#define __IPHONE_12_3 120300
|
||||
#define __IPHONE_12_4 120400
|
||||
#define __IPHONE_13_0 130000
|
||||
#define __IPHONE_13_1 130100
|
||||
#define __IPHONE_13_2 130200
|
||||
#define __IPHONE_13_3 130300
|
||||
#define __IPHONE_13_4 130400
|
||||
#define __IPHONE_13_5 130500
|
||||
#define __IPHONE_13_6 130600
|
||||
#define __IPHONE_13_7 130700
|
||||
#define __IPHONE_14_0 140000
|
||||
#define __IPHONE_14_1 140100
|
||||
#define __IPHONE_14_2 140200
|
||||
/* __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
|
||||
#define __TVOS_9_1 90100
|
||||
#define __TVOS_9_2 90200
|
||||
#define __TVOS_10_0 100000
|
||||
#define __TVOS_10_0_1 100001
|
||||
#define __TVOS_10_1 100100
|
||||
#define __TVOS_10_2 100200
|
||||
#define __TVOS_11_0 110000
|
||||
#define __TVOS_11_1 110100
|
||||
#define __TVOS_11_2 110200
|
||||
#define __TVOS_11_3 110300
|
||||
#define __TVOS_11_4 110400
|
||||
#define __TVOS_12_0 120000
|
||||
#define __TVOS_12_1 120100
|
||||
#define __TVOS_12_2 120200
|
||||
#define __TVOS_12_3 120300
|
||||
#define __TVOS_12_4 120400
|
||||
#define __TVOS_13_0 130000
|
||||
#define __TVOS_13_2 130200
|
||||
#define __TVOS_13_3 130300
|
||||
#define __TVOS_13_4 130400
|
||||
#define __TVOS_14_0 140000
|
||||
#define __TVOS_14_1 140100
|
||||
#define __TVOS_14_2 140200
|
||||
|
||||
#define __WATCHOS_1_0 10000
|
||||
#define __WATCHOS_2_0 20000
|
||||
#define __WATCHOS_2_1 20100
|
||||
#define __WATCHOS_2_2 20200
|
||||
#define __WATCHOS_3_0 30000
|
||||
#define __WATCHOS_3_1 30100
|
||||
#define __WATCHOS_3_1_1 30101
|
||||
#define __WATCHOS_3_2 30200
|
||||
#define __WATCHOS_4_0 40000
|
||||
#define __WATCHOS_4_1 40100
|
||||
#define __WATCHOS_4_2 40200
|
||||
#define __WATCHOS_4_3 40300
|
||||
#define __WATCHOS_5_0 50000
|
||||
#define __WATCHOS_5_1 50100
|
||||
#define __WATCHOS_5_2 50200
|
||||
#define __WATCHOS_5_3 50300
|
||||
#define __WATCHOS_6_0 60000
|
||||
#define __WATCHOS_6_1 60100
|
||||
#define __WATCHOS_6_2 60200
|
||||
#define __WATCHOS_7_0 70000
|
||||
#define __WATCHOS_7_1 70100
|
||||
|
||||
/*
|
||||
* Set up standard Mac OS X versions
|
||||
*/
|
||||
|
||||
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
|
||||
|
||||
#define MAC_OS_X_VERSION_10_0 1000
|
||||
#define MAC_OS_X_VERSION_10_1 1010
|
||||
#define MAC_OS_X_VERSION_10_2 1020
|
||||
#define MAC_OS_X_VERSION_10_3 1030
|
||||
#define MAC_OS_X_VERSION_10_4 1040
|
||||
#define MAC_OS_X_VERSION_10_5 1050
|
||||
#define MAC_OS_X_VERSION_10_6 1060
|
||||
#define MAC_OS_X_VERSION_10_7 1070
|
||||
#define MAC_OS_X_VERSION_10_8 1080
|
||||
#define MAC_OS_X_VERSION_10_9 1090
|
||||
#define MAC_OS_X_VERSION_10_10 101000
|
||||
#define MAC_OS_X_VERSION_10_10_2 101002
|
||||
#define MAC_OS_X_VERSION_10_10_3 101003
|
||||
#define MAC_OS_X_VERSION_10_11 101100
|
||||
#define MAC_OS_X_VERSION_10_11_2 101102
|
||||
#define MAC_OS_X_VERSION_10_11_3 101103
|
||||
#define MAC_OS_X_VERSION_10_11_4 101104
|
||||
#define MAC_OS_X_VERSION_10_12 101200
|
||||
#define MAC_OS_X_VERSION_10_12_1 101201
|
||||
#define MAC_OS_X_VERSION_10_12_2 101202
|
||||
#define MAC_OS_X_VERSION_10_12_4 101204
|
||||
#define MAC_OS_X_VERSION_10_13 101300
|
||||
#define MAC_OS_X_VERSION_10_13_1 101301
|
||||
#define MAC_OS_X_VERSION_10_13_2 101302
|
||||
#define MAC_OS_X_VERSION_10_13_4 101304
|
||||
#define MAC_OS_X_VERSION_10_14 101400
|
||||
#define MAC_OS_X_VERSION_10_14_1 101401
|
||||
#define MAC_OS_X_VERSION_10_14_4 101404
|
||||
#define MAC_OS_X_VERSION_10_14_6 101406
|
||||
#define MAC_OS_X_VERSION_10_15 101500
|
||||
#define MAC_OS_X_VERSION_10_15_1 101501
|
||||
#define MAC_OS_X_VERSION_10_16 101600
|
||||
#define MAC_OS_VERSION_11_0 110000
|
||||
|
||||
#endif /* #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) */
|
||||
|
||||
#define __DRIVERKIT_19_0 190000
|
||||
#define __DRIVERKIT_20_0 200000
|
||||
|
||||
#endif /* __AVAILABILITY_VERSIONS__ */
|
||||
508
lib/libc/include/aarch64-macos-gnu/TargetConditionals.h
Normal file
508
lib/libc/include/aarch64-macos-gnu/TargetConditionals.h
Normal file
@ -0,0 +1,508 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2014 by 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@
|
||||
*/
|
||||
|
||||
/*
|
||||
File: TargetConditionals.h
|
||||
|
||||
Contains: Autoconfiguration of TARGET_ conditionals for Mac OS X and iPhone
|
||||
|
||||
Note: TargetConditionals.h in 3.4 Universal Interfaces works
|
||||
with all compilers. This header only recognizes compilers
|
||||
known to run on Mac OS X.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __TARGETCONDITIONALS__
|
||||
#define __TARGETCONDITIONALS__
|
||||
|
||||
/*
|
||||
*
|
||||
* TARGET_CPU_*
|
||||
* These conditionals specify which microprocessor instruction set is being
|
||||
* generated. At most one of these is true, the rest are false.
|
||||
*
|
||||
* TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode
|
||||
* TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode
|
||||
* TARGET_CPU_68K - Compiler is generating 680x0 instructions
|
||||
* TARGET_CPU_X86 - Compiler is generating x86 instructions for 32-bit mode
|
||||
* TARGET_CPU_X86_64 - Compiler is generating x86 instructions for 64-bit mode
|
||||
* TARGET_CPU_ARM - Compiler is generating ARM instructions for 32-bit mode
|
||||
* TARGET_CPU_ARM64 - Compiler is generating ARM instructions for 64-bit mode
|
||||
* TARGET_CPU_MIPS - Compiler is generating MIPS instructions
|
||||
* TARGET_CPU_SPARC - Compiler is generating Sparc instructions
|
||||
* TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions
|
||||
*
|
||||
*
|
||||
* TARGET_OS_*
|
||||
* These conditionals specify in which Operating System the generated code will
|
||||
* run. Indention is used to show which conditionals are evolutionary subclasses.
|
||||
*
|
||||
* The MAC/WIN32/UNIX conditionals are mutually exclusive.
|
||||
* The IOS/TV/WATCH conditionals are mutually exclusive.
|
||||
*
|
||||
*
|
||||
* TARGET_OS_WIN32 - Generated code will run under 32-bit Windows
|
||||
* TARGET_OS_UNIX - Generated code will run under some Unix (not OSX)
|
||||
* TARGET_OS_MAC - Generated code will run under Mac OS X variant
|
||||
* TARGET_OS_OSX - Generated code will run under OS X devices
|
||||
* TARGET_OS_IPHONE - Generated code for firmware, devices, or simulator
|
||||
* TARGET_OS_IOS - Generated code will run under iOS
|
||||
* TARGET_OS_TV - Generated code will run under Apple TV OS
|
||||
* TARGET_OS_WATCH - Generated code will run under Apple Watch OS
|
||||
* TARGET_OS_BRIDGE - Generated code will run under Bridge devices
|
||||
* TARGET_OS_MACCATALYST - Generated code will run under macOS
|
||||
* TARGET_OS_SIMULATOR - Generated code will run under a simulator
|
||||
*
|
||||
* TARGET_OS_EMBEDDED - DEPRECATED: Use TARGET_OS_IPHONE and/or TARGET_OS_SIMULATOR instead
|
||||
* TARGET_IPHONE_SIMULATOR - DEPRECATED: Same as TARGET_OS_SIMULATOR
|
||||
* TARGET_OS_NANO - DEPRECATED: Same as TARGET_OS_WATCH
|
||||
*
|
||||
* +---------------------------------------------------------------------+
|
||||
* | TARGET_OS_MAC |
|
||||
* | +---+ +-----------------------------------------------+ +---------+ |
|
||||
* | | | | TARGET_OS_IPHONE | | | |
|
||||
* | | | | +---------------+ +----+ +-------+ +--------+ | | | |
|
||||
* | | | | | IOS | | | | | | | | | | |
|
||||
* | |OSX| | |+-------------+| | TV | | WATCH | | BRIDGE | | |DRIVERKIT| |
|
||||
* | | | | || MACCATALYST || | | | | | | | | | |
|
||||
* | | | | |+-------------+| | | | | | | | | | |
|
||||
* | | | | +---------------+ +----+ +-------+ +--------+ | | | |
|
||||
* | +---+ +-----------------------------------------------+ +---------+ |
|
||||
* +---------------------------------------------------------------------+
|
||||
*
|
||||
* TARGET_RT_*
|
||||
* These conditionals specify in which runtime the generated code will
|
||||
* run. This is needed when the OS and CPU support more than one runtime
|
||||
* (e.g. Mac OS X supports CFM and mach-o).
|
||||
*
|
||||
* TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers
|
||||
* TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers
|
||||
* TARGET_RT_64_BIT - Generated code uses 64-bit pointers
|
||||
* TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used
|
||||
* TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used
|
||||
*/
|
||||
|
||||
/*
|
||||
* TARGET_OS conditionals can be enabled via clang preprocessor extensions:
|
||||
*
|
||||
* __is_target_arch
|
||||
* __is_target_vendor
|
||||
* __is_target_os
|
||||
* __is_target_environment
|
||||
*
|
||||
* “-target=x86_64-apple-ios12-macabi”
|
||||
* TARGET_OS_MAC=1
|
||||
* TARGET_OS_IPHONE=1
|
||||
* TARGET_OS_IOS=1
|
||||
* TARGET_OS_MACCATALYST=1
|
||||
*
|
||||
* “-target=x86_64-apple-ios12-simulator”
|
||||
* TARGET_OS_MAC=1
|
||||
* TARGET_OS_IPHONE=1
|
||||
* TARGET_OS_IOS=1
|
||||
* TARGET_OS_SIMULATOR=1
|
||||
*
|
||||
* DYNAMIC_TARGETS_ENABLED indicates that the core TARGET_OS macros were enabled via clang preprocessor extensions.
|
||||
* If this value is not set, the macro enablements will fall back to the static behavior.
|
||||
* It is disabled by default.
|
||||
*/
|
||||
|
||||
#if defined(__has_builtin)
|
||||
#if __has_builtin(__is_target_arch)
|
||||
#if __has_builtin(__is_target_vendor)
|
||||
#if __has_builtin(__is_target_os)
|
||||
#if __has_builtin(__is_target_environment)
|
||||
|
||||
/* “-target=x86_64-apple-ios12-macabi” */
|
||||
/* “-target=arm64-apple-ios12-macabi” */
|
||||
/* “-target=arm64e-apple-ios12-macabi” */
|
||||
#if (__is_target_arch(x86_64) || __is_target_arch(arm64) || __is_target_arch(arm64e)) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(macabi)
|
||||
#define TARGET_OS_OSX 0
|
||||
#define TARGET_OS_IPHONE 1
|
||||
#define TARGET_OS_IOS 1
|
||||
#define TARGET_OS_WATCH 0
|
||||
|
||||
#define TARGET_OS_TV 0
|
||||
#define TARGET_OS_SIMULATOR 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#define TARGET_OS_RTKIT 0
|
||||
#define TARGET_OS_MACCATALYST 1
|
||||
#define TARGET_OS_MACCATALYST 1
|
||||
#ifndef TARGET_OS_UIKITFORMAC
|
||||
#define TARGET_OS_UIKITFORMAC 1
|
||||
#endif
|
||||
#define TARGET_OS_DRIVERKIT 0
|
||||
#define DYNAMIC_TARGETS_ENABLED 1
|
||||
#endif
|
||||
|
||||
/* “-target=x86_64-apple-ios12-simulator” */
|
||||
#if __is_target_arch(x86_64) && __is_target_vendor(apple) && __is_target_os(ios) && __is_target_environment(simulator)
|
||||
#define TARGET_OS_OSX 0
|
||||
#define TARGET_OS_IPHONE 1
|
||||
#define TARGET_OS_IOS 1
|
||||
#define TARGET_OS_WATCH 0
|
||||
|
||||
#define TARGET_OS_TV 0
|
||||
#define TARGET_OS_SIMULATOR 1
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#define TARGET_OS_RTKIT 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#ifndef TARGET_OS_UIKITFORMAC
|
||||
#define TARGET_OS_UIKITFORMAC 0
|
||||
#endif
|
||||
#define TARGET_OS_DRIVERKIT 0
|
||||
#define DYNAMIC_TARGETS_ENABLED 1
|
||||
#endif
|
||||
|
||||
/* -target=x86_64-apple-driverkit19.0 */
|
||||
/* -target=arm64-apple-driverkit19.0 */
|
||||
/* -target=arm64e-apple-driverkit19.0 */
|
||||
#if (__is_target_arch(x86_64) || __is_target_arch(arm64) || __is_target_arch(arm64e)) && __is_target_vendor(apple) && __is_target_os(driverkit)
|
||||
#define TARGET_OS_OSX 0
|
||||
#define TARGET_OS_IPHONE 0
|
||||
#define TARGET_OS_IOS 0
|
||||
#define TARGET_OS_WATCH 0
|
||||
|
||||
#define TARGET_OS_TV 0
|
||||
#define TARGET_OS_SIMULATOR 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#define TARGET_OS_RTKIT 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#ifndef TARGET_OS_UIKITFORMAC
|
||||
#define TARGET_OS_UIKITFORMAC 0
|
||||
#endif
|
||||
#define TARGET_OS_DRIVERKIT 1
|
||||
#define DYNAMIC_TARGETS_ENABLED 1
|
||||
#endif
|
||||
|
||||
#endif /* #if __has_builtin(__is_target_environment) */
|
||||
#endif /* #if __has_builtin(__is_target_os) */
|
||||
#endif /* #if __has_builtin(__is_target_vendor) */
|
||||
#endif /* #if __has_builtin(__is_target_arch) */
|
||||
#endif /* #if defined(__has_builtin) */
|
||||
|
||||
|
||||
#ifndef DYNAMIC_TARGETS_ENABLED
|
||||
#define DYNAMIC_TARGETS_ENABLED 0
|
||||
#endif /* DYNAMIC_TARGETS_ENABLED */
|
||||
|
||||
/*
|
||||
* gcc based compiler used on Mac OS X
|
||||
*/
|
||||
#if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
|
||||
#define TARGET_OS_MAC 1
|
||||
#define TARGET_OS_WIN32 0
|
||||
#define TARGET_OS_UNIX 0
|
||||
|
||||
#if !DYNAMIC_TARGETS_ENABLED
|
||||
#define TARGET_OS_OSX 1
|
||||
#define TARGET_OS_IPHONE 0
|
||||
#define TARGET_OS_IOS 0
|
||||
#define TARGET_OS_WATCH 0
|
||||
|
||||
#define TARGET_OS_TV 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#define TARGET_OS_MACCATALYST 0
|
||||
#ifndef TARGET_OS_UIKITFORMAC
|
||||
#define TARGET_OS_UIKITFORMAC 0
|
||||
#endif
|
||||
#define TARGET_OS_SIMULATOR 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#define TARGET_OS_RTKIT 0
|
||||
#define TARGET_OS_DRIVERKIT 0
|
||||
#endif
|
||||
|
||||
#define TARGET_IPHONE_SIMULATOR TARGET_OS_SIMULATOR /* deprecated */
|
||||
#define TARGET_OS_NANO TARGET_OS_WATCH /* deprecated */
|
||||
|
||||
#define TARGET_ABI_USES_IOS_VALUES (!TARGET_CPU_X86_64 || (TARGET_OS_IPHONE && !TARGET_OS_MACCATALYST))
|
||||
#if defined(__ppc__)
|
||||
#define TARGET_CPU_PPC 1
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 0
|
||||
#define TARGET_RT_BIG_ENDIAN 1
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#ifdef __MACOS_CLASSIC__
|
||||
#define TARGET_RT_MAC_CFM 1
|
||||
#define TARGET_RT_MAC_MACHO 0
|
||||
#else
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#endif
|
||||
#elif defined(__ppc64__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 1
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 0
|
||||
#define TARGET_RT_BIG_ENDIAN 1
|
||||
#define TARGET_RT_64_BIT 1
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#elif defined(__i386__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 1
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#elif defined(__x86_64__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 1
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#define TARGET_RT_64_BIT 1
|
||||
#elif defined(__arm__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 1
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#elif defined(__arm64__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 1
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#if __LP64__
|
||||
#define TARGET_RT_64_BIT 1
|
||||
#else
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#endif
|
||||
#else
|
||||
#error unrecognized GNU C compiler
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CodeWarrior compiler from Metrowerks/Motorola
|
||||
*/
|
||||
#elif defined(__MWERKS__)
|
||||
#define TARGET_OS_MAC 1
|
||||
#define TARGET_OS_WIN32 0
|
||||
#define TARGET_OS_UNIX 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#if defined(__POWERPC__)
|
||||
#define TARGET_CPU_PPC 1
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 0
|
||||
#define TARGET_RT_BIG_ENDIAN 1
|
||||
#elif defined(__INTEL__)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 1
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#else
|
||||
#error unknown Metrowerks CPU type
|
||||
#endif
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#ifdef __MACH__
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#else
|
||||
#define TARGET_RT_MAC_CFM 1
|
||||
#define TARGET_RT_MAC_MACHO 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* unknown compiler
|
||||
*/
|
||||
#else
|
||||
#if defined(TARGET_CPU_PPC) && TARGET_CPU_PPC
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_PPC64) && TARGET_CPU_PPC64
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_X86) && TARGET_CPU_X86
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_X86_64) && TARGET_CPU_X86_64
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_ARM) && TARGET_CPU_ARM
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#elif defined(TARGET_CPU_ARM64) && TARGET_CPU_ARM64
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_PPC64 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_X86_64 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#else
|
||||
/*
|
||||
NOTE: If your compiler errors out here then support for your compiler
|
||||
has not yet been added to TargetConditionals.h.
|
||||
|
||||
TargetConditionals.h is designed to be plug-and-play. It auto detects
|
||||
which compiler is being run and configures the TARGET_ conditionals
|
||||
appropriately.
|
||||
|
||||
The short term work around is to set the TARGET_CPU_ and TARGET_OS_
|
||||
on the command line to the compiler (e.g. -DTARGET_CPU_MIPS=1 -DTARGET_OS_UNIX=1)
|
||||
|
||||
The long term solution is to add a new case to this file which
|
||||
auto detects your compiler and sets up the TARGET_ conditionals.
|
||||
Then submit the changes to Apple Computer.
|
||||
*/
|
||||
#error TargetConditionals.h: unknown compiler (see comment above)
|
||||
#define TARGET_CPU_PPC 0
|
||||
#define TARGET_CPU_68K 0
|
||||
#define TARGET_CPU_X86 0
|
||||
#define TARGET_CPU_ARM 0
|
||||
#define TARGET_CPU_ARM64 0
|
||||
#define TARGET_CPU_MIPS 0
|
||||
#define TARGET_CPU_SPARC 0
|
||||
#define TARGET_CPU_ALPHA 0
|
||||
#endif
|
||||
#define TARGET_OS_MAC 1
|
||||
#define TARGET_OS_WIN32 0
|
||||
#define TARGET_OS_UNIX 0
|
||||
#define TARGET_OS_EMBEDDED 0
|
||||
#if TARGET_CPU_PPC || TARGET_CPU_PPC64
|
||||
#define TARGET_RT_BIG_ENDIAN 1
|
||||
#define TARGET_RT_LITTLE_ENDIAN 0
|
||||
#else
|
||||
#define TARGET_RT_BIG_ENDIAN 0
|
||||
#define TARGET_RT_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
#if TARGET_CPU_PPC64 || TARGET_CPU_X86_64
|
||||
#define TARGET_RT_64_BIT 1
|
||||
#else
|
||||
#define TARGET_RT_64_BIT 0
|
||||
#endif
|
||||
#ifdef __MACH__
|
||||
#define TARGET_RT_MAC_MACHO 1
|
||||
#define TARGET_RT_MAC_CFM 0
|
||||
#else
|
||||
#define TARGET_RT_MAC_MACHO 0
|
||||
#define TARGET_RT_MAC_CFM 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __TARGETCONDITIONALS__ */
|
||||
35
lib/libc/include/aarch64-macos-gnu/_ctermid.h
Normal file
35
lib/libc/include/aarch64-macos-gnu/_ctermid.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2002-2006, 2008-2010, 2012, 2020 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@
|
||||
*/
|
||||
|
||||
#ifndef _CTERMID_H_
|
||||
#define _CTERMID_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
char *ctermid(char *);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
9
lib/libc/include/aarch64-macos-gnu/arm/_limits.h
Normal file
9
lib/libc/include/aarch64-macos-gnu/arm/_limits.h
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _ARM__LIMITS_H_
|
||||
#define _ARM__LIMITS_H_
|
||||
|
||||
#define __DARWIN_CLK_TCK 100 /* ticks per second */
|
||||
|
||||
#endif /* _ARM__LIMITS_H_ */
|
||||
91
lib/libc/include/aarch64-macos-gnu/arm/_mcontext.h
Normal file
91
lib/libc/include/aarch64-macos-gnu/arm/_mcontext.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2012 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 __ARM_MCONTEXT_H_
|
||||
#define __ARM_MCONTEXT_H_
|
||||
|
||||
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <mach/machine/_structs.h>
|
||||
|
||||
#ifndef _STRUCT_MCONTEXT32
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_MCONTEXT32 struct __darwin_mcontext32
|
||||
_STRUCT_MCONTEXT32
|
||||
{
|
||||
_STRUCT_ARM_EXCEPTION_STATE __es;
|
||||
_STRUCT_ARM_THREAD_STATE __ss;
|
||||
_STRUCT_ARM_VFP_STATE __fs;
|
||||
};
|
||||
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_MCONTEXT32 struct mcontext32
|
||||
_STRUCT_MCONTEXT32
|
||||
{
|
||||
_STRUCT_ARM_EXCEPTION_STATE es;
|
||||
_STRUCT_ARM_THREAD_STATE ss;
|
||||
_STRUCT_ARM_VFP_STATE fs;
|
||||
};
|
||||
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#endif /* _STRUCT_MCONTEXT32 */
|
||||
|
||||
|
||||
#ifndef _STRUCT_MCONTEXT64
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_MCONTEXT64 struct __darwin_mcontext64
|
||||
_STRUCT_MCONTEXT64
|
||||
{
|
||||
_STRUCT_ARM_EXCEPTION_STATE64 __es;
|
||||
_STRUCT_ARM_THREAD_STATE64 __ss;
|
||||
_STRUCT_ARM_NEON_STATE64 __ns;
|
||||
};
|
||||
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_MCONTEXT64 struct mcontext64
|
||||
_STRUCT_MCONTEXT64
|
||||
{
|
||||
_STRUCT_ARM_EXCEPTION_STATE64 es;
|
||||
_STRUCT_ARM_THREAD_STATE64 ss;
|
||||
_STRUCT_ARM_NEON_STATE64 ns;
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#endif /* _STRUCT_MCONTEXT32 */
|
||||
|
||||
#ifndef _MCONTEXT_T
|
||||
#define _MCONTEXT_T
|
||||
#if defined(__arm64__)
|
||||
typedef _STRUCT_MCONTEXT64 *mcontext_t;
|
||||
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT64
|
||||
#else
|
||||
typedef _STRUCT_MCONTEXT32 *mcontext_t;
|
||||
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT32
|
||||
#endif
|
||||
#endif /* _MCONTEXT_T */
|
||||
|
||||
#endif /* __ARM_MCONTEXT_H_ */
|
||||
22
lib/libc/include/aarch64-macos-gnu/arm/_param.h
Normal file
22
lib/libc/include/aarch64-macos-gnu/arm/_param.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _ARM__PARAM_H_
|
||||
#define _ARM__PARAM_H_
|
||||
|
||||
#include <arm/_types.h>
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value for all
|
||||
* data types (int, long, ...). The result is unsigned int and must be
|
||||
* cast to any desired pointer type.
|
||||
*/
|
||||
#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
|
||||
#define __DARWIN_ALIGN(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
|
||||
|
||||
#define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1)
|
||||
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
|
||||
|
||||
|
||||
#endif /* _ARM__PARAM_H_ */
|
||||
98
lib/libc/include/aarch64-macos-gnu/arm/_types.h
Normal file
98
lib/libc/include/aarch64-macos-gnu/arm/_types.h
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _BSD_ARM__TYPES_H_
|
||||
#define _BSD_ARM__TYPES_H_
|
||||
|
||||
/*
|
||||
* This header file contains integer types. It's intended to also contain
|
||||
* flotaing point and other arithmetic types, as needed, later.
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
typedef __signed char __int8_t;
|
||||
#else /* !__GNUC__ */
|
||||
typedef char __int8_t;
|
||||
#endif /* !__GNUC__ */
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef short __int16_t;
|
||||
typedef unsigned short __uint16_t;
|
||||
typedef int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
|
||||
typedef long __darwin_intptr_t;
|
||||
typedef unsigned int __darwin_natural_t;
|
||||
|
||||
/*
|
||||
* The rune type below is declared to be an ``int'' instead of the more natural
|
||||
* ``unsigned long'' or ``long''. Two things are happening here. It is not
|
||||
* unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
|
||||
* it looks like 10646 will be a 31 bit standard. This means that if your
|
||||
* ints cannot hold 32 bits, you will be in trouble. The reason an int was
|
||||
* chosen over a long is that the is*() and to*() routines take ints (says
|
||||
* ANSI C), but they use __darwin_ct_rune_t instead of int. By changing it
|
||||
* here, you lose a bit of ANSI conformance, but your programs will still
|
||||
* work.
|
||||
*
|
||||
* NOTE: rune_t is not covered by ANSI nor other standards, and should not
|
||||
* be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and
|
||||
* rune_t must be the same type. Also wint_t must be no narrower than
|
||||
* wchar_t, and should also be able to hold all members of the largest
|
||||
* character set plus one extra value (WEOF). wint_t must be at least 16 bits.
|
||||
*/
|
||||
|
||||
typedef int __darwin_ct_rune_t; /* ct_rune_t */
|
||||
|
||||
/*
|
||||
* mbstate_t is an opaque object to keep conversion state, during multibyte
|
||||
* stream conversions. The content must not be referenced by user programs.
|
||||
*/
|
||||
typedef union {
|
||||
char __mbstate8[128];
|
||||
long long _mbstateL; /* for alignment */
|
||||
} __mbstate_t;
|
||||
|
||||
typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */
|
||||
|
||||
#if defined(__PTRDIFF_TYPE__)
|
||||
typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */
|
||||
#elif defined(__LP64__)
|
||||
typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */
|
||||
#else
|
||||
typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#if defined(__SIZE_TYPE__)
|
||||
typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */
|
||||
#else
|
||||
typedef unsigned long __darwin_size_t; /* sizeof() */
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ > 2)
|
||||
typedef __builtin_va_list __darwin_va_list; /* va_list */
|
||||
#else
|
||||
typedef void * __darwin_va_list; /* va_list */
|
||||
#endif
|
||||
|
||||
#if defined(__WCHAR_TYPE__)
|
||||
typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */
|
||||
#else
|
||||
typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */
|
||||
#endif
|
||||
|
||||
typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */
|
||||
|
||||
#if defined(__WINT_TYPE__)
|
||||
typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
|
||||
#else
|
||||
typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
|
||||
#endif
|
||||
|
||||
typedef unsigned long __darwin_clock_t; /* clock() */
|
||||
typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
|
||||
typedef long __darwin_ssize_t; /* byte count or error */
|
||||
typedef long __darwin_time_t; /* time() */
|
||||
|
||||
#endif /* _BSD_ARM__TYPES_H_ */
|
||||
67
lib/libc/include/aarch64-macos-gnu/arm/arch.h
Normal file
67
lib/libc/include/aarch64-macos-gnu/arm/arch.h
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2007 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 _ARM_ARCH_H
|
||||
#define _ARM_ARCH_H
|
||||
|
||||
/* Collect the __ARM_ARCH_*__ compiler flags into something easier to use. */
|
||||
#if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7S__) || defined (__ARM_ARCH_7F__) || defined (__ARM_ARCH_7K__)
|
||||
#define _ARM_ARCH_7
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
|
||||
#define _ARM_ARCH_6K
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__)
|
||||
#define _ARM_ARCH_6Z
|
||||
#endif
|
||||
|
||||
#if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) || \
|
||||
defined (_ARM_ARCH_6Z) || defined (_ARM_ARCH_6K)
|
||||
#define _ARM_ARCH_6
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_6) || defined (__ARM_ARCH_5E__) || \
|
||||
defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5TEJ__)
|
||||
#define _ARM_ARCH_5E
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_5E) || defined (__ARM_ARCH_5__) || \
|
||||
defined (__ARM_ARCH_5T__)
|
||||
#define _ARM_ARCH_5
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_5) || defined (__ARM_ARCH_4T__)
|
||||
#define _ARM_ARCH_4T
|
||||
#endif
|
||||
|
||||
#if defined (_ARM_ARCH_4T) || defined (__ARM_ARCH_4__)
|
||||
#define _ARM_ARCH_4
|
||||
#endif
|
||||
|
||||
#endif
|
||||
78
lib/libc/include/aarch64-macos-gnu/arm/endian.h
Normal file
78
lib/libc/include/aarch64-macos-gnu/arm/endian.h
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1987, 1991, 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.
|
||||
*
|
||||
* @(#)endian.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
#ifndef _ARM__ENDIAN_H_
|
||||
#define _ARM__ENDIAN_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
/*
|
||||
* Define _NOQUAD if the compiler does NOT support 64-bit integers.
|
||||
*/
|
||||
/* #define _NOQUAD */
|
||||
|
||||
/*
|
||||
* Define the order of 32-bit words in 64-bit words.
|
||||
*/
|
||||
#define _QUAD_HIGHWORD 1
|
||||
#define _QUAD_LOWWORD 0
|
||||
|
||||
/*
|
||||
* Definitions for byte order, according to byte significance from low
|
||||
* address to high.
|
||||
*/
|
||||
#define __DARWIN_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
|
||||
#define __DARWIN_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
|
||||
#define __DARWIN_PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
|
||||
|
||||
#define __DARWIN_BYTE_ORDER __DARWIN_LITTLE_ENDIAN
|
||||
|
||||
#if defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
|
||||
#define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
|
||||
#define BIG_ENDIAN __DARWIN_BIG_ENDIAN
|
||||
#define PDP_ENDIAN __DARWIN_PDP_ENDIAN
|
||||
|
||||
#define BYTE_ORDER __DARWIN_BYTE_ORDER
|
||||
|
||||
#include <sys/_endian.h>
|
||||
|
||||
#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */
|
||||
#endif /* !_ARM__ENDIAN_H_ */
|
||||
110
lib/libc/include/aarch64-macos-gnu/arm/limits.h
Normal file
110
lib/libc/include/aarch64-macos-gnu/arm/limits.h
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1988, 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.
|
||||
*
|
||||
* @(#)limits.h 8.3 (Berkeley) 1/4/94
|
||||
*/
|
||||
|
||||
#ifndef _ARM_LIMITS_H_
|
||||
#define _ARM_LIMITS_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <arm/_limits.h>
|
||||
|
||||
#define CHAR_BIT 8 /* number of bits in a char */
|
||||
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
#define CLK_TCK __DARWIN_CLK_TCK /* ticks per second */
|
||||
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
|
||||
/*
|
||||
* According to ANSI (section 2.2.4.2), the values below must be usable by
|
||||
* #if preprocessing directives. Additionally, the expression must have the
|
||||
* same type as would an expression that is an object of the corresponding
|
||||
* type converted according to the integral promotions. The subtraction for
|
||||
* INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
|
||||
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
|
||||
* These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
|
||||
* are written as hex so that GCC will be quiet about large integer constants.
|
||||
*/
|
||||
#define SCHAR_MAX 127 /* min value for a signed char */
|
||||
#define SCHAR_MIN (-128) /* max value for a signed char */
|
||||
|
||||
#define UCHAR_MAX 255 /* max value for an unsigned char */
|
||||
#define CHAR_MAX 127 /* max value for a char */
|
||||
#define CHAR_MIN (-128) /* min value for a char */
|
||||
|
||||
#define USHRT_MAX 65535 /* max value for an unsigned short */
|
||||
#define SHRT_MAX 32767 /* max value for a short */
|
||||
#define SHRT_MIN (-32768) /* min value for a short */
|
||||
|
||||
#define UINT_MAX 0xffffffff /* max value for an unsigned int */
|
||||
#define INT_MAX 2147483647 /* max value for an int */
|
||||
#define INT_MIN (-2147483647-1) /* min value for an int */
|
||||
|
||||
#ifdef __LP64__
|
||||
#define ULONG_MAX 0xffffffffffffffffUL /* max unsigned long */
|
||||
#define LONG_MAX 0x7fffffffffffffffL /* max signed long */
|
||||
#define LONG_MIN (-0x7fffffffffffffffL-1) /* min signed long */
|
||||
#else /* !__LP64__ */
|
||||
#define ULONG_MAX 0xffffffffUL /* max unsigned long */
|
||||
#define LONG_MAX 2147483647L /* max signed long */
|
||||
#define LONG_MIN (-2147483647L-1) /* min signed long */
|
||||
#endif /* __LP64__ */
|
||||
|
||||
#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */
|
||||
#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */
|
||||
#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */
|
||||
|
||||
#if !defined(_ANSI_SOURCE)
|
||||
#ifdef __LP64__
|
||||
#define LONG_BIT 64
|
||||
#else /* !__LP64__ */
|
||||
#define LONG_BIT 32
|
||||
#endif /* __LP64__ */
|
||||
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
|
||||
#define WORD_BIT 32
|
||||
|
||||
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
|
||||
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
|
||||
|
||||
#define UQUAD_MAX ULLONG_MAX
|
||||
#define QUAD_MAX LLONG_MAX
|
||||
#define QUAD_MIN LLONG_MIN
|
||||
|
||||
#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
|
||||
#endif /* _ARM_LIMITS_H_ */
|
||||
147
lib/libc/include/aarch64-macos-gnu/arm/param.h
Normal file
147
lib/libc/include/aarch64-macos-gnu/arm/param.h
Normal file
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2010 Apple Inc. All rights reserved.
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
* (c) UNIX System Laboratories, Inc.
|
||||
* All or some portions of this file are derived from material licensed
|
||||
* to the University of California by American Telephone and Telegraph
|
||||
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
|
||||
* the permission of UNIX System Laboratories, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)param.h 8.1 (Berkeley) 4/4/95
|
||||
*/
|
||||
|
||||
/*
|
||||
* Machine dependent constants for ARM
|
||||
*/
|
||||
|
||||
#ifndef _ARM_PARAM_H_
|
||||
#define _ARM_PARAM_H_
|
||||
|
||||
#include <arm/_param.h>
|
||||
|
||||
/*
|
||||
* Round p (pointer or byte index) up to a correctly-aligned value for all
|
||||
* data types (int, long, ...). The result is unsigned int and must be
|
||||
* cast to any desired pointer type.
|
||||
*/
|
||||
#define ALIGNBYTES __DARWIN_ALIGNBYTES
|
||||
#define ALIGN(p) __DARWIN_ALIGN(p)
|
||||
|
||||
#define NBPG 4096 /* bytes/page */
|
||||
#define PGOFSET (NBPG-1) /* byte offset into page */
|
||||
#define PGSHIFT 12 /* LOG2(NBPG) */
|
||||
|
||||
#define DEV_BSIZE 512
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
#define BLKDEV_IOSIZE 2048
|
||||
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
|
||||
|
||||
#define CLSIZE 1
|
||||
#define CLSIZELOG2 0
|
||||
|
||||
/*
|
||||
* Constants related to network buffer management.
|
||||
* MCLBYTES must be no larger than CLBYTES (the software page size), and,
|
||||
* on machines that exchange pages of input or output buffers with mbuf
|
||||
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
|
||||
* of the hardware page size.
|
||||
*/
|
||||
#define MSIZESHIFT 8 /* 256 */
|
||||
#define MSIZE (1 << MSIZESHIFT) /* size of an mbuf */
|
||||
#define MCLSHIFT 11 /* 2048 */
|
||||
#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */
|
||||
#define MBIGCLSHIFT 12 /* 4096 */
|
||||
#define MBIGCLBYTES (1 << MBIGCLSHIFT) /* size of a big cluster */
|
||||
#define M16KCLSHIFT 14 /* 16384 */
|
||||
#define M16KCLBYTES (1 << M16KCLSHIFT) /* size of a jumbo cluster */
|
||||
|
||||
#define MCLOFSET (MCLBYTES - 1)
|
||||
#ifndef NMBCLUSTERS
|
||||
#define NMBCLUSTERS CONFIG_NMBCLUSTERS /* cl map size */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some macros for units conversion
|
||||
*/
|
||||
/* Core clicks (NeXT_page_size bytes) to segments and vice versa */
|
||||
#define ctos(x) (x)
|
||||
#define stoc(x) (x)
|
||||
|
||||
/* Core clicks (4096 bytes) to disk blocks */
|
||||
#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))
|
||||
#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))
|
||||
#define dtob(x) ((x)<<DEV_BSHIFT)
|
||||
|
||||
/* clicks to bytes */
|
||||
#define ctob(x) ((x)<<PGSHIFT)
|
||||
|
||||
/* bytes to clicks */
|
||||
#define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT)
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define btodb(bytes, devBlockSize) \
|
||||
((unsigned)(bytes) / devBlockSize)
|
||||
#define dbtob(db, devBlockSize) \
|
||||
((unsigned)(db) * devBlockSize)
|
||||
#else
|
||||
#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
|
||||
((unsigned)(bytes) >> DEV_BSHIFT)
|
||||
#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
|
||||
((unsigned)(db) << DEV_BSHIFT)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Map a ``block device block'' to a file system block.
|
||||
* This should be device dependent, and will be if we
|
||||
* add an entry to cdevsw/bdevsw for that purpose.
|
||||
* For now though just use DEV_BSIZE.
|
||||
*/
|
||||
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
|
||||
|
||||
/*
|
||||
* Macros to decode (and encode) processor status word.
|
||||
*/
|
||||
#define STATUS_WORD(rpl, ipl) (((ipl) << 8) | (rpl))
|
||||
#define USERMODE(x) (((x) & 3) == 3)
|
||||
#define BASEPRI(x) (((x) & (255 << 8)) == 0)
|
||||
|
||||
|
||||
#if defined(KERNEL) || defined(STANDALONE)
|
||||
#define DELAY(n) delay(n)
|
||||
|
||||
#else /* defined(KERNEL) || defined(STANDALONE) */
|
||||
#define DELAY(n) { int N = (n); while (--N > 0); }
|
||||
#endif /* defined(KERNEL) || defined(STANDALONE) */
|
||||
|
||||
#endif /* _ARM_PARAM_H_ */
|
||||
18
lib/libc/include/aarch64-macos-gnu/arm/signal.h
Normal file
18
lib/libc/include/aarch64-macos-gnu/arm/signal.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2009 Apple, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ARM_SIGNAL_
|
||||
#define _ARM_SIGNAL_ 1
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#ifndef _ANSI_SOURCE
|
||||
typedef int sig_atomic_t;
|
||||
#endif /* ! _ANSI_SOURCE */
|
||||
|
||||
#endif /* _ARM_SIGNAL_ */
|
||||
107
lib/libc/include/aarch64-macos-gnu/arm/types.h
Normal file
107
lib/libc/include/aarch64-macos-gnu/arm/types.h
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1990, 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.
|
||||
*
|
||||
* @(#)types.h 8.3 (Berkeley) 1/5/94
|
||||
*/
|
||||
|
||||
#ifndef _MACHTYPES_H_
|
||||
#define _MACHTYPES_H_
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
#include <arm/_types.h>
|
||||
#include <sys/cdefs.h>
|
||||
/*
|
||||
* Basic integral types. Omit the typedef if
|
||||
* not possible for a machine/compiler combination.
|
||||
*/
|
||||
#include <sys/_types/_int8_t.h>
|
||||
#include <sys/_types/_int16_t.h>
|
||||
#include <sys/_types/_int32_t.h>
|
||||
#include <sys/_types/_int64_t.h>
|
||||
|
||||
#include <sys/_types/_u_int8_t.h>
|
||||
#include <sys/_types/_u_int16_t.h>
|
||||
#include <sys/_types/_u_int32_t.h>
|
||||
#include <sys/_types/_u_int64_t.h>
|
||||
|
||||
#if __LP64__
|
||||
typedef int64_t register_t;
|
||||
#else
|
||||
typedef int32_t register_t;
|
||||
#endif
|
||||
|
||||
#include <sys/_types/_intptr_t.h>
|
||||
#include <sys/_types/_uintptr_t.h>
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
/* These types are used for reserving the largest possible size. */
|
||||
#ifdef __arm64__
|
||||
typedef u_int64_t user_addr_t;
|
||||
typedef u_int64_t user_size_t;
|
||||
typedef int64_t user_ssize_t;
|
||||
typedef int64_t user_long_t;
|
||||
typedef u_int64_t user_ulong_t;
|
||||
typedef int64_t user_time_t;
|
||||
typedef int64_t user_off_t;
|
||||
#else
|
||||
typedef u_int32_t user_addr_t;
|
||||
typedef u_int32_t user_size_t;
|
||||
typedef int32_t user_ssize_t;
|
||||
typedef int32_t user_long_t;
|
||||
typedef u_int32_t user_ulong_t;
|
||||
typedef int32_t user_time_t;
|
||||
typedef int64_t user_off_t;
|
||||
#endif
|
||||
|
||||
#define USER_ADDR_NULL ((user_addr_t) 0)
|
||||
#define CAST_USER_ADDR_T(a_ptr) ((user_addr_t)((uintptr_t)(a_ptr)))
|
||||
|
||||
|
||||
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
|
||||
/* This defines the size of syscall arguments after copying into the kernel: */
|
||||
#if defined(__arm__)
|
||||
typedef u_int32_t syscall_arg_t;
|
||||
#elif defined(__arm64__)
|
||||
typedef u_int64_t syscall_arg_t;
|
||||
#else
|
||||
#error Unknown architecture.
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
#endif /* _MACHTYPES_H_ */
|
||||
391
lib/libc/include/aarch64-macos-gnu/bsm/audit.h
Normal file
391
lib/libc/include/aarch64-macos-gnu/bsm/audit.h
Normal file
@ -0,0 +1,391 @@
|
||||
/*-
|
||||
* Copyright (c) 2005-2009 Apple Inc.
|
||||
* 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. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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.
|
||||
*
|
||||
* $P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#10 $
|
||||
*/
|
||||
|
||||
#ifndef _BSM_AUDIT_H
|
||||
#define _BSM_AUDIT_H
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define AUDIT_RECORD_MAGIC 0x828a0f1b
|
||||
#define MAX_AUDIT_RECORDS 20
|
||||
#define MAXAUDITDATA (0x8000 - 1)
|
||||
#define MAX_AUDIT_RECORD_SIZE MAXAUDITDATA
|
||||
#define MIN_AUDIT_FILE_SIZE (512 * 1024)
|
||||
|
||||
/*
|
||||
* Minimum noumber of free blocks on the filesystem containing the audit
|
||||
* log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0
|
||||
* as the kernel does an unsigned compare, plus we want to leave a few blocks
|
||||
* free so userspace can terminate the log, etc.
|
||||
*/
|
||||
#define AUDIT_HARD_LIMIT_FREE_BLOCKS 4
|
||||
|
||||
/*
|
||||
* Triggers for the audit daemon.
|
||||
*/
|
||||
#define AUDIT_TRIGGER_MIN 1
|
||||
#define AUDIT_TRIGGER_LOW_SPACE 1 /* Below low watermark. */
|
||||
#define AUDIT_TRIGGER_ROTATE_KERNEL 2 /* Kernel requests rotate. */
|
||||
#define AUDIT_TRIGGER_READ_FILE 3 /* Re-read config file. */
|
||||
#define AUDIT_TRIGGER_CLOSE_AND_DIE 4 /* Terminate audit. */
|
||||
#define AUDIT_TRIGGER_NO_SPACE 5 /* Below min free space. */
|
||||
#define AUDIT_TRIGGER_ROTATE_USER 6 /* User requests rotate. */
|
||||
#define AUDIT_TRIGGER_INITIALIZE 7 /* User initialize of auditd. */
|
||||
#define AUDIT_TRIGGER_EXPIRE_TRAILS 8 /* User expiration of trails. */
|
||||
#define AUDIT_TRIGGER_MAX 8
|
||||
|
||||
/*
|
||||
* The special device filename (FreeBSD).
|
||||
*/
|
||||
#define AUDITDEV_FILENAME "audit"
|
||||
#define AUDIT_TRIGGER_FILE ("/dev/" AUDITDEV_FILENAME)
|
||||
|
||||
/*
|
||||
* Pre-defined audit IDs
|
||||
*/
|
||||
#define AU_DEFAUDITID (uid_t)(-1)
|
||||
#define AU_DEFAUDITSID 0
|
||||
#define AU_ASSIGN_ASID -1
|
||||
|
||||
/*
|
||||
* IPC types.
|
||||
*/
|
||||
#define AT_IPC_MSG ((unsigned char)1) /* Message IPC id. */
|
||||
#define AT_IPC_SEM ((unsigned char)2) /* Semaphore IPC id. */
|
||||
#define AT_IPC_SHM ((unsigned char)3) /* Shared mem IPC id. */
|
||||
|
||||
/*
|
||||
* Audit conditions.
|
||||
*/
|
||||
#define AUC_UNSET 0
|
||||
#define AUC_AUDITING 1
|
||||
#define AUC_NOAUDIT 2
|
||||
#define AUC_DISABLED -1
|
||||
|
||||
/*
|
||||
* auditon(2) commands.
|
||||
*/
|
||||
#define A_OLDGETPOLICY 2
|
||||
#define A_OLDSETPOLICY 3
|
||||
#define A_GETKMASK 4
|
||||
#define A_SETKMASK 5
|
||||
#define A_OLDGETQCTRL 6
|
||||
#define A_OLDSETQCTRL 7
|
||||
#define A_GETCWD 8
|
||||
#define A_GETCAR 9
|
||||
#define A_GETSTAT 12
|
||||
#define A_SETSTAT 13
|
||||
#define A_SETUMASK 14
|
||||
#define A_SETSMASK 15
|
||||
#define A_OLDGETCOND 20
|
||||
#define A_OLDSETCOND 21
|
||||
#define A_GETCLASS 22
|
||||
#define A_SETCLASS 23
|
||||
#define A_GETPINFO 24
|
||||
#define A_SETPMASK 25
|
||||
#define A_SETFSIZE 26
|
||||
#define A_GETFSIZE 27
|
||||
#define A_GETPINFO_ADDR 28
|
||||
#define A_GETKAUDIT 29
|
||||
#define A_SETKAUDIT 30
|
||||
#define A_SENDTRIGGER 31
|
||||
#define A_GETSINFO_ADDR 32
|
||||
#define A_GETPOLICY 33
|
||||
#define A_SETPOLICY 34
|
||||
#define A_GETQCTRL 35
|
||||
#define A_SETQCTRL 36
|
||||
#define A_GETCOND 37
|
||||
#define A_SETCOND 38
|
||||
#define A_GETSFLAGS 39
|
||||
#define A_SETSFLAGS 40
|
||||
#define A_GETCTLMODE 41
|
||||
#define A_SETCTLMODE 42
|
||||
#define A_GETEXPAFTER 43
|
||||
#define A_SETEXPAFTER 44
|
||||
|
||||
/*
|
||||
* Audit policy controls.
|
||||
*/
|
||||
#define AUDIT_CNT 0x0001
|
||||
#define AUDIT_AHLT 0x0002
|
||||
#define AUDIT_ARGV 0x0004
|
||||
#define AUDIT_ARGE 0x0008
|
||||
#define AUDIT_SEQ 0x0010
|
||||
#define AUDIT_WINDATA 0x0020
|
||||
#define AUDIT_USER 0x0040
|
||||
#define AUDIT_GROUP 0x0080
|
||||
#define AUDIT_TRAIL 0x0100
|
||||
#define AUDIT_PATH 0x0200
|
||||
#define AUDIT_SCNT 0x0400
|
||||
#define AUDIT_PUBLIC 0x0800
|
||||
#define AUDIT_ZONENAME 0x1000
|
||||
#define AUDIT_PERZONE 0x2000
|
||||
|
||||
/*
|
||||
* Default audit queue control parameters.
|
||||
*/
|
||||
#define AQ_HIWATER 100
|
||||
#define AQ_MAXHIGH 10000
|
||||
#define AQ_LOWATER 10
|
||||
#define AQ_BUFSZ MAXAUDITDATA
|
||||
#define AQ_MAXBUFSZ 1048576
|
||||
|
||||
/*
|
||||
* Default minimum percentage free space on file system.
|
||||
*/
|
||||
#define AU_FS_MINFREE 20
|
||||
|
||||
/*
|
||||
* Type definitions used indicating the length of variable length addresses
|
||||
* in tokens containing addresses, such as header fields.
|
||||
*/
|
||||
#define AU_IPv4 4
|
||||
#define AU_IPv6 16
|
||||
|
||||
/*
|
||||
* Reserved audit class mask indicating which classes are unable to have
|
||||
* events added or removed by unentitled processes.
|
||||
*/
|
||||
#define AU_CLASS_MASK_RESERVED 0x10000000
|
||||
|
||||
/*
|
||||
* Audit control modes
|
||||
*/
|
||||
#define AUDIT_CTLMODE_NORMAL ((unsigned char)1)
|
||||
#define AUDIT_CTLMODE_EXTERNAL ((unsigned char)2)
|
||||
|
||||
/*
|
||||
* Audit file expire_after op modes
|
||||
*/
|
||||
#define AUDIT_EXPIRE_OP_AND ((unsigned char)0)
|
||||
#define AUDIT_EXPIRE_OP_OR ((unsigned char)1)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
typedef uid_t au_id_t;
|
||||
typedef pid_t au_asid_t;
|
||||
typedef u_int16_t au_event_t;
|
||||
typedef u_int16_t au_emod_t;
|
||||
typedef u_int32_t au_class_t;
|
||||
typedef u_int64_t au_asflgs_t __attribute__ ((aligned(8)));
|
||||
typedef unsigned char au_ctlmode_t;
|
||||
|
||||
struct au_tid {
|
||||
dev_t port;
|
||||
u_int32_t machine;
|
||||
};
|
||||
typedef struct au_tid au_tid_t;
|
||||
|
||||
struct au_tid_addr {
|
||||
dev_t at_port;
|
||||
u_int32_t at_type;
|
||||
u_int32_t at_addr[4];
|
||||
};
|
||||
typedef struct au_tid_addr au_tid_addr_t;
|
||||
|
||||
struct au_mask {
|
||||
unsigned int am_success; /* Success bits. */
|
||||
unsigned int am_failure; /* Failure bits. */
|
||||
};
|
||||
typedef struct au_mask au_mask_t;
|
||||
|
||||
struct auditinfo {
|
||||
au_id_t ai_auid; /* Audit user ID. */
|
||||
au_mask_t ai_mask; /* Audit masks. */
|
||||
au_tid_t ai_termid; /* Terminal ID. */
|
||||
au_asid_t ai_asid; /* Audit session ID. */
|
||||
};
|
||||
typedef struct auditinfo auditinfo_t;
|
||||
|
||||
struct auditinfo_addr {
|
||||
au_id_t ai_auid; /* Audit user ID. */
|
||||
au_mask_t ai_mask; /* Audit masks. */
|
||||
au_tid_addr_t ai_termid; /* Terminal ID. */
|
||||
au_asid_t ai_asid; /* Audit session ID. */
|
||||
au_asflgs_t ai_flags; /* Audit session flags. */
|
||||
};
|
||||
typedef struct auditinfo_addr auditinfo_addr_t;
|
||||
|
||||
struct auditpinfo {
|
||||
pid_t ap_pid; /* ID of target process. */
|
||||
au_id_t ap_auid; /* Audit user ID. */
|
||||
au_mask_t ap_mask; /* Audit masks. */
|
||||
au_tid_t ap_termid; /* Terminal ID. */
|
||||
au_asid_t ap_asid; /* Audit session ID. */
|
||||
};
|
||||
typedef struct auditpinfo auditpinfo_t;
|
||||
|
||||
struct auditpinfo_addr {
|
||||
pid_t ap_pid; /* ID of target process. */
|
||||
au_id_t ap_auid; /* Audit user ID. */
|
||||
au_mask_t ap_mask; /* Audit masks. */
|
||||
au_tid_addr_t ap_termid; /* Terminal ID. */
|
||||
au_asid_t ap_asid; /* Audit session ID. */
|
||||
au_asflgs_t ap_flags; /* Audit session flags. */
|
||||
};
|
||||
typedef struct auditpinfo_addr auditpinfo_addr_t;
|
||||
|
||||
struct au_session {
|
||||
auditinfo_addr_t *as_aia_p; /* Ptr to full audit info. */
|
||||
au_mask_t as_mask; /* Process Audit Masks. */
|
||||
};
|
||||
typedef struct au_session au_session_t;
|
||||
|
||||
struct au_expire_after {
|
||||
time_t age; /* Age after which trail files should be expired */
|
||||
size_t size; /* Aggregate trail size when files should be expired */
|
||||
unsigned char op_type; /* Operator used with the above values to determine when files should be expired */
|
||||
};
|
||||
typedef struct au_expire_after au_expire_after_t;
|
||||
|
||||
/*
|
||||
* Contents of token_t are opaque outside of libbsm.
|
||||
*/
|
||||
typedef struct au_token token_t;
|
||||
|
||||
/*
|
||||
* Kernel audit queue control parameters:
|
||||
* Default: Maximum:
|
||||
* aq_hiwater: AQ_HIWATER (100) AQ_MAXHIGH (10000)
|
||||
* aq_lowater: AQ_LOWATER (10) <aq_hiwater
|
||||
* aq_bufsz: AQ_BUFSZ (32767) AQ_MAXBUFSZ (1048576)
|
||||
* aq_delay: 20 20000 (not used)
|
||||
*/
|
||||
struct au_qctrl {
|
||||
int aq_hiwater; /* Max # of audit recs in queue when */
|
||||
/* threads with new ARs get blocked. */
|
||||
|
||||
int aq_lowater; /* # of audit recs in queue when */
|
||||
/* blocked threads get unblocked. */
|
||||
|
||||
int aq_bufsz; /* Max size of audit record for audit(2). */
|
||||
int aq_delay; /* Queue delay (not used). */
|
||||
int aq_minfree; /* Minimum filesystem percent free space. */
|
||||
};
|
||||
typedef struct au_qctrl au_qctrl_t;
|
||||
|
||||
/*
|
||||
* Structure for the audit statistics.
|
||||
*/
|
||||
struct audit_stat {
|
||||
unsigned int as_version;
|
||||
unsigned int as_numevent;
|
||||
int as_generated;
|
||||
int as_nonattrib;
|
||||
int as_kernel;
|
||||
int as_audit;
|
||||
int as_auditctl;
|
||||
int as_enqueue;
|
||||
int as_written;
|
||||
int as_wblocked;
|
||||
int as_rblocked;
|
||||
int as_dropped;
|
||||
int as_totalsize;
|
||||
unsigned int as_memused;
|
||||
};
|
||||
typedef struct audit_stat au_stat_t;
|
||||
|
||||
/*
|
||||
* Structure for the audit file statistics.
|
||||
*/
|
||||
struct audit_fstat {
|
||||
u_int64_t af_filesz;
|
||||
u_int64_t af_currsz;
|
||||
};
|
||||
typedef struct audit_fstat au_fstat_t;
|
||||
|
||||
/*
|
||||
* Audit to event class mapping.
|
||||
*/
|
||||
struct au_evclass_map {
|
||||
au_event_t ec_number;
|
||||
au_class_t ec_class;
|
||||
};
|
||||
typedef struct au_evclass_map au_evclass_map_t;
|
||||
|
||||
|
||||
#if !defined(_KERNEL) && !defined(KERNEL)
|
||||
#include <Availability.h>
|
||||
#define __AUDIT_API_DEPRECATED __API_DEPRECATED("audit is deprecated", macos(10.4, 11.0))
|
||||
#else
|
||||
#define __AUDIT_API_DEPRECATED
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Audit system calls.
|
||||
*/
|
||||
#if !defined(_KERNEL) && !defined(KERNEL)
|
||||
int audit(const void *, int)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
int auditon(int, void *, int)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
int auditctl(const char *)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
int getauid(au_id_t *);
|
||||
int setauid(const au_id_t *);
|
||||
int getaudit_addr(struct auditinfo_addr *, int);
|
||||
int setaudit_addr(const struct auditinfo_addr *, int);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <Availability.h>
|
||||
|
||||
/*
|
||||
* getaudit()/setaudit() are deprecated and have been replaced with
|
||||
* wrappers to the getaudit_addr()/setaudit_addr() syscalls above.
|
||||
*/
|
||||
|
||||
int getaudit(struct auditinfo *)
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
|
||||
__IPHONE_2_0, __IPHONE_6_0);
|
||||
int setaudit(const struct auditinfo *)
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8,
|
||||
__IPHONE_2_0, __IPHONE_6_0);
|
||||
#else
|
||||
|
||||
int getaudit(struct auditinfo *)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
int setaudit(const struct auditinfo *)
|
||||
__AUDIT_API_DEPRECATED;
|
||||
#endif /* !__APPLE__ */
|
||||
|
||||
#ifdef __APPLE_API_PRIVATE
|
||||
#include <mach/port.h>
|
||||
mach_port_name_t audit_session_self(void);
|
||||
au_asid_t audit_session_join(mach_port_name_t port);
|
||||
int audit_session_port(au_asid_t asid, mach_port_name_t *portname);
|
||||
#endif /* __APPLE_API_PRIVATE */
|
||||
|
||||
#endif /* defined(_KERNEL) || defined(KERNEL) */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_BSM_AUDIT_H */
|
||||
428
lib/libc/include/aarch64-macos-gnu/dispatch/block.h
Normal file
428
lib/libc/include/aarch64-macos-gnu/dispatch/block.h
Normal file
@ -0,0 +1,428 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_BLOCK__
|
||||
#define __DISPATCH_BLOCK__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
|
||||
/*!
|
||||
* @group Dispatch block objects
|
||||
*/
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_block_flags_t
|
||||
* Flags to pass to the dispatch_block_create* functions.
|
||||
*
|
||||
* @const DISPATCH_BLOCK_BARRIER
|
||||
* Flag indicating that a dispatch block object should act as a barrier block
|
||||
* when submitted to a DISPATCH_QUEUE_CONCURRENT queue.
|
||||
* See dispatch_barrier_async() for details.
|
||||
* This flag has no effect when the dispatch block object is invoked directly.
|
||||
*
|
||||
* @const DISPATCH_BLOCK_DETACHED
|
||||
* Flag indicating that a dispatch block object should execute disassociated
|
||||
* from current execution context attributes such as os_activity_t
|
||||
* and properties of the current IPC request (if any). With regard to QoS class,
|
||||
* the behavior is the same as for DISPATCH_BLOCK_NO_QOS. If invoked directly,
|
||||
* the block object will remove the other attributes from the calling thread for
|
||||
* the duration of the block body (before applying attributes assigned to the
|
||||
* block object, if any). If submitted to a queue, the block object will be
|
||||
* executed with the attributes of the queue (or any attributes specifically
|
||||
* assigned to the block object).
|
||||
*
|
||||
* @const DISPATCH_BLOCK_ASSIGN_CURRENT
|
||||
* Flag indicating that a dispatch block object should be assigned the execution
|
||||
* context attributes that are current at the time the block object is created.
|
||||
* This applies to attributes such as QOS class, os_activity_t and properties of
|
||||
* the current IPC request (if any). If invoked directly, the block object will
|
||||
* apply these attributes to the calling thread for the duration of the block
|
||||
* body. If the block object is submitted to a queue, this flag replaces the
|
||||
* default behavior of associating the submitted block instance with the
|
||||
* execution context attributes that are current at the time of submission.
|
||||
* If a specific QOS class is assigned with DISPATCH_BLOCK_NO_QOS_CLASS or
|
||||
* dispatch_block_create_with_qos_class(), that QOS class takes precedence over
|
||||
* the QOS class assignment indicated by this flag.
|
||||
*
|
||||
* @const DISPATCH_BLOCK_NO_QOS_CLASS
|
||||
* Flag indicating that a dispatch block object should be not be assigned a QOS
|
||||
* class. If invoked directly, the block object will be executed with the QOS
|
||||
* class of the calling thread. If the block object is submitted to a queue,
|
||||
* this replaces the default behavior of associating the submitted block
|
||||
* instance with the QOS class current at the time of submission.
|
||||
* This flag is ignored if a specific QOS class is assigned with
|
||||
* dispatch_block_create_with_qos_class().
|
||||
*
|
||||
* @const DISPATCH_BLOCK_INHERIT_QOS_CLASS
|
||||
* Flag indicating that execution of a dispatch block object submitted to a
|
||||
* queue should prefer the QOS class assigned to the queue over the QOS class
|
||||
* assigned to the block (resp. associated with the block at the time of
|
||||
* submission). The latter will only be used if the queue in question does not
|
||||
* have an assigned QOS class, as long as doing so does not result in a QOS
|
||||
* class lower than the QOS class inherited from the queue's target queue.
|
||||
* This flag is the default when a dispatch block object is submitted to a queue
|
||||
* for asynchronous execution and has no effect when the dispatch block object
|
||||
* is invoked directly. It is ignored if DISPATCH_BLOCK_ENFORCE_QOS_CLASS is
|
||||
* also passed.
|
||||
*
|
||||
* @const DISPATCH_BLOCK_ENFORCE_QOS_CLASS
|
||||
* Flag indicating that execution of a dispatch block object submitted to a
|
||||
* queue should prefer the QOS class assigned to the block (resp. associated
|
||||
* with the block at the time of submission) over the QOS class assigned to the
|
||||
* queue, as long as doing so will not result in a lower QOS class.
|
||||
* This flag is the default when a dispatch block object is submitted to a queue
|
||||
* for synchronous execution or when the dispatch block object is invoked
|
||||
* directly.
|
||||
*/
|
||||
DISPATCH_OPTIONS(dispatch_block_flags, unsigned long,
|
||||
DISPATCH_BLOCK_BARRIER
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x1,
|
||||
DISPATCH_BLOCK_DETACHED
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x2,
|
||||
DISPATCH_BLOCK_ASSIGN_CURRENT
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x4,
|
||||
DISPATCH_BLOCK_NO_QOS_CLASS
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x8,
|
||||
DISPATCH_BLOCK_INHERIT_QOS_CLASS
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x10,
|
||||
DISPATCH_BLOCK_ENFORCE_QOS_CLASS
|
||||
DISPATCH_ENUM_API_AVAILABLE(macos(10.10), ios(8.0)) = 0x20,
|
||||
);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_create
|
||||
*
|
||||
* @abstract
|
||||
* Create a new dispatch block object on the heap from an existing block and
|
||||
* the given flags.
|
||||
*
|
||||
* @discussion
|
||||
* The provided block is Block_copy'ed to the heap and retained by the newly
|
||||
* created dispatch block object.
|
||||
*
|
||||
* The returned dispatch block object is intended to be submitted to a dispatch
|
||||
* queue with dispatch_async() and related functions, but may also be invoked
|
||||
* directly. Both operations can be performed an arbitrary number of times but
|
||||
* only the first completed execution of a dispatch block object can be waited
|
||||
* on with dispatch_block_wait() or observed with dispatch_block_notify().
|
||||
*
|
||||
* If the returned dispatch block object is submitted to a dispatch queue, the
|
||||
* submitted block instance will be associated with the QOS class current at the
|
||||
* time of submission, unless one of the following flags assigned a specific QOS
|
||||
* class (or no QOS class) at the time of block creation:
|
||||
* - DISPATCH_BLOCK_ASSIGN_CURRENT
|
||||
* - DISPATCH_BLOCK_NO_QOS_CLASS
|
||||
* - DISPATCH_BLOCK_DETACHED
|
||||
* The QOS class the block object will be executed with also depends on the QOS
|
||||
* class assigned to the queue and which of the following flags was specified or
|
||||
* defaulted to:
|
||||
* - DISPATCH_BLOCK_INHERIT_QOS_CLASS (default for asynchronous execution)
|
||||
* - DISPATCH_BLOCK_ENFORCE_QOS_CLASS (default for synchronous execution)
|
||||
* See description of dispatch_block_flags_t for details.
|
||||
*
|
||||
* If the returned dispatch block object is submitted directly to a serial queue
|
||||
* and is configured to execute with a specific QOS class, the system will make
|
||||
* a best effort to apply the necessary QOS overrides to ensure that blocks
|
||||
* submitted earlier to the serial queue are executed at that same QOS class or
|
||||
* higher.
|
||||
*
|
||||
* @param flags
|
||||
* Configuration flags for the block object.
|
||||
* Passing a value that is not a bitwise OR of flags from dispatch_block_flags_t
|
||||
* results in NULL being returned.
|
||||
*
|
||||
* @param block
|
||||
* The block to create the dispatch block object from.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch block object, or NULL.
|
||||
* When not building with Objective-C ARC, must be released with a -[release]
|
||||
* message or the Block_release() function.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_RETURNS_RETAINED_BLOCK
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_block_t
|
||||
dispatch_block_create(dispatch_block_flags_t flags, dispatch_block_t block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_create_with_qos_class
|
||||
*
|
||||
* @abstract
|
||||
* Create a new dispatch block object on the heap from an existing block and
|
||||
* the given flags, and assign it the specified QOS class and relative priority.
|
||||
*
|
||||
* @discussion
|
||||
* The provided block is Block_copy'ed to the heap and retained by the newly
|
||||
* created dispatch block object.
|
||||
*
|
||||
* The returned dispatch block object is intended to be submitted to a dispatch
|
||||
* queue with dispatch_async() and related functions, but may also be invoked
|
||||
* directly. Both operations can be performed an arbitrary number of times but
|
||||
* only the first completed execution of a dispatch block object can be waited
|
||||
* on with dispatch_block_wait() or observed with dispatch_block_notify().
|
||||
*
|
||||
* If invoked directly, the returned dispatch block object will be executed with
|
||||
* the assigned QOS class as long as that does not result in a lower QOS class
|
||||
* than what is current on the calling thread.
|
||||
*
|
||||
* If the returned dispatch block object is submitted to a dispatch queue, the
|
||||
* QOS class it will be executed with depends on the QOS class assigned to the
|
||||
* block, the QOS class assigned to the queue and which of the following flags
|
||||
* was specified or defaulted to:
|
||||
* - DISPATCH_BLOCK_INHERIT_QOS_CLASS: default for asynchronous execution
|
||||
* - DISPATCH_BLOCK_ENFORCE_QOS_CLASS: default for synchronous execution
|
||||
* See description of dispatch_block_flags_t for details.
|
||||
*
|
||||
* If the returned dispatch block object is submitted directly to a serial queue
|
||||
* and is configured to execute with a specific QOS class, the system will make
|
||||
* a best effort to apply the necessary QOS overrides to ensure that blocks
|
||||
* submitted earlier to the serial queue are executed at that same QOS class or
|
||||
* higher.
|
||||
*
|
||||
* @param flags
|
||||
* Configuration flags for the new block object.
|
||||
* Passing a value that is not a bitwise OR of flags from dispatch_block_flags_t
|
||||
* results in NULL being returned.
|
||||
*
|
||||
* @param qos_class
|
||||
* A QOS class value:
|
||||
* - QOS_CLASS_USER_INTERACTIVE
|
||||
* - QOS_CLASS_USER_INITIATED
|
||||
* - QOS_CLASS_DEFAULT
|
||||
* - QOS_CLASS_UTILITY
|
||||
* - QOS_CLASS_BACKGROUND
|
||||
* - QOS_CLASS_UNSPECIFIED
|
||||
* Passing QOS_CLASS_UNSPECIFIED is equivalent to specifying the
|
||||
* DISPATCH_BLOCK_NO_QOS_CLASS flag. Passing any other value results in NULL
|
||||
* being returned.
|
||||
*
|
||||
* @param relative_priority
|
||||
* A relative priority within the QOS class. This value is a negative
|
||||
* offset from the maximum supported scheduler priority for the given class.
|
||||
* Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY
|
||||
* results in NULL being returned.
|
||||
*
|
||||
* @param block
|
||||
* The block to create the dispatch block object from.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch block object, or NULL.
|
||||
* When not building with Objective-C ARC, must be released with a -[release]
|
||||
* message or the Block_release() function.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL4 DISPATCH_RETURNS_RETAINED_BLOCK
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_block_t
|
||||
dispatch_block_create_with_qos_class(dispatch_block_flags_t flags,
|
||||
dispatch_qos_class_t qos_class, int relative_priority,
|
||||
dispatch_block_t block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_perform
|
||||
*
|
||||
* @abstract
|
||||
* Create, synchronously execute and release a dispatch block object from the
|
||||
* specified block and flags.
|
||||
*
|
||||
* @discussion
|
||||
* Behaves identically to the sequence
|
||||
* <code>
|
||||
* dispatch_block_t b = dispatch_block_create(flags, block);
|
||||
* b();
|
||||
* Block_release(b);
|
||||
* </code>
|
||||
* but may be implemented more efficiently internally by not requiring a copy
|
||||
* to the heap of the specified block or the allocation of a new block object.
|
||||
*
|
||||
* @param flags
|
||||
* Configuration flags for the temporary block object.
|
||||
* The result of passing a value that is not a bitwise OR of flags from
|
||||
* dispatch_block_flags_t is undefined.
|
||||
*
|
||||
* @param block
|
||||
* The block to create the temporary block object from.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_block_perform(dispatch_block_flags_t flags,
|
||||
DISPATCH_NOESCAPE dispatch_block_t block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_wait
|
||||
*
|
||||
* @abstract
|
||||
* Wait synchronously until execution of the specified dispatch block object has
|
||||
* completed or until the specified timeout has elapsed.
|
||||
*
|
||||
* @discussion
|
||||
* This function will return immediately if execution of the block object has
|
||||
* already completed.
|
||||
*
|
||||
* It is not possible to wait for multiple executions of the same block object
|
||||
* with this interface; use dispatch_group_wait() for that purpose. A single
|
||||
* dispatch block object may either be waited on once and executed once,
|
||||
* or it may be executed any number of times. The behavior of any other
|
||||
* combination is undefined. Submission to a dispatch queue counts as an
|
||||
* execution, even if cancellation (dispatch_block_cancel) means the block's
|
||||
* code never runs.
|
||||
*
|
||||
* The result of calling this function from multiple threads simultaneously
|
||||
* with the same dispatch block object is undefined, but note that doing so
|
||||
* would violate the rules described in the previous paragraph.
|
||||
*
|
||||
* If this function returns indicating that the specified timeout has elapsed,
|
||||
* then that invocation does not count as the one allowed wait.
|
||||
*
|
||||
* If at the time this function is called, the specified dispatch block object
|
||||
* has been submitted directly to a serial queue, the system will make a best
|
||||
* effort to apply the necessary QOS overrides to ensure that the block and any
|
||||
* blocks submitted earlier to that serial queue are executed at the QOS class
|
||||
* (or higher) of the thread calling dispatch_block_wait().
|
||||
*
|
||||
* @param block
|
||||
* The dispatch block object to wait on.
|
||||
* The result of passing NULL or a block object not returned by one of the
|
||||
* dispatch_block_create* functions is undefined.
|
||||
*
|
||||
* @param timeout
|
||||
* When to timeout (see dispatch_time). As a convenience, there are the
|
||||
* DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
|
||||
*
|
||||
* @result
|
||||
* Returns zero on success (the dispatch block object completed within the
|
||||
* specified timeout) or non-zero on error (i.e. timed out).
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_notify
|
||||
*
|
||||
* @abstract
|
||||
* Schedule a notification block to be submitted to a queue when the execution
|
||||
* of a specified dispatch block object has completed.
|
||||
*
|
||||
* @discussion
|
||||
* This function will submit the notification block immediately if execution of
|
||||
* the observed block object has already completed.
|
||||
*
|
||||
* It is not possible to be notified of multiple executions of the same block
|
||||
* object with this interface, use dispatch_group_notify() for that purpose.
|
||||
*
|
||||
* A single dispatch block object may either be observed one or more times
|
||||
* and executed once, or it may be executed any number of times. The behavior
|
||||
* of any other combination is undefined. Submission to a dispatch queue
|
||||
* counts as an execution, even if cancellation (dispatch_block_cancel) means
|
||||
* the block's code never runs.
|
||||
*
|
||||
* If multiple notification blocks are scheduled for a single block object,
|
||||
* there is no defined order in which the notification blocks will be submitted
|
||||
* to their associated queues.
|
||||
*
|
||||
* @param block
|
||||
* The dispatch block object to observe.
|
||||
* The result of passing NULL or a block object not returned by one of the
|
||||
* dispatch_block_create* functions is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The queue to which the supplied notification block will be submitted when
|
||||
* the observed block completes.
|
||||
*
|
||||
* @param notification_block
|
||||
* The notification block to submit when the observed block object completes.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_block_notify(dispatch_block_t block, dispatch_queue_t queue,
|
||||
dispatch_block_t notification_block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_cancel
|
||||
*
|
||||
* @abstract
|
||||
* Asynchronously cancel the specified dispatch block object.
|
||||
*
|
||||
* @discussion
|
||||
* Cancellation causes any future execution of the dispatch block object to
|
||||
* return immediately, but does not affect any execution of the block object
|
||||
* that is already in progress.
|
||||
*
|
||||
* Release of any resources associated with the block object will be delayed
|
||||
* until execution of the block object is next attempted (or any execution
|
||||
* already in progress completes).
|
||||
*
|
||||
* NOTE: care needs to be taken to ensure that a block object that may be
|
||||
* canceled does not capture any resources that require execution of the
|
||||
* block body in order to be released (e.g. memory allocated with
|
||||
* malloc(3) that the block body calls free(3) on). Such resources will
|
||||
* be leaked if the block body is never executed due to cancellation.
|
||||
*
|
||||
* @param block
|
||||
* The dispatch block object to cancel.
|
||||
* The result of passing NULL or a block object not returned by one of the
|
||||
* dispatch_block_create* functions is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_block_cancel(dispatch_block_t block);
|
||||
|
||||
/*!
|
||||
* @function dispatch_block_testcancel
|
||||
*
|
||||
* @abstract
|
||||
* Tests whether the given dispatch block object has been canceled.
|
||||
*
|
||||
* @param block
|
||||
* The dispatch block object to test.
|
||||
* The result of passing NULL or a block object not returned by one of the
|
||||
* dispatch_block_create* functions is undefined.
|
||||
*
|
||||
* @result
|
||||
* Non-zero if canceled and zero if not canceled.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_block_testcancel(dispatch_block_t block);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif // __BLOCKS__
|
||||
|
||||
#endif // __DISPATCH_BLOCK__
|
||||
80
lib/libc/include/aarch64-macos-gnu/dispatch/dispatch.h
Normal file
80
lib/libc/include/aarch64-macos-gnu/dispatch/dispatch.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_PUBLIC__
|
||||
#define __DISPATCH_PUBLIC__
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
#include <os/availability.h>
|
||||
#include <TargetConditionals.h>
|
||||
#include <os/base.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <os/generic_win_base.h>
|
||||
#elif defined(__unix__)
|
||||
#include <os/generic_unix_base.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#if defined(_WIN32)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__has_feature)
|
||||
#if __has_feature(modules)
|
||||
#if !defined(__arm__)
|
||||
#include <stdio.h> // for off_t (to match Glibc.modulemap)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DISPATCH_API_VERSION 20181008
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#define __DISPATCH_INDIRECT__
|
||||
#endif
|
||||
|
||||
#include <os/object.h>
|
||||
#include <os/workgroup.h>
|
||||
#include <dispatch/base.h>
|
||||
#include <dispatch/time.h>
|
||||
#include <dispatch/object.h>
|
||||
#include <dispatch/queue.h>
|
||||
#include <dispatch/block.h>
|
||||
#include <dispatch/source.h>
|
||||
#include <dispatch/group.h>
|
||||
#include <dispatch/semaphore.h>
|
||||
#include <dispatch/once.h>
|
||||
#include <dispatch/data.h>
|
||||
#include <dispatch/io.h>
|
||||
#include <dispatch/workloop.h>
|
||||
|
||||
#undef __DISPATCH_INDIRECT__
|
||||
|
||||
#endif
|
||||
279
lib/libc/include/aarch64-macos-gnu/dispatch/group.h
Normal file
279
lib/libc/include/aarch64-macos-gnu/dispatch/group.h
Normal file
@ -0,0 +1,279 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_GROUP__
|
||||
#define __DISPATCH_GROUP__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_group_t
|
||||
* @abstract
|
||||
* A group of blocks submitted to queues for asynchronous invocation.
|
||||
*/
|
||||
DISPATCH_DECL(dispatch_group);
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_create
|
||||
*
|
||||
* @abstract
|
||||
* Creates new group with which blocks may be associated.
|
||||
*
|
||||
* @discussion
|
||||
* This function creates a new group with which blocks may be associated.
|
||||
* The dispatch group may be used to wait for the completion of the blocks it
|
||||
* references. The group object memory is freed with dispatch_release().
|
||||
*
|
||||
* @result
|
||||
* The newly created group, or NULL on failure.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_group_t
|
||||
dispatch_group_create(void);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_async
|
||||
*
|
||||
* @abstract
|
||||
* Submits a block to a dispatch queue and associates the block with the given
|
||||
* dispatch group.
|
||||
*
|
||||
* @discussion
|
||||
* Submits a block to a dispatch queue and associates the block with the given
|
||||
* dispatch group. The dispatch group may be used to wait for the completion
|
||||
* of the blocks it references.
|
||||
*
|
||||
* @param group
|
||||
* A dispatch group to associate with the submitted block.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The dispatch queue to which the block will be submitted for asynchronous
|
||||
* invocation.
|
||||
*
|
||||
* @param block
|
||||
* The block to perform asynchronously.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_async(dispatch_group_t group,
|
||||
dispatch_queue_t queue,
|
||||
dispatch_block_t block);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_async_f
|
||||
*
|
||||
* @abstract
|
||||
* Submits a function to a dispatch queue and associates the block with the
|
||||
* given dispatch group.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_group_async() for details.
|
||||
*
|
||||
* @param group
|
||||
* A dispatch group to associate with the submitted function.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The dispatch queue to which the function will be submitted for asynchronous
|
||||
* invocation.
|
||||
*
|
||||
* @param context
|
||||
* The application-defined context parameter to pass to the function.
|
||||
*
|
||||
* @param work
|
||||
* The application-defined function to invoke on the target queue. The first
|
||||
* parameter passed to this function is the context provided to
|
||||
* dispatch_group_async_f().
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4
|
||||
DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_async_f(dispatch_group_t group,
|
||||
dispatch_queue_t queue,
|
||||
void *_Nullable context,
|
||||
dispatch_function_t work);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_wait
|
||||
*
|
||||
* @abstract
|
||||
* Wait synchronously until all the blocks associated with a group have
|
||||
* completed or until the specified timeout has elapsed.
|
||||
*
|
||||
* @discussion
|
||||
* This function waits for the completion of the blocks associated with the
|
||||
* given dispatch group, and returns after all blocks have completed or when
|
||||
* the specified timeout has elapsed.
|
||||
*
|
||||
* This function will return immediately if there are no blocks associated
|
||||
* with the dispatch group (i.e. the group is empty).
|
||||
*
|
||||
* The result of calling this function from multiple threads simultaneously
|
||||
* with the same dispatch group is undefined.
|
||||
*
|
||||
* After the successful return of this function, the dispatch group is empty.
|
||||
* It may either be released with dispatch_release() or re-used for additional
|
||||
* blocks. See dispatch_group_async() for more information.
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to wait on.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param timeout
|
||||
* When to timeout (see dispatch_time). As a convenience, there are the
|
||||
* DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
|
||||
*
|
||||
* @result
|
||||
* Returns zero on success (all blocks associated with the group completed
|
||||
* within the specified timeout) or non-zero on error (i.e. timed out).
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_group_wait(dispatch_group_t group, dispatch_time_t timeout);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_notify
|
||||
*
|
||||
* @abstract
|
||||
* Schedule a block to be submitted to a queue when all the blocks associated
|
||||
* with a group have completed.
|
||||
*
|
||||
* @discussion
|
||||
* This function schedules a notification block to be submitted to the specified
|
||||
* queue once all blocks associated with the dispatch group have completed.
|
||||
*
|
||||
* If no blocks are associated with the dispatch group (i.e. the group is empty)
|
||||
* then the notification block will be submitted immediately.
|
||||
*
|
||||
* The group will be empty at the time the notification block is submitted to
|
||||
* the target queue. The group may either be released with dispatch_release()
|
||||
* or reused for additional operations.
|
||||
* See dispatch_group_async() for more information.
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to observe.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The queue to which the supplied block will be submitted when the group
|
||||
* completes.
|
||||
*
|
||||
* @param block
|
||||
* The block to submit when the group completes.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_notify(dispatch_group_t group,
|
||||
dispatch_queue_t queue,
|
||||
dispatch_block_t block);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_notify_f
|
||||
*
|
||||
* @abstract
|
||||
* Schedule a function to be submitted to a queue when all the blocks
|
||||
* associated with a group have completed.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_group_notify() for details.
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to observe.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param context
|
||||
* The application-defined context parameter to pass to the function.
|
||||
*
|
||||
* @param work
|
||||
* The application-defined function to invoke on the target queue. The first
|
||||
* parameter passed to this function is the context provided to
|
||||
* dispatch_group_notify_f().
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4
|
||||
DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_notify_f(dispatch_group_t group,
|
||||
dispatch_queue_t queue,
|
||||
void *_Nullable context,
|
||||
dispatch_function_t work);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_enter
|
||||
*
|
||||
* @abstract
|
||||
* Manually indicate a block has entered the group
|
||||
*
|
||||
* @discussion
|
||||
* Calling this function indicates another block has joined the group through
|
||||
* a means other than dispatch_group_async(). Calls to this function must be
|
||||
* balanced with dispatch_group_leave().
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to update.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_enter(dispatch_group_t group);
|
||||
|
||||
/*!
|
||||
* @function dispatch_group_leave
|
||||
*
|
||||
* @abstract
|
||||
* Manually indicate a block in the group has completed
|
||||
*
|
||||
* @discussion
|
||||
* Calling this function indicates block has completed and left the dispatch
|
||||
* group by a means other than dispatch_group_async().
|
||||
*
|
||||
* @param group
|
||||
* The dispatch group to update.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_group_leave(dispatch_group_t group);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
606
lib/libc/include/aarch64-macos-gnu/dispatch/object.h
Normal file
606
lib/libc/include/aarch64-macos-gnu/dispatch/object.h
Normal file
@ -0,0 +1,606 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2012 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_OBJECT__
|
||||
#define __DISPATCH_OBJECT__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
#if __has_include(<sys/qos.h>)
|
||||
#include <sys/qos.h>
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_object_t
|
||||
*
|
||||
* @abstract
|
||||
* Abstract base type for all dispatch objects.
|
||||
* The details of the type definition are language-specific.
|
||||
*
|
||||
* @discussion
|
||||
* Dispatch objects are reference counted via calls to dispatch_retain() and
|
||||
* dispatch_release().
|
||||
*/
|
||||
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
/*
|
||||
* By default, dispatch objects are declared as Objective-C types when building
|
||||
* with an Objective-C compiler. This allows them to participate in ARC, in RR
|
||||
* management by the Blocks runtime and in leaks checking by the static
|
||||
* analyzer, and enables them to be added to Cocoa collections.
|
||||
* See <os/object.h> for details.
|
||||
*/
|
||||
OS_OBJECT_DECL_CLASS(dispatch_object);
|
||||
|
||||
#if OS_OBJECT_SWIFT3
|
||||
#define DISPATCH_DECL(name) OS_OBJECT_DECL_SUBCLASS_SWIFT(name, dispatch_object)
|
||||
#define DISPATCH_DECL_SUBCLASS(name, base) OS_OBJECT_DECL_SUBCLASS_SWIFT(name, base)
|
||||
#else // OS_OBJECT_SWIFT3
|
||||
#define DISPATCH_DECL(name) OS_OBJECT_DECL_SUBCLASS(name, dispatch_object)
|
||||
#define DISPATCH_DECL_SUBCLASS(name, base) OS_OBJECT_DECL_SUBCLASS(name, base)
|
||||
|
||||
DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
_dispatch_object_validate(dispatch_object_t object)
|
||||
{
|
||||
void *isa = *(void *volatile*)(OS_OBJECT_BRIDGE void*)object;
|
||||
(void)isa;
|
||||
}
|
||||
#endif // OS_OBJECT_SWIFT3
|
||||
|
||||
#define DISPATCH_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object))
|
||||
#define DISPATCH_RETURNS_RETAINED OS_OBJECT_RETURNS_RETAINED
|
||||
#elif defined(__cplusplus) && !defined(__DISPATCH_BUILDING_DISPATCH__)
|
||||
/*
|
||||
* Dispatch objects are NOT C++ objects. Nevertheless, we can at least keep C++
|
||||
* aware of type compatibility.
|
||||
*/
|
||||
typedef struct dispatch_object_s {
|
||||
private:
|
||||
dispatch_object_s();
|
||||
~dispatch_object_s();
|
||||
dispatch_object_s(const dispatch_object_s &);
|
||||
void operator=(const dispatch_object_s &);
|
||||
} *dispatch_object_t;
|
||||
#define DISPATCH_DECL(name) \
|
||||
typedef struct name##_s : public dispatch_object_s {} *name##_t
|
||||
#define DISPATCH_DECL_SUBCLASS(name, base) \
|
||||
typedef struct name##_s : public base##_s {} *name##_t
|
||||
#define DISPATCH_GLOBAL_OBJECT(type, object) (static_cast<type>(&(object)))
|
||||
#define DISPATCH_RETURNS_RETAINED
|
||||
#else /* Plain C */
|
||||
typedef union {
|
||||
struct _os_object_s *_os_obj;
|
||||
struct dispatch_object_s *_do;
|
||||
struct dispatch_queue_s *_dq;
|
||||
struct dispatch_queue_attr_s *_dqa;
|
||||
struct dispatch_group_s *_dg;
|
||||
struct dispatch_source_s *_ds;
|
||||
struct dispatch_channel_s *_dch;
|
||||
struct dispatch_mach_s *_dm;
|
||||
struct dispatch_mach_msg_s *_dmsg;
|
||||
struct dispatch_semaphore_s *_dsema;
|
||||
struct dispatch_data_s *_ddata;
|
||||
struct dispatch_io_s *_dchannel;
|
||||
} dispatch_object_t DISPATCH_TRANSPARENT_UNION;
|
||||
#define DISPATCH_DECL(name) typedef struct name##_s *name##_t
|
||||
#define DISPATCH_DECL_SUBCLASS(name, base) typedef base##_t name##_t
|
||||
#define DISPATCH_GLOBAL_OBJECT(type, object) ((type)&(object))
|
||||
#define DISPATCH_RETURNS_RETAINED
|
||||
#endif
|
||||
|
||||
#if OS_OBJECT_SWIFT3 && OS_OBJECT_USE_OBJC
|
||||
#define DISPATCH_SOURCE_TYPE_DECL(name) \
|
||||
DISPATCH_EXPORT struct dispatch_source_type_s \
|
||||
_dispatch_source_type_##name; \
|
||||
OS_OBJECT_DECL_PROTOCOL(dispatch_source_##name, <OS_dispatch_source>); \
|
||||
OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL( \
|
||||
dispatch_source, dispatch_source_##name)
|
||||
#define DISPATCH_SOURCE_DECL(name) \
|
||||
DISPATCH_DECL(name); \
|
||||
OS_OBJECT_DECL_PROTOCOL(name, <NSObject>); \
|
||||
OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, name)
|
||||
#ifndef DISPATCH_DATA_DECL
|
||||
#define DISPATCH_DATA_DECL(name) OS_OBJECT_DECL_SWIFT(name)
|
||||
#endif // DISPATCH_DATA_DECL
|
||||
#else
|
||||
#define DISPATCH_SOURCE_DECL(name) \
|
||||
DISPATCH_DECL(name);
|
||||
#define DISPATCH_DATA_DECL(name) DISPATCH_DECL(name)
|
||||
#define DISPATCH_SOURCE_TYPE_DECL(name) \
|
||||
DISPATCH_EXPORT const struct dispatch_source_type_s \
|
||||
_dispatch_source_type_##name
|
||||
#endif
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @typedef dispatch_block_t
|
||||
*
|
||||
* @abstract
|
||||
* The type of blocks submitted to dispatch queues, which take no arguments
|
||||
* and have no return value.
|
||||
*
|
||||
* @discussion
|
||||
* When not building with Objective-C ARC, a block object allocated on or
|
||||
* copied to the heap must be released with a -[release] message or the
|
||||
* Block_release() function.
|
||||
*
|
||||
* The declaration of a block literal allocates storage on the stack.
|
||||
* Therefore, this is an invalid construct:
|
||||
* <code>
|
||||
* dispatch_block_t block;
|
||||
* if (x) {
|
||||
* block = ^{ printf("true\n"); };
|
||||
* } else {
|
||||
* block = ^{ printf("false\n"); };
|
||||
* }
|
||||
* block(); // unsafe!!!
|
||||
* </code>
|
||||
*
|
||||
* What is happening behind the scenes:
|
||||
* <code>
|
||||
* if (x) {
|
||||
* struct Block __tmp_1 = ...; // setup details
|
||||
* block = &__tmp_1;
|
||||
* } else {
|
||||
* struct Block __tmp_2 = ...; // setup details
|
||||
* block = &__tmp_2;
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* As the example demonstrates, the address of a stack variable is escaping the
|
||||
* scope in which it is allocated. That is a classic C bug.
|
||||
*
|
||||
* Instead, the block literal must be copied to the heap with the Block_copy()
|
||||
* function or by sending it a -[copy] message.
|
||||
*/
|
||||
typedef void (^dispatch_block_t)(void);
|
||||
#endif // __BLOCKS__
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_qos_class_t
|
||||
* Alias for qos_class_t type.
|
||||
*/
|
||||
#if __has_include(<sys/qos.h>)
|
||||
typedef qos_class_t dispatch_qos_class_t;
|
||||
#else
|
||||
typedef unsigned int dispatch_qos_class_t;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_retain
|
||||
*
|
||||
* @abstract
|
||||
* Increment the reference count of a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* Calls to dispatch_retain() must be balanced with calls to
|
||||
* dispatch_release().
|
||||
*
|
||||
* @param object
|
||||
* The object to retain.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
DISPATCH_SWIFT_UNAVAILABLE("Can't be used with ARC")
|
||||
void
|
||||
dispatch_retain(dispatch_object_t object);
|
||||
#if OS_OBJECT_USE_OBJC_RETAIN_RELEASE
|
||||
#undef dispatch_retain
|
||||
#define dispatch_retain(object) \
|
||||
__extension__({ dispatch_object_t _o = (object); \
|
||||
_dispatch_object_validate(_o); (void)[_o retain]; })
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_release
|
||||
*
|
||||
* @abstract
|
||||
* Decrement the reference count of a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* A dispatch object is asynchronously deallocated once all references are
|
||||
* released (i.e. the reference count becomes zero). The system does not
|
||||
* guarantee that a given client is the last or only reference to a given
|
||||
* object.
|
||||
*
|
||||
* @param object
|
||||
* The object to release.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
DISPATCH_SWIFT_UNAVAILABLE("Can't be used with ARC")
|
||||
void
|
||||
dispatch_release(dispatch_object_t object);
|
||||
#if OS_OBJECT_USE_OBJC_RETAIN_RELEASE
|
||||
#undef dispatch_release
|
||||
#define dispatch_release(object) \
|
||||
__extension__({ dispatch_object_t _o = (object); \
|
||||
_dispatch_object_validate(_o); [_o release]; })
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_get_context
|
||||
*
|
||||
* @abstract
|
||||
* Returns the application defined context of the object.
|
||||
*
|
||||
* @param object
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* The context of the object; may be NULL.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_PURE DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
void *_Nullable
|
||||
dispatch_get_context(dispatch_object_t object);
|
||||
|
||||
/*!
|
||||
* @function dispatch_set_context
|
||||
*
|
||||
* @abstract
|
||||
* Associates an application defined context with the object.
|
||||
*
|
||||
* @param object
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param context
|
||||
* The new client defined context for the object. This may be NULL.
|
||||
*
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_set_context(dispatch_object_t object, void *_Nullable context);
|
||||
|
||||
/*!
|
||||
* @function dispatch_set_finalizer_f
|
||||
*
|
||||
* @abstract
|
||||
* Set the finalizer function for a dispatch object.
|
||||
*
|
||||
* @param object
|
||||
* The dispatch object to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param finalizer
|
||||
* The finalizer function pointer.
|
||||
*
|
||||
* @discussion
|
||||
* A dispatch object's finalizer will be invoked on the object's target queue
|
||||
* after all references to the object have been released. This finalizer may be
|
||||
* used by the application to release any resources associated with the object,
|
||||
* such as freeing the object's context.
|
||||
* The context parameter passed to the finalizer function is the current
|
||||
* context of the dispatch object at the time the finalizer call is made.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_set_finalizer_f(dispatch_object_t object,
|
||||
dispatch_function_t _Nullable finalizer);
|
||||
|
||||
/*!
|
||||
* @function dispatch_activate
|
||||
*
|
||||
* @abstract
|
||||
* Activates the specified dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* Dispatch objects such as queues and sources may be created in an inactive
|
||||
* state. Objects in this state have to be activated before any blocks
|
||||
* associated with them will be invoked.
|
||||
*
|
||||
* The target queue of inactive objects can be changed using
|
||||
* dispatch_set_target_queue(). Change of target queue is no longer permitted
|
||||
* once an initially inactive object has been activated.
|
||||
*
|
||||
* Calling dispatch_activate() on an active object has no effect.
|
||||
* Releasing the last reference count on an inactive object is undefined.
|
||||
*
|
||||
* @param object
|
||||
* The object to be activated.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_activate(dispatch_object_t object);
|
||||
|
||||
/*!
|
||||
* @function dispatch_suspend
|
||||
*
|
||||
* @abstract
|
||||
* Suspends the invocation of blocks on a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* A suspended object will not invoke any blocks associated with it. The
|
||||
* suspension of an object will occur after any running block associated with
|
||||
* the object completes.
|
||||
*
|
||||
* Calls to dispatch_suspend() must be balanced with calls
|
||||
* to dispatch_resume().
|
||||
*
|
||||
* @param object
|
||||
* The object to be suspended.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_suspend(dispatch_object_t object);
|
||||
|
||||
/*!
|
||||
* @function dispatch_resume
|
||||
*
|
||||
* @abstract
|
||||
* Resumes the invocation of blocks on a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* Dispatch objects can be suspended with dispatch_suspend(), which increments
|
||||
* an internal suspension count. dispatch_resume() is the inverse operation,
|
||||
* and consumes suspension counts. When the last suspension count is consumed,
|
||||
* blocks associated with the object will be invoked again.
|
||||
*
|
||||
* For backward compatibility reasons, dispatch_resume() on an inactive and not
|
||||
* otherwise suspended dispatch source object has the same effect as calling
|
||||
* dispatch_activate(). For new code, using dispatch_activate() is preferred.
|
||||
*
|
||||
* If the specified object has zero suspension count and is not an inactive
|
||||
* source, this function will result in an assertion and the process being
|
||||
* terminated.
|
||||
*
|
||||
* @param object
|
||||
* The object to be resumed.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_resume(dispatch_object_t object);
|
||||
|
||||
/*!
|
||||
* @function dispatch_set_qos_class_floor
|
||||
*
|
||||
* @abstract
|
||||
* Sets the QOS class floor on a dispatch queue, source or workloop.
|
||||
*
|
||||
* @discussion
|
||||
* The QOS class of workitems submitted to this object asynchronously will be
|
||||
* elevated to at least the specified QOS class floor. The QOS of the workitem
|
||||
* will be used if higher than the floor even when the workitem has been created
|
||||
* without "ENFORCE" semantics.
|
||||
*
|
||||
* Setting the QOS class floor is equivalent to the QOS effects of configuring
|
||||
* a queue whose target queue has a QoS class set to the same value.
|
||||
*
|
||||
* @param object
|
||||
* A dispatch queue, workloop, or source to configure.
|
||||
* The object must be inactive.
|
||||
*
|
||||
* Passing another object type or an object that has been activated is undefined
|
||||
* and will cause the process to be terminated.
|
||||
*
|
||||
* @param qos_class
|
||||
* A QOS class value:
|
||||
* - QOS_CLASS_USER_INTERACTIVE
|
||||
* - QOS_CLASS_USER_INITIATED
|
||||
* - QOS_CLASS_DEFAULT
|
||||
* - QOS_CLASS_UTILITY
|
||||
* - QOS_CLASS_BACKGROUND
|
||||
* Passing any other value is undefined.
|
||||
*
|
||||
* @param relative_priority
|
||||
* A relative priority within the QOS class. This value is a negative
|
||||
* offset from the maximum supported scheduler priority for the given class.
|
||||
* Passing a value greater than zero or less than QOS_MIN_RELATIVE_PRIORITY
|
||||
* is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_set_qos_class_floor(dispatch_object_t object,
|
||||
dispatch_qos_class_t qos_class, int relative_priority);
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @function dispatch_wait
|
||||
*
|
||||
* @abstract
|
||||
* Wait synchronously for an object or until the specified timeout has elapsed.
|
||||
*
|
||||
* @discussion
|
||||
* Type-generic macro that maps to dispatch_block_wait, dispatch_group_wait or
|
||||
* dispatch_semaphore_wait, depending on the type of the first argument.
|
||||
* See documentation for these functions for more details.
|
||||
* This function is unavailable for any other object type.
|
||||
*
|
||||
* @param object
|
||||
* The object to wait on.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param timeout
|
||||
* When to timeout (see dispatch_time). As a convenience, there are the
|
||||
* DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
|
||||
*
|
||||
* @result
|
||||
* Returns zero on success or non-zero on error (i.e. timed out).
|
||||
*/
|
||||
DISPATCH_UNAVAILABLE
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_wait(void *object, dispatch_time_t timeout);
|
||||
#if __has_extension(c_generic_selections)
|
||||
#define dispatch_wait(object, timeout) \
|
||||
_Generic((object), \
|
||||
dispatch_block_t:dispatch_block_wait, \
|
||||
dispatch_group_t:dispatch_group_wait, \
|
||||
dispatch_semaphore_t:dispatch_semaphore_wait \
|
||||
)((object),(timeout))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_notify
|
||||
*
|
||||
* @abstract
|
||||
* Schedule a notification block to be submitted to a queue when the execution
|
||||
* of a specified object has completed.
|
||||
*
|
||||
* @discussion
|
||||
* Type-generic macro that maps to dispatch_block_notify or
|
||||
* dispatch_group_notify, depending on the type of the first argument.
|
||||
* See documentation for these functions for more details.
|
||||
* This function is unavailable for any other object type.
|
||||
*
|
||||
* @param object
|
||||
* The object to observe.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param queue
|
||||
* The queue to which the supplied notification block will be submitted when
|
||||
* the observed object completes.
|
||||
*
|
||||
* @param notification_block
|
||||
* The block to submit when the observed object completes.
|
||||
*/
|
||||
DISPATCH_UNAVAILABLE
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_notify(void *object, dispatch_object_t queue,
|
||||
dispatch_block_t notification_block);
|
||||
#if __has_extension(c_generic_selections)
|
||||
#define dispatch_notify(object, queue, notification_block) \
|
||||
_Generic((object), \
|
||||
dispatch_block_t:dispatch_block_notify, \
|
||||
dispatch_group_t:dispatch_group_notify \
|
||||
)((object),(queue), (notification_block))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_cancel
|
||||
*
|
||||
* @abstract
|
||||
* Cancel the specified object.
|
||||
*
|
||||
* @discussion
|
||||
* Type-generic macro that maps to dispatch_block_cancel or
|
||||
* dispatch_source_cancel, depending on the type of the first argument.
|
||||
* See documentation for these functions for more details.
|
||||
* This function is unavailable for any other object type.
|
||||
*
|
||||
* @param object
|
||||
* The object to cancel.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
DISPATCH_UNAVAILABLE
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_cancel(void *object);
|
||||
#if __has_extension(c_generic_selections)
|
||||
#define dispatch_cancel(object) \
|
||||
_Generic((object), \
|
||||
dispatch_block_t:dispatch_block_cancel, \
|
||||
dispatch_source_t:dispatch_source_cancel \
|
||||
)((object))
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_testcancel
|
||||
*
|
||||
* @abstract
|
||||
* Test whether the specified object has been canceled
|
||||
*
|
||||
* @discussion
|
||||
* Type-generic macro that maps to dispatch_block_testcancel or
|
||||
* dispatch_source_testcancel, depending on the type of the first argument.
|
||||
* See documentation for these functions for more details.
|
||||
* This function is unavailable for any other object type.
|
||||
*
|
||||
* @param object
|
||||
* The object to test.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* Non-zero if canceled and zero if not canceled.
|
||||
*/
|
||||
DISPATCH_UNAVAILABLE
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_testcancel(void *object);
|
||||
#if __has_extension(c_generic_selections)
|
||||
#define dispatch_testcancel(object) \
|
||||
_Generic((object), \
|
||||
dispatch_block_t:dispatch_block_testcancel, \
|
||||
dispatch_source_t:dispatch_source_testcancel \
|
||||
)((object))
|
||||
#endif
|
||||
#endif // __BLOCKS__
|
||||
|
||||
/*!
|
||||
* @function dispatch_debug
|
||||
*
|
||||
* @abstract
|
||||
* Programmatically log debug information about a dispatch object.
|
||||
*
|
||||
* @discussion
|
||||
* Programmatically log debug information about a dispatch object. By default,
|
||||
* the log output is sent to syslog at notice level. In the debug version of
|
||||
* the library, the log output is sent to a file in /var/tmp.
|
||||
* The log output destination can be configured via the LIBDISPATCH_LOG
|
||||
* environment variable, valid values are: YES, NO, syslog, stderr, file.
|
||||
*
|
||||
* This function is deprecated and will be removed in a future release.
|
||||
* Objective-C callers may use -debugDescription instead.
|
||||
*
|
||||
* @param object
|
||||
* The object to introspect.
|
||||
*
|
||||
* @param message
|
||||
* The message to log above and beyond the introspection.
|
||||
*/
|
||||
API_DEPRECATED("unsupported interface", macos(10.6,10.9), ios(4.0,6.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW DISPATCH_COLD
|
||||
__attribute__((__format__(printf,2,3)))
|
||||
void
|
||||
dispatch_debug(dispatch_object_t object, const char *message, ...);
|
||||
|
||||
API_DEPRECATED("unsupported interface", macos(10.6,10.9), ios(4.0,6.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW DISPATCH_COLD
|
||||
__attribute__((__format__(printf,2,0)))
|
||||
void
|
||||
dispatch_debugv(dispatch_object_t object, const char *message, va_list ap);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
1674
lib/libc/include/aarch64-macos-gnu/dispatch/queue.h
Normal file
1674
lib/libc/include/aarch64-macos-gnu/dispatch/queue.h
Normal file
File diff suppressed because it is too large
Load Diff
117
lib/libc/include/aarch64-macos-gnu/dispatch/semaphore.h
Normal file
117
lib/libc/include/aarch64-macos-gnu/dispatch/semaphore.h
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_SEMAPHORE__
|
||||
#define __DISPATCH_SEMAPHORE__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_semaphore_t
|
||||
*
|
||||
* @abstract
|
||||
* A counting semaphore.
|
||||
*/
|
||||
DISPATCH_DECL(dispatch_semaphore);
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @function dispatch_semaphore_create
|
||||
*
|
||||
* @abstract
|
||||
* Creates new counting semaphore with an initial value.
|
||||
*
|
||||
* @discussion
|
||||
* Passing zero for the value is useful for when two threads need to reconcile
|
||||
* the completion of a particular event. Passing a value greater than zero is
|
||||
* useful for managing a finite pool of resources, where the pool size is equal
|
||||
* to the value.
|
||||
*
|
||||
* @param value
|
||||
* The starting value for the semaphore. Passing a value less than zero will
|
||||
* cause NULL to be returned.
|
||||
*
|
||||
* @result
|
||||
* The newly created semaphore, or NULL on failure.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_semaphore_t
|
||||
dispatch_semaphore_create(intptr_t value);
|
||||
|
||||
/*!
|
||||
* @function dispatch_semaphore_wait
|
||||
*
|
||||
* @abstract
|
||||
* Wait (decrement) for a semaphore.
|
||||
*
|
||||
* @discussion
|
||||
* Decrement the counting semaphore. If the resulting value is less than zero,
|
||||
* this function waits for a signal to occur before returning.
|
||||
*
|
||||
* @param dsema
|
||||
* The semaphore. The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param timeout
|
||||
* When to timeout (see dispatch_time). As a convenience, there are the
|
||||
* DISPATCH_TIME_NOW and DISPATCH_TIME_FOREVER constants.
|
||||
*
|
||||
* @result
|
||||
* Returns zero on success, or non-zero if the timeout occurred.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);
|
||||
|
||||
/*!
|
||||
* @function dispatch_semaphore_signal
|
||||
*
|
||||
* @abstract
|
||||
* Signal (increment) a semaphore.
|
||||
*
|
||||
* @discussion
|
||||
* Increment the counting semaphore. If the previous value was less than zero,
|
||||
* this function wakes a waiting thread before returning.
|
||||
*
|
||||
* @param dsema The counting semaphore.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* This function returns non-zero if a thread is woken. Otherwise, zero is
|
||||
* returned.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_semaphore_signal(dispatch_semaphore_t dsema);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif /* __DISPATCH_SEMAPHORE__ */
|
||||
780
lib/libc/include/aarch64-macos-gnu/dispatch/source.h
Normal file
780
lib/libc/include/aarch64-macos-gnu/dispatch/source.h
Normal file
@ -0,0 +1,780 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2013 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_SOURCE__
|
||||
#define __DISPATCH_SOURCE__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
#if TARGET_OS_MAC
|
||||
#include <mach/port.h>
|
||||
#include <mach/message.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#include <sys/signal.h>
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @header
|
||||
* The dispatch framework provides a suite of interfaces for monitoring low-
|
||||
* level system objects (file descriptors, Mach ports, signals, VFS nodes, etc.)
|
||||
* for activity and automatically submitting event handler blocks to dispatch
|
||||
* queues when such activity occurs.
|
||||
*
|
||||
* This suite of interfaces is known as the Dispatch Source API.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_t
|
||||
*
|
||||
* @abstract
|
||||
* Dispatch sources are used to automatically submit event handler blocks to
|
||||
* dispatch queues in response to external events.
|
||||
*/
|
||||
DISPATCH_SOURCE_DECL(dispatch_source);
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_type_t
|
||||
*
|
||||
* @abstract
|
||||
* Constants of this type represent the class of low-level system object that
|
||||
* is being monitored by the dispatch source. Constants of this type are
|
||||
* passed as a parameter to dispatch_source_create() and determine how the
|
||||
* handle argument is interpreted (i.e. as a file descriptor, mach port,
|
||||
* signal number, process identifier, etc.), and how the mask argument is
|
||||
* interpreted.
|
||||
*/
|
||||
typedef const struct dispatch_source_type_s *dispatch_source_type_t;
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_DATA_ADD
|
||||
* @discussion A dispatch source that coalesces data obtained via calls to
|
||||
* dispatch_source_merge_data(). An ADD is used to coalesce the data.
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_DATA_ADD (&_dispatch_source_type_data_add)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(data_add);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_DATA_OR
|
||||
* @discussion A dispatch source that coalesces data obtained via calls to
|
||||
* dispatch_source_merge_data(). A bitwise OR is used to coalesce the data.
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_DATA_OR (&_dispatch_source_type_data_or)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(data_or);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_DATA_REPLACE
|
||||
* @discussion A dispatch source that tracks data obtained via calls to
|
||||
* dispatch_source_merge_data(). Newly obtained data values replace existing
|
||||
* data values not yet delivered to the source handler
|
||||
*
|
||||
* A data value of zero will cause the source handler to not be invoked.
|
||||
*
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_DATA_REPLACE (&_dispatch_source_type_data_replace)
|
||||
API_AVAILABLE(macos(10.13), ios(11.0), tvos(11.0), watchos(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(data_replace);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_MACH_SEND
|
||||
* @discussion A dispatch source that monitors a Mach port for dead name
|
||||
* notifications (send right no longer has any corresponding receive right).
|
||||
* The handle is a Mach port with a send or send-once right (mach_port_t).
|
||||
* The mask is a mask of desired events from dispatch_source_mach_send_flags_t.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_MACH_SEND (&_dispatch_source_type_mach_send)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(mach_send);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_MACH_RECV
|
||||
* @discussion A dispatch source that monitors a Mach port for pending messages.
|
||||
* The handle is a Mach port with a receive right (mach_port_t).
|
||||
* The mask is a mask of desired events from dispatch_source_mach_recv_flags_t,
|
||||
* but no flags are currently defined (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_MACH_RECV (&_dispatch_source_type_mach_recv)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(mach_recv);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_MEMORYPRESSURE
|
||||
* @discussion A dispatch source that monitors the system for changes in
|
||||
* memory pressure condition.
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask is a mask of desired events from
|
||||
* dispatch_source_memorypressure_flags_t.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_MEMORYPRESSURE \
|
||||
(&_dispatch_source_type_memorypressure)
|
||||
API_AVAILABLE(macos(10.9), ios(8.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(memorypressure);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_PROC
|
||||
* @discussion A dispatch source that monitors an external process for events
|
||||
* defined by dispatch_source_proc_flags_t.
|
||||
* The handle is a process identifier (pid_t).
|
||||
* The mask is a mask of desired events from dispatch_source_proc_flags_t.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_PROC (&_dispatch_source_type_proc)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(proc);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_READ
|
||||
* @discussion A dispatch source that monitors a file descriptor for pending
|
||||
* bytes available to be read.
|
||||
* The handle is a file descriptor (int).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_READ (&_dispatch_source_type_read)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(read);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_SIGNAL
|
||||
* @discussion A dispatch source that monitors the current process for signals.
|
||||
* The handle is a signal number (int).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_SIGNAL (&_dispatch_source_type_signal)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(signal);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_TIMER
|
||||
* @discussion A dispatch source that submits the event handler block based
|
||||
* on a timer.
|
||||
* The handle is unused (pass zero for now).
|
||||
* The mask specifies which flags from dispatch_source_timer_flags_t to apply.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_TIMER (&_dispatch_source_type_timer)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(timer);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_VNODE
|
||||
* @discussion A dispatch source that monitors a file descriptor for events
|
||||
* defined by dispatch_source_vnode_flags_t.
|
||||
* The handle is a file descriptor (int).
|
||||
* The mask is a mask of desired events from dispatch_source_vnode_flags_t.
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_VNODE (&_dispatch_source_type_vnode)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0)) DISPATCH_LINUX_UNAVAILABLE()
|
||||
DISPATCH_SOURCE_TYPE_DECL(vnode);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_SOURCE_TYPE_WRITE
|
||||
* @discussion A dispatch source that monitors a file descriptor for available
|
||||
* buffer space to write bytes.
|
||||
* The handle is a file descriptor (int).
|
||||
* The mask is unused (pass zero for now).
|
||||
*/
|
||||
#define DISPATCH_SOURCE_TYPE_WRITE (&_dispatch_source_type_write)
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_SOURCE_TYPE_DECL(write);
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_mach_send_flags_t
|
||||
* Type of dispatch_source_mach_send flags
|
||||
*
|
||||
* @constant DISPATCH_MACH_SEND_DEAD
|
||||
* The receive right corresponding to the given send right was destroyed.
|
||||
*/
|
||||
#define DISPATCH_MACH_SEND_DEAD 0x1
|
||||
|
||||
typedef unsigned long dispatch_source_mach_send_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_mach_recv_flags_t
|
||||
* Type of dispatch_source_mach_recv flags
|
||||
*/
|
||||
typedef unsigned long dispatch_source_mach_recv_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_memorypressure_flags_t
|
||||
* Type of dispatch_source_memorypressure flags
|
||||
*
|
||||
* @constant DISPATCH_MEMORYPRESSURE_NORMAL
|
||||
* The system memory pressure condition has returned to normal.
|
||||
*
|
||||
* @constant DISPATCH_MEMORYPRESSURE_WARN
|
||||
* The system memory pressure condition has changed to warning.
|
||||
*
|
||||
* @constant DISPATCH_MEMORYPRESSURE_CRITICAL
|
||||
* The system memory pressure condition has changed to critical.
|
||||
*
|
||||
* @discussion
|
||||
* Elevated memory pressure is a system-wide condition that applications
|
||||
* registered for this source should react to by changing their future memory
|
||||
* use behavior, e.g. by reducing cache sizes of newly initiated operations
|
||||
* until memory pressure returns back to normal.
|
||||
* NOTE: applications should NOT traverse and discard existing caches for past
|
||||
* operations when the system memory pressure enters an elevated state, as that
|
||||
* is likely to trigger VM operations that will further aggravate system memory
|
||||
* pressure.
|
||||
*/
|
||||
|
||||
#define DISPATCH_MEMORYPRESSURE_NORMAL 0x01
|
||||
#define DISPATCH_MEMORYPRESSURE_WARN 0x02
|
||||
#define DISPATCH_MEMORYPRESSURE_CRITICAL 0x04
|
||||
|
||||
typedef unsigned long dispatch_source_memorypressure_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_proc_flags_t
|
||||
* Type of dispatch_source_proc flags
|
||||
*
|
||||
* @constant DISPATCH_PROC_EXIT
|
||||
* The process has exited (perhaps cleanly, perhaps not).
|
||||
*
|
||||
* @constant DISPATCH_PROC_FORK
|
||||
* The process has created one or more child processes.
|
||||
*
|
||||
* @constant DISPATCH_PROC_EXEC
|
||||
* The process has become another executable image via
|
||||
* exec*() or posix_spawn*().
|
||||
*
|
||||
* @constant DISPATCH_PROC_SIGNAL
|
||||
* A Unix signal was delivered to the process.
|
||||
*/
|
||||
#define DISPATCH_PROC_EXIT 0x80000000
|
||||
#define DISPATCH_PROC_FORK 0x40000000
|
||||
#define DISPATCH_PROC_EXEC 0x20000000
|
||||
#define DISPATCH_PROC_SIGNAL 0x08000000
|
||||
|
||||
typedef unsigned long dispatch_source_proc_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_vnode_flags_t
|
||||
* Type of dispatch_source_vnode flags
|
||||
*
|
||||
* @constant DISPATCH_VNODE_DELETE
|
||||
* The filesystem object was deleted from the namespace.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_WRITE
|
||||
* The filesystem object data changed.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_EXTEND
|
||||
* The filesystem object changed in size.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_ATTRIB
|
||||
* The filesystem object metadata changed.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_LINK
|
||||
* The filesystem object link count changed.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_RENAME
|
||||
* The filesystem object was renamed in the namespace.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_REVOKE
|
||||
* The filesystem object was revoked.
|
||||
*
|
||||
* @constant DISPATCH_VNODE_FUNLOCK
|
||||
* The filesystem object was unlocked.
|
||||
*/
|
||||
|
||||
#define DISPATCH_VNODE_DELETE 0x1
|
||||
#define DISPATCH_VNODE_WRITE 0x2
|
||||
#define DISPATCH_VNODE_EXTEND 0x4
|
||||
#define DISPATCH_VNODE_ATTRIB 0x8
|
||||
#define DISPATCH_VNODE_LINK 0x10
|
||||
#define DISPATCH_VNODE_RENAME 0x20
|
||||
#define DISPATCH_VNODE_REVOKE 0x40
|
||||
#define DISPATCH_VNODE_FUNLOCK 0x100
|
||||
|
||||
typedef unsigned long dispatch_source_vnode_flags_t;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_source_timer_flags_t
|
||||
* Type of dispatch_source_timer flags
|
||||
*
|
||||
* @constant DISPATCH_TIMER_STRICT
|
||||
* Specifies that the system should make a best effort to strictly observe the
|
||||
* leeway value specified for the timer via dispatch_source_set_timer(), even
|
||||
* if that value is smaller than the default leeway value that would be applied
|
||||
* to the timer otherwise. A minimal amount of leeway will be applied to the
|
||||
* timer even if this flag is specified.
|
||||
*
|
||||
* CAUTION: Use of this flag may override power-saving techniques employed by
|
||||
* the system and cause higher power consumption, so it must be used with care
|
||||
* and only when absolutely necessary.
|
||||
*/
|
||||
|
||||
#define DISPATCH_TIMER_STRICT 0x1
|
||||
|
||||
typedef unsigned long dispatch_source_timer_flags_t;
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_create
|
||||
*
|
||||
* @abstract
|
||||
* Creates a new dispatch source to monitor low-level system objects and auto-
|
||||
* matically submit a handler block to a dispatch queue in response to events.
|
||||
*
|
||||
* @discussion
|
||||
* Dispatch sources are not reentrant. Any events received while the dispatch
|
||||
* source is suspended or while the event handler block is currently executing
|
||||
* will be coalesced and delivered after the dispatch source is resumed or the
|
||||
* event handler block has returned.
|
||||
*
|
||||
* Dispatch sources are created in an inactive state. After creating the
|
||||
* source and setting any desired attributes (i.e. the handler, context, etc.),
|
||||
* a call must be made to dispatch_activate() in order to begin event delivery.
|
||||
*
|
||||
* Calling dispatch_set_target_queue() on a source once it has been activated
|
||||
* is not allowed (see dispatch_activate() and dispatch_set_target_queue()).
|
||||
*
|
||||
* For backward compatibility reasons, dispatch_resume() on an inactive,
|
||||
* and not otherwise suspended source has the same effect as calling
|
||||
* dispatch_activate(). For new code, using dispatch_activate() is preferred.
|
||||
*
|
||||
* @param type
|
||||
* Declares the type of the dispatch source. Must be one of the defined
|
||||
* dispatch_source_type_t constants.
|
||||
*
|
||||
* @param handle
|
||||
* The underlying system handle to monitor. The interpretation of this argument
|
||||
* is determined by the constant provided in the type parameter.
|
||||
*
|
||||
* @param mask
|
||||
* A mask of flags specifying which events are desired. The interpretation of
|
||||
* this argument is determined by the constant provided in the type parameter.
|
||||
*
|
||||
* @param queue
|
||||
* The dispatch queue to which the event handler block will be submitted.
|
||||
* If queue is DISPATCH_TARGET_QUEUE_DEFAULT, the source will submit the event
|
||||
* handler block to the default priority global queue.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch source. Or NULL if invalid arguments are passed.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_source_t
|
||||
dispatch_source_create(dispatch_source_type_t type,
|
||||
uintptr_t handle,
|
||||
uintptr_t mask,
|
||||
dispatch_queue_t _Nullable queue);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_event_handler
|
||||
*
|
||||
* @abstract
|
||||
* Sets the event handler block for the given dispatch source.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The event handler block to submit to the source's target queue.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_event_handler(dispatch_source_t source,
|
||||
dispatch_block_t _Nullable handler);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_event_handler_f
|
||||
*
|
||||
* @abstract
|
||||
* Sets the event handler function for the given dispatch source.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The event handler function to submit to the source's target queue.
|
||||
* The context parameter passed to the event handler function is the context of
|
||||
* the dispatch source current at the time the event handler was set.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_event_handler_f(dispatch_source_t source,
|
||||
dispatch_function_t _Nullable handler);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_cancel_handler
|
||||
*
|
||||
* @abstract
|
||||
* Sets the cancellation handler block for the given dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* The cancellation handler (if specified) will be submitted to the source's
|
||||
* target queue in response to a call to dispatch_source_cancel() once the
|
||||
* system has released all references to the source's underlying handle and
|
||||
* the source's event handler block has returned.
|
||||
*
|
||||
* IMPORTANT:
|
||||
* Source cancellation and a cancellation handler are required for file
|
||||
* descriptor and mach port based sources in order to safely close the
|
||||
* descriptor or destroy the port.
|
||||
* Closing the descriptor or port before the cancellation handler is invoked may
|
||||
* result in a race condition. If a new descriptor is allocated with the same
|
||||
* value as the recently closed descriptor while the source's event handler is
|
||||
* still running, the event handler may read/write data to the wrong descriptor.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The cancellation handler block to submit to the source's target queue.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_cancel_handler(dispatch_source_t source,
|
||||
dispatch_block_t _Nullable handler);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_cancel_handler_f
|
||||
*
|
||||
* @abstract
|
||||
* Sets the cancellation handler function for the given dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_source_set_cancel_handler() for more details.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The cancellation handler function to submit to the source's target queue.
|
||||
* The context parameter passed to the event handler function is the current
|
||||
* context of the dispatch source at the time the handler call is made.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_cancel_handler_f(dispatch_source_t source,
|
||||
dispatch_function_t _Nullable handler);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_cancel
|
||||
*
|
||||
* @abstract
|
||||
* Asynchronously cancel the dispatch source, preventing any further invocation
|
||||
* of its event handler block.
|
||||
*
|
||||
* @discussion
|
||||
* Cancellation prevents any further invocation of the event handler block for
|
||||
* the specified dispatch source, but does not interrupt an event handler
|
||||
* block that is already in progress.
|
||||
*
|
||||
* The cancellation handler is submitted to the source's target queue once the
|
||||
* the source's event handler has finished, indicating it is now safe to close
|
||||
* the source's handle (i.e. file descriptor or mach port).
|
||||
*
|
||||
* See dispatch_source_set_cancel_handler() for more information.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to be canceled.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_cancel(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_testcancel
|
||||
*
|
||||
* @abstract
|
||||
* Tests whether the given dispatch source has been canceled.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to be tested.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* Non-zero if canceled and zero if not canceled.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
intptr_t
|
||||
dispatch_source_testcancel(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_get_handle
|
||||
*
|
||||
* @abstract
|
||||
* Returns the underlying system handle associated with this dispatch source.
|
||||
*
|
||||
* @param source
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* The return value should be interpreted according to the type of the dispatch
|
||||
* source, and may be one of the following handles:
|
||||
*
|
||||
* DISPATCH_SOURCE_TYPE_DATA_ADD: n/a
|
||||
* DISPATCH_SOURCE_TYPE_DATA_OR: n/a
|
||||
* DISPATCH_SOURCE_TYPE_DATA_REPLACE: n/a
|
||||
* DISPATCH_SOURCE_TYPE_MACH_SEND: mach port (mach_port_t)
|
||||
* DISPATCH_SOURCE_TYPE_MACH_RECV: mach port (mach_port_t)
|
||||
* DISPATCH_SOURCE_TYPE_MEMORYPRESSURE n/a
|
||||
* DISPATCH_SOURCE_TYPE_PROC: process identifier (pid_t)
|
||||
* DISPATCH_SOURCE_TYPE_READ: file descriptor (int)
|
||||
* DISPATCH_SOURCE_TYPE_SIGNAL: signal number (int)
|
||||
* DISPATCH_SOURCE_TYPE_TIMER: n/a
|
||||
* DISPATCH_SOURCE_TYPE_VNODE: file descriptor (int)
|
||||
* DISPATCH_SOURCE_TYPE_WRITE: file descriptor (int)
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
uintptr_t
|
||||
dispatch_source_get_handle(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_get_mask
|
||||
*
|
||||
* @abstract
|
||||
* Returns the mask of events monitored by the dispatch source.
|
||||
*
|
||||
* @param source
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* The return value should be interpreted according to the type of the dispatch
|
||||
* source, and may be one of the following flag sets:
|
||||
*
|
||||
* DISPATCH_SOURCE_TYPE_DATA_ADD: n/a
|
||||
* DISPATCH_SOURCE_TYPE_DATA_OR: n/a
|
||||
* DISPATCH_SOURCE_TYPE_DATA_REPLACE: n/a
|
||||
* DISPATCH_SOURCE_TYPE_MACH_SEND: dispatch_source_mach_send_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_MACH_RECV: dispatch_source_mach_recv_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_MEMORYPRESSURE dispatch_source_memorypressure_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_PROC: dispatch_source_proc_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_READ: n/a
|
||||
* DISPATCH_SOURCE_TYPE_SIGNAL: n/a
|
||||
* DISPATCH_SOURCE_TYPE_TIMER: dispatch_source_timer_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_VNODE: dispatch_source_vnode_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_WRITE: n/a
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
uintptr_t
|
||||
dispatch_source_get_mask(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_get_data
|
||||
*
|
||||
* @abstract
|
||||
* Returns pending data for the dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* This function is intended to be called from within the event handler block.
|
||||
* The result of calling this function outside of the event handler callback is
|
||||
* undefined.
|
||||
*
|
||||
* @param source
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @result
|
||||
* The return value should be interpreted according to the type of the dispatch
|
||||
* source, and may be one of the following:
|
||||
*
|
||||
* DISPATCH_SOURCE_TYPE_DATA_ADD: application defined data
|
||||
* DISPATCH_SOURCE_TYPE_DATA_OR: application defined data
|
||||
* DISPATCH_SOURCE_TYPE_DATA_REPLACE: application defined data
|
||||
* DISPATCH_SOURCE_TYPE_MACH_SEND: dispatch_source_mach_send_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_MACH_RECV: dispatch_source_mach_recv_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_MEMORYPRESSURE dispatch_source_memorypressure_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_PROC: dispatch_source_proc_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_READ: estimated bytes available to read
|
||||
* DISPATCH_SOURCE_TYPE_SIGNAL: number of signals delivered since
|
||||
* the last handler invocation
|
||||
* DISPATCH_SOURCE_TYPE_TIMER: number of times the timer has fired
|
||||
* since the last handler invocation
|
||||
* DISPATCH_SOURCE_TYPE_VNODE: dispatch_source_vnode_flags_t
|
||||
* DISPATCH_SOURCE_TYPE_WRITE: estimated buffer space available
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
|
||||
DISPATCH_NOTHROW
|
||||
uintptr_t
|
||||
dispatch_source_get_data(dispatch_source_t source);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_merge_data
|
||||
*
|
||||
* @abstract
|
||||
* Merges data into a dispatch source of type DISPATCH_SOURCE_TYPE_DATA_ADD,
|
||||
* DISPATCH_SOURCE_TYPE_DATA_OR or DISPATCH_SOURCE_TYPE_DATA_REPLACE,
|
||||
* and submits its event handler block to its target queue.
|
||||
*
|
||||
* @param source
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param value
|
||||
* The value to coalesce with the pending data using a logical OR or an ADD
|
||||
* as specified by the dispatch source type. A value of zero has no effect
|
||||
* and will not result in the submission of the event handler block.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_merge_data(dispatch_source_t source, uintptr_t value);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_timer
|
||||
*
|
||||
* @abstract
|
||||
* Sets a start time, interval, and leeway value for a timer source.
|
||||
*
|
||||
* @discussion
|
||||
* Once this function returns, any pending source data accumulated for the
|
||||
* previous timer values has been cleared; the next fire of the timer will
|
||||
* occur at 'start', and every 'interval' nanoseconds thereafter until the
|
||||
* timer source is canceled.
|
||||
*
|
||||
* Any fire of the timer may be delayed by the system in order to improve power
|
||||
* consumption and system performance. The upper limit to the allowable delay
|
||||
* may be configured with the 'leeway' argument, the lower limit is under the
|
||||
* control of the system.
|
||||
*
|
||||
* For the initial timer fire at 'start', the upper limit to the allowable
|
||||
* delay is set to 'leeway' nanoseconds. For the subsequent timer fires at
|
||||
* 'start' + N * 'interval', the upper limit is MIN('leeway','interval'/2).
|
||||
*
|
||||
* The lower limit to the allowable delay may vary with process state such as
|
||||
* visibility of application UI. If the specified timer source was created with
|
||||
* a mask of DISPATCH_TIMER_STRICT, the system will make a best effort to
|
||||
* strictly observe the provided 'leeway' value even if it is smaller than the
|
||||
* current lower limit. Note that a minimal amount of delay is to be expected
|
||||
* even if this flag is specified.
|
||||
*
|
||||
* The 'start' argument also determines which clock will be used for the timer:
|
||||
* If 'start' is DISPATCH_TIME_NOW or was created with dispatch_time(3), the
|
||||
* timer is based on up time (which is obtained from mach_absolute_time() on
|
||||
* Apple platforms). If 'start' was created with dispatch_walltime(3), the
|
||||
* timer is based on gettimeofday(3).
|
||||
*
|
||||
* Calling this function has no effect if the timer source has already been
|
||||
* canceled.
|
||||
*
|
||||
* @param start
|
||||
* The start time of the timer. See dispatch_time() and dispatch_walltime()
|
||||
* for more information.
|
||||
*
|
||||
* @param interval
|
||||
* The nanosecond interval for the timer. Use DISPATCH_TIME_FOREVER for a
|
||||
* one-shot timer.
|
||||
*
|
||||
* @param leeway
|
||||
* The nanosecond leeway for the timer.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_timer(dispatch_source_t source,
|
||||
dispatch_time_t start,
|
||||
uint64_t interval,
|
||||
uint64_t leeway);
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_registration_handler
|
||||
*
|
||||
* @abstract
|
||||
* Sets the registration handler block for the given dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* The registration handler (if specified) will be submitted to the source's
|
||||
* target queue once the corresponding kevent() has been registered with the
|
||||
* system, following the initial dispatch_resume() of the source.
|
||||
*
|
||||
* If a source is already registered when the registration handler is set, the
|
||||
* registration handler will be invoked immediately.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The registration handler block to submit to the source's target queue.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.7), ios(4.3))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_registration_handler(dispatch_source_t source,
|
||||
dispatch_block_t _Nullable handler);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_source_set_registration_handler_f
|
||||
*
|
||||
* @abstract
|
||||
* Sets the registration handler function for the given dispatch source.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_source_set_registration_handler() for more details.
|
||||
*
|
||||
* @param source
|
||||
* The dispatch source to modify.
|
||||
* The result of passing NULL in this parameter is undefined.
|
||||
*
|
||||
* @param handler
|
||||
* The registration handler function to submit to the source's target queue.
|
||||
* The context parameter passed to the registration handler function is the
|
||||
* current context of the dispatch source at the time the handler call is made.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(4.3))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_source_set_registration_handler_f(dispatch_source_t source,
|
||||
dispatch_function_t _Nullable handler);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
163
lib/libc/include/aarch64-macos-gnu/dispatch/workloop.h
Normal file
163
lib/libc/include/aarch64-macos-gnu/dispatch/workloop.h
Normal file
@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (c) 2017-2019 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __DISPATCH_WORKLOOP__
|
||||
#define __DISPATCH_WORKLOOP__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_workloop_t
|
||||
*
|
||||
* @abstract
|
||||
* Dispatch workloops invoke workitems submitted to them in priority order.
|
||||
*
|
||||
* @discussion
|
||||
* A dispatch workloop is a flavor of dispatch_queue_t that is a priority
|
||||
* ordered queue (using the QOS class of the submitted workitems as the
|
||||
* ordering).
|
||||
*
|
||||
* Between each workitem invocation, the workloop will evaluate whether higher
|
||||
* priority workitems have since been submitted, either directly to the
|
||||
* workloop or to any queues that target the workloop, and execute these first.
|
||||
*
|
||||
* Serial queues targeting a workloop maintain FIFO execution of their
|
||||
* workitems. However, the workloop may reorder workitems submitted to
|
||||
* independent serial queues targeting it with respect to each other,
|
||||
* based on their priorities, while preserving FIFO execution with respect to
|
||||
* each serial queue.
|
||||
*
|
||||
* A dispatch workloop is a "subclass" of dispatch_queue_t which can be passed
|
||||
* to all APIs accepting a dispatch queue, except for functions from the
|
||||
* dispatch_sync() family. dispatch_async_and_wait() must be used for workloop
|
||||
* objects. Functions from the dispatch_sync() family on queues targeting
|
||||
* a workloop are still permitted but discouraged for performance reasons.
|
||||
*/
|
||||
DISPATCH_DECL_SUBCLASS(dispatch_workloop, dispatch_queue);
|
||||
|
||||
/*!
|
||||
* @function dispatch_workloop_create
|
||||
*
|
||||
* @abstract
|
||||
* Creates a new dispatch workloop to which workitems may be submitted.
|
||||
*
|
||||
* @param label
|
||||
* A string label to attach to the workloop.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch workloop.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_workloop_t
|
||||
dispatch_workloop_create(const char *_Nullable label);
|
||||
|
||||
/*!
|
||||
* @function dispatch_workloop_create_inactive
|
||||
*
|
||||
* @abstract
|
||||
* Creates a new inactive dispatch workloop that can be setup and then
|
||||
* activated.
|
||||
*
|
||||
* @discussion
|
||||
* Creating an inactive workloop allows for it to receive further configuration
|
||||
* before it is activated, and workitems can be submitted to it.
|
||||
*
|
||||
* Submitting workitems to an inactive workloop is undefined and will cause the
|
||||
* process to be terminated.
|
||||
*
|
||||
* @param label
|
||||
* A string label to attach to the workloop.
|
||||
*
|
||||
* @result
|
||||
* The newly created dispatch workloop.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_workloop_t
|
||||
dispatch_workloop_create_inactive(const char *_Nullable label);
|
||||
|
||||
/*!
|
||||
* @function dispatch_workloop_set_autorelease_frequency
|
||||
*
|
||||
* @abstract
|
||||
* Sets the autorelease frequency of the workloop.
|
||||
*
|
||||
* @discussion
|
||||
* See dispatch_queue_attr_make_with_autorelease_frequency().
|
||||
* The default policy for a workloop is
|
||||
* DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM.
|
||||
*
|
||||
* @param workloop
|
||||
* The dispatch workloop to modify.
|
||||
*
|
||||
* This workloop must be inactive, passing an activated object is undefined
|
||||
* and will cause the process to be terminated.
|
||||
*
|
||||
* @param frequency
|
||||
* The requested autorelease frequency.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_workloop_set_autorelease_frequency(dispatch_workloop_t workloop,
|
||||
dispatch_autorelease_frequency_t frequency);
|
||||
|
||||
/*!
|
||||
* @function dispatch_workloop_set_os_workgroup
|
||||
*
|
||||
* @abstract
|
||||
* Associates an os_workgroup_t with the specified dispatch workloop.
|
||||
*
|
||||
* The worker thread will be a member of the specified os_workgroup_t while executing
|
||||
* work items submitted to the workloop.
|
||||
*
|
||||
* @param workloop
|
||||
* The dispatch workloop to modify.
|
||||
*
|
||||
* This workloop must be inactive, passing an activated object is undefined
|
||||
* and will cause the process to be terminated.
|
||||
*
|
||||
* @param workgroup
|
||||
* The workgroup to associate with this workloop.
|
||||
*
|
||||
* The workgroup specified is retained and the previously associated workgroup
|
||||
* (if any) is released.
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_workloop_set_os_workgroup(dispatch_workloop_t workloop,
|
||||
os_workgroup_t workgroup);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
1266
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomicDeprecated.h
Normal file
1266
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomicDeprecated.h
Normal file
File diff suppressed because it is too large
Load Diff
115
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomicQueue.h
Normal file
115
lib/libc/include/aarch64-macos-gnu/libkern/OSAtomicQueue.h
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2016 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@
|
||||
*/
|
||||
|
||||
#ifndef _OSATOMICQUEUE_H_
|
||||
#define _OSATOMICQUEUE_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "OSAtomicDeprecated.h"
|
||||
|
||||
#include <Availability.h>
|
||||
|
||||
/*! @header Lockless atomic enqueue and dequeue
|
||||
* These routines manipulate singly-linked LIFO lists.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*! @abstract The data structure for a queue head.
|
||||
@discussion
|
||||
You should always initialize a queue head structure with the
|
||||
initialization vector {@link OS_ATOMIC_QUEUE_INIT} before use.
|
||||
*/
|
||||
#if defined(__LP64__)
|
||||
|
||||
typedef volatile struct {
|
||||
void *opaque1;
|
||||
long opaque2;
|
||||
} __attribute__ ((aligned (16))) OSQueueHead;
|
||||
|
||||
#else
|
||||
|
||||
typedef volatile struct {
|
||||
void *opaque1;
|
||||
long opaque2;
|
||||
} OSQueueHead;
|
||||
|
||||
#endif
|
||||
|
||||
/*! @abstract The initialization vector for a queue head. */
|
||||
#define OS_ATOMIC_QUEUE_INIT { NULL, 0 }
|
||||
|
||||
/*! @abstract Enqueue an element onto a list.
|
||||
@discussion
|
||||
Memory barriers are incorporated as needed to permit thread-safe access
|
||||
to the queue element.
|
||||
@param __list
|
||||
The list on which you want to enqueue the element.
|
||||
@param __new
|
||||
The element to add.
|
||||
@param __offset
|
||||
The "offset" parameter is the offset (in bytes) of the link field
|
||||
from the beginning of the data structure being queued (<code>__new</code>).
|
||||
The link field should be a pointer type.
|
||||
The <code>__offset</code> value needs to be same for all enqueuing and
|
||||
dequeuing operations on the same list, even if different structure types
|
||||
are enqueued on that list. The use of <code>offsetset()</code>, defined in
|
||||
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
|
||||
value.
|
||||
*/
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0)
|
||||
void OSAtomicEnqueue( OSQueueHead *__list, void *__new, size_t __offset);
|
||||
|
||||
|
||||
/*! @abstract Dequeue an element from a list.
|
||||
@discussion
|
||||
Memory barriers are incorporated as needed to permit thread-safe access
|
||||
to the queue element.
|
||||
@param __list
|
||||
The list from which you want to dequeue an element.
|
||||
@param __offset
|
||||
The "offset" parameter is the offset (in bytes) of the link field
|
||||
from the beginning of the data structure being dequeued (<code>__new</code>).
|
||||
The link field should be a pointer type.
|
||||
The <code>__offset</code> value needs to be same for all enqueuing and
|
||||
dequeuing operations on the same list, even if different structure types
|
||||
are enqueued on that list. The use of <code>offsetset()</code>, defined in
|
||||
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
|
||||
value.
|
||||
IMPORTANT: the memory backing the link field of a queue element must not be
|
||||
unmapped after OSAtomicDequeue() returns until all concurrent calls to
|
||||
OSAtomicDequeue() for the same list on other threads have also returned,
|
||||
as they may still be accessing that memory location.
|
||||
@result
|
||||
Returns the most recently enqueued element, or <code>NULL</code> if the
|
||||
list is empty.
|
||||
*/
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0)
|
||||
void* OSAtomicDequeue( OSQueueHead *__list, size_t __offset);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _OSATOMICQUEUE_H_ */
|
||||
317
lib/libc/include/aarch64-macos-gnu/libkern/OSByteOrder.h
Normal file
317
lib/libc/include/aarch64-macos-gnu/libkern/OSByteOrder.h
Normal file
@ -0,0 +1,317 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2006 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@
|
||||
*/
|
||||
|
||||
#ifndef _OS_OSBYTEORDER_H
|
||||
#define _OS_OSBYTEORDER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <libkern/_OSByteOrder.h>
|
||||
|
||||
/* Macros for swapping constant values in the preprocessing stage. */
|
||||
#define OSSwapConstInt16(x) __DARWIN_OSSwapConstInt16(x)
|
||||
#define OSSwapConstInt32(x) __DARWIN_OSSwapConstInt32(x)
|
||||
#define OSSwapConstInt64(x) __DARWIN_OSSwapConstInt64(x)
|
||||
|
||||
#if !defined(__DARWIN_OS_INLINE)
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
# define __DARWIN_OS_INLINE static inline
|
||||
# elif defined(__MWERKS__) || defined(__cplusplus)
|
||||
# define __DARWIN_OS_INLINE static inline
|
||||
# else
|
||||
# define __DARWIN_OS_INLINE static __inline__
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#if (defined(__i386__) || defined(__x86_64__))
|
||||
#include <libkern/i386/OSByteOrder.h>
|
||||
#elif defined (__arm__) || defined(__arm64__)
|
||||
#include <libkern/arm/OSByteOrder.h>
|
||||
#else
|
||||
#include <libkern/machine/OSByteOrder.h>
|
||||
#endif
|
||||
|
||||
#else /* ! __GNUC__ */
|
||||
|
||||
#include <libkern/machine/OSByteOrder.h>
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#define OSSwapInt16(x) __DARWIN_OSSwapInt16(x)
|
||||
#define OSSwapInt32(x) __DARWIN_OSSwapInt32(x)
|
||||
#define OSSwapInt64(x) __DARWIN_OSSwapInt64(x)
|
||||
|
||||
enum {
|
||||
OSUnknownByteOrder,
|
||||
OSLittleEndian,
|
||||
OSBigEndian
|
||||
};
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
int32_t
|
||||
OSHostByteOrder(void)
|
||||
{
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
return OSLittleEndian;
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
return OSBigEndian;
|
||||
#else
|
||||
return OSUnknownByteOrder;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define OSReadBigInt(x, y) OSReadBigInt32(x, y)
|
||||
#define OSWriteBigInt(x, y, z) OSWriteBigInt32(x, y, z)
|
||||
#define OSSwapBigToHostInt(x) OSSwapBigToHostInt32(x)
|
||||
#define OSSwapHostToBigInt(x) OSSwapHostToBigInt32(x)
|
||||
#define OSReadLittleInt(x, y) OSReadLittleInt32(x, y)
|
||||
#define OSWriteLittleInt(x, y, z) OSWriteLittleInt32(x, y, z)
|
||||
#define OSSwapHostToLittleInt(x) OSSwapHostToLittleInt32(x)
|
||||
#define OSSwapLittleToHostInt(x) OSSwapLittleToHostInt32(x)
|
||||
|
||||
/* Functions for loading native endian values. */
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
_OSReadInt16(
|
||||
const volatile void * base,
|
||||
uintptr_t byteOffset
|
||||
)
|
||||
{
|
||||
return *(volatile uint16_t *)((uintptr_t)base + byteOffset);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
_OSReadInt32(
|
||||
const volatile void * base,
|
||||
uintptr_t byteOffset
|
||||
)
|
||||
{
|
||||
return *(volatile uint32_t *)((uintptr_t)base + byteOffset);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
_OSReadInt64(
|
||||
const volatile void * base,
|
||||
uintptr_t byteOffset
|
||||
)
|
||||
{
|
||||
return *(volatile uint64_t *)((uintptr_t)base + byteOffset);
|
||||
}
|
||||
|
||||
/* Functions for storing native endian values. */
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteInt16(
|
||||
volatile void * base,
|
||||
uintptr_t byteOffset,
|
||||
uint16_t data
|
||||
)
|
||||
{
|
||||
*(volatile uint16_t *)((uintptr_t)base + byteOffset) = data;
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteInt32(
|
||||
volatile void * base,
|
||||
uintptr_t byteOffset,
|
||||
uint32_t data
|
||||
)
|
||||
{
|
||||
*(volatile uint32_t *)((uintptr_t)base + byteOffset) = data;
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteInt64(
|
||||
volatile void * base,
|
||||
uintptr_t byteOffset,
|
||||
uint64_t data
|
||||
)
|
||||
{
|
||||
*(volatile uint64_t *)((uintptr_t)base + byteOffset) = data;
|
||||
}
|
||||
|
||||
#if defined(__BIG_ENDIAN__)
|
||||
|
||||
/* Functions for loading big endian to host endianess. */
|
||||
|
||||
#define OSReadBigInt16(base, byteOffset) _OSReadInt16(base, byteOffset)
|
||||
#define OSReadBigInt32(base, byteOffset) _OSReadInt32(base, byteOffset)
|
||||
#define OSReadBigInt64(base, byteOffset) _OSReadInt64(base, byteOffset)
|
||||
|
||||
/* Functions for storing host endianess to big endian. */
|
||||
|
||||
#define OSWriteBigInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data)
|
||||
#define OSWriteBigInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data)
|
||||
#define OSWriteBigInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data)
|
||||
|
||||
/* Functions for loading little endian to host endianess. */
|
||||
|
||||
#define OSReadLittleInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset)
|
||||
#define OSReadLittleInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset)
|
||||
#define OSReadLittleInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset)
|
||||
|
||||
/* Functions for storing host endianess to little endian. */
|
||||
|
||||
#define OSWriteLittleInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data)
|
||||
#define OSWriteLittleInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data)
|
||||
#define OSWriteLittleInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data)
|
||||
|
||||
/* Host endianess to big endian byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapHostToBigConstInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapHostToBigConstInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapHostToBigConstInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Generic host endianess to big endian byte swapping functions. */
|
||||
|
||||
#define OSSwapHostToBigInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapHostToBigInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapHostToBigInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Host endianess to little endian byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapHostToLittleConstInt16(x) OSSwapConstInt16(x)
|
||||
#define OSSwapHostToLittleConstInt32(x) OSSwapConstInt32(x)
|
||||
#define OSSwapHostToLittleConstInt64(x) OSSwapConstInt64(x)
|
||||
|
||||
/* Generic host endianess to little endian byte swapping functions. */
|
||||
|
||||
#define OSSwapHostToLittleInt16(x) OSSwapInt16(x)
|
||||
#define OSSwapHostToLittleInt32(x) OSSwapInt32(x)
|
||||
#define OSSwapHostToLittleInt64(x) OSSwapInt64(x)
|
||||
|
||||
/* Big endian to host endianess byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapBigToHostConstInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapBigToHostConstInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapBigToHostConstInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Generic big endian to host endianess byte swapping functions. */
|
||||
|
||||
#define OSSwapBigToHostInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapBigToHostInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapBigToHostInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Little endian to host endianess byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapLittleToHostConstInt16(x) OSSwapConstInt16(x)
|
||||
#define OSSwapLittleToHostConstInt32(x) OSSwapConstInt32(x)
|
||||
#define OSSwapLittleToHostConstInt64(x) OSSwapConstInt64(x)
|
||||
|
||||
/* Generic little endian to host endianess byte swapping functions. */
|
||||
|
||||
#define OSSwapLittleToHostInt16(x) OSSwapInt16(x)
|
||||
#define OSSwapLittleToHostInt32(x) OSSwapInt32(x)
|
||||
#define OSSwapLittleToHostInt64(x) OSSwapInt64(x)
|
||||
|
||||
#elif defined(__LITTLE_ENDIAN__)
|
||||
|
||||
/* Functions for loading big endian to host endianess. */
|
||||
|
||||
#define OSReadBigInt16(base, byteOffset) OSReadSwapInt16(base, byteOffset)
|
||||
#define OSReadBigInt32(base, byteOffset) OSReadSwapInt32(base, byteOffset)
|
||||
#define OSReadBigInt64(base, byteOffset) OSReadSwapInt64(base, byteOffset)
|
||||
|
||||
/* Functions for storing host endianess to big endian. */
|
||||
|
||||
#define OSWriteBigInt16(base, byteOffset, data) OSWriteSwapInt16(base, byteOffset, data)
|
||||
#define OSWriteBigInt32(base, byteOffset, data) OSWriteSwapInt32(base, byteOffset, data)
|
||||
#define OSWriteBigInt64(base, byteOffset, data) OSWriteSwapInt64(base, byteOffset, data)
|
||||
|
||||
/* Functions for loading little endian to host endianess. */
|
||||
|
||||
#define OSReadLittleInt16(base, byteOffset) _OSReadInt16(base, byteOffset)
|
||||
#define OSReadLittleInt32(base, byteOffset) _OSReadInt32(base, byteOffset)
|
||||
#define OSReadLittleInt64(base, byteOffset) _OSReadInt64(base, byteOffset)
|
||||
|
||||
/* Functions for storing host endianess to little endian. */
|
||||
|
||||
#define OSWriteLittleInt16(base, byteOffset, data) _OSWriteInt16(base, byteOffset, data)
|
||||
#define OSWriteLittleInt32(base, byteOffset, data) _OSWriteInt32(base, byteOffset, data)
|
||||
#define OSWriteLittleInt64(base, byteOffset, data) _OSWriteInt64(base, byteOffset, data)
|
||||
|
||||
/* Host endianess to big endian byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapHostToBigConstInt16(x) OSSwapConstInt16(x)
|
||||
#define OSSwapHostToBigConstInt32(x) OSSwapConstInt32(x)
|
||||
#define OSSwapHostToBigConstInt64(x) OSSwapConstInt64(x)
|
||||
|
||||
/* Generic host endianess to big endian byte swapping functions. */
|
||||
|
||||
#define OSSwapHostToBigInt16(x) OSSwapInt16(x)
|
||||
#define OSSwapHostToBigInt32(x) OSSwapInt32(x)
|
||||
#define OSSwapHostToBigInt64(x) OSSwapInt64(x)
|
||||
|
||||
/* Host endianess to little endian byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapHostToLittleConstInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapHostToLittleConstInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapHostToLittleConstInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Generic host endianess to little endian byte swapping functions. */
|
||||
|
||||
#define OSSwapHostToLittleInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapHostToLittleInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapHostToLittleInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Big endian to host endianess byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapBigToHostConstInt16(x) OSSwapConstInt16(x)
|
||||
#define OSSwapBigToHostConstInt32(x) OSSwapConstInt32(x)
|
||||
#define OSSwapBigToHostConstInt64(x) OSSwapConstInt64(x)
|
||||
|
||||
/* Generic big endian to host endianess byte swapping functions. */
|
||||
|
||||
#define OSSwapBigToHostInt16(x) OSSwapInt16(x)
|
||||
#define OSSwapBigToHostInt32(x) OSSwapInt32(x)
|
||||
#define OSSwapBigToHostInt64(x) OSSwapInt64(x)
|
||||
|
||||
/* Little endian to host endianess byte swapping macros for constants. */
|
||||
|
||||
#define OSSwapLittleToHostConstInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapLittleToHostConstInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapLittleToHostConstInt64(x) ((uint64_t)(x))
|
||||
|
||||
/* Generic little endian to host endianess byte swapping functions. */
|
||||
|
||||
#define OSSwapLittleToHostInt16(x) ((uint16_t)(x))
|
||||
#define OSSwapLittleToHostInt32(x) ((uint32_t)(x))
|
||||
#define OSSwapLittleToHostInt64(x) ((uint64_t)(x))
|
||||
|
||||
#else
|
||||
#error Unknown endianess.
|
||||
#endif
|
||||
|
||||
#endif /* ! _OS_OSBYTEORDER_H */
|
||||
133
lib/libc/include/aarch64-macos-gnu/libkern/_OSByteOrder.h
Normal file
133
lib/libc/include/aarch64-macos-gnu/libkern/_OSByteOrder.h
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2006 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@
|
||||
*/
|
||||
|
||||
#ifndef _OS__OSBYTEORDER_H
|
||||
#define _OS__OSBYTEORDER_H
|
||||
|
||||
/*
|
||||
* This header is normally included from <libkern/OSByteOrder.h>. However,
|
||||
* <sys/_endian.h> also includes this in the case of little-endian
|
||||
* architectures, so that we can map OSByteOrder routines to the hton* and ntoh*
|
||||
* macros. This results in the asymmetry below; we only include
|
||||
* <libkern/arch/_OSByteOrder.h> for little-endian architectures.
|
||||
*/
|
||||
|
||||
#include <sys/_types.h>
|
||||
|
||||
/* Macros for swapping constant values in the preprocessing stage. */
|
||||
#define __DARWIN_OSSwapConstInt16(x) \
|
||||
((__uint16_t)((((__uint16_t)(x) & 0xff00U) >> 8) | \
|
||||
(((__uint16_t)(x) & 0x00ffU) << 8)))
|
||||
|
||||
#define __DARWIN_OSSwapConstInt32(x) \
|
||||
((__uint32_t)((((__uint32_t)(x) & 0xff000000U) >> 24) | \
|
||||
(((__uint32_t)(x) & 0x00ff0000U) >> 8) | \
|
||||
(((__uint32_t)(x) & 0x0000ff00U) << 8) | \
|
||||
(((__uint32_t)(x) & 0x000000ffU) << 24)))
|
||||
|
||||
#define __DARWIN_OSSwapConstInt64(x) \
|
||||
((__uint64_t)((((__uint64_t)(x) & 0xff00000000000000ULL) >> 56) | \
|
||||
(((__uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
|
||||
(((__uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
|
||||
(((__uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
|
||||
(((__uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \
|
||||
(((__uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
|
||||
(((__uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
|
||||
(((__uint64_t)(x) & 0x00000000000000ffULL) << 56)))
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#if !defined(__DARWIN_OS_INLINE)
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
# define __DARWIN_OS_INLINE static inline
|
||||
# elif defined(__MWERKS__) || defined(__cplusplus)
|
||||
# define __DARWIN_OS_INLINE static inline
|
||||
# else
|
||||
# define __DARWIN_OS_INLINE static __inline__
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <libkern/i386/_OSByteOrder.h>
|
||||
#endif
|
||||
|
||||
#if defined (__arm__) || defined(__arm64__)
|
||||
#include <libkern/arm/OSByteOrder.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define __DARWIN_OSSwapInt16(x) \
|
||||
((__uint16_t)(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt16(x) : _OSSwapInt16(x)))
|
||||
|
||||
#define __DARWIN_OSSwapInt32(x) \
|
||||
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt32(x) : _OSSwapInt32(x))
|
||||
|
||||
#define __DARWIN_OSSwapInt64(x) \
|
||||
(__builtin_constant_p(x) ? __DARWIN_OSSwapConstInt64(x) : _OSSwapInt64(x))
|
||||
|
||||
#else /* ! __GNUC__ */
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
_OSSwapInt16(
|
||||
uint16_t data
|
||||
)
|
||||
{
|
||||
return __DARWIN_OSSwapConstInt16(data);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
_OSSwapInt32(
|
||||
uint32_t data
|
||||
)
|
||||
{
|
||||
return __DARWIN_OSSwapConstInt32(data);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
_OSSwapInt64(
|
||||
uint64_t data
|
||||
)
|
||||
{
|
||||
return __DARWIN_OSSwapConstInt64(data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define __DARWIN_OSSwapInt16(x) _OSSwapInt16(x)
|
||||
|
||||
#define __DARWIN_OSSwapInt32(x) _OSSwapInt32(x)
|
||||
|
||||
#define __DARWIN_OSSwapInt64(x) _OSSwapInt64(x)
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* ! _OS__OSBYTEORDER_H */
|
||||
216
lib/libc/include/aarch64-macos-gnu/libkern/arm/OSByteOrder.h
Normal file
216
lib/libc/include/aarch64-macos-gnu/libkern/arm/OSByteOrder.h
Normal file
@ -0,0 +1,216 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2007 Apple Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _OS_OSBYTEORDERARM_H
|
||||
#define _OS_OSBYTEORDERARM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <arm/arch.h> /* for _ARM_ARCH_6 */
|
||||
|
||||
/* Generic byte swapping functions. */
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
_OSSwapInt16(
|
||||
uint16_t _data
|
||||
)
|
||||
{
|
||||
/* Reduces to 'rev16' with clang */
|
||||
return (uint16_t)(_data << 8 | _data >> 8);
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
_OSSwapInt32(
|
||||
uint32_t _data
|
||||
)
|
||||
{
|
||||
#if defined(__llvm__)
|
||||
_data = __builtin_bswap32(_data);
|
||||
#else
|
||||
/* This actually generates the best code */
|
||||
_data = (((_data ^ (_data >> 16 | (_data << 16))) & 0xFF00FFFF) >> 8) ^ (_data >> 8 | _data << 24);
|
||||
#endif
|
||||
|
||||
return _data;
|
||||
}
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
_OSSwapInt64(
|
||||
uint64_t _data
|
||||
)
|
||||
{
|
||||
#if defined(__llvm__)
|
||||
return __builtin_bswap64(_data);
|
||||
#else
|
||||
union {
|
||||
uint64_t _ull;
|
||||
uint32_t _ul[2];
|
||||
} _u;
|
||||
|
||||
/* This actually generates the best code */
|
||||
_u._ul[0] = (uint32_t)(_data >> 32);
|
||||
_u._ul[1] = (uint32_t)(_data & 0xffffffff);
|
||||
_u._ul[0] = _OSSwapInt32(_u._ul[0]);
|
||||
_u._ul[1] = _OSSwapInt32(_u._ul[1]);
|
||||
return _u._ull;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Functions for byte reversed loads. */
|
||||
|
||||
struct _OSUnalignedU16 {
|
||||
volatile uint16_t __val;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct _OSUnalignedU32 {
|
||||
volatile uint32_t __val;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct _OSUnalignedU64 {
|
||||
volatile uint64_t __val;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
_OSReadSwapInt16(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
OSReadSwapInt16(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
_OSReadSwapInt32(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
uint32_t
|
||||
OSReadSwapInt32(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
_OSReadSwapInt64(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
uint64_t
|
||||
OSReadSwapInt64(
|
||||
const volatile void * _base,
|
||||
uintptr_t _offset
|
||||
)
|
||||
{
|
||||
return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Functions for byte reversed stores. */
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteSwapInt16(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint16_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
OSWriteSwapInt16(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint16_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteSwapInt32(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint32_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
OSWriteSwapInt32(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint32_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
_OSWriteSwapInt64(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint64_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data);
|
||||
}
|
||||
#else
|
||||
__DARWIN_OS_INLINE
|
||||
void
|
||||
OSWriteSwapInt64(
|
||||
volatile void * _base,
|
||||
uintptr_t _offset,
|
||||
uint64_t _data
|
||||
)
|
||||
{
|
||||
((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! _OS_OSBYTEORDERARM_H */
|
||||
272
lib/libc/include/aarch64-macos-gnu/mach-o/dyld.h
Normal file
272
lib/libc/include/aarch64-macos-gnu/mach-o/dyld.h
Normal file
@ -0,0 +1,272 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 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@
|
||||
*/
|
||||
#ifndef _MACH_O_DYLD_H_
|
||||
#define _MACH_O_DYLD_H_
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <mach-o/loader.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __DRIVERKIT_19_0
|
||||
#define DYLD_DRIVERKIT_UNAVAILABLE __API_UNAVAILABLE(driverkit)
|
||||
#else
|
||||
#define DYLD_DRIVERKIT_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following functions allow you to iterate through all loaded images.
|
||||
* This is not a thread safe operation. Another thread can add or remove
|
||||
* an image during the iteration.
|
||||
*
|
||||
* Many uses of these routines can be replace by a call to dladdr() which
|
||||
* will return the mach_header and name of an image, given an address in
|
||||
* the image. dladdr() is thread safe.
|
||||
*/
|
||||
extern uint32_t _dyld_image_count(void) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
extern const struct mach_header* _dyld_get_image_header(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
extern intptr_t _dyld_get_image_vmaddr_slide(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
extern const char* _dyld_get_image_name(uint32_t image_index) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
|
||||
|
||||
/*
|
||||
* The following functions allow you to install callbacks which will be called
|
||||
* by dyld whenever an image is loaded or unloaded. During a call to _dyld_register_func_for_add_image()
|
||||
* the callback func is called for every existing image. Later, it is called as each new image
|
||||
* is loaded and bound (but initializers not yet run). The callback registered with
|
||||
* _dyld_register_func_for_remove_image() is called after any terminators in an image are run
|
||||
* and before the image is un-memory-mapped.
|
||||
*/
|
||||
extern void _dyld_register_func_for_add_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide)) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
extern void _dyld_register_func_for_remove_image(void (*func)(const struct mach_header* mh, intptr_t vmaddr_slide)) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
|
||||
|
||||
/*
|
||||
* NSVersionOfRunTimeLibrary() returns the current_version number of the currently dylib
|
||||
* specifed by the libraryName. The libraryName parameter would be "bar" for /path/libbar.3.dylib and
|
||||
* "Foo" for /path/Foo.framework/Versions/A/Foo. It returns -1 if no such library is loaded.
|
||||
*/
|
||||
extern int32_t NSVersionOfRunTimeLibrary(const char* libraryName) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
|
||||
|
||||
/*
|
||||
* NSVersionOfLinkTimeLibrary() returns the current_version number that the main executable was linked
|
||||
* against at build time. The libraryName parameter would be "bar" for /path/libbar.3.dylib and
|
||||
* "Foo" for /path/Foo.framework/Versions/A/Foo. It returns -1 if the main executable did not link
|
||||
* against the specified library.
|
||||
*/
|
||||
extern int32_t NSVersionOfLinkTimeLibrary(const char* libraryName) __OSX_AVAILABLE_STARTING(__MAC_10_1, __IPHONE_2_0);
|
||||
|
||||
|
||||
/*
|
||||
* _NSGetExecutablePath() copies the path of the main executable into the buffer. The bufsize parameter
|
||||
* should initially be the size of the buffer. The function returns 0 if the path was successfully copied,
|
||||
* and *bufsize is left unchanged. It returns -1 if the buffer is not large enough, and *bufsize is set
|
||||
* to the size required.
|
||||
*
|
||||
* Note that _NSGetExecutablePath will return "a path" to the executable not a "real path" to the executable.
|
||||
* That is the path may be a symbolic link and not the real file. With deep directories the total bufsize
|
||||
* needed could be more than MAXPATHLEN.
|
||||
*/
|
||||
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Registers a function to be called when the current thread terminates.
|
||||
* Called by c++ compiler to implement destructors on thread_local object variables.
|
||||
*/
|
||||
extern void _tlv_atexit(void (*termFunc)(void* objAddr), void* objAddr) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0);
|
||||
|
||||
|
||||
/*
|
||||
* Never called. On-disk thread local variables contain a pointer to this. Once
|
||||
* the thread local is prepared, the pointer changes to a real handler such as tlv_get_addr.
|
||||
*/
|
||||
extern void _tlv_bootstrap(void) __OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) DYLD_DRIVERKIT_UNAVAILABLE ;
|
||||
|
||||
|
||||
/*
|
||||
* Dylibs that are incorporated into the dyld cache are removed from disk. That means code
|
||||
* cannot stat() the file to see if it "exists". This function is like a stat() call that checks if a
|
||||
* path is to a dylib that was removed from disk and is incorporated into the active dyld cache.
|
||||
*/
|
||||
extern bool _dyld_shared_cache_contains_path(const char* path) __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) DYLD_DRIVERKIT_UNAVAILABLE;
|
||||
|
||||
|
||||
/*
|
||||
* The following dyld API's are deprecated as of Mac OS X 10.5. They are either
|
||||
* no longer necessary or are superceeded by dlopen and friends in <dlfcn.h>.
|
||||
* dlopen/dlsym/dlclose have been available since Mac OS X 10.3 and work with
|
||||
* dylibs and bundles.
|
||||
*
|
||||
* NSAddImage -> dlopen
|
||||
* NSLookupSymbolInImage -> dlsym
|
||||
* NSCreateObjectFileImageFromFile -> dlopen
|
||||
* NSDestroyObjectFileImage -> dlclose
|
||||
* NSLinkModule -> not needed when dlopen used
|
||||
* NSUnLinkModule -> not needed when dlclose used
|
||||
* NSLookupSymbolInModule -> dlsym
|
||||
* _dyld_image_containing_address -> dladdr
|
||||
* NSLinkEditError -> dlerror
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ENUM_DYLD_BOOL
|
||||
#define ENUM_DYLD_BOOL
|
||||
#undef FALSE
|
||||
#undef TRUE
|
||||
enum DYLD_BOOL { FALSE, TRUE };
|
||||
#endif /* ENUM_DYLD_BOOL */
|
||||
|
||||
|
||||
/* Object file image API */
|
||||
typedef enum {
|
||||
NSObjectFileImageFailure, /* for this a message is printed on stderr */
|
||||
NSObjectFileImageSuccess,
|
||||
NSObjectFileImageInappropriateFile,
|
||||
NSObjectFileImageArch,
|
||||
NSObjectFileImageFormat, /* for this a message is printed on stderr */
|
||||
NSObjectFileImageAccess
|
||||
} NSObjectFileImageReturnCode;
|
||||
|
||||
typedef struct __NSObjectFileImage* NSObjectFileImage;
|
||||
|
||||
|
||||
|
||||
/* NSObjectFileImage can only be used with MH_BUNDLE files */
|
||||
extern NSObjectFileImageReturnCode NSCreateObjectFileImageFromFile(const char* pathName, NSObjectFileImage *objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()");
|
||||
extern NSObjectFileImageReturnCode NSCreateObjectFileImageFromMemory(const void *address, size_t size, NSObjectFileImage *objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern bool NSDestroyObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlclose()");
|
||||
|
||||
extern uint32_t NSSymbolDefinitionCountInObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern const char* NSSymbolDefinitionNameInObjectFileImage(NSObjectFileImage objectFileImage, uint32_t ordinal) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern uint32_t NSSymbolReferenceCountInObjectFileImage(NSObjectFileImage objectFileImage) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern const char* NSSymbolReferenceNameInObjectFileImage(NSObjectFileImage objectFileImage, uint32_t ordinal, bool *tentative_definition) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern bool NSIsSymbolDefinedInObjectFileImage(NSObjectFileImage objectFileImage, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern void* NSGetSectionDataInObjectFileImage(NSObjectFileImage objectFileImage, const char* segmentName, const char* sectionName, size_t *size) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "getsectiondata()");
|
||||
|
||||
typedef struct __NSModule* NSModule;
|
||||
extern const char* NSNameOfModule(NSModule m) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern const char* NSLibraryNameForModule(NSModule m) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
|
||||
extern NSModule NSLinkModule(NSObjectFileImage objectFileImage, const char* moduleName, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()");
|
||||
#define NSLINKMODULE_OPTION_NONE 0x0
|
||||
#define NSLINKMODULE_OPTION_BINDNOW 0x1
|
||||
#define NSLINKMODULE_OPTION_PRIVATE 0x2
|
||||
#define NSLINKMODULE_OPTION_RETURN_ON_ERROR 0x4
|
||||
#define NSLINKMODULE_OPTION_DONT_CALL_MOD_INIT_ROUTINES 0x8
|
||||
#define NSLINKMODULE_OPTION_TRAILING_PHYS_NAME 0x10
|
||||
|
||||
extern bool NSUnLinkModule(NSModule module, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
#define NSUNLINKMODULE_OPTION_NONE 0x0
|
||||
#define NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED 0x1
|
||||
#define NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES 0x2
|
||||
|
||||
/* symbol API */
|
||||
typedef struct __NSSymbol* NSSymbol;
|
||||
extern bool NSIsSymbolNameDefined(const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern bool NSIsSymbolNameDefinedWithHint(const char* symbolName, const char* libraryNameHint) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern bool NSIsSymbolNameDefinedInImage(const struct mach_header* image, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern NSSymbol NSLookupAndBindSymbol(const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern NSSymbol NSLookupAndBindSymbolWithHint(const char* symbolName, const char* libraryNameHint) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern NSSymbol NSLookupSymbolInModule(NSModule module, const char* symbolName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
|
||||
extern NSSymbol NSLookupSymbolInImage(const struct mach_header* image, const char* symbolName, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
|
||||
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND 0x0
|
||||
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW 0x1
|
||||
#define NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_FULLY 0x2
|
||||
#define NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR 0x4
|
||||
extern const char* NSNameOfSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
extern void * NSAddressOfSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
|
||||
extern NSModule NSModuleForSymbol(NSSymbol symbol) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dladdr()");
|
||||
|
||||
/* error handling API */
|
||||
typedef enum {
|
||||
NSLinkEditFileAccessError,
|
||||
NSLinkEditFileFormatError,
|
||||
NSLinkEditMachResourceError,
|
||||
NSLinkEditUnixResourceError,
|
||||
NSLinkEditOtherError,
|
||||
NSLinkEditWarningError,
|
||||
NSLinkEditMultiplyDefinedError,
|
||||
NSLinkEditUndefinedError
|
||||
} NSLinkEditErrors;
|
||||
|
||||
/*
|
||||
* For the NSLinkEditErrors value NSLinkEditOtherError these are the values
|
||||
* passed to the link edit error handler as the errorNumber (what would be an
|
||||
* errno value for NSLinkEditUnixResourceError or a kern_return_t value for
|
||||
* NSLinkEditMachResourceError).
|
||||
*/
|
||||
typedef enum {
|
||||
NSOtherErrorRelocation,
|
||||
NSOtherErrorLazyBind,
|
||||
NSOtherErrorIndrLoop,
|
||||
NSOtherErrorLazyInit,
|
||||
NSOtherErrorInvalidArgs
|
||||
} NSOtherErrorNumbers;
|
||||
|
||||
extern void NSLinkEditError(NSLinkEditErrors *c, int *errorNumber, const char** fileName, const char** errorString) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlerror()");
|
||||
|
||||
typedef struct {
|
||||
void (*undefined)(const char* symbolName);
|
||||
NSModule (*multiple)(NSSymbol s, NSModule oldModule, NSModule newModule);
|
||||
void (*linkEdit)(NSLinkEditErrors errorClass, int errorNumber,
|
||||
const char* fileName, const char* errorString);
|
||||
} NSLinkEditErrorHandlers;
|
||||
|
||||
extern void NSInstallLinkEditErrorHandlers(const NSLinkEditErrorHandlers *handlers) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "");
|
||||
|
||||
extern bool NSAddLibrary(const char* pathName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlopen()");
|
||||
extern bool NSAddLibraryWithSearching(const char* pathName) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlopen()");
|
||||
extern const struct mach_header* NSAddImage(const char* image_name, uint32_t options) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen()");
|
||||
#define NSADDIMAGE_OPTION_NONE 0x0
|
||||
#define NSADDIMAGE_OPTION_RETURN_ON_ERROR 0x1
|
||||
#define NSADDIMAGE_OPTION_WITH_SEARCHING 0x2
|
||||
#define NSADDIMAGE_OPTION_RETURN_ONLY_IF_LOADED 0x4
|
||||
#define NSADDIMAGE_OPTION_MATCH_FILENAME_BY_INSTALLNAME 0x8
|
||||
|
||||
extern bool _dyld_present(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "always true");
|
||||
extern bool _dyld_launched_prebound(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "moot");
|
||||
extern bool _dyld_all_twolevel_modules_prebound(void) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "moot");
|
||||
extern bool _dyld_bind_fully_image_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlopen(RTLD_NOW)");
|
||||
extern bool _dyld_image_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "dladdr()");
|
||||
extern void _dyld_lookup_and_bind(const char* symbol_name, void **address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern void _dyld_lookup_and_bind_with_hint(const char* symbol_name, const char* library_name_hint, void** address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.4, "dlsym()");
|
||||
extern void _dyld_lookup_and_bind_fully(const char* symbol_name, void** address, NSModule* module) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.1, 10.5, "dlsym()");
|
||||
|
||||
extern const struct mach_header* _dyld_get_image_header_containing_address(const void* address) __API_UNAVAILABLE(ios, tvos, watchos) DYLD_DRIVERKIT_UNAVAILABLE __OSX_DEPRECATED(10.3, 10.5, "dladdr()");
|
||||
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_O_DYLD_H_ */
|
||||
1601
lib/libc/include/aarch64-macos-gnu/mach-o/loader.h
Normal file
1601
lib/libc/include/aarch64-macos-gnu/mach-o/loader.h
Normal file
File diff suppressed because it is too large
Load Diff
645
lib/libc/include/aarch64-macos-gnu/mach/arm/_structs.h
Normal file
645
lib/libc/include/aarch64-macos-gnu/mach/arm/_structs.h
Normal file
@ -0,0 +1,645 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
#ifndef _MACH_ARM__STRUCTS_H_
|
||||
#define _MACH_ARM__STRUCTS_H_
|
||||
|
||||
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
|
||||
#include <machine/types.h> /* __uint32_t */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE struct __darwin_arm_exception_state
|
||||
_STRUCT_ARM_EXCEPTION_STATE
|
||||
{
|
||||
__uint32_t __exception; /* number of arm exception taken */
|
||||
__uint32_t __fsr; /* Fault status */
|
||||
__uint32_t __far; /* Virtual Fault Address */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE struct arm_exception_state
|
||||
_STRUCT_ARM_EXCEPTION_STATE
|
||||
{
|
||||
__uint32_t exception; /* number of arm exception taken */
|
||||
__uint32_t fsr; /* Fault status */
|
||||
__uint32_t far; /* Virtual Fault Address */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE64 struct __darwin_arm_exception_state64
|
||||
_STRUCT_ARM_EXCEPTION_STATE64
|
||||
{
|
||||
__uint64_t __far; /* Virtual Fault Address */
|
||||
__uint32_t __esr; /* Exception syndrome */
|
||||
__uint32_t __exception; /* number of arm exception taken */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_EXCEPTION_STATE64 struct arm_exception_state64
|
||||
_STRUCT_ARM_EXCEPTION_STATE64
|
||||
{
|
||||
__uint64_t far; /* Virtual Fault Address */
|
||||
__uint32_t esr; /* Exception syndrome */
|
||||
__uint32_t exception; /* number of arm exception taken */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_THREAD_STATE struct __darwin_arm_thread_state
|
||||
_STRUCT_ARM_THREAD_STATE
|
||||
{
|
||||
__uint32_t __r[13]; /* General purpose register r0-r12 */
|
||||
__uint32_t __sp; /* Stack pointer r13 */
|
||||
__uint32_t __lr; /* Link register r14 */
|
||||
__uint32_t __pc; /* Program counter r15 */
|
||||
__uint32_t __cpsr; /* Current program status register */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_THREAD_STATE struct arm_thread_state
|
||||
_STRUCT_ARM_THREAD_STATE
|
||||
{
|
||||
__uint32_t r[13]; /* General purpose register r0-r12 */
|
||||
__uint32_t sp; /* Stack pointer r13 */
|
||||
__uint32_t lr; /* Link register r14 */
|
||||
__uint32_t pc; /* Program counter r15 */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
|
||||
/*
|
||||
* By default, the pointer fields in the arm_thread_state64_t structure are
|
||||
* opaque on the arm64e architecture and require the use of accessor macros.
|
||||
* This mode can also be enabled on the arm64 architecture by building with
|
||||
* -D__DARWIN_OPAQUE_ARM_THREAD_STATE64=1.
|
||||
*/
|
||||
#if defined(__arm64__) && defined(__LP64__)
|
||||
|
||||
#if __has_feature(ptrauth_calls)
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 1
|
||||
#define __DARWIN_PTRAUTH_ARM_THREAD_STATE64 1
|
||||
#endif /* __has_feature(ptrauth_calls) */
|
||||
|
||||
#ifndef __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
|
||||
#endif
|
||||
|
||||
#else /* defined(__arm64__) && defined(__LP64__) */
|
||||
|
||||
#undef __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
|
||||
|
||||
#endif /* defined(__arm64__) && defined(__LP64__) */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_THREAD_STATE64 struct __darwin_arm_thread_state64
|
||||
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t __x[29]; /* General purpose registers x0-x28 */
|
||||
void* __opaque_fp; /* Frame pointer x29 */
|
||||
void* __opaque_lr; /* Link register x30 */
|
||||
void* __opaque_sp; /* Stack pointer x31 */
|
||||
void* __opaque_pc; /* Program counter */
|
||||
__uint32_t __cpsr; /* Current program status register */
|
||||
__uint32_t __opaque_flags; /* Flags describing structure format */
|
||||
};
|
||||
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t __x[29]; /* General purpose registers x0-x28 */
|
||||
__uint64_t __fp; /* Frame pointer x29 */
|
||||
__uint64_t __lr; /* Link register x30 */
|
||||
__uint64_t __sp; /* Stack pointer x31 */
|
||||
__uint64_t __pc; /* Program counter */
|
||||
__uint32_t __cpsr; /* Current program status register */
|
||||
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
|
||||
};
|
||||
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_THREAD_STATE64 struct arm_thread_state64
|
||||
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t x[29]; /* General purpose registers x0-x28 */
|
||||
void* __opaque_fp; /* Frame pointer x29 */
|
||||
void* __opaque_lr; /* Link register x30 */
|
||||
void* __opaque_sp; /* Stack pointer x31 */
|
||||
void* __opaque_pc; /* Program counter */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
__uint32_t __opaque_flags; /* Flags describing structure format */
|
||||
};
|
||||
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
_STRUCT_ARM_THREAD_STATE64
|
||||
{
|
||||
__uint64_t x[29]; /* General purpose registers x0-x28 */
|
||||
__uint64_t fp; /* Frame pointer x29 */
|
||||
__uint64_t lr; /* Link register x30 */
|
||||
__uint64_t sp; /* Stack pointer x31 */
|
||||
__uint64_t pc; /* Program counter */
|
||||
__uint32_t cpsr; /* Current program status register */
|
||||
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
|
||||
};
|
||||
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
|
||||
|
||||
/* Accessor macros for arm_thread_state64_t pointer fields */
|
||||
|
||||
#if __has_feature(ptrauth_calls) && defined(__LP64__)
|
||||
#include <ptrauth.h>
|
||||
|
||||
#if !__DARWIN_OPAQUE_ARM_THREAD_STATE64 || !__DARWIN_PTRAUTH_ARM_THREAD_STATE64
|
||||
#error "Invalid configuration"
|
||||
#endif
|
||||
|
||||
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH 0x1
|
||||
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_pc, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("pc")) : __tsp->__opaque_pc); })
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the __darwin_arm_thread_state64_get_pc() macro in that case. */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_function(__tsp->__opaque_pc, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("pc")) : NULL); })
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
__typeof__(fptr) __f = (fptr); __tsp->__opaque_pc = \
|
||||
(__f ? (!(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("pc")) : ptrauth_auth_data(__f, \
|
||||
ptrauth_key_function_pointer, 0)) : __f); })
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_lr, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("lr")) : __tsp->__opaque_lr); })
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the __darwin_arm_thread_state64_get_lr() macro in that case. */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
|
||||
ptrauth_auth_function(__tsp->__opaque_lr, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("lr")) : NULL); })
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
__typeof__(fptr) __f = (fptr); __tsp->__opaque_lr = \
|
||||
(__f ? (!(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? (__tsp->__opaque_flags \
|
||||
&= ~__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR , \
|
||||
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
|
||||
ptrauth_key_process_independent_code, \
|
||||
ptrauth_string_discriminator("lr"))) : ptrauth_auth_data(__f, \
|
||||
ptrauth_key_function_pointer, 0)) : __f); })
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_sp && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_sp, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("sp")) : __tsp->__opaque_sp); })
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_sp = \
|
||||
(__p && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_sign_unauthenticated(__p, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("sp")) : __p); })
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
(uintptr_t)(__tsp->__opaque_fp && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_auth_data(__tsp->__opaque_fp, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("fp")) : __tsp->__opaque_fp); })
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_fp = \
|
||||
(__p && !(__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
|
||||
ptrauth_sign_unauthenticated(__p, \
|
||||
ptrauth_key_process_independent_data, \
|
||||
ptrauth_string_discriminator("fp")) : __p); })
|
||||
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
|
||||
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
|
||||
__tsp->__opaque_pc = ((__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_pc : \
|
||||
ptrauth_strip(__tsp->__opaque_pc, ptrauth_key_process_independent_code)); \
|
||||
__tsp->__opaque_lr = ((__tsp->__opaque_flags & \
|
||||
(__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? __tsp->__opaque_lr : \
|
||||
ptrauth_strip(__tsp->__opaque_lr, ptrauth_key_process_independent_code)); \
|
||||
__tsp->__opaque_sp = ((__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_sp : \
|
||||
ptrauth_strip(__tsp->__opaque_sp, ptrauth_key_process_independent_data)); \
|
||||
__tsp->__opaque_fp = ((__tsp->__opaque_flags & \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_fp : \
|
||||
ptrauth_strip(__tsp->__opaque_fp, ptrauth_key_process_independent_data)); \
|
||||
__tsp->__opaque_flags |= \
|
||||
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH; })
|
||||
|
||||
#else /* __has_feature(ptrauth_calls) && defined(__LP64__) */
|
||||
|
||||
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
|
||||
|
||||
#ifndef __LP64__
|
||||
#error "Invalid configuration"
|
||||
#endif
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
((uintptr_t)((ts).__opaque_pc))
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
((ts).__opaque_pc)
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
((ts).__opaque_pc = (fptr))
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
((uintptr_t)((ts).__opaque_lr))
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
((ts).__opaque_lr)
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
((ts).__opaque_lr = (fptr))
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
((uintptr_t)((ts).__opaque_sp))
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
((ts).__opaque_sp = (void*)(uintptr_t)(ptr))
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
((uintptr_t)((ts).__opaque_fp))
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
((ts).__opaque_fp = (void*)(uintptr_t)(ptr))
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
|
||||
(void)(ts)
|
||||
|
||||
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
#if __DARWIN_UNIX03
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
((ts).__pc)
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).__pc))
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
((ts).__pc = (uintptr_t)(fptr))
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
((ts).__lr)
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).__lr))
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
((ts).__lr = (uintptr_t)(fptr))
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
((ts).__sp)
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
((ts).__sp = (uintptr_t)(ptr))
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
((ts).__fp)
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
((ts).__fp = (uintptr_t)(ptr))
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
|
||||
(void)(ts)
|
||||
|
||||
#else /* __DARWIN_UNIX03 */
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_pc(ts) \
|
||||
((ts).pc)
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).pc))
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
((ts).pc = (uintptr_t)(fptr))
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_lr(ts) \
|
||||
((ts).lr)
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer */
|
||||
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
|
||||
((void*)(uintptr_t)((ts).lr))
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
((ts).lr = (uintptr_t)(fptr))
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_sp(ts) \
|
||||
((ts).sp)
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
|
||||
((ts).sp = (uintptr_t)(ptr))
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define __darwin_arm_thread_state64_get_fp(ts) \
|
||||
((ts).fp)
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
|
||||
((ts).fp = (uintptr_t)(ptr))
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
|
||||
(void)(ts)
|
||||
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
|
||||
|
||||
#endif /* __has_feature(ptrauth_calls) && defined(__LP64__) */
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_VFP_STATE struct __darwin_arm_vfp_state
|
||||
_STRUCT_ARM_VFP_STATE
|
||||
{
|
||||
__uint32_t __r[64];
|
||||
__uint32_t __fpscr;
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_VFP_STATE struct arm_vfp_state
|
||||
_STRUCT_ARM_VFP_STATE
|
||||
{
|
||||
__uint32_t r[64];
|
||||
__uint32_t fpscr;
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_NEON_STATE64 struct __darwin_arm_neon_state64
|
||||
#define _STRUCT_ARM_NEON_STATE struct __darwin_arm_neon_state
|
||||
|
||||
#if defined(__arm64__)
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
__uint128_t __v[32];
|
||||
__uint32_t __fpsr;
|
||||
__uint32_t __fpcr;
|
||||
};
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
__uint128_t __v[16];
|
||||
__uint32_t __fpsr;
|
||||
__uint32_t __fpcr;
|
||||
};
|
||||
#elif defined(__arm__)
|
||||
/*
|
||||
* No 128-bit intrinsic for ARM; leave it opaque for now.
|
||||
*/
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
#else
|
||||
#error Unknown architecture.
|
||||
#endif
|
||||
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_NEON_STATE64 struct arm_neon_state64
|
||||
#define _STRUCT_ARM_NEON_STATE struct arm_neon_state
|
||||
|
||||
#if defined(__arm64__)
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
__uint128_t q[32];
|
||||
uint32_t fpsr;
|
||||
uint32_t fpcr;
|
||||
};
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
__uint128_t q[16];
|
||||
uint32_t fpsr;
|
||||
uint32_t fpcr;
|
||||
};
|
||||
#elif defined(__arm__)
|
||||
/*
|
||||
* No 128-bit intrinsic for ARM; leave it opaque for now.
|
||||
*/
|
||||
_STRUCT_ARM_NEON_STATE64
|
||||
{
|
||||
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
_STRUCT_ARM_NEON_STATE
|
||||
{
|
||||
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
|
||||
} __attribute__((aligned(16)));
|
||||
|
||||
#else
|
||||
#error Unknown architecture.
|
||||
#endif
|
||||
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_AMX_STATE_V1 struct __darwin_arm_amx_state_v1
|
||||
_STRUCT_ARM_AMX_STATE_V1
|
||||
{
|
||||
__uint8_t __x[8][64]; /* 8 64-byte registers */
|
||||
__uint8_t __y[8][64]; /* 8 64-byte registers */
|
||||
__uint8_t __z[64][64]; /* 64 64-byte registers in an M-by-N matrix */
|
||||
__uint64_t __amx_state_t_el1; /* AMX_STATE_T_EL1 value */
|
||||
} __attribute__((aligned(64)));
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_AMX_STATE_V1 struct arm_amx_state_v1
|
||||
_STRUCT_ARM_AMX_STATE_V1
|
||||
{
|
||||
__uint8_t x[8][64]; /* 8 64-byte registers */
|
||||
__uint8_t y[8][64]; /* 8 64-byte registers */
|
||||
__uint8_t z[64][64]; /* 64 64-byte registers in an M-by-N matrix */
|
||||
__uint64_t amx_state_t_el1; /* AMX_STATE_T_EL1 value. */
|
||||
} __attribute__((aligned(64)));
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#define _STRUCT_ARM_PAGEIN_STATE struct __arm_pagein_state
|
||||
_STRUCT_ARM_PAGEIN_STATE
|
||||
{
|
||||
int __pagein_error;
|
||||
};
|
||||
|
||||
/*
|
||||
* Debug State
|
||||
*/
|
||||
#if defined(__arm__)
|
||||
/* Old-fashioned debug state is only for ARM */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_DEBUG_STATE struct __darwin_arm_debug_state
|
||||
_STRUCT_ARM_DEBUG_STATE
|
||||
{
|
||||
__uint32_t __bvr[16];
|
||||
__uint32_t __bcr[16];
|
||||
__uint32_t __wvr[16];
|
||||
__uint32_t __wcr[16];
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_DEBUG_STATE struct arm_debug_state
|
||||
_STRUCT_ARM_DEBUG_STATE
|
||||
{
|
||||
__uint32_t bvr[16];
|
||||
__uint32_t bcr[16];
|
||||
__uint32_t wvr[16];
|
||||
__uint32_t wcr[16];
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#elif defined(__arm64__)
|
||||
|
||||
/* ARM's arm_debug_state is ARM64's arm_legacy_debug_state */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct __arm_legacy_debug_state
|
||||
_STRUCT_ARM_LEGACY_DEBUG_STATE
|
||||
{
|
||||
__uint32_t __bvr[16];
|
||||
__uint32_t __bcr[16];
|
||||
__uint32_t __wvr[16];
|
||||
__uint32_t __wcr[16];
|
||||
};
|
||||
#else /* __DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct arm_legacy_debug_state
|
||||
_STRUCT_ARM_LEGACY_DEBUG_STATE
|
||||
{
|
||||
__uint32_t bvr[16];
|
||||
__uint32_t bcr[16];
|
||||
__uint32_t wvr[16];
|
||||
__uint32_t wcr[16];
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
#else
|
||||
#error unknown architecture
|
||||
#endif
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_DEBUG_STATE32 struct __darwin_arm_debug_state32
|
||||
_STRUCT_ARM_DEBUG_STATE32
|
||||
{
|
||||
__uint32_t __bvr[16];
|
||||
__uint32_t __bcr[16];
|
||||
__uint32_t __wvr[16];
|
||||
__uint32_t __wcr[16];
|
||||
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
|
||||
#define _STRUCT_ARM_DEBUG_STATE64 struct __darwin_arm_debug_state64
|
||||
_STRUCT_ARM_DEBUG_STATE64
|
||||
{
|
||||
__uint64_t __bvr[16];
|
||||
__uint64_t __bcr[16];
|
||||
__uint64_t __wvr[16];
|
||||
__uint64_t __wcr[16];
|
||||
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_DEBUG_STATE32 struct arm_debug_state32
|
||||
_STRUCT_ARM_DEBUG_STATE32
|
||||
{
|
||||
__uint32_t bvr[16];
|
||||
__uint32_t bcr[16];
|
||||
__uint32_t wvr[16];
|
||||
__uint32_t wcr[16];
|
||||
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
|
||||
#define _STRUCT_ARM_DEBUG_STATE64 struct arm_debug_state64
|
||||
_STRUCT_ARM_DEBUG_STATE64
|
||||
{
|
||||
__uint64_t bvr[16];
|
||||
__uint64_t bcr[16];
|
||||
__uint64_t wvr[16];
|
||||
__uint64_t wcr[16];
|
||||
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
|
||||
};
|
||||
#endif /* __DARWIN_UNIX03 */
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
#define _STRUCT_ARM_CPMU_STATE64 struct __darwin_arm_cpmu_state64
|
||||
_STRUCT_ARM_CPMU_STATE64
|
||||
{
|
||||
__uint64_t __ctrs[16];
|
||||
};
|
||||
#else /* __DARWIN_UNIX03 */
|
||||
#define _STRUCT_ARM_CPMU_STATE64 struct arm_cpmu_state64
|
||||
_STRUCT_ARM_CPMU_STATE64
|
||||
{
|
||||
__uint64_t ctrs[16];
|
||||
};
|
||||
#endif /* !__DARWIN_UNIX03 */
|
||||
|
||||
#endif /* _MACH_ARM__STRUCTS_H_ */
|
||||
70
lib/libc/include/aarch64-macos-gnu/mach/arm/boolean.h
Normal file
70
lib/libc/include/aarch64-macos-gnu/mach/arm/boolean.h
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: boolean.h
|
||||
*
|
||||
* Boolean type, for ARM.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_BOOLEAN_H_
|
||||
#define _MACH_ARM_BOOLEAN_H_
|
||||
|
||||
typedef int boolean_t;
|
||||
|
||||
#endif /* _MACH_ARM_BOOLEAN_H_ */
|
||||
79
lib/libc/include/aarch64-macos-gnu/mach/arm/exception.h
Normal file
79
lib/libc/include/aarch64-macos-gnu/mach/arm/exception.h
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2007 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 _MACH_ARM_EXCEPTION_H_
|
||||
#define _MACH_ARM_EXCEPTION_H_
|
||||
|
||||
#define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */
|
||||
|
||||
#define EXC_MASK_MACHINE 0
|
||||
|
||||
#define EXCEPTION_CODE_MAX 2 /* code and subcode */
|
||||
|
||||
|
||||
/*
|
||||
* Trap numbers as defined by the hardware exception vectors.
|
||||
*/
|
||||
|
||||
/*
|
||||
* EXC_BAD_INSTRUCTION
|
||||
*/
|
||||
|
||||
#define EXC_ARM_UNDEFINED 1 /* Undefined */
|
||||
|
||||
/*
|
||||
* EXC_ARITHMETIC
|
||||
*/
|
||||
|
||||
#define EXC_ARM_FP_UNDEFINED 0 /* Undefined Floating Point Exception */
|
||||
#define EXC_ARM_FP_IO 1 /* Invalid Floating Point Operation */
|
||||
#define EXC_ARM_FP_DZ 2 /* Floating Point Divide by Zero */
|
||||
#define EXC_ARM_FP_OF 3 /* Floating Point Overflow */
|
||||
#define EXC_ARM_FP_UF 4 /* Floating Point Underflow */
|
||||
#define EXC_ARM_FP_IX 5 /* Inexact Floating Point Result */
|
||||
#define EXC_ARM_FP_ID 6 /* Floating Point Denormal Input */
|
||||
|
||||
/*
|
||||
* EXC_BAD_ACCESS
|
||||
* Note: do not conflict with kern_return_t values returned by vm_fault
|
||||
*/
|
||||
|
||||
#define EXC_ARM_DA_ALIGN 0x101 /* Alignment Fault */
|
||||
#define EXC_ARM_DA_DEBUG 0x102 /* Debug (watch/break) Fault */
|
||||
#define EXC_ARM_SP_ALIGN 0x103 /* SP Alignment Fault */
|
||||
#define EXC_ARM_SWP 0x104 /* SWP instruction */
|
||||
#define EXC_ARM_PAC_FAIL 0x105 /* PAC authentication failure */
|
||||
|
||||
/*
|
||||
* EXC_BREAKPOINT
|
||||
*/
|
||||
|
||||
#define EXC_ARM_BREAKPOINT 1 /* breakpoint trap */
|
||||
|
||||
|
||||
#endif /* _MACH_ARM_EXCEPTION_H_ */
|
||||
74
lib/libc/include/aarch64-macos-gnu/mach/arm/kern_return.h
Normal file
74
lib/libc/include/aarch64-macos-gnu/mach/arm/kern_return.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: kern_return.h
|
||||
* Author: Avadis Tevanian, Jr., Michael Wayne Young
|
||||
* Date: 1985
|
||||
*
|
||||
* Machine-dependent kernel return definitions.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_KERN_RETURN_H_
|
||||
#define _MACH_ARM_KERN_RETURN_H_
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
typedef int kern_return_t;
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#endif /* _MACH_ARM_KERN_RETURN_H_ */
|
||||
72
lib/libc/include/aarch64-macos-gnu/mach/arm/processor_info.h
Normal file
72
lib/libc/include/aarch64-macos-gnu/mach/arm/processor_info.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2018 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 _MACH_ARM_PROCESSOR_INFO_H_
|
||||
#define _MACH_ARM_PROCESSOR_INFO_H_
|
||||
|
||||
#define PROCESSOR_CPU_STAT 0x10000003 /* Low-level CPU statistics */
|
||||
#define PROCESSOR_CPU_STAT64 0x10000004 /* Low-level CPU statistics, in full 64-bit */
|
||||
|
||||
#include <stdint.h> /* uint32_t, uint64_t */
|
||||
|
||||
struct processor_cpu_stat {
|
||||
uint32_t irq_ex_cnt;
|
||||
uint32_t ipi_cnt;
|
||||
uint32_t timer_cnt;
|
||||
uint32_t undef_ex_cnt;
|
||||
uint32_t unaligned_cnt;
|
||||
uint32_t vfp_cnt;
|
||||
uint32_t vfp_shortv_cnt;
|
||||
uint32_t data_ex_cnt;
|
||||
uint32_t instr_ex_cnt;
|
||||
};
|
||||
|
||||
typedef struct processor_cpu_stat processor_cpu_stat_data_t;
|
||||
typedef struct processor_cpu_stat *processor_cpu_stat_t;
|
||||
#define PROCESSOR_CPU_STAT_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(processor_cpu_stat_data_t) / sizeof(natural_t)))
|
||||
|
||||
struct processor_cpu_stat64 {
|
||||
uint64_t irq_ex_cnt;
|
||||
uint64_t ipi_cnt;
|
||||
uint64_t timer_cnt;
|
||||
uint64_t undef_ex_cnt;
|
||||
uint64_t unaligned_cnt;
|
||||
uint64_t vfp_cnt;
|
||||
uint64_t vfp_shortv_cnt;
|
||||
uint64_t data_ex_cnt;
|
||||
uint64_t instr_ex_cnt;
|
||||
uint64_t pmi_cnt;
|
||||
} __attribute__((packed, aligned(4)));
|
||||
|
||||
typedef struct processor_cpu_stat64 processor_cpu_stat64_data_t;
|
||||
typedef struct processor_cpu_stat64 *processor_cpu_stat64_t;
|
||||
#define PROCESSOR_CPU_STAT64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(processor_cpu_stat64_data_t) / sizeof(integer_t)))
|
||||
|
||||
#endif /* _MACH_ARM_PROCESSOR_INFO_H_ */
|
||||
35
lib/libc/include/aarch64-macos-gnu/mach/arm/rpc.h
Normal file
35
lib/libc/include/aarch64-macos-gnu/mach/arm/rpc.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_RPC_H_
|
||||
#define _MACH_ARM_RPC_H_
|
||||
|
||||
#endif /* _MACH_ARM_RPC_H_ */
|
||||
44
lib/libc/include/aarch64-macos-gnu/mach/arm/thread_state.h
Normal file
44
lib/libc/include/aarch64-macos-gnu/mach/arm/thread_state.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_THREAD_STATE_H_
|
||||
#define _MACH_ARM_THREAD_STATE_H_
|
||||
|
||||
/* Size of maximum exported thread state in words */
|
||||
#define ARM_THREAD_STATE_MAX (1296) /* Size of biggest state possible */
|
||||
|
||||
#if defined (__arm__) || defined(__arm64__)
|
||||
#define THREAD_STATE_MAX ARM_THREAD_STATE_MAX
|
||||
#else
|
||||
#error Unsupported arch
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_ARM_THREAD_STATE_H_ */
|
||||
249
lib/libc/include/aarch64-macos-gnu/mach/arm/thread_status.h
Normal file
249
lib/libc/include/aarch64-macos-gnu/mach/arm/thread_status.h
Normal file
@ -0,0 +1,249 @@
|
||||
/*
|
||||
* Copyright (c) 2007 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@
|
||||
*/
|
||||
/*
|
||||
* FILE_ID: thread_status.h
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ARM_THREAD_STATUS_H_
|
||||
#define _ARM_THREAD_STATUS_H_
|
||||
|
||||
#include <mach/machine/_structs.h>
|
||||
#include <mach/message.h>
|
||||
#include <mach/vm_types.h>
|
||||
#include <mach/arm/thread_state.h>
|
||||
|
||||
/*
|
||||
* Support for determining the state of a thread
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Flavors
|
||||
*/
|
||||
|
||||
#define ARM_THREAD_STATE 1
|
||||
#define ARM_UNIFIED_THREAD_STATE ARM_THREAD_STATE
|
||||
#define ARM_VFP_STATE 2
|
||||
#define ARM_EXCEPTION_STATE 3
|
||||
#define ARM_DEBUG_STATE 4 /* pre-armv8 */
|
||||
#define THREAD_STATE_NONE 5
|
||||
#define ARM_THREAD_STATE64 6
|
||||
#define ARM_EXCEPTION_STATE64 7
|
||||
// ARM_THREAD_STATE_LAST 8 /* legacy */
|
||||
#define ARM_THREAD_STATE32 9
|
||||
|
||||
|
||||
/* API */
|
||||
#define ARM_DEBUG_STATE32 14
|
||||
#define ARM_DEBUG_STATE64 15
|
||||
#define ARM_NEON_STATE 16
|
||||
#define ARM_NEON_STATE64 17
|
||||
#define ARM_CPMU_STATE64 18
|
||||
|
||||
|
||||
/* API */
|
||||
#define ARM_AMX_STATE 24
|
||||
#define ARM_AMX_STATE_V1 25
|
||||
#define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) \
|
||||
((_flavor_) == ARM_AMX_STATE_V1)
|
||||
#define ARM_PAGEIN_STATE 27
|
||||
|
||||
#define VALID_THREAD_STATE_FLAVOR(x) \
|
||||
((x == ARM_THREAD_STATE) || \
|
||||
(x == ARM_VFP_STATE) || \
|
||||
(x == ARM_EXCEPTION_STATE) || \
|
||||
(x == ARM_DEBUG_STATE) || \
|
||||
(x == THREAD_STATE_NONE) || \
|
||||
(x == ARM_THREAD_STATE32) || \
|
||||
(x == ARM_THREAD_STATE64) || \
|
||||
(x == ARM_EXCEPTION_STATE64) || \
|
||||
(x == ARM_NEON_STATE) || \
|
||||
(x == ARM_NEON_STATE64) || \
|
||||
(x == ARM_DEBUG_STATE32) || \
|
||||
(x == ARM_DEBUG_STATE64) || \
|
||||
(x == ARM_PAGEIN_STATE) || \
|
||||
(ARM_STATE_FLAVOR_IS_OTHER_VALID(x)))
|
||||
|
||||
struct arm_state_hdr {
|
||||
uint32_t flavor;
|
||||
uint32_t count;
|
||||
};
|
||||
typedef struct arm_state_hdr arm_state_hdr_t;
|
||||
|
||||
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state_t;
|
||||
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state32_t;
|
||||
typedef _STRUCT_ARM_THREAD_STATE64 arm_thread_state64_t;
|
||||
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
|
||||
|
||||
/* Accessor macros for arm_thread_state64_t pointer fields */
|
||||
|
||||
/* Return pc field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_pc(ts) \
|
||||
__darwin_arm_thread_state64_get_pc(ts)
|
||||
/* Return pc field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the arm_thread_state64_get_pc() macro in that case. */
|
||||
#define arm_thread_state64_get_pc_fptr(ts) \
|
||||
__darwin_arm_thread_state64_get_pc_fptr(ts)
|
||||
/* Set pc field of arm_thread_state64_t to a function pointer */
|
||||
#define arm_thread_state64_set_pc_fptr(ts, fptr) \
|
||||
__darwin_arm_thread_state64_set_pc_fptr(ts, fptr)
|
||||
/* Return lr field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_lr(ts) \
|
||||
__darwin_arm_thread_state64_get_lr(ts)
|
||||
/* Return lr field of arm_thread_state64_t as a function pointer. May return
|
||||
* NULL if a valid function pointer cannot be constructed, the caller should
|
||||
* fall back to the arm_thread_state64_get_lr() macro in that case. */
|
||||
#define arm_thread_state64_get_lr_fptr(ts) \
|
||||
__darwin_arm_thread_state64_get_lr_fptr(ts)
|
||||
/* Set lr field of arm_thread_state64_t to a function pointer */
|
||||
#define arm_thread_state64_set_lr_fptr(ts, fptr) \
|
||||
__darwin_arm_thread_state64_set_lr_fptr(ts, fptr)
|
||||
/* Return sp field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_sp(ts) \
|
||||
__darwin_arm_thread_state64_get_sp(ts)
|
||||
/* Set sp field of arm_thread_state64_t to a data pointer value */
|
||||
#define arm_thread_state64_set_sp(ts, ptr) \
|
||||
__darwin_arm_thread_state64_set_sp(ts, ptr)
|
||||
/* Return fp field of arm_thread_state64_t as a data pointer value */
|
||||
#define arm_thread_state64_get_fp(ts) \
|
||||
__darwin_arm_thread_state64_get_fp(ts)
|
||||
/* Set fp field of arm_thread_state64_t to a data pointer value */
|
||||
#define arm_thread_state64_set_fp(ts, ptr) \
|
||||
__darwin_arm_thread_state64_set_fp(ts, ptr)
|
||||
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
|
||||
#define arm_thread_state64_ptrauth_strip(ts) \
|
||||
__darwin_arm_thread_state64_ptrauth_strip(ts)
|
||||
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
|
||||
|
||||
struct arm_unified_thread_state {
|
||||
arm_state_hdr_t ash;
|
||||
union {
|
||||
arm_thread_state32_t ts_32;
|
||||
arm_thread_state64_t ts_64;
|
||||
} uts;
|
||||
};
|
||||
#define ts_32 uts.ts_32
|
||||
#define ts_64 uts.ts_64
|
||||
typedef struct arm_unified_thread_state arm_unified_thread_state_t;
|
||||
|
||||
#define ARM_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_thread_state_t)/sizeof(uint32_t)))
|
||||
#define ARM_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_thread_state32_t)/sizeof(uint32_t)))
|
||||
#define ARM_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_thread_state64_t)/sizeof(uint32_t)))
|
||||
#define ARM_UNIFIED_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_unified_thread_state_t)/sizeof(uint32_t)))
|
||||
|
||||
|
||||
typedef _STRUCT_ARM_VFP_STATE arm_vfp_state_t;
|
||||
typedef _STRUCT_ARM_NEON_STATE arm_neon_state_t;
|
||||
typedef _STRUCT_ARM_NEON_STATE arm_neon_state32_t;
|
||||
typedef _STRUCT_ARM_NEON_STATE64 arm_neon_state64_t;
|
||||
|
||||
typedef _STRUCT_ARM_AMX_STATE_V1 arm_amx_state_v1_t;
|
||||
|
||||
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state_t;
|
||||
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state32_t;
|
||||
typedef _STRUCT_ARM_EXCEPTION_STATE64 arm_exception_state64_t;
|
||||
|
||||
typedef _STRUCT_ARM_DEBUG_STATE32 arm_debug_state32_t;
|
||||
typedef _STRUCT_ARM_DEBUG_STATE64 arm_debug_state64_t;
|
||||
|
||||
typedef _STRUCT_ARM_PAGEIN_STATE arm_pagein_state_t;
|
||||
|
||||
/*
|
||||
* Otherwise not ARM64 kernel and we must preserve legacy ARM definitions of
|
||||
* arm_debug_state for binary compatability of userland consumers of this file.
|
||||
*/
|
||||
#if defined(__arm__)
|
||||
typedef _STRUCT_ARM_DEBUG_STATE arm_debug_state_t;
|
||||
#elif defined(__arm64__)
|
||||
typedef _STRUCT_ARM_LEGACY_DEBUG_STATE arm_debug_state_t;
|
||||
#else /* defined(__arm__) */
|
||||
#error Undefined architecture
|
||||
#endif /* defined(__arm__) */
|
||||
|
||||
#define ARM_VFP_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_vfp_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_exception_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_exception_state64_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_debug_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_debug_state32_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_PAGEIN_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_pagein_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_debug_state64_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_NEON_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_neon_state_t)/sizeof(uint32_t)))
|
||||
|
||||
#define ARM_NEON_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (arm_neon_state64_t)/sizeof(uint32_t)))
|
||||
|
||||
#define MACHINE_THREAD_STATE ARM_THREAD_STATE
|
||||
#define MACHINE_THREAD_STATE_COUNT ARM_UNIFIED_THREAD_STATE_COUNT
|
||||
|
||||
|
||||
struct arm_amx_state {
|
||||
arm_state_hdr_t ash;
|
||||
union {
|
||||
arm_amx_state_v1_t as_v1;
|
||||
} uas;
|
||||
};
|
||||
#define as_v1 uas.as_v1
|
||||
typedef struct arm_amx_state arm_amx_state_t;
|
||||
|
||||
#define ARM_AMX_STATE_V1_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(arm_amx_state_v1_t)/sizeof(unsigned int)))
|
||||
|
||||
#define ARM_AMX_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(arm_amx_state_t)/sizeof(unsigned int)))
|
||||
|
||||
|
||||
/*
|
||||
* Largest state on this machine:
|
||||
*/
|
||||
#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
|
||||
|
||||
|
||||
#endif /* _ARM_THREAD_STATUS_H_ */
|
||||
103
lib/libc/include/aarch64-macos-gnu/mach/arm/vm_param.h
Normal file
103
lib/libc/include/aarch64-macos-gnu/mach/arm/vm_param.h
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (c) 2007 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@
|
||||
*/
|
||||
/*
|
||||
* FILE_ID: vm_param.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARM machine dependent virtual memory parameters.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_VM_PARAM_H_
|
||||
#define _MACH_ARM_VM_PARAM_H_
|
||||
|
||||
|
||||
#if !defined (KERNEL) && !defined (__ASSEMBLER__)
|
||||
#include <mach/vm_page_size.h>
|
||||
#endif
|
||||
|
||||
#define BYTE_SIZE 8 /* byte size in bits */
|
||||
|
||||
|
||||
#define PAGE_SHIFT vm_page_shift
|
||||
#define PAGE_SIZE vm_page_size
|
||||
#define PAGE_MASK vm_page_mask
|
||||
|
||||
#define VM_PAGE_SIZE vm_page_size
|
||||
|
||||
#define machine_ptob(x) ((x) << PAGE_SHIFT)
|
||||
|
||||
|
||||
#define PAGE_MAX_SHIFT 14
|
||||
#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT)
|
||||
#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1)
|
||||
|
||||
#define PAGE_MIN_SHIFT 12
|
||||
#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT)
|
||||
#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1)
|
||||
|
||||
#define VM_MAX_PAGE_ADDRESS MACH_VM_MAX_ADDRESS
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
|
||||
#if defined (__arm__)
|
||||
|
||||
#define VM_MIN_ADDRESS ((vm_address_t) 0x00000000)
|
||||
#define VM_MAX_ADDRESS ((vm_address_t) 0x80000000)
|
||||
|
||||
/* system-wide values */
|
||||
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
|
||||
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_ADDRESS)
|
||||
|
||||
#elif defined (__arm64__)
|
||||
|
||||
#define VM_MIN_ADDRESS ((vm_address_t) 0x0000000000000000ULL)
|
||||
#define VM_MAX_ADDRESS ((vm_address_t) 0x0000000080000000ULL)
|
||||
|
||||
/* system-wide values */
|
||||
#define MACH_VM_MIN_ADDRESS_RAW 0x0ULL
|
||||
#define MACH_VM_MAX_ADDRESS_RAW 0x00007FFFFE000000ULL
|
||||
|
||||
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW)
|
||||
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW)
|
||||
|
||||
|
||||
#else /* defined(__arm64__) */
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS
|
||||
#define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS
|
||||
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
#define SWI_SYSCALL 0x80
|
||||
|
||||
#endif /* _MACH_ARM_VM_PARAM_H_ */
|
||||
157
lib/libc/include/aarch64-macos-gnu/mach/arm/vm_types.h
Normal file
157
lib/libc/include/aarch64-macos-gnu/mach/arm/vm_types.h
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: vm_types.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1985
|
||||
*
|
||||
* Header file for VM data types. ARM version.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ARM_VM_TYPES_H_
|
||||
#define _MACH_ARM_VM_TYPES_H_
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
|
||||
#include <arm/_types.h>
|
||||
#include <stdint.h>
|
||||
#include <Availability.h>
|
||||
|
||||
/*
|
||||
* natural_t and integer_t are Mach's legacy types for machine-
|
||||
* independent integer types (unsigned, and signed, respectively).
|
||||
* Their original purpose was to define other types in a machine/
|
||||
* compiler independent way.
|
||||
*
|
||||
* They also had an implicit "same size as pointer" characteristic
|
||||
* to them (i.e. Mach's traditional types are very ILP32 or ILP64
|
||||
* centric). We will likely support x86 ABIs that do not follow
|
||||
* either ofthese models (specifically LP64). Therefore, we had to
|
||||
* make a choice between making these types scale with pointers or stay
|
||||
* tied to integers. Because their use is predominantly tied to
|
||||
* to the size of an integer, we are keeping that association and
|
||||
* breaking free from pointer size guarantees.
|
||||
*
|
||||
* New use of these types is discouraged.
|
||||
*/
|
||||
typedef __darwin_natural_t natural_t;
|
||||
typedef int integer_t;
|
||||
|
||||
/*
|
||||
* A vm_offset_t is a type-neutral pointer,
|
||||
* e.g. an offset into a virtual memory space.
|
||||
*/
|
||||
#ifdef __LP64__
|
||||
typedef uintptr_t vm_offset_t;
|
||||
typedef uintptr_t vm_size_t;
|
||||
|
||||
typedef uint64_t mach_vm_address_t;
|
||||
typedef uint64_t mach_vm_offset_t;
|
||||
typedef uint64_t mach_vm_size_t;
|
||||
|
||||
typedef uint64_t vm_map_offset_t;
|
||||
typedef uint64_t vm_map_address_t;
|
||||
typedef uint64_t vm_map_size_t;
|
||||
#else
|
||||
typedef natural_t vm_offset_t;
|
||||
/*
|
||||
* A vm_size_t is the proper type for e.g.
|
||||
* expressing the difference between two
|
||||
* vm_offset_t entities.
|
||||
*/
|
||||
typedef natural_t vm_size_t;
|
||||
|
||||
/*
|
||||
* This new type is independent of a particular vm map's
|
||||
* implementation size - and represents appropriate types
|
||||
* for all possible maps. This is used for interfaces
|
||||
* where the size of the map is not known - or we don't
|
||||
* want to have to distinguish.
|
||||
*/
|
||||
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0)
|
||||
typedef uint32_t mach_vm_address_t;
|
||||
typedef uint32_t mach_vm_offset_t;
|
||||
typedef uint32_t mach_vm_size_t;
|
||||
#else
|
||||
typedef uint64_t mach_vm_address_t;
|
||||
typedef uint64_t mach_vm_offset_t;
|
||||
typedef uint64_t mach_vm_size_t;
|
||||
#endif
|
||||
|
||||
typedef uint32_t vm_map_offset_t;
|
||||
typedef uint32_t vm_map_address_t;
|
||||
typedef uint32_t vm_map_size_t;
|
||||
#endif /* __LP64__ */
|
||||
|
||||
|
||||
typedef uint32_t vm32_offset_t;
|
||||
typedef uint32_t vm32_address_t;
|
||||
typedef uint32_t vm32_size_t;
|
||||
|
||||
typedef vm_offset_t mach_port_context_t;
|
||||
|
||||
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
/*
|
||||
* If composing messages by hand (please do not)
|
||||
*/
|
||||
#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
|
||||
|
||||
#endif /* _MACH_ARM_VM_TYPES_H_ */
|
||||
334
lib/libc/include/aarch64-macos-gnu/mach/kern_return.h
Normal file
334
lib/libc/include/aarch64-macos-gnu/mach/kern_return.h
Normal file
@ -0,0 +1,334 @@
|
||||
/*
|
||||
* Copyright (c) 2000 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: h/kern_return.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1985
|
||||
*
|
||||
* Kernel return codes.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_KERN_RETURN_H_
|
||||
#define _MACH_KERN_RETURN_H_
|
||||
|
||||
#include <mach/machine/kern_return.h>
|
||||
|
||||
#define KERN_SUCCESS 0
|
||||
|
||||
#define KERN_INVALID_ADDRESS 1
|
||||
/* Specified address is not currently valid.
|
||||
*/
|
||||
|
||||
#define KERN_PROTECTION_FAILURE 2
|
||||
/* Specified memory is valid, but does not permit the
|
||||
* required forms of access.
|
||||
*/
|
||||
|
||||
#define KERN_NO_SPACE 3
|
||||
/* The address range specified is already in use, or
|
||||
* no address range of the size specified could be
|
||||
* found.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_ARGUMENT 4
|
||||
/* The function requested was not applicable to this
|
||||
* type of argument, or an argument is invalid
|
||||
*/
|
||||
|
||||
#define KERN_FAILURE 5
|
||||
/* The function could not be performed. A catch-all.
|
||||
*/
|
||||
|
||||
#define KERN_RESOURCE_SHORTAGE 6
|
||||
/* A system resource could not be allocated to fulfill
|
||||
* this request. This failure may not be permanent.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_RECEIVER 7
|
||||
/* The task in question does not hold receive rights
|
||||
* for the port argument.
|
||||
*/
|
||||
|
||||
#define KERN_NO_ACCESS 8
|
||||
/* Bogus access restriction.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_FAILURE 9
|
||||
/* During a page fault, the target address refers to a
|
||||
* memory object that has been destroyed. This
|
||||
* failure is permanent.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_ERROR 10
|
||||
/* During a page fault, the memory object indicated
|
||||
* that the data could not be returned. This failure
|
||||
* may be temporary; future attempts to access this
|
||||
* same data may succeed, as defined by the memory
|
||||
* object.
|
||||
*/
|
||||
|
||||
#define KERN_ALREADY_IN_SET 11
|
||||
/* The receive right is already a member of the portset.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_IN_SET 12
|
||||
/* The receive right is not a member of a port set.
|
||||
*/
|
||||
|
||||
#define KERN_NAME_EXISTS 13
|
||||
/* The name already denotes a right in the task.
|
||||
*/
|
||||
|
||||
#define KERN_ABORTED 14
|
||||
/* The operation was aborted. Ipc code will
|
||||
* catch this and reflect it as a message error.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_NAME 15
|
||||
/* The name doesn't denote a right in the task.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_TASK 16
|
||||
/* Target task isn't an active task.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_RIGHT 17
|
||||
/* The name denotes a right, but not an appropriate right.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_VALUE 18
|
||||
/* A blatant range error.
|
||||
*/
|
||||
|
||||
#define KERN_UREFS_OVERFLOW 19
|
||||
/* Operation would overflow limit on user-references.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_CAPABILITY 20
|
||||
/* The supplied (port) capability is improper.
|
||||
*/
|
||||
|
||||
#define KERN_RIGHT_EXISTS 21
|
||||
/* The task already has send or receive rights
|
||||
* for the port under another name.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_HOST 22
|
||||
/* Target host isn't actually a host.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_PRESENT 23
|
||||
/* An attempt was made to supply "precious" data
|
||||
* for memory that is already present in a
|
||||
* memory object.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_DATA_MOVED 24
|
||||
/* A page was requested of a memory manager via
|
||||
* memory_object_data_request for an object using
|
||||
* a MEMORY_OBJECT_COPY_CALL strategy, with the
|
||||
* VM_PROT_WANTS_COPY flag being used to specify
|
||||
* that the page desired is for a copy of the
|
||||
* object, and the memory manager has detected
|
||||
* the page was pushed into a copy of the object
|
||||
* while the kernel was walking the shadow chain
|
||||
* from the copy to the object. This error code
|
||||
* is delivered via memory_object_data_error
|
||||
* and is handled by the kernel (it forces the
|
||||
* kernel to restart the fault). It will not be
|
||||
* seen by users.
|
||||
*/
|
||||
|
||||
#define KERN_MEMORY_RESTART_COPY 25
|
||||
/* A strategic copy was attempted of an object
|
||||
* upon which a quicker copy is now possible.
|
||||
* The caller should retry the copy using
|
||||
* vm_object_copy_quickly. This error code
|
||||
* is seen only by the kernel.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_PROCESSOR_SET 26
|
||||
/* An argument applied to assert processor set privilege
|
||||
* was not a processor set control port.
|
||||
*/
|
||||
|
||||
#define KERN_POLICY_LIMIT 27
|
||||
/* The specified scheduling attributes exceed the thread's
|
||||
* limits.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_POLICY 28
|
||||
/* The specified scheduling policy is not currently
|
||||
* enabled for the processor set.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_OBJECT 29
|
||||
/* The external memory manager failed to initialize the
|
||||
* memory object.
|
||||
*/
|
||||
|
||||
#define KERN_ALREADY_WAITING 30
|
||||
/* A thread is attempting to wait for an event for which
|
||||
* there is already a waiting thread.
|
||||
*/
|
||||
|
||||
#define KERN_DEFAULT_SET 31
|
||||
/* An attempt was made to destroy the default processor
|
||||
* set.
|
||||
*/
|
||||
|
||||
#define KERN_EXCEPTION_PROTECTED 32
|
||||
/* An attempt was made to fetch an exception port that is
|
||||
* protected, or to abort a thread while processing a
|
||||
* protected exception.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_LEDGER 33
|
||||
/* A ledger was required but not supplied.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_MEMORY_CONTROL 34
|
||||
/* The port was not a memory cache control port.
|
||||
*/
|
||||
|
||||
#define KERN_INVALID_SECURITY 35
|
||||
/* An argument supplied to assert security privilege
|
||||
* was not a host security port.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_DEPRESSED 36
|
||||
/* thread_depress_abort was called on a thread which
|
||||
* was not currently depressed.
|
||||
*/
|
||||
|
||||
#define KERN_TERMINATED 37
|
||||
/* Object has been terminated and is no longer available
|
||||
*/
|
||||
|
||||
#define KERN_LOCK_SET_DESTROYED 38
|
||||
/* Lock set has been destroyed and is no longer available.
|
||||
*/
|
||||
|
||||
#define KERN_LOCK_UNSTABLE 39
|
||||
/* The thread holding the lock terminated before releasing
|
||||
* the lock
|
||||
*/
|
||||
|
||||
#define KERN_LOCK_OWNED 40
|
||||
/* The lock is already owned by another thread
|
||||
*/
|
||||
|
||||
#define KERN_LOCK_OWNED_SELF 41
|
||||
/* The lock is already owned by the calling thread
|
||||
*/
|
||||
|
||||
#define KERN_SEMAPHORE_DESTROYED 42
|
||||
/* Semaphore has been destroyed and is no longer available.
|
||||
*/
|
||||
|
||||
#define KERN_RPC_SERVER_TERMINATED 43
|
||||
/* Return from RPC indicating the target server was
|
||||
* terminated before it successfully replied
|
||||
*/
|
||||
|
||||
#define KERN_RPC_TERMINATE_ORPHAN 44
|
||||
/* Terminate an orphaned activation.
|
||||
*/
|
||||
|
||||
#define KERN_RPC_CONTINUE_ORPHAN 45
|
||||
/* Allow an orphaned activation to continue executing.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_SUPPORTED 46
|
||||
/* Empty thread activation (No thread linked to it)
|
||||
*/
|
||||
|
||||
#define KERN_NODE_DOWN 47
|
||||
/* Remote node down or inaccessible.
|
||||
*/
|
||||
|
||||
#define KERN_NOT_WAITING 48
|
||||
/* A signalled thread was not actually waiting. */
|
||||
|
||||
#define KERN_OPERATION_TIMED_OUT 49
|
||||
/* Some thread-oriented operation (semaphore_wait) timed out
|
||||
*/
|
||||
|
||||
#define KERN_CODESIGN_ERROR 50
|
||||
/* During a page fault, indicates that the page was rejected
|
||||
* as a result of a signature check.
|
||||
*/
|
||||
|
||||
#define KERN_POLICY_STATIC 51
|
||||
/* The requested property cannot be changed at this time.
|
||||
*/
|
||||
|
||||
#define KERN_INSUFFICIENT_BUFFER_SIZE 52
|
||||
/* The provided buffer is of insufficient size for the requested data.
|
||||
*/
|
||||
|
||||
#define KERN_DENIED 53
|
||||
/* Denied by security policy
|
||||
*/
|
||||
|
||||
#define KERN_RETURN_MAX 0x100
|
||||
/* Maximum return value allowable
|
||||
*/
|
||||
|
||||
#endif /* _MACH_KERN_RETURN_H_ */
|
||||
1808
lib/libc/include/aarch64-macos-gnu/mach/mach_port.h
Normal file
1808
lib/libc/include/aarch64-macos-gnu/mach/mach_port.h
Normal file
File diff suppressed because it is too large
Load Diff
297
lib/libc/include/aarch64-macos-gnu/mach/mach_traps.h
Normal file
297
lib/libc/include/aarch64-macos-gnu/mach/mach_traps.h
Normal file
@ -0,0 +1,297 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2019 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* Definitions of general Mach system traps.
|
||||
*
|
||||
* These are the definitions as seen from user-space.
|
||||
* The kernel definitions are in <mach/syscall_sw.h>.
|
||||
* Kernel RPC functions are defined in <mach/mach_interface.h>.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACH_TRAPS_H_
|
||||
#define _MACH_MACH_TRAPS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <mach/std_types.h>
|
||||
#include <mach/mach_types.h>
|
||||
#include <mach/kern_return.h>
|
||||
#include <mach/port.h>
|
||||
#include <mach/vm_types.h>
|
||||
#include <mach/clock_types.h>
|
||||
|
||||
#include <machine/endian.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
|
||||
extern kern_return_t clock_sleep_trap(
|
||||
mach_port_name_t clock_name,
|
||||
sleep_type_t sleep_type,
|
||||
int sleep_sec,
|
||||
int sleep_nsec,
|
||||
mach_timespec_t *wakeup_time);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_allocate_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_offset_t *addr,
|
||||
mach_vm_size_t size,
|
||||
int flags);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_deallocate_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_protect_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_address_t address,
|
||||
mach_vm_size_t size,
|
||||
boolean_t set_maximum,
|
||||
vm_prot_t new_protection
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_map_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_offset_t *address,
|
||||
mach_vm_size_t size,
|
||||
mach_vm_offset_t mask,
|
||||
int flags,
|
||||
vm_prot_t cur_protection
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_vm_purgable_control_trap(
|
||||
mach_port_name_t target,
|
||||
mach_vm_offset_t address,
|
||||
vm_purgable_t control,
|
||||
int *state);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_allocate_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_right_t right,
|
||||
mach_port_name_t *name
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_deallocate_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_mod_refs_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_right_t right,
|
||||
mach_port_delta_t delta
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_move_member_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t member,
|
||||
mach_port_name_t after
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_insert_right_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_name_t poly,
|
||||
mach_msg_type_name_t polyPoly
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_get_attributes_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_flavor_t flavor,
|
||||
mach_port_info_t port_info_out,
|
||||
mach_msg_type_number_t *port_info_outCnt
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_insert_member_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_name_t pset
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_extract_member_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_name_t pset
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_construct_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_options_t *options,
|
||||
uint64_t context,
|
||||
mach_port_name_t *name
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_destruct_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
mach_port_delta_t srdelta,
|
||||
uint64_t guard
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_guard_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
uint64_t guard,
|
||||
boolean_t strict
|
||||
);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_unguard_trap(
|
||||
mach_port_name_t target,
|
||||
mach_port_name_t name,
|
||||
uint64_t guard
|
||||
);
|
||||
|
||||
extern kern_return_t mach_generate_activity_id(
|
||||
mach_port_name_t target,
|
||||
int count,
|
||||
uint64_t *activity_id
|
||||
);
|
||||
|
||||
extern kern_return_t macx_swapon(
|
||||
uint64_t filename,
|
||||
int flags,
|
||||
int size,
|
||||
int priority);
|
||||
|
||||
extern kern_return_t macx_swapoff(
|
||||
uint64_t filename,
|
||||
int flags);
|
||||
|
||||
extern kern_return_t macx_triggers(
|
||||
int hi_water,
|
||||
int low_water,
|
||||
int flags,
|
||||
mach_port_t alert_port);
|
||||
|
||||
extern kern_return_t macx_backing_store_suspend(
|
||||
boolean_t suspend);
|
||||
|
||||
extern kern_return_t macx_backing_store_recovery(
|
||||
int pid);
|
||||
|
||||
extern boolean_t swtch_pri(int pri);
|
||||
|
||||
extern boolean_t swtch(void);
|
||||
|
||||
extern kern_return_t thread_switch(
|
||||
mach_port_name_t thread_name,
|
||||
int option,
|
||||
mach_msg_timeout_t option_time);
|
||||
|
||||
extern mach_port_name_t task_self_trap(void);
|
||||
|
||||
extern kern_return_t host_create_mach_voucher_trap(
|
||||
mach_port_name_t host,
|
||||
mach_voucher_attr_raw_recipe_array_t recipes,
|
||||
int recipes_size,
|
||||
mach_port_name_t *voucher);
|
||||
|
||||
extern kern_return_t mach_voucher_extract_attr_recipe_trap(
|
||||
mach_port_name_t voucher_name,
|
||||
mach_voucher_attr_key_t key,
|
||||
mach_voucher_attr_raw_recipe_t recipe,
|
||||
mach_msg_type_number_t *recipe_size);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_type_trap(
|
||||
ipc_space_t task,
|
||||
mach_port_name_t name,
|
||||
mach_port_type_t *ptype);
|
||||
|
||||
extern kern_return_t _kernelrpc_mach_port_request_notification_trap(
|
||||
ipc_space_t task,
|
||||
mach_port_name_t name,
|
||||
mach_msg_id_t msgid,
|
||||
mach_port_mscount_t sync,
|
||||
mach_port_name_t notify,
|
||||
mach_msg_type_name_t notifyPoly,
|
||||
mach_port_name_t *previous);
|
||||
|
||||
/*
|
||||
* Obsolete interfaces.
|
||||
*/
|
||||
|
||||
extern kern_return_t task_for_pid(
|
||||
mach_port_name_t target_tport,
|
||||
int pid,
|
||||
mach_port_name_t *t);
|
||||
|
||||
extern kern_return_t task_name_for_pid(
|
||||
mach_port_name_t target_tport,
|
||||
int pid,
|
||||
mach_port_name_t *tn);
|
||||
|
||||
extern kern_return_t pid_for_task(
|
||||
mach_port_name_t t,
|
||||
int *x);
|
||||
|
||||
extern kern_return_t debug_control_port_for_pid(
|
||||
mach_port_name_t target_tport,
|
||||
int pid,
|
||||
mach_port_name_t *t);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACH_MACH_TRAPS_H_ */
|
||||
283
lib/libc/include/aarch64-macos-gnu/mach/mach_types.h
Normal file
283
lib/libc/include/aarch64-macos-gnu/mach/mach_types.h
Normal file
@ -0,0 +1,283 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2018 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
|
||||
* support for mandatory and extensible security protections. This notice
|
||||
* is included in support of clause 2.2 (b) of the Apple Public License,
|
||||
* Version 2.0.
|
||||
*/
|
||||
/*
|
||||
* File: mach/mach_types.h
|
||||
* Author: Avadis Tevanian, Jr., Michael Wayne Young
|
||||
* Date: 1986
|
||||
*
|
||||
* Mach external interface definitions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACH_TYPES_H_
|
||||
#define _MACH_MACH_TYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <mach/host_info.h>
|
||||
#include <mach/host_notify.h>
|
||||
#include <mach/host_special_ports.h>
|
||||
#include <mach/machine.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/memory_object_types.h>
|
||||
#include <mach/message.h>
|
||||
#include <mach/exception_types.h>
|
||||
#include <mach/port.h>
|
||||
#include <mach/mach_voucher_types.h>
|
||||
#include <mach/processor_info.h>
|
||||
#include <mach/task_info.h>
|
||||
#include <mach/task_inspect.h>
|
||||
#include <mach/task_policy.h>
|
||||
#include <mach/task_special_ports.h>
|
||||
#include <mach/thread_info.h>
|
||||
#include <mach/thread_policy.h>
|
||||
#include <mach/thread_special_ports.h>
|
||||
#include <mach/thread_status.h>
|
||||
#include <mach/time_value.h>
|
||||
#include <mach/clock_types.h>
|
||||
#include <mach/vm_attributes.h>
|
||||
#include <mach/vm_inherit.h>
|
||||
#include <mach/vm_purgable.h>
|
||||
#include <mach/vm_behavior.h>
|
||||
#include <mach/vm_prot.h>
|
||||
#include <mach/vm_statistics.h>
|
||||
#include <mach/vm_sync.h>
|
||||
#include <mach/vm_types.h>
|
||||
#include <mach/vm_region.h>
|
||||
#include <mach/kmod.h>
|
||||
#include <mach/dyld_kernel.h>
|
||||
|
||||
|
||||
/*
|
||||
* If we are not in the kernel, then these will all be represented by
|
||||
* ports at user-space.
|
||||
*/
|
||||
typedef mach_port_t task_t;
|
||||
typedef mach_port_t task_name_t;
|
||||
typedef mach_port_t task_policy_set_t;
|
||||
typedef mach_port_t task_policy_get_t;
|
||||
typedef mach_port_t task_inspect_t;
|
||||
typedef mach_port_t task_read_t;
|
||||
typedef mach_port_t task_suspension_token_t;
|
||||
typedef mach_port_t thread_t;
|
||||
typedef mach_port_t thread_act_t;
|
||||
typedef mach_port_t thread_inspect_t;
|
||||
typedef mach_port_t thread_read_t;
|
||||
typedef mach_port_t ipc_space_t;
|
||||
typedef mach_port_t ipc_space_read_t;
|
||||
typedef mach_port_t ipc_space_inspect_t;
|
||||
typedef mach_port_t coalition_t;
|
||||
typedef mach_port_t host_t;
|
||||
typedef mach_port_t host_priv_t;
|
||||
typedef mach_port_t host_security_t;
|
||||
typedef mach_port_t processor_t;
|
||||
typedef mach_port_t processor_set_t;
|
||||
typedef mach_port_t processor_set_control_t;
|
||||
typedef mach_port_t semaphore_t;
|
||||
typedef mach_port_t lock_set_t;
|
||||
typedef mach_port_t ledger_t;
|
||||
typedef mach_port_t alarm_t;
|
||||
typedef mach_port_t clock_serv_t;
|
||||
typedef mach_port_t clock_ctrl_t;
|
||||
typedef mach_port_t arcade_register_t;
|
||||
typedef mach_port_t ipc_eventlink_t;
|
||||
typedef mach_port_t eventlink_port_pair_t[2];
|
||||
typedef mach_port_t suid_cred_t;
|
||||
|
||||
|
||||
/*
|
||||
* These aren't really unique types. They are just called
|
||||
* out as unique types at one point in history. So we list
|
||||
* them here for compatibility.
|
||||
*/
|
||||
typedef processor_set_t processor_set_name_t;
|
||||
|
||||
/*
|
||||
* These types are just hard-coded as ports
|
||||
*/
|
||||
typedef mach_port_t clock_reply_t;
|
||||
typedef mach_port_t bootstrap_t;
|
||||
typedef mach_port_t mem_entry_name_port_t;
|
||||
typedef mach_port_t exception_handler_t;
|
||||
typedef exception_handler_t *exception_handler_array_t;
|
||||
typedef mach_port_t vm_task_entry_t;
|
||||
typedef mach_port_t io_master_t;
|
||||
typedef mach_port_t UNDServerRef;
|
||||
typedef mach_port_t mach_eventlink_t;
|
||||
|
||||
/*
|
||||
* Mig doesn't translate the components of an array.
|
||||
* For example, Mig won't use the thread_t translations
|
||||
* to translate a thread_array_t argument. So, these definitions
|
||||
* are not completely accurate at the moment for other kernel
|
||||
* components.
|
||||
*/
|
||||
typedef task_t *task_array_t;
|
||||
typedef thread_t *thread_array_t;
|
||||
typedef processor_set_t *processor_set_array_t;
|
||||
typedef processor_set_t *processor_set_name_array_t;
|
||||
typedef processor_t *processor_array_t;
|
||||
typedef thread_act_t *thread_act_array_t;
|
||||
typedef ledger_t *ledger_array_t;
|
||||
|
||||
/*
|
||||
* However the real mach_types got declared, we also have to declare
|
||||
* types with "port" in the name for compatability with the way OSF
|
||||
* had declared the user interfaces at one point. Someday these should
|
||||
* go away.
|
||||
*/
|
||||
typedef task_t task_port_t;
|
||||
typedef task_array_t task_port_array_t;
|
||||
typedef thread_t thread_port_t;
|
||||
typedef thread_array_t thread_port_array_t;
|
||||
typedef ipc_space_t ipc_space_port_t;
|
||||
typedef host_t host_name_t;
|
||||
typedef host_t host_name_port_t;
|
||||
typedef processor_set_t processor_set_port_t;
|
||||
typedef processor_set_t processor_set_name_port_t;
|
||||
typedef processor_set_array_t processor_set_name_port_array_t;
|
||||
typedef processor_set_t processor_set_control_port_t;
|
||||
typedef processor_t processor_port_t;
|
||||
typedef processor_array_t processor_port_array_t;
|
||||
typedef thread_act_t thread_act_port_t;
|
||||
typedef thread_act_array_t thread_act_port_array_t;
|
||||
typedef semaphore_t semaphore_port_t;
|
||||
typedef lock_set_t lock_set_port_t;
|
||||
typedef ledger_t ledger_port_t;
|
||||
typedef ledger_array_t ledger_port_array_t;
|
||||
typedef alarm_t alarm_port_t;
|
||||
typedef clock_serv_t clock_serv_port_t;
|
||||
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 suid_cred_path_t[1024];
|
||||
typedef uint32_t suid_cred_uid_t;
|
||||
|
||||
#define TASK_NULL ((task_t) 0)
|
||||
#define TASK_NAME_NULL ((task_name_t) 0)
|
||||
#define TASK_INSPECT_NULL ((task_inspect_t) 0)
|
||||
#define TASK_READ_NULL ((task_read_t) 0)
|
||||
#define THREAD_NULL ((thread_t) 0)
|
||||
#define THREAD_INSPECT_NULL ((thread_inspect_t) 0)
|
||||
#define THREAD_READ_NULL ((thread_read_t) 0)
|
||||
#define TID_NULL ((uint64_t) 0)
|
||||
#define THR_ACT_NULL ((thread_act_t) 0)
|
||||
#define IPC_SPACE_NULL ((ipc_space_t) 0)
|
||||
#define IPC_SPACE_READ_NULL ((ipc_space_read_t) 0)
|
||||
#define IPC_SPACE_INSPECT_NULL ((ipc_space_inspect_t) 0)
|
||||
#define COALITION_NULL ((coalition_t) 0)
|
||||
#define HOST_NULL ((host_t) 0)
|
||||
#define HOST_PRIV_NULL ((host_priv_t) 0)
|
||||
#define HOST_SECURITY_NULL ((host_security_t) 0)
|
||||
#define PROCESSOR_SET_NULL ((processor_set_t) 0)
|
||||
#define PROCESSOR_NULL ((processor_t) 0)
|
||||
#define SEMAPHORE_NULL ((semaphore_t) 0)
|
||||
#define LOCK_SET_NULL ((lock_set_t) 0)
|
||||
#define LEDGER_NULL ((ledger_t) 0)
|
||||
#define ALARM_NULL ((alarm_t) 0)
|
||||
#define CLOCK_NULL ((clock_t) 0)
|
||||
#define UND_SERVER_NULL ((UNDServerRef) 0)
|
||||
#define ARCADE_REG_NULL ((arcade_register_t) 0)
|
||||
#define MACH_EVENTLINK_NULL ((mach_eventlink_t) 0)
|
||||
#define IPC_EVENTLINK_NULL ((ipc_eventlink_t) 0)
|
||||
#define SUID_CRED_NULL ((suid_cred_t) 0)
|
||||
|
||||
/* capability strictly _DECREASING_.
|
||||
* not ordered the other way around because we want TASK_FLAVOR_CONTROL
|
||||
* to be closest to the itk_lock. see task.h.
|
||||
*/
|
||||
typedef unsigned int mach_task_flavor_t;
|
||||
#define TASK_FLAVOR_CONTROL 0 /* a task_t */
|
||||
#define TASK_FLAVOR_READ 1 /* a task_read_t */
|
||||
#define TASK_FLAVOR_INSPECT 2 /* a task_inspect_t */
|
||||
#define TASK_FLAVOR_NAME 3 /* a task_name_t */
|
||||
|
||||
/* capability strictly _DECREASING_ */
|
||||
typedef unsigned int mach_thread_flavor_t;
|
||||
#define THREAD_FLAVOR_CONTROL 0 /* a thread_t */
|
||||
#define THREAD_FLAVOR_READ 1 /* a thread_read_t */
|
||||
#define THREAD_FLAVOR_INSPECT 2 /* a thread_inspect_t */
|
||||
|
||||
/* DEPRECATED */
|
||||
typedef natural_t ledger_item_t;
|
||||
#define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0))
|
||||
|
||||
typedef int64_t ledger_amount_t;
|
||||
#define LEDGER_LIMIT_INFINITY ((ledger_amount_t)((1ULL << 63) - 1))
|
||||
|
||||
typedef mach_vm_offset_t *emulation_vector_t;
|
||||
typedef char *user_subsystem_t;
|
||||
|
||||
typedef char *labelstr_t;
|
||||
/*
|
||||
* Backwards compatibility, for those programs written
|
||||
* before mach/{std,mach}_types.{defs,h} were set up.
|
||||
*/
|
||||
#include <mach/std_types.h>
|
||||
|
||||
#endif /* _MACH_MACH_TYPES_H_ */
|
||||
411
lib/libc/include/aarch64-macos-gnu/mach/machine.h
Normal file
411
lib/libc/include/aarch64-macos-gnu/mach/machine.h
Normal file
@ -0,0 +1,411 @@
|
||||
/*
|
||||
* Copyright (c) 2007-2016 Apple, Inc. All rights reserved.
|
||||
* Copyright (c) 2000 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@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/* File: machine.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1986
|
||||
*
|
||||
* Machine independent machine abstraction.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MACHINE_H_
|
||||
#define _MACH_MACHINE_H_
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/boolean.h>
|
||||
|
||||
typedef integer_t cpu_type_t;
|
||||
typedef integer_t cpu_subtype_t;
|
||||
typedef integer_t cpu_threadtype_t;
|
||||
|
||||
#define CPU_STATE_MAX 4
|
||||
|
||||
#define CPU_STATE_USER 0
|
||||
#define CPU_STATE_SYSTEM 1
|
||||
#define CPU_STATE_IDLE 2
|
||||
#define CPU_STATE_NICE 3
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Capability bits used in the definition of cpu_type.
|
||||
*/
|
||||
#define CPU_ARCH_MASK 0xff000000 /* mask for architecture bits */
|
||||
#define CPU_ARCH_ABI64 0x01000000 /* 64 bit ABI */
|
||||
#define CPU_ARCH_ABI64_32 0x02000000 /* ABI for 64-bit hardware with 32-bit types; LP32 */
|
||||
|
||||
/*
|
||||
* Machine types known by all.
|
||||
*/
|
||||
|
||||
#define CPU_TYPE_ANY ((cpu_type_t) -1)
|
||||
|
||||
#define CPU_TYPE_VAX ((cpu_type_t) 1)
|
||||
/* skip ((cpu_type_t) 2) */
|
||||
/* skip ((cpu_type_t) 3) */
|
||||
/* skip ((cpu_type_t) 4) */
|
||||
/* skip ((cpu_type_t) 5) */
|
||||
#define CPU_TYPE_MC680x0 ((cpu_type_t) 6)
|
||||
#define CPU_TYPE_X86 ((cpu_type_t) 7)
|
||||
#define CPU_TYPE_I386 CPU_TYPE_X86 /* compatibility */
|
||||
#define CPU_TYPE_X86_64 (CPU_TYPE_X86 | CPU_ARCH_ABI64)
|
||||
|
||||
/* skip CPU_TYPE_MIPS ((cpu_type_t) 8) */
|
||||
/* skip ((cpu_type_t) 9) */
|
||||
#define CPU_TYPE_MC98000 ((cpu_type_t) 10)
|
||||
#define CPU_TYPE_HPPA ((cpu_type_t) 11)
|
||||
#define CPU_TYPE_ARM ((cpu_type_t) 12)
|
||||
#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64)
|
||||
#define CPU_TYPE_ARM64_32 (CPU_TYPE_ARM | CPU_ARCH_ABI64_32)
|
||||
#define CPU_TYPE_MC88000 ((cpu_type_t) 13)
|
||||
#define CPU_TYPE_SPARC ((cpu_type_t) 14)
|
||||
#define CPU_TYPE_I860 ((cpu_type_t) 15)
|
||||
/* skip CPU_TYPE_ALPHA ((cpu_type_t) 16) */
|
||||
/* skip ((cpu_type_t) 17) */
|
||||
#define CPU_TYPE_POWERPC ((cpu_type_t) 18)
|
||||
#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
|
||||
/* skip ((cpu_type_t) 19) */
|
||||
/* skip ((cpu_type_t) 20 */
|
||||
/* skip ((cpu_type_t) 21 */
|
||||
/* skip ((cpu_type_t) 22 */
|
||||
|
||||
/*
|
||||
* Machine subtypes (these are defined here, instead of in a machine
|
||||
* dependent directory, so that any program can get all definitions
|
||||
* regardless of where is it compiled).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Capability bits used in the definition of cpu_subtype.
|
||||
*/
|
||||
#define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
|
||||
#define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
|
||||
#define CPU_SUBTYPE_PTRAUTH_ABI 0x80000000 /* pointer authentication with versioned ABI */
|
||||
|
||||
/*
|
||||
* When selecting a slice, ANY will pick the slice with the best
|
||||
* grading for the selected cpu_type_t, unlike the "ALL" subtypes,
|
||||
* which are the slices that can run on any hardware for that cpu type.
|
||||
*/
|
||||
#define CPU_SUBTYPE_ANY ((cpu_subtype_t) -1)
|
||||
|
||||
/*
|
||||
* Object files that are hand-crafted to run on any
|
||||
* implementation of an architecture are tagged with
|
||||
* CPU_SUBTYPE_MULTIPLE. This functions essentially the same as
|
||||
* the "ALL" subtype of an architecture except that it allows us
|
||||
* to easily find object files that may need to be modified
|
||||
* whenever a new implementation of an architecture comes out.
|
||||
*
|
||||
* It is the responsibility of the implementor to make sure the
|
||||
* software handles unsupported implementations elegantly.
|
||||
*/
|
||||
#define CPU_SUBTYPE_MULTIPLE ((cpu_subtype_t) -1)
|
||||
#define CPU_SUBTYPE_LITTLE_ENDIAN ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_BIG_ENDIAN ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* Machine threadtypes.
|
||||
* This is none - not defined - for most machine types/subtypes.
|
||||
*/
|
||||
#define CPU_THREADTYPE_NONE ((cpu_threadtype_t) 0)
|
||||
|
||||
/*
|
||||
* VAX subtypes (these do *not* necessary conform to the actual cpu
|
||||
* ID assigned by DEC available via the SID register).
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_VAX_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_VAX780 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_VAX785 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_VAX750 ((cpu_subtype_t) 3)
|
||||
#define CPU_SUBTYPE_VAX730 ((cpu_subtype_t) 4)
|
||||
#define CPU_SUBTYPE_UVAXI ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_UVAXII ((cpu_subtype_t) 6)
|
||||
#define CPU_SUBTYPE_VAX8200 ((cpu_subtype_t) 7)
|
||||
#define CPU_SUBTYPE_VAX8500 ((cpu_subtype_t) 8)
|
||||
#define CPU_SUBTYPE_VAX8600 ((cpu_subtype_t) 9)
|
||||
#define CPU_SUBTYPE_VAX8650 ((cpu_subtype_t) 10)
|
||||
#define CPU_SUBTYPE_VAX8800 ((cpu_subtype_t) 11)
|
||||
#define CPU_SUBTYPE_UVAXIII ((cpu_subtype_t) 12)
|
||||
|
||||
/*
|
||||
* 680x0 subtypes
|
||||
*
|
||||
* The subtype definitions here are unusual for historical reasons.
|
||||
* NeXT used to consider 68030 code as generic 68000 code. For
|
||||
* backwards compatability:
|
||||
*
|
||||
* CPU_SUBTYPE_MC68030 symbol has been preserved for source code
|
||||
* compatability.
|
||||
*
|
||||
* CPU_SUBTYPE_MC680x0_ALL has been defined to be the same
|
||||
* subtype as CPU_SUBTYPE_MC68030 for binary comatability.
|
||||
*
|
||||
* CPU_SUBTYPE_MC68030_ONLY has been added to allow new object
|
||||
* files to be tagged as containing 68030-specific instructions.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_MC680x0_ALL ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_MC68030 ((cpu_subtype_t) 1) /* compat */
|
||||
#define CPU_SUBTYPE_MC68040 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_MC68030_ONLY ((cpu_subtype_t) 3)
|
||||
|
||||
/*
|
||||
* I386 subtypes
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_INTEL(f, m) ((cpu_subtype_t) (f) + ((m) << 4))
|
||||
|
||||
#define CPU_SUBTYPE_I386_ALL CPU_SUBTYPE_INTEL(3, 0)
|
||||
#define CPU_SUBTYPE_386 CPU_SUBTYPE_INTEL(3, 0)
|
||||
#define CPU_SUBTYPE_486 CPU_SUBTYPE_INTEL(4, 0)
|
||||
#define CPU_SUBTYPE_486SX CPU_SUBTYPE_INTEL(4, 8) // 8 << 4 = 128
|
||||
#define CPU_SUBTYPE_586 CPU_SUBTYPE_INTEL(5, 0)
|
||||
#define CPU_SUBTYPE_PENT CPU_SUBTYPE_INTEL(5, 0)
|
||||
#define CPU_SUBTYPE_PENTPRO CPU_SUBTYPE_INTEL(6, 1)
|
||||
#define CPU_SUBTYPE_PENTII_M3 CPU_SUBTYPE_INTEL(6, 3)
|
||||
#define CPU_SUBTYPE_PENTII_M5 CPU_SUBTYPE_INTEL(6, 5)
|
||||
#define CPU_SUBTYPE_CELERON CPU_SUBTYPE_INTEL(7, 6)
|
||||
#define CPU_SUBTYPE_CELERON_MOBILE CPU_SUBTYPE_INTEL(7, 7)
|
||||
#define CPU_SUBTYPE_PENTIUM_3 CPU_SUBTYPE_INTEL(8, 0)
|
||||
#define CPU_SUBTYPE_PENTIUM_3_M CPU_SUBTYPE_INTEL(8, 1)
|
||||
#define CPU_SUBTYPE_PENTIUM_3_XEON CPU_SUBTYPE_INTEL(8, 2)
|
||||
#define CPU_SUBTYPE_PENTIUM_M CPU_SUBTYPE_INTEL(9, 0)
|
||||
#define CPU_SUBTYPE_PENTIUM_4 CPU_SUBTYPE_INTEL(10, 0)
|
||||
#define CPU_SUBTYPE_PENTIUM_4_M CPU_SUBTYPE_INTEL(10, 1)
|
||||
#define CPU_SUBTYPE_ITANIUM CPU_SUBTYPE_INTEL(11, 0)
|
||||
#define CPU_SUBTYPE_ITANIUM_2 CPU_SUBTYPE_INTEL(11, 1)
|
||||
#define CPU_SUBTYPE_XEON CPU_SUBTYPE_INTEL(12, 0)
|
||||
#define CPU_SUBTYPE_XEON_MP CPU_SUBTYPE_INTEL(12, 1)
|
||||
|
||||
#define CPU_SUBTYPE_INTEL_FAMILY(x) ((x) & 15)
|
||||
#define CPU_SUBTYPE_INTEL_FAMILY_MAX 15
|
||||
|
||||
#define CPU_SUBTYPE_INTEL_MODEL(x) ((x) >> 4)
|
||||
#define CPU_SUBTYPE_INTEL_MODEL_ALL 0
|
||||
|
||||
/*
|
||||
* X86 subtypes.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
|
||||
#define CPU_SUBTYPE_X86_64_ALL ((cpu_subtype_t)3)
|
||||
#define CPU_SUBTYPE_X86_ARCH1 ((cpu_subtype_t)4)
|
||||
#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell feature subset */
|
||||
|
||||
|
||||
#define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)
|
||||
|
||||
/*
|
||||
* Mips subtypes.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_MIPS_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_MIPS_R2300 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_MIPS_R2600 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_MIPS_R2800 ((cpu_subtype_t) 3)
|
||||
#define CPU_SUBTYPE_MIPS_R2000a ((cpu_subtype_t) 4) /* pmax */
|
||||
#define CPU_SUBTYPE_MIPS_R2000 ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_MIPS_R3000a ((cpu_subtype_t) 6) /* 3max */
|
||||
#define CPU_SUBTYPE_MIPS_R3000 ((cpu_subtype_t) 7)
|
||||
|
||||
/*
|
||||
* MC98000 (PowerPC) subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_MC98000_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_MC98601 ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* HPPA subtypes for Hewlett-Packard HP-PA family of
|
||||
* risc processors. Port by NeXT to 700 series.
|
||||
*/
|
||||
|
||||
#define CPU_SUBTYPE_HPPA_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_HPPA_7100 ((cpu_subtype_t) 0) /* compat */
|
||||
#define CPU_SUBTYPE_HPPA_7100LC ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* MC88000 subtypes.
|
||||
*/
|
||||
#define CPU_SUBTYPE_MC88000_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_MC88100 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_MC88110 ((cpu_subtype_t) 2)
|
||||
|
||||
/*
|
||||
* SPARC subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_SPARC_ALL ((cpu_subtype_t) 0)
|
||||
|
||||
/*
|
||||
* I860 subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_I860_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_I860_860 ((cpu_subtype_t) 1)
|
||||
|
||||
/*
|
||||
* PowerPC subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_POWERPC_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_POWERPC_601 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_POWERPC_602 ((cpu_subtype_t) 2)
|
||||
#define CPU_SUBTYPE_POWERPC_603 ((cpu_subtype_t) 3)
|
||||
#define CPU_SUBTYPE_POWERPC_603e ((cpu_subtype_t) 4)
|
||||
#define CPU_SUBTYPE_POWERPC_603ev ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_POWERPC_604 ((cpu_subtype_t) 6)
|
||||
#define CPU_SUBTYPE_POWERPC_604e ((cpu_subtype_t) 7)
|
||||
#define CPU_SUBTYPE_POWERPC_620 ((cpu_subtype_t) 8)
|
||||
#define CPU_SUBTYPE_POWERPC_750 ((cpu_subtype_t) 9)
|
||||
#define CPU_SUBTYPE_POWERPC_7400 ((cpu_subtype_t) 10)
|
||||
#define CPU_SUBTYPE_POWERPC_7450 ((cpu_subtype_t) 11)
|
||||
#define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100)
|
||||
|
||||
/*
|
||||
* ARM subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_ARM_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_ARM_V4T ((cpu_subtype_t) 5)
|
||||
#define CPU_SUBTYPE_ARM_V6 ((cpu_subtype_t) 6)
|
||||
#define CPU_SUBTYPE_ARM_V5TEJ ((cpu_subtype_t) 7)
|
||||
#define CPU_SUBTYPE_ARM_XSCALE ((cpu_subtype_t) 8)
|
||||
#define CPU_SUBTYPE_ARM_V7 ((cpu_subtype_t) 9) /* ARMv7-A and ARMv7-R */
|
||||
#define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) /* Cortex A9 */
|
||||
#define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t) 11) /* Swift */
|
||||
#define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12)
|
||||
#define CPU_SUBTYPE_ARM_V8 ((cpu_subtype_t) 13)
|
||||
#define CPU_SUBTYPE_ARM_V6M ((cpu_subtype_t) 14) /* Not meant to be run under xnu */
|
||||
#define CPU_SUBTYPE_ARM_V7M ((cpu_subtype_t) 15) /* Not meant to be run under xnu */
|
||||
#define CPU_SUBTYPE_ARM_V7EM ((cpu_subtype_t) 16) /* Not meant to be run under xnu */
|
||||
#define CPU_SUBTYPE_ARM_V8M ((cpu_subtype_t) 17) /* Not meant to be run under xnu */
|
||||
|
||||
/*
|
||||
* ARM64 subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_ARM64_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_ARM64_V8 ((cpu_subtype_t) 1)
|
||||
#define CPU_SUBTYPE_ARM64E ((cpu_subtype_t) 2)
|
||||
|
||||
/* CPU subtype feature flags for ptrauth on arm64e platforms */
|
||||
#define CPU_SUBTYPE_ARM64_PTR_AUTH_MASK 0x0f000000
|
||||
#define CPU_SUBTYPE_ARM64_PTR_AUTH_VERSION(x) (((x) & CPU_SUBTYPE_ARM64_PTR_AUTH_MASK) >> 24)
|
||||
|
||||
/*
|
||||
* ARM64_32 subtypes
|
||||
*/
|
||||
#define CPU_SUBTYPE_ARM64_32_ALL ((cpu_subtype_t) 0)
|
||||
#define CPU_SUBTYPE_ARM64_32_V8 ((cpu_subtype_t) 1)
|
||||
|
||||
#endif /* !__ASSEMBLER__ */
|
||||
|
||||
/*
|
||||
* CPU families (sysctl hw.cpufamily)
|
||||
*
|
||||
* These are meant to identify the CPU's marketing name - an
|
||||
* application can map these to (possibly) localized strings.
|
||||
* NB: the encodings of the CPU families are intentionally arbitrary.
|
||||
* There is no ordering, and you should never try to deduce whether
|
||||
* or not some feature is available based on the family.
|
||||
* Use feature flags (eg, hw.optional.altivec) to test for optional
|
||||
* functionality.
|
||||
*/
|
||||
#define CPUFAMILY_UNKNOWN 0
|
||||
#define CPUFAMILY_POWERPC_G3 0xcee41549
|
||||
#define CPUFAMILY_POWERPC_G4 0x77c184ae
|
||||
#define CPUFAMILY_POWERPC_G5 0xed76d8aa
|
||||
#define CPUFAMILY_INTEL_6_13 0xaa33392b
|
||||
#define CPUFAMILY_INTEL_PENRYN 0x78ea4fbc
|
||||
#define CPUFAMILY_INTEL_NEHALEM 0x6b5a4cd2
|
||||
#define CPUFAMILY_INTEL_WESTMERE 0x573b5eec
|
||||
#define CPUFAMILY_INTEL_SANDYBRIDGE 0x5490b78c
|
||||
#define CPUFAMILY_INTEL_IVYBRIDGE 0x1f65e835
|
||||
#define CPUFAMILY_INTEL_HASWELL 0x10b282dc
|
||||
#define CPUFAMILY_INTEL_BROADWELL 0x582ed09c
|
||||
#define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f
|
||||
#define CPUFAMILY_INTEL_KABYLAKE 0x0f817246
|
||||
#define CPUFAMILY_INTEL_ICELAKE 0x38435547
|
||||
#if !defined(RC_HIDE_XNU_COMETLAKE)
|
||||
#define CPUFAMILY_INTEL_COMETLAKE 0x1cf8a03e
|
||||
#endif /* not RC_HIDE_XNU_COMETLAKE */
|
||||
#define CPUFAMILY_ARM_9 0xe73283ae
|
||||
#define CPUFAMILY_ARM_11 0x8ff620d8
|
||||
#define CPUFAMILY_ARM_XSCALE 0x53b005f5
|
||||
#define CPUFAMILY_ARM_12 0xbd1b0ae9
|
||||
#define CPUFAMILY_ARM_13 0x0cc90e64
|
||||
#define CPUFAMILY_ARM_14 0x96077ef1
|
||||
#define CPUFAMILY_ARM_15 0xa8511bca
|
||||
#define CPUFAMILY_ARM_SWIFT 0x1e2d6381
|
||||
#define CPUFAMILY_ARM_CYCLONE 0x37a09642
|
||||
#define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
|
||||
#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
|
||||
#define CPUFAMILY_ARM_HURRICANE 0x67ceee93
|
||||
#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
|
||||
#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
|
||||
#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
|
||||
#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
|
||||
|
||||
#define CPUSUBFAMILY_UNKNOWN 0
|
||||
#define CPUSUBFAMILY_ARM_HP 1
|
||||
#define CPUSUBFAMILY_ARM_HG 2
|
||||
#define CPUSUBFAMILY_ARM_M 3
|
||||
#define CPUSUBFAMILY_ARM_HS 4
|
||||
#define CPUSUBFAMILY_ARM_HC_HD 5
|
||||
|
||||
/* The following synonyms are deprecated: */
|
||||
#define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN
|
||||
#define CPUFAMILY_INTEL_6_26 CPUFAMILY_INTEL_NEHALEM
|
||||
|
||||
|
||||
#endif /* _MACH_MACHINE_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/_structs.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/_structs.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2017 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 _MACH_MACHINE__STRUCTS_H_
|
||||
#define _MACH_MACHINE__STRUCTS_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/_structs.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/_structs.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE__STRUCTS_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/boolean.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/boolean.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _MACH_MACHINE_BOOLEAN_H_
|
||||
#define _MACH_MACHINE_BOOLEAN_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/boolean.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/boolean.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_BOOLEAN_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/exception.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/exception.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _MACH_MACHINE_EXCEPTION_H_
|
||||
#define _MACH_MACHINE_EXCEPTION_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/exception.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/exception.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_EXCEPTION_H_ */
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _MACH_MACHINE_KERN_RETURN_H_
|
||||
#define _MACH_MACHINE_KERN_RETURN_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/kern_return.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/kern_return.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_KERN_RETURN_H_ */
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _MACH_MACHINE_PROCESSOR_INFO_H_
|
||||
#define _MACH_MACHINE_PROCESSOR_INFO_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/processor_info.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/processor_info.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_PROCESSOR_INFO_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/rpc.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/rpc.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _MACH_MACHINE_RPC_H_
|
||||
#define _MACH_MACHINE_RPC_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/rpc.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/rpc.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_RPC_H_ */
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _MACH_MACHINE_THREAD_STATE_H_
|
||||
#define _MACH_MACHINE_THREAD_STATE_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/thread_state.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/thread_state.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_THREAD_STATE_H_ */
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _MACH_MACHINE_THREAD_STATUS_H_
|
||||
#define _MACH_MACHINE_THREAD_STATUS_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/thread_status.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/thread_status.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_THREAD_STATUS_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/vm_param.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/vm_param.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _MACH_MACHINE_VM_PARAM_H_
|
||||
#define _MACH_MACHINE_VM_PARAM_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/vm_param.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/vm_param.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_VM_PARAM_H_ */
|
||||
40
lib/libc/include/aarch64-macos-gnu/mach/machine/vm_types.h
Normal file
40
lib/libc/include/aarch64-macos-gnu/mach/machine/vm_types.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _MACH_MACHINE_VM_TYPES_H_
|
||||
#define _MACH_MACHINE_VM_TYPES_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "mach/i386/vm_types.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "mach/arm/vm_types.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHINE_VM_TYPES_H_ */
|
||||
908
lib/libc/include/aarch64-macos-gnu/mach/message.h
Normal file
908
lib/libc/include/aarch64-macos-gnu/mach/message.h
Normal file
@ -0,0 +1,908 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2005 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* NOTICE: This file was modified by McAfee Research in 2004 to introduce
|
||||
* support for mandatory and extensible security protections. This notice
|
||||
* is included in support of clause 2.2 (b) of the Apple Public License,
|
||||
* Version 2.0.
|
||||
* Copyright (c) 2005 SPARTA, Inc.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/message.h
|
||||
*
|
||||
* Mach IPC message and primitive function definitions.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_MESSAGE_H_
|
||||
#define _MACH_MESSAGE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <mach/port.h>
|
||||
#include <mach/boolean.h>
|
||||
#include <mach/kern_return.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <Availability.h>
|
||||
|
||||
/*
|
||||
* The timeout mechanism uses mach_msg_timeout_t values,
|
||||
* passed by value. The timeout units are milliseconds.
|
||||
* It is controlled with the MACH_SEND_TIMEOUT
|
||||
* and MACH_RCV_TIMEOUT options.
|
||||
*/
|
||||
|
||||
typedef natural_t mach_msg_timeout_t;
|
||||
|
||||
/*
|
||||
* The value to be used when there is no timeout.
|
||||
* (No MACH_SEND_TIMEOUT/MACH_RCV_TIMEOUT option.)
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TIMEOUT_NONE ((mach_msg_timeout_t) 0)
|
||||
|
||||
/*
|
||||
* The kernel uses MACH_MSGH_BITS_COMPLEX as a hint. If it isn't on, it
|
||||
* assumes the body of the message doesn't contain port rights or OOL
|
||||
* data. The field is set in received messages. A user task must
|
||||
* use caution in interpreting the body of a message if the bit isn't
|
||||
* on, because the mach_msg_type's in the body might "lie" about the
|
||||
* contents. If the bit isn't on, but the mach_msg_types
|
||||
* in the body specify rights or OOL data, the behavior is undefined.
|
||||
* (Ie, an error may or may not be produced.)
|
||||
*
|
||||
* The value of MACH_MSGH_BITS_REMOTE determines the interpretation
|
||||
* of the msgh_remote_port field. It is handled like a msgt_name,
|
||||
* but must result in a send or send-once type right.
|
||||
*
|
||||
* The value of MACH_MSGH_BITS_LOCAL determines the interpretation
|
||||
* of the msgh_local_port field. It is handled like a msgt_name,
|
||||
* and also must result in a send or send-once type right.
|
||||
*
|
||||
* The value of MACH_MSGH_BITS_VOUCHER determines the interpretation
|
||||
* of the msgh_voucher_port field. It is handled like a msgt_name,
|
||||
* but must result in a send right (and the msgh_voucher_port field
|
||||
* must be the name of a send right to a Mach voucher kernel object.
|
||||
*
|
||||
* MACH_MSGH_BITS() combines two MACH_MSG_TYPE_* values, for the remote
|
||||
* and local fields, into a single value suitable for msgh_bits.
|
||||
*
|
||||
* MACH_MSGH_BITS_CIRCULAR should be zero; is is used internally.
|
||||
*
|
||||
* The unused bits should be zero and are reserved for the kernel
|
||||
* or for future interface expansion.
|
||||
*/
|
||||
|
||||
#define MACH_MSGH_BITS_ZERO 0x00000000
|
||||
|
||||
#define MACH_MSGH_BITS_REMOTE_MASK 0x0000001f
|
||||
#define MACH_MSGH_BITS_LOCAL_MASK 0x00001f00
|
||||
#define MACH_MSGH_BITS_VOUCHER_MASK 0x001f0000
|
||||
|
||||
#define MACH_MSGH_BITS_PORTS_MASK \
|
||||
(MACH_MSGH_BITS_REMOTE_MASK | \
|
||||
MACH_MSGH_BITS_LOCAL_MASK | \
|
||||
MACH_MSGH_BITS_VOUCHER_MASK)
|
||||
|
||||
#define MACH_MSGH_BITS_COMPLEX 0x80000000U /* message is complex */
|
||||
|
||||
#define MACH_MSGH_BITS_USER 0x801f1f1fU /* allowed bits user->kernel */
|
||||
|
||||
#define MACH_MSGH_BITS_RAISEIMP 0x20000000U /* importance raised due to msg */
|
||||
#define MACH_MSGH_BITS_DENAP MACH_MSGH_BITS_RAISEIMP
|
||||
|
||||
#define MACH_MSGH_BITS_IMPHOLDASRT 0x10000000U /* assertion help, userland private */
|
||||
#define MACH_MSGH_BITS_DENAPHOLDASRT MACH_MSGH_BITS_IMPHOLDASRT
|
||||
|
||||
#define MACH_MSGH_BITS_CIRCULAR 0x10000000U /* message circular, kernel private */
|
||||
|
||||
#define MACH_MSGH_BITS_USED 0xb01f1f1fU
|
||||
|
||||
/* setter macros for the bits */
|
||||
#define MACH_MSGH_BITS(remote, local) /* legacy */ \
|
||||
((remote) | ((local) << 8))
|
||||
#define MACH_MSGH_BITS_SET_PORTS(remote, local, voucher) \
|
||||
(((remote) & MACH_MSGH_BITS_REMOTE_MASK) | \
|
||||
(((local) << 8) & MACH_MSGH_BITS_LOCAL_MASK) | \
|
||||
(((voucher) << 16) & MACH_MSGH_BITS_VOUCHER_MASK))
|
||||
#define MACH_MSGH_BITS_SET(remote, local, voucher, other) \
|
||||
(MACH_MSGH_BITS_SET_PORTS((remote), (local), (voucher)) \
|
||||
| ((other) &~ MACH_MSGH_BITS_PORTS_MASK))
|
||||
|
||||
/* getter macros for pulling values out of the bits field */
|
||||
#define MACH_MSGH_BITS_REMOTE(bits) \
|
||||
((bits) & MACH_MSGH_BITS_REMOTE_MASK)
|
||||
#define MACH_MSGH_BITS_LOCAL(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_LOCAL_MASK) >> 8)
|
||||
#define MACH_MSGH_BITS_VOUCHER(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_VOUCHER_MASK) >> 16)
|
||||
#define MACH_MSGH_BITS_PORTS(bits) \
|
||||
((bits) & MACH_MSGH_BITS_PORTS_MASK)
|
||||
#define MACH_MSGH_BITS_OTHER(bits) \
|
||||
((bits) &~ MACH_MSGH_BITS_PORTS_MASK)
|
||||
|
||||
/* checking macros */
|
||||
#define MACH_MSGH_BITS_HAS_REMOTE(bits) \
|
||||
(MACH_MSGH_BITS_REMOTE(bits) != MACH_MSGH_BITS_ZERO)
|
||||
#define MACH_MSGH_BITS_HAS_LOCAL(bits) \
|
||||
(MACH_MSGH_BITS_LOCAL(bits) != MACH_MSGH_BITS_ZERO)
|
||||
#define MACH_MSGH_BITS_HAS_VOUCHER(bits) \
|
||||
(MACH_MSGH_BITS_VOUCHER(bits) != MACH_MSGH_BITS_ZERO)
|
||||
#define MACH_MSGH_BITS_IS_COMPLEX(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_COMPLEX) != MACH_MSGH_BITS_ZERO)
|
||||
|
||||
/* importance checking macros */
|
||||
#define MACH_MSGH_BITS_RAISED_IMPORTANCE(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_RAISEIMP) != MACH_MSGH_BITS_ZERO)
|
||||
#define MACH_MSGH_BITS_HOLDS_IMPORTANCE_ASSERTION(bits) \
|
||||
(((bits) & MACH_MSGH_BITS_IMPHOLDASRT) != MACH_MSGH_BITS_ZERO)
|
||||
|
||||
/*
|
||||
* Every message starts with a message header.
|
||||
* Following the message header, if the message is complex, are a count
|
||||
* of type descriptors and the type descriptors themselves
|
||||
* (mach_msg_descriptor_t). The size of the message must be specified in
|
||||
* bytes, and includes the message header, descriptor count, descriptors,
|
||||
* and inline data.
|
||||
*
|
||||
* The msgh_remote_port field specifies the destination of the message.
|
||||
* It must specify a valid send or send-once right for a port.
|
||||
*
|
||||
* The msgh_local_port field specifies a "reply port". Normally,
|
||||
* This field carries a send-once right that the receiver will use
|
||||
* to reply to the message. It may carry the values MACH_PORT_NULL,
|
||||
* MACH_PORT_DEAD, a send-once right, or a send right.
|
||||
*
|
||||
* The msgh_voucher_port field specifies a Mach voucher port. Only
|
||||
* send rights to kernel-implemented Mach Voucher kernel objects in
|
||||
* addition to MACH_PORT_NULL or MACH_PORT_DEAD may be passed.
|
||||
*
|
||||
* The msgh_id field is uninterpreted by the message primitives.
|
||||
* It normally carries information specifying the format
|
||||
* or meaning of the message.
|
||||
*/
|
||||
|
||||
typedef unsigned int mach_msg_bits_t;
|
||||
typedef natural_t mach_msg_size_t;
|
||||
typedef integer_t mach_msg_id_t;
|
||||
|
||||
#define MACH_MSG_SIZE_NULL (mach_msg_size_t *) 0
|
||||
|
||||
typedef unsigned int mach_msg_priority_t;
|
||||
|
||||
#define MACH_MSG_PRIORITY_UNSPECIFIED (mach_msg_priority_t) 0
|
||||
|
||||
|
||||
typedef unsigned int mach_msg_type_name_t;
|
||||
|
||||
#define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive right */
|
||||
#define MACH_MSG_TYPE_MOVE_SEND 17 /* Must hold send right(s) */
|
||||
#define MACH_MSG_TYPE_MOVE_SEND_ONCE 18 /* Must hold sendonce right */
|
||||
#define MACH_MSG_TYPE_COPY_SEND 19 /* Must hold send right(s) */
|
||||
#define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */
|
||||
#define MACH_MSG_TYPE_MAKE_SEND_ONCE 21 /* Must hold receive right */
|
||||
#define MACH_MSG_TYPE_COPY_RECEIVE 22 /* NOT VALID */
|
||||
#define MACH_MSG_TYPE_DISPOSE_RECEIVE 24 /* must hold receive right */
|
||||
#define MACH_MSG_TYPE_DISPOSE_SEND 25 /* must hold send right(s) */
|
||||
#define MACH_MSG_TYPE_DISPOSE_SEND_ONCE 26 /* must hold sendonce right */
|
||||
|
||||
typedef unsigned int mach_msg_copy_options_t;
|
||||
|
||||
#define MACH_MSG_PHYSICAL_COPY 0
|
||||
#define MACH_MSG_VIRTUAL_COPY 1
|
||||
#define MACH_MSG_ALLOCATE 2
|
||||
#define MACH_MSG_OVERWRITE 3 /* deprecated */
|
||||
#ifdef MACH_KERNEL
|
||||
#define MACH_MSG_KALLOC_COPY_T 4
|
||||
#endif /* MACH_KERNEL */
|
||||
|
||||
#define MACH_MSG_GUARD_FLAGS_NONE 0x0000
|
||||
#define MACH_MSG_GUARD_FLAGS_IMMOVABLE_RECEIVE 0x0001 /* Move the receive right and mark it as immovable */
|
||||
#define MACH_MSG_GUARD_FLAGS_UNGUARDED_ON_SEND 0x0002 /* Verify that the port is unguarded */
|
||||
#define MACH_MSG_GUARD_FLAGS_MASK 0x0003 /* Valid flag bits */
|
||||
typedef unsigned int mach_msg_guard_flags_t;
|
||||
|
||||
/*
|
||||
* In a complex mach message, the mach_msg_header_t is followed by
|
||||
* a descriptor count, then an array of that number of descriptors
|
||||
* (mach_msg_*_descriptor_t). The type field of mach_msg_type_descriptor_t
|
||||
* (which any descriptor can be cast to) indicates the flavor of the
|
||||
* descriptor.
|
||||
*
|
||||
* Note that in LP64, the various types of descriptors are no longer all
|
||||
* the same size as mach_msg_descriptor_t, so the array cannot be indexed
|
||||
* as expected.
|
||||
*/
|
||||
|
||||
typedef unsigned int mach_msg_descriptor_type_t;
|
||||
|
||||
#define MACH_MSG_PORT_DESCRIPTOR 0
|
||||
#define MACH_MSG_OOL_DESCRIPTOR 1
|
||||
#define MACH_MSG_OOL_PORTS_DESCRIPTOR 2
|
||||
#define MACH_MSG_OOL_VOLATILE_DESCRIPTOR 3
|
||||
#define MACH_MSG_GUARDED_PORT_DESCRIPTOR 4
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
typedef struct{
|
||||
natural_t pad1;
|
||||
mach_msg_size_t pad2;
|
||||
unsigned int pad3 : 24;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
} mach_msg_type_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
mach_port_t name;
|
||||
// Pad to 8 bytes everywhere except the K64 kernel where mach_port_t is 8 bytes
|
||||
mach_msg_size_t pad1;
|
||||
unsigned int pad2 : 16;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
} mach_msg_port_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
uint32_t address;
|
||||
mach_msg_size_t size;
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
unsigned int pad1: 8;
|
||||
mach_msg_descriptor_type_t type: 8;
|
||||
} mach_msg_ool_descriptor32_t;
|
||||
|
||||
typedef struct{
|
||||
uint64_t address;
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
unsigned int pad1: 8;
|
||||
mach_msg_descriptor_type_t type: 8;
|
||||
mach_msg_size_t size;
|
||||
} mach_msg_ool_descriptor64_t;
|
||||
|
||||
typedef struct{
|
||||
void* address;
|
||||
#if !defined(__LP64__)
|
||||
mach_msg_size_t size;
|
||||
#endif
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
unsigned int pad1: 8;
|
||||
mach_msg_descriptor_type_t type: 8;
|
||||
#if defined(__LP64__)
|
||||
mach_msg_size_t size;
|
||||
#endif
|
||||
} mach_msg_ool_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
uint32_t address;
|
||||
mach_msg_size_t count;
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
} mach_msg_ool_ports_descriptor32_t;
|
||||
|
||||
typedef struct{
|
||||
uint64_t address;
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
mach_msg_size_t count;
|
||||
} mach_msg_ool_ports_descriptor64_t;
|
||||
|
||||
typedef struct{
|
||||
void* address;
|
||||
#if !defined(__LP64__)
|
||||
mach_msg_size_t count;
|
||||
#endif
|
||||
boolean_t deallocate: 8;
|
||||
mach_msg_copy_options_t copy: 8;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
#if defined(__LP64__)
|
||||
mach_msg_size_t count;
|
||||
#endif
|
||||
} mach_msg_ool_ports_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
uint32_t context;
|
||||
mach_port_name_t name;
|
||||
mach_msg_guard_flags_t flags : 16;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
} mach_msg_guarded_port_descriptor32_t;
|
||||
|
||||
typedef struct{
|
||||
uint64_t context;
|
||||
mach_msg_guard_flags_t flags : 16;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
mach_port_name_t name;
|
||||
} mach_msg_guarded_port_descriptor64_t;
|
||||
|
||||
typedef struct{
|
||||
mach_port_context_t context;
|
||||
#if !defined(__LP64__)
|
||||
mach_port_name_t name;
|
||||
#endif
|
||||
mach_msg_guard_flags_t flags : 16;
|
||||
mach_msg_type_name_t disposition : 8;
|
||||
mach_msg_descriptor_type_t type : 8;
|
||||
#if defined(__LP64__)
|
||||
mach_port_name_t name;
|
||||
#endif /* defined(__LP64__) */
|
||||
} mach_msg_guarded_port_descriptor_t;
|
||||
|
||||
/*
|
||||
* LP64support - This union definition is not really
|
||||
* appropriate in LP64 mode because not all descriptors
|
||||
* are of the same size in that environment.
|
||||
*/
|
||||
typedef union{
|
||||
mach_msg_port_descriptor_t port;
|
||||
mach_msg_ool_descriptor_t out_of_line;
|
||||
mach_msg_ool_ports_descriptor_t ool_ports;
|
||||
mach_msg_type_descriptor_t type;
|
||||
mach_msg_guarded_port_descriptor_t guarded_port;
|
||||
} mach_msg_descriptor_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_size_t msgh_descriptor_count;
|
||||
} mach_msg_body_t;
|
||||
|
||||
#define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0
|
||||
#define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0
|
||||
|
||||
typedef struct{
|
||||
mach_msg_bits_t msgh_bits;
|
||||
mach_msg_size_t msgh_size;
|
||||
mach_port_t msgh_remote_port;
|
||||
mach_port_t msgh_local_port;
|
||||
mach_port_name_t msgh_voucher_port;
|
||||
mach_msg_id_t msgh_id;
|
||||
} mach_msg_header_t;
|
||||
|
||||
#define msgh_reserved msgh_voucher_port
|
||||
#define MACH_MSG_NULL (mach_msg_header_t *) 0
|
||||
|
||||
typedef struct{
|
||||
mach_msg_header_t header;
|
||||
mach_msg_body_t body;
|
||||
} mach_msg_base_t;
|
||||
|
||||
typedef unsigned int mach_msg_trailer_type_t;
|
||||
|
||||
#define MACH_MSG_TRAILER_FORMAT_0 0
|
||||
|
||||
typedef unsigned int mach_msg_trailer_size_t;
|
||||
typedef char *mach_msg_trailer_info_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
} mach_msg_trailer_t;
|
||||
|
||||
/*
|
||||
* The msgh_seqno field carries a sequence number
|
||||
* associated with the received-from port. A port's
|
||||
* sequence number is incremented every time a message
|
||||
* is received from it and included in the received
|
||||
* trailer to help put messages back in sequence if
|
||||
* multiple threads receive and/or process received
|
||||
* messages.
|
||||
*/
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
} mach_msg_seqno_trailer_t;
|
||||
|
||||
typedef struct{
|
||||
unsigned int val[2];
|
||||
} security_token_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
security_token_t msgh_sender;
|
||||
} mach_msg_security_trailer_t;
|
||||
|
||||
/*
|
||||
* The audit token is an opaque token which identifies
|
||||
* Mach tasks and senders of Mach messages as subjects
|
||||
* to the BSM audit system. Only the appropriate BSM
|
||||
* library routines should be used to interpret the
|
||||
* contents of the audit token as the representation
|
||||
* of the subject identity within the token may change
|
||||
* over time.
|
||||
*/
|
||||
typedef struct{
|
||||
unsigned int val[8];
|
||||
} audit_token_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
security_token_t msgh_sender;
|
||||
audit_token_t msgh_audit;
|
||||
} mach_msg_audit_trailer_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
security_token_t msgh_sender;
|
||||
audit_token_t msgh_audit;
|
||||
mach_port_context_t msgh_context;
|
||||
} mach_msg_context_trailer_t;
|
||||
|
||||
|
||||
|
||||
typedef struct{
|
||||
mach_port_name_t sender;
|
||||
} msg_labels_t;
|
||||
|
||||
typedef int mach_msg_filter_id;
|
||||
#define MACH_MSG_FILTER_POLICY_ALLOW (mach_msg_filter_id)0
|
||||
|
||||
/*
|
||||
* Trailer type to pass MAC policy label info as a mach message trailer.
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct{
|
||||
mach_msg_trailer_type_t msgh_trailer_type;
|
||||
mach_msg_trailer_size_t msgh_trailer_size;
|
||||
mach_port_seqno_t msgh_seqno;
|
||||
security_token_t msgh_sender;
|
||||
audit_token_t msgh_audit;
|
||||
mach_port_context_t msgh_context;
|
||||
mach_msg_filter_id msgh_ad;
|
||||
msg_labels_t msgh_labels;
|
||||
} mach_msg_mac_trailer_t;
|
||||
|
||||
|
||||
#define MACH_MSG_TRAILER_MINIMUM_SIZE sizeof(mach_msg_trailer_t)
|
||||
|
||||
/*
|
||||
* These values can change from release to release - but clearly
|
||||
* code cannot request additional trailer elements one was not
|
||||
* compiled to understand. Therefore, it is safe to use this
|
||||
* constant when the same module specified the receive options.
|
||||
* Otherwise, you run the risk that the options requested by
|
||||
* another module may exceed the local modules notion of
|
||||
* MAX_TRAILER_SIZE.
|
||||
*/
|
||||
|
||||
typedef mach_msg_mac_trailer_t mach_msg_max_trailer_t;
|
||||
#define MAX_TRAILER_SIZE ((mach_msg_size_t)sizeof(mach_msg_max_trailer_t))
|
||||
|
||||
/*
|
||||
* Legacy requirements keep us from ever updating these defines (even
|
||||
* when the format_0 trailers gain new option data fields in the future).
|
||||
* Therefore, they shouldn't be used going forward. Instead, the sizes
|
||||
* should be compared against the specific element size requested using
|
||||
* REQUESTED_TRAILER_SIZE.
|
||||
*/
|
||||
typedef mach_msg_security_trailer_t mach_msg_format_0_trailer_t;
|
||||
|
||||
/*typedef mach_msg_mac_trailer_t mach_msg_format_0_trailer_t;
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TRAILER_FORMAT_0_SIZE sizeof(mach_msg_format_0_trailer_t)
|
||||
|
||||
#define KERNEL_SECURITY_TOKEN_VALUE { {0, 1} }
|
||||
extern const security_token_t KERNEL_SECURITY_TOKEN;
|
||||
|
||||
#define KERNEL_AUDIT_TOKEN_VALUE { {0, 0, 0, 0, 0, 0, 0, 0} }
|
||||
extern const audit_token_t KERNEL_AUDIT_TOKEN;
|
||||
|
||||
typedef integer_t mach_msg_options_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_header_t header;
|
||||
} mach_msg_empty_send_t;
|
||||
|
||||
typedef struct{
|
||||
mach_msg_header_t header;
|
||||
mach_msg_trailer_t trailer;
|
||||
} mach_msg_empty_rcv_t;
|
||||
|
||||
typedef union{
|
||||
mach_msg_empty_send_t send;
|
||||
mach_msg_empty_rcv_t rcv;
|
||||
} mach_msg_empty_t;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* utility to round the message size - will become machine dependent */
|
||||
#define round_msg(x) (((mach_msg_size_t)(x) + sizeof (natural_t) - 1) & \
|
||||
~(sizeof (natural_t) - 1))
|
||||
|
||||
|
||||
/*
|
||||
* There is no fixed upper bound to the size of Mach messages.
|
||||
*/
|
||||
#define MACH_MSG_SIZE_MAX ((mach_msg_size_t) ~0)
|
||||
|
||||
#if defined(__APPLE_API_PRIVATE)
|
||||
/*
|
||||
* But architectural limits of a given implementation, or
|
||||
* temporal conditions may cause unpredictable send failures
|
||||
* for messages larger than MACH_MSG_SIZE_RELIABLE.
|
||||
*
|
||||
* In either case, waiting for memory is [currently] outside
|
||||
* the scope of send timeout values provided to IPC.
|
||||
*/
|
||||
#define MACH_MSG_SIZE_RELIABLE ((mach_msg_size_t) 256 * 1024)
|
||||
#endif
|
||||
/*
|
||||
* Compatibility definitions, for code written
|
||||
* when there was a msgh_kind instead of msgh_seqno.
|
||||
*/
|
||||
#define MACH_MSGH_KIND_NORMAL 0x00000000
|
||||
#define MACH_MSGH_KIND_NOTIFICATION 0x00000001
|
||||
#define msgh_kind msgh_seqno
|
||||
#define mach_msg_kind_t mach_port_seqno_t
|
||||
|
||||
typedef natural_t mach_msg_type_size_t;
|
||||
typedef natural_t mach_msg_type_number_t;
|
||||
|
||||
/*
|
||||
* Values received/carried in messages. Tells the receiver what
|
||||
* sort of port right he now has.
|
||||
*
|
||||
* MACH_MSG_TYPE_PORT_NAME is used to transfer a port name
|
||||
* which should remain uninterpreted by the kernel. (Port rights
|
||||
* are not transferred, just the port name.)
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_NONE 0
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_NAME 15
|
||||
#define MACH_MSG_TYPE_PORT_RECEIVE MACH_MSG_TYPE_MOVE_RECEIVE
|
||||
#define MACH_MSG_TYPE_PORT_SEND MACH_MSG_TYPE_MOVE_SEND
|
||||
#define MACH_MSG_TYPE_PORT_SEND_ONCE MACH_MSG_TYPE_MOVE_SEND_ONCE
|
||||
|
||||
#define MACH_MSG_TYPE_LAST 22 /* Last assigned */
|
||||
|
||||
/*
|
||||
* A dummy value. Mostly used to indicate that the actual value
|
||||
* will be filled in later, dynamically.
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TYPE_POLYMORPHIC ((mach_msg_type_name_t) -1)
|
||||
|
||||
/*
|
||||
* Is a given item a port type?
|
||||
*/
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_ANY(x) \
|
||||
(((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
|
||||
((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_ANY_SEND(x) \
|
||||
(((x) >= MACH_MSG_TYPE_MOVE_SEND) && \
|
||||
((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
|
||||
|
||||
#define MACH_MSG_TYPE_PORT_ANY_RIGHT(x) \
|
||||
(((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
|
||||
((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE))
|
||||
|
||||
typedef integer_t mach_msg_option_t;
|
||||
|
||||
#define MACH_MSG_OPTION_NONE 0x00000000
|
||||
|
||||
#define MACH_SEND_MSG 0x00000001
|
||||
#define MACH_RCV_MSG 0x00000002
|
||||
|
||||
#define MACH_RCV_LARGE 0x00000004 /* report large message sizes */
|
||||
#define MACH_RCV_LARGE_IDENTITY 0x00000008 /* identify source of large messages */
|
||||
|
||||
#define MACH_SEND_TIMEOUT 0x00000010 /* timeout value applies to send */
|
||||
#define MACH_SEND_OVERRIDE 0x00000020 /* priority override for send */
|
||||
#define MACH_SEND_INTERRUPT 0x00000040 /* don't restart interrupted sends */
|
||||
#define MACH_SEND_NOTIFY 0x00000080 /* arm send-possible notify */
|
||||
#define MACH_SEND_ALWAYS 0x00010000 /* ignore qlimits - kernel only */
|
||||
#define MACH_SEND_TRAILER 0x00020000 /* sender-provided trailer */
|
||||
#define MACH_SEND_NOIMPORTANCE 0x00040000 /* msg won't carry importance */
|
||||
#define MACH_SEND_NODENAP MACH_SEND_NOIMPORTANCE
|
||||
#define MACH_SEND_IMPORTANCE 0x00080000 /* msg carries importance - kernel only */
|
||||
#define MACH_SEND_SYNC_OVERRIDE 0x00100000 /* msg should do sync ipc override */
|
||||
#define MACH_SEND_PROPAGATE_QOS 0x00200000 /* IPC should propagate the caller's QoS */
|
||||
#define MACH_SEND_SYNC_USE_THRPRI MACH_SEND_PROPAGATE_QOS /* obsolete name */
|
||||
#define MACH_SEND_KERNEL 0x00400000 /* full send from kernel space - kernel only */
|
||||
#define MACH_SEND_SYNC_BOOTSTRAP_CHECKIN 0x00800000 /* special reply port should boost thread doing sync bootstrap checkin */
|
||||
|
||||
#define MACH_RCV_TIMEOUT 0x00000100 /* timeout value applies to receive */
|
||||
#define MACH_RCV_NOTIFY 0x00000000 /* legacy name (value was: 0x00000200) */
|
||||
#define MACH_RCV_INTERRUPT 0x00000400 /* don't restart interrupted receive */
|
||||
#define MACH_RCV_VOUCHER 0x00000800 /* willing to receive voucher port */
|
||||
#define MACH_RCV_OVERWRITE 0x00000000 /* scatter receive (deprecated) */
|
||||
#define MACH_RCV_GUARDED_DESC 0x00001000 /* Can receive new guarded descriptor */
|
||||
#define MACH_RCV_SYNC_WAIT 0x00004000 /* sync waiter waiting for rcv */
|
||||
#define MACH_RCV_SYNC_PEEK 0x00008000 /* sync waiter waiting to peek */
|
||||
|
||||
#define MACH_MSG_STRICT_REPLY 0x00000200 /* Enforce specific properties about the reply port, and
|
||||
* the context in which a thread replies to a message.
|
||||
* This flag must be passed on both the SEND and RCV */
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: a 0x00------ RCV mask implies to ask for
|
||||
* a MACH_MSG_TRAILER_FORMAT_0 with 0 Elements,
|
||||
* which is equivalent to a mach_msg_trailer_t.
|
||||
*
|
||||
* XXXMAC: unlike the rest of the MACH_RCV_* flags, MACH_RCV_TRAILER_LABELS
|
||||
* needs its own private bit since we only calculate its fields when absolutely
|
||||
* required.
|
||||
*/
|
||||
#define MACH_RCV_TRAILER_NULL 0
|
||||
#define MACH_RCV_TRAILER_SEQNO 1
|
||||
#define MACH_RCV_TRAILER_SENDER 2
|
||||
#define MACH_RCV_TRAILER_AUDIT 3
|
||||
#define MACH_RCV_TRAILER_CTX 4
|
||||
#define MACH_RCV_TRAILER_AV 7
|
||||
#define MACH_RCV_TRAILER_LABELS 8
|
||||
|
||||
#define MACH_RCV_TRAILER_TYPE(x) (((x) & 0xf) << 28)
|
||||
#define MACH_RCV_TRAILER_ELEMENTS(x) (((x) & 0xf) << 24)
|
||||
#define MACH_RCV_TRAILER_MASK ((0xf << 24))
|
||||
|
||||
#define GET_RCV_ELEMENTS(y) (((y) >> 24) & 0xf)
|
||||
|
||||
|
||||
/*
|
||||
* XXXMAC: note that in the case of MACH_RCV_TRAILER_LABELS,
|
||||
* we just fall through to mach_msg_max_trailer_t.
|
||||
* This is correct behavior since mach_msg_max_trailer_t is defined as
|
||||
* mac_msg_mac_trailer_t which is used for the LABELS trailer.
|
||||
* It also makes things work properly if MACH_RCV_TRAILER_LABELS is ORed
|
||||
* with one of the other options.
|
||||
*/
|
||||
|
||||
#define REQUESTED_TRAILER_SIZE_NATIVE(y) \
|
||||
((mach_msg_trailer_size_t) \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_NULL) ? \
|
||||
sizeof(mach_msg_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SEQNO) ? \
|
||||
sizeof(mach_msg_seqno_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SENDER) ? \
|
||||
sizeof(mach_msg_security_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_AUDIT) ? \
|
||||
sizeof(mach_msg_audit_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_CTX) ? \
|
||||
sizeof(mach_msg_context_trailer_t) : \
|
||||
((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_AV) ? \
|
||||
sizeof(mach_msg_mac_trailer_t) : \
|
||||
sizeof(mach_msg_max_trailer_t))))))))
|
||||
|
||||
|
||||
#define REQUESTED_TRAILER_SIZE(y) REQUESTED_TRAILER_SIZE_NATIVE(y)
|
||||
|
||||
/*
|
||||
* Much code assumes that mach_msg_return_t == kern_return_t.
|
||||
* This definition is useful for descriptive purposes.
|
||||
*
|
||||
* See <mach/error.h> for the format of error codes.
|
||||
* IPC errors are system 4. Send errors are subsystem 0;
|
||||
* receive errors are subsystem 1. The code field is always non-zero.
|
||||
* The high bits of the code field communicate extra information
|
||||
* for some error codes. MACH_MSG_MASK masks off these special bits.
|
||||
*/
|
||||
|
||||
typedef kern_return_t mach_msg_return_t;
|
||||
|
||||
#define MACH_MSG_SUCCESS 0x00000000
|
||||
|
||||
|
||||
#define MACH_MSG_MASK 0x00003e00
|
||||
/* All special error code bits defined below. */
|
||||
#define MACH_MSG_IPC_SPACE 0x00002000
|
||||
/* No room in IPC name space for another capability name. */
|
||||
#define MACH_MSG_VM_SPACE 0x00001000
|
||||
/* No room in VM address space for out-of-line memory. */
|
||||
#define MACH_MSG_IPC_KERNEL 0x00000800
|
||||
/* Kernel resource shortage handling an IPC capability. */
|
||||
#define MACH_MSG_VM_KERNEL 0x00000400
|
||||
/* Kernel resource shortage handling out-of-line memory. */
|
||||
|
||||
#define MACH_SEND_IN_PROGRESS 0x10000001
|
||||
/* Thread is waiting to send. (Internal use only.) */
|
||||
#define MACH_SEND_INVALID_DATA 0x10000002
|
||||
/* Bogus in-line data. */
|
||||
#define MACH_SEND_INVALID_DEST 0x10000003
|
||||
/* Bogus destination port. */
|
||||
#define MACH_SEND_TIMED_OUT 0x10000004
|
||||
/* Message not sent before timeout expired. */
|
||||
#define MACH_SEND_INVALID_VOUCHER 0x10000005
|
||||
/* Bogus voucher port. */
|
||||
#define MACH_SEND_INTERRUPTED 0x10000007
|
||||
/* Software interrupt. */
|
||||
#define MACH_SEND_MSG_TOO_SMALL 0x10000008
|
||||
/* Data doesn't contain a complete message. */
|
||||
#define MACH_SEND_INVALID_REPLY 0x10000009
|
||||
/* Bogus reply port. */
|
||||
#define MACH_SEND_INVALID_RIGHT 0x1000000a
|
||||
/* Bogus port rights in the message body. */
|
||||
#define MACH_SEND_INVALID_NOTIFY 0x1000000b
|
||||
/* Bogus notify port argument. */
|
||||
#define MACH_SEND_INVALID_MEMORY 0x1000000c
|
||||
/* Invalid out-of-line memory pointer. */
|
||||
#define MACH_SEND_NO_BUFFER 0x1000000d
|
||||
/* No message buffer is available. */
|
||||
#define MACH_SEND_TOO_LARGE 0x1000000e
|
||||
/* Send is too large for port */
|
||||
#define MACH_SEND_INVALID_TYPE 0x1000000f
|
||||
/* Invalid msg-type specification. */
|
||||
#define MACH_SEND_INVALID_HEADER 0x10000010
|
||||
/* A field in the header had a bad value. */
|
||||
#define MACH_SEND_INVALID_TRAILER 0x10000011
|
||||
/* The trailer to be sent does not match kernel format. */
|
||||
#define MACH_SEND_INVALID_CONTEXT 0x10000012
|
||||
/* The sending thread context did not match the context on the dest port */
|
||||
#define MACH_SEND_INVALID_RT_OOL_SIZE 0x10000015
|
||||
/* compatibility: no longer a returned error */
|
||||
#define MACH_SEND_NO_GRANT_DEST 0x10000016
|
||||
/* The destination port doesn't accept ports in body */
|
||||
#define MACH_SEND_MSG_FILTERED 0x10000017
|
||||
/* Message send was rejected by message filter */
|
||||
|
||||
#define MACH_RCV_IN_PROGRESS 0x10004001
|
||||
/* Thread is waiting for receive. (Internal use only.) */
|
||||
#define MACH_RCV_INVALID_NAME 0x10004002
|
||||
/* Bogus name for receive port/port-set. */
|
||||
#define MACH_RCV_TIMED_OUT 0x10004003
|
||||
/* Didn't get a message within the timeout value. */
|
||||
#define MACH_RCV_TOO_LARGE 0x10004004
|
||||
/* Message buffer is not large enough for inline data. */
|
||||
#define MACH_RCV_INTERRUPTED 0x10004005
|
||||
/* Software interrupt. */
|
||||
#define MACH_RCV_PORT_CHANGED 0x10004006
|
||||
/* compatibility: no longer a returned error */
|
||||
#define MACH_RCV_INVALID_NOTIFY 0x10004007
|
||||
/* Bogus notify port argument. */
|
||||
#define MACH_RCV_INVALID_DATA 0x10004008
|
||||
/* Bogus message buffer for inline data. */
|
||||
#define MACH_RCV_PORT_DIED 0x10004009
|
||||
/* Port/set was sent away/died during receive. */
|
||||
#define MACH_RCV_IN_SET 0x1000400a
|
||||
/* compatibility: no longer a returned error */
|
||||
#define MACH_RCV_HEADER_ERROR 0x1000400b
|
||||
/* Error receiving message header. See special bits. */
|
||||
#define MACH_RCV_BODY_ERROR 0x1000400c
|
||||
/* Error receiving message body. See special bits. */
|
||||
#define MACH_RCV_INVALID_TYPE 0x1000400d
|
||||
/* Invalid msg-type specification in scatter list. */
|
||||
#define MACH_RCV_SCATTER_SMALL 0x1000400e
|
||||
/* Out-of-line overwrite region is not large enough */
|
||||
#define MACH_RCV_INVALID_TRAILER 0x1000400f
|
||||
/* trailer type or number of trailer elements not supported */
|
||||
#define MACH_RCV_IN_PROGRESS_TIMED 0x10004011
|
||||
/* Waiting for receive with timeout. (Internal use only.) */
|
||||
#define MACH_RCV_INVALID_REPLY 0x10004012
|
||||
/* invalid reply port used in a STRICT_REPLY message */
|
||||
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Routine: mach_msg_overwrite
|
||||
* Purpose:
|
||||
* Send and/or receive a message. If the message operation
|
||||
* is interrupted, and the user did not request an indication
|
||||
* of that fact, then restart the appropriate parts of the
|
||||
* operation silently (trap version does not restart).
|
||||
*
|
||||
* Distinct send and receive buffers may be specified. If
|
||||
* no separate receive buffer is specified, the msg parameter
|
||||
* will be used for both send and receive operations.
|
||||
*
|
||||
* In addition to a distinct receive buffer, that buffer may
|
||||
* already contain scatter control information to direct the
|
||||
* receiving of the message.
|
||||
*/
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern mach_msg_return_t mach_msg_overwrite(
|
||||
mach_msg_header_t *msg,
|
||||
mach_msg_option_t option,
|
||||
mach_msg_size_t send_size,
|
||||
mach_msg_size_t rcv_size,
|
||||
mach_port_name_t rcv_name,
|
||||
mach_msg_timeout_t timeout,
|
||||
mach_port_name_t notify,
|
||||
mach_msg_header_t *rcv_msg,
|
||||
mach_msg_size_t rcv_limit);
|
||||
|
||||
|
||||
/*
|
||||
* Routine: mach_msg
|
||||
* Purpose:
|
||||
* Send and/or receive a message. If the message operation
|
||||
* is interrupted, and the user did not request an indication
|
||||
* of that fact, then restart the appropriate parts of the
|
||||
* operation silently (trap version does not restart).
|
||||
*/
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern mach_msg_return_t mach_msg(
|
||||
mach_msg_header_t *msg,
|
||||
mach_msg_option_t option,
|
||||
mach_msg_size_t send_size,
|
||||
mach_msg_size_t rcv_size,
|
||||
mach_port_name_t rcv_name,
|
||||
mach_msg_timeout_t timeout,
|
||||
mach_port_name_t notify);
|
||||
|
||||
/*
|
||||
* Routine: mach_voucher_deallocate
|
||||
* Purpose:
|
||||
* Deallocate a mach voucher created or received in a message. Drops
|
||||
* one (send right) reference to the voucher.
|
||||
*/
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern kern_return_t mach_voucher_deallocate(
|
||||
mach_port_name_t voucher);
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACH_MESSAGE_H_ */
|
||||
429
lib/libc/include/aarch64-macos-gnu/mach/port.h
Normal file
429
lib/libc/include/aarch64-macos-gnu/mach/port.h
Normal file
@ -0,0 +1,429 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2006 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* NOTICE: This file was modified by McAfee Research in 2004 to introduce
|
||||
* support for mandatory and extensible security protections. This notice
|
||||
* is included in support of clause 2.2 (b) of the Apple Public License,
|
||||
* Version 2.0.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/port.h
|
||||
*
|
||||
* Definition of a Mach port
|
||||
*
|
||||
* Mach ports are the endpoints to Mach-implemented communications
|
||||
* channels (usually uni-directional message queues, but other types
|
||||
* also exist).
|
||||
*
|
||||
* Unique collections of these endpoints are maintained for each
|
||||
* Mach task. Each Mach port in the task's collection is given a
|
||||
* [task-local] name to identify it - and the the various "rights"
|
||||
* held by the task for that specific endpoint.
|
||||
*
|
||||
* This header defines the types used to identify these Mach ports
|
||||
* and the various rights associated with them. For more info see:
|
||||
*
|
||||
* <mach/mach_port.h> - manipulation of port rights in a given space
|
||||
* <mach/message.h> - message queue [and port right passing] mechanism
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_PORT_H_
|
||||
#define _MACH_PORT_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
#include <mach/boolean.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
|
||||
/*
|
||||
* mach_port_name_t - the local identity for a Mach port
|
||||
*
|
||||
* The name is Mach port namespace specific. It is used to
|
||||
* identify the rights held for that port by the task whose
|
||||
* namespace is implied [or specifically provided].
|
||||
*
|
||||
* Use of this type usually implies just a name - no rights.
|
||||
* See mach_port_t for a type that implies a "named right."
|
||||
*
|
||||
*/
|
||||
|
||||
typedef natural_t mach_port_name_t;
|
||||
typedef mach_port_name_t *mach_port_name_array_t;
|
||||
|
||||
|
||||
/*
|
||||
* mach_port_t - a named port right
|
||||
*
|
||||
* In user-space, "rights" are represented by the name of the
|
||||
* right in the Mach port namespace. Even so, this type is
|
||||
* presented as a unique one to more clearly denote the presence
|
||||
* of a right coming along with the name.
|
||||
*
|
||||
* Often, various rights for a port held in a single name space
|
||||
* will coalesce and are, therefore, be identified by a single name
|
||||
* [this is the case for send and receive rights]. But not
|
||||
* always [send-once rights currently get a unique name for
|
||||
* each right].
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/_types.h>
|
||||
#include <sys/_types/_mach_port_t.h>
|
||||
|
||||
|
||||
typedef mach_port_t *mach_port_array_t;
|
||||
|
||||
/*
|
||||
* MACH_PORT_NULL is a legal value that can be carried in messages.
|
||||
* It indicates the absence of any port or port rights. (A port
|
||||
* argument keeps the message from being "simple", even if the
|
||||
* value is MACH_PORT_NULL.) The value MACH_PORT_DEAD is also a legal
|
||||
* value that can be carried in messages. It indicates
|
||||
* that a port right was present, but it died.
|
||||
*/
|
||||
|
||||
#define MACH_PORT_NULL 0 /* intentional loose typing */
|
||||
#define MACH_PORT_DEAD ((mach_port_name_t) ~0)
|
||||
#define MACH_PORT_VALID(name) \
|
||||
(((name) != MACH_PORT_NULL) && \
|
||||
((name) != MACH_PORT_DEAD))
|
||||
|
||||
|
||||
/*
|
||||
* For kernel-selected [assigned] port names, the name is
|
||||
* comprised of two parts: a generation number and an index.
|
||||
* This approach keeps the exact same name from being generated
|
||||
* and reused too quickly [to catch right/reference counting bugs].
|
||||
* The dividing line between the constituent parts is exposed so
|
||||
* that efficient "mach_port_name_t to data structure pointer"
|
||||
* conversion implementation can be made. But it is possible
|
||||
* for user-level code to assign their own names to Mach ports.
|
||||
* These are not required to participate in this algorithm. So
|
||||
* care should be taken before "assuming" this model.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NO_PORT_GEN
|
||||
|
||||
#define MACH_PORT_INDEX(name) ((name) >> 8)
|
||||
#define MACH_PORT_GEN(name) (((name) & 0xff) << 24)
|
||||
#define MACH_PORT_MAKE(index, gen) \
|
||||
(((index) << 8) | (gen) >> 24)
|
||||
|
||||
#else /* NO_PORT_GEN */
|
||||
|
||||
#define MACH_PORT_INDEX(name) (name)
|
||||
#define MACH_PORT_GEN(name) (0)
|
||||
#define MACH_PORT_MAKE(index, gen) (index)
|
||||
|
||||
#endif /* NO_PORT_GEN */
|
||||
|
||||
|
||||
/*
|
||||
* These are the different rights a task may have for a port.
|
||||
* The MACH_PORT_RIGHT_* definitions are used as arguments
|
||||
* to mach_port_allocate, mach_port_get_refs, etc, to specify
|
||||
* a particular right to act upon. The mach_port_names and
|
||||
* mach_port_type calls return bitmasks using the MACH_PORT_TYPE_*
|
||||
* definitions. This is because a single name may denote
|
||||
* multiple rights.
|
||||
*/
|
||||
|
||||
typedef natural_t mach_port_right_t;
|
||||
|
||||
#define MACH_PORT_RIGHT_SEND ((mach_port_right_t) 0)
|
||||
#define MACH_PORT_RIGHT_RECEIVE ((mach_port_right_t) 1)
|
||||
#define MACH_PORT_RIGHT_SEND_ONCE ((mach_port_right_t) 2)
|
||||
#define MACH_PORT_RIGHT_PORT_SET ((mach_port_right_t) 3)
|
||||
#define MACH_PORT_RIGHT_DEAD_NAME ((mach_port_right_t) 4)
|
||||
#define MACH_PORT_RIGHT_LABELH ((mach_port_right_t) 5) /* obsolete right */
|
||||
#define MACH_PORT_RIGHT_NUMBER ((mach_port_right_t) 6) /* right not implemented */
|
||||
|
||||
|
||||
typedef natural_t mach_port_type_t;
|
||||
typedef mach_port_type_t *mach_port_type_array_t;
|
||||
|
||||
#define MACH_PORT_TYPE(right) \
|
||||
((mach_port_type_t)(((mach_port_type_t) 1) \
|
||||
<< ((right) + ((mach_port_right_t) 16))))
|
||||
#define MACH_PORT_TYPE_NONE ((mach_port_type_t) 0L)
|
||||
#define MACH_PORT_TYPE_SEND MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND)
|
||||
#define MACH_PORT_TYPE_RECEIVE MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
|
||||
#define MACH_PORT_TYPE_SEND_ONCE MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE)
|
||||
#define MACH_PORT_TYPE_PORT_SET MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET)
|
||||
#define MACH_PORT_TYPE_DEAD_NAME MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME)
|
||||
#define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */
|
||||
|
||||
|
||||
|
||||
/* Convenient combinations. */
|
||||
|
||||
#define MACH_PORT_TYPE_SEND_RECEIVE \
|
||||
(MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE)
|
||||
#define MACH_PORT_TYPE_SEND_RIGHTS \
|
||||
(MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE)
|
||||
#define MACH_PORT_TYPE_PORT_RIGHTS \
|
||||
(MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE)
|
||||
#define MACH_PORT_TYPE_PORT_OR_DEAD \
|
||||
(MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME)
|
||||
#define MACH_PORT_TYPE_ALL_RIGHTS \
|
||||
(MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET)
|
||||
|
||||
/* Dummy type bits that mach_port_type/mach_port_names can return. */
|
||||
|
||||
#define MACH_PORT_TYPE_DNREQUEST 0x80000000
|
||||
#define MACH_PORT_TYPE_SPREQUEST 0x40000000
|
||||
#define MACH_PORT_TYPE_SPREQUEST_DELAYED 0x20000000
|
||||
|
||||
/* User-references for capabilities. */
|
||||
|
||||
typedef natural_t mach_port_urefs_t;
|
||||
typedef integer_t mach_port_delta_t; /* change in urefs */
|
||||
|
||||
/* Attributes of ports. (See mach_port_get_receive_status.) */
|
||||
|
||||
typedef natural_t mach_port_seqno_t; /* sequence number */
|
||||
typedef natural_t mach_port_mscount_t; /* make-send count */
|
||||
typedef natural_t mach_port_msgcount_t; /* number of msgs */
|
||||
typedef natural_t mach_port_rights_t; /* number of rights */
|
||||
|
||||
/*
|
||||
* Are there outstanding send rights for a given port?
|
||||
*/
|
||||
#define MACH_PORT_SRIGHTS_NONE 0 /* no srights */
|
||||
#define MACH_PORT_SRIGHTS_PRESENT 1 /* srights */
|
||||
typedef unsigned int mach_port_srights_t; /* status of send rights */
|
||||
|
||||
typedef struct mach_port_status {
|
||||
mach_port_rights_t mps_pset; /* count of containing port sets */
|
||||
mach_port_seqno_t mps_seqno; /* sequence number */
|
||||
mach_port_mscount_t mps_mscount; /* make-send count */
|
||||
mach_port_msgcount_t mps_qlimit; /* queue limit */
|
||||
mach_port_msgcount_t mps_msgcount; /* number in the queue */
|
||||
mach_port_rights_t mps_sorights; /* how many send-once rights */
|
||||
boolean_t mps_srights; /* do send rights exist? */
|
||||
boolean_t mps_pdrequest; /* port-deleted requested? */
|
||||
boolean_t mps_nsrequest; /* no-senders requested? */
|
||||
natural_t mps_flags; /* port flags */
|
||||
} mach_port_status_t;
|
||||
|
||||
/* System-wide values for setting queue limits on a port */
|
||||
#define MACH_PORT_QLIMIT_ZERO (0)
|
||||
#define MACH_PORT_QLIMIT_BASIC (5)
|
||||
#define MACH_PORT_QLIMIT_SMALL (16)
|
||||
#define MACH_PORT_QLIMIT_LARGE (1024)
|
||||
#define MACH_PORT_QLIMIT_KERNEL (65534)
|
||||
#define MACH_PORT_QLIMIT_MIN MACH_PORT_QLIMIT_ZERO
|
||||
#define MACH_PORT_QLIMIT_DEFAULT MACH_PORT_QLIMIT_BASIC
|
||||
#define MACH_PORT_QLIMIT_MAX MACH_PORT_QLIMIT_LARGE
|
||||
|
||||
typedef struct mach_port_limits {
|
||||
mach_port_msgcount_t mpl_qlimit; /* number of msgs */
|
||||
} mach_port_limits_t;
|
||||
|
||||
/* Possible values for mps_flags (part of mach_port_status_t) */
|
||||
#define MACH_PORT_STATUS_FLAG_TEMPOWNER 0x01
|
||||
#define MACH_PORT_STATUS_FLAG_GUARDED 0x02
|
||||
#define MACH_PORT_STATUS_FLAG_STRICT_GUARD 0x04
|
||||
#define MACH_PORT_STATUS_FLAG_IMP_DONATION 0x08
|
||||
#define MACH_PORT_STATUS_FLAG_REVIVE 0x10
|
||||
#define MACH_PORT_STATUS_FLAG_TASKPTR 0x20
|
||||
#define MACH_PORT_STATUS_FLAG_GUARD_IMMOVABLE_RECEIVE 0x40
|
||||
#define MACH_PORT_STATUS_FLAG_NO_GRANT 0x80
|
||||
|
||||
typedef struct mach_port_info_ext {
|
||||
mach_port_status_t mpie_status;
|
||||
mach_port_msgcount_t mpie_boost_cnt;
|
||||
uint32_t reserved[6];
|
||||
} mach_port_info_ext_t;
|
||||
|
||||
typedef integer_t *mach_port_info_t; /* varying array of natural_t */
|
||||
|
||||
/* Flavors for mach_port_get/set_attributes() */
|
||||
typedef int mach_port_flavor_t;
|
||||
#define MACH_PORT_LIMITS_INFO 1 /* uses mach_port_limits_t */
|
||||
#define MACH_PORT_RECEIVE_STATUS 2 /* uses mach_port_status_t */
|
||||
#define MACH_PORT_DNREQUESTS_SIZE 3 /* info is int */
|
||||
#define MACH_PORT_TEMPOWNER 4 /* indicates receive right will be reassigned to another task */
|
||||
#define MACH_PORT_IMPORTANCE_RECEIVER 5 /* indicates recieve right accepts priority donation */
|
||||
#define MACH_PORT_DENAP_RECEIVER 6 /* indicates receive right accepts de-nap donation */
|
||||
#define MACH_PORT_INFO_EXT 7 /* uses mach_port_info_ext_t */
|
||||
|
||||
#define MACH_PORT_LIMITS_INFO_COUNT ((natural_t) \
|
||||
(sizeof(mach_port_limits_t)/sizeof(natural_t)))
|
||||
#define MACH_PORT_RECEIVE_STATUS_COUNT ((natural_t) \
|
||||
(sizeof(mach_port_status_t)/sizeof(natural_t)))
|
||||
#define MACH_PORT_DNREQUESTS_SIZE_COUNT 1
|
||||
#define MACH_PORT_INFO_EXT_COUNT ((natural_t) \
|
||||
(sizeof(mach_port_info_ext_t)/sizeof(natural_t)))
|
||||
/*
|
||||
* Structure used to pass information about port allocation requests.
|
||||
* Must be padded to 64-bits total length.
|
||||
*/
|
||||
typedef struct mach_port_qos {
|
||||
unsigned int name:1; /* name given */
|
||||
unsigned int prealloc:1; /* prealloced message */
|
||||
boolean_t pad1:30;
|
||||
natural_t len;
|
||||
} mach_port_qos_t;
|
||||
|
||||
/* Mach Port Guarding definitions */
|
||||
|
||||
/*
|
||||
* Flags for mach_port_options (used for
|
||||
* invocation of mach_port_construct).
|
||||
* Indicates attributes to be set for the newly
|
||||
* allocated port.
|
||||
*/
|
||||
#define MPO_CONTEXT_AS_GUARD 0x01 /* Add guard to the port */
|
||||
#define MPO_QLIMIT 0x02 /* Set qlimit for the port msg queue */
|
||||
#define MPO_TEMPOWNER 0x04 /* Set the tempowner bit of the port */
|
||||
#define MPO_IMPORTANCE_RECEIVER 0x08 /* Mark the port as importance receiver */
|
||||
#define MPO_INSERT_SEND_RIGHT 0x10 /* Insert a send right for the port */
|
||||
#define MPO_STRICT 0x20 /* Apply strict guarding for port */
|
||||
#define MPO_DENAP_RECEIVER 0x40 /* Mark the port as App de-nap receiver */
|
||||
#define MPO_IMMOVABLE_RECEIVE 0x80 /* Mark the port as immovable; protected by the guard context */
|
||||
#define MPO_FILTER_MSG 0x100 /* Allow message filtering */
|
||||
#define MPO_TG_BLOCK_TRACKING 0x200 /* Track blocking relationship for thread group during sync IPC */
|
||||
|
||||
/*
|
||||
* Structure to define optional attributes for a newly
|
||||
* constructed port.
|
||||
*/
|
||||
typedef struct mach_port_options {
|
||||
uint32_t flags; /* Flags defining attributes for port */
|
||||
mach_port_limits_t mpl; /* Message queue limit for port */
|
||||
union {
|
||||
uint64_t reserved[2]; /* Reserved */
|
||||
mach_port_name_t work_interval_port; /* Work interval port */
|
||||
};
|
||||
}mach_port_options_t;
|
||||
|
||||
typedef mach_port_options_t *mach_port_options_ptr_t;
|
||||
|
||||
/*
|
||||
* EXC_GUARD represents a guard violation for both
|
||||
* mach ports and file descriptors. GUARD_TYPE_ is used
|
||||
* to differentiate among them.
|
||||
*/
|
||||
#define GUARD_TYPE_MACH_PORT 0x1
|
||||
|
||||
/* Reasons for exception for a guarded mach port */
|
||||
enum mach_port_guard_exception_codes {
|
||||
kGUARD_EXC_DESTROY = 1u << 0,
|
||||
kGUARD_EXC_MOD_REFS = 1u << 1,
|
||||
kGUARD_EXC_SET_CONTEXT = 1u << 2,
|
||||
kGUARD_EXC_UNGUARDED = 1u << 3,
|
||||
kGUARD_EXC_INCORRECT_GUARD = 1u << 4,
|
||||
kGUARD_EXC_IMMOVABLE = 1u << 5,
|
||||
kGUARD_EXC_STRICT_REPLY = 1u << 6,
|
||||
kGUARD_EXC_MSG_FILTERED = 1u << 7,
|
||||
/* start of [optionally] non-fatal guards */
|
||||
kGUARD_EXC_INVALID_RIGHT = 1u << 8,
|
||||
kGUARD_EXC_INVALID_NAME = 1u << 9,
|
||||
kGUARD_EXC_INVALID_VALUE = 1u << 10,
|
||||
kGUARD_EXC_INVALID_ARGUMENT = 1u << 11,
|
||||
kGUARD_EXC_RIGHT_EXISTS = 1u << 12,
|
||||
kGUARD_EXC_KERN_NO_SPACE = 1u << 13,
|
||||
kGUARD_EXC_KERN_FAILURE = 1u << 14,
|
||||
kGUARD_EXC_KERN_RESOURCE = 1u << 15,
|
||||
kGUARD_EXC_SEND_INVALID_REPLY = 1u << 16,
|
||||
kGUARD_EXC_SEND_INVALID_VOUCHER = 1u << 17,
|
||||
kGUARD_EXC_SEND_INVALID_RIGHT = 1u << 18,
|
||||
kGUARD_EXC_RCV_INVALID_NAME = 1u << 19,
|
||||
kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* should never be fatal; for development only */
|
||||
};
|
||||
|
||||
#define MAX_FATAL_kGUARD_EXC_CODE (1u << 6)
|
||||
|
||||
/*
|
||||
* These flags are used as bits in the subcode of kGUARD_EXC_STRICT_REPLY exceptions.
|
||||
*/
|
||||
#define MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_DISP (0x01ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_PORT (0x02ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_INVALID_VOUCHER (0x04ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_NO_BANK_ATTR (0x08ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA (0x10ull << 56)
|
||||
#define MPG_FLAGS_STRICT_REPLY_MASK (0xffull << 56)
|
||||
|
||||
/*
|
||||
* Flags for mach_port_guard_with_flags. These flags extend
|
||||
* the attributes associated with a guarded port.
|
||||
*/
|
||||
#define MPG_STRICT 0x01 /* Apply strict guarding for a port */
|
||||
#define MPG_IMMOVABLE_RECEIVE 0x02 /* Receive right cannot be moved out of the space */
|
||||
|
||||
#if !__DARWIN_UNIX03 && !defined(_NO_PORT_T_FROM_MACH)
|
||||
/*
|
||||
* Mach 3.0 renamed everything to have mach_ in front of it.
|
||||
* These types and macros are provided for backward compatibility
|
||||
* but are deprecated.
|
||||
*/
|
||||
typedef mach_port_t port_t;
|
||||
typedef mach_port_name_t port_name_t;
|
||||
typedef mach_port_name_t *port_name_array_t;
|
||||
|
||||
#define PORT_NULL ((port_t) 0)
|
||||
#define PORT_DEAD ((port_t) ~0)
|
||||
#define PORT_VALID(name) \
|
||||
((port_t)(name) != PORT_NULL && (port_t)(name) != PORT_DEAD)
|
||||
|
||||
#endif /* !__DARWIN_UNIX03 && !_NO_PORT_T_FROM_MACH */
|
||||
|
||||
#endif /* _MACH_PORT_H_ */
|
||||
585
lib/libc/include/aarch64-macos-gnu/mach/processor_set.h
Normal file
585
lib/libc/include/aarch64-macos-gnu/mach/processor_set.h
Normal file
@ -0,0 +1,585 @@
|
||||
#ifndef _processor_set_user_
|
||||
#define _processor_set_user_
|
||||
|
||||
/* Module processor_set */
|
||||
|
||||
#include <string.h>
|
||||
#include <mach/ndr.h>
|
||||
#include <mach/boolean.h>
|
||||
#include <mach/kern_return.h>
|
||||
#include <mach/notify.h>
|
||||
#include <mach/mach_types.h>
|
||||
#include <mach/message.h>
|
||||
#include <mach/mig_errors.h>
|
||||
#include <mach/port.h>
|
||||
|
||||
/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
|
||||
|
||||
#if defined(__has_include)
|
||||
#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
|
||||
#ifndef USING_MIG_STRNCPY_ZEROFILL
|
||||
#define USING_MIG_STRNCPY_ZEROFILL
|
||||
#endif
|
||||
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
|
||||
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
|
||||
#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
|
||||
#endif /* __has_include */
|
||||
|
||||
/* END MIG_STRNCPY_ZEROFILL CODE */
|
||||
|
||||
|
||||
#ifdef AUTOTEST
|
||||
#ifndef FUNCTION_PTR_T
|
||||
#define FUNCTION_PTR_T
|
||||
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
|
||||
typedef struct {
|
||||
char *name;
|
||||
function_ptr_t function;
|
||||
} function_table_entry;
|
||||
typedef function_table_entry *function_table_t;
|
||||
#endif /* FUNCTION_PTR_T */
|
||||
#endif /* AUTOTEST */
|
||||
|
||||
#ifndef processor_set_MSG_COUNT
|
||||
#define processor_set_MSG_COUNT 11
|
||||
#endif /* processor_set_MSG_COUNT */
|
||||
|
||||
#include <mach/std_types.h>
|
||||
#include <mach/mig.h>
|
||||
#include <mach/mig.h>
|
||||
#include <mach/mach_types.h>
|
||||
|
||||
#ifdef __BeforeMigUserHeader
|
||||
__BeforeMigUserHeader
|
||||
#endif /* __BeforeMigUserHeader */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
/* Routine processor_set_statistics */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_statistics
|
||||
(
|
||||
processor_set_name_t pset,
|
||||
processor_set_flavor_t flavor,
|
||||
processor_set_info_t info_out,
|
||||
mach_msg_type_number_t *info_outCnt
|
||||
);
|
||||
|
||||
/* Routine processor_set_destroy */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_destroy
|
||||
(
|
||||
processor_set_t set
|
||||
);
|
||||
|
||||
/* Routine processor_set_max_priority */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_max_priority
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
int max_priority,
|
||||
boolean_t change_threads
|
||||
);
|
||||
|
||||
/* Routine processor_set_policy_enable */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_policy_enable
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
int policy
|
||||
);
|
||||
|
||||
/* Routine processor_set_policy_disable */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_policy_disable
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
int policy,
|
||||
boolean_t change_threads
|
||||
);
|
||||
|
||||
/* Routine processor_set_tasks */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_tasks
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
task_array_t *task_list,
|
||||
mach_msg_type_number_t *task_listCnt
|
||||
);
|
||||
|
||||
/* Routine processor_set_threads */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_threads
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
thread_act_array_t *thread_list,
|
||||
mach_msg_type_number_t *thread_listCnt
|
||||
);
|
||||
|
||||
/* Routine processor_set_policy_control */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_policy_control
|
||||
(
|
||||
processor_set_t pset,
|
||||
processor_set_flavor_t flavor,
|
||||
processor_set_info_t policy_info,
|
||||
mach_msg_type_number_t policy_infoCnt,
|
||||
boolean_t change
|
||||
);
|
||||
|
||||
/* Routine processor_set_stack_usage */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_stack_usage
|
||||
(
|
||||
processor_set_t pset,
|
||||
unsigned *ltotal,
|
||||
vm_size_t *space,
|
||||
vm_size_t *resident,
|
||||
vm_size_t *maxusage,
|
||||
vm_offset_t *maxstack
|
||||
);
|
||||
|
||||
/* Routine processor_set_info */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_info
|
||||
(
|
||||
processor_set_name_t set_name,
|
||||
int flavor,
|
||||
host_t *host,
|
||||
processor_set_info_t info_out,
|
||||
mach_msg_type_number_t *info_outCnt
|
||||
);
|
||||
|
||||
/* Routine processor_set_tasks_with_flavor */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t processor_set_tasks_with_flavor
|
||||
(
|
||||
processor_set_t processor_set,
|
||||
mach_task_flavor_t flavor,
|
||||
task_array_t *task_list,
|
||||
mach_msg_type_number_t *task_listCnt
|
||||
);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
/********************** Caution **************************/
|
||||
/* The following data types should be used to calculate */
|
||||
/* maximum message sizes only. The actual message may be */
|
||||
/* smaller, and the position of the arguments within the */
|
||||
/* message layout may vary from what is presented here. */
|
||||
/* For example, if any of the arguments are variable- */
|
||||
/* sized, and less than the maximum is sent, the data */
|
||||
/* will be packed tight in the actual message to reduce */
|
||||
/* the presence of holes. */
|
||||
/********************** Caution **************************/
|
||||
|
||||
/* typedefs for all requests */
|
||||
|
||||
#ifndef __Request__processor_set_subsystem__defined
|
||||
#define __Request__processor_set_subsystem__defined
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
processor_set_flavor_t flavor;
|
||||
mach_msg_type_number_t info_outCnt;
|
||||
} __Request__processor_set_statistics_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
} __Request__processor_set_destroy_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
int max_priority;
|
||||
boolean_t change_threads;
|
||||
} __Request__processor_set_max_priority_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
int policy;
|
||||
} __Request__processor_set_policy_enable_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
int policy;
|
||||
boolean_t change_threads;
|
||||
} __Request__processor_set_policy_disable_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
} __Request__processor_set_tasks_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
} __Request__processor_set_threads_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
processor_set_flavor_t flavor;
|
||||
mach_msg_type_number_t policy_infoCnt;
|
||||
integer_t policy_info[5];
|
||||
boolean_t change;
|
||||
} __Request__processor_set_policy_control_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
} __Request__processor_set_stack_usage_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
int flavor;
|
||||
mach_msg_type_number_t info_outCnt;
|
||||
} __Request__processor_set_info_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
mach_task_flavor_t flavor;
|
||||
} __Request__processor_set_tasks_with_flavor_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Request__processor_set_subsystem__defined */
|
||||
|
||||
/* union of all requests */
|
||||
|
||||
#ifndef __RequestUnion__processor_set_subsystem__defined
|
||||
#define __RequestUnion__processor_set_subsystem__defined
|
||||
union __RequestUnion__processor_set_subsystem {
|
||||
__Request__processor_set_statistics_t Request_processor_set_statistics;
|
||||
__Request__processor_set_destroy_t Request_processor_set_destroy;
|
||||
__Request__processor_set_max_priority_t Request_processor_set_max_priority;
|
||||
__Request__processor_set_policy_enable_t Request_processor_set_policy_enable;
|
||||
__Request__processor_set_policy_disable_t Request_processor_set_policy_disable;
|
||||
__Request__processor_set_tasks_t Request_processor_set_tasks;
|
||||
__Request__processor_set_threads_t Request_processor_set_threads;
|
||||
__Request__processor_set_policy_control_t Request_processor_set_policy_control;
|
||||
__Request__processor_set_stack_usage_t Request_processor_set_stack_usage;
|
||||
__Request__processor_set_info_t Request_processor_set_info;
|
||||
__Request__processor_set_tasks_with_flavor_t Request_processor_set_tasks_with_flavor;
|
||||
};
|
||||
#endif /* !__RequestUnion__processor_set_subsystem__defined */
|
||||
/* typedefs for all replies */
|
||||
|
||||
#ifndef __Reply__processor_set_subsystem__defined
|
||||
#define __Reply__processor_set_subsystem__defined
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
mach_msg_type_number_t info_outCnt;
|
||||
integer_t info_out[5];
|
||||
} __Reply__processor_set_statistics_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_destroy_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_max_priority_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_policy_enable_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_policy_disable_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
/* start of the kernel processed data */
|
||||
mach_msg_body_t msgh_body;
|
||||
mach_msg_ool_ports_descriptor_t task_list;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
mach_msg_type_number_t task_listCnt;
|
||||
} __Reply__processor_set_tasks_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
/* start of the kernel processed data */
|
||||
mach_msg_body_t msgh_body;
|
||||
mach_msg_ool_ports_descriptor_t thread_list;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
mach_msg_type_number_t thread_listCnt;
|
||||
} __Reply__processor_set_threads_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__processor_set_policy_control_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
unsigned ltotal;
|
||||
vm_size_t space;
|
||||
vm_size_t resident;
|
||||
vm_size_t maxusage;
|
||||
vm_offset_t maxstack;
|
||||
} __Reply__processor_set_stack_usage_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
/* start of the kernel processed data */
|
||||
mach_msg_body_t msgh_body;
|
||||
mach_msg_port_descriptor_t host;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
mach_msg_type_number_t info_outCnt;
|
||||
integer_t info_out[5];
|
||||
} __Reply__processor_set_info_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
/* start of the kernel processed data */
|
||||
mach_msg_body_t msgh_body;
|
||||
mach_msg_ool_ports_descriptor_t task_list;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
mach_msg_type_number_t task_listCnt;
|
||||
} __Reply__processor_set_tasks_with_flavor_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Reply__processor_set_subsystem__defined */
|
||||
|
||||
/* union of all replies */
|
||||
|
||||
#ifndef __ReplyUnion__processor_set_subsystem__defined
|
||||
#define __ReplyUnion__processor_set_subsystem__defined
|
||||
union __ReplyUnion__processor_set_subsystem {
|
||||
__Reply__processor_set_statistics_t Reply_processor_set_statistics;
|
||||
__Reply__processor_set_destroy_t Reply_processor_set_destroy;
|
||||
__Reply__processor_set_max_priority_t Reply_processor_set_max_priority;
|
||||
__Reply__processor_set_policy_enable_t Reply_processor_set_policy_enable;
|
||||
__Reply__processor_set_policy_disable_t Reply_processor_set_policy_disable;
|
||||
__Reply__processor_set_tasks_t Reply_processor_set_tasks;
|
||||
__Reply__processor_set_threads_t Reply_processor_set_threads;
|
||||
__Reply__processor_set_policy_control_t Reply_processor_set_policy_control;
|
||||
__Reply__processor_set_stack_usage_t Reply_processor_set_stack_usage;
|
||||
__Reply__processor_set_info_t Reply_processor_set_info;
|
||||
__Reply__processor_set_tasks_with_flavor_t Reply_processor_set_tasks_with_flavor;
|
||||
};
|
||||
#endif /* !__RequestUnion__processor_set_subsystem__defined */
|
||||
|
||||
#ifndef subsystem_to_name_map_processor_set
|
||||
#define subsystem_to_name_map_processor_set \
|
||||
{ "processor_set_statistics", 4000 },\
|
||||
{ "processor_set_destroy", 4001 },\
|
||||
{ "processor_set_max_priority", 4002 },\
|
||||
{ "processor_set_policy_enable", 4003 },\
|
||||
{ "processor_set_policy_disable", 4004 },\
|
||||
{ "processor_set_tasks", 4005 },\
|
||||
{ "processor_set_threads", 4006 },\
|
||||
{ "processor_set_policy_control", 4007 },\
|
||||
{ "processor_set_stack_usage", 4008 },\
|
||||
{ "processor_set_info", 4009 },\
|
||||
{ "processor_set_tasks_with_flavor", 4010 }
|
||||
#endif
|
||||
|
||||
#ifdef __AfterMigUserHeader
|
||||
__AfterMigUserHeader
|
||||
#endif /* __AfterMigUserHeader */
|
||||
|
||||
#endif /* _processor_set_user_ */
|
||||
2523
lib/libc/include/aarch64-macos-gnu/mach/task.h
Normal file
2523
lib/libc/include/aarch64-macos-gnu/mach/task.h
Normal file
File diff suppressed because it is too large
Load Diff
524
lib/libc/include/aarch64-macos-gnu/mach/task_info.h
Normal file
524
lib/libc/include/aarch64-macos-gnu/mach/task_info.h
Normal file
@ -0,0 +1,524 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007, 2015 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
* Machine-independent task information structures and definitions.
|
||||
*
|
||||
* The definitions in this file are exported to the user. The kernel
|
||||
* will translate its internal data structures to these structures
|
||||
* as appropriate.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_TASK_INFO_H_
|
||||
#define _MACH_TASK_INFO_H_
|
||||
|
||||
#include <mach/message.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/time_value.h>
|
||||
#include <mach/policy.h>
|
||||
#include <mach/vm_statistics.h> /* for vm_extmod_statistics_data_t */
|
||||
#include <Availability.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/*
|
||||
* Generic information structure to allow for expansion.
|
||||
*/
|
||||
typedef natural_t task_flavor_t;
|
||||
typedef integer_t *task_info_t; /* varying array of int */
|
||||
|
||||
/* Deprecated, use per structure _data_t's instead */
|
||||
#define TASK_INFO_MAX (1024) /* maximum array size */
|
||||
typedef integer_t task_info_data_t[TASK_INFO_MAX];
|
||||
|
||||
/*
|
||||
* Currently defined information structures.
|
||||
*/
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
|
||||
#define TASK_BASIC_INFO_32 4 /* basic information */
|
||||
#define TASK_BASIC2_INFO_32 6
|
||||
|
||||
struct task_basic_info_32 {
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
natural_t virtual_size; /* virtual memory size (bytes) */
|
||||
natural_t resident_size; /* resident memory size (bytes) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
};
|
||||
typedef struct task_basic_info_32 task_basic_info_32_data_t;
|
||||
typedef struct task_basic_info_32 *task_basic_info_32_t;
|
||||
#define TASK_BASIC_INFO_32_COUNT \
|
||||
(sizeof(task_basic_info_32_data_t) / sizeof(natural_t))
|
||||
|
||||
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
|
||||
struct task_basic_info_64 {
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
#else /* defined(__arm__) || defined(__arm64__) */
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
#endif /* defined(__arm__) || defined(__arm64__) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
};
|
||||
typedef struct task_basic_info_64 task_basic_info_64_data_t;
|
||||
typedef struct task_basic_info_64 *task_basic_info_64_t;
|
||||
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
#if defined(__arm__) && defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0)
|
||||
/*
|
||||
* Note: arm64 can't use the old flavor. If you somehow manage to,
|
||||
* you can cope with the nonsense data yourself.
|
||||
*/
|
||||
#define TASK_BASIC_INFO_64 5
|
||||
#define TASK_BASIC_INFO_64_COUNT \
|
||||
(sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
|
||||
|
||||
#else
|
||||
|
||||
#define TASK_BASIC_INFO_64 TASK_BASIC_INFO_64_2
|
||||
#define TASK_BASIC_INFO_64_COUNT TASK_BASIC_INFO_64_2_COUNT
|
||||
#endif
|
||||
#else /* defined(__arm__) || defined(__arm64__) */
|
||||
#define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */
|
||||
#define TASK_BASIC_INFO_64_COUNT \
|
||||
(sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
|
||||
#endif
|
||||
|
||||
|
||||
/* localized structure - cannot be safely passed between tasks of differing sizes */
|
||||
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
|
||||
struct task_basic_info {
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
};
|
||||
|
||||
typedef struct task_basic_info task_basic_info_data_t;
|
||||
typedef struct task_basic_info *task_basic_info_t;
|
||||
#define TASK_BASIC_INFO_COUNT \
|
||||
(sizeof(task_basic_info_data_t) / sizeof(natural_t))
|
||||
#if !defined(__LP64__)
|
||||
#define TASK_BASIC_INFO TASK_BASIC_INFO_32
|
||||
#else
|
||||
#define TASK_BASIC_INFO TASK_BASIC_INFO_64
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define TASK_EVENTS_INFO 2 /* various event counts */
|
||||
|
||||
struct task_events_info {
|
||||
integer_t faults; /* number of page faults */
|
||||
integer_t pageins; /* number of actual pageins */
|
||||
integer_t cow_faults; /* number of copy-on-write faults */
|
||||
integer_t messages_sent; /* number of messages sent */
|
||||
integer_t messages_received; /* number of messages received */
|
||||
integer_t syscalls_mach; /* number of mach system calls */
|
||||
integer_t syscalls_unix; /* number of unix system calls */
|
||||
integer_t csw; /* number of context switches */
|
||||
};
|
||||
typedef struct task_events_info task_events_info_data_t;
|
||||
typedef struct task_events_info *task_events_info_t;
|
||||
#define TASK_EVENTS_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_events_info_data_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_THREAD_TIMES_INFO 3 /* total times for live threads -
|
||||
* only accurate if suspended */
|
||||
|
||||
struct task_thread_times_info {
|
||||
time_value_t user_time; /* total user run time for
|
||||
* live threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* live threads */
|
||||
};
|
||||
|
||||
typedef struct task_thread_times_info task_thread_times_info_data_t;
|
||||
typedef struct task_thread_times_info *task_thread_times_info_t;
|
||||
#define TASK_THREAD_TIMES_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_thread_times_info_data_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_ABSOLUTETIME_INFO 1
|
||||
|
||||
struct task_absolutetime_info {
|
||||
uint64_t total_user;
|
||||
uint64_t total_system;
|
||||
uint64_t threads_user; /* existing threads only */
|
||||
uint64_t threads_system;
|
||||
};
|
||||
|
||||
typedef struct task_absolutetime_info task_absolutetime_info_data_t;
|
||||
typedef struct task_absolutetime_info *task_absolutetime_info_t;
|
||||
#define TASK_ABSOLUTETIME_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_absolutetime_info_data_t) / sizeof (natural_t)))
|
||||
|
||||
#define TASK_KERNELMEMORY_INFO 7
|
||||
|
||||
struct task_kernelmemory_info {
|
||||
uint64_t total_palloc; /* private kernel mem alloc'ed */
|
||||
uint64_t total_pfree; /* private kernel mem freed */
|
||||
uint64_t total_salloc; /* shared kernel mem alloc'ed */
|
||||
uint64_t total_sfree; /* shared kernel mem freed */
|
||||
};
|
||||
|
||||
typedef struct task_kernelmemory_info task_kernelmemory_info_data_t;
|
||||
typedef struct task_kernelmemory_info *task_kernelmemory_info_t;
|
||||
#define TASK_KERNELMEMORY_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_kernelmemory_info_data_t) / sizeof (natural_t)))
|
||||
|
||||
#define TASK_SECURITY_TOKEN 13
|
||||
#define TASK_SECURITY_TOKEN_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(security_token_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_AUDIT_TOKEN 15
|
||||
#define TASK_AUDIT_TOKEN_COUNT \
|
||||
(sizeof(audit_token_t) / sizeof(natural_t))
|
||||
|
||||
|
||||
#define TASK_AFFINITY_TAG_INFO 16 /* This is experimental. */
|
||||
|
||||
struct task_affinity_tag_info {
|
||||
integer_t set_count;
|
||||
integer_t min;
|
||||
integer_t max;
|
||||
integer_t task_count;
|
||||
};
|
||||
typedef struct task_affinity_tag_info task_affinity_tag_info_data_t;
|
||||
typedef struct task_affinity_tag_info *task_affinity_tag_info_t;
|
||||
#define TASK_AFFINITY_TAG_INFO_COUNT \
|
||||
(sizeof(task_affinity_tag_info_data_t) / sizeof(natural_t))
|
||||
|
||||
#define TASK_DYLD_INFO 17
|
||||
|
||||
struct task_dyld_info {
|
||||
mach_vm_address_t all_image_info_addr;
|
||||
mach_vm_size_t all_image_info_size;
|
||||
integer_t all_image_info_format;
|
||||
};
|
||||
typedef struct task_dyld_info task_dyld_info_data_t;
|
||||
typedef struct task_dyld_info *task_dyld_info_t;
|
||||
#define TASK_DYLD_INFO_COUNT \
|
||||
(sizeof(task_dyld_info_data_t) / sizeof(natural_t))
|
||||
#define TASK_DYLD_ALL_IMAGE_INFO_32 0 /* format value */
|
||||
#define TASK_DYLD_ALL_IMAGE_INFO_64 1 /* format value */
|
||||
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
|
||||
/* Don't use this, use MACH_TASK_BASIC_INFO instead */
|
||||
/* Compatibility for old 32-bit mach_vm_*_t */
|
||||
#define TASK_BASIC_INFO_64_2 18 /* 64-bit capable basic info */
|
||||
|
||||
struct task_basic_info_64_2 {
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
};
|
||||
typedef struct task_basic_info_64_2 task_basic_info_64_2_data_t;
|
||||
typedef struct task_basic_info_64_2 *task_basic_info_64_2_t;
|
||||
#define TASK_BASIC_INFO_64_2_COUNT \
|
||||
(sizeof(task_basic_info_64_2_data_t) / sizeof(natural_t))
|
||||
#endif
|
||||
|
||||
#define TASK_EXTMOD_INFO 19
|
||||
|
||||
struct task_extmod_info {
|
||||
unsigned char task_uuid[16];
|
||||
vm_extmod_statistics_data_t extmod_statistics;
|
||||
};
|
||||
typedef struct task_extmod_info task_extmod_info_data_t;
|
||||
typedef struct task_extmod_info *task_extmod_info_t;
|
||||
#define TASK_EXTMOD_INFO_COUNT \
|
||||
(sizeof(task_extmod_info_data_t) / sizeof(natural_t))
|
||||
|
||||
|
||||
#define MACH_TASK_BASIC_INFO 20 /* always 64-bit basic info */
|
||||
struct mach_task_basic_info {
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
mach_vm_size_t resident_size_max; /* maximum resident memory size (bytes) */
|
||||
time_value_t user_time; /* total user run time for
|
||||
* terminated threads */
|
||||
time_value_t system_time; /* total system run time for
|
||||
* terminated threads */
|
||||
policy_t policy; /* default policy for new threads */
|
||||
integer_t suspend_count; /* suspend count for task */
|
||||
};
|
||||
typedef struct mach_task_basic_info mach_task_basic_info_data_t;
|
||||
typedef struct mach_task_basic_info *mach_task_basic_info_t;
|
||||
#define MACH_TASK_BASIC_INFO_COUNT \
|
||||
(sizeof(mach_task_basic_info_data_t) / sizeof(natural_t))
|
||||
|
||||
|
||||
#define TASK_POWER_INFO 21
|
||||
|
||||
struct task_power_info {
|
||||
uint64_t total_user;
|
||||
uint64_t total_system;
|
||||
uint64_t task_interrupt_wakeups;
|
||||
uint64_t task_platform_idle_wakeups;
|
||||
uint64_t task_timer_wakeups_bin_1;
|
||||
uint64_t task_timer_wakeups_bin_2;
|
||||
};
|
||||
|
||||
typedef struct task_power_info task_power_info_data_t;
|
||||
typedef struct task_power_info *task_power_info_t;
|
||||
#define TASK_POWER_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_power_info_data_t) / sizeof (natural_t)))
|
||||
|
||||
|
||||
|
||||
#define TASK_VM_INFO 22
|
||||
#define TASK_VM_INFO_PURGEABLE 23
|
||||
struct task_vm_info {
|
||||
mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
|
||||
integer_t region_count; /* number of memory regions */
|
||||
integer_t page_size;
|
||||
mach_vm_size_t resident_size; /* resident memory size (bytes) */
|
||||
mach_vm_size_t resident_size_peak; /* peak resident size (bytes) */
|
||||
|
||||
mach_vm_size_t device;
|
||||
mach_vm_size_t device_peak;
|
||||
mach_vm_size_t internal;
|
||||
mach_vm_size_t internal_peak;
|
||||
mach_vm_size_t external;
|
||||
mach_vm_size_t external_peak;
|
||||
mach_vm_size_t reusable;
|
||||
mach_vm_size_t reusable_peak;
|
||||
mach_vm_size_t purgeable_volatile_pmap;
|
||||
mach_vm_size_t purgeable_volatile_resident;
|
||||
mach_vm_size_t purgeable_volatile_virtual;
|
||||
mach_vm_size_t compressed;
|
||||
mach_vm_size_t compressed_peak;
|
||||
mach_vm_size_t compressed_lifetime;
|
||||
|
||||
/* added for rev1 */
|
||||
mach_vm_size_t phys_footprint;
|
||||
|
||||
/* added for rev2 */
|
||||
mach_vm_address_t min_address;
|
||||
mach_vm_address_t max_address;
|
||||
|
||||
/* added for rev3 */
|
||||
int64_t ledger_phys_footprint_peak;
|
||||
int64_t ledger_purgeable_nonvolatile;
|
||||
int64_t ledger_purgeable_novolatile_compressed;
|
||||
int64_t ledger_purgeable_volatile;
|
||||
int64_t ledger_purgeable_volatile_compressed;
|
||||
int64_t ledger_tag_network_nonvolatile;
|
||||
int64_t ledger_tag_network_nonvolatile_compressed;
|
||||
int64_t ledger_tag_network_volatile;
|
||||
int64_t ledger_tag_network_volatile_compressed;
|
||||
int64_t ledger_tag_media_footprint;
|
||||
int64_t ledger_tag_media_footprint_compressed;
|
||||
int64_t ledger_tag_media_nofootprint;
|
||||
int64_t ledger_tag_media_nofootprint_compressed;
|
||||
int64_t ledger_tag_graphics_footprint;
|
||||
int64_t ledger_tag_graphics_footprint_compressed;
|
||||
int64_t ledger_tag_graphics_nofootprint;
|
||||
int64_t ledger_tag_graphics_nofootprint_compressed;
|
||||
int64_t ledger_tag_neural_footprint;
|
||||
int64_t ledger_tag_neural_footprint_compressed;
|
||||
int64_t ledger_tag_neural_nofootprint;
|
||||
int64_t ledger_tag_neural_nofootprint_compressed;
|
||||
|
||||
/* added for rev4 */
|
||||
uint64_t limit_bytes_remaining;
|
||||
|
||||
/* added for rev5 */
|
||||
integer_t decompressions;
|
||||
};
|
||||
typedef struct task_vm_info task_vm_info_data_t;
|
||||
typedef struct task_vm_info *task_vm_info_t;
|
||||
#define TASK_VM_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_vm_info_data_t) / sizeof (natural_t)))
|
||||
#define TASK_VM_INFO_REV5_COUNT TASK_VM_INFO_COUNT
|
||||
#define TASK_VM_INFO_REV4_COUNT /* doesn't include decompressions */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV5_COUNT - 1))
|
||||
#define TASK_VM_INFO_REV3_COUNT /* doesn't include limit bytes */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV4_COUNT - 2))
|
||||
#define TASK_VM_INFO_REV2_COUNT /* doesn't include extra ledgers info */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV3_COUNT - 42))
|
||||
#define TASK_VM_INFO_REV1_COUNT /* doesn't include min and max address */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV2_COUNT - 4))
|
||||
#define TASK_VM_INFO_REV0_COUNT /* doesn't include phys_footprint */ \
|
||||
((mach_msg_type_number_t) (TASK_VM_INFO_REV1_COUNT - 2))
|
||||
|
||||
typedef struct vm_purgeable_info task_purgable_info_t;
|
||||
|
||||
|
||||
#define TASK_TRACE_MEMORY_INFO 24 /* no longer supported */
|
||||
struct task_trace_memory_info {
|
||||
uint64_t user_memory_address; /* address of start of trace memory buffer */
|
||||
uint64_t buffer_size; /* size of buffer in bytes */
|
||||
uint64_t mailbox_array_size; /* size of mailbox area in bytes */
|
||||
};
|
||||
typedef struct task_trace_memory_info task_trace_memory_info_data_t;
|
||||
typedef struct task_trace_memory_info * task_trace_memory_info_t;
|
||||
#define TASK_TRACE_MEMORY_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_trace_memory_info_data_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_WAIT_STATE_INFO 25 /* deprecated. */
|
||||
struct task_wait_state_info {
|
||||
uint64_t total_wait_state_time; /* Time that all threads past and present have been in a wait state */
|
||||
uint64_t total_wait_sfi_state_time; /* Time that threads have been in SFI wait (should be a subset of total wait state time */
|
||||
uint32_t _reserved[4];
|
||||
};
|
||||
typedef struct task_wait_state_info task_wait_state_info_data_t;
|
||||
typedef struct task_wait_state_info * task_wait_state_info_t;
|
||||
#define TASK_WAIT_STATE_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_wait_state_info_data_t) / sizeof(natural_t)))
|
||||
|
||||
#define TASK_POWER_INFO_V2 26
|
||||
|
||||
typedef struct {
|
||||
uint64_t task_gpu_utilisation;
|
||||
uint64_t task_gpu_stat_reserved0;
|
||||
uint64_t task_gpu_stat_reserved1;
|
||||
uint64_t task_gpu_stat_reserved2;
|
||||
} gpu_energy_data;
|
||||
|
||||
typedef gpu_energy_data *gpu_energy_data_t;
|
||||
struct task_power_info_v2 {
|
||||
task_power_info_data_t cpu_energy;
|
||||
gpu_energy_data gpu_energy;
|
||||
#if defined(__arm__) || defined(__arm64__)
|
||||
uint64_t task_energy;
|
||||
#endif /* defined(__arm__) || defined(__arm64__) */
|
||||
uint64_t task_ptime;
|
||||
uint64_t task_pset_switches;
|
||||
};
|
||||
|
||||
typedef struct task_power_info_v2 task_power_info_v2_data_t;
|
||||
typedef struct task_power_info_v2 *task_power_info_v2_t;
|
||||
#define TASK_POWER_INFO_V2_COUNT_OLD \
|
||||
((mach_msg_type_number_t) (sizeof (task_power_info_v2_data_t) - sizeof(uint64_t)*2) / sizeof (natural_t))
|
||||
#define TASK_POWER_INFO_V2_COUNT \
|
||||
((mach_msg_type_number_t) (sizeof (task_power_info_v2_data_t) / sizeof (natural_t)))
|
||||
|
||||
#define TASK_VM_INFO_PURGEABLE_ACCOUNT 27 /* Used for xnu purgeable vm unit tests */
|
||||
|
||||
|
||||
#define TASK_FLAGS_INFO 28 /* return t_flags field */
|
||||
struct task_flags_info {
|
||||
uint32_t flags; /* task flags */
|
||||
};
|
||||
typedef struct task_flags_info task_flags_info_data_t;
|
||||
typedef struct task_flags_info * task_flags_info_t;
|
||||
#define TASK_FLAGS_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(task_flags_info_data_t) / sizeof (natural_t)))
|
||||
|
||||
#define TF_LP64 0x00000001 /* task has 64-bit addressing */
|
||||
#define TF_64B_DATA 0x00000002 /* task has 64-bit data registers */
|
||||
|
||||
#define TASK_DEBUG_INFO_INTERNAL 29 /* Used for kernel internal development tests. */
|
||||
|
||||
|
||||
/*
|
||||
* Type to control EXC_GUARD delivery options for a task
|
||||
* via task_get/set_exc_guard_behavior interface(s).
|
||||
*/
|
||||
typedef uint32_t task_exc_guard_behavior_t;
|
||||
|
||||
/* EXC_GUARD optional delivery settings on a per-task basis */
|
||||
#define TASK_EXC_GUARD_VM_DELIVER 0x01 /* Deliver virtual memory EXC_GUARD exceptions */
|
||||
#define TASK_EXC_GUARD_VM_ONCE 0x02 /* Deliver them only once */
|
||||
#define TASK_EXC_GUARD_VM_CORPSE 0x04 /* Deliver them via a forked corpse */
|
||||
#define TASK_EXC_GUARD_VM_FATAL 0x08 /* Virtual Memory EXC_GUARD delivery is fatal */
|
||||
#define TASK_EXC_GUARD_VM_ALL 0x0f
|
||||
|
||||
#define TASK_EXC_GUARD_MP_DELIVER 0x10 /* Deliver mach port EXC_GUARD exceptions */
|
||||
#define TASK_EXC_GUARD_MP_ONCE 0x20 /* Deliver them only once */
|
||||
#define TASK_EXC_GUARD_MP_CORPSE 0x40 /* Deliver them via a forked corpse */
|
||||
#define TASK_EXC_GUARD_MP_FATAL 0x80 /* mach port EXC_GUARD delivery is fatal */
|
||||
#define TASK_EXC_GUARD_MP_ALL 0xf0
|
||||
|
||||
#define TASK_EXC_GUARD_ALL 0xff /* All optional deliver settings */
|
||||
|
||||
|
||||
/*
|
||||
* Obsolete interfaces.
|
||||
*/
|
||||
|
||||
#define TASK_SCHED_TIMESHARE_INFO 10
|
||||
#define TASK_SCHED_RR_INFO 11
|
||||
#define TASK_SCHED_FIFO_INFO 12
|
||||
|
||||
#define TASK_SCHED_INFO 14
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif /* _MACH_TASK_INFO_H_ */
|
||||
186
lib/libc/include/aarch64-macos-gnu/mach/task_policy.h
Normal file
186
lib/libc/include/aarch64-macos-gnu/mach/task_policy.h
Normal file
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2005 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@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_TASK_POLICY_H_
|
||||
#define _MACH_TASK_POLICY_H_
|
||||
|
||||
#include <mach/mach_types.h>
|
||||
|
||||
/*
|
||||
* These are the calls for accessing the policy parameters
|
||||
* of a particular task.
|
||||
*
|
||||
* The extra 'get_default' parameter to the second call is
|
||||
* IN/OUT as follows:
|
||||
* 1) if asserted on the way in it indicates that the default
|
||||
* values should be returned, not the ones currently set, in
|
||||
* this case 'get_default' will always be asserted on return;
|
||||
* 2) if unasserted on the way in, the current settings are
|
||||
* desired and if still unasserted on return, then the info
|
||||
* returned reflects the current settings, otherwise if
|
||||
* 'get_default' returns asserted, it means that there are no
|
||||
* current settings due to other parameters taking precedence,
|
||||
* and the default ones are being returned instead.
|
||||
*/
|
||||
|
||||
typedef natural_t task_policy_flavor_t;
|
||||
typedef integer_t *task_policy_t;
|
||||
|
||||
/*
|
||||
* kern_return_t task_policy_set(
|
||||
* task_t task,
|
||||
* task_policy_flavor_t flavor,
|
||||
* task_policy_t policy_info,
|
||||
* mach_msg_type_number_t count);
|
||||
*
|
||||
* kern_return_t task_policy_get(
|
||||
* task_t task,
|
||||
* task_policy_flavor_t flavor,
|
||||
* task_policy_t policy_info,
|
||||
* mach_msg_type_number_t *count,
|
||||
* boolean_t *get_default);
|
||||
*/
|
||||
|
||||
/*
|
||||
* Defined flavors.
|
||||
*/
|
||||
/*
|
||||
* TASK_CATEGORY_POLICY:
|
||||
*
|
||||
* This provides information to the kernel about the role
|
||||
* of the task in the system.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* role: Enumerated as follows:
|
||||
*
|
||||
* TASK_UNSPECIFIED is the default, since the role is not
|
||||
* inherited from the parent.
|
||||
*
|
||||
* TASK_FOREGROUND_APPLICATION should be assigned when the
|
||||
* task is a normal UI application in the foreground from
|
||||
* the HI point of view.
|
||||
* **N.B. There may be more than one of these at a given time.
|
||||
*
|
||||
* TASK_BACKGROUND_APPLICATION should be assigned when the
|
||||
* task is a normal UI application in the background from
|
||||
* the HI point of view.
|
||||
*
|
||||
* TASK_CONTROL_APPLICATION should be assigned to the unique
|
||||
* UI application which implements the pop-up application dialog.
|
||||
* There can only be one task at a time with this designation,
|
||||
* which is assigned FCFS.
|
||||
*
|
||||
* TASK_GRAPHICS_SERVER should be assigned to the graphics
|
||||
* management (window) server. There can only be one task at
|
||||
* a time with this designation, which is assigned FCFS.
|
||||
*/
|
||||
|
||||
#define TASK_CATEGORY_POLICY 1
|
||||
|
||||
#define TASK_SUPPRESSION_POLICY 3
|
||||
#define TASK_POLICY_STATE 4
|
||||
#define TASK_BASE_QOS_POLICY 8
|
||||
#define TASK_OVERRIDE_QOS_POLICY 9
|
||||
#define TASK_BASE_LATENCY_QOS_POLICY 10
|
||||
#define TASK_BASE_THROUGHPUT_QOS_POLICY 11
|
||||
|
||||
typedef enum task_role {
|
||||
TASK_RENICED = -1,
|
||||
TASK_UNSPECIFIED = 0,
|
||||
TASK_FOREGROUND_APPLICATION = 1,
|
||||
TASK_BACKGROUND_APPLICATION = 2,
|
||||
TASK_CONTROL_APPLICATION = 3,
|
||||
TASK_GRAPHICS_SERVER = 4,
|
||||
TASK_THROTTLE_APPLICATION = 5,
|
||||
TASK_NONUI_APPLICATION = 6,
|
||||
TASK_DEFAULT_APPLICATION = 7,
|
||||
TASK_DARWINBG_APPLICATION = 8,
|
||||
} task_role_t;
|
||||
|
||||
struct task_category_policy {
|
||||
task_role_t role;
|
||||
};
|
||||
|
||||
typedef struct task_category_policy task_category_policy_data_t;
|
||||
typedef struct task_category_policy *task_category_policy_t;
|
||||
|
||||
#define TASK_CATEGORY_POLICY_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (task_category_policy_data_t) / sizeof (integer_t)))
|
||||
|
||||
|
||||
enum task_latency_qos {
|
||||
LATENCY_QOS_TIER_UNSPECIFIED = 0x0,
|
||||
LATENCY_QOS_TIER_0 = ((0xFF << 16) | 1),
|
||||
LATENCY_QOS_TIER_1 = ((0xFF << 16) | 2),
|
||||
LATENCY_QOS_TIER_2 = ((0xFF << 16) | 3),
|
||||
LATENCY_QOS_TIER_3 = ((0xFF << 16) | 4),
|
||||
LATENCY_QOS_TIER_4 = ((0xFF << 16) | 5),
|
||||
LATENCY_QOS_TIER_5 = ((0xFF << 16) | 6)
|
||||
};
|
||||
typedef integer_t task_latency_qos_t;
|
||||
enum task_throughput_qos {
|
||||
THROUGHPUT_QOS_TIER_UNSPECIFIED = 0x0,
|
||||
THROUGHPUT_QOS_TIER_0 = ((0xFE << 16) | 1),
|
||||
THROUGHPUT_QOS_TIER_1 = ((0xFE << 16) | 2),
|
||||
THROUGHPUT_QOS_TIER_2 = ((0xFE << 16) | 3),
|
||||
THROUGHPUT_QOS_TIER_3 = ((0xFE << 16) | 4),
|
||||
THROUGHPUT_QOS_TIER_4 = ((0xFE << 16) | 5),
|
||||
THROUGHPUT_QOS_TIER_5 = ((0xFE << 16) | 6),
|
||||
};
|
||||
|
||||
#define LATENCY_QOS_LAUNCH_DEFAULT_TIER LATENCY_QOS_TIER_3
|
||||
#define THROUGHPUT_QOS_LAUNCH_DEFAULT_TIER THROUGHPUT_QOS_TIER_3
|
||||
|
||||
typedef integer_t task_throughput_qos_t;
|
||||
|
||||
struct task_qos_policy {
|
||||
task_latency_qos_t task_latency_qos_tier;
|
||||
task_throughput_qos_t task_throughput_qos_tier;
|
||||
};
|
||||
|
||||
typedef struct task_qos_policy *task_qos_policy_t;
|
||||
#define TASK_QOS_POLICY_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (struct task_qos_policy) / sizeof (integer_t)))
|
||||
|
||||
/* These should be removed - they belong in proc_info.h */
|
||||
#define PROC_FLAG_DARWINBG 0x8000 /* process in darwin background */
|
||||
#define PROC_FLAG_EXT_DARWINBG 0x10000 /* process in darwin background - external enforcement */
|
||||
#define PROC_FLAG_IOS_APPLEDAEMON 0x20000 /* process is apple ios daemon */
|
||||
#define PROC_FLAG_IOS_IMPPROMOTION 0x80000 /* process is apple ios daemon */
|
||||
#define PROC_FLAG_ADAPTIVE 0x100000 /* Process is adaptive */
|
||||
#define PROC_FLAG_ADAPTIVE_IMPORTANT 0x200000 /* Process is adaptive, and is currently important */
|
||||
#define PROC_FLAG_IMPORTANCE_DONOR 0x400000 /* Process is marked as an importance donor */
|
||||
#define PROC_FLAG_SUPPRESSED 0x800000 /* Process is suppressed */
|
||||
#define PROC_FLAG_APPLICATION 0x1000000 /* Process is an application */
|
||||
#define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* _MACH_TASK_POLICY_H_ */
|
||||
133
lib/libc/include/aarch64-macos-gnu/mach/task_special_ports.h
Normal file
133
lib/libc/include/aarch64-macos-gnu/mach/task_special_ports.h
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2010 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/task_special_ports.h
|
||||
*
|
||||
* Defines codes for special_purpose task ports. These are NOT
|
||||
* port identifiers - they are only used for the task_get_special_port
|
||||
* and task_set_special_port routines.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_TASK_SPECIAL_PORTS_H_
|
||||
#define _MACH_TASK_SPECIAL_PORTS_H_
|
||||
|
||||
typedef int task_special_port_t;
|
||||
|
||||
#define TASK_KERNEL_PORT 1 /* The full task port for task. */
|
||||
|
||||
#define TASK_HOST_PORT 2 /* The host (priv) port for task. */
|
||||
|
||||
#define TASK_NAME_PORT 3 /* The name port for task. */
|
||||
|
||||
#define TASK_BOOTSTRAP_PORT 4 /* Bootstrap environment for task. */
|
||||
|
||||
#define TASK_INSPECT_PORT 5 /* The inspect port for task. */
|
||||
|
||||
#define TASK_READ_PORT 6 /* The read port for task. */
|
||||
|
||||
|
||||
|
||||
#define TASK_SEATBELT_PORT 7 /* Seatbelt compiler/DEM port for task. */
|
||||
|
||||
/* PORT 8 was the GSSD TASK PORT which transformed to a host port */
|
||||
|
||||
#define TASK_ACCESS_PORT 9 /* Permission check for task_for_pid. */
|
||||
|
||||
#define TASK_DEBUG_CONTROL_PORT 10 /* debug control port */
|
||||
|
||||
#define TASK_RESOURCE_NOTIFY_PORT 11 /* overrides host special RN port */
|
||||
|
||||
#define TASK_MAX_SPECIAL_PORT TASK_RESOURCE_NOTIFY_PORT
|
||||
|
||||
/*
|
||||
* Definitions for ease of use
|
||||
*/
|
||||
|
||||
#define task_get_kernel_port(task, port) \
|
||||
(task_get_special_port((task), TASK_KERNEL_PORT, (port)))
|
||||
|
||||
#define task_set_kernel_port(task, port) \
|
||||
(task_set_special_port((task), TASK_KERNEL_PORT, (port)))
|
||||
|
||||
#define task_get_host_port(task, port) \
|
||||
(task_get_special_port((task), TASK_HOST_PORT, (port)))
|
||||
|
||||
#define task_set_host_port(task, port) \
|
||||
(task_set_special_port((task), TASK_HOST_PORT, (port)))
|
||||
|
||||
#define task_get_bootstrap_port(task, port) \
|
||||
(task_get_special_port((task), TASK_BOOTSTRAP_PORT, (port)))
|
||||
|
||||
#define task_get_debug_control_port(task, port) \
|
||||
(task_get_special_port((task), TASK_DEBUG_CONTROL_PORT, (port)))
|
||||
|
||||
#define task_set_bootstrap_port(task, port) \
|
||||
(task_set_special_port((task), TASK_BOOTSTRAP_PORT, (port)))
|
||||
|
||||
#define task_get_task_access_port(task, port) \
|
||||
(task_get_special_port((task), TASK_ACCESS_PORT, (port)))
|
||||
|
||||
#define task_set_task_access_port(task, port) \
|
||||
(task_set_special_port((task), TASK_ACCESS_PORT, (port)))
|
||||
|
||||
#define task_set_task_debug_control_port(task, port) \
|
||||
(task_set_special_port((task), TASK_DEBUG_CONTROL_PORT, (port)))
|
||||
|
||||
|
||||
#endif /* _MACH_TASK_SPECIAL_PORTS_H_ */
|
||||
1386
lib/libc/include/aarch64-macos-gnu/mach/thread_act.h
Normal file
1386
lib/libc/include/aarch64-macos-gnu/mach/thread_act.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2002 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/thread_special_ports.h
|
||||
*
|
||||
* Defines codes for special_purpose thread ports. These are NOT
|
||||
* port identifiers - they are only used for the thread_get_special_port
|
||||
* and thread_set_special_port routines.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_THREAD_SPECIAL_PORTS_H_
|
||||
#define _MACH_THREAD_SPECIAL_PORTS_H_
|
||||
|
||||
#define THREAD_KERNEL_PORT 1 /* The full thread port for thread. */
|
||||
|
||||
#define THREAD_INSPECT_PORT 2 /* The inspect port for thread. */
|
||||
|
||||
#define THREAD_READ_PORT 3 /* The read port for thread. */
|
||||
|
||||
/*
|
||||
* Definitions for ease of use
|
||||
*/
|
||||
|
||||
#define thread_get_kernel_port(thread, port) \
|
||||
(thread_get_special_port((thread), THREAD_KERNEL_PORT, (port)))
|
||||
|
||||
#define thread_set_kernel_port(thread, port) \
|
||||
(thread_set_special_port((thread), THREAD_KERNEL_PORT, (port)))
|
||||
|
||||
#endif /* _MACH_THREAD_SPECIAL_PORTS_H_ */
|
||||
100
lib/libc/include/aarch64-macos-gnu/mach/thread_status.h
Normal file
100
lib/libc/include/aarch64-macos-gnu/mach/thread_status.h
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2002 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/thread_status.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
*
|
||||
* This file contains the structure definitions for the user-visible
|
||||
* thread state. This thread state is examined with the thread_get_state
|
||||
* kernel call and may be changed with the thread_set_state kernel call.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_THREAD_STATUS_H_
|
||||
#define _MACH_THREAD_STATUS_H_
|
||||
|
||||
/*
|
||||
* The actual structure that comprises the thread state is defined
|
||||
* in the machine dependent module.
|
||||
*/
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/machine/thread_status.h>
|
||||
#include <mach/machine/thread_state.h>
|
||||
|
||||
/*
|
||||
* Generic definition for machine-dependent thread status.
|
||||
*/
|
||||
|
||||
typedef natural_t *thread_state_t; /* Variable-length array */
|
||||
|
||||
/* THREAD_STATE_MAX is now defined in <mach/machine/thread_state.h> */
|
||||
typedef natural_t thread_state_data_t[THREAD_STATE_MAX];
|
||||
|
||||
#define THREAD_STATE_FLAVOR_LIST 0 /* List of valid flavors */
|
||||
#define THREAD_STATE_FLAVOR_LIST_NEW 128
|
||||
#define THREAD_STATE_FLAVOR_LIST_10_9 129
|
||||
#define THREAD_STATE_FLAVOR_LIST_10_13 130
|
||||
#define THREAD_STATE_FLAVOR_LIST_10_15 131
|
||||
|
||||
typedef int thread_state_flavor_t;
|
||||
typedef thread_state_flavor_t *thread_state_flavor_array_t;
|
||||
|
||||
#define THREAD_CONVERT_THREAD_STATE_TO_SELF 1
|
||||
#define THREAD_CONVERT_THREAD_STATE_FROM_SELF 2
|
||||
|
||||
#endif /* _MACH_THREAD_STATUS_H_ */
|
||||
153
lib/libc/include/aarch64-macos-gnu/mach/vm_prot.h
Normal file
153
lib/libc/include/aarch64-macos-gnu/mach/vm_prot.h
Normal file
@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2002 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/vm_prot.h
|
||||
* Author: Avadis Tevanian, Jr., Michael Wayne Young
|
||||
*
|
||||
* Virtual memory protection definitions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_VM_PROT_H_
|
||||
#define _MACH_VM_PROT_H_
|
||||
|
||||
/*
|
||||
* Types defined:
|
||||
*
|
||||
* vm_prot_t VM protection values.
|
||||
*/
|
||||
|
||||
typedef int vm_prot_t;
|
||||
|
||||
/*
|
||||
* Protection values, defined as bits within the vm_prot_t type
|
||||
*/
|
||||
|
||||
#define VM_PROT_NONE ((vm_prot_t) 0x00)
|
||||
|
||||
#define VM_PROT_READ ((vm_prot_t) 0x01) /* read permission */
|
||||
#define VM_PROT_WRITE ((vm_prot_t) 0x02) /* write permission */
|
||||
#define VM_PROT_EXECUTE ((vm_prot_t) 0x04) /* execute permission */
|
||||
|
||||
/*
|
||||
* The default protection for newly-created virtual memory
|
||||
*/
|
||||
|
||||
#define VM_PROT_DEFAULT (VM_PROT_READ|VM_PROT_WRITE)
|
||||
|
||||
/*
|
||||
* The maximum privileges possible, for parameter checking.
|
||||
*/
|
||||
|
||||
#define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
|
||||
|
||||
/*
|
||||
* An invalid protection value.
|
||||
* Used only by memory_object_lock_request to indicate no change
|
||||
* to page locks. Using -1 here is a bad idea because it
|
||||
* looks like VM_PROT_ALL and then some.
|
||||
*/
|
||||
|
||||
#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x08)
|
||||
|
||||
/*
|
||||
* When a caller finds that he cannot obtain write permission on a
|
||||
* mapped entry, the following flag can be used. The entry will
|
||||
* be made "needs copy" effectively copying the object (using COW),
|
||||
* and write permission will be added to the maximum protections
|
||||
* for the associated entry.
|
||||
*/
|
||||
|
||||
#define VM_PROT_COPY ((vm_prot_t) 0x10)
|
||||
|
||||
|
||||
/*
|
||||
* Another invalid protection value.
|
||||
* Used only by memory_object_data_request upon an object
|
||||
* which has specified a copy_call copy strategy. It is used
|
||||
* when the kernel wants a page belonging to a copy of the
|
||||
* object, and is only asking the object as a result of
|
||||
* following a shadow chain. This solves the race between pages
|
||||
* being pushed up by the memory manager and the kernel
|
||||
* walking down the shadow chain.
|
||||
*/
|
||||
|
||||
#define VM_PROT_WANTS_COPY ((vm_prot_t) 0x10)
|
||||
|
||||
|
||||
/*
|
||||
* Another invalid protection value.
|
||||
* Indicates that the other protection bits are to be applied as a mask
|
||||
* against the actual protection bits of the map entry.
|
||||
*/
|
||||
#define VM_PROT_IS_MASK ((vm_prot_t) 0x40)
|
||||
|
||||
/*
|
||||
* Another invalid protection value to support execute-only protection.
|
||||
* VM_PROT_STRIP_READ is a special marker that tells mprotect to not
|
||||
* set VM_PROT_READ. We have to do it this way because existing code
|
||||
* expects the system to set VM_PROT_READ if VM_PROT_EXECUTE is set.
|
||||
* VM_PROT_EXECUTE_ONLY is just a convenience value to indicate that
|
||||
* the memory should be executable and explicitly not readable. It will
|
||||
* be ignored on platforms that do not support this type of protection.
|
||||
*/
|
||||
#define VM_PROT_STRIP_READ ((vm_prot_t) 0x80)
|
||||
#define VM_PROT_EXECUTE_ONLY (VM_PROT_EXECUTE|VM_PROT_STRIP_READ)
|
||||
|
||||
|
||||
#endif /* _MACH_VM_PROT_H_ */
|
||||
550
lib/libc/include/aarch64-macos-gnu/mach/vm_statistics.h
Normal file
550
lib/libc/include/aarch64-macos-gnu/mach/vm_statistics.h
Normal file
@ -0,0 +1,550 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2020 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*/
|
||||
/*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* File: mach/vm_statistics.h
|
||||
* Author: Avadis Tevanian, Jr., Michael Wayne Young, David Golub
|
||||
*
|
||||
* Virtual memory statistics structure.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_VM_STATISTICS_H_
|
||||
#define _MACH_VM_STATISTICS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/machine/kern_return.h>
|
||||
|
||||
/*
|
||||
* vm_statistics
|
||||
*
|
||||
* History:
|
||||
* rev0 - original structure.
|
||||
* rev1 - added purgable info (purgable_count and purges).
|
||||
* rev2 - added speculative_count.
|
||||
*
|
||||
* Note: you cannot add any new fields to this structure. Add them below in
|
||||
* vm_statistics64.
|
||||
*/
|
||||
|
||||
struct vm_statistics {
|
||||
natural_t free_count; /* # of pages free */
|
||||
natural_t active_count; /* # of pages active */
|
||||
natural_t inactive_count; /* # of pages inactive */
|
||||
natural_t wire_count; /* # of pages wired down */
|
||||
natural_t zero_fill_count; /* # of zero fill pages */
|
||||
natural_t reactivations; /* # of pages reactivated */
|
||||
natural_t pageins; /* # of pageins */
|
||||
natural_t pageouts; /* # of pageouts */
|
||||
natural_t faults; /* # of faults */
|
||||
natural_t cow_faults; /* # of copy-on-writes */
|
||||
natural_t lookups; /* object cache lookups */
|
||||
natural_t hits; /* object cache hits */
|
||||
|
||||
/* added for rev1 */
|
||||
natural_t purgeable_count; /* # of pages purgeable */
|
||||
natural_t purges; /* # of pages purged */
|
||||
|
||||
/* added for rev2 */
|
||||
/*
|
||||
* NB: speculative pages are already accounted for in "free_count",
|
||||
* so "speculative_count" is the number of "free" pages that are
|
||||
* used to hold data that was read speculatively from disk but
|
||||
* haven't actually been used by anyone so far.
|
||||
*/
|
||||
natural_t speculative_count; /* # of pages speculative */
|
||||
};
|
||||
|
||||
/* Used by all architectures */
|
||||
typedef struct vm_statistics *vm_statistics_t;
|
||||
typedef struct vm_statistics vm_statistics_data_t;
|
||||
|
||||
/*
|
||||
* vm_statistics64
|
||||
*
|
||||
* History:
|
||||
* rev0 - original structure.
|
||||
* rev1 - added purgable info (purgable_count and purges).
|
||||
* rev2 - added speculative_count.
|
||||
* ----
|
||||
* rev3 - changed name to vm_statistics64.
|
||||
* changed some fields in structure to 64-bit on
|
||||
* arm, i386 and x86_64 architectures.
|
||||
* rev4 - require 64-bit alignment for efficient access
|
||||
* in the kernel. No change to reported data.
|
||||
*
|
||||
*/
|
||||
|
||||
struct vm_statistics64 {
|
||||
natural_t free_count; /* # of pages free */
|
||||
natural_t active_count; /* # of pages active */
|
||||
natural_t inactive_count; /* # of pages inactive */
|
||||
natural_t wire_count; /* # of pages wired down */
|
||||
uint64_t zero_fill_count; /* # of zero fill pages */
|
||||
uint64_t reactivations; /* # of pages reactivated */
|
||||
uint64_t pageins; /* # of pageins */
|
||||
uint64_t pageouts; /* # of pageouts */
|
||||
uint64_t faults; /* # of faults */
|
||||
uint64_t cow_faults; /* # of copy-on-writes */
|
||||
uint64_t lookups; /* object cache lookups */
|
||||
uint64_t hits; /* object cache hits */
|
||||
uint64_t purges; /* # of pages purged */
|
||||
natural_t purgeable_count; /* # of pages purgeable */
|
||||
/*
|
||||
* NB: speculative pages are already accounted for in "free_count",
|
||||
* so "speculative_count" is the number of "free" pages that are
|
||||
* used to hold data that was read speculatively from disk but
|
||||
* haven't actually been used by anyone so far.
|
||||
*/
|
||||
natural_t speculative_count; /* # of pages speculative */
|
||||
|
||||
/* added for rev1 */
|
||||
uint64_t decompressions; /* # of pages decompressed */
|
||||
uint64_t compressions; /* # of pages compressed */
|
||||
uint64_t swapins; /* # of pages swapped in (via compression segments) */
|
||||
uint64_t swapouts; /* # of pages swapped out (via compression segments) */
|
||||
natural_t compressor_page_count; /* # of pages used by the compressed pager to hold all the compressed data */
|
||||
natural_t throttled_count; /* # of pages throttled */
|
||||
natural_t external_page_count; /* # of pages that are file-backed (non-swap) */
|
||||
natural_t internal_page_count; /* # of pages that are anonymous */
|
||||
uint64_t total_uncompressed_pages_in_compressor; /* # of pages (uncompressed) held within the compressor. */
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
typedef struct vm_statistics64 *vm_statistics64_t;
|
||||
typedef struct vm_statistics64 vm_statistics64_data_t;
|
||||
|
||||
kern_return_t vm_stats(void *info, unsigned int *count);
|
||||
|
||||
/*
|
||||
* VM_STATISTICS_TRUNCATE_TO_32_BIT
|
||||
*
|
||||
* This is used by host_statistics() to truncate and peg the 64-bit in-kernel values from
|
||||
* vm_statistics64 to the 32-bit values of the older structure above (vm_statistics).
|
||||
*/
|
||||
#define VM_STATISTICS_TRUNCATE_TO_32_BIT(value) ((uint32_t)(((value) > UINT32_MAX ) ? UINT32_MAX : (value)))
|
||||
|
||||
/*
|
||||
* vm_extmod_statistics
|
||||
*
|
||||
* Structure to record modifications to a task by an
|
||||
* external agent.
|
||||
*
|
||||
* History:
|
||||
* rev0 - original structure.
|
||||
*/
|
||||
|
||||
struct vm_extmod_statistics {
|
||||
int64_t task_for_pid_count; /* # of times task port was looked up */
|
||||
int64_t task_for_pid_caller_count; /* # of times this task called task_for_pid */
|
||||
int64_t thread_creation_count; /* # of threads created in task */
|
||||
int64_t thread_creation_caller_count; /* # of threads created by task */
|
||||
int64_t thread_set_state_count; /* # of register state sets in task */
|
||||
int64_t thread_set_state_caller_count; /* # of register state sets by task */
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
typedef struct vm_extmod_statistics *vm_extmod_statistics_t;
|
||||
typedef struct vm_extmod_statistics vm_extmod_statistics_data_t;
|
||||
|
||||
typedef struct vm_purgeable_stat {
|
||||
uint64_t count;
|
||||
uint64_t size;
|
||||
}vm_purgeable_stat_t;
|
||||
|
||||
struct vm_purgeable_info {
|
||||
vm_purgeable_stat_t fifo_data[8];
|
||||
vm_purgeable_stat_t obsolete_data;
|
||||
vm_purgeable_stat_t lifo_data[8];
|
||||
};
|
||||
|
||||
typedef struct vm_purgeable_info *vm_purgeable_info_t;
|
||||
|
||||
/* included for the vm_map_page_query call */
|
||||
|
||||
#define VM_PAGE_QUERY_PAGE_PRESENT 0x1
|
||||
#define VM_PAGE_QUERY_PAGE_FICTITIOUS 0x2
|
||||
#define VM_PAGE_QUERY_PAGE_REF 0x4
|
||||
#define VM_PAGE_QUERY_PAGE_DIRTY 0x8
|
||||
#define VM_PAGE_QUERY_PAGE_PAGED_OUT 0x10
|
||||
#define VM_PAGE_QUERY_PAGE_COPIED 0x20
|
||||
#define VM_PAGE_QUERY_PAGE_SPECULATIVE 0x40
|
||||
#define VM_PAGE_QUERY_PAGE_EXTERNAL 0x80
|
||||
#define VM_PAGE_QUERY_PAGE_CS_VALIDATED 0x100
|
||||
#define VM_PAGE_QUERY_PAGE_CS_TAINTED 0x200
|
||||
#define VM_PAGE_QUERY_PAGE_CS_NX 0x400
|
||||
#define VM_PAGE_QUERY_PAGE_REUSABLE 0x800
|
||||
|
||||
|
||||
/*
|
||||
* VM allocation flags:
|
||||
*
|
||||
* VM_FLAGS_FIXED
|
||||
* (really the absence of VM_FLAGS_ANYWHERE)
|
||||
* Allocate new VM region at the specified virtual address, if possible.
|
||||
*
|
||||
* VM_FLAGS_ANYWHERE
|
||||
* Allocate new VM region anywhere it would fit in the address space.
|
||||
*
|
||||
* VM_FLAGS_PURGABLE
|
||||
* Create a purgable VM object for that new VM region.
|
||||
*
|
||||
* VM_FLAGS_4GB_CHUNK
|
||||
* The new VM region will be chunked up into 4GB sized pieces.
|
||||
*
|
||||
* VM_FLAGS_NO_PMAP_CHECK
|
||||
* (for DEBUG kernel config only, ignored for other configs)
|
||||
* Do not check that there is no stale pmap mapping for the new VM region.
|
||||
* This is useful for kernel memory allocations at bootstrap when building
|
||||
* the initial kernel address space while some memory is already in use.
|
||||
*
|
||||
* VM_FLAGS_OVERWRITE
|
||||
* The new VM region can replace existing VM regions if necessary
|
||||
* (to be used in combination with VM_FLAGS_FIXED).
|
||||
*
|
||||
* VM_FLAGS_NO_CACHE
|
||||
* Pages brought in to this VM region are placed on the speculative
|
||||
* queue instead of the active queue. In other words, they are not
|
||||
* cached so that they will be stolen first if memory runs low.
|
||||
*/
|
||||
|
||||
#define VM_FLAGS_FIXED 0x0000
|
||||
#define VM_FLAGS_ANYWHERE 0x0001
|
||||
#define VM_FLAGS_PURGABLE 0x0002
|
||||
#define VM_FLAGS_4GB_CHUNK 0x0004
|
||||
#define VM_FLAGS_RANDOM_ADDR 0x0008
|
||||
#define VM_FLAGS_NO_CACHE 0x0010
|
||||
#define VM_FLAGS_RESILIENT_CODESIGN 0x0020
|
||||
#define VM_FLAGS_RESILIENT_MEDIA 0x0040
|
||||
#define VM_FLAGS_OVERWRITE 0x4000 /* delete any existing mappings first */
|
||||
/*
|
||||
* VM_FLAGS_SUPERPAGE_MASK
|
||||
* 3 bits that specify whether large pages should be used instead of
|
||||
* base pages (!=0), as well as the requested page size.
|
||||
*/
|
||||
#define VM_FLAGS_SUPERPAGE_MASK 0x70000 /* bits 0x10000, 0x20000, 0x40000 */
|
||||
#define VM_FLAGS_RETURN_DATA_ADDR 0x100000 /* Return address of target data, rather than base of page */
|
||||
#define VM_FLAGS_RETURN_4K_DATA_ADDR 0x800000 /* 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
|
||||
#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 | \
|
||||
VM_FLAGS_PURGABLE | \
|
||||
VM_FLAGS_4GB_CHUNK | \
|
||||
VM_FLAGS_RANDOM_ADDR | \
|
||||
VM_FLAGS_NO_CACHE | \
|
||||
VM_FLAGS_OVERWRITE | \
|
||||
VM_FLAGS_SUPERPAGE_MASK | \
|
||||
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 | \
|
||||
VM_FLAGS_OVERWRITE| \
|
||||
VM_FLAGS_RETURN_DATA_ADDR | \
|
||||
VM_FLAGS_RESILIENT_CODESIGN | \
|
||||
VM_FLAGS_RESILIENT_MEDIA)
|
||||
|
||||
#define VM_FLAGS_SUPERPAGE_SHIFT 16
|
||||
#define SUPERPAGE_NONE 0 /* no superpages, if all bits are 0 */
|
||||
#define SUPERPAGE_SIZE_ANY 1
|
||||
#define VM_FLAGS_SUPERPAGE_NONE (SUPERPAGE_NONE << VM_FLAGS_SUPERPAGE_SHIFT)
|
||||
#define VM_FLAGS_SUPERPAGE_SIZE_ANY (SUPERPAGE_SIZE_ANY << VM_FLAGS_SUPERPAGE_SHIFT)
|
||||
#define SUPERPAGE_SIZE_2MB 2
|
||||
#define VM_FLAGS_SUPERPAGE_SIZE_2MB (SUPERPAGE_SIZE_2MB<<VM_FLAGS_SUPERPAGE_SHIFT)
|
||||
|
||||
/*
|
||||
* EXC_GUARD definitions for virtual memory.
|
||||
*/
|
||||
#define GUARD_TYPE_VIRT_MEMORY 0x5
|
||||
|
||||
/* Reasons for exception for virtual memory */
|
||||
enum virtual_memory_guard_exception_codes {
|
||||
kGUARD_EXC_DEALLOC_GAP = 1u << 0
|
||||
};
|
||||
|
||||
|
||||
/* current accounting postmark */
|
||||
#define __VM_LEDGER_ACCOUNTING_POSTMARK 2019032600
|
||||
|
||||
/* discrete values: */
|
||||
#define VM_LEDGER_TAG_NONE 0x00000000
|
||||
#define VM_LEDGER_TAG_DEFAULT 0x00000001
|
||||
#define VM_LEDGER_TAG_NETWORK 0x00000002
|
||||
#define VM_LEDGER_TAG_MEDIA 0x00000003
|
||||
#define VM_LEDGER_TAG_GRAPHICS 0x00000004
|
||||
#define VM_LEDGER_TAG_NEURAL 0x00000005
|
||||
#define VM_LEDGER_TAG_MAX 0x00000005
|
||||
/* individual bits: */
|
||||
#define VM_LEDGER_FLAG_NO_FOOTPRINT 0x00000001
|
||||
#define VM_LEDGER_FLAGS (VM_LEDGER_FLAG_NO_FOOTPRINT)
|
||||
|
||||
|
||||
#define VM_MEMORY_MALLOC 1
|
||||
#define VM_MEMORY_MALLOC_SMALL 2
|
||||
#define VM_MEMORY_MALLOC_LARGE 3
|
||||
#define VM_MEMORY_MALLOC_HUGE 4
|
||||
#define VM_MEMORY_SBRK 5// uninteresting -- no one should call
|
||||
#define VM_MEMORY_REALLOC 6
|
||||
#define VM_MEMORY_MALLOC_TINY 7
|
||||
#define VM_MEMORY_MALLOC_LARGE_REUSABLE 8
|
||||
#define VM_MEMORY_MALLOC_LARGE_REUSED 9
|
||||
|
||||
#define VM_MEMORY_ANALYSIS_TOOL 10
|
||||
|
||||
#define VM_MEMORY_MALLOC_NANO 11
|
||||
#define VM_MEMORY_MALLOC_MEDIUM 12
|
||||
#define VM_MEMORY_MALLOC_PGUARD 13
|
||||
|
||||
#define VM_MEMORY_MACH_MSG 20
|
||||
#define VM_MEMORY_IOKIT 21
|
||||
#define VM_MEMORY_STACK 30
|
||||
#define VM_MEMORY_GUARD 31
|
||||
#define VM_MEMORY_SHARED_PMAP 32
|
||||
/* memory containing a dylib */
|
||||
#define VM_MEMORY_DYLIB 33
|
||||
#define VM_MEMORY_OBJC_DISPATCHERS 34
|
||||
|
||||
/* Was a nested pmap (VM_MEMORY_SHARED_PMAP) which has now been unnested */
|
||||
#define VM_MEMORY_UNSHARED_PMAP 35
|
||||
|
||||
|
||||
// Placeholders for now -- as we analyze the libraries and find how they
|
||||
// use memory, we can make these labels more specific.
|
||||
#define VM_MEMORY_APPKIT 40
|
||||
#define VM_MEMORY_FOUNDATION 41
|
||||
#define VM_MEMORY_COREGRAPHICS 42
|
||||
#define VM_MEMORY_CORESERVICES 43
|
||||
#define VM_MEMORY_CARBON VM_MEMORY_CORESERVICES
|
||||
#define VM_MEMORY_JAVA 44
|
||||
#define VM_MEMORY_COREDATA 45
|
||||
#define VM_MEMORY_COREDATA_OBJECTIDS 46
|
||||
#define VM_MEMORY_ATS 50
|
||||
#define VM_MEMORY_LAYERKIT 51
|
||||
#define VM_MEMORY_CGIMAGE 52
|
||||
#define VM_MEMORY_TCMALLOC 53
|
||||
|
||||
/* private raster data (i.e. layers, some images, QGL allocator) */
|
||||
#define VM_MEMORY_COREGRAPHICS_DATA 54
|
||||
|
||||
/* shared image and font caches */
|
||||
#define VM_MEMORY_COREGRAPHICS_SHARED 55
|
||||
|
||||
/* Memory used for virtual framebuffers, shadowing buffers, etc... */
|
||||
#define VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS 56
|
||||
|
||||
/* Window backing stores, custom shadow data, and compressed backing stores */
|
||||
#define VM_MEMORY_COREGRAPHICS_BACKINGSTORES 57
|
||||
|
||||
/* x-alloc'd memory */
|
||||
#define VM_MEMORY_COREGRAPHICS_XALLOC 58
|
||||
|
||||
/* catch-all for other uses, such as the read-only shared data page */
|
||||
#define VM_MEMORY_COREGRAPHICS_MISC VM_MEMORY_COREGRAPHICS
|
||||
|
||||
/* memory allocated by the dynamic loader for itself */
|
||||
#define VM_MEMORY_DYLD 60
|
||||
/* malloc'd memory created by dyld */
|
||||
#define VM_MEMORY_DYLD_MALLOC 61
|
||||
|
||||
/* Used for sqlite page cache */
|
||||
#define VM_MEMORY_SQLITE 62
|
||||
|
||||
/* JavaScriptCore heaps */
|
||||
#define VM_MEMORY_JAVASCRIPT_CORE 63
|
||||
#define VM_MEMORY_WEBASSEMBLY VM_MEMORY_JAVASCRIPT_CORE
|
||||
/* memory allocated for the JIT */
|
||||
#define VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR 64
|
||||
#define VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE 65
|
||||
|
||||
/* memory allocated for GLSL */
|
||||
#define VM_MEMORY_GLSL 66
|
||||
|
||||
/* memory allocated for OpenCL.framework */
|
||||
#define VM_MEMORY_OPENCL 67
|
||||
|
||||
/* memory allocated for QuartzCore.framework */
|
||||
#define VM_MEMORY_COREIMAGE 68
|
||||
|
||||
/* memory allocated for WebCore Purgeable Buffers */
|
||||
#define VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS 69
|
||||
|
||||
/* ImageIO memory */
|
||||
#define VM_MEMORY_IMAGEIO 70
|
||||
|
||||
/* CoreProfile memory */
|
||||
#define VM_MEMORY_COREPROFILE 71
|
||||
|
||||
/* assetsd / MobileSlideShow memory */
|
||||
#define VM_MEMORY_ASSETSD 72
|
||||
|
||||
/* libsystem_kernel os_once_alloc */
|
||||
#define VM_MEMORY_OS_ALLOC_ONCE 73
|
||||
|
||||
/* libdispatch internal allocator */
|
||||
#define VM_MEMORY_LIBDISPATCH 74
|
||||
|
||||
/* Accelerate.framework image backing stores */
|
||||
#define VM_MEMORY_ACCELERATE 75
|
||||
|
||||
/* CoreUI image block data */
|
||||
#define VM_MEMORY_COREUI 76
|
||||
|
||||
/* CoreUI image file */
|
||||
#define VM_MEMORY_COREUIFILE 77
|
||||
|
||||
/* Genealogy buffers */
|
||||
#define VM_MEMORY_GENEALOGY 78
|
||||
|
||||
/* RawCamera VM allocated memory */
|
||||
#define VM_MEMORY_RAWCAMERA 79
|
||||
|
||||
/* corpse info for dead process */
|
||||
#define VM_MEMORY_CORPSEINFO 80
|
||||
|
||||
/* Apple System Logger (ASL) messages */
|
||||
#define VM_MEMORY_ASL 81
|
||||
|
||||
/* Swift runtime */
|
||||
#define VM_MEMORY_SWIFT_RUNTIME 82
|
||||
|
||||
/* Swift metadata */
|
||||
#define VM_MEMORY_SWIFT_METADATA 83
|
||||
|
||||
/* DHMM data */
|
||||
#define VM_MEMORY_DHMM 84
|
||||
|
||||
|
||||
/* memory allocated by SceneKit.framework */
|
||||
#define VM_MEMORY_SCENEKIT 86
|
||||
|
||||
/* memory allocated by skywalk networking */
|
||||
#define VM_MEMORY_SKYWALK 87
|
||||
|
||||
#define VM_MEMORY_IOSURFACE 88
|
||||
|
||||
#define VM_MEMORY_LIBNETWORK 89
|
||||
|
||||
#define VM_MEMORY_AUDIO 90
|
||||
|
||||
#define VM_MEMORY_VIDEOBITSTREAM 91
|
||||
|
||||
/* memory allocated by CoreMedia */
|
||||
#define VM_MEMORY_CM_XPC 92
|
||||
|
||||
#define VM_MEMORY_CM_RPC 93
|
||||
|
||||
#define VM_MEMORY_CM_MEMORYPOOL 94
|
||||
|
||||
#define VM_MEMORY_CM_READCACHE 95
|
||||
|
||||
#define VM_MEMORY_CM_CRABS 96
|
||||
|
||||
/* memory allocated for QuickLookThumbnailing */
|
||||
#define VM_MEMORY_QUICKLOOK_THUMBNAILS 97
|
||||
|
||||
/* memory allocated by Accounts framework */
|
||||
#define VM_MEMORY_ACCOUNTS 98
|
||||
|
||||
/* memory allocated by Sanitizer runtime libraries */
|
||||
#define VM_MEMORY_SANITIZER 99
|
||||
|
||||
/* Differentiate memory needed by GPU drivers and frameworks from generic IOKit allocations */
|
||||
#define VM_MEMORY_IOACCELERATOR 100
|
||||
|
||||
/* memory allocated by CoreMedia for global image registration of frames */
|
||||
#define VM_MEMORY_CM_REGWARP 101
|
||||
|
||||
/* memory allocated by EmbeddedAcousticRecognition for speech decoder */
|
||||
#define VM_MEMORY_EAR_DECODER 102
|
||||
|
||||
/* CoreUI cached image data */
|
||||
#define VM_MEMORY_COREUI_CACHED_IMAGE_DATA 103
|
||||
|
||||
/* Reserve 230-239 for Rosetta */
|
||||
#define VM_MEMORY_ROSETTA 230
|
||||
#define VM_MEMORY_ROSETTA_THREAD_CONTEXT 231
|
||||
#define VM_MEMORY_ROSETTA_INDIRECT_BRANCH_MAP 232
|
||||
#define VM_MEMORY_ROSETTA_RETURN_STACK 233
|
||||
#define VM_MEMORY_ROSETTA_EXECUTABLE_HEAP 234
|
||||
#define VM_MEMORY_ROSETTA_USER_LDT 235
|
||||
#define VM_MEMORY_ROSETTA_ARENA 236
|
||||
#define VM_MEMORY_ROSETTA_10 239
|
||||
|
||||
/* Reserve 240-255 for application */
|
||||
#define VM_MEMORY_APPLICATION_SPECIFIC_1 240
|
||||
#define VM_MEMORY_APPLICATION_SPECIFIC_16 255
|
||||
|
||||
#define VM_MAKE_TAG(tag) ((tag) << 24)
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_VM_STATISTICS_H_ */
|
||||
97
lib/libc/include/aarch64-macos-gnu/mach/vm_types.h
Normal file
97
lib/libc/include/aarch64-macos-gnu/mach/vm_types.h
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2018 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@
|
||||
*/
|
||||
/*
|
||||
* @OSF_COPYRIGHT@
|
||||
*
|
||||
*/
|
||||
#ifndef _MACH_VM_TYPES_H_
|
||||
#define _MACH_VM_TYPES_H_
|
||||
|
||||
#include <mach/port.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef vm_offset_t pointer_t;
|
||||
typedef vm_offset_t vm_address_t;
|
||||
|
||||
/*
|
||||
* We use addr64_t for 64-bit addresses that are used on both
|
||||
* 32 and 64-bit machines. On PPC, they are passed and returned as
|
||||
* two adjacent 32-bit GPRs. We use addr64_t in places where
|
||||
* common code must be useable both on 32 and 64-bit machines.
|
||||
*/
|
||||
typedef uint64_t addr64_t; /* Basic effective address */
|
||||
|
||||
/*
|
||||
* We use reg64_t for addresses that are 32 bits on a 32-bit
|
||||
* machine, and 64 bits on a 64-bit machine, but are always
|
||||
* passed and returned in a single GPR on PPC. This type
|
||||
* cannot be used in generic 32-bit c, since on a 64-bit
|
||||
* machine the upper half of the register will be ignored
|
||||
* by the c compiler in 32-bit mode. In c, we can only use the
|
||||
* type in prototypes of functions that are written in and called
|
||||
* from assembly language. This type is basically a comment.
|
||||
*/
|
||||
typedef uint32_t reg64_t;
|
||||
|
||||
/*
|
||||
* To minimize the use of 64-bit fields, we keep some physical
|
||||
* 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 */
|
||||
#define PPNUM_MAX UINT32_MAX
|
||||
|
||||
|
||||
|
||||
typedef mach_port_t vm_map_t, vm_map_read_t, vm_map_inspect_t;
|
||||
|
||||
|
||||
#define VM_MAP_NULL ((vm_map_t) 0)
|
||||
#define VM_MAP_INSPECT_NULL ((vm_map_inspect_t) 0)
|
||||
#define VM_MAP_READ_NULL ((vm_map_read_t) 0)
|
||||
|
||||
/*
|
||||
* Evolving definitions, likely to change.
|
||||
*/
|
||||
|
||||
typedef uint64_t vm_object_offset_t;
|
||||
typedef uint64_t vm_object_size_t;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef mach_port_t upl_t;
|
||||
typedef mach_port_t vm_named_entry_t;
|
||||
|
||||
|
||||
#define UPL_NULL ((upl_t) 0)
|
||||
#define VM_NAMED_ENTRY_NULL ((vm_named_entry_t) 0)
|
||||
|
||||
#endif /* _MACH_VM_TYPES_H_ */
|
||||
34
lib/libc/include/aarch64-macos-gnu/machine/_mcontext.h
Normal file
34
lib/libc/include/aarch64-macos-gnu/machine/_mcontext.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2012 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@
|
||||
*/
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
#include "i386/_mcontext.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "arm/_mcontext.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
34
lib/libc/include/aarch64-macos-gnu/machine/_param.h
Normal file
34
lib/libc/include/aarch64-macos-gnu/machine/_param.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2007 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@
|
||||
*/
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
#include <i386/_param.h>
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include <arm/_param.h>
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
39
lib/libc/include/aarch64-macos-gnu/machine/_types.h
Normal file
39
lib/libc/include/aarch64-macos-gnu/machine/_types.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2007 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 _BSD_MACHINE__TYPES_H_
|
||||
#define _BSD_MACHINE__TYPES_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "i386/_types.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "arm/_types.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE__TYPES_H_ */
|
||||
42
lib/libc/include/aarch64-macos-gnu/machine/endian.h
Normal file
42
lib/libc/include/aarch64-macos-gnu/machine/endian.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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@
|
||||
*/
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _BSD_MACHINE_ENDIAN_H_
|
||||
#define _BSD_MACHINE_ENDIAN_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "i386/endian.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "arm/endian.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE_ENDIAN_H_ */
|
||||
11
lib/libc/include/aarch64-macos-gnu/machine/limits.h
Normal file
11
lib/libc/include/aarch64-macos-gnu/machine/limits.h
Normal file
@ -0,0 +1,11 @@
|
||||
/* This is the `system' limits.h, independent of any particular
|
||||
* compiler. GCC provides its own limits.h which can be found in
|
||||
* /usr/lib/gcc, although it is not very informative.
|
||||
* This file is public domain. */
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include <i386/limits.h>
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include <arm/limits.h>
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
42
lib/libc/include/aarch64-macos-gnu/machine/param.h
Normal file
42
lib/libc/include/aarch64-macos-gnu/machine/param.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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@
|
||||
*/
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _BSD_MACHINE_PARAM_H_
|
||||
#define _BSD_MACHINE_PARAM_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include <i386/param.h>
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include <arm/param.h>
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE_PARAM_H_ */
|
||||
39
lib/libc/include/aarch64-macos-gnu/machine/signal.h
Normal file
39
lib/libc/include/aarch64-macos-gnu/machine/signal.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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 _BSD_MACHINE_SIGNAL_H_
|
||||
#define _BSD_MACHINE_SIGNAL_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "i386/signal.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "arm/signal.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE_SIGNAL_H_ */
|
||||
42
lib/libc/include/aarch64-macos-gnu/machine/types.h
Normal file
42
lib/libc/include/aarch64-macos-gnu/machine/types.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2007 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@
|
||||
*/
|
||||
/*
|
||||
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||
*/
|
||||
#ifndef _BSD_MACHINE_TYPES_H_
|
||||
#define _BSD_MACHINE_TYPES_H_
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#include "i386/types.h"
|
||||
#elif defined (__arm__) || defined (__arm64__)
|
||||
#include "arm/types.h"
|
||||
#else
|
||||
#error architecture not supported
|
||||
#endif
|
||||
|
||||
#endif /* _BSD_MACHINE_TYPES_H_ */
|
||||
56
lib/libc/include/aarch64-macos-gnu/malloc/_malloc.h
Normal file
56
lib/libc/include/aarch64-macos-gnu/malloc/_malloc.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2018 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 _MALLOC_UNDERSCORE_MALLOC_H_
|
||||
#define _MALLOC_UNDERSCORE_MALLOC_H_
|
||||
|
||||
/*
|
||||
* This header is included from <stdlib.h>, so the contents of this file have
|
||||
* broad source compatibility and POSIX conformance implications.
|
||||
* Be cautious about what is included and declared here.
|
||||
*/
|
||||
|
||||
#include <Availability.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <_types.h>
|
||||
#include <sys/_types/_size_t.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
void *malloc(size_t __size) __result_use_check __alloc_size(1);
|
||||
void *calloc(size_t __count, size_t __size) __result_use_check __alloc_size(1,2);
|
||||
void free(void *);
|
||||
void *realloc(void *__ptr, size_t __size) __result_use_check __alloc_size(2);
|
||||
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
void *valloc(size_t) __alloc_size(1);
|
||||
#endif // !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
#if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL) || \
|
||||
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
|
||||
(defined(__cplusplus) && __cplusplus >= 201703L)
|
||||
void *aligned_alloc(size_t __alignment, size_t __size) __result_use_check __alloc_size(2) __OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
#endif
|
||||
int posix_memalign(void **__memptr, size_t __alignment, size_t __size) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MALLOC_UNDERSCORE_MALLOC_H_ */
|
||||
314
lib/libc/include/aarch64-macos-gnu/malloc/malloc.h
Normal file
314
lib/libc/include/aarch64-macos-gnu/malloc/malloc.h
Normal file
@ -0,0 +1,314 @@
|
||||
/*
|
||||
* Copyright (c) 1999 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 _MALLOC_MALLOC_H_
|
||||
#define _MALLOC_MALLOC_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <mach/mach_types.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#if __has_feature(ptrauth_calls)
|
||||
#include <ptrauth.h>
|
||||
|
||||
// Zone function pointer, type-diversified but not address-diversified (because
|
||||
// the zone can be copied). Process-independent because the zone structure may
|
||||
// be in the shared library cache.
|
||||
#define MALLOC_ZONE_FN_PTR(fn) __ptrauth(ptrauth_key_process_independent_code, \
|
||||
FALSE, ptrauth_string_discriminator("malloc_zone_fn." #fn)) fn
|
||||
|
||||
// Introspection function pointer, address- and type-diversified.
|
||||
// Process-independent because the malloc_introspection_t structure that contains
|
||||
// these pointers may be in the shared library cache.
|
||||
#define MALLOC_INTROSPECT_FN_PTR(fn) __ptrauth(ptrauth_key_process_independent_code, \
|
||||
TRUE, ptrauth_string_discriminator("malloc_introspect_fn." #fn)) fn
|
||||
|
||||
// Pointer to the introspection pointer table, type-diversified but not
|
||||
// address-diversified (because the zone can be copied).
|
||||
// Process-independent because the table pointer may be in the shared library cache.
|
||||
#define MALLOC_INTROSPECT_TBL_PTR(ptr) __ptrauth(ptrauth_key_process_independent_data,\
|
||||
FALSE, ptrauth_string_discriminator("malloc_introspect_tbl")) ptr
|
||||
|
||||
#endif // __has_feature(ptrauth_calls)
|
||||
|
||||
#ifndef MALLOC_ZONE_FN_PTR
|
||||
#define MALLOC_ZONE_FN_PTR(fn) fn
|
||||
#define MALLOC_INTROSPECT_FN_PTR(fn) fn
|
||||
#define MALLOC_INTROSPECT_TBL_PTR(ptr) ptr
|
||||
#endif // MALLOC_ZONE_FN_PTR
|
||||
|
||||
__BEGIN_DECLS
|
||||
/********* Type definitions ************/
|
||||
|
||||
typedef struct _malloc_zone_t {
|
||||
/* Only zone implementors should depend on the layout of this structure;
|
||||
Regular callers should use the access functions below */
|
||||
void *reserved1; /* RESERVED FOR CFAllocator DO NOT USE */
|
||||
void *reserved2; /* RESERVED FOR CFAllocator DO NOT USE */
|
||||
size_t (* MALLOC_ZONE_FN_PTR(size))(struct _malloc_zone_t *zone, const void *ptr); /* returns the size of a block or 0 if not in this zone; must be fast, especially for negative answers */
|
||||
void *(* MALLOC_ZONE_FN_PTR(malloc))(struct _malloc_zone_t *zone, size_t size);
|
||||
void *(* MALLOC_ZONE_FN_PTR(calloc))(struct _malloc_zone_t *zone, size_t num_items, size_t size); /* same as malloc, but block returned is set to zero */
|
||||
void *(* MALLOC_ZONE_FN_PTR(valloc))(struct _malloc_zone_t *zone, size_t size); /* same as malloc, but block returned is set to zero and is guaranteed to be page aligned */
|
||||
void (* MALLOC_ZONE_FN_PTR(free))(struct _malloc_zone_t *zone, void *ptr);
|
||||
void *(* MALLOC_ZONE_FN_PTR(realloc))(struct _malloc_zone_t *zone, void *ptr, size_t size);
|
||||
void (* MALLOC_ZONE_FN_PTR(destroy))(struct _malloc_zone_t *zone); /* zone is destroyed and all memory reclaimed */
|
||||
const char *zone_name;
|
||||
|
||||
/* Optional batch callbacks; these may be NULL */
|
||||
unsigned (* MALLOC_ZONE_FN_PTR(batch_malloc))(struct _malloc_zone_t *zone, size_t size, void **results, unsigned num_requested); /* given a size, returns pointers capable of holding that size; returns the number of pointers allocated (maybe 0 or less than num_requested) */
|
||||
void (* MALLOC_ZONE_FN_PTR(batch_free))(struct _malloc_zone_t *zone, void **to_be_freed, unsigned num_to_be_freed); /* frees all the pointers in to_be_freed; note that to_be_freed may be overwritten during the process */
|
||||
|
||||
struct malloc_introspection_t * MALLOC_INTROSPECT_TBL_PTR(introspect);
|
||||
unsigned version;
|
||||
|
||||
/* aligned memory allocation. The callback may be NULL. Present in version >= 5. */
|
||||
void *(* MALLOC_ZONE_FN_PTR(memalign))(struct _malloc_zone_t *zone, size_t alignment, size_t size);
|
||||
|
||||
/* free a pointer known to be in zone and known to have the given size. The callback may be NULL. Present in version >= 6.*/
|
||||
void (* MALLOC_ZONE_FN_PTR(free_definite_size))(struct _malloc_zone_t *zone, void *ptr, size_t size);
|
||||
|
||||
/* Empty out caches in the face of memory pressure. The callback may be NULL. Present in version >= 8. */
|
||||
size_t (* MALLOC_ZONE_FN_PTR(pressure_relief))(struct _malloc_zone_t *zone, size_t goal);
|
||||
|
||||
/*
|
||||
* Checks whether an address might belong to the zone. May be NULL. Present in version >= 10.
|
||||
* False positives are allowed (e.g. the pointer was freed, or it's in zone space that has
|
||||
* not yet been allocated. False negatives are not allowed.
|
||||
*/
|
||||
boolean_t (* MALLOC_ZONE_FN_PTR(claimed_address))(struct _malloc_zone_t *zone, void *ptr);
|
||||
} malloc_zone_t;
|
||||
|
||||
/********* Creation and destruction ************/
|
||||
|
||||
extern malloc_zone_t *malloc_default_zone(void);
|
||||
/* The initial zone */
|
||||
|
||||
extern malloc_zone_t *malloc_create_zone(vm_size_t start_size, unsigned flags);
|
||||
/* Creates a new zone with default behavior and registers it */
|
||||
|
||||
extern void malloc_destroy_zone(malloc_zone_t *zone);
|
||||
/* Destroys zone and everything it allocated */
|
||||
|
||||
/********* Block creation and manipulation ************/
|
||||
|
||||
extern void *malloc_zone_malloc(malloc_zone_t *zone, size_t size) __alloc_size(2);
|
||||
/* Allocates a new pointer of size size; zone must be non-NULL */
|
||||
|
||||
extern void *malloc_zone_calloc(malloc_zone_t *zone, size_t num_items, size_t size) __alloc_size(2,3);
|
||||
/* Allocates a new pointer of size num_items * size; block is cleared; zone must be non-NULL */
|
||||
|
||||
extern void *malloc_zone_valloc(malloc_zone_t *zone, size_t size) __alloc_size(2);
|
||||
/* Allocates a new pointer of size size; zone must be non-NULL; Pointer is guaranteed to be page-aligned and block is cleared */
|
||||
|
||||
extern void malloc_zone_free(malloc_zone_t *zone, void *ptr);
|
||||
/* Frees pointer in zone; zone must be non-NULL */
|
||||
|
||||
extern void *malloc_zone_realloc(malloc_zone_t *zone, void *ptr, size_t size) __alloc_size(3);
|
||||
/* Enlarges block if necessary; zone must be non-NULL */
|
||||
|
||||
extern malloc_zone_t *malloc_zone_from_ptr(const void *ptr);
|
||||
/* Returns the zone for a pointer, or NULL if not in any zone.
|
||||
The ptr must have been returned from a malloc or realloc call. */
|
||||
|
||||
extern size_t malloc_size(const void *ptr);
|
||||
/* Returns size of given ptr */
|
||||
|
||||
extern size_t malloc_good_size(size_t size);
|
||||
/* Returns number of bytes greater than or equal to size that can be allocated without padding */
|
||||
|
||||
extern void *malloc_zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size) __alloc_size(3) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
|
||||
/*
|
||||
* Allocates a new pointer of size size whose address is an exact multiple of alignment.
|
||||
* alignment must be a power of two and at least as large as sizeof(void *).
|
||||
* zone must be non-NULL.
|
||||
*/
|
||||
|
||||
/********* Batch methods ************/
|
||||
|
||||
extern unsigned malloc_zone_batch_malloc(malloc_zone_t *zone, size_t size, void **results, unsigned num_requested);
|
||||
/* Allocates num blocks of the same size; Returns the number truly allocated (may be 0) */
|
||||
|
||||
extern void malloc_zone_batch_free(malloc_zone_t *zone, void **to_be_freed, unsigned num);
|
||||
/* frees all the pointers in to_be_freed; note that to_be_freed may be overwritten during the process; This function will always free even if the zone has no batch callback */
|
||||
|
||||
/********* Functions for libcache ************/
|
||||
|
||||
extern malloc_zone_t *malloc_default_purgeable_zone(void) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
|
||||
/* Returns a pointer to the default purgeable_zone. */
|
||||
|
||||
extern void malloc_make_purgeable(void *ptr) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
|
||||
/* Make an allocation from the purgeable zone purgeable if possible. */
|
||||
|
||||
extern int malloc_make_nonpurgeable(void *ptr) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0);
|
||||
/* Makes an allocation from the purgeable zone nonpurgeable.
|
||||
* Returns zero if the contents were not purged since the last
|
||||
* call to malloc_make_purgeable, else returns non-zero. */
|
||||
|
||||
/********* Functions for zone implementors ************/
|
||||
|
||||
extern void malloc_zone_register(malloc_zone_t *zone);
|
||||
/* Registers a custom malloc zone; Should typically be called after a
|
||||
* malloc_zone_t has been filled in with custom methods by a client. See
|
||||
* malloc_create_zone for creating additional malloc zones with the
|
||||
* default allocation and free behavior. */
|
||||
|
||||
extern void malloc_zone_unregister(malloc_zone_t *zone);
|
||||
/* De-registers a zone
|
||||
Should typically be called before calling the zone destruction routine */
|
||||
|
||||
extern void malloc_set_zone_name(malloc_zone_t *zone, const char *name);
|
||||
/* Sets the name of a zone */
|
||||
|
||||
extern const char *malloc_get_zone_name(malloc_zone_t *zone);
|
||||
/* Returns the name of a zone */
|
||||
|
||||
size_t malloc_zone_pressure_relief(malloc_zone_t *zone, size_t goal) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
/* malloc_zone_pressure_relief() advises the malloc subsystem that the process is under memory pressure and
|
||||
* that the subsystem should make its best effort towards releasing (i.e. munmap()-ing) "goal" bytes from "zone".
|
||||
* If "goal" is passed as zero, the malloc subsystem will attempt to achieve maximal pressure relief in "zone".
|
||||
* If "zone" is passed as NULL, all zones are examined for pressure relief opportunities.
|
||||
* malloc_zone_pressure_relief() returns the number of bytes released.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
vm_address_t address;
|
||||
vm_size_t size;
|
||||
} vm_range_t;
|
||||
|
||||
typedef struct malloc_statistics_t {
|
||||
unsigned blocks_in_use;
|
||||
size_t size_in_use;
|
||||
size_t max_size_in_use; /* high water mark of touched memory */
|
||||
size_t size_allocated; /* reserved in memory */
|
||||
} malloc_statistics_t;
|
||||
|
||||
typedef kern_return_t memory_reader_t(task_t remote_task, vm_address_t remote_address, vm_size_t size, void **local_memory);
|
||||
/* given a task, "reads" the memory at the given address and size
|
||||
local_memory: set to a contiguous chunk of memory; validity of local_memory is assumed to be limited (until next call) */
|
||||
|
||||
#define MALLOC_PTR_IN_USE_RANGE_TYPE 1 /* for allocated pointers */
|
||||
#define MALLOC_PTR_REGION_RANGE_TYPE 2 /* for region containing pointers */
|
||||
#define MALLOC_ADMIN_REGION_RANGE_TYPE 4 /* for region used internally */
|
||||
#define MALLOC_ZONE_SPECIFIC_FLAGS 0xff00 /* bits reserved for zone-specific purposes */
|
||||
|
||||
typedef void vm_range_recorder_t(task_t, void *, unsigned type, vm_range_t *, unsigned);
|
||||
/* given a task and context, "records" the specified addresses */
|
||||
|
||||
/* Print function for the print_task() operation. */
|
||||
typedef void print_task_printer_t(const char *fmt, ...) __printflike(1,2);
|
||||
|
||||
typedef struct malloc_introspection_t {
|
||||
kern_return_t (* MALLOC_INTROSPECT_FN_PTR(enumerator))(task_t task, void *, unsigned type_mask, vm_address_t zone_address, memory_reader_t reader, vm_range_recorder_t recorder); /* enumerates all the malloc pointers in use */
|
||||
size_t (* MALLOC_INTROSPECT_FN_PTR(good_size))(malloc_zone_t *zone, size_t size);
|
||||
boolean_t (* MALLOC_INTROSPECT_FN_PTR(check))(malloc_zone_t *zone); /* Consistency checker */
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(print))(malloc_zone_t *zone, boolean_t verbose); /* Prints zone */
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(log))(malloc_zone_t *zone, void *address); /* Enables logging of activity */
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(force_lock))(malloc_zone_t *zone); /* Forces locking zone */
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(force_unlock))(malloc_zone_t *zone); /* Forces unlocking zone */
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(statistics))(malloc_zone_t *zone, malloc_statistics_t *stats); /* Fills statistics */
|
||||
boolean_t (* MALLOC_INTROSPECT_FN_PTR(zone_locked))(malloc_zone_t *zone); /* Are any zone locks held */
|
||||
|
||||
/* Discharge checking. Present in version >= 7. */
|
||||
boolean_t (* MALLOC_INTROSPECT_FN_PTR(enable_discharge_checking))(malloc_zone_t *zone);
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(disable_discharge_checking))(malloc_zone_t *zone);
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(discharge))(malloc_zone_t *zone, void *memory);
|
||||
#ifdef __BLOCKS__
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(enumerate_discharged_pointers))(malloc_zone_t *zone, void (^report_discharged)(void *memory, void *info));
|
||||
#else
|
||||
void *enumerate_unavailable_without_blocks;
|
||||
#endif /* __BLOCKS__ */
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(reinit_lock))(malloc_zone_t *zone); /* Reinitialize zone locks, called only from atfork_child handler. Present in version >= 9. */
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(print_task))(task_t task, unsigned level, vm_address_t zone_address, memory_reader_t reader, print_task_printer_t printer); /* debug print for another process. Present in version >= 11. */
|
||||
void (* MALLOC_INTROSPECT_FN_PTR(task_statistics))(task_t task, vm_address_t zone_address, memory_reader_t reader, malloc_statistics_t *stats); /* Present in version >= 12 */
|
||||
} malloc_introspection_t;
|
||||
|
||||
// The value of "level" when passed to print_task() that corresponds to
|
||||
// verbose passed to print()
|
||||
#define MALLOC_VERBOSE_PRINT_LEVEL 2
|
||||
|
||||
extern void malloc_printf(const char *format, ...);
|
||||
/* Convenience for logging errors and warnings;
|
||||
No allocation is performed during execution of this function;
|
||||
Only understands usual %p %d %s formats, and %y that expresses a number of bytes (5b,10KB,1MB...)
|
||||
*/
|
||||
|
||||
/********* Functions for performance tools ************/
|
||||
|
||||
extern kern_return_t malloc_get_all_zones(task_t task, memory_reader_t reader, vm_address_t **addresses, unsigned *count);
|
||||
/* Fills addresses and count with the addresses of the zones in task;
|
||||
Note that the validity of the addresses returned correspond to the validity of the memory returned by reader */
|
||||
|
||||
/********* Debug helpers ************/
|
||||
|
||||
extern void malloc_zone_print_ptr_info(void *ptr);
|
||||
/* print to stdout if this pointer is in the malloc heap, free status, and size */
|
||||
|
||||
extern boolean_t malloc_zone_check(malloc_zone_t *zone);
|
||||
/* Checks zone is well formed; if !zone, checks all zones */
|
||||
|
||||
extern void malloc_zone_print(malloc_zone_t *zone, boolean_t verbose);
|
||||
/* Prints summary on zone; if !zone, prints all zones */
|
||||
|
||||
extern void malloc_zone_statistics(malloc_zone_t *zone, malloc_statistics_t *stats);
|
||||
/* Fills statistics for zone; if !zone, sums up all zones */
|
||||
|
||||
extern void malloc_zone_log(malloc_zone_t *zone, void *address);
|
||||
/* Controls logging of all activity; if !zone, for all zones;
|
||||
If address==0 nothing is logged;
|
||||
If address==-1 all activity is logged;
|
||||
Else only the activity regarding address is logged */
|
||||
|
||||
struct mstats {
|
||||
size_t bytes_total;
|
||||
size_t chunks_used;
|
||||
size_t bytes_used;
|
||||
size_t chunks_free;
|
||||
size_t bytes_free;
|
||||
};
|
||||
|
||||
extern struct mstats mstats(void);
|
||||
|
||||
extern boolean_t malloc_zone_enable_discharge_checking(malloc_zone_t *zone) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
/* Increment the discharge checking enabled counter for a zone. Returns true if the zone supports checking, false if it does not. */
|
||||
|
||||
extern void malloc_zone_disable_discharge_checking(malloc_zone_t *zone) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
/* Decrement the discharge checking enabled counter for a zone. */
|
||||
|
||||
extern void malloc_zone_discharge(malloc_zone_t *zone, void *memory) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
/* Register memory that the programmer expects to be freed soon.
|
||||
zone may be NULL in which case the zone is determined using malloc_zone_from_ptr().
|
||||
If discharge checking is off for the zone this function is a no-op. */
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
extern void malloc_zone_enumerate_discharged_pointers(malloc_zone_t *zone, void (^report_discharged)(void *memory, void *info)) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
/* Calls report_discharged for each block that was registered using malloc_zone_discharge() but has not yet been freed.
|
||||
info is used to provide zone defined information about the memory block.
|
||||
If zone is NULL then the enumeration covers all zones. */
|
||||
#else
|
||||
extern void malloc_zone_enumerate_discharged_pointers(malloc_zone_t *zone, void *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MALLOC_MALLOC_H_ */
|
||||
775
lib/libc/include/aarch64-macos-gnu/math.h
Normal file
775
lib/libc/include/aarch64-macos-gnu/math.h
Normal file
@ -0,0 +1,775 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2017 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* The contents of this file constitute Original Code as defined in and
|
||||
* are subject to the Apple Public Source License Version 1.1 (the
|
||||
* "License"). You may not use this file except in compliance with the
|
||||
* License. Please obtain a copy of the License at
|
||||
* http://www.apple.com/publicsource and read it before using this file.
|
||||
*
|
||||
* This 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 OR NON-INFRINGEMENT. Please see the
|
||||
* License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __MATH_H__
|
||||
#define __MATH_H__
|
||||
|
||||
#ifndef __MATH__
|
||||
#define __MATH__
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <Availability.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/******************************************************************************
|
||||
* Floating point data types *
|
||||
******************************************************************************/
|
||||
|
||||
/* Define float_t and double_t per C standard, ISO/IEC 9899:2011 7.12 2,
|
||||
taking advantage of GCC's __FLT_EVAL_METHOD__ (which a compiler may
|
||||
define anytime and GCC does) that shadows FLT_EVAL_METHOD (which a
|
||||
compiler must define only in float.h). */
|
||||
#if __FLT_EVAL_METHOD__ == 0
|
||||
typedef float float_t;
|
||||
typedef double double_t;
|
||||
#elif __FLT_EVAL_METHOD__ == 1
|
||||
typedef double float_t;
|
||||
typedef double double_t;
|
||||
#elif __FLT_EVAL_METHOD__ == 2 || __FLT_EVAL_METHOD__ == -1
|
||||
typedef long double float_t;
|
||||
typedef long double double_t;
|
||||
#else /* __FLT_EVAL_METHOD__ */
|
||||
# error "Unsupported value of __FLT_EVAL_METHOD__."
|
||||
#endif /* __FLT_EVAL_METHOD__ */
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# define HUGE_VAL __builtin_huge_val()
|
||||
# define HUGE_VALF __builtin_huge_valf()
|
||||
# define HUGE_VALL __builtin_huge_vall()
|
||||
# define NAN __builtin_nanf("0x7fc00000")
|
||||
#else
|
||||
# define HUGE_VAL 1e500
|
||||
# define HUGE_VALF 1e50f
|
||||
# define HUGE_VALL 1e5000L
|
||||
# define NAN __nan()
|
||||
#endif
|
||||
|
||||
#define INFINITY HUGE_VALF
|
||||
|
||||
/******************************************************************************
|
||||
* Taxonomy of floating point data types *
|
||||
******************************************************************************/
|
||||
|
||||
#define FP_NAN 1
|
||||
#define FP_INFINITE 2
|
||||
#define FP_ZERO 3
|
||||
#define FP_NORMAL 4
|
||||
#define FP_SUBNORMAL 5
|
||||
#define FP_SUPERNORMAL 6 /* legacy PowerPC support; this is otherwise unused */
|
||||
|
||||
#if defined __arm64__ || defined __ARM_VFPV4__
|
||||
/* On these architectures, fma(), fmaf( ), and fmal( ) are generally about as
|
||||
fast as (or faster than) separate multiply and add of the same operands. */
|
||||
# define FP_FAST_FMA 1
|
||||
# define FP_FAST_FMAF 1
|
||||
# define FP_FAST_FMAL 1
|
||||
#elif (defined __i386__ || defined __x86_64__) && (defined __FMA__ || defined __AVX512F__)
|
||||
/* When targeting the FMA ISA extension, fma() and fmaf( ) are generally
|
||||
about as fast as (or faster than) separate multiply and add of the same
|
||||
operands, but fmal( ) may be more costly. */
|
||||
# define FP_FAST_FMA 1
|
||||
# define FP_FAST_FMAF 1
|
||||
# undef FP_FAST_FMAL
|
||||
#else
|
||||
/* On these architectures, fma( ), fmaf( ), and fmal( ) function calls are
|
||||
significantly more costly than separate multiply and add operations. */
|
||||
# undef FP_FAST_FMA
|
||||
# undef FP_FAST_FMAF
|
||||
# undef FP_FAST_FMAL
|
||||
#endif
|
||||
|
||||
/* The values returned by `ilogb' for 0 and NaN respectively. */
|
||||
#define FP_ILOGB0 (-2147483647 - 1)
|
||||
#define FP_ILOGBNAN (-2147483647 - 1)
|
||||
|
||||
/* Bitmasks for the math_errhandling macro. */
|
||||
#define MATH_ERRNO 1 /* errno set by math functions. */
|
||||
#define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */
|
||||
|
||||
#define math_errhandling (__math_errhandling())
|
||||
extern int __math_errhandling(void);
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Inquiry macros *
|
||||
* *
|
||||
* fpclassify Returns one of the FP_* values. *
|
||||
* isnormal Non-zero if and only if the argument x is normalized. *
|
||||
* isfinite Non-zero if and only if the argument x is finite. *
|
||||
* isnan Non-zero if and only if the argument x is a NaN. *
|
||||
* signbit Non-zero if and only if the sign of the argument x is *
|
||||
* negative. This includes, NaNs, infinities and zeros. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#define fpclassify(x) \
|
||||
( sizeof(x) == sizeof(float) ? __fpclassifyf((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __fpclassifyd((double)(x)) \
|
||||
: __fpclassifyl((long double)(x)))
|
||||
|
||||
extern int __fpclassifyf(float);
|
||||
extern int __fpclassifyd(double);
|
||||
extern int __fpclassifyl(long double);
|
||||
|
||||
#if (defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__)
|
||||
/* These inline functions may fail to return expected results if unsafe
|
||||
math optimizations like those enabled by -ffast-math are turned on.
|
||||
Thus, (somewhat surprisingly) you only get the fast inline
|
||||
implementations if such compiler options are NOT enabled. This is
|
||||
because the inline functions require the compiler to be adhering to
|
||||
the standard in order to work properly; -ffast-math, among other
|
||||
things, implies that NaNs don't happen, which allows the compiler to
|
||||
optimize away checks like x != x, which might lead to things like
|
||||
isnan(NaN) returning false.
|
||||
|
||||
Thus, if you compile with -ffast-math, actual function calls are
|
||||
generated for these utilities. */
|
||||
|
||||
#define isnormal(x) \
|
||||
( sizeof(x) == sizeof(float) ? __inline_isnormalf((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __inline_isnormald((double)(x)) \
|
||||
: __inline_isnormall((long double)(x)))
|
||||
|
||||
#define isfinite(x) \
|
||||
( sizeof(x) == sizeof(float) ? __inline_isfinitef((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __inline_isfinited((double)(x)) \
|
||||
: __inline_isfinitel((long double)(x)))
|
||||
|
||||
#define isinf(x) \
|
||||
( sizeof(x) == sizeof(float) ? __inline_isinff((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __inline_isinfd((double)(x)) \
|
||||
: __inline_isinfl((long double)(x)))
|
||||
|
||||
#define isnan(x) \
|
||||
( sizeof(x) == sizeof(float) ? __inline_isnanf((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __inline_isnand((double)(x)) \
|
||||
: __inline_isnanl((long double)(x)))
|
||||
|
||||
#define signbit(x) \
|
||||
( sizeof(x) == sizeof(float) ? __inline_signbitf((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __inline_signbitd((double)(x)) \
|
||||
: __inline_signbitl((long double)(x)))
|
||||
|
||||
__header_always_inline int __inline_isfinitef(float);
|
||||
__header_always_inline int __inline_isfinited(double);
|
||||
__header_always_inline int __inline_isfinitel(long double);
|
||||
__header_always_inline int __inline_isinff(float);
|
||||
__header_always_inline int __inline_isinfd(double);
|
||||
__header_always_inline int __inline_isinfl(long double);
|
||||
__header_always_inline int __inline_isnanf(float);
|
||||
__header_always_inline int __inline_isnand(double);
|
||||
__header_always_inline int __inline_isnanl(long double);
|
||||
__header_always_inline int __inline_isnormalf(float);
|
||||
__header_always_inline int __inline_isnormald(double);
|
||||
__header_always_inline int __inline_isnormall(long double);
|
||||
__header_always_inline int __inline_signbitf(float);
|
||||
__header_always_inline int __inline_signbitd(double);
|
||||
__header_always_inline int __inline_signbitl(long double);
|
||||
|
||||
__header_always_inline int __inline_isfinitef(float __x) {
|
||||
return __x == __x && __builtin_fabsf(__x) != __builtin_inff();
|
||||
}
|
||||
__header_always_inline int __inline_isfinited(double __x) {
|
||||
return __x == __x && __builtin_fabs(__x) != __builtin_inf();
|
||||
}
|
||||
__header_always_inline int __inline_isfinitel(long double __x) {
|
||||
return __x == __x && __builtin_fabsl(__x) != __builtin_infl();
|
||||
}
|
||||
__header_always_inline int __inline_isinff(float __x) {
|
||||
return __builtin_fabsf(__x) == __builtin_inff();
|
||||
}
|
||||
__header_always_inline int __inline_isinfd(double __x) {
|
||||
return __builtin_fabs(__x) == __builtin_inf();
|
||||
}
|
||||
__header_always_inline int __inline_isinfl(long double __x) {
|
||||
return __builtin_fabsl(__x) == __builtin_infl();
|
||||
}
|
||||
__header_always_inline int __inline_isnanf(float __x) {
|
||||
return __x != __x;
|
||||
}
|
||||
__header_always_inline int __inline_isnand(double __x) {
|
||||
return __x != __x;
|
||||
}
|
||||
__header_always_inline int __inline_isnanl(long double __x) {
|
||||
return __x != __x;
|
||||
}
|
||||
__header_always_inline int __inline_signbitf(float __x) {
|
||||
union { float __f; unsigned int __u; } __u;
|
||||
__u.__f = __x;
|
||||
return (int)(__u.__u >> 31);
|
||||
}
|
||||
__header_always_inline int __inline_signbitd(double __x) {
|
||||
union { double __f; unsigned long long __u; } __u;
|
||||
__u.__f = __x;
|
||||
return (int)(__u.__u >> 63);
|
||||
}
|
||||
#if defined __i386__ || defined __x86_64__
|
||||
__header_always_inline int __inline_signbitl(long double __x) {
|
||||
union {
|
||||
long double __ld;
|
||||
struct{ unsigned long long __m; unsigned short __sexp; } __p;
|
||||
} __u;
|
||||
__u.__ld = __x;
|
||||
return (int)(__u.__p.__sexp >> 15);
|
||||
}
|
||||
#else
|
||||
__header_always_inline int __inline_signbitl(long double __x) {
|
||||
union { long double __f; unsigned long long __u;} __u;
|
||||
__u.__f = __x;
|
||||
return (int)(__u.__u >> 63);
|
||||
}
|
||||
#endif
|
||||
__header_always_inline int __inline_isnormalf(float __x) {
|
||||
return __inline_isfinitef(__x) && __builtin_fabsf(__x) >= __FLT_MIN__;
|
||||
}
|
||||
__header_always_inline int __inline_isnormald(double __x) {
|
||||
return __inline_isfinited(__x) && __builtin_fabs(__x) >= __DBL_MIN__;
|
||||
}
|
||||
__header_always_inline int __inline_isnormall(long double __x) {
|
||||
return __inline_isfinitel(__x) && __builtin_fabsl(__x) >= __LDBL_MIN__;
|
||||
}
|
||||
|
||||
#else /* defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__ */
|
||||
|
||||
/* Implementations making function calls to fall back on when -ffast-math
|
||||
or similar is specified. These are not available in iOS versions prior
|
||||
to 6.0. If you need them, you must target that version or later. */
|
||||
|
||||
#define isnormal(x) \
|
||||
( sizeof(x) == sizeof(float) ? __isnormalf((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __isnormald((double)(x)) \
|
||||
: __isnormall((long double)(x)))
|
||||
|
||||
#define isfinite(x) \
|
||||
( sizeof(x) == sizeof(float) ? __isfinitef((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __isfinited((double)(x)) \
|
||||
: __isfinitel((long double)(x)))
|
||||
|
||||
#define isinf(x) \
|
||||
( sizeof(x) == sizeof(float) ? __isinff((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __isinfd((double)(x)) \
|
||||
: __isinfl((long double)(x)))
|
||||
|
||||
#define isnan(x) \
|
||||
( sizeof(x) == sizeof(float) ? __isnanf((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __isnand((double)(x)) \
|
||||
: __isnanl((long double)(x)))
|
||||
|
||||
#define signbit(x) \
|
||||
( sizeof(x) == sizeof(float) ? __signbitf((float)(x)) \
|
||||
: sizeof(x) == sizeof(double) ? __signbitd((double)(x)) \
|
||||
: __signbitl((long double)(x)))
|
||||
|
||||
extern int __isnormalf(float);
|
||||
extern int __isnormald(double);
|
||||
extern int __isnormall(long double);
|
||||
extern int __isfinitef(float);
|
||||
extern int __isfinited(double);
|
||||
extern int __isfinitel(long double);
|
||||
extern int __isinff(float);
|
||||
extern int __isinfd(double);
|
||||
extern int __isinfl(long double);
|
||||
extern int __isnanf(float);
|
||||
extern int __isnand(double);
|
||||
extern int __isnanl(long double);
|
||||
extern int __signbitf(float);
|
||||
extern int __signbitd(double);
|
||||
extern int __signbitl(long double);
|
||||
|
||||
#endif /* defined(__GNUC__) && 0 == __FINITE_MATH_ONLY__ */
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* Math Functions *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
extern float acosf(float);
|
||||
extern double acos(double);
|
||||
extern long double acosl(long double);
|
||||
|
||||
extern float asinf(float);
|
||||
extern double asin(double);
|
||||
extern long double asinl(long double);
|
||||
|
||||
extern float atanf(float);
|
||||
extern double atan(double);
|
||||
extern long double atanl(long double);
|
||||
|
||||
extern float atan2f(float, float);
|
||||
extern double atan2(double, double);
|
||||
extern long double atan2l(long double, long double);
|
||||
|
||||
extern float cosf(float);
|
||||
extern double cos(double);
|
||||
extern long double cosl(long double);
|
||||
|
||||
extern float sinf(float);
|
||||
extern double sin(double);
|
||||
extern long double sinl(long double);
|
||||
|
||||
extern float tanf(float);
|
||||
extern double tan(double);
|
||||
extern long double tanl(long double);
|
||||
|
||||
extern float acoshf(float);
|
||||
extern double acosh(double);
|
||||
extern long double acoshl(long double);
|
||||
|
||||
extern float asinhf(float);
|
||||
extern double asinh(double);
|
||||
extern long double asinhl(long double);
|
||||
|
||||
extern float atanhf(float);
|
||||
extern double atanh(double);
|
||||
extern long double atanhl(long double);
|
||||
|
||||
extern float coshf(float);
|
||||
extern double cosh(double);
|
||||
extern long double coshl(long double);
|
||||
|
||||
extern float sinhf(float);
|
||||
extern double sinh(double);
|
||||
extern long double sinhl(long double);
|
||||
|
||||
extern float tanhf(float);
|
||||
extern double tanh(double);
|
||||
extern long double tanhl(long double);
|
||||
|
||||
extern float expf(float);
|
||||
extern double exp(double);
|
||||
extern long double expl(long double);
|
||||
|
||||
extern float exp2f(float);
|
||||
extern double exp2(double);
|
||||
extern long double exp2l(long double);
|
||||
|
||||
extern float expm1f(float);
|
||||
extern double expm1(double);
|
||||
extern long double expm1l(long double);
|
||||
|
||||
extern float logf(float);
|
||||
extern double log(double);
|
||||
extern long double logl(long double);
|
||||
|
||||
extern float log10f(float);
|
||||
extern double log10(double);
|
||||
extern long double log10l(long double);
|
||||
|
||||
extern float log2f(float);
|
||||
extern double log2(double);
|
||||
extern long double log2l(long double);
|
||||
|
||||
extern float log1pf(float);
|
||||
extern double log1p(double);
|
||||
extern long double log1pl(long double);
|
||||
|
||||
extern float logbf(float);
|
||||
extern double logb(double);
|
||||
extern long double logbl(long double);
|
||||
|
||||
extern float modff(float, float *);
|
||||
extern double modf(double, double *);
|
||||
extern long double modfl(long double, long double *);
|
||||
|
||||
extern float ldexpf(float, int);
|
||||
extern double ldexp(double, int);
|
||||
extern long double ldexpl(long double, int);
|
||||
|
||||
extern float frexpf(float, int *);
|
||||
extern double frexp(double, int *);
|
||||
extern long double frexpl(long double, int *);
|
||||
|
||||
extern int ilogbf(float);
|
||||
extern int ilogb(double);
|
||||
extern int ilogbl(long double);
|
||||
|
||||
extern float scalbnf(float, int);
|
||||
extern double scalbn(double, int);
|
||||
extern long double scalbnl(long double, int);
|
||||
|
||||
extern float scalblnf(float, long int);
|
||||
extern double scalbln(double, long int);
|
||||
extern long double scalblnl(long double, long int);
|
||||
|
||||
extern float fabsf(float);
|
||||
extern double fabs(double);
|
||||
extern long double fabsl(long double);
|
||||
|
||||
extern float cbrtf(float);
|
||||
extern double cbrt(double);
|
||||
extern long double cbrtl(long double);
|
||||
|
||||
extern float hypotf(float, float);
|
||||
extern double hypot(double, double);
|
||||
extern long double hypotl(long double, long double);
|
||||
|
||||
extern float powf(float, float);
|
||||
extern double pow(double, double);
|
||||
extern long double powl(long double, long double);
|
||||
|
||||
extern float sqrtf(float);
|
||||
extern double sqrt(double);
|
||||
extern long double sqrtl(long double);
|
||||
|
||||
extern float erff(float);
|
||||
extern double erf(double);
|
||||
extern long double erfl(long double);
|
||||
|
||||
extern float erfcf(float);
|
||||
extern double erfc(double);
|
||||
extern long double erfcl(long double);
|
||||
|
||||
/* lgammaf, lgamma, and lgammal are not thread-safe. The thread-safe
|
||||
variants lgammaf_r, lgamma_r, and lgammal_r are made available if
|
||||
you define the _REENTRANT symbol before including <math.h> */
|
||||
extern float lgammaf(float);
|
||||
extern double lgamma(double);
|
||||
extern long double lgammal(long double);
|
||||
|
||||
extern float tgammaf(float);
|
||||
extern double tgamma(double);
|
||||
extern long double tgammal(long double);
|
||||
|
||||
extern float ceilf(float);
|
||||
extern double ceil(double);
|
||||
extern long double ceill(long double);
|
||||
|
||||
extern float floorf(float);
|
||||
extern double floor(double);
|
||||
extern long double floorl(long double);
|
||||
|
||||
extern float nearbyintf(float);
|
||||
extern double nearbyint(double);
|
||||
extern long double nearbyintl(long double);
|
||||
|
||||
extern float rintf(float);
|
||||
extern double rint(double);
|
||||
extern long double rintl(long double);
|
||||
|
||||
extern long int lrintf(float);
|
||||
extern long int lrint(double);
|
||||
extern long int lrintl(long double);
|
||||
|
||||
extern float roundf(float);
|
||||
extern double round(double);
|
||||
extern long double roundl(long double);
|
||||
|
||||
extern long int lroundf(float);
|
||||
extern long int lround(double);
|
||||
extern long int lroundl(long double);
|
||||
|
||||
/* long long is not part of C90. Make sure you are passing -std=c99 or
|
||||
-std=gnu99 or higher if you need these functions returning long longs */
|
||||
#if !(__DARWIN_NO_LONG_LONG)
|
||||
extern long long int llrintf(float);
|
||||
extern long long int llrint(double);
|
||||
extern long long int llrintl(long double);
|
||||
|
||||
extern long long int llroundf(float);
|
||||
extern long long int llround(double);
|
||||
extern long long int llroundl(long double);
|
||||
#endif /* !(__DARWIN_NO_LONG_LONG) */
|
||||
|
||||
extern float truncf(float);
|
||||
extern double trunc(double);
|
||||
extern long double truncl(long double);
|
||||
|
||||
extern float fmodf(float, float);
|
||||
extern double fmod(double, double);
|
||||
extern long double fmodl(long double, long double);
|
||||
|
||||
extern float remainderf(float, float);
|
||||
extern double remainder(double, double);
|
||||
extern long double remainderl(long double, long double);
|
||||
|
||||
extern float remquof(float, float, int *);
|
||||
extern double remquo(double, double, int *);
|
||||
extern long double remquol(long double, long double, int *);
|
||||
|
||||
extern float copysignf(float, float);
|
||||
extern double copysign(double, double);
|
||||
extern long double copysignl(long double, long double);
|
||||
|
||||
extern float nanf(const char *);
|
||||
extern double nan(const char *);
|
||||
extern long double nanl(const char *);
|
||||
|
||||
extern float nextafterf(float, float);
|
||||
extern double nextafter(double, double);
|
||||
extern long double nextafterl(long double, long double);
|
||||
|
||||
extern double nexttoward(double, long double);
|
||||
extern float nexttowardf(float, long double);
|
||||
extern long double nexttowardl(long double, long double);
|
||||
|
||||
extern float fdimf(float, float);
|
||||
extern double fdim(double, double);
|
||||
extern long double fdiml(long double, long double);
|
||||
|
||||
extern float fmaxf(float, float);
|
||||
extern double fmax(double, double);
|
||||
extern long double fmaxl(long double, long double);
|
||||
|
||||
extern float fminf(float, float);
|
||||
extern double fmin(double, double);
|
||||
extern long double fminl(long double, long double);
|
||||
|
||||
extern float fmaf(float, float, float);
|
||||
extern double fma(double, double, double);
|
||||
extern long double fmal(long double, long double, long double);
|
||||
|
||||
#define isgreater(x, y) __builtin_isgreater((x),(y))
|
||||
#define isgreaterequal(x, y) __builtin_isgreaterequal((x),(y))
|
||||
#define isless(x, y) __builtin_isless((x),(y))
|
||||
#define islessequal(x, y) __builtin_islessequal((x),(y))
|
||||
#define islessgreater(x, y) __builtin_islessgreater((x),(y))
|
||||
#define isunordered(x, y) __builtin_isunordered((x),(y))
|
||||
|
||||
#if defined __i386__ || defined __x86_64__
|
||||
/* Deprecated functions; use the INFINITY and NAN macros instead. */
|
||||
extern float __inff(void)
|
||||
__API_DEPRECATED("use `(float)INFINITY` instead", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
extern double __inf(void)
|
||||
__API_DEPRECATED("use `INFINITY` instead", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
extern long double __infl(void)
|
||||
__API_DEPRECATED("use `(long double)INFINITY` instead", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
extern float __nan(void)
|
||||
__API_DEPRECATED("use `NAN` instead", macos(10.0, 10.14)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Reentrant variants of lgamma[fl] *
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef _REENTRANT
|
||||
/* Reentrant variants of the lgamma[fl] functions. */
|
||||
extern float lgammaf_r(float, int *) __API_AVAILABLE(macos(10.6), ios(3.1));
|
||||
extern double lgamma_r(double, int *) __API_AVAILABLE(macos(10.6), ios(3.1));
|
||||
extern long double lgammal_r(long double, int *) __API_AVAILABLE(macos(10.6), ios(3.1));
|
||||
#endif /* _REENTRANT */
|
||||
|
||||
/******************************************************************************
|
||||
* Apple extensions to the C standard *
|
||||
******************************************************************************/
|
||||
|
||||
/* Because these functions are not specified by any relevant standard, they
|
||||
are prefixed with __, which places them in the implementor's namespace, so
|
||||
they should not conflict with any developer or third-party code. If they
|
||||
are added to a relevant standard in the future, un-prefixed names may be
|
||||
added to the library and they may be moved out of this section of the
|
||||
header.
|
||||
|
||||
Because these functions are non-standard, they may not be available on non-
|
||||
Apple platforms. */
|
||||
|
||||
/* __exp10(x) returns 10**x. Edge cases match those of exp( ) and exp2( ). */
|
||||
extern float __exp10f(float) __API_AVAILABLE(macos(10.9), ios(7.0));
|
||||
extern double __exp10(double) __API_AVAILABLE(macos(10.9), ios(7.0));
|
||||
|
||||
/* __sincos(x,sinp,cosp) computes the sine and cosine of x with a single
|
||||
function call, storing the sine in the memory pointed to by sinp, and
|
||||
the cosine in the memory pointed to by cosp. Edge cases match those of
|
||||
separate calls to sin( ) and cos( ). */
|
||||
__header_always_inline void __sincosf(float __x, float *__sinp, float *__cosp);
|
||||
__header_always_inline void __sincos(double __x, double *__sinp, double *__cosp);
|
||||
|
||||
/* __sinpi(x) returns the sine of pi times x; __cospi(x) and __tanpi(x) return
|
||||
the cosine and tangent, respectively. These functions can produce a more
|
||||
accurate answer than expressions of the form sin(M_PI * x) because they
|
||||
avoid any loss of precision that results from rounding the result of the
|
||||
multiplication M_PI * x. They may also be significantly more efficient in
|
||||
some cases because the argument reduction for these functions is easier
|
||||
to compute. Consult the man pages for edge case details. */
|
||||
extern float __cospif(float) __API_AVAILABLE(macos(10.9), ios(7.0));
|
||||
extern double __cospi(double) __API_AVAILABLE(macos(10.9), ios(7.0));
|
||||
extern float __sinpif(float) __API_AVAILABLE(macos(10.9), ios(7.0));
|
||||
extern double __sinpi(double) __API_AVAILABLE(macos(10.9), ios(7.0));
|
||||
extern float __tanpif(float) __API_AVAILABLE(macos(10.9), ios(7.0));
|
||||
extern double __tanpi(double) __API_AVAILABLE(macos(10.9), ios(7.0));
|
||||
|
||||
#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 1090) || \
|
||||
(defined __IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < 70000)
|
||||
/* __sincos and __sincosf were introduced in OSX 10.9 and iOS 7.0. When
|
||||
targeting an older system, we simply split them up into discrete calls
|
||||
to sin( ) and cos( ). */
|
||||
__header_always_inline void __sincosf(float __x, float *__sinp, float *__cosp) {
|
||||
*__sinp = sinf(__x);
|
||||
*__cosp = cosf(__x);
|
||||
}
|
||||
|
||||
__header_always_inline void __sincos(double __x, double *__sinp, double *__cosp) {
|
||||
*__sinp = sin(__x);
|
||||
*__cosp = cos(__x);
|
||||
}
|
||||
#else
|
||||
/* __sincospi(x,sinp,cosp) computes the sine and cosine of pi times x with a
|
||||
single function call, storing the sine in the memory pointed to by sinp,
|
||||
and the cosine in the memory pointed to by cosp. Edge cases match those
|
||||
of separate calls to __sinpi( ) and __cospi( ), and are documented in the
|
||||
man pages.
|
||||
|
||||
These functions were introduced in OSX 10.9 and iOS 7.0. Because they are
|
||||
implemented as header inlines, weak-linking does not function as normal,
|
||||
and they are simply hidden when targeting earlier OS versions. */
|
||||
__header_always_inline void __sincospif(float __x, float *__sinp, float *__cosp);
|
||||
__header_always_inline void __sincospi(double __x, double *__sinp, double *__cosp);
|
||||
|
||||
/* Implementation details of __sincos and __sincospi allowing them to return
|
||||
two results while allowing the compiler to optimize away unnecessary load-
|
||||
store traffic. Although these interfaces are exposed in the math.h header
|
||||
to allow compilers to generate better code, users should call __sincos[f]
|
||||
and __sincospi[f] instead and allow the compiler to emit these calls. */
|
||||
struct __float2 { float __sinval; float __cosval; };
|
||||
struct __double2 { double __sinval; double __cosval; };
|
||||
|
||||
extern struct __float2 __sincosf_stret(float);
|
||||
extern struct __double2 __sincos_stret(double);
|
||||
extern struct __float2 __sincospif_stret(float);
|
||||
extern struct __double2 __sincospi_stret(double);
|
||||
|
||||
__header_always_inline void __sincosf(float __x, float *__sinp, float *__cosp) {
|
||||
const struct __float2 __stret = __sincosf_stret(__x);
|
||||
*__sinp = __stret.__sinval; *__cosp = __stret.__cosval;
|
||||
}
|
||||
|
||||
__header_always_inline void __sincos(double __x, double *__sinp, double *__cosp) {
|
||||
const struct __double2 __stret = __sincos_stret(__x);
|
||||
*__sinp = __stret.__sinval; *__cosp = __stret.__cosval;
|
||||
}
|
||||
|
||||
__header_always_inline void __sincospif(float __x, float *__sinp, float *__cosp) {
|
||||
const struct __float2 __stret = __sincospif_stret(__x);
|
||||
*__sinp = __stret.__sinval; *__cosp = __stret.__cosval;
|
||||
}
|
||||
|
||||
__header_always_inline void __sincospi(double __x, double *__sinp, double *__cosp) {
|
||||
const struct __double2 __stret = __sincospi_stret(__x);
|
||||
*__sinp = __stret.__sinval; *__cosp = __stret.__cosval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* POSIX/UNIX extensions to the C standard *
|
||||
******************************************************************************/
|
||||
|
||||
#if __DARWIN_C_LEVEL >= 199506L
|
||||
extern double j0(double) __API_AVAILABLE(macos(10.0), ios(3.2));
|
||||
extern double j1(double) __API_AVAILABLE(macos(10.0), ios(3.2));
|
||||
extern double jn(int, double) __API_AVAILABLE(macos(10.0), ios(3.2));
|
||||
extern double y0(double) __API_AVAILABLE(macos(10.0), ios(3.2));
|
||||
extern double y1(double) __API_AVAILABLE(macos(10.0), ios(3.2));
|
||||
extern double yn(int, double) __API_AVAILABLE(macos(10.0), ios(3.2));
|
||||
extern double scalb(double, double);
|
||||
extern int signgam;
|
||||
|
||||
/* Even though these might be more useful as long doubles, POSIX requires
|
||||
that they be double-precision literals. */
|
||||
#define M_E 2.71828182845904523536028747135266250 /* e */
|
||||
#define M_LOG2E 1.44269504088896340735992468100189214 /* log2(e) */
|
||||
#define M_LOG10E 0.434294481903251827651128918916605082 /* log10(e) */
|
||||
#define M_LN2 0.693147180559945309417232121458176568 /* loge(2) */
|
||||
#define M_LN10 2.30258509299404568401799145468436421 /* loge(10) */
|
||||
#define M_PI 3.14159265358979323846264338327950288 /* pi */
|
||||
#define M_PI_2 1.57079632679489661923132169163975144 /* pi/2 */
|
||||
#define M_PI_4 0.785398163397448309615660845819875721 /* pi/4 */
|
||||
#define M_1_PI 0.318309886183790671537767526745028724 /* 1/pi */
|
||||
#define M_2_PI 0.636619772367581343075535053490057448 /* 2/pi */
|
||||
#define M_2_SQRTPI 1.12837916709551257389615890312154517 /* 2/sqrt(pi) */
|
||||
#define M_SQRT2 1.41421356237309504880168872420969808 /* sqrt(2) */
|
||||
#define M_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */
|
||||
|
||||
#define MAXFLOAT 0x1.fffffep+127f
|
||||
#endif /* __DARWIN_C_LEVEL >= 199506L */
|
||||
|
||||
/* Long-double versions of M_E, etc for convenience on Intel where long-
|
||||
double is not the same as double. Define __MATH_LONG_DOUBLE_CONSTANTS
|
||||
to make these constants available. */
|
||||
#if defined __MATH_LONG_DOUBLE_CONSTANTS
|
||||
#define M_El 0xa.df85458a2bb4a9bp-2L
|
||||
#define M_LOG2El 0xb.8aa3b295c17f0bcp-3L
|
||||
#define M_LOG10El 0xd.e5bd8a937287195p-5L
|
||||
#define M_LN2l 0xb.17217f7d1cf79acp-4L
|
||||
#define M_LN10l 0x9.35d8dddaaa8ac17p-2L
|
||||
#define M_PIl 0xc.90fdaa22168c235p-2L
|
||||
#define M_PI_2l 0xc.90fdaa22168c235p-3L
|
||||
#define M_PI_4l 0xc.90fdaa22168c235p-4L
|
||||
#define M_1_PIl 0xa.2f9836e4e44152ap-5L
|
||||
#define M_2_PIl 0xa.2f9836e4e44152ap-4L
|
||||
#define M_2_SQRTPIl 0x9.06eba8214db688dp-3L
|
||||
#define M_SQRT2l 0xb.504f333f9de6484p-3L
|
||||
#define M_SQRT1_2l 0xb.504f333f9de6484p-4L
|
||||
#endif /* defined __MATH_LONG_DOUBLE_CONSTANTS */
|
||||
|
||||
/******************************************************************************
|
||||
* Legacy BSD extensions to the C standard *
|
||||
******************************************************************************/
|
||||
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
|
||||
#define FP_SNAN FP_NAN
|
||||
#define FP_QNAN FP_NAN
|
||||
#define HUGE MAXFLOAT
|
||||
#define X_TLOSS 1.41484755040568800000e+16
|
||||
#define DOMAIN 1
|
||||
#define SING 2
|
||||
#define OVERFLOW 3
|
||||
#define UNDERFLOW 4
|
||||
#define TLOSS 5
|
||||
#define PLOSS 6
|
||||
|
||||
#if defined __i386__ || defined __x86_64__
|
||||
/* Legacy BSD API; use the C99 `lrint( )` function instead. */
|
||||
extern long int rinttol(double)
|
||||
__API_DEPRECATED_WITH_REPLACEMENT("lrint", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
/* Legacy BSD API; use the C99 `lround( )` function instead. */
|
||||
extern long int roundtol(double)
|
||||
__API_DEPRECATED_WITH_REPLACEMENT("lround", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
/* Legacy BSD API; use the C99 `remainder( )` function instead. */
|
||||
extern double drem(double, double)
|
||||
__API_DEPRECATED_WITH_REPLACEMENT("remainder", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
/* Legacy BSD API; use the C99 `isfinite( )` macro instead. */
|
||||
extern int finite(double)
|
||||
__API_DEPRECATED("Use `isfinite((double)x)` instead.", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
/* Legacy BSD API; use the C99 `tgamma( )` function instead. */
|
||||
extern double gamma(double)
|
||||
__API_DEPRECATED_WITH_REPLACEMENT("tgamma", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
/* Legacy BSD API; use `2*frexp( )` or `scalbn(x, -ilogb(x))` instead. */
|
||||
extern double significand(double)
|
||||
__API_DEPRECATED("Use `2*frexp( )` or `scalbn(x, -ilogb(x))` instead.", macos(10.0, 10.9)) __API_UNAVAILABLE(ios, watchos, tvos);
|
||||
#endif
|
||||
|
||||
#if !defined __cplusplus
|
||||
struct exception {
|
||||
int type;
|
||||
char *name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
};
|
||||
|
||||
#endif /* !defined __cplusplus */
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
|
||||
|
||||
__END_DECLS
|
||||
#endif /* __MATH_H__ */
|
||||
442
lib/libc/include/aarch64-macos-gnu/net/if.h
Normal file
442
lib/libc/include/aarch64-macos-gnu/net/if.h
Normal file
@ -0,0 +1,442 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2020 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@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 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.
|
||||
*
|
||||
* @(#)if.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_H_
|
||||
#define _NET_IF_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <net/net_kev.h>
|
||||
|
||||
#define IF_NAMESIZE 16
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#include <sys/appleapiopts.h>
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <net/if_var.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#endif
|
||||
|
||||
struct if_clonereq {
|
||||
int ifcr_total; /* total cloners (out) */
|
||||
int ifcr_count; /* room for this many in user buffer */
|
||||
char *ifcr_buffer; /* buffer for cloner names */
|
||||
};
|
||||
|
||||
|
||||
#define IFF_UP 0x1 /* interface is up */
|
||||
#define IFF_BROADCAST 0x2 /* broadcast address valid */
|
||||
#define IFF_DEBUG 0x4 /* turn on debugging */
|
||||
#define IFF_LOOPBACK 0x8 /* is a loopback net */
|
||||
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
|
||||
#define IFF_NOTRAILERS 0x20 /* obsolete: avoid use of trailers */
|
||||
#define IFF_RUNNING 0x40 /* resources allocated */
|
||||
#define IFF_NOARP 0x80 /* no address resolution protocol */
|
||||
#define IFF_PROMISC 0x100 /* receive all packets */
|
||||
#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
|
||||
#define IFF_OACTIVE 0x400 /* transmission in progress */
|
||||
#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */
|
||||
#define IFF_LINK0 0x1000 /* per link layer defined bit */
|
||||
#define IFF_LINK1 0x2000 /* per link layer defined bit */
|
||||
#define IFF_LINK2 0x4000 /* per link layer defined bit */
|
||||
#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */
|
||||
#define IFF_MULTICAST 0x8000 /* supports multicast */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Capabilities that interfaces can advertise.
|
||||
*
|
||||
* struct ifnet.if_capabilities
|
||||
* contains the optional features & capabilities a particular interface
|
||||
* supports (not only the driver but also the detected hw revision).
|
||||
* Capabilities are defined by IFCAP_* below.
|
||||
* struct ifnet.if_capenable
|
||||
* contains the enabled (either by default or through ifconfig) optional
|
||||
* features & capabilities on this interface.
|
||||
* Capabilities are defined by IFCAP_* below.
|
||||
* struct if_data.ifi_hwassist in IFNET_* form, defined in net/kpi_interface.h,
|
||||
* contains the enabled optional features & capabilites that can be used
|
||||
* individually per packet and are specified in the mbuf pkthdr.csum_flags
|
||||
* field. IFCAP_* and IFNET_* do not match one to one and IFNET_* may be
|
||||
* more detailed or differentiated than IFCAP_*.
|
||||
* IFNET_* hwassist flags have corresponding CSUM_* in sys/mbuf.h
|
||||
*/
|
||||
#define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */
|
||||
#define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */
|
||||
#define IFCAP_VLAN_MTU 0x00004 /* VLAN-compatible MTU */
|
||||
#define IFCAP_VLAN_HWTAGGING 0x00008 /* hardware VLAN tag support */
|
||||
#define IFCAP_JUMBO_MTU 0x00010 /* 9000 byte MTU supported */
|
||||
#define IFCAP_TSO4 0x00020 /* can do TCP Segmentation Offload */
|
||||
#define IFCAP_TSO6 0x00040 /* can do TCP6 Segmentation Offload */
|
||||
#define IFCAP_LRO 0x00080 /* can do Large Receive Offload */
|
||||
#define IFCAP_AV 0x00100 /* can do 802.1 AV Bridging */
|
||||
#define IFCAP_TXSTATUS 0x00200 /* can return linklevel xmit status */
|
||||
#define IFCAP_SKYWALK 0x00400 /* Skywalk mode supported/enabled */
|
||||
#define IFCAP_HW_TIMESTAMP 0x00800 /* Time stamping in hardware */
|
||||
#define IFCAP_SW_TIMESTAMP 0x01000 /* Time stamping in software */
|
||||
#define IFCAP_CSUM_PARTIAL 0x02000 /* can offload partial checksum */
|
||||
#define IFCAP_CSUM_ZERO_INVERT 0x04000 /* can invert 0 to -0 (0xffff) */
|
||||
|
||||
#define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM)
|
||||
#define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6)
|
||||
|
||||
#define IFCAP_VALID (IFCAP_HWCSUM | IFCAP_TSO | IFCAP_LRO | IFCAP_VLAN_MTU | \
|
||||
IFCAP_VLAN_HWTAGGING | IFCAP_JUMBO_MTU | IFCAP_AV | IFCAP_TXSTATUS | \
|
||||
IFCAP_SKYWALK | IFCAP_SW_TIMESTAMP | IFCAP_HW_TIMESTAMP | \
|
||||
IFCAP_CSUM_PARTIAL | IFCAP_CSUM_ZERO_INVERT)
|
||||
|
||||
#define IFQ_MAXLEN 128
|
||||
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
|
||||
#define IFQ_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */
|
||||
#define IFQ_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */
|
||||
|
||||
/*
|
||||
* Message format for use in obtaining information about interfaces
|
||||
* from sysctl and the routing socket
|
||||
*/
|
||||
struct if_msghdr {
|
||||
unsigned short ifm_msglen; /* to skip non-understood messages */
|
||||
unsigned char ifm_version; /* future binary compatability */
|
||||
unsigned char ifm_type; /* message type */
|
||||
int ifm_addrs; /* like rtm_addrs */
|
||||
int ifm_flags; /* value of if_flags */
|
||||
unsigned short ifm_index; /* index for associated ifp */
|
||||
struct if_data ifm_data; /* statistics and other data about if */
|
||||
};
|
||||
|
||||
/*
|
||||
* Message format for use in obtaining information about interface addresses
|
||||
* from sysctl and the routing socket
|
||||
*/
|
||||
struct ifa_msghdr {
|
||||
unsigned short ifam_msglen; /* to skip non-understood messages */
|
||||
unsigned char ifam_version; /* future binary compatability */
|
||||
unsigned char ifam_type; /* message type */
|
||||
int ifam_addrs; /* like rtm_addrs */
|
||||
int ifam_flags; /* value of ifa_flags */
|
||||
unsigned short ifam_index; /* index for associated ifp */
|
||||
int ifam_metric; /* value of ifa_metric */
|
||||
};
|
||||
|
||||
/*
|
||||
* Message format for use in obtaining information about multicast addresses
|
||||
* from the routing socket
|
||||
*/
|
||||
struct ifma_msghdr {
|
||||
unsigned short ifmam_msglen; /* to skip non-understood messages */
|
||||
unsigned char ifmam_version; /* future binary compatability */
|
||||
unsigned char ifmam_type; /* message type */
|
||||
int ifmam_addrs; /* like rtm_addrs */
|
||||
int ifmam_flags; /* value of ifa_flags */
|
||||
unsigned short ifmam_index; /* index for associated ifp */
|
||||
};
|
||||
|
||||
/*
|
||||
* Message format for use in obtaining information about interfaces
|
||||
* from sysctl
|
||||
*/
|
||||
struct if_msghdr2 {
|
||||
u_short ifm_msglen; /* to skip over non-understood messages */
|
||||
u_char ifm_version; /* future binary compatability */
|
||||
u_char ifm_type; /* message type */
|
||||
int ifm_addrs; /* like rtm_addrs */
|
||||
int ifm_flags; /* value of if_flags */
|
||||
u_short ifm_index; /* index for associated ifp */
|
||||
int ifm_snd_len; /* instantaneous length of send queue */
|
||||
int ifm_snd_maxlen; /* maximum length of send queue */
|
||||
int ifm_snd_drops; /* number of drops in send queue */
|
||||
int ifm_timer; /* time until if_watchdog called */
|
||||
struct if_data64 ifm_data; /* statistics and other data */
|
||||
};
|
||||
|
||||
/*
|
||||
* Message format for use in obtaining information about multicast addresses
|
||||
* from sysctl
|
||||
*/
|
||||
struct ifma_msghdr2 {
|
||||
u_short ifmam_msglen; /* to skip over non-understood messages */
|
||||
u_char ifmam_version; /* future binary compatability */
|
||||
u_char ifmam_type; /* message type */
|
||||
int ifmam_addrs; /* like rtm_addrs */
|
||||
int ifmam_flags; /* value of ifa_flags */
|
||||
u_short ifmam_index; /* index for associated ifp */
|
||||
int32_t ifmam_refcount;
|
||||
};
|
||||
|
||||
/*
|
||||
* ifdevmtu: interface device mtu
|
||||
* Used with SIOCGIFDEVMTU to get the current mtu in use by the device,
|
||||
* as well as the minimum and maximum mtu allowed by the device.
|
||||
*/
|
||||
struct ifdevmtu {
|
||||
int ifdm_current;
|
||||
int ifdm_min;
|
||||
int ifdm_max;
|
||||
};
|
||||
|
||||
#pragma pack(4)
|
||||
|
||||
/*
|
||||
* ifkpi: interface kpi ioctl
|
||||
* Used with SIOCSIFKPI and SIOCGIFKPI.
|
||||
*
|
||||
* ifk_module_id - From in the kernel, a value from kev_vendor_code_find. From
|
||||
* user space, a value from SIOCGKEVVENDOR ioctl on a kernel event socket.
|
||||
* ifk_type - The type. Types are specific to each module id.
|
||||
* ifk_data - The data. ifk_ptr may be a 64bit pointer for 64 bit processes.
|
||||
*
|
||||
* Copying data between user space and kernel space is done using copyin
|
||||
* and copyout. A process may be running in 64bit mode. In such a case,
|
||||
* the pointer will be a 64bit pointer, not a 32bit pointer. The following
|
||||
* sample is a safe way to copy the data in to the kernel from either a
|
||||
* 32bit or 64bit process:
|
||||
*
|
||||
* user_addr_t tmp_ptr;
|
||||
* if (IS_64BIT_PROCESS(current_proc())) {
|
||||
* tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr64);
|
||||
* }
|
||||
* else {
|
||||
* tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr);
|
||||
* }
|
||||
* error = copyin(tmp_ptr, allocated_dst_buffer, size of allocated_dst_buffer);
|
||||
*/
|
||||
|
||||
struct ifkpi {
|
||||
unsigned int ifk_module_id;
|
||||
unsigned int ifk_type;
|
||||
union {
|
||||
void *ifk_ptr;
|
||||
int ifk_value;
|
||||
} ifk_data;
|
||||
};
|
||||
|
||||
/* Wake capabilities of a interface */
|
||||
#define IF_WAKE_ON_MAGIC_PACKET 0x01
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/*
|
||||
* Interface request structure used for socket
|
||||
* ioctl's. All interface ioctl's must have parameter
|
||||
* definitions which begin with ifr_name. The
|
||||
* remainder may be interface specific.
|
||||
*/
|
||||
struct ifreq {
|
||||
#ifndef IFNAMSIZ
|
||||
#define IFNAMSIZ IF_NAMESIZE
|
||||
#endif
|
||||
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
union {
|
||||
struct sockaddr ifru_addr;
|
||||
struct sockaddr ifru_dstaddr;
|
||||
struct sockaddr ifru_broadaddr;
|
||||
short ifru_flags;
|
||||
int ifru_metric;
|
||||
int ifru_mtu;
|
||||
int ifru_phys;
|
||||
int ifru_media;
|
||||
int ifru_intval;
|
||||
caddr_t ifru_data;
|
||||
struct ifdevmtu ifru_devmtu;
|
||||
struct ifkpi ifru_kpi;
|
||||
u_int32_t ifru_wake_flags;
|
||||
u_int32_t ifru_route_refcnt;
|
||||
int ifru_cap[2];
|
||||
u_int32_t ifru_functional_type;
|
||||
#define IFRTYPE_FUNCTIONAL_UNKNOWN 0
|
||||
#define IFRTYPE_FUNCTIONAL_LOOPBACK 1
|
||||
#define IFRTYPE_FUNCTIONAL_WIRED 2
|
||||
#define IFRTYPE_FUNCTIONAL_WIFI_INFRA 3
|
||||
#define IFRTYPE_FUNCTIONAL_WIFI_AWDL 4
|
||||
#define IFRTYPE_FUNCTIONAL_CELLULAR 5
|
||||
#define IFRTYPE_FUNCTIONAL_INTCOPROC 6
|
||||
#define IFRTYPE_FUNCTIONAL_COMPANIONLINK 7
|
||||
#define IFRTYPE_FUNCTIONAL_LAST 7
|
||||
} ifr_ifru;
|
||||
#define ifr_addr ifr_ifru.ifru_addr /* address */
|
||||
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
|
||||
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
|
||||
#ifdef __APPLE__
|
||||
#define ifr_flags ifr_ifru.ifru_flags /* flags */
|
||||
#else
|
||||
#define ifr_flags ifr_ifru.ifru_flags[0] /* flags */
|
||||
#define ifr_prevflags ifr_ifru.ifru_flags[1] /* flags */
|
||||
#endif /* __APPLE__ */
|
||||
#define ifr_metric ifr_ifru.ifru_metric /* metric */
|
||||
#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */
|
||||
#define ifr_phys ifr_ifru.ifru_phys /* physical wire */
|
||||
#define ifr_media ifr_ifru.ifru_media /* physical media */
|
||||
#define ifr_data ifr_ifru.ifru_data /* for use by interface */
|
||||
#define ifr_devmtu ifr_ifru.ifru_devmtu
|
||||
#define ifr_intval ifr_ifru.ifru_intval /* integer value */
|
||||
#define ifr_kpi ifr_ifru.ifru_kpi
|
||||
#define ifr_wake_flags ifr_ifru.ifru_wake_flags /* wake capabilities */
|
||||
#define ifr_route_refcnt ifr_ifru.ifru_route_refcnt /* route references count */
|
||||
#define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */
|
||||
#define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */
|
||||
};
|
||||
|
||||
#define _SIZEOF_ADDR_IFREQ(ifr) \
|
||||
((ifr).ifr_addr.sa_len > sizeof (struct sockaddr) ? \
|
||||
(sizeof (struct ifreq) - sizeof (struct sockaddr) + \
|
||||
(ifr).ifr_addr.sa_len) : sizeof (struct ifreq))
|
||||
|
||||
struct ifaliasreq {
|
||||
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
struct sockaddr ifra_addr;
|
||||
struct sockaddr ifra_broadaddr;
|
||||
struct sockaddr ifra_mask;
|
||||
};
|
||||
|
||||
struct rslvmulti_req {
|
||||
struct sockaddr *sa;
|
||||
struct sockaddr **llsa;
|
||||
};
|
||||
|
||||
#pragma pack(4)
|
||||
|
||||
struct ifmediareq {
|
||||
char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
int ifm_current; /* current media options */
|
||||
int ifm_mask; /* don't care mask */
|
||||
int ifm_status; /* media status */
|
||||
int ifm_active; /* active options */
|
||||
int ifm_count; /* # entries in ifm_ulist array */
|
||||
int *ifm_ulist; /* media words */
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
|
||||
|
||||
#pragma pack(4)
|
||||
struct ifdrv {
|
||||
char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
unsigned long ifd_cmd;
|
||||
size_t ifd_len; /* length of ifd_data buffer */
|
||||
void *ifd_data;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
|
||||
/*
|
||||
* Structure used to retrieve aux status data from interfaces.
|
||||
* Kernel suppliers to this interface should respect the formatting
|
||||
* needed by ifconfig(8): each line starts with a TAB and ends with
|
||||
* a newline.
|
||||
*/
|
||||
|
||||
#define IFSTATMAX 800 /* 10 lines of text */
|
||||
struct ifstat {
|
||||
char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */
|
||||
char ascii[IFSTATMAX + 1];
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure used in SIOCGIFCONF request.
|
||||
* Used to retrieve interface configuration
|
||||
* for machine (useful for programs which
|
||||
* must know all networks accessible).
|
||||
*/
|
||||
#pragma pack(4)
|
||||
struct ifconf {
|
||||
int ifc_len; /* size of associated buffer */
|
||||
union {
|
||||
caddr_t ifcu_buf;
|
||||
struct ifreq *ifcu_req;
|
||||
} ifc_ifcu;
|
||||
};
|
||||
#pragma pack()
|
||||
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
|
||||
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
|
||||
|
||||
|
||||
/*
|
||||
* DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure
|
||||
*/
|
||||
struct kev_dl_proto_data {
|
||||
struct net_event_data link_data;
|
||||
u_int32_t proto_family;
|
||||
u_int32_t proto_remaining_count;
|
||||
};
|
||||
|
||||
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
|
||||
struct if_nameindex {
|
||||
unsigned int if_index; /* 1, 2, ... */
|
||||
char *if_name; /* null terminated name: "le0", ... */
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
unsigned int if_nametoindex(const char *);
|
||||
char *if_indextoname(unsigned int, char *);
|
||||
struct if_nameindex *if_nameindex(void);
|
||||
void if_freenameindex(struct if_nameindex *);
|
||||
__END_DECLS
|
||||
|
||||
|
||||
#endif /* !_NET_IF_H_ */
|
||||
243
lib/libc/include/aarch64-macos-gnu/net/if_var.h
Normal file
243
lib/libc/include/aarch64-macos-gnu/net/if_var.h
Normal file
@ -0,0 +1,243 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2020 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@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 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.
|
||||
*
|
||||
* From: @(#)if.h 8.1 (Berkeley) 6/10/93
|
||||
* $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_VAR_H_
|
||||
#define _NET_IF_VAR_H_
|
||||
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/queue.h> /* get TAILQ macros */
|
||||
#ifdef BSD_KERN_PRIVATE
|
||||
#include <net/pktsched/pktsched.h>
|
||||
#include <sys/eventhandler.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define APPLE_IF_FAM_LOOPBACK 1
|
||||
#define APPLE_IF_FAM_ETHERNET 2
|
||||
#define APPLE_IF_FAM_SLIP 3
|
||||
#define APPLE_IF_FAM_TUN 4
|
||||
#define APPLE_IF_FAM_VLAN 5
|
||||
#define APPLE_IF_FAM_PPP 6
|
||||
#define APPLE_IF_FAM_PVC 7
|
||||
#define APPLE_IF_FAM_DISC 8
|
||||
#define APPLE_IF_FAM_MDECAP 9
|
||||
#define APPLE_IF_FAM_GIF 10
|
||||
#define APPLE_IF_FAM_FAITH 11 /* deprecated */
|
||||
#define APPLE_IF_FAM_STF 12
|
||||
#define APPLE_IF_FAM_FIREWIRE 13
|
||||
#define APPLE_IF_FAM_BOND 14
|
||||
#define APPLE_IF_FAM_CELLULAR 15
|
||||
#define APPLE_IF_FAM_6LOWPAN 16
|
||||
#define APPLE_IF_FAM_UTUN 17
|
||||
#define APPLE_IF_FAM_IPSEC 18
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
/*
|
||||
* 72 was chosen below because it is the size of a TCP/IP
|
||||
* header (40) + the minimum mss (32).
|
||||
*/
|
||||
#define IF_MINMTU 72
|
||||
#define IF_MAXMTU 65535
|
||||
|
||||
/*
|
||||
* Structures defining a network interface, providing a packet
|
||||
* transport mechanism (ala level 0 of the PUP protocols).
|
||||
*
|
||||
* Each interface accepts output datagrams of a specified maximum
|
||||
* length, and provides higher level routines with input datagrams
|
||||
* received from its medium.
|
||||
*
|
||||
* Output occurs when the routine if_output is called, with three parameters:
|
||||
* (*ifp->if_output)(ifp, m, dst, rt)
|
||||
* Here m is the mbuf chain to be sent and dst is the destination address.
|
||||
* The output routine encapsulates the supplied datagram if necessary,
|
||||
* and then transmits it on its medium.
|
||||
*
|
||||
* On input, each interface unwraps the data received by it, and either
|
||||
* places it on the input queue of a internetwork datagram routine
|
||||
* and posts the associated software interrupt, or passes the datagram to a raw
|
||||
* packet input routine.
|
||||
*
|
||||
* Routines exist for locating interfaces by their addresses
|
||||
* or for locating a interface on a certain network, as well as more general
|
||||
* routing and gateway routines maintaining information used to locate
|
||||
* interfaces. These routines live in the files if.c and route.c
|
||||
*/
|
||||
|
||||
#define IFNAMSIZ 16
|
||||
|
||||
/* This belongs up in socket.h or socketvar.h, depending on how far the
|
||||
* event bubbles up.
|
||||
*/
|
||||
|
||||
struct net_event_data {
|
||||
u_int32_t if_family;
|
||||
u_int32_t if_unit;
|
||||
char if_name[IFNAMSIZ];
|
||||
};
|
||||
|
||||
#if defined(__LP64__)
|
||||
#include <sys/_types/_timeval32.h>
|
||||
#define IF_DATA_TIMEVAL timeval32
|
||||
#else
|
||||
#define IF_DATA_TIMEVAL timeval
|
||||
#endif
|
||||
|
||||
#pragma pack(4)
|
||||
|
||||
/*
|
||||
* Structure describing information about an interface
|
||||
* which may be of interest to management entities.
|
||||
*/
|
||||
struct if_data {
|
||||
/* generic interface information */
|
||||
u_char ifi_type; /* ethernet, tokenring, etc */
|
||||
u_char ifi_typelen; /* Length of frame type id */
|
||||
u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
|
||||
u_char ifi_addrlen; /* media address length */
|
||||
u_char ifi_hdrlen; /* media header length */
|
||||
u_char ifi_recvquota; /* polling quota for receive intrs */
|
||||
u_char ifi_xmitquota; /* polling quota for xmit intrs */
|
||||
u_char ifi_unused1; /* for future use */
|
||||
u_int32_t ifi_mtu; /* maximum transmission unit */
|
||||
u_int32_t ifi_metric; /* routing metric (external only) */
|
||||
u_int32_t ifi_baudrate; /* linespeed */
|
||||
/* volatile statistics */
|
||||
u_int32_t ifi_ipackets; /* packets received on interface */
|
||||
u_int32_t ifi_ierrors; /* input errors on interface */
|
||||
u_int32_t ifi_opackets; /* packets sent on interface */
|
||||
u_int32_t ifi_oerrors; /* output errors on interface */
|
||||
u_int32_t ifi_collisions; /* collisions on csma interfaces */
|
||||
u_int32_t ifi_ibytes; /* total number of octets received */
|
||||
u_int32_t ifi_obytes; /* total number of octets sent */
|
||||
u_int32_t ifi_imcasts; /* packets received via multicast */
|
||||
u_int32_t ifi_omcasts; /* packets sent via multicast */
|
||||
u_int32_t ifi_iqdrops; /* dropped on input, this interface */
|
||||
u_int32_t ifi_noproto; /* destined for unsupported protocol */
|
||||
u_int32_t ifi_recvtiming; /* usec spent receiving when timing */
|
||||
u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */
|
||||
struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */
|
||||
u_int32_t ifi_unused2; /* used to be the default_proto */
|
||||
u_int32_t ifi_hwassist; /* HW offload capabilities */
|
||||
u_int32_t ifi_reserved1; /* for future use */
|
||||
u_int32_t ifi_reserved2; /* for future use */
|
||||
};
|
||||
|
||||
/*
|
||||
* Structure describing information about an interface
|
||||
* which may be of interest to management entities.
|
||||
*/
|
||||
struct if_data64 {
|
||||
/* generic interface information */
|
||||
u_char ifi_type; /* ethernet, tokenring, etc */
|
||||
u_char ifi_typelen; /* Length of frame type id */
|
||||
u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
|
||||
u_char ifi_addrlen; /* media address length */
|
||||
u_char ifi_hdrlen; /* media header length */
|
||||
u_char ifi_recvquota; /* polling quota for receive intrs */
|
||||
u_char ifi_xmitquota; /* polling quota for xmit intrs */
|
||||
u_char ifi_unused1; /* for future use */
|
||||
u_int32_t ifi_mtu; /* maximum transmission unit */
|
||||
u_int32_t ifi_metric; /* routing metric (external only) */
|
||||
u_int64_t ifi_baudrate; /* linespeed */
|
||||
/* volatile statistics */
|
||||
u_int64_t ifi_ipackets; /* packets received on interface */
|
||||
u_int64_t ifi_ierrors; /* input errors on interface */
|
||||
u_int64_t ifi_opackets; /* packets sent on interface */
|
||||
u_int64_t ifi_oerrors; /* output errors on interface */
|
||||
u_int64_t ifi_collisions; /* collisions on csma interfaces */
|
||||
u_int64_t ifi_ibytes; /* total number of octets received */
|
||||
u_int64_t ifi_obytes; /* total number of octets sent */
|
||||
u_int64_t ifi_imcasts; /* packets received via multicast */
|
||||
u_int64_t ifi_omcasts; /* packets sent via multicast */
|
||||
u_int64_t ifi_iqdrops; /* dropped on input, this interface */
|
||||
u_int64_t ifi_noproto; /* destined for unsupported protocol */
|
||||
u_int32_t ifi_recvtiming; /* usec spent receiving when timing */
|
||||
u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */
|
||||
struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */
|
||||
};
|
||||
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/*
|
||||
* Structure defining a queue for a network interface.
|
||||
*/
|
||||
struct ifqueue {
|
||||
void *ifq_head;
|
||||
void *ifq_tail;
|
||||
int ifq_len;
|
||||
int ifq_maxlen;
|
||||
int ifq_drops;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* !_NET_IF_VAR_H_ */
|
||||
672
lib/libc/include/aarch64-macos-gnu/netinet/in.h
Normal file
672
lib/libc/include/aarch64-macos-gnu/netinet/in.h
Normal file
@ -0,0 +1,672 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2018 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@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 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.
|
||||
*
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
* $FreeBSD: src/sys/netinet/in.h,v 1.48.2.2 2001/04/21 14:53:06 ume Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_IN_H_
|
||||
#define _NETINET_IN_H_
|
||||
|
||||
#include <sys/appleapiopts.h>
|
||||
#include <stdint.h> /* uint(8|16|32)_t */
|
||||
|
||||
#include <Availability.h>
|
||||
|
||||
|
||||
#include <sys/_types/_in_addr_t.h>
|
||||
#include <sys/_types/_in_port_t.h>
|
||||
|
||||
/*
|
||||
* POSIX 1003.1-2003
|
||||
* "Inclusion of the <netinet/in.h> header may also make visible all
|
||||
* symbols from <inttypes.h> and <sys/socket.h>".
|
||||
*/
|
||||
#include <sys/socket.h>
|
||||
|
||||
/*
|
||||
* The following two #includes insure htonl and family are defined
|
||||
*/
|
||||
#include <machine/endian.h>
|
||||
#include <sys/_endian.h>
|
||||
|
||||
/*
|
||||
* Constants and structures defined by the internet system,
|
||||
* Per RFC 790, September 1981, and numerous additions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Protocols (RFC 1700)
|
||||
*/
|
||||
#define IPPROTO_IP 0 /* dummy for IP */
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IPPROTO_HOPOPTS 0 /* IP6 hop-by-hop options */
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
#define IPPROTO_ICMP 1 /* control message protocol */
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IPPROTO_IGMP 2 /* group mgmt protocol */
|
||||
#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
|
||||
#define IPPROTO_IPV4 4 /* IPv4 encapsulation */
|
||||
#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
#define IPPROTO_TCP 6 /* tcp */
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IPPROTO_ST 7 /* Stream protocol II */
|
||||
#define IPPROTO_EGP 8 /* exterior gateway protocol */
|
||||
#define IPPROTO_PIGP 9 /* private interior gateway */
|
||||
#define IPPROTO_RCCMON 10 /* BBN RCC Monitoring */
|
||||
#define IPPROTO_NVPII 11 /* network voice protocol*/
|
||||
#define IPPROTO_PUP 12 /* pup */
|
||||
#define IPPROTO_ARGUS 13 /* Argus */
|
||||
#define IPPROTO_EMCON 14 /* EMCON */
|
||||
#define IPPROTO_XNET 15 /* Cross Net Debugger */
|
||||
#define IPPROTO_CHAOS 16 /* Chaos*/
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
#define IPPROTO_UDP 17 /* user datagram protocol */
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IPPROTO_MUX 18 /* Multiplexing */
|
||||
#define IPPROTO_MEAS 19 /* DCN Measurement Subsystems */
|
||||
#define IPPROTO_HMP 20 /* Host Monitoring */
|
||||
#define IPPROTO_PRM 21 /* Packet Radio Measurement */
|
||||
#define IPPROTO_IDP 22 /* xns idp */
|
||||
#define IPPROTO_TRUNK1 23 /* Trunk-1 */
|
||||
#define IPPROTO_TRUNK2 24 /* Trunk-2 */
|
||||
#define IPPROTO_LEAF1 25 /* Leaf-1 */
|
||||
#define IPPROTO_LEAF2 26 /* Leaf-2 */
|
||||
#define IPPROTO_RDP 27 /* Reliable Data */
|
||||
#define IPPROTO_IRTP 28 /* Reliable Transaction */
|
||||
#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
|
||||
#define IPPROTO_BLT 30 /* Bulk Data Transfer */
|
||||
#define IPPROTO_NSP 31 /* Network Services */
|
||||
#define IPPROTO_INP 32 /* Merit Internodal */
|
||||
#define IPPROTO_SEP 33 /* Sequential Exchange */
|
||||
#define IPPROTO_3PC 34 /* Third Party Connect */
|
||||
#define IPPROTO_IDPR 35 /* InterDomain Policy Routing */
|
||||
#define IPPROTO_XTP 36 /* XTP */
|
||||
#define IPPROTO_DDP 37 /* Datagram Delivery */
|
||||
#define IPPROTO_CMTP 38 /* Control Message Transport */
|
||||
#define IPPROTO_TPXX 39 /* TP++ Transport */
|
||||
#define IPPROTO_IL 40 /* IL transport protocol */
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
#define IPPROTO_IPV6 41 /* IP6 header */
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IPPROTO_SDRP 42 /* Source Demand Routing */
|
||||
#define IPPROTO_ROUTING 43 /* IP6 routing header */
|
||||
#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */
|
||||
#define IPPROTO_IDRP 45 /* InterDomain Routing*/
|
||||
#define IPPROTO_RSVP 46 /* resource reservation */
|
||||
#define IPPROTO_GRE 47 /* General Routing Encap. */
|
||||
#define IPPROTO_MHRP 48 /* Mobile Host Routing */
|
||||
#define IPPROTO_BHA 49 /* BHA */
|
||||
#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */
|
||||
#define IPPROTO_AH 51 /* IP6 Auth Header */
|
||||
#define IPPROTO_INLSP 52 /* Integ. Net Layer Security */
|
||||
#define IPPROTO_SWIPE 53 /* IP with encryption */
|
||||
#define IPPROTO_NHRP 54 /* Next Hop Resolution */
|
||||
/* 55-57: Unassigned */
|
||||
#define IPPROTO_ICMPV6 58 /* ICMP6 */
|
||||
#define IPPROTO_NONE 59 /* IP6 no next header */
|
||||
#define IPPROTO_DSTOPTS 60 /* IP6 destination option */
|
||||
#define IPPROTO_AHIP 61 /* any host internal protocol */
|
||||
#define IPPROTO_CFTP 62 /* CFTP */
|
||||
#define IPPROTO_HELLO 63 /* "hello" routing protocol */
|
||||
#define IPPROTO_SATEXPAK 64 /* SATNET/Backroom EXPAK */
|
||||
#define IPPROTO_KRYPTOLAN 65 /* Kryptolan */
|
||||
#define IPPROTO_RVD 66 /* Remote Virtual Disk */
|
||||
#define IPPROTO_IPPC 67 /* Pluribus Packet Core */
|
||||
#define IPPROTO_ADFS 68 /* Any distributed FS */
|
||||
#define IPPROTO_SATMON 69 /* Satnet Monitoring */
|
||||
#define IPPROTO_VISA 70 /* VISA Protocol */
|
||||
#define IPPROTO_IPCV 71 /* Packet Core Utility */
|
||||
#define IPPROTO_CPNX 72 /* Comp. Prot. Net. Executive */
|
||||
#define IPPROTO_CPHB 73 /* Comp. Prot. HeartBeat */
|
||||
#define IPPROTO_WSN 74 /* Wang Span Network */
|
||||
#define IPPROTO_PVP 75 /* Packet Video Protocol */
|
||||
#define IPPROTO_BRSATMON 76 /* BackRoom SATNET Monitoring */
|
||||
#define IPPROTO_ND 77 /* Sun net disk proto (temp.) */
|
||||
#define IPPROTO_WBMON 78 /* WIDEBAND Monitoring */
|
||||
#define IPPROTO_WBEXPAK 79 /* WIDEBAND EXPAK */
|
||||
#define IPPROTO_EON 80 /* ISO cnlp */
|
||||
#define IPPROTO_VMTP 81 /* VMTP */
|
||||
#define IPPROTO_SVMTP 82 /* Secure VMTP */
|
||||
#define IPPROTO_VINES 83 /* Banyon VINES */
|
||||
#define IPPROTO_TTP 84 /* TTP */
|
||||
#define IPPROTO_IGP 85 /* NSFNET-IGP */
|
||||
#define IPPROTO_DGP 86 /* dissimilar gateway prot. */
|
||||
#define IPPROTO_TCF 87 /* TCF */
|
||||
#define IPPROTO_IGRP 88 /* Cisco/GXS IGRP */
|
||||
#define IPPROTO_OSPFIGP 89 /* OSPFIGP */
|
||||
#define IPPROTO_SRPC 90 /* Strite RPC protocol */
|
||||
#define IPPROTO_LARP 91 /* Locus Address Resoloution */
|
||||
#define IPPROTO_MTP 92 /* Multicast Transport */
|
||||
#define IPPROTO_AX25 93 /* AX.25 Frames */
|
||||
#define IPPROTO_IPEIP 94 /* IP encapsulated in IP */
|
||||
#define IPPROTO_MICP 95 /* Mobile Int.ing control */
|
||||
#define IPPROTO_SCCSP 96 /* Semaphore Comm. security */
|
||||
#define IPPROTO_ETHERIP 97 /* Ethernet IP encapsulation */
|
||||
#define IPPROTO_ENCAP 98 /* encapsulation header */
|
||||
#define IPPROTO_APES 99 /* any private encr. scheme */
|
||||
#define IPPROTO_GMTP 100 /* GMTP*/
|
||||
/* 101-252: Partly Unassigned */
|
||||
#define IPPROTO_PIM 103 /* Protocol Independent Mcast */
|
||||
#define IPPROTO_IPCOMP 108 /* payload compression (IPComp) */
|
||||
#define IPPROTO_PGM 113 /* PGM */
|
||||
#define IPPROTO_SCTP 132 /* SCTP */
|
||||
/* 253-254: Experimentation and testing; 255: Reserved (RFC3692) */
|
||||
/* BSD Private, local use, namespace incursion */
|
||||
#define IPPROTO_DIVERT 254 /* divert pseudo-protocol */
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
#define IPPROTO_RAW 255 /* raw IP packet */
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IPPROTO_MAX 256
|
||||
|
||||
/* last return value of *_input(), meaning "all job for this pkt is done". */
|
||||
#define IPPROTO_DONE 257
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
|
||||
/*
|
||||
* Local port number conventions:
|
||||
*
|
||||
* When a user does a bind(2) or connect(2) with a port number of zero,
|
||||
* a non-conflicting local port address is chosen.
|
||||
* The default range is IPPORT_RESERVED through
|
||||
* IPPORT_USERRESERVED, although that is settable by sysctl.
|
||||
*
|
||||
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
|
||||
* default assignment range.
|
||||
*
|
||||
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
|
||||
*
|
||||
* The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
|
||||
* into the "high" range. These are reserved for client outbound connections
|
||||
* which do not want to be filtered by any firewalls.
|
||||
*
|
||||
* The value IP_PORTRANGE_LOW changes the range to the "low" are
|
||||
* that is (by convention) restricted to privileged processes. This
|
||||
* convention is based on "vouchsafe" principles only. It is only secure
|
||||
* if you trust the remote host to restrict these ports.
|
||||
*
|
||||
* The default range of ports and the high range can be changed by
|
||||
* sysctl(3). (net.inet.ip.port{hi,low}{first,last}_auto)
|
||||
*
|
||||
* Changing those values has bad security implications if you are
|
||||
* using a a stateless firewall that is allowing packets outside of that
|
||||
* range in order to allow transparent outgoing connections.
|
||||
*
|
||||
* Such a firewall configuration will generally depend on the use of these
|
||||
* default values. If you change them, you may find your Security
|
||||
* Administrator looking for you with a heavy object.
|
||||
*
|
||||
* For a slightly more orthodox text view on this:
|
||||
*
|
||||
* ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers
|
||||
*
|
||||
* port numbers are divided into three ranges:
|
||||
*
|
||||
* 0 - 1023 Well Known Ports
|
||||
* 1024 - 49151 Registered Ports
|
||||
* 49152 - 65535 Dynamic and/or Private Ports
|
||||
*
|
||||
*/
|
||||
|
||||
#define __DARWIN_IPPORT_RESERVED 1024
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
/*
|
||||
* Ports < IPPORT_RESERVED are reserved for
|
||||
* privileged processes (e.g. root). (IP_PORTRANGE_LOW)
|
||||
* Ports > IPPORT_USERRESERVED are reserved
|
||||
* for servers, not necessarily privileged. (IP_PORTRANGE_DEFAULT)
|
||||
*/
|
||||
#ifndef IPPORT_RESERVED
|
||||
#define IPPORT_RESERVED __DARWIN_IPPORT_RESERVED
|
||||
#endif
|
||||
#define IPPORT_USERRESERVED 5000
|
||||
|
||||
/*
|
||||
* Default local port range to use by setting IP_PORTRANGE_HIGH
|
||||
*/
|
||||
#define IPPORT_HIFIRSTAUTO 49152
|
||||
#define IPPORT_HILASTAUTO 65535
|
||||
|
||||
/*
|
||||
* Scanning for a free reserved port return a value below IPPORT_RESERVED,
|
||||
* but higher than IPPORT_RESERVEDSTART. Traditionally the start value was
|
||||
* 512, but that conflicts with some well-known-services that firewalls may
|
||||
* have a fit if we use.
|
||||
*/
|
||||
#define IPPORT_RESERVEDSTART 600
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
|
||||
/*
|
||||
* Internet address (a structure for historical reasons)
|
||||
*/
|
||||
struct in_addr {
|
||||
in_addr_t s_addr;
|
||||
};
|
||||
|
||||
/*
|
||||
* Definitions of bits in internet address integers.
|
||||
* On subnets, the decomposition of addresses to host and net parts
|
||||
* is done according to subnet mask, not the masks here.
|
||||
*/
|
||||
#define INADDR_ANY (u_int32_t)0x00000000
|
||||
#define INADDR_BROADCAST (u_int32_t)0xffffffff /* must be masked */
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IN_CLASSA(i) (((u_int32_t)(i) & 0x80000000) == 0)
|
||||
#define IN_CLASSA_NET 0xff000000
|
||||
#define IN_CLASSA_NSHIFT 24
|
||||
#define IN_CLASSA_HOST 0x00ffffff
|
||||
#define IN_CLASSA_MAX 128
|
||||
|
||||
#define IN_CLASSB(i) (((u_int32_t)(i) & 0xc0000000) == 0x80000000)
|
||||
#define IN_CLASSB_NET 0xffff0000
|
||||
#define IN_CLASSB_NSHIFT 16
|
||||
#define IN_CLASSB_HOST 0x0000ffff
|
||||
#define IN_CLASSB_MAX 65536
|
||||
|
||||
#define IN_CLASSC(i) (((u_int32_t)(i) & 0xe0000000) == 0xc0000000)
|
||||
#define IN_CLASSC_NET 0xffffff00
|
||||
#define IN_CLASSC_NSHIFT 8
|
||||
#define IN_CLASSC_HOST 0x000000ff
|
||||
|
||||
#define IN_CLASSD(i) (((u_int32_t)(i) & 0xf0000000) == 0xe0000000)
|
||||
#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
|
||||
#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
|
||||
#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
|
||||
#define IN_MULTICAST(i) IN_CLASSD(i)
|
||||
|
||||
#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
|
||||
#define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000)
|
||||
|
||||
#define INADDR_LOOPBACK (u_int32_t)0x7f000001
|
||||
|
||||
#define INADDR_NONE 0xffffffff /* -1 return */
|
||||
|
||||
#define INADDR_UNSPEC_GROUP (u_int32_t)0xe0000000 /* 224.0.0.0 */
|
||||
#define INADDR_ALLHOSTS_GROUP (u_int32_t)0xe0000001 /* 224.0.0.1 */
|
||||
#define INADDR_ALLRTRS_GROUP (u_int32_t)0xe0000002 /* 224.0.0.2 */
|
||||
#define INADDR_ALLRPTS_GROUP (u_int32_t)0xe0000016 /* 224.0.0.22, IGMPv3 */
|
||||
#define INADDR_CARP_GROUP (u_int32_t)0xe0000012 /* 224.0.0.18 */
|
||||
#define INADDR_PFSYNC_GROUP (u_int32_t)0xe00000f0 /* 224.0.0.240 */
|
||||
#define INADDR_ALLMDNS_GROUP (u_int32_t)0xe00000fb /* 224.0.0.251 */
|
||||
#define INADDR_MAX_LOCAL_GROUP (u_int32_t)0xe00000ff /* 224.0.0.255 */
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define IN_LINKLOCALNETNUM (u_int32_t)0xA9FE0000 /* 169.254.0.0 */
|
||||
#define IN_LINKLOCAL(i) (((u_int32_t)(i) & IN_CLASSB_NET) == IN_LINKLOCALNETNUM)
|
||||
#define IN_LOOPBACK(i) (((u_int32_t)(i) & 0xff000000) == 0x7f000000)
|
||||
#define IN_ZERONET(i) (((u_int32_t)(i) & 0xff000000) == 0)
|
||||
|
||||
#define IN_PRIVATE(i) ((((u_int32_t)(i) & 0xff000000) == 0x0a000000) || \
|
||||
(((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \
|
||||
(((u_int32_t)(i) & 0xffff0000) == 0xc0a80000))
|
||||
|
||||
|
||||
#define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & 0xffffff00) == 0xe0000000)
|
||||
|
||||
#define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#define IN_LOOPBACKNET 127 /* official! */
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
|
||||
/*
|
||||
* Socket address, internet style.
|
||||
*/
|
||||
struct sockaddr_in {
|
||||
__uint8_t sin_len;
|
||||
sa_family_t sin_family;
|
||||
in_port_t sin_port;
|
||||
struct in_addr sin_addr;
|
||||
char sin_zero[8];
|
||||
};
|
||||
|
||||
#define IN_ARE_ADDR_EQUAL(a, b) \
|
||||
(bcmp(&(a)->s_addr, &(b)->s_addr, \
|
||||
sizeof (struct in_addr)) == 0)
|
||||
|
||||
|
||||
#define INET_ADDRSTRLEN 16
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
/*
|
||||
* Structure used to describe IP options.
|
||||
* Used to store options internally, to pass them to a process,
|
||||
* or to restore options retrieved earlier.
|
||||
* The ip_dst is used for the first-hop gateway when using a source route
|
||||
* (this gets put into the header proper).
|
||||
*/
|
||||
struct ip_opts {
|
||||
struct in_addr ip_dst; /* first hop, 0 w/o src rt */
|
||||
char ip_opts[40]; /* actually variable in size */
|
||||
};
|
||||
|
||||
/*
|
||||
* Options for use with [gs]etsockopt at the IP level.
|
||||
* First word of comment is data type; bool is stored in int.
|
||||
*/
|
||||
#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
|
||||
#define IP_HDRINCL 2 /* int; header is included with data */
|
||||
#define IP_TOS 3 /* int; IP type of service and preced. */
|
||||
#define IP_TTL 4 /* int; IP time to live */
|
||||
#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
|
||||
#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
|
||||
#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
|
||||
#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
|
||||
#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */
|
||||
#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
|
||||
#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
|
||||
#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
|
||||
#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
|
||||
#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */
|
||||
#define IP_RSVP_ON 15 /* enable RSVP in kernel */
|
||||
#define IP_RSVP_OFF 16 /* disable RSVP in kernel */
|
||||
#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */
|
||||
#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */
|
||||
#define IP_PORTRANGE 19 /* int; range to choose for unspec port */
|
||||
#define IP_RECVIF 20 /* bool; receive reception if w/dgram */
|
||||
/* for IPSEC */
|
||||
#define IP_IPSEC_POLICY 21 /* int; set/get security policy */
|
||||
#define IP_FAITH 22 /* deprecated */
|
||||
#ifdef __APPLE__
|
||||
#define IP_STRIPHDR 23 /* bool: drop receive of raw IP header */
|
||||
#endif
|
||||
#define IP_RECVTTL 24 /* bool; receive reception TTL w/dgram */
|
||||
#define IP_BOUND_IF 25 /* int; set/get bound interface */
|
||||
#define IP_PKTINFO 26 /* get pktinfo on recv socket, set src on sent dgram */
|
||||
#define IP_RECVPKTINFO IP_PKTINFO /* receive pktinfo w/dgram */
|
||||
#define IP_RECVTOS 27 /* bool; receive IP TOS w/dgram */
|
||||
#define IP_DONTFRAG 28 /* don't fragment packet */
|
||||
|
||||
#define IP_FW_ADD 40 /* add a firewall rule to chain */
|
||||
#define IP_FW_DEL 41 /* delete a firewall rule from chain */
|
||||
#define IP_FW_FLUSH 42 /* flush firewall rule chain */
|
||||
#define IP_FW_ZERO 43 /* clear single/all firewall counter(s) */
|
||||
#define IP_FW_GET 44 /* get entire firewall rule chain */
|
||||
#define IP_FW_RESETLOG 45 /* reset logging counters */
|
||||
|
||||
/* These older firewall socket option codes are maintained for backward compatibility. */
|
||||
#define IP_OLD_FW_ADD 50 /* add a firewall rule to chain */
|
||||
#define IP_OLD_FW_DEL 51 /* delete a firewall rule from chain */
|
||||
#define IP_OLD_FW_FLUSH 52 /* flush firewall rule chain */
|
||||
#define IP_OLD_FW_ZERO 53 /* clear single/all firewall counter(s) */
|
||||
#define IP_OLD_FW_GET 54 /* get entire firewall rule chain */
|
||||
#define IP_NAT__XXX 55 /* set/get NAT opts XXX Deprecated, do not use */
|
||||
#define IP_OLD_FW_RESETLOG 56 /* reset logging counters */
|
||||
|
||||
#define IP_DUMMYNET_CONFIGURE 60 /* add/configure a dummynet pipe */
|
||||
#define IP_DUMMYNET_DEL 61 /* delete a dummynet pipe from chain */
|
||||
#define IP_DUMMYNET_FLUSH 62 /* flush dummynet */
|
||||
#define IP_DUMMYNET_GET 64 /* get entire dummynet pipes */
|
||||
|
||||
#define IP_TRAFFIC_MGT_BACKGROUND 65 /* int*; get background IO flags; set background IO */
|
||||
#define IP_MULTICAST_IFINDEX 66 /* int*; set/get IP multicast i/f index */
|
||||
|
||||
/* IPv4 Source Filter Multicast API [RFC3678] */
|
||||
#define IP_ADD_SOURCE_MEMBERSHIP 70 /* join a source-specific group */
|
||||
#define IP_DROP_SOURCE_MEMBERSHIP 71 /* drop a single source */
|
||||
#define IP_BLOCK_SOURCE 72 /* block a source */
|
||||
#define IP_UNBLOCK_SOURCE 73 /* unblock a source */
|
||||
|
||||
/* The following option is private; do not use it from user applications. */
|
||||
#define IP_MSFILTER 74 /* set/get filter list */
|
||||
|
||||
/* Protocol Independent Multicast API [RFC3678] */
|
||||
#define MCAST_JOIN_GROUP 80 /* join an any-source group */
|
||||
#define MCAST_LEAVE_GROUP 81 /* leave all sources for group */
|
||||
#define MCAST_JOIN_SOURCE_GROUP 82 /* join a source-specific group */
|
||||
#define MCAST_LEAVE_SOURCE_GROUP 83 /* leave a single source */
|
||||
#define MCAST_BLOCK_SOURCE 84 /* block a source */
|
||||
#define MCAST_UNBLOCK_SOURCE 85 /* unblock a source */
|
||||
|
||||
|
||||
/*
|
||||
* Defaults and limits for options
|
||||
*/
|
||||
#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
|
||||
#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
|
||||
|
||||
/*
|
||||
* The imo_membership vector for each socket is now dynamically allocated at
|
||||
* run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
|
||||
* according to a power-of-two increment.
|
||||
*/
|
||||
#define IP_MIN_MEMBERSHIPS 31
|
||||
#define IP_MAX_MEMBERSHIPS 4095
|
||||
|
||||
/*
|
||||
* Default resource limits for IPv4 multicast source filtering.
|
||||
* These may be modified by sysctl.
|
||||
*/
|
||||
#define IP_MAX_GROUP_SRC_FILTER 512 /* sources per group */
|
||||
#define IP_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */
|
||||
#define IP_MAX_SOCK_MUTE_FILTER 128 /* XXX no longer used */
|
||||
|
||||
/*
|
||||
* Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
|
||||
*/
|
||||
struct ip_mreq {
|
||||
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
||||
struct in_addr imr_interface; /* local IP address of interface */
|
||||
};
|
||||
|
||||
/*
|
||||
* Modified argument structure for IP_MULTICAST_IF, obtained from Linux.
|
||||
* This is used to specify an interface index for multicast sends, as
|
||||
* the IPv4 legacy APIs do not support this (unless IP_SENDIF is available).
|
||||
*/
|
||||
struct ip_mreqn {
|
||||
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
||||
struct in_addr imr_address; /* local IP address of interface */
|
||||
int imr_ifindex; /* Interface index; cast to uint32_t */
|
||||
};
|
||||
|
||||
#pragma pack(4)
|
||||
/*
|
||||
* Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678]
|
||||
*/
|
||||
struct ip_mreq_source {
|
||||
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
||||
struct in_addr imr_sourceaddr; /* IP address of source */
|
||||
struct in_addr imr_interface; /* local IP address of interface */
|
||||
};
|
||||
|
||||
/*
|
||||
* Argument structures for Protocol-Independent Multicast Source
|
||||
* Filter APIs. [RFC3678]
|
||||
*/
|
||||
struct group_req {
|
||||
uint32_t gr_interface; /* interface index */
|
||||
struct sockaddr_storage gr_group; /* group address */
|
||||
};
|
||||
|
||||
struct group_source_req {
|
||||
uint32_t gsr_interface; /* interface index */
|
||||
struct sockaddr_storage gsr_group; /* group address */
|
||||
struct sockaddr_storage gsr_source; /* source address */
|
||||
};
|
||||
|
||||
#ifndef __MSFILTERREQ_DEFINED
|
||||
#define __MSFILTERREQ_DEFINED
|
||||
/*
|
||||
* The following structure is private; do not use it from user applications.
|
||||
* It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between
|
||||
* the RFC 3678 libc functions and the kernel.
|
||||
*/
|
||||
struct __msfilterreq {
|
||||
uint32_t msfr_ifindex; /* interface index */
|
||||
uint32_t msfr_fmode; /* filter mode for group */
|
||||
uint32_t msfr_nsrcs; /* # of sources in msfr_srcs */
|
||||
uint32_t __msfr_align;
|
||||
struct sockaddr_storage msfr_group; /* group address */
|
||||
struct sockaddr_storage *msfr_srcs;
|
||||
};
|
||||
|
||||
#endif /* __MSFILTERREQ_DEFINED */
|
||||
|
||||
#pragma pack()
|
||||
struct sockaddr;
|
||||
|
||||
/*
|
||||
* Advanced (Full-state) APIs [RFC3678]
|
||||
* The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter().
|
||||
* We use uint32_t here to be consistent.
|
||||
*/
|
||||
int setipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t,
|
||||
uint32_t, struct in_addr *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
int getipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t *,
|
||||
uint32_t *, struct in_addr *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
int setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
|
||||
uint32_t, uint32_t, struct sockaddr_storage *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
int getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
|
||||
uint32_t *, uint32_t *, struct sockaddr_storage *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
|
||||
|
||||
/*
|
||||
* Filter modes; also used to represent per-socket filter mode internally.
|
||||
*/
|
||||
#define MCAST_UNDEFINED 0 /* fmode: not yet defined */
|
||||
#define MCAST_INCLUDE 1 /* fmode: include these source(s) */
|
||||
#define MCAST_EXCLUDE 2 /* fmode: exclude these source(s) */
|
||||
|
||||
/*
|
||||
* Argument for IP_PORTRANGE:
|
||||
* - which range to search when port is unspecified at bind() or connect()
|
||||
*/
|
||||
#define IP_PORTRANGE_DEFAULT 0 /* default range */
|
||||
#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
|
||||
#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
|
||||
|
||||
|
||||
/*
|
||||
* IP_PKTINFO: Packet information (equivalent to RFC2292 sec 5 for IPv4)
|
||||
* This structure is used for
|
||||
*
|
||||
* 1) Receiving ancilliary data about the datagram if IP_PKTINFO sockopt is
|
||||
* set on the socket. In this case ipi_ifindex will contain the interface
|
||||
* index the datagram was received on, ipi_addr is the IP address the
|
||||
* datagram was received to.
|
||||
*
|
||||
* 2) Sending a datagram using a specific interface or IP source address.
|
||||
* if ipi_ifindex is set to non-zero when in_pktinfo is passed as
|
||||
* ancilliary data of type IP_PKTINFO, this will be used as the source
|
||||
* interface to send the datagram from. If ipi_ifindex is null, ip_spec_dst
|
||||
* will be used for the source address.
|
||||
*
|
||||
* Note: if IP_BOUND_IF is set on the socket, ipi_ifindex in the ancillary
|
||||
* IP_PKTINFO option silently overrides the bound interface when it is
|
||||
* specified during send time.
|
||||
*/
|
||||
struct in_pktinfo {
|
||||
unsigned int ipi_ifindex; /* send/recv interface index */
|
||||
struct in_addr ipi_spec_dst; /* Local address */
|
||||
struct in_addr ipi_addr; /* IP Header dst address */
|
||||
};
|
||||
|
||||
/*
|
||||
* Definitions for inet sysctl operations.
|
||||
*
|
||||
* Third level is protocol number.
|
||||
* Fourth level is desired variable within that protocol.
|
||||
*/
|
||||
#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */
|
||||
|
||||
|
||||
/*
|
||||
* Names for IP sysctl objects
|
||||
*/
|
||||
#define IPCTL_FORWARDING 1 /* act as router */
|
||||
#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
|
||||
#define IPCTL_DEFTTL 3 /* default TTL */
|
||||
#ifdef notyet
|
||||
#define IPCTL_DEFMTU 4 /* default MTU */
|
||||
#endif
|
||||
#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */
|
||||
#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */
|
||||
#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */
|
||||
#define IPCTL_SOURCEROUTE 8 /* may perform source routes */
|
||||
#define IPCTL_DIRECTEDBROADCAST 9 /* may re-broadcast received packets */
|
||||
#define IPCTL_INTRQMAXLEN 10 /* max length of netisr queue */
|
||||
#define IPCTL_INTRQDROPS 11 /* number of netisr q drops */
|
||||
#define IPCTL_STATS 12 /* ipstat structure */
|
||||
#define IPCTL_ACCEPTSOURCEROUTE 13 /* may accept source routed packets */
|
||||
#define IPCTL_FASTFORWARDING 14 /* use fast IP forwarding code */
|
||||
#define IPCTL_KEEPFAITH 15 /* deprecated */
|
||||
#define IPCTL_GIF_TTL 16 /* default TTL for gif encap packet */
|
||||
#define IPCTL_MAXID 17
|
||||
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
|
||||
/* INET6 stuff */
|
||||
#define __KAME_NETINET_IN_H_INCLUDED_
|
||||
#include <netinet6/in6.h>
|
||||
#undef __KAME_NETINET_IN_H_INCLUDED_
|
||||
|
||||
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
__BEGIN_DECLS
|
||||
int bindresvport(int, struct sockaddr_in *);
|
||||
struct sockaddr;
|
||||
int bindresvport_sa(int, struct sockaddr *);
|
||||
__END_DECLS
|
||||
#endif
|
||||
#endif /* _NETINET_IN_H_ */
|
||||
285
lib/libc/include/aarch64-macos-gnu/netinet/tcp.h
Normal file
285
lib/libc/include/aarch64-macos-gnu/netinet/tcp.h
Normal file
@ -0,0 +1,285 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2018 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@
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)tcp.h 8.1 (Berkeley) 6/10/93
|
||||
* $FreeBSD: src/sys/netinet/tcp.h,v 1.13.2.3 2001/03/01 22:08:42 jlemon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NETINET_TCP_H_
|
||||
#define _NETINET_TCP_H_
|
||||
#include <sys/appleapiopts.h>
|
||||
|
||||
#include <machine/endian.h>
|
||||
#include <machine/types.h> /* __uint32_t */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
typedef __uint32_t tcp_seq;
|
||||
typedef __uint32_t tcp_cc; /* connection count per rfc1644 */
|
||||
|
||||
#define tcp6_seq tcp_seq /* for KAME src sync over BSD*'s */
|
||||
#define tcp6hdr tcphdr /* for KAME src sync over BSD*'s */
|
||||
|
||||
/*
|
||||
* TCP header.
|
||||
* Per RFC 793, September, 1981.
|
||||
*/
|
||||
struct tcphdr {
|
||||
unsigned short th_sport; /* source port */
|
||||
unsigned short th_dport; /* destination port */
|
||||
tcp_seq th_seq; /* sequence number */
|
||||
tcp_seq th_ack; /* acknowledgement number */
|
||||
#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
|
||||
unsigned int th_x2:4, /* (unused) */
|
||||
th_off:4; /* data offset */
|
||||
#endif
|
||||
#if __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN
|
||||
unsigned int th_off:4, /* data offset */
|
||||
th_x2:4; /* (unused) */
|
||||
#endif
|
||||
unsigned char th_flags;
|
||||
#define TH_FIN 0x01
|
||||
#define TH_SYN 0x02
|
||||
#define TH_RST 0x04
|
||||
#define TH_PUSH 0x08
|
||||
#define TH_ACK 0x10
|
||||
#define TH_URG 0x20
|
||||
#define TH_ECE 0x40
|
||||
#define TH_CWR 0x80
|
||||
#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR)
|
||||
#define TH_ACCEPT (TH_FIN|TH_SYN|TH_RST|TH_ACK)
|
||||
|
||||
unsigned short th_win; /* window */
|
||||
unsigned short th_sum; /* checksum */
|
||||
unsigned short th_urp; /* urgent pointer */
|
||||
};
|
||||
|
||||
#define TCPOPT_EOL 0
|
||||
#define TCPOPT_NOP 1
|
||||
#define TCPOPT_MAXSEG 2
|
||||
#define TCPOLEN_MAXSEG 4
|
||||
#define TCPOPT_WINDOW 3
|
||||
#define TCPOLEN_WINDOW 3
|
||||
#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
|
||||
#define TCPOLEN_SACK_PERMITTED 2
|
||||
#define TCPOPT_SACK 5 /* Experimental */
|
||||
#define TCPOLEN_SACK 8 /* len of sack block */
|
||||
#define TCPOPT_TIMESTAMP 8
|
||||
#define TCPOLEN_TIMESTAMP 10
|
||||
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
|
||||
#define TCPOPT_TSTAMP_HDR \
|
||||
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
|
||||
|
||||
#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */
|
||||
|
||||
#define TCPOPT_CC 11 /* CC options: RFC-1644 */
|
||||
#define TCPOPT_CCNEW 12
|
||||
#define TCPOPT_CCECHO 13
|
||||
#define TCPOLEN_CC 6
|
||||
#define TCPOLEN_CC_APPA (TCPOLEN_CC+2)
|
||||
#define TCPOPT_CC_HDR(ccopt) \
|
||||
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC)
|
||||
#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */
|
||||
#define TCPOLEN_SIGNATURE 18
|
||||
#if MPTCP
|
||||
#define TCPOPT_MULTIPATH 30
|
||||
#endif
|
||||
|
||||
#define TCPOPT_FASTOPEN 34
|
||||
#define TCPOLEN_FASTOPEN_REQ 2
|
||||
|
||||
/* Option definitions */
|
||||
#define TCPOPT_SACK_PERMIT_HDR \
|
||||
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK_PERMITTED<<8|TCPOLEN_SACK_PERMITTED)
|
||||
#define TCPOPT_SACK_HDR (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK<<8)
|
||||
/* Miscellaneous constants */
|
||||
#define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at sender side */
|
||||
|
||||
/*
|
||||
* A SACK option that specifies n blocks will have a length of (8*n + 2)
|
||||
* bytes, so the 40 bytes available for TCP options can specify a
|
||||
* maximum of 4 blocks.
|
||||
*/
|
||||
|
||||
#define TCP_MAX_SACK 4 /* MAX # SACKs sent in any segment */
|
||||
|
||||
|
||||
/*
|
||||
* Default maximum segment size for TCP.
|
||||
* With an IP MTU of 576, this is 536,
|
||||
* but 512 is probably more convenient.
|
||||
* This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
|
||||
*/
|
||||
#define TCP_MSS 512
|
||||
|
||||
/*
|
||||
* TCP_MINMSS is defined to be 216 which is fine for the smallest
|
||||
* link MTU (256 bytes, SLIP interface) in the Internet.
|
||||
* However it is very unlikely to come across such low MTU interfaces
|
||||
* these days (anno dato 2004).
|
||||
* Probably it can be set to 512 without ill effects. But we play safe.
|
||||
* See tcp_subr.c tcp_minmss SYSCTL declaration for more comments.
|
||||
* Setting this to "0" disables the minmss check.
|
||||
*/
|
||||
#define TCP_MINMSS 216
|
||||
|
||||
/*
|
||||
* Default maximum segment size for TCP6.
|
||||
* With an IP6 MSS of 1280, this is 1220,
|
||||
* but 1024 is probably more convenient. (xxx kazu in doubt)
|
||||
* This should be defined as MIN(1024, IP6_MSS - sizeof (struct tcpip6hdr))
|
||||
*/
|
||||
#define TCP6_MSS 1024
|
||||
|
||||
#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
|
||||
#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */
|
||||
|
||||
#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
|
||||
|
||||
#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */
|
||||
#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr))
|
||||
/* max space left for options */
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
|
||||
/*
|
||||
* User-settable options (used with setsockopt).
|
||||
*/
|
||||
#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define TCP_MAXSEG 0x02 /* set maximum segment size */
|
||||
#define TCP_NOPUSH 0x04 /* don't push last block of write */
|
||||
#define TCP_NOOPT 0x08 /* don't use TCP options */
|
||||
#define TCP_KEEPALIVE 0x10 /* idle time used when SO_KEEPALIVE is enabled */
|
||||
#define TCP_CONNECTIONTIMEOUT 0x20 /* connection timeout */
|
||||
#define PERSIST_TIMEOUT 0x40 /* time after which a connection in
|
||||
* persist timeout will terminate.
|
||||
* see draft-ananth-tcpm-persist-02.txt
|
||||
*/
|
||||
#define TCP_RXT_CONNDROPTIME 0x80 /* time after which tcp retransmissions will be
|
||||
* stopped and the connection will be dropped
|
||||
*/
|
||||
#define TCP_RXT_FINDROP 0x100 /* when this option is set, drop a connection
|
||||
* after retransmitting the FIN 3 times. It will
|
||||
* prevent holding too many mbufs in socket
|
||||
* buffer queues.
|
||||
*/
|
||||
#define TCP_KEEPINTVL 0x101 /* interval between keepalives */
|
||||
#define TCP_KEEPCNT 0x102 /* number of keepalives before close */
|
||||
#define TCP_SENDMOREACKS 0x103 /* always ack every other packet */
|
||||
#define TCP_ENABLE_ECN 0x104 /* Enable ECN on a connection */
|
||||
#define TCP_FASTOPEN 0x105 /* Enable/Disable TCP Fastopen on this socket */
|
||||
#define TCP_CONNECTION_INFO 0x106 /* State of TCP connection */
|
||||
|
||||
|
||||
|
||||
#define TCP_NOTSENT_LOWAT 0x201 /* Low water mark for TCP unsent data */
|
||||
|
||||
|
||||
struct tcp_connection_info {
|
||||
u_int8_t tcpi_state; /* connection state */
|
||||
u_int8_t tcpi_snd_wscale; /* Window scale for send window */
|
||||
u_int8_t tcpi_rcv_wscale; /* Window scale for receive window */
|
||||
u_int8_t __pad1;
|
||||
u_int32_t tcpi_options; /* TCP options supported */
|
||||
#define TCPCI_OPT_TIMESTAMPS 0x00000001 /* Timestamps enabled */
|
||||
#define TCPCI_OPT_SACK 0x00000002 /* SACK enabled */
|
||||
#define TCPCI_OPT_WSCALE 0x00000004 /* Window scaling enabled */
|
||||
#define TCPCI_OPT_ECN 0x00000008 /* ECN enabled */
|
||||
u_int32_t tcpi_flags; /* flags */
|
||||
#define TCPCI_FLAG_LOSSRECOVERY 0x00000001
|
||||
#define TCPCI_FLAG_REORDERING_DETECTED 0x00000002
|
||||
u_int32_t tcpi_rto; /* retransmit timeout in ms */
|
||||
u_int32_t tcpi_maxseg; /* maximum segment size supported */
|
||||
u_int32_t tcpi_snd_ssthresh; /* slow start threshold in bytes */
|
||||
u_int32_t tcpi_snd_cwnd; /* send congestion window in bytes */
|
||||
u_int32_t tcpi_snd_wnd; /* send widnow in bytes */
|
||||
u_int32_t tcpi_snd_sbbytes; /* bytes in send socket buffer, including in-flight data */
|
||||
u_int32_t tcpi_rcv_wnd; /* receive window in bytes*/
|
||||
u_int32_t tcpi_rttcur; /* most recent RTT in ms */
|
||||
u_int32_t tcpi_srtt; /* average RTT in ms */
|
||||
u_int32_t tcpi_rttvar; /* RTT variance */
|
||||
u_int32_t
|
||||
tcpi_tfo_cookie_req:1, /* Cookie requested? */
|
||||
tcpi_tfo_cookie_rcv:1, /* Cookie received? */
|
||||
tcpi_tfo_syn_loss:1, /* Fallback to reg. TCP after SYN-loss */
|
||||
tcpi_tfo_syn_data_sent:1, /* SYN+data has been sent out */
|
||||
tcpi_tfo_syn_data_acked:1, /* SYN+data has been fully acknowledged */
|
||||
tcpi_tfo_syn_data_rcv:1, /* Server received SYN+data with a valid cookie */
|
||||
tcpi_tfo_cookie_req_rcv:1, /* Server received cookie-request */
|
||||
tcpi_tfo_cookie_sent:1, /* Server announced cookie */
|
||||
tcpi_tfo_cookie_invalid:1, /* Server received an invalid cookie */
|
||||
tcpi_tfo_cookie_wrong:1, /* Our sent cookie was wrong */
|
||||
tcpi_tfo_no_cookie_rcv:1, /* We did not receive a cookie upon our request */
|
||||
tcpi_tfo_heuristics_disable:1, /* TFO-heuristics disabled it */
|
||||
tcpi_tfo_send_blackhole:1, /* A sending-blackhole got detected */
|
||||
tcpi_tfo_recv_blackhole:1, /* A receiver-blackhole got detected */
|
||||
tcpi_tfo_onebyte_proxy:1, /* A proxy acknowledges all but one byte of the SYN */
|
||||
__pad2:17;
|
||||
u_int64_t tcpi_txpackets __attribute__((aligned(8)));
|
||||
u_int64_t tcpi_txbytes __attribute__((aligned(8)));
|
||||
u_int64_t tcpi_txretransmitbytes __attribute__((aligned(8)));
|
||||
u_int64_t tcpi_rxpackets __attribute__((aligned(8)));
|
||||
u_int64_t tcpi_rxbytes __attribute__((aligned(8)));
|
||||
u_int64_t tcpi_rxoutoforderbytes __attribute__((aligned(8)));
|
||||
u_int64_t tcpi_txretransmitpackets __attribute__((aligned(8)));
|
||||
};
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
|
||||
#endif
|
||||
681
lib/libc/include/aarch64-macos-gnu/netinet6/in6.h
Normal file
681
lib/libc/include/aarch64-macos-gnu/netinet6/in6.h
Normal file
@ -0,0 +1,681 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2020 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@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||
* 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1990, 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.
|
||||
*
|
||||
* @(#)in.h 8.3 (Berkeley) 1/3/94
|
||||
*/
|
||||
|
||||
#ifndef __KAME_NETINET_IN_H_INCLUDED_
|
||||
#error "do not include netinet6/in6.h directly, include netinet/in.h. " \
|
||||
" see RFC2553"
|
||||
#endif
|
||||
|
||||
#ifndef _NETINET6_IN6_H_
|
||||
#define _NETINET6_IN6_H_
|
||||
#include <sys/appleapiopts.h>
|
||||
|
||||
#include <sys/_types.h>
|
||||
#include <sys/_types/_sa_family_t.h>
|
||||
|
||||
/*
|
||||
* Identification of the network protocol stack
|
||||
* for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE
|
||||
* has the table of implementation/integration differences.
|
||||
*/
|
||||
#define __KAME__
|
||||
#define __KAME_VERSION "2009/apple-darwin"
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
/*
|
||||
* Local port number conventions:
|
||||
*
|
||||
* Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
|
||||
* unless a kernel is compiled with IPNOPRIVPORTS defined.
|
||||
*
|
||||
* When a user does a bind(2) or connect(2) with a port number of zero,
|
||||
* a non-conflicting local port address is chosen.
|
||||
*
|
||||
* The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
|
||||
* that is settable by sysctl(3); net.inet.ip.anonportmin and
|
||||
* net.inet.ip.anonportmax respectively.
|
||||
*
|
||||
* A user may set the IPPROTO_IP option IP_PORTRANGE to change this
|
||||
* default assignment range.
|
||||
*
|
||||
* The value IP_PORTRANGE_DEFAULT causes the default behavior.
|
||||
*
|
||||
* The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
|
||||
* and exists only for FreeBSD compatibility purposes.
|
||||
*
|
||||
* The value IP_PORTRANGE_LOW changes the range to the "low" are
|
||||
* that is (by convention) restricted to privileged processes.
|
||||
* This convention is based on "vouchsafe" principles only.
|
||||
* It is only secure if you trust the remote host to restrict these ports.
|
||||
* The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
|
||||
*/
|
||||
|
||||
#define IPV6PORT_RESERVED 1024
|
||||
#define IPV6PORT_ANONMIN 49152
|
||||
#define IPV6PORT_ANONMAX 65535
|
||||
#define IPV6PORT_RESERVEDMIN 600
|
||||
#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
|
||||
/*
|
||||
* IPv6 address
|
||||
*/
|
||||
typedef struct in6_addr {
|
||||
union {
|
||||
__uint8_t __u6_addr8[16];
|
||||
__uint16_t __u6_addr16[8];
|
||||
__uint32_t __u6_addr32[4];
|
||||
} __u6_addr; /* 128-bit IP6 address */
|
||||
} in6_addr_t;
|
||||
|
||||
#define s6_addr __u6_addr.__u6_addr8
|
||||
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
|
||||
/*
|
||||
* Socket address for IPv6
|
||||
*/
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define SIN6_LEN
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
struct sockaddr_in6 {
|
||||
__uint8_t sin6_len; /* length of this struct(sa_family_t) */
|
||||
sa_family_t sin6_family; /* AF_INET6 (sa_family_t) */
|
||||
in_port_t sin6_port; /* Transport layer port # (in_port_t) */
|
||||
__uint32_t sin6_flowinfo; /* IP6 flow information */
|
||||
struct in6_addr sin6_addr; /* IP6 address */
|
||||
__uint32_t sin6_scope_id; /* scope zone index */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Definition of some useful macros to handle IP6 addresses
|
||||
*/
|
||||
#define IN6ADDR_ANY_INIT \
|
||||
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
|
||||
#define IN6ADDR_LOOPBACK_INIT \
|
||||
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
|
||||
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
||||
#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \
|
||||
{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
||||
#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
|
||||
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
|
||||
#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
|
||||
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
|
||||
#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \
|
||||
{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}
|
||||
#define IN6ADDR_V4MAPPED_INIT \
|
||||
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
|
||||
#define IN6ADDR_MULTICAST_PREFIX IN6MASK8
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
|
||||
extern const struct in6_addr in6addr_any;
|
||||
extern const struct in6_addr in6addr_loopback;
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
extern const struct in6_addr in6addr_nodelocal_allnodes;
|
||||
extern const struct in6_addr in6addr_linklocal_allnodes;
|
||||
extern const struct in6_addr in6addr_linklocal_allrouters;
|
||||
extern const struct in6_addr in6addr_linklocal_allv2routers;
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
|
||||
/*
|
||||
* Equality
|
||||
* NOTE: Some of kernel programming environment (for example, openbsd/sparc)
|
||||
* does not supply memcmp(). For userland memcmp() is preferred as it is
|
||||
* in ANSI standard.
|
||||
*/
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IN6_ARE_ADDR_EQUAL(a, b) \
|
||||
(memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof (struct in6_addr)) \
|
||||
== 0)
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
|
||||
|
||||
/*
|
||||
* Unspecified
|
||||
*/
|
||||
#define IN6_IS_ADDR_UNSPECIFIED(a) \
|
||||
((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == 0))
|
||||
|
||||
/*
|
||||
* Loopback
|
||||
*/
|
||||
#define IN6_IS_ADDR_LOOPBACK(a) \
|
||||
((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
|
||||
|
||||
/*
|
||||
* IPv4 compatible
|
||||
*/
|
||||
#define IN6_IS_ADDR_V4COMPAT(a) \
|
||||
((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))
|
||||
|
||||
/*
|
||||
* Mapped
|
||||
*/
|
||||
#define IN6_IS_ADDR_V4MAPPED(a) \
|
||||
((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
|
||||
(*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == \
|
||||
ntohl(0x0000ffff)))
|
||||
|
||||
/*
|
||||
* 6to4
|
||||
*/
|
||||
#define IN6_IS_ADDR_6TO4(x) (ntohs((x)->s6_addr16[0]) == 0x2002)
|
||||
|
||||
/*
|
||||
* KAME Scope Values
|
||||
*/
|
||||
|
||||
#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
|
||||
#define __IPV6_ADDR_SCOPE_INTFACELOCAL 0x01
|
||||
#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
|
||||
#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
|
||||
#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
|
||||
#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e
|
||||
|
||||
/*
|
||||
* Unicast Scope
|
||||
* Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
|
||||
*/
|
||||
#define IN6_IS_ADDR_LINKLOCAL(a) \
|
||||
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
|
||||
#define IN6_IS_ADDR_SITELOCAL(a) \
|
||||
(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
|
||||
|
||||
/*
|
||||
* Multicast
|
||||
*/
|
||||
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
|
||||
|
||||
#define IPV6_ADDR_MC_FLAGS(a) ((a)->s6_addr[1] & 0xf0)
|
||||
|
||||
#define IPV6_ADDR_MC_FLAGS_TRANSIENT 0x10
|
||||
#define IPV6_ADDR_MC_FLAGS_PREFIX 0x20
|
||||
#define IPV6_ADDR_MC_FLAGS_UNICAST_BASED (IPV6_ADDR_MC_FLAGS_TRANSIENT | IPV6_ADDR_MC_FLAGS_PREFIX)
|
||||
|
||||
#define IN6_IS_ADDR_UNICAST_BASED_MULTICAST(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(IPV6_ADDR_MC_FLAGS(a) == IPV6_ADDR_MC_FLAGS_UNICAST_BASED))
|
||||
|
||||
/*
|
||||
* Unique Local IPv6 Unicast Addresses (per RFC 4193)
|
||||
*/
|
||||
#define IN6_IS_ADDR_UNIQUE_LOCAL(a) \
|
||||
(((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))
|
||||
|
||||
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
|
||||
|
||||
/*
|
||||
* Multicast Scope
|
||||
*/
|
||||
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
|
||||
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(IPV6_ADDR_MC_FLAGS(a) != IPV6_ADDR_MC_FLAGS_UNICAST_BASED) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
|
||||
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
|
||||
#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
|
||||
#define IN6_IS_ADDR_MC_GLOBAL(a) \
|
||||
(IN6_IS_ADDR_MULTICAST(a) && \
|
||||
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Options for use with [gs]etsockopt at the IPV6 level.
|
||||
* First word of comment is data type; bool is stored in int.
|
||||
*/
|
||||
/* no hdrincl */
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
/*
|
||||
* RFC 3542 define the following socket options in a manner incompatible
|
||||
* with RFC 2292:
|
||||
* IPV6_PKTINFO
|
||||
* IPV6_HOPLIMIT
|
||||
* IPV6_NEXTHOP
|
||||
* IPV6_HOPOPTS
|
||||
* IPV6_DSTOPTS
|
||||
* IPV6_RTHDR
|
||||
*
|
||||
* To use the new IPv6 Sockets options introduced by RFC 3542
|
||||
* the constant __APPLE_USE_RFC_3542 must be defined before
|
||||
* including <netinet/in.h>
|
||||
*
|
||||
* To use the old IPv6 Sockets options from RFC 2292
|
||||
* the constant __APPLE_USE_RFC_2292 must be defined before
|
||||
* including <netinet/in.h>
|
||||
*
|
||||
* Note that eventually RFC 3542 is going to be the
|
||||
* default and RFC 2292 will be obsolete.
|
||||
*/
|
||||
|
||||
#if defined(__APPLE_USE_RFC_3542) && defined(__APPLE_USE_RFC_2292)
|
||||
#error "__APPLE_USE_RFC_3542 and __APPLE_USE_RFC_2292 cannot be both defined"
|
||||
#endif
|
||||
|
||||
#if 0 /* the followings are relic in IPv4 and hence are disabled */
|
||||
#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */
|
||||
#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */
|
||||
#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */
|
||||
#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */
|
||||
#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */
|
||||
#endif /* 0 */
|
||||
#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
|
||||
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
|
||||
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
|
||||
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 mcast loopback */
|
||||
#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
|
||||
#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
|
||||
#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
|
||||
#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */
|
||||
#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */
|
||||
#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */
|
||||
#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */
|
||||
#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */
|
||||
#define IPV6_2292RTHDR 24 /* ip6_rthdr: routing header */
|
||||
|
||||
/* buf/cmsghdr; set/get IPv6 options [obsoleted by RFC3542] */
|
||||
#define IPV6_2292PKTOPTIONS 25
|
||||
|
||||
#ifdef __APPLE_USE_RFC_2292
|
||||
#define IPV6_PKTINFO IPV6_2292PKTINFO
|
||||
#define IPV6_HOPLIMIT IPV6_2292HOPLIMIT
|
||||
#define IPV6_NEXTHOP IPV6_2292NEXTHOP
|
||||
#define IPV6_HOPOPTS IPV6_2292HOPOPTS
|
||||
#define IPV6_DSTOPTS IPV6_2292DSTOPTS
|
||||
#define IPV6_RTHDR IPV6_2292RTHDR
|
||||
#define IPV6_PKTOPTIONS IPV6_2292PKTOPTIONS
|
||||
#endif /* __APPLE_USE_RFC_2292 */
|
||||
|
||||
#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
#define IPV6_V6ONLY 27 /* bool; only bind INET6 at wildcard bind */
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define IPV6_BINDV6ONLY IPV6_V6ONLY
|
||||
|
||||
|
||||
#if 1 /* IPSEC */
|
||||
#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */
|
||||
#endif /* 1 */
|
||||
#define IPV6_FAITH 29 /* deprecated */
|
||||
|
||||
#if 1 /* IPV6FIREWALL */
|
||||
#define IPV6_FW_ADD 30 /* add a firewall rule to chain */
|
||||
#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */
|
||||
#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */
|
||||
#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */
|
||||
#define IPV6_FW_GET 34 /* get entire firewall rule chain */
|
||||
#endif /* 1 */
|
||||
|
||||
/*
|
||||
* APPLE: NOTE the value of those 2 options is kept unchanged from
|
||||
* previous version of darwin/OS X for binary compatibility reasons
|
||||
* and differ from FreeBSD (values 57 and 61). See below.
|
||||
*/
|
||||
#define IPV6_RECVTCLASS 35 /* bool; recv traffic class values */
|
||||
#define IPV6_TCLASS 36 /* int; send traffic class value */
|
||||
|
||||
#ifdef __APPLE_USE_RFC_3542
|
||||
/* new socket options introduced in RFC3542 */
|
||||
/*
|
||||
* ip6_dest; send dst option before rthdr
|
||||
* APPLE: Value purposely different than FreeBSD (35) to avoid
|
||||
* collision with definition of IPV6_RECVTCLASS in previous
|
||||
* darwin implementations
|
||||
*/
|
||||
#define IPV6_RTHDRDSTOPTS 57
|
||||
|
||||
/*
|
||||
* bool; recv if, dst addr
|
||||
* APPLE: Value purposely different than FreeBSD(36) to avoid
|
||||
* collision with definition of IPV6_TCLASS in previous
|
||||
* darwin implementations
|
||||
*/
|
||||
#define IPV6_RECVPKTINFO 61
|
||||
|
||||
#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */
|
||||
#define IPV6_RECVRTHDR 38 /* bool; recv routing header */
|
||||
#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */
|
||||
#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */
|
||||
|
||||
#define IPV6_USE_MIN_MTU 42 /* bool; send packets at the minimum MTU */
|
||||
#define IPV6_RECVPATHMTU 43 /* bool; notify an according MTU */
|
||||
|
||||
/*
|
||||
* mtuinfo; get the current path MTU (sopt), 4 bytes int;
|
||||
* MTU notification (cmsg)
|
||||
*/
|
||||
#define IPV6_PATHMTU 44
|
||||
|
||||
#if 0 /* obsoleted during 2292bis -> 3542 */
|
||||
/* no data; ND reachability confirm (cmsg only/not in of RFC3542) */
|
||||
#define IPV6_REACHCONF 45
|
||||
#endif
|
||||
/* more new socket options introduced in RFC3542 */
|
||||
#define IPV6_3542PKTINFO 46 /* in6_pktinfo; send if, src addr */
|
||||
#define IPV6_3542HOPLIMIT 47 /* int; send hop limit */
|
||||
#define IPV6_3542NEXTHOP 48 /* sockaddr; next hop addr */
|
||||
#define IPV6_3542HOPOPTS 49 /* ip6_hbh; send hop-by-hop option */
|
||||
#define IPV6_3542DSTOPTS 50 /* ip6_dest; send dst option befor rthdr */
|
||||
#define IPV6_3542RTHDR 51 /* ip6_rthdr; send routing header */
|
||||
|
||||
#define IPV6_PKTINFO IPV6_3542PKTINFO
|
||||
#define IPV6_HOPLIMIT IPV6_3542HOPLIMIT
|
||||
#define IPV6_NEXTHOP IPV6_3542NEXTHOP
|
||||
#define IPV6_HOPOPTS IPV6_3542HOPOPTS
|
||||
#define IPV6_DSTOPTS IPV6_3542DSTOPTS
|
||||
#define IPV6_RTHDR IPV6_3542RTHDR
|
||||
|
||||
#define IPV6_AUTOFLOWLABEL 59 /* bool; attach flowlabel automagically */
|
||||
|
||||
#define IPV6_DONTFRAG 62 /* bool; disable IPv6 fragmentation */
|
||||
|
||||
/* int; prefer temporary addresses as the source address. */
|
||||
#define IPV6_PREFER_TEMPADDR 63
|
||||
|
||||
/*
|
||||
* The following option is private; do not use it from user applications.
|
||||
* It is deliberately defined to the same value as IP_MSFILTER.
|
||||
*/
|
||||
#define IPV6_MSFILTER 74 /* struct __msfilterreq; */
|
||||
#endif /* __APPLE_USE_RFC_3542 */
|
||||
|
||||
#define IPV6_BOUND_IF 125 /* int; set/get bound interface */
|
||||
|
||||
|
||||
/* to define items, should talk with KAME guys first, for *BSD compatibility */
|
||||
|
||||
#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. */
|
||||
#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. */
|
||||
#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */
|
||||
|
||||
/*
|
||||
* Defaults and limits for options
|
||||
*/
|
||||
#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */
|
||||
#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
|
||||
|
||||
/*
|
||||
* The im6o_membership vector for each socket is now dynamically allocated at
|
||||
* run-time, bounded by USHRT_MAX, and is reallocated when needed, sized
|
||||
* according to a power-of-two increment.
|
||||
*/
|
||||
#define IPV6_MIN_MEMBERSHIPS 31
|
||||
#define IPV6_MAX_MEMBERSHIPS 4095
|
||||
|
||||
/*
|
||||
* Default resource limits for IPv6 multicast source filtering.
|
||||
* These may be modified by sysctl.
|
||||
*/
|
||||
#define IPV6_MAX_GROUP_SRC_FILTER 512 /* sources per group */
|
||||
#define IPV6_MAX_SOCK_SRC_FILTER 128 /* sources per socket/group */
|
||||
|
||||
/*
|
||||
* Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
|
||||
*/
|
||||
struct ipv6_mreq {
|
||||
struct in6_addr ipv6mr_multiaddr;
|
||||
unsigned int ipv6mr_interface;
|
||||
};
|
||||
|
||||
/*
|
||||
* IPV6_2292PKTINFO: Packet information(RFC2292 sec 5)
|
||||
*/
|
||||
struct in6_pktinfo {
|
||||
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
|
||||
unsigned int ipi6_ifindex; /* send/recv interface index */
|
||||
};
|
||||
|
||||
/*
|
||||
* Control structure for IPV6_RECVPATHMTU socket option.
|
||||
*/
|
||||
struct ip6_mtuinfo {
|
||||
struct sockaddr_in6 ip6m_addr; /* or sockaddr_storage? */
|
||||
uint32_t ip6m_mtu;
|
||||
};
|
||||
|
||||
/*
|
||||
* Argument for IPV6_PORTRANGE:
|
||||
* - which range to search when port is unspecified at bind() or connect()
|
||||
*/
|
||||
#define IPV6_PORTRANGE_DEFAULT 0 /* default range */
|
||||
#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
|
||||
#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
|
||||
|
||||
/*
|
||||
* Definitions for inet6 sysctl operations.
|
||||
*
|
||||
* Third level is protocol number.
|
||||
* Fourth level is desired variable within that protocol.
|
||||
*/
|
||||
#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */
|
||||
|
||||
/*
|
||||
* Names for IP sysctl objects
|
||||
*/
|
||||
#define IPV6CTL_FORWARDING 1 /* act as router */
|
||||
#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
|
||||
#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */
|
||||
#ifdef notyet
|
||||
#define IPV6CTL_DEFMTU 4 /* default MTU */
|
||||
#endif
|
||||
#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */
|
||||
#define IPV6CTL_STATS 6 /* stats */
|
||||
#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */
|
||||
#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */
|
||||
#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */
|
||||
#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */
|
||||
#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */
|
||||
#define IPV6CTL_ACCEPT_RTADV 12
|
||||
#define IPV6CTL_KEEPFAITH 13 /* deprecated */
|
||||
#define IPV6CTL_LOG_INTERVAL 14
|
||||
#define IPV6CTL_HDRNESTLIMIT 15
|
||||
#define IPV6CTL_DAD_COUNT 16
|
||||
#define IPV6CTL_AUTO_FLOWLABEL 17
|
||||
#define IPV6CTL_DEFMCASTHLIM 18
|
||||
#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */
|
||||
#define IPV6CTL_KAME_VERSION 20
|
||||
#define IPV6CTL_USE_DEPRECATED 21 /* use deprec addr (RFC2462 5.5.4) */
|
||||
#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */
|
||||
#if 0 /* obsolete */
|
||||
#define IPV6CTL_MAPPED_ADDR 23
|
||||
#endif
|
||||
#define IPV6CTL_V6ONLY 24
|
||||
#define IPV6CTL_RTEXPIRE 25 /* cloned route expiration time */
|
||||
#define IPV6CTL_RTMINEXPIRE 26 /* min value for expiration time */
|
||||
#define IPV6CTL_RTMAXCACHE 27 /* trigger level for dynamic expire */
|
||||
|
||||
#define IPV6CTL_USETEMPADDR 32 /* use temporary addresses [RFC 4941] */
|
||||
#define IPV6CTL_TEMPPLTIME 33 /* preferred lifetime for tmpaddrs */
|
||||
#define IPV6CTL_TEMPVLTIME 34 /* valid lifetime for tmpaddrs */
|
||||
#define IPV6CTL_AUTO_LINKLOCAL 35 /* automatic link-local addr assign */
|
||||
#define IPV6CTL_RIP6STATS 36 /* raw_ip6 stats */
|
||||
#define IPV6CTL_PREFER_TEMPADDR 37 /* prefer temporary addr as src */
|
||||
#define IPV6CTL_ADDRCTLPOLICY 38 /* get/set address selection policy */
|
||||
#define IPV6CTL_USE_DEFAULTZONE 39 /* use default scope zone */
|
||||
|
||||
#define IPV6CTL_MAXFRAGS 41 /* max fragments */
|
||||
#define IPV6CTL_MCAST_PMTU 44 /* enable pMTU discovery for mcast? */
|
||||
|
||||
#define IPV6CTL_NEIGHBORGCTHRESH 46
|
||||
#define IPV6CTL_MAXIFPREFIXES 47
|
||||
#define IPV6CTL_MAXIFDEFROUTERS 48
|
||||
#define IPV6CTL_MAXDYNROUTES 49
|
||||
#define ICMPV6CTL_ND6_ONLINKNSRFC4861 50
|
||||
|
||||
/* New entries should be added here from current IPV6CTL_MAXID value. */
|
||||
/* to define items, should talk with KAME guys first, for *BSD compatibility */
|
||||
#define IPV6CTL_MAXID 51
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
__BEGIN_DECLS
|
||||
struct cmsghdr;
|
||||
|
||||
extern int inet6_option_space(int);
|
||||
extern int inet6_option_init(void *, struct cmsghdr **, int);
|
||||
extern int inet6_option_append(struct cmsghdr *, const __uint8_t *, int, int);
|
||||
extern __uint8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
|
||||
extern int inet6_option_next(const struct cmsghdr *, __uint8_t **);
|
||||
extern int inet6_option_find(const struct cmsghdr *, __uint8_t **, int);
|
||||
|
||||
extern size_t inet6_rthdr_space(int, int);
|
||||
extern struct cmsghdr *inet6_rthdr_init(void *, int);
|
||||
extern int inet6_rthdr_add(struct cmsghdr *, const struct in6_addr *,
|
||||
unsigned int);
|
||||
extern int inet6_rthdr_lasthop(struct cmsghdr *, unsigned int);
|
||||
#if 0 /* not implemented yet */
|
||||
extern int inet6_rthdr_reverse(const struct cmsghdr *, struct cmsghdr *);
|
||||
#endif
|
||||
extern int inet6_rthdr_segments(const struct cmsghdr *);
|
||||
extern struct in6_addr *inet6_rthdr_getaddr(struct cmsghdr *, int);
|
||||
extern int inet6_rthdr_getflags(const struct cmsghdr *, int);
|
||||
|
||||
extern int inet6_opt_init(void *, socklen_t);
|
||||
extern int inet6_opt_append(void *, socklen_t, int, __uint8_t, socklen_t,
|
||||
__uint8_t, void **);
|
||||
extern int inet6_opt_finish(void *, socklen_t, int);
|
||||
extern int inet6_opt_set_val(void *, int, void *, socklen_t);
|
||||
|
||||
extern int inet6_opt_next(void *, socklen_t, int, __uint8_t *, socklen_t *,
|
||||
void **);
|
||||
extern int inet6_opt_find(void *, socklen_t, int, __uint8_t, socklen_t *,
|
||||
void **);
|
||||
extern int inet6_opt_get_val(void *, int, void *, socklen_t);
|
||||
extern socklen_t inet6_rth_space(int, int);
|
||||
extern void *inet6_rth_init(void *, socklen_t, int, int);
|
||||
extern int inet6_rth_add(void *, const struct in6_addr *);
|
||||
extern int inet6_rth_reverse(const void *, void *);
|
||||
extern int inet6_rth_segments(const void *);
|
||||
extern struct in6_addr *inet6_rth_getaddr(const void *, int);
|
||||
|
||||
__END_DECLS
|
||||
#endif /* PLATFORM_DriverKit */
|
||||
#endif /* !_NETINET6_IN6_H_ */
|
||||
286
lib/libc/include/aarch64-macos-gnu/objc/objc-api.h
Normal file
286
lib/libc/include/aarch64-macos-gnu/objc/objc-api.h
Normal file
@ -0,0 +1,286 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2006 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 1988-1996 NeXT Software, Inc.
|
||||
|
||||
#ifndef _OBJC_OBJC_API_H_
|
||||
#define _OBJC_OBJC_API_H_
|
||||
|
||||
#include <Availability.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <TargetConditionals.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef __has_feature
|
||||
# define __has_feature(x) 0
|
||||
#endif
|
||||
|
||||
#ifndef __has_extension
|
||||
# define __has_extension __has_feature
|
||||
#endif
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#if !__has_feature(nullability)
|
||||
# ifndef _Nullable
|
||||
# define _Nullable
|
||||
# endif
|
||||
# ifndef _Nonnull
|
||||
# define _Nonnull
|
||||
# endif
|
||||
# ifndef _Null_unspecified
|
||||
# define _Null_unspecified
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* OBJC_API_VERSION 0 or undef: Tiger and earlier API only
|
||||
* OBJC_API_VERSION 2: Leopard and later API available
|
||||
*/
|
||||
#if !defined(OBJC_API_VERSION)
|
||||
# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_5
|
||||
# define OBJC_API_VERSION 0
|
||||
# else
|
||||
# define OBJC_API_VERSION 2
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* OBJC_NO_GC 1: GC is not supported
|
||||
* OBJC_NO_GC undef: GC is supported. This SDK no longer supports this mode.
|
||||
*
|
||||
* OBJC_NO_GC_API undef: Libraries must export any symbols that
|
||||
* dual-mode code may links to.
|
||||
* OBJC_NO_GC_API 1: Libraries need not export GC-related symbols.
|
||||
*/
|
||||
#if defined(__OBJC_GC__)
|
||||
# error Objective-C garbage collection is not supported.
|
||||
#elif TARGET_OS_OSX
|
||||
/* GC is unsupported. GC API symbols are exported. */
|
||||
# define OBJC_NO_GC 1
|
||||
# undef OBJC_NO_GC_API
|
||||
#else
|
||||
/* GC is unsupported. GC API symbols are not exported. */
|
||||
# define OBJC_NO_GC 1
|
||||
# define OBJC_NO_GC_API 1
|
||||
#endif
|
||||
|
||||
|
||||
/* NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER == 1
|
||||
* marks -[NSObject init] as a designated initializer. */
|
||||
#if !defined(NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER)
|
||||
# define NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER 1
|
||||
#endif
|
||||
|
||||
/* The arm64 ABI requires proper casting to ensure arguments are passed
|
||||
* * correctly. */
|
||||
#if defined(__arm64__) && !__swift__
|
||||
# undef OBJC_OLD_DISPATCH_PROTOTYPES
|
||||
# define OBJC_OLD_DISPATCH_PROTOTYPES 0
|
||||
#endif
|
||||
|
||||
/* OBJC_OLD_DISPATCH_PROTOTYPES == 0 enforces the rule that the dispatch
|
||||
* functions must be cast to an appropriate function pointer type. */
|
||||
#if !defined(OBJC_OLD_DISPATCH_PROTOTYPES)
|
||||
# if __swift__
|
||||
// Existing Swift code expects IMP to be Comparable.
|
||||
// Variadic IMP is comparable via OpaquePointer; non-variadic IMP isn't.
|
||||
# define OBJC_OLD_DISPATCH_PROTOTYPES 1
|
||||
# else
|
||||
# define OBJC_OLD_DISPATCH_PROTOTYPES 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* OBJC_AVAILABLE: shorthand for all-OS availability */
|
||||
|
||||
# if !defined(OBJC_AVAILABLE)
|
||||
# define OBJC_AVAILABLE(x, i, t, w, b) \
|
||||
__OSX_AVAILABLE(x) __IOS_AVAILABLE(i) __TVOS_AVAILABLE(t) \
|
||||
__WATCHOS_AVAILABLE(w)
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
/* OBJC_OSX_DEPRECATED_OTHERS_UNAVAILABLE: Deprecated on OS X,
|
||||
* unavailable everywhere else. */
|
||||
|
||||
# if !defined(OBJC_OSX_DEPRECATED_OTHERS_UNAVAILABLE)
|
||||
# define OBJC_OSX_DEPRECATED_OTHERS_UNAVAILABLE(_start, _dep, _msg) \
|
||||
__OSX_DEPRECATED(_start, _dep, _msg) \
|
||||
__IOS_UNAVAILABLE __TVOS_UNAVAILABLE \
|
||||
__WATCHOS_UNAVAILABLE
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
/* OBJC_OSX_AVAILABLE_OTHERS_UNAVAILABLE: Available on OS X,
|
||||
* unavailable everywhere else. */
|
||||
|
||||
# if !defined(OBJC_OSX_AVAILABLE_OTHERS_UNAVAILABLE)
|
||||
# define OBJC_OSX_AVAILABLE_OTHERS_UNAVAILABLE(vers) \
|
||||
__OSX_AVAILABLE(vers) \
|
||||
__IOS_UNAVAILABLE __TVOS_UNAVAILABLE \
|
||||
__WATCHOS_UNAVAILABLE
|
||||
# endif
|
||||
|
||||
|
||||
|
||||
/* OBJC_ISA_AVAILABILITY: `isa` will be deprecated or unavailable
|
||||
* in the future */
|
||||
#if !defined(OBJC_ISA_AVAILABILITY)
|
||||
# if __OBJC2__
|
||||
# define OBJC_ISA_AVAILABILITY __attribute__((deprecated))
|
||||
# else
|
||||
# define OBJC_ISA_AVAILABILITY /* still available */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* OBJC2_UNAVAILABLE: unavailable in objc 2.0, deprecated in Leopard */
|
||||
#if !defined(OBJC2_UNAVAILABLE)
|
||||
# if __OBJC2__
|
||||
# define OBJC2_UNAVAILABLE UNAVAILABLE_ATTRIBUTE
|
||||
# else
|
||||
/* plain C code also falls here, but this is close enough */
|
||||
# define OBJC2_UNAVAILABLE \
|
||||
__OSX_DEPRECATED(10.5, 10.5, "not available in __OBJC2__") \
|
||||
__IOS_DEPRECATED(2.0, 2.0, "not available in __OBJC2__") \
|
||||
__TVOS_UNAVAILABLE __WATCHOS_UNAVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* OBJC_UNAVAILABLE: unavailable, with a message where supported */
|
||||
#if !defined(OBJC_UNAVAILABLE)
|
||||
# if __has_extension(attribute_unavailable_with_message)
|
||||
# define OBJC_UNAVAILABLE(_msg) __attribute__((unavailable(_msg)))
|
||||
# else
|
||||
# define OBJC_UNAVAILABLE(_msg) __attribute__((unavailable))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* OBJC_DEPRECATED: deprecated, with a message where supported */
|
||||
#if !defined(OBJC_DEPRECATED)
|
||||
# if __has_extension(attribute_deprecated_with_message)
|
||||
# define OBJC_DEPRECATED(_msg) __attribute__((deprecated(_msg)))
|
||||
# else
|
||||
# define OBJC_DEPRECATED(_msg) __attribute__((deprecated))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* OBJC_ARC_UNAVAILABLE: unavailable with -fobjc-arc */
|
||||
#if !defined(OBJC_ARC_UNAVAILABLE)
|
||||
# if __has_feature(objc_arc)
|
||||
# define OBJC_ARC_UNAVAILABLE OBJC_UNAVAILABLE("not available in automatic reference counting mode")
|
||||
# else
|
||||
# define OBJC_ARC_UNAVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* OBJC_SWIFT_UNAVAILABLE: unavailable in Swift */
|
||||
#if !defined(OBJC_SWIFT_UNAVAILABLE)
|
||||
# if __has_feature(attribute_availability_swift)
|
||||
# define OBJC_SWIFT_UNAVAILABLE(_msg) __attribute__((availability(swift, unavailable, message=_msg)))
|
||||
# else
|
||||
# define OBJC_SWIFT_UNAVAILABLE(_msg)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* OBJC_ARM64_UNAVAILABLE: unavailable on arm64 (i.e. stret dispatch) */
|
||||
#if !defined(OBJC_ARM64_UNAVAILABLE)
|
||||
# if defined(__arm64__)
|
||||
# define OBJC_ARM64_UNAVAILABLE OBJC_UNAVAILABLE("not available in arm64")
|
||||
# else
|
||||
# define OBJC_ARM64_UNAVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* OBJC_GC_UNAVAILABLE: unavailable with -fobjc-gc or -fobjc-gc-only */
|
||||
#if !defined(OBJC_GC_UNAVAILABLE)
|
||||
# define OBJC_GC_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_EXTERN)
|
||||
# if defined(__cplusplus)
|
||||
# define OBJC_EXTERN extern "C"
|
||||
# else
|
||||
# define OBJC_EXTERN extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_VISIBLE)
|
||||
|
||||
# define OBJC_VISIBLE __attribute__((visibility("default")))
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_EXPORT)
|
||||
# define OBJC_EXPORT OBJC_EXTERN OBJC_VISIBLE
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_IMPORT)
|
||||
# define OBJC_IMPORT extern
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_ROOT_CLASS)
|
||||
# if __has_attribute(objc_root_class)
|
||||
# define OBJC_ROOT_CLASS __attribute__((objc_root_class))
|
||||
# else
|
||||
# define OBJC_ROOT_CLASS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef __DARWIN_NULL
|
||||
#define __DARWIN_NULL NULL
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_INLINE)
|
||||
# define OBJC_INLINE __inline
|
||||
#endif
|
||||
|
||||
// Declares an enum type or option bits type as appropriate for each language.
|
||||
#if (__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && __has_feature(objc_fixed_enum))
|
||||
#define OBJC_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
|
||||
#if (__cplusplus)
|
||||
#define OBJC_OPTIONS(_type, _name) _type _name; enum : _type
|
||||
#else
|
||||
#define OBJC_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
|
||||
#endif
|
||||
#else
|
||||
#define OBJC_ENUM(_type, _name) _type _name; enum
|
||||
#define OBJC_OPTIONS(_type, _name) _type _name; enum
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_RETURNS_RETAINED)
|
||||
# if __OBJC__ && __has_attribute(ns_returns_retained)
|
||||
# define OBJC_RETURNS_RETAINED __attribute__((ns_returns_retained))
|
||||
# else
|
||||
# define OBJC_RETURNS_RETAINED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
2164
lib/libc/include/aarch64-macos-gnu/objc/runtime.h
Normal file
2164
lib/libc/include/aarch64-macos-gnu/objc/runtime.h
Normal file
File diff suppressed because it is too large
Load Diff
322
lib/libc/include/aarch64-macos-gnu/os/base.h
Normal file
322
lib/libc/include/aarch64-macos-gnu/os/base.h
Normal file
@ -0,0 +1,322 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2020 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __OS_BASE__
|
||||
#define __OS_BASE__
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(x) 0
|
||||
#endif
|
||||
#ifndef __has_include
|
||||
#define __has_include(x) 0
|
||||
#endif
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(x) 0
|
||||
#endif
|
||||
#ifndef __has_attribute
|
||||
#define __has_attribute(x) 0
|
||||
#endif
|
||||
#ifndef __has_extension
|
||||
#define __has_extension(x) 0
|
||||
#endif
|
||||
|
||||
#undef OS_INLINE // <sys/_types/_os_inline.h>
|
||||
#if __GNUC__
|
||||
#define OS_NORETURN __attribute__((__noreturn__))
|
||||
#define OS_NOTHROW __attribute__((__nothrow__))
|
||||
#define OS_NONNULL1 __attribute__((__nonnull__(1)))
|
||||
#define OS_NONNULL2 __attribute__((__nonnull__(2)))
|
||||
#define OS_NONNULL3 __attribute__((__nonnull__(3)))
|
||||
#define OS_NONNULL4 __attribute__((__nonnull__(4)))
|
||||
#define OS_NONNULL5 __attribute__((__nonnull__(5)))
|
||||
#define OS_NONNULL6 __attribute__((__nonnull__(6)))
|
||||
#define OS_NONNULL7 __attribute__((__nonnull__(7)))
|
||||
#define OS_NONNULL8 __attribute__((__nonnull__(8)))
|
||||
#define OS_NONNULL9 __attribute__((__nonnull__(9)))
|
||||
#define OS_NONNULL10 __attribute__((__nonnull__(10)))
|
||||
#define OS_NONNULL11 __attribute__((__nonnull__(11)))
|
||||
#define OS_NONNULL12 __attribute__((__nonnull__(12)))
|
||||
#define OS_NONNULL13 __attribute__((__nonnull__(13)))
|
||||
#define OS_NONNULL14 __attribute__((__nonnull__(14)))
|
||||
#define OS_NONNULL15 __attribute__((__nonnull__(15)))
|
||||
#define OS_NONNULL_ALL __attribute__((__nonnull__))
|
||||
#define OS_SENTINEL __attribute__((__sentinel__))
|
||||
#define OS_PURE __attribute__((__pure__))
|
||||
#define OS_CONST __attribute__((__const__))
|
||||
#define OS_WARN_RESULT __attribute__((__warn_unused_result__))
|
||||
#define OS_MALLOC __attribute__((__malloc__))
|
||||
#define OS_USED __attribute__((__used__))
|
||||
#define OS_UNUSED __attribute__((__unused__))
|
||||
#define OS_COLD __attribute__((__cold__))
|
||||
#define OS_WEAK __attribute__((__weak__))
|
||||
#define OS_WEAK_IMPORT __attribute__((__weak_import__))
|
||||
#define OS_NOINLINE __attribute__((__noinline__))
|
||||
#define OS_ALWAYS_INLINE __attribute__((__always_inline__))
|
||||
#define OS_TRANSPARENT_UNION __attribute__((__transparent_union__))
|
||||
#define OS_ALIGNED(n) __attribute__((__aligned__((n))))
|
||||
#define OS_FORMAT_PRINTF(x, y) __attribute__((__format__(printf,x,y)))
|
||||
#define OS_EXPORT extern __attribute__((__visibility__("default")))
|
||||
#define OS_INLINE static __inline__
|
||||
#define OS_EXPECT(x, v) __builtin_expect((x), (v))
|
||||
#else
|
||||
#define OS_NORETURN
|
||||
#define OS_NOTHROW
|
||||
#define OS_NONNULL1
|
||||
#define OS_NONNULL2
|
||||
#define OS_NONNULL3
|
||||
#define OS_NONNULL4
|
||||
#define OS_NONNULL5
|
||||
#define OS_NONNULL6
|
||||
#define OS_NONNULL7
|
||||
#define OS_NONNULL8
|
||||
#define OS_NONNULL9
|
||||
#define OS_NONNULL10
|
||||
#define OS_NONNULL11
|
||||
#define OS_NONNULL12
|
||||
#define OS_NONNULL13
|
||||
#define OS_NONNULL14
|
||||
#define OS_NONNULL15
|
||||
#define OS_NONNULL_ALL
|
||||
#define OS_SENTINEL
|
||||
#define OS_PURE
|
||||
#define OS_CONST
|
||||
#define OS_WARN_RESULT
|
||||
#define OS_MALLOC
|
||||
#define OS_USED
|
||||
#define OS_UNUSED
|
||||
#define OS_COLD
|
||||
#define OS_WEAK
|
||||
#define OS_WEAK_IMPORT
|
||||
#define OS_NOINLINE
|
||||
#define OS_ALWAYS_INLINE
|
||||
#define OS_TRANSPARENT_UNION
|
||||
#define OS_ALIGNED(n)
|
||||
#define OS_FORMAT_PRINTF(x, y)
|
||||
#define OS_EXPORT extern
|
||||
#define OS_INLINE static inline
|
||||
#define OS_EXPECT(x, v) (x)
|
||||
#endif
|
||||
|
||||
#if __has_attribute(noescape)
|
||||
#define OS_NOESCAPE __attribute__((__noescape__))
|
||||
#else
|
||||
#define OS_NOESCAPE
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && defined(__clang__)
|
||||
#define OS_FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif __has_attribute(fallthrough)
|
||||
#define OS_FALLTHROUGH __attribute__((__fallthrough__))
|
||||
#else
|
||||
#define OS_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#if __has_feature(assume_nonnull)
|
||||
#define OS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
|
||||
#define OS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
|
||||
#else
|
||||
#define OS_ASSUME_NONNULL_BEGIN
|
||||
#define OS_ASSUME_NONNULL_END
|
||||
#endif
|
||||
|
||||
#if __has_builtin(__builtin_assume)
|
||||
#define OS_COMPILER_CAN_ASSUME(expr) __builtin_assume(expr)
|
||||
#else
|
||||
#define OS_COMPILER_CAN_ASSUME(expr) ((void)(expr))
|
||||
#endif
|
||||
|
||||
#if __has_extension(attribute_overloadable)
|
||||
#define OS_OVERLOADABLE __attribute__((__overloadable__))
|
||||
#else
|
||||
#define OS_OVERLOADABLE
|
||||
#endif
|
||||
|
||||
#if __has_attribute(enum_extensibility)
|
||||
#define __OS_ENUM_ATTR __attribute__((enum_extensibility(open)))
|
||||
#define __OS_ENUM_ATTR_CLOSED __attribute__((enum_extensibility(closed)))
|
||||
#else
|
||||
#define __OS_ENUM_ATTR
|
||||
#define __OS_ENUM_ATTR_CLOSED
|
||||
#endif // __has_attribute(enum_extensibility)
|
||||
|
||||
#if __has_attribute(flag_enum)
|
||||
/*!
|
||||
* Compile with -Wflag-enum and -Wassign-enum to enforce at definition and
|
||||
* assignment, respectively, i.e. -Wflag-enum prevents you from creating new
|
||||
* enumeration values from illegal values within the enum definition, and
|
||||
* -Wassign-enum prevents you from assigning illegal values to a variable of the
|
||||
* enum type.
|
||||
*/
|
||||
#define __OS_OPTIONS_ATTR __attribute__((flag_enum))
|
||||
#else
|
||||
#define __OS_OPTIONS_ATTR
|
||||
#endif // __has_attribute(flag_enum)
|
||||
|
||||
#if __has_feature(objc_fixed_enum) || __has_extension(cxx_fixed_enum) || \
|
||||
__has_extension(cxx_strong_enums)
|
||||
#define OS_ENUM(_name, _type, ...) \
|
||||
typedef enum : _type { __VA_ARGS__ } _name##_t
|
||||
#define OS_CLOSED_ENUM(_name, _type, ...) \
|
||||
typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR_CLOSED _name##_t
|
||||
#define OS_OPTIONS(_name, _type, ...) \
|
||||
typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR __OS_OPTIONS_ATTR _name##_t
|
||||
#define OS_CLOSED_OPTIONS(_name, _type, ...) \
|
||||
typedef enum : _type { __VA_ARGS__ } __OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR _name##_t
|
||||
#else
|
||||
/*!
|
||||
* There is unfortunately no good way in plain C to have both fixed-type enums
|
||||
* and enforcement for clang's enum_extensibility extensions. The primary goal
|
||||
* of these macros is to allow you to define an enum and specify its width in a
|
||||
* single statement, and for plain C that is accomplished by defining an
|
||||
* anonymous enum and then separately typedef'ing the requested type name to the
|
||||
* requested underlying integer type. So the type emitted actually has no
|
||||
* relationship at all to the enum, and therefore while the compiler could
|
||||
* enforce enum extensibility if you used the enum type, it cannot do so if you
|
||||
* use the "_t" type resulting from this expression.
|
||||
*
|
||||
* But we still define a named enum type and decorate it appropriately for you,
|
||||
* so if you really want the enum extensibility enforcement, you can use the
|
||||
* enum type yourself, i.e. when compiling with a C compiler:
|
||||
*
|
||||
* OS_CLOSED_ENUM(my_type, uint64_t,
|
||||
* FOO,
|
||||
* BAR,
|
||||
* BAZ,
|
||||
* );
|
||||
*
|
||||
* my_type_t mt = 98; // legal
|
||||
* enum my_type emt = 98; // illegal
|
||||
*
|
||||
* But be aware that the underlying enum type's width is subject only to the C
|
||||
* language's guarantees -- namely that it will be compatible with int, char,
|
||||
* and unsigned char. It is not safe to rely on the size of this type.
|
||||
*
|
||||
* When compiling in ObjC or C++, both of the above assignments are illegal.
|
||||
*/
|
||||
#define __OS_ENUM_C_FALLBACK(_name, _type, ...) \
|
||||
typedef _type _name##_t; enum _name { __VA_ARGS__ }
|
||||
|
||||
#define OS_ENUM(_name, _type, ...) \
|
||||
typedef _type _name##_t; enum { __VA_ARGS__ }
|
||||
#define OS_CLOSED_ENUM(_name, _type, ...) \
|
||||
__OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \
|
||||
__OS_ENUM_ATTR_CLOSED
|
||||
#define OS_OPTIONS(_name, _type, ...) \
|
||||
__OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \
|
||||
__OS_ENUM_ATTR __OS_OPTIONS_ATTR
|
||||
#define OS_CLOSED_OPTIONS(_name, _type, ...) \
|
||||
__OS_ENUM_C_FALLBACK(_name, _type, ## __VA_ARGS__) \
|
||||
__OS_ENUM_ATTR_CLOSED __OS_OPTIONS_ATTR
|
||||
#endif // __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
|
||||
|
||||
#if __has_feature(attribute_availability_swift)
|
||||
// equivalent to __SWIFT_UNAVAILABLE from Availability.h
|
||||
#define OS_SWIFT_UNAVAILABLE(_msg) \
|
||||
__attribute__((__availability__(swift, unavailable, message=_msg)))
|
||||
#else
|
||||
#define OS_SWIFT_UNAVAILABLE(_msg)
|
||||
#endif
|
||||
|
||||
#if __has_attribute(swift_private)
|
||||
# define OS_REFINED_FOR_SWIFT __attribute__((__swift_private__))
|
||||
#else
|
||||
# define OS_REFINED_FOR_SWIFT
|
||||
#endif
|
||||
|
||||
#if __has_attribute(swift_name)
|
||||
# define OS_SWIFT_NAME(_name) __attribute__((__swift_name__(#_name)))
|
||||
#else
|
||||
# define OS_SWIFT_NAME(_name)
|
||||
#endif
|
||||
|
||||
#define __OS_STRINGIFY(s) #s
|
||||
#define OS_STRINGIFY(s) __OS_STRINGIFY(s)
|
||||
#define __OS_CONCAT(x, y) x ## y
|
||||
#define OS_CONCAT(x, y) __OS_CONCAT(x, y)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define os_prevent_tail_call_optimization() __asm__("")
|
||||
#define os_is_compile_time_constant(expr) __builtin_constant_p(expr)
|
||||
#define os_compiler_barrier() __asm__ __volatile__("" ::: "memory")
|
||||
#else
|
||||
#define os_prevent_tail_call_optimization() do { } while (0)
|
||||
#define os_is_compile_time_constant(expr) 0
|
||||
#define os_compiler_barrier() do { } while (0)
|
||||
#endif
|
||||
|
||||
#if __has_attribute(not_tail_called)
|
||||
#define OS_NOT_TAIL_CALLED __attribute__((__not_tail_called__))
|
||||
#else
|
||||
#define OS_NOT_TAIL_CALLED
|
||||
#endif
|
||||
|
||||
|
||||
typedef void (*os_function_t)(void *_Nullable);
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @typedef os_block_t
|
||||
*
|
||||
* @abstract
|
||||
* Generic type for a block taking no arguments and returning no value.
|
||||
*
|
||||
* @discussion
|
||||
* When not building with Objective-C ARC, a block object allocated on or
|
||||
* copied to the heap must be released with a -[release] message or the
|
||||
* Block_release() function.
|
||||
*
|
||||
* The declaration of a block literal allocates storage on the stack.
|
||||
* Therefore, this is an invalid construct:
|
||||
* <code>
|
||||
* os_block_t block;
|
||||
* if (x) {
|
||||
* block = ^{ printf("true\n"); };
|
||||
* } else {
|
||||
* block = ^{ printf("false\n"); };
|
||||
* }
|
||||
* block(); // unsafe!!!
|
||||
* </code>
|
||||
*
|
||||
* What is happening behind the scenes:
|
||||
* <code>
|
||||
* if (x) {
|
||||
* struct Block __tmp_1 = ...; // setup details
|
||||
* block = &__tmp_1;
|
||||
* } else {
|
||||
* struct Block __tmp_2 = ...; // setup details
|
||||
* block = &__tmp_2;
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* As the example demonstrates, the address of a stack variable is escaping the
|
||||
* scope in which it is allocated. That is a classic C bug.
|
||||
*
|
||||
* Instead, the block literal must be copied to the heap with the Block_copy()
|
||||
* function or by sending it a -[copy] message.
|
||||
*/
|
||||
typedef void (^os_block_t)(void);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif // __OS_BASE__
|
||||
18
lib/libc/include/aarch64-macos-gnu/os/clock.h
Normal file
18
lib/libc/include/aarch64-macos-gnu/os/clock.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef __OS_CLOCK__
|
||||
#define __OS_CLOCK__
|
||||
|
||||
#include <os/base.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/*
|
||||
* @typedef os_clockid_t
|
||||
*
|
||||
* @abstract
|
||||
* Describes the kind of clock that the workgroup timestamp parameters are
|
||||
* specified in
|
||||
*/
|
||||
OS_ENUM(os_clockid, uint32_t,
|
||||
OS_CLOCK_MACH_ABSOLUTE_TIME = 32,
|
||||
);
|
||||
|
||||
#endif /* __OS_CLOCK__ */
|
||||
303
lib/libc/include/aarch64-macos-gnu/os/object.h
Normal file
303
lib/libc/include/aarch64-macos-gnu/os/object.h
Normal file
@ -0,0 +1,303 @@
|
||||
/*
|
||||
* Copyright (c) 2011-2014 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __OS_OBJECT__
|
||||
#define __OS_OBJECT__
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
#include <os/availability.h>
|
||||
#include <TargetConditionals.h>
|
||||
#include <os/base.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <os/generic_win_base.h>
|
||||
#elif defined(__unix__)
|
||||
#include <os/generic_unix_base.h>
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @header
|
||||
*
|
||||
* @preprocinfo
|
||||
* By default, libSystem objects such as GCD and XPC objects are declared as
|
||||
* Objective-C types when building with an Objective-C compiler. This allows
|
||||
* them to participate in ARC, in RR management by the Blocks runtime and in
|
||||
* leaks checking by the static analyzer, and enables them to be added to Cocoa
|
||||
* collections.
|
||||
*
|
||||
* NOTE: this requires explicit cancellation of dispatch sources and xpc
|
||||
* connections whose handler blocks capture the source/connection object,
|
||||
* resp. ensuring that such captures do not form retain cycles (e.g. by
|
||||
* declaring the source as __weak).
|
||||
*
|
||||
* To opt-out of this default behavior, add -DOS_OBJECT_USE_OBJC=0 to your
|
||||
* compiler flags.
|
||||
*
|
||||
* This mode requires a platform with the modern Objective-C runtime, the
|
||||
* Objective-C GC compiler option to be disabled, and at least a Mac OS X 10.8
|
||||
* or iOS 6.0 deployment target.
|
||||
*/
|
||||
|
||||
#ifndef OS_OBJECT_HAVE_OBJC_SUPPORT
|
||||
#if !defined(__OBJC__) || defined(__OBJC_GC__)
|
||||
# define OS_OBJECT_HAVE_OBJC_SUPPORT 0
|
||||
#elif !defined(TARGET_OS_MAC) || !TARGET_OS_MAC
|
||||
# define OS_OBJECT_HAVE_OBJC_SUPPORT 0
|
||||
#elif TARGET_OS_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
|
||||
# define OS_OBJECT_HAVE_OBJC_SUPPORT 0
|
||||
#elif TARGET_OS_MAC && !TARGET_OS_IPHONE
|
||||
# if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8
|
||||
# define OS_OBJECT_HAVE_OBJC_SUPPORT 0
|
||||
# elif defined(__i386__) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12
|
||||
# define OS_OBJECT_HAVE_OBJC_SUPPORT 0
|
||||
# else
|
||||
# define OS_OBJECT_HAVE_OBJC_SUPPORT 1
|
||||
# endif
|
||||
#else
|
||||
# define OS_OBJECT_HAVE_OBJC_SUPPORT 1
|
||||
#endif
|
||||
#endif // OS_OBJECT_HAVE_OBJC_SUPPORT
|
||||
|
||||
#if OS_OBJECT_HAVE_OBJC_SUPPORT
|
||||
#if defined(__swift__) && __swift__ && !OS_OBJECT_USE_OBJC
|
||||
#define OS_OBJECT_USE_OBJC 1
|
||||
#endif
|
||||
#ifndef OS_OBJECT_USE_OBJC
|
||||
#define OS_OBJECT_USE_OBJC 1
|
||||
#endif
|
||||
#elif defined(OS_OBJECT_USE_OBJC) && OS_OBJECT_USE_OBJC
|
||||
/* Unsupported platform for OS_OBJECT_USE_OBJC=1 */
|
||||
#undef OS_OBJECT_USE_OBJC
|
||||
#define OS_OBJECT_USE_OBJC 0
|
||||
#else
|
||||
#define OS_OBJECT_USE_OBJC 0
|
||||
#endif
|
||||
|
||||
#ifndef OS_OBJECT_SWIFT3
|
||||
#ifdef __swift__
|
||||
#define OS_OBJECT_SWIFT3 1
|
||||
#else // __swift__
|
||||
#define OS_OBJECT_SWIFT3 0
|
||||
#endif // __swift__
|
||||
#endif // OS_OBJECT_SWIFT3
|
||||
|
||||
#if __has_feature(assume_nonnull)
|
||||
#define OS_OBJECT_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
|
||||
#define OS_OBJECT_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
|
||||
#else
|
||||
#define OS_OBJECT_ASSUME_NONNULL_BEGIN
|
||||
#define OS_OBJECT_ASSUME_NONNULL_END
|
||||
#endif
|
||||
#define OS_OBJECT_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
|
||||
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
#import <objc/NSObject.h>
|
||||
#if __has_attribute(objc_independent_class)
|
||||
#define OS_OBJC_INDEPENDENT_CLASS __attribute__((objc_independent_class))
|
||||
#endif // __has_attribute(objc_independent_class)
|
||||
#ifndef OS_OBJC_INDEPENDENT_CLASS
|
||||
#define OS_OBJC_INDEPENDENT_CLASS
|
||||
#endif
|
||||
#define OS_OBJECT_CLASS(name) OS_##name
|
||||
#define OS_OBJECT_DECL_PROTOCOL(name, ...) \
|
||||
@protocol OS_OBJECT_CLASS(name) __VA_ARGS__ \
|
||||
@end
|
||||
#define OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL_IMPL(name, proto) \
|
||||
@interface name () <proto> \
|
||||
@end
|
||||
#define OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, proto) \
|
||||
OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL_IMPL( \
|
||||
OS_OBJECT_CLASS(name), OS_OBJECT_CLASS(proto))
|
||||
#define OS_OBJECT_DECL_IMPL(name, adhere, ...) \
|
||||
OS_OBJECT_DECL_PROTOCOL(name, __VA_ARGS__) \
|
||||
typedef adhere<OS_OBJECT_CLASS(name)> \
|
||||
* OS_OBJC_INDEPENDENT_CLASS name##_t
|
||||
#define OS_OBJECT_DECL_BASE(name, ...) \
|
||||
@interface OS_OBJECT_CLASS(name) : __VA_ARGS__ \
|
||||
- (instancetype)init OS_SWIFT_UNAVAILABLE("Unavailable in Swift"); \
|
||||
@end
|
||||
#define OS_OBJECT_DECL_IMPL_CLASS(name, ...) \
|
||||
OS_OBJECT_DECL_BASE(name, ## __VA_ARGS__) \
|
||||
typedef OS_OBJECT_CLASS(name) \
|
||||
* OS_OBJC_INDEPENDENT_CLASS name##_t
|
||||
#define OS_OBJECT_DECL(name, ...) \
|
||||
OS_OBJECT_DECL_IMPL(name, NSObject, <NSObject>)
|
||||
#define OS_OBJECT_DECL_SUBCLASS(name, super) \
|
||||
OS_OBJECT_DECL_IMPL(name, NSObject, <OS_OBJECT_CLASS(super)>)
|
||||
#if __has_attribute(ns_returns_retained)
|
||||
#define OS_OBJECT_RETURNS_RETAINED __attribute__((__ns_returns_retained__))
|
||||
#else
|
||||
#define OS_OBJECT_RETURNS_RETAINED
|
||||
#endif
|
||||
#if __has_attribute(ns_consumed)
|
||||
#define OS_OBJECT_CONSUMED __attribute__((__ns_consumed__))
|
||||
#else
|
||||
#define OS_OBJECT_CONSUMED
|
||||
#endif
|
||||
#if __has_feature(objc_arc)
|
||||
#define OS_OBJECT_BRIDGE __bridge
|
||||
#define OS_WARN_RESULT_NEEDS_RELEASE
|
||||
#else
|
||||
#define OS_OBJECT_BRIDGE
|
||||
#define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT
|
||||
#endif
|
||||
|
||||
|
||||
#if __has_attribute(objc_runtime_visible) && \
|
||||
((defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
|
||||
__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12) || \
|
||||
(defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \
|
||||
!defined(__TV_OS_VERSION_MIN_REQUIRED) && \
|
||||
!defined(__WATCH_OS_VERSION_MIN_REQUIRED) && \
|
||||
__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0) || \
|
||||
(defined(__TV_OS_VERSION_MIN_REQUIRED) && \
|
||||
__TV_OS_VERSION_MIN_REQUIRED < __TVOS_10_0) || \
|
||||
(defined(__WATCH_OS_VERSION_MIN_REQUIRED) && \
|
||||
__WATCH_OS_VERSION_MIN_REQUIRED < __WATCHOS_3_0))
|
||||
/*
|
||||
* To provide backward deployment of ObjC objects in Swift on pre-10.12
|
||||
* SDKs, OS_object classes can be marked as OS_OBJECT_OBJC_RUNTIME_VISIBLE.
|
||||
* When compiling with a deployment target earlier than OS X 10.12 (iOS 10.0,
|
||||
* tvOS 10.0, watchOS 3.0) the Swift compiler will only refer to this type at
|
||||
* runtime (using the ObjC runtime).
|
||||
*/
|
||||
#define OS_OBJECT_OBJC_RUNTIME_VISIBLE __attribute__((objc_runtime_visible))
|
||||
#else
|
||||
#define OS_OBJECT_OBJC_RUNTIME_VISIBLE
|
||||
#endif
|
||||
#ifndef OS_OBJECT_USE_OBJC_RETAIN_RELEASE
|
||||
#if defined(__clang_analyzer__)
|
||||
#define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 1
|
||||
#elif __has_feature(objc_arc) && !OS_OBJECT_SWIFT3
|
||||
#define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 1
|
||||
#else
|
||||
#define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 0
|
||||
#endif
|
||||
#endif
|
||||
#if OS_OBJECT_SWIFT3
|
||||
#define OS_OBJECT_DECL_SWIFT(name) \
|
||||
OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \
|
||||
OS_OBJECT_DECL_IMPL_CLASS(name, NSObject)
|
||||
#define OS_OBJECT_DECL_SUBCLASS_SWIFT(name, super) \
|
||||
OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \
|
||||
OS_OBJECT_DECL_IMPL_CLASS(name, OS_OBJECT_CLASS(super))
|
||||
#endif // OS_OBJECT_SWIFT3
|
||||
OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE
|
||||
OS_OBJECT_DECL_BASE(object, NSObject);
|
||||
#else
|
||||
/*! @parseOnly */
|
||||
#define OS_OBJECT_RETURNS_RETAINED
|
||||
/*! @parseOnly */
|
||||
#define OS_OBJECT_CONSUMED
|
||||
/*! @parseOnly */
|
||||
#define OS_OBJECT_BRIDGE
|
||||
/*! @parseOnly */
|
||||
#define OS_WARN_RESULT_NEEDS_RELEASE OS_WARN_RESULT
|
||||
/*! @parseOnly */
|
||||
#define OS_OBJECT_OBJC_RUNTIME_VISIBLE
|
||||
#define OS_OBJECT_USE_OBJC_RETAIN_RELEASE 0
|
||||
#endif
|
||||
|
||||
#if OS_OBJECT_SWIFT3
|
||||
#define OS_OBJECT_DECL_CLASS(name) \
|
||||
OS_OBJECT_DECL_SUBCLASS_SWIFT(name, object)
|
||||
#elif OS_OBJECT_USE_OBJC
|
||||
#define OS_OBJECT_DECL_CLASS(name) \
|
||||
OS_OBJECT_DECL(name)
|
||||
#else
|
||||
#define OS_OBJECT_DECL_CLASS(name) \
|
||||
typedef struct name##_s *name##_t
|
||||
#endif
|
||||
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
/* Declares a class of the specific name and exposes the interface and typedefs
|
||||
* name##_t to the pointer to the class */
|
||||
#define OS_OBJECT_SHOW_CLASS(name, ...) \
|
||||
OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \
|
||||
OS_OBJECT_DECL_IMPL_CLASS(name, ## __VA_ARGS__ )
|
||||
/* Declares a subclass of the same name, and
|
||||
* subclass adheres to protocol specified. Typedefs baseclass<proto> * to subclass##_t */
|
||||
#define OS_OBJECT_SHOW_SUBCLASS(subclass_name, super, proto_name) \
|
||||
OS_EXPORT OS_OBJECT_OBJC_RUNTIME_VISIBLE \
|
||||
OS_OBJECT_DECL_BASE(subclass_name, OS_OBJECT_CLASS(super)<OS_OBJECT_CLASS(proto_name)>); \
|
||||
typedef OS_OBJECT_CLASS(super)<OS_OBJECT_CLASS(proto_name)> \
|
||||
* OS_OBJC_INDEPENDENT_CLASS subclass_name##_t
|
||||
#else /* Plain C */
|
||||
#define OS_OBJECT_DECL_PROTOCOL(name, ...)
|
||||
#define OS_OBJECT_SHOW_CLASS(name, ...) \
|
||||
typedef struct name##_s *name##_t
|
||||
#define OS_OBJECT_SHOW_SUBCLASS(name, super, ...) \
|
||||
typedef super##_t name##_t
|
||||
#endif
|
||||
|
||||
#define OS_OBJECT_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object))
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @function os_retain
|
||||
*
|
||||
* @abstract
|
||||
* Increment the reference count of an os_object.
|
||||
*
|
||||
* @discussion
|
||||
* On a platform with the modern Objective-C runtime this is exactly equivalent
|
||||
* to sending the object the -[retain] message.
|
||||
*
|
||||
* @param object
|
||||
* The object to retain.
|
||||
*
|
||||
* @result
|
||||
* The retained object.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
OS_EXPORT OS_SWIFT_UNAVAILABLE("Can't be used with ARC")
|
||||
void*
|
||||
os_retain(void *object);
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
#undef os_retain
|
||||
#define os_retain(object) [object retain]
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function os_release
|
||||
*
|
||||
* @abstract
|
||||
* Decrement the reference count of a os_object.
|
||||
*
|
||||
* @discussion
|
||||
* On a platform with the modern Objective-C runtime this is exactly equivalent
|
||||
* to sending the object the -[release] message.
|
||||
*
|
||||
* @param object
|
||||
* The object to release.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.10), ios(8.0))
|
||||
OS_EXPORT
|
||||
void OS_SWIFT_UNAVAILABLE("Can't be used with ARC")
|
||||
os_release(void *object);
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
#undef os_release
|
||||
#define os_release(object) [object release]
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
37
lib/libc/include/aarch64-macos-gnu/os/workgroup.h
Normal file
37
lib/libc/include/aarch64-macos-gnu/os/workgroup.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __OS_WORKGROUP__
|
||||
#define __OS_WORKGROUP__
|
||||
|
||||
#ifndef __DISPATCH_BUILDING_DISPATCH__
|
||||
#ifndef __OS_WORKGROUP_INDIRECT__
|
||||
#define __OS_WORKGROUP_INDIRECT__
|
||||
#endif /* __OS_WORKGROUP_INDIRECT__ */
|
||||
|
||||
#include <os/workgroup_base.h>
|
||||
#include <os/workgroup_object.h>
|
||||
#include <os/workgroup_interval.h>
|
||||
#include <os/workgroup_parallel.h>
|
||||
|
||||
#undef __OS_WORKGROUP_INDIRECT__
|
||||
#endif /* __DISPATCH_BUILDING_DISPATCH__ */
|
||||
|
||||
#endif /* __OS_WORKGROUP__ */
|
||||
78
lib/libc/include/aarch64-macos-gnu/os/workgroup_base.h
Normal file
78
lib/libc/include/aarch64-macos-gnu/os/workgroup_base.h
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef __OS_WORKGROUP_BASE__
|
||||
#define __OS_WORKGROUP_BASE__
|
||||
|
||||
#ifndef __OS_WORKGROUP_INDIRECT__
|
||||
#error "Please #include <os/workgroup.h> instead of this file directly."
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <mach/port.h>
|
||||
|
||||
#include <Availability.h>
|
||||
#include <os/base.h>
|
||||
#include <os/object.h>
|
||||
#include <os/clock.h>
|
||||
|
||||
#if __has_feature(assume_nonnull)
|
||||
#define OS_WORKGROUP_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
|
||||
#define OS_WORKGROUP_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
|
||||
#else
|
||||
#define OS_WORKGROUP_ASSUME_NONNULL_BEGIN
|
||||
#define OS_WORKGROUP_ASSUME_NONNULL_END
|
||||
#endif
|
||||
#define OS_WORKGROUP_WARN_RESULT __attribute__((__warn_unused_result__))
|
||||
#define OS_WORKGROUP_EXPORT OS_EXPORT
|
||||
#define OS_WORKGROUP_RETURNS_RETAINED OS_OBJECT_RETURNS_RETAINED
|
||||
|
||||
#define OS_WORKGROUP_DECL(name, swift_name) \
|
||||
OS_SWIFT_NAME(swift_name) \
|
||||
OS_OBJECT_SHOW_CLASS(name, OS_OBJECT_CLASS(object))
|
||||
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
#define OS_WORKGROUP_SUBCLASS_DECL_PROTO(name, swift_name, ...) \
|
||||
OS_SWIFT_NAME(swift_name) \
|
||||
OS_OBJECT_DECL_PROTOCOL(name ## __VA_ARGS__ )
|
||||
#else
|
||||
#define OS_WORKGROUP_SUBCLASS_DECL_PROTO(name, swift_name, ...)
|
||||
#endif
|
||||
|
||||
#define OS_WORKGROUP_SUBCLASS_DECL(name, super, swift_name, ...) \
|
||||
OS_SWIFT_NAME(swift_name) \
|
||||
OS_OBJECT_SHOW_SUBCLASS(name, super, name, ## __VA_ARGS__)
|
||||
|
||||
#if defined(__LP64__)
|
||||
#define __OS_WORKGROUP_ATTR_SIZE__ 60
|
||||
#define __OS_WORKGROUP_INTERVAL_DATA_SIZE__ 56
|
||||
#define __OS_WORKGROUP_JOIN_TOKEN_SIZE__ 36
|
||||
#else
|
||||
#define __OS_WORKGROUP_ATTR_SIZE__ 60
|
||||
#define __OS_WORKGROUP_INTERVAL_DATA_SIZE__ 56
|
||||
#define __OS_WORKGROUP_JOIN_TOKEN_SIZE__ 28
|
||||
#endif
|
||||
|
||||
#define _OS_WORKGROUP_ATTR_SIG_DEFAULT_INIT 0x2FA863B4
|
||||
#define _OS_WORKGROUP_ATTR_SIG_EMPTY_INIT 0x2FA863C4
|
||||
|
||||
struct OS_REFINED_FOR_SWIFT os_workgroup_attr_opaque_s {
|
||||
uint32_t sig;
|
||||
char opaque[__OS_WORKGROUP_ATTR_SIZE__];
|
||||
};
|
||||
|
||||
#define _OS_WORKGROUP_INTERVAL_DATA_SIG_INIT 0x52A74C4D
|
||||
struct OS_REFINED_FOR_SWIFT os_workgroup_interval_data_opaque_s {
|
||||
uint32_t sig;
|
||||
char opaque[__OS_WORKGROUP_INTERVAL_DATA_SIZE__];
|
||||
};
|
||||
|
||||
struct OS_REFINED_FOR_SWIFT os_workgroup_join_token_opaque_s {
|
||||
uint32_t sig;
|
||||
char opaque[__OS_WORKGROUP_JOIN_TOKEN_SIZE__];
|
||||
};
|
||||
|
||||
#endif /* __OS_WORKGROUP_BASE__ */
|
||||
155
lib/libc/include/aarch64-macos-gnu/os/workgroup_interval.h
Normal file
155
lib/libc/include/aarch64-macos-gnu/os/workgroup_interval.h
Normal file
@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __OS_WORKGROUP_INTERVAL__
|
||||
#define __OS_WORKGROUP_INTERVAL__
|
||||
|
||||
#ifndef __OS_WORKGROUP_INDIRECT__
|
||||
#error "Please #include <os/workgroup.h> instead of this file directly."
|
||||
#include <os/workgroup_base.h> // For header doc
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
OS_WORKGROUP_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @typedef os_workgroup_interval_t
|
||||
*
|
||||
* @abstract
|
||||
* A subclass of an os_workgroup_t for tracking work performed as part of
|
||||
* a repeating interval-driven workload.
|
||||
*/
|
||||
OS_WORKGROUP_SUBCLASS_DECL_PROTO(os_workgroup_interval, Repeatable);
|
||||
OS_WORKGROUP_SUBCLASS_DECL(os_workgroup_interval, os_workgroup, WorkGroupInterval);
|
||||
|
||||
/* During the first instance of this API, the only supported interval
|
||||
* workgroups are for audio workloads. Please refer to the AudioToolbox
|
||||
* framework for more information.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @typedef os_workgroup_interval_data, os_workgroup_interval_data_t
|
||||
*
|
||||
* @abstract
|
||||
* An opaque structure containing additional configuration for the workgroup
|
||||
* interval.
|
||||
*/
|
||||
typedef struct os_workgroup_interval_data_opaque_s os_workgroup_interval_data_s;
|
||||
typedef struct os_workgroup_interval_data_opaque_s *os_workgroup_interval_data_t;
|
||||
#define OS_WORKGROUP_INTERVAL_DATA_INITIALIZER \
|
||||
{ .sig = _OS_WORKGROUP_INTERVAL_DATA_SIG_INIT }
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_interval_start
|
||||
*
|
||||
* @abstract
|
||||
* Indicates to the system that the member threads of this
|
||||
* os_workgroup_interval_t have begun working on an instance of the repeatable
|
||||
* interval workload with the specified timestamps. This function is real time
|
||||
* safe.
|
||||
*
|
||||
* This function will set and return an errno in the following cases:
|
||||
*
|
||||
* - The current thread is not a member of the os_workgroup_interval_t
|
||||
* - The os_workgroup_interval_t has been cancelled
|
||||
* - The timestamps passed in are malformed
|
||||
* - os_workgroup_interval_start() was previously called on the
|
||||
* os_workgroup_interval_t without an intervening os_workgroup_interval_finish()
|
||||
* - A concurrent workgroup interval configuration operation is taking place.
|
||||
*
|
||||
* @param start
|
||||
* Start timestamp specified in the os_clockid_t with which the
|
||||
* os_workgroup_interval_t was created. This is generally a time in the past and
|
||||
* indicates when the workgroup started working on an interval period
|
||||
*
|
||||
* @param deadline
|
||||
* Deadline timestamp specified in the os_clockid_t with which the
|
||||
* os_workgroup_interval_t was created. This specifies the deadline which the
|
||||
* interval period would like to meet.
|
||||
*
|
||||
* @param data
|
||||
* This field is currently unused and should be NULL
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
|
||||
int
|
||||
os_workgroup_interval_start(os_workgroup_interval_t wg, uint64_t start, uint64_t
|
||||
deadline, os_workgroup_interval_data_t _Nullable data);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_interval_update
|
||||
*
|
||||
* @abstract
|
||||
* Updates an already started interval workgroup to have the new
|
||||
* deadline specified. This function is real time safe.
|
||||
*
|
||||
* This function will return an error in the following cases:
|
||||
* - The current thread is not a member of the os_workgroup_interval_t
|
||||
* - The os_workgroup_interval_t has been cancelled
|
||||
* - The timestamp passed in is malformed
|
||||
* - os_workgroup_interval_start() was not previously called on the
|
||||
* os_workgroup_interval_t or was already matched with an
|
||||
* os_workgroup_interval_finish()
|
||||
* - A concurrent workgroup interval configuration operation is taking place
|
||||
*
|
||||
* @param deadline
|
||||
* Timestamp specified in the os_clockid_t with
|
||||
* which the os_workgroup_interval_t was created.
|
||||
*
|
||||
* @param data
|
||||
* This field is currently unused and should be NULL
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
|
||||
int
|
||||
os_workgroup_interval_update(os_workgroup_interval_t wg, uint64_t deadline,
|
||||
os_workgroup_interval_data_t _Nullable data);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_interval_finish
|
||||
*
|
||||
* @abstract
|
||||
* Indicates to the system that the member threads of
|
||||
* this os_workgroup_interval_t have finished working on the current instance
|
||||
* of the interval workload. This function is real time safe.
|
||||
*
|
||||
* This function will return an error in the following cases:
|
||||
* - The current thread is not a member of the os_workgroup_interval_t
|
||||
* - os_workgroup_interval_start() was not previously called on the
|
||||
* os_workgroup_interval_t or was already matched with an
|
||||
* os_workgroup_interval_finish()
|
||||
* - A concurrent workgroup interval configuration operation is taking place.
|
||||
*
|
||||
* @param data
|
||||
* This field is currently unused and should be NULL
|
||||
*
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
|
||||
int
|
||||
os_workgroup_interval_finish(os_workgroup_interval_t wg,
|
||||
os_workgroup_interval_data_t _Nullable data);
|
||||
|
||||
OS_WORKGROUP_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __OS_WORKGROUP_INTERVAL__ */
|
||||
357
lib/libc/include/aarch64-macos-gnu/os/workgroup_object.h
Normal file
357
lib/libc/include/aarch64-macos-gnu/os/workgroup_object.h
Normal file
@ -0,0 +1,357 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __OS_WORKGROUP_OBJECT__
|
||||
#define __OS_WORKGROUP_OBJECT__
|
||||
|
||||
#ifndef __OS_WORKGROUP_INDIRECT__
|
||||
#error "Please #include <os/workgroup.h> instead of this file directly."
|
||||
#include <os/workgroup_base.h> // For header doc
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
OS_WORKGROUP_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @typedef os_workgroup_t
|
||||
*
|
||||
* @abstract
|
||||
* A reference counted os object representing a workload that needs to
|
||||
* be distinctly recognized and tracked by the system. The workgroup
|
||||
* tracks a collection of threads all working cooperatively. An os_workgroup
|
||||
* object - when not an instance of a specific os_workgroup_t subclass -
|
||||
* represents a generic workload and makes no assumptions about the kind of
|
||||
* work done.
|
||||
*
|
||||
* @discussion
|
||||
* Threads can explicitly join an os_workgroup_t to mark themselves as
|
||||
* participants in the workload.
|
||||
*/
|
||||
OS_WORKGROUP_DECL(os_workgroup, WorkGroup);
|
||||
|
||||
|
||||
/* Attribute creation and specification */
|
||||
|
||||
/*!
|
||||
* @typedef os_workgroup_attr_t
|
||||
*
|
||||
* @abstract
|
||||
* Pointer to an opaque structure for describing attributes that can be
|
||||
* configured on a workgroup at creation.
|
||||
*/
|
||||
typedef struct os_workgroup_attr_opaque_s os_workgroup_attr_s;
|
||||
typedef struct os_workgroup_attr_opaque_s *os_workgroup_attr_t;
|
||||
|
||||
/* os_workgroup_t attributes need to be initialized before use. This initializer
|
||||
* allows you to create a workgroup with the system default attributes. */
|
||||
#define OS_WORKGROUP_ATTR_INITIALIZER_DEFAULT \
|
||||
{ .sig = _OS_WORKGROUP_ATTR_SIG_DEFAULT_INIT }
|
||||
|
||||
|
||||
|
||||
/* The main use of the workgroup API is through instantiations of the concrete
|
||||
* subclasses - please refer to os/workgroup_interval.h and
|
||||
* os/workgroup_parallel.h for more information on creating workgroups.
|
||||
*
|
||||
* The functions below operate on all subclasses of os_workgroup_t.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_copy_port
|
||||
*
|
||||
* @abstract
|
||||
* Returns a reference to a send right representing this workgroup that is to be
|
||||
* sent to other processes. This port is to be passed to
|
||||
* os_workgroup_create_with_port() to create a workgroup object.
|
||||
*
|
||||
* It is the client's responsibility to release the send right reference.
|
||||
*
|
||||
* If an error is encountered, errno is set and returned.
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0))
|
||||
API_UNAVAILABLE(ios, tvos, watchos)
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
|
||||
int
|
||||
os_workgroup_copy_port(os_workgroup_t wg, mach_port_t *mach_port_out);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_create_with_port
|
||||
*
|
||||
* @abstract
|
||||
* Create an os_workgroup_t object from a send right returned by a previous
|
||||
* call to os_workgroup_copy_port, potentially in a different process.
|
||||
*
|
||||
* A newly created os_workgroup_t has no initial member threads - in particular
|
||||
* the creating thread does not join the os_workgroup_t implicitly.
|
||||
*
|
||||
* @param name
|
||||
* A client specified string for labelling the workgroup. This parameter is
|
||||
* optional and can be NULL.
|
||||
*
|
||||
* @param mach_port
|
||||
* The send right to create the workgroup from. No reference is consumed
|
||||
* on the specified send right.
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0))
|
||||
API_UNAVAILABLE(ios, tvos, watchos)
|
||||
OS_SWIFT_NAME(WorkGroup.init(__name:port:)) OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED
|
||||
os_workgroup_t _Nullable
|
||||
os_workgroup_create_with_port(const char *_Nullable name, mach_port_t mach_port);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_create_with_workgroup
|
||||
*
|
||||
* @abstract
|
||||
* Create a new os_workgroup object from an existing os_workgroup.
|
||||
*
|
||||
* The newly created os_workgroup has no initial member threads - in particular
|
||||
* the creating threaad does not join the os_workgroup_t implicitly.
|
||||
*
|
||||
* @param name
|
||||
* A client specified string for labelling the workgroup. This parameter is
|
||||
* optional and can be NULL.
|
||||
*
|
||||
* @param wg
|
||||
* The existing workgroup to create a new workgroup object from.
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED
|
||||
os_workgroup_t _Nullable
|
||||
os_workgroup_create_with_workgroup(const char * _Nullable name, os_workgroup_t wg);
|
||||
|
||||
/*!
|
||||
* @typedef os_workgroup_join_token, os_workgroup_join_token_t
|
||||
*
|
||||
* @abstract
|
||||
* An opaque join token which the client needs to pass to os_workgroup_join
|
||||
* and os_workgroup_leave
|
||||
*/
|
||||
OS_REFINED_FOR_SWIFT
|
||||
typedef struct os_workgroup_join_token_opaque_s os_workgroup_join_token_s;
|
||||
OS_REFINED_FOR_SWIFT
|
||||
typedef struct os_workgroup_join_token_opaque_s *os_workgroup_join_token_t;
|
||||
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_join
|
||||
*
|
||||
* @abstract
|
||||
* Joins the current thread to the specified workgroup and populates the join
|
||||
* token that has been passed in. This API is real-time safe.
|
||||
*
|
||||
* @param wg
|
||||
* The workgroup that the current thread would like to join
|
||||
*
|
||||
* @param token_out
|
||||
* Pointer to a client allocated struct which the function will populate
|
||||
* with the join token. This token must be passed in by the thread when it calls
|
||||
* os_workgroup_leave().
|
||||
*
|
||||
* Errors will be returned in the following cases:
|
||||
*
|
||||
* EALREADY The thread is already part of a workgroup that the specified
|
||||
* workgroup does not nest with
|
||||
* EINVAL The workgroup has been cancelled
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
|
||||
int
|
||||
os_workgroup_join(os_workgroup_t wg, os_workgroup_join_token_t token_out);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_leave
|
||||
*
|
||||
* @abstract
|
||||
* This removes the current thread from a workgroup it has previously
|
||||
* joined. Threads must leave all workgroups in the reverse order that they
|
||||
* have joined them. Failing to do so before exiting will result in undefined
|
||||
* behavior.
|
||||
*
|
||||
* If the join token is malformed, the process will be aborted.
|
||||
*
|
||||
* This API is real time safe.
|
||||
*
|
||||
* @param wg
|
||||
* The workgroup that the current thread would like to leave.
|
||||
*
|
||||
* @param token
|
||||
* This is the join token populated by the most recent call to
|
||||
* os_workgroup_join().
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
|
||||
void
|
||||
os_workgroup_leave(os_workgroup_t wg, os_workgroup_join_token_t token);
|
||||
|
||||
/* Working Arena index of a thread in a workgroup */
|
||||
typedef uint32_t os_workgroup_index;
|
||||
/* Destructor for Working Arena */
|
||||
typedef void (*os_workgroup_working_arena_destructor_t)(void * _Nullable);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_set_working_arena
|
||||
*
|
||||
* @abstract
|
||||
* Associates a client defined working arena with the workgroup. The arena
|
||||
* is local to the workgroup object in the process. This is intended for
|
||||
* distributing a manually managed memory allocation between member threads
|
||||
* of the workgroup.
|
||||
*
|
||||
* This function can be called multiple times and the client specified
|
||||
* destructor will be called on the previously assigned arena, if any. This
|
||||
* function can only be called when no threads have currently joined the
|
||||
* workgroup and all workloops associated with the workgroup are idle.
|
||||
*
|
||||
* @param wg
|
||||
* The workgroup to associate the working arena with
|
||||
*
|
||||
* @param arena
|
||||
* The client managed arena to associate with the workgroup. This value can
|
||||
* be NULL.
|
||||
*
|
||||
* @param max_workers
|
||||
* The maximum number of threads that will ever query the workgroup for the
|
||||
* arena and request an index into it. If the arena is not used to partition
|
||||
* work amongst member threads, then this field can be 0.
|
||||
*
|
||||
* @param destructor
|
||||
* A destructor to call on the previously assigned working arena, if any
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT OS_WORKGROUP_WARN_RESULT
|
||||
int
|
||||
os_workgroup_set_working_arena(os_workgroup_t wg, void * _Nullable arena,
|
||||
uint32_t max_workers, os_workgroup_working_arena_destructor_t destructor);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_get_working_arena
|
||||
*
|
||||
* @abstract
|
||||
* Returns the working arena associated with the workgroup and the current
|
||||
* thread's index in the workgroup. This function can only be called by a member
|
||||
* of the workgroup. Multiple calls to this API by a member thread will return
|
||||
* the same arena and index until the thread leaves the workgroup.
|
||||
*
|
||||
* For workloops with an associated workgroup, every work item on the workloop
|
||||
* will receive the same index in the arena.
|
||||
*
|
||||
* This method returns NULL if no arena is set on the workgroup. The index
|
||||
* returned by this function is zero-based and is namespaced per workgroup
|
||||
* object in the process. The indices provided are strictly monotonic and never
|
||||
* reused until a future call to os_workgroup_set_working_arena.
|
||||
*
|
||||
* @param wg
|
||||
* The workgroup to get the working arena from.
|
||||
*
|
||||
* @param index_out
|
||||
* A pointer to a os_workgroup_index which will be populated by the caller's
|
||||
* index in the workgroup.
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
|
||||
void * _Nullable
|
||||
os_workgroup_get_working_arena(os_workgroup_t wg,
|
||||
os_workgroup_index * _Nullable index_out);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_cancel
|
||||
*
|
||||
* @abstract
|
||||
* This API invalidates a workgroup and indicates to the system that the
|
||||
* workload is no longer relevant to the caller.
|
||||
*
|
||||
* No new work should be initiated for a cancelled workgroup and
|
||||
* work that is already underway should periodically check for
|
||||
* cancellation with os_workgroup_testcancel and initiate cleanup if needed.
|
||||
*
|
||||
* Threads currently in the workgroup continue to be tracked together but no
|
||||
* new threads may join this workgroup - the only possible operation allowed is
|
||||
* to leave the workgroup. Other actions may have undefined behavior or
|
||||
* otherwise fail.
|
||||
*
|
||||
* This API is idempotent. Cancellation is local to the workgroup object
|
||||
* it is called on and does not affect other workgroups.
|
||||
*
|
||||
* @param wg
|
||||
* The workgroup that that the thread would like to cancel
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
|
||||
void
|
||||
os_workgroup_cancel(os_workgroup_t wg);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_testcancel
|
||||
*
|
||||
* @abstract
|
||||
* Returns true if the workgroup object has been cancelled. See also
|
||||
* os_workgroup_cancel
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
|
||||
bool
|
||||
os_workgroup_testcancel(os_workgroup_t wg);
|
||||
|
||||
/*!
|
||||
* @typedef os_workgroup_max_parallel_threads_attr_t
|
||||
*
|
||||
* @abstract
|
||||
* A pointer to a structure describing the set of properties of a workgroup to
|
||||
* override with the explicitly specified values in the structure.
|
||||
*
|
||||
* See also os_workgroup_max_parallel_threads.
|
||||
*/
|
||||
OS_REFINED_FOR_SWIFT
|
||||
typedef struct os_workgroup_max_parallel_threads_attr_s os_workgroup_mpt_attr_s;
|
||||
OS_REFINED_FOR_SWIFT
|
||||
typedef struct os_workgroup_max_parallel_threads_attr_s *os_workgroup_mpt_attr_t;
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_max_parallel_threads
|
||||
*
|
||||
* @abstract
|
||||
* Returns the system's recommendation for maximum number of threads the client
|
||||
* should make for a multi-threaded workload in a given workgroup.
|
||||
*
|
||||
* This API takes into consideration the current hardware the code is running on
|
||||
* and the attributes of the workgroup. It does not take into consideration the
|
||||
* current load of the system and therefore always provides the most optimal
|
||||
* recommendation for the workload.
|
||||
*
|
||||
* @param wg
|
||||
* The workgroup in which the multi-threaded workload will be performed in. The
|
||||
* threads performing the multi-threaded workload are expected to join this
|
||||
* workgroup.
|
||||
*
|
||||
* @param attr
|
||||
* This value is currently unused and should be NULL.
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_REFINED_FOR_SWIFT OS_WORKGROUP_EXPORT
|
||||
int
|
||||
os_workgroup_max_parallel_threads(os_workgroup_t wg, os_workgroup_mpt_attr_t
|
||||
_Nullable attr);
|
||||
|
||||
OS_WORKGROUP_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __OS_WORKGROUP_OBJECT__ */
|
||||
74
lib/libc/include/aarch64-macos-gnu/os/workgroup_parallel.h
Normal file
74
lib/libc/include/aarch64-macos-gnu/os/workgroup_parallel.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_APACHE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __OS_WORKGROUP_PARALLEL__
|
||||
#define __OS_WORKGROUP_PARALLEL__
|
||||
|
||||
#ifndef __OS_WORKGROUP_INDIRECT__
|
||||
#error "Please #include <os/workgroup.h> instead of this file directly."
|
||||
#include <os/workgroup_base.h> // For header doc
|
||||
#endif
|
||||
|
||||
#include <os/workgroup_object.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
OS_WORKGROUP_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/*!
|
||||
* @typedef os_workgroup_parallel_t
|
||||
*
|
||||
* @abstract
|
||||
* A subclass of an os_workgroup_t for tracking parallel work.
|
||||
*/
|
||||
OS_WORKGROUP_SUBCLASS_DECL_PROTO(os_workgroup_parallel, Parallelizable);
|
||||
OS_WORKGROUP_SUBCLASS_DECL(os_workgroup_parallel, os_workgroup, WorkGroupParallel);
|
||||
|
||||
/*!
|
||||
* @function os_workgroup_parallel_create
|
||||
*
|
||||
* @abstract
|
||||
* Creates an os_workgroup_t which tracks a parallel workload.
|
||||
* A newly created os_workgroup_interval_t has no initial member threads -
|
||||
* in particular the creating thread does not join the os_workgroup_parallel_t
|
||||
* implicitly.
|
||||
*
|
||||
* See also os_workgroup_max_parallel_threads().
|
||||
*
|
||||
* @param name
|
||||
* A client specified string for labelling the workgroup. This parameter is
|
||||
* optional and can be NULL.
|
||||
*
|
||||
* @param attr
|
||||
* The requested set of workgroup attributes. NULL is to be specified for the
|
||||
* default set of attributes.
|
||||
*/
|
||||
API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0), watchos(7.0))
|
||||
OS_WORKGROUP_EXPORT OS_WORKGROUP_RETURNS_RETAINED
|
||||
OS_SWIFT_NAME(WorkGroupParallel.init(__name:attr:))
|
||||
os_workgroup_parallel_t _Nullable
|
||||
os_workgroup_parallel_create(const char * _Nullable name,
|
||||
os_workgroup_attr_t _Nullable attr);
|
||||
|
||||
OS_WORKGROUP_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __OS_WORKGROUP_PARALLEL__ */
|
||||
592
lib/libc/include/aarch64-macos-gnu/pthread.h
Normal file
592
lib/libc/include/aarch64-macos-gnu/pthread.h
Normal file
@ -0,0 +1,592 @@
|
||||
/*
|
||||
* Copyright (c) 2000-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 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991
|
||||
* All Rights Reserved
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright notice appears in all copies and
|
||||
* that both the copyright notice and this permission notice appear in
|
||||
* supporting documentation.
|
||||
*
|
||||
* OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
* LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* MkLinux
|
||||
*/
|
||||
|
||||
/*
|
||||
* POSIX Threads - IEEE 1003.1c
|
||||
*/
|
||||
|
||||
#ifndef _PTHREAD_H
|
||||
#define _PTHREAD_H
|
||||
|
||||
#include <_types.h>
|
||||
#include <pthread/sched.h>
|
||||
#include <time.h>
|
||||
#include <sys/_pthread/_pthread_types.h>
|
||||
#include <sys/_pthread/_pthread_attr_t.h>
|
||||
#include <sys/_pthread/_pthread_cond_t.h>
|
||||
#include <sys/_pthread/_pthread_condattr_t.h>
|
||||
#include <sys/_pthread/_pthread_key_t.h>
|
||||
#include <sys/_pthread/_pthread_mutex_t.h>
|
||||
#include <sys/_pthread/_pthread_mutexattr_t.h>
|
||||
#include <sys/_pthread/_pthread_once_t.h>
|
||||
#include <sys/_pthread/_pthread_rwlock_t.h>
|
||||
#include <sys/_pthread/_pthread_rwlockattr_t.h>
|
||||
#include <sys/_pthread/_pthread_t.h>
|
||||
|
||||
#include <pthread/qos.h>
|
||||
|
||||
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(__cplusplus)
|
||||
|
||||
#include <sys/_types/_mach_port_t.h>
|
||||
#include <sys/_types/_sigset_t.h>
|
||||
|
||||
#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE || __cplusplus */
|
||||
|
||||
/*
|
||||
* These symbols indicate which [optional] features are available
|
||||
* They can be tested at compile time via '#ifdef XXX'
|
||||
* The way to check for pthreads is like so:
|
||||
|
||||
* #include <unistd.h>
|
||||
* #ifdef _POSIX_THREADS
|
||||
* #include <pthread.h>
|
||||
* #endif
|
||||
|
||||
*/
|
||||
|
||||
/* These will be moved to unistd.h */
|
||||
|
||||
/*
|
||||
* Note: These data structures are meant to be opaque. Only enough
|
||||
* structure is exposed to support initializers.
|
||||
* All of the typedefs will be moved to <sys/types.h>
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#if __has_feature(assume_nonnull)
|
||||
_Pragma("clang assume_nonnull begin")
|
||||
#endif
|
||||
__BEGIN_DECLS
|
||||
/*
|
||||
* Threads
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Cancel cleanup handler management. Note, since these are implemented as macros,
|
||||
* they *MUST* occur in matched pairs!
|
||||
*/
|
||||
|
||||
#define pthread_cleanup_push(func, val) \
|
||||
{ \
|
||||
struct __darwin_pthread_handler_rec __handler; \
|
||||
pthread_t __self = pthread_self(); \
|
||||
__handler.__routine = func; \
|
||||
__handler.__arg = val; \
|
||||
__handler.__next = __self->__cleanup_stack; \
|
||||
__self->__cleanup_stack = &__handler;
|
||||
|
||||
#define pthread_cleanup_pop(execute) \
|
||||
/* Note: 'handler' must be in this same lexical context! */ \
|
||||
__self->__cleanup_stack = __handler.__next; \
|
||||
if (execute) (__handler.__routine)(__handler.__arg); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Thread attributes
|
||||
*/
|
||||
|
||||
#define PTHREAD_CREATE_JOINABLE 1
|
||||
#define PTHREAD_CREATE_DETACHED 2
|
||||
|
||||
#define PTHREAD_INHERIT_SCHED 1
|
||||
#define PTHREAD_EXPLICIT_SCHED 2
|
||||
|
||||
#define PTHREAD_CANCEL_ENABLE 0x01 /* Cancel takes place at next cancellation point */
|
||||
#define PTHREAD_CANCEL_DISABLE 0x00 /* Cancel postponed */
|
||||
#define PTHREAD_CANCEL_DEFERRED 0x02 /* Cancel waits until cancellation point */
|
||||
#define PTHREAD_CANCEL_ASYNCHRONOUS 0x00 /* Cancel occurs immediately */
|
||||
|
||||
/* Value returned from pthread_join() when a thread is canceled */
|
||||
#define PTHREAD_CANCELED ((void *) 1)
|
||||
|
||||
/* We only support PTHREAD_SCOPE_SYSTEM */
|
||||
#define PTHREAD_SCOPE_SYSTEM 1
|
||||
#define PTHREAD_SCOPE_PROCESS 2
|
||||
|
||||
#define PTHREAD_PROCESS_SHARED 1
|
||||
#define PTHREAD_PROCESS_PRIVATE 2
|
||||
|
||||
/*
|
||||
* Mutex protocol attributes
|
||||
*/
|
||||
#define PTHREAD_PRIO_NONE 0
|
||||
#define PTHREAD_PRIO_INHERIT 1
|
||||
#define PTHREAD_PRIO_PROTECT 2
|
||||
|
||||
/*
|
||||
* Mutex type attributes
|
||||
*/
|
||||
#define PTHREAD_MUTEX_NORMAL 0
|
||||
#define PTHREAD_MUTEX_ERRORCHECK 1
|
||||
#define PTHREAD_MUTEX_RECURSIVE 2
|
||||
#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
|
||||
|
||||
/*
|
||||
* Mutex policy attributes
|
||||
*/
|
||||
#define PTHREAD_MUTEX_POLICY_FAIRSHARE_NP 1
|
||||
#define PTHREAD_MUTEX_POLICY_FIRSTFIT_NP 3
|
||||
|
||||
/*
|
||||
* RWLock variables
|
||||
*/
|
||||
#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWLOCK_SIG_init, {0}}
|
||||
|
||||
/*
|
||||
* Mutex variables
|
||||
*/
|
||||
#define PTHREAD_MUTEX_INITIALIZER {_PTHREAD_MUTEX_SIG_init, {0}}
|
||||
|
||||
/* <rdar://problem/10854763> */
|
||||
#if ((__MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) || (__IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000)) || defined(__DRIVERKIT_VERSION_MIN_REQUIRED)
|
||||
# if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
|
||||
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER {_PTHREAD_ERRORCHECK_MUTEX_SIG_init, {0}}
|
||||
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER {_PTHREAD_RECURSIVE_MUTEX_SIG_init, {0}}
|
||||
# endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
|
||||
#endif
|
||||
|
||||
/* <rdar://problem/25944576> */
|
||||
#define _PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT \
|
||||
defined(SWIFT_CLASS_EXTRA) && (!defined(SWIFT_SDK_OVERLAY_PTHREAD_EPOCH) || (SWIFT_SDK_OVERLAY_PTHREAD_EPOCH < 1))
|
||||
|
||||
/*
|
||||
* Condition variable attributes
|
||||
*/
|
||||
|
||||
/*
|
||||
* Condition variables
|
||||
*/
|
||||
|
||||
#define PTHREAD_COND_INITIALIZER {_PTHREAD_COND_SIG_init, {0}}
|
||||
|
||||
/*
|
||||
* Initialization control (once) variables
|
||||
*/
|
||||
|
||||
#define PTHREAD_ONCE_INIT {_PTHREAD_ONCE_SIG_init, {0}}
|
||||
|
||||
/*
|
||||
* Prototypes for all PTHREAD interfaces
|
||||
*/
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_atfork(void (* _Nullable)(void), void (* _Nullable)(void),
|
||||
void (* _Nullable)(void));
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_destroy(pthread_attr_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_getguardsize(const pthread_attr_t * __restrict, size_t * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_getinheritsched(const pthread_attr_t * __restrict, int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_getschedparam(const pthread_attr_t * __restrict,
|
||||
struct sched_param * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_getschedpolicy(const pthread_attr_t * __restrict, int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_getscope(const pthread_attr_t * __restrict, int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_getstack(const pthread_attr_t * __restrict,
|
||||
void * _Nullable * _Nonnull __restrict, size_t * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_getstackaddr(const pthread_attr_t * __restrict,
|
||||
void * _Nullable * _Nonnull __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_getstacksize(const pthread_attr_t * __restrict, size_t * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_init(pthread_attr_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_setdetachstate(pthread_attr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_setguardsize(pthread_attr_t *, size_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_setinheritsched(pthread_attr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_setschedparam(pthread_attr_t * __restrict,
|
||||
const struct sched_param * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_setschedpolicy(pthread_attr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_setscope(pthread_attr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_setstackaddr(pthread_attr_t *, void *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_attr_setstacksize(pthread_attr_t *, size_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_cancel(pthread_t) __DARWIN_ALIAS(pthread_cancel);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_cond_broadcast(pthread_cond_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_cond_destroy(pthread_cond_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_cond_init(
|
||||
pthread_cond_t * __restrict,
|
||||
const pthread_condattr_t * _Nullable __restrict)
|
||||
__DARWIN_ALIAS(pthread_cond_init);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_cond_signal(pthread_cond_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_cond_timedwait(
|
||||
pthread_cond_t * __restrict, pthread_mutex_t * __restrict,
|
||||
const struct timespec * _Nullable __restrict)
|
||||
__DARWIN_ALIAS_C(pthread_cond_timedwait);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_cond_wait(pthread_cond_t * __restrict,
|
||||
pthread_mutex_t * __restrict) __DARWIN_ALIAS_C(pthread_cond_wait);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_condattr_destroy(pthread_condattr_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_condattr_init(pthread_condattr_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_condattr_getpshared(const pthread_condattr_t * __restrict,
|
||||
int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_condattr_setpshared(pthread_condattr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
#if !_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
|
||||
int pthread_create(pthread_t _Nullable * _Nonnull __restrict,
|
||||
const pthread_attr_t * _Nullable __restrict,
|
||||
void * _Nullable (* _Nonnull)(void * _Nullable),
|
||||
void * _Nullable __restrict);
|
||||
#else
|
||||
int pthread_create(pthread_t * __restrict,
|
||||
const pthread_attr_t * _Nullable __restrict,
|
||||
void *(* _Nonnull)(void *), void * _Nullable __restrict);
|
||||
#endif // _PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_detach(pthread_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_equal(pthread_t _Nullable, pthread_t _Nullable);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
void pthread_exit(void * _Nullable) __dead2;
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_getconcurrency(void);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_getschedparam(pthread_t , int * _Nullable __restrict,
|
||||
struct sched_param * _Nullable __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
void* _Nullable pthread_getspecific(pthread_key_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_join(pthread_t , void * _Nullable * _Nullable)
|
||||
__DARWIN_ALIAS_C(pthread_join);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_key_create(pthread_key_t *, void (* _Nullable)(void *));
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_key_delete(pthread_key_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutex_destroy(pthread_mutex_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutex_getprioceiling(const pthread_mutex_t * __restrict,
|
||||
int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutex_init(pthread_mutex_t * __restrict,
|
||||
const pthread_mutexattr_t * _Nullable __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutex_lock(pthread_mutex_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutex_setprioceiling(pthread_mutex_t * __restrict, int,
|
||||
int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutex_trylock(pthread_mutex_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutex_unlock(pthread_mutex_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t *) __DARWIN_ALIAS(pthread_mutexattr_destroy);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t * __restrict,
|
||||
int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t * __restrict,
|
||||
int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_getpshared(const pthread_mutexattr_t * __restrict,
|
||||
int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_gettype(const pthread_mutexattr_t * __restrict,
|
||||
int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.13.4), ios(11.3), watchos(4.3), tvos(11.3))
|
||||
int pthread_mutexattr_getpolicy_np(const pthread_mutexattr_t * __restrict,
|
||||
int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_init(pthread_mutexattr_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
int pthread_mutexattr_setpolicy_np(pthread_mutexattr_t *, int);
|
||||
|
||||
__SWIFT_UNAVAILABLE_MSG("Use lazily initialized globals instead")
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_once(pthread_once_t *, void (* _Nonnull)(void));
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlock_destroy(pthread_rwlock_t * ) __DARWIN_ALIAS(pthread_rwlock_destroy);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlock_init(pthread_rwlock_t * __restrict,
|
||||
const pthread_rwlockattr_t * _Nullable __restrict)
|
||||
__DARWIN_ALIAS(pthread_rwlock_init);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlock_rdlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_rdlock);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlock_tryrdlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_tryrdlock);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlock_trywrlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_trywrlock);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlock_wrlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_wrlock);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlock_unlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_unlock);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * __restrict,
|
||||
int * __restrict);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlockattr_init(pthread_rwlockattr_t *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
pthread_t pthread_self(void);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_setcancelstate(int , int * _Nullable)
|
||||
__DARWIN_ALIAS(pthread_setcancelstate);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_setcanceltype(int , int * _Nullable)
|
||||
__DARWIN_ALIAS(pthread_setcanceltype);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_setconcurrency(int);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_setschedparam(pthread_t, int, const struct sched_param *);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_setspecific(pthread_key_t , const void * _Nullable);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
void pthread_testcancel(void) __DARWIN_ALIAS(pthread_testcancel);
|
||||
|
||||
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(__cplusplus)
|
||||
|
||||
/* returns non-zero if pthread_create or cthread_fork have been called */
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_is_threaded_np(void);
|
||||
|
||||
__API_AVAILABLE(macos(10.6), ios(3.2))
|
||||
int pthread_threadid_np(pthread_t _Nullable,__uint64_t* _Nullable);
|
||||
|
||||
/*SPI to set and get pthread name*/
|
||||
__API_AVAILABLE(macos(10.6), ios(3.2))
|
||||
int pthread_getname_np(pthread_t,char*,size_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.6), ios(3.2))
|
||||
int pthread_setname_np(const char*);
|
||||
|
||||
/* returns non-zero if the current thread is the main thread */
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_main_np(void);
|
||||
|
||||
/* return the mach thread bound to the pthread */
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
mach_port_t pthread_mach_thread_np(pthread_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
size_t pthread_get_stacksize_np(pthread_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
void* pthread_get_stackaddr_np(pthread_t);
|
||||
|
||||
/* Like pthread_cond_signal(), but only wake up the specified pthread */
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_cond_signal_thread_np(pthread_cond_t *, pthread_t _Nullable);
|
||||
|
||||
/* Like pthread_cond_timedwait, but use a relative timeout */
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_cond_timedwait_relative_np(pthread_cond_t *, pthread_mutex_t *,
|
||||
const struct timespec * _Nullable);
|
||||
|
||||
/* Like pthread_create(), but leaves the thread suspended */
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
#if !_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
|
||||
int pthread_create_suspended_np(
|
||||
pthread_t _Nullable * _Nonnull, const pthread_attr_t * _Nullable,
|
||||
void * _Nullable (* _Nonnull)(void * _Nullable), void * _Nullable);
|
||||
#else
|
||||
int pthread_create_suspended_np(pthread_t *, const pthread_attr_t * _Nullable,
|
||||
void *(* _Nonnull)(void *), void * _Nullable);
|
||||
#endif
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_kill(pthread_t, int);
|
||||
|
||||
__API_AVAILABLE(macos(10.5), ios(2.0))
|
||||
_Nullable pthread_t pthread_from_mach_thread_np(mach_port_t);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
int pthread_sigmask(int, const sigset_t * _Nullable, sigset_t * _Nullable)
|
||||
__DARWIN_ALIAS(pthread_sigmask);
|
||||
|
||||
__API_AVAILABLE(macos(10.4), ios(2.0))
|
||||
void pthread_yield_np(void);
|
||||
|
||||
__API_AVAILABLE(macos(11.0))
|
||||
__API_UNAVAILABLE(ios, tvos, watchos)
|
||||
void pthread_jit_write_protect_np(int enabled);
|
||||
|
||||
__API_AVAILABLE(macos(11.0))
|
||||
__API_UNAVAILABLE(ios, tvos, watchos)
|
||||
int pthread_jit_write_protect_supported_np(void);
|
||||
|
||||
/*!
|
||||
* @function pthread_cpu_number_np
|
||||
*
|
||||
* @param cpu_number_out
|
||||
* The CPU number that the thread was running on at the time of query.
|
||||
* This cpu number is in the interval [0, ncpus) (from sysctlbyname("hw.ncpu"))
|
||||
*
|
||||
* @result
|
||||
* This function returns 0 or the value of errno if an error occurred.
|
||||
*
|
||||
* @note
|
||||
* Optimizations of per-CPU datastructures based on the result of this function
|
||||
* still require synchronization since it is not guaranteed that the thread will
|
||||
* still be on the same CPU by the time the function returns.
|
||||
*/
|
||||
__API_AVAILABLE(macos(11.0), ios(14.2), tvos(14.2), watchos(7.1))
|
||||
int
|
||||
pthread_cpu_number_np(size_t *cpu_number_out);
|
||||
|
||||
#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE || __cplusplus */
|
||||
__END_DECLS
|
||||
#if __has_feature(assume_nonnull)
|
||||
_Pragma("clang assume_nonnull end")
|
||||
#endif
|
||||
|
||||
#endif /* _PTHREAD_H */
|
||||
45
lib/libc/include/aarch64-macos-gnu/pthread/sched.h
Normal file
45
lib/libc/include/aarch64-macos-gnu/pthread/sched.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2003 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 _SCHED_H_
|
||||
#define _SCHED_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <pthread/pthread_impl.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
/*
|
||||
* Scheduling paramters
|
||||
*/
|
||||
#ifndef __POSIX_LIB__
|
||||
struct sched_param { int sched_priority; char __opaque[__SCHED_PARAM_SIZE__]; };
|
||||
#else
|
||||
struct sched_param;
|
||||
#endif
|
||||
|
||||
extern int sched_yield(void);
|
||||
extern int sched_get_priority_min(int);
|
||||
extern int sched_get_priority_max(int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SCHED_H_ */
|
||||
45
lib/libc/include/aarch64-macos-gnu/sched.h
Normal file
45
lib/libc/include/aarch64-macos-gnu/sched.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2003 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 _SCHED_H_
|
||||
#define _SCHED_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <pthread/pthread_impl.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
/*
|
||||
* Scheduling paramters
|
||||
*/
|
||||
#ifndef __POSIX_LIB__
|
||||
struct sched_param { int sched_priority; char __opaque[__SCHED_PARAM_SIZE__]; };
|
||||
#else
|
||||
struct sched_param;
|
||||
#endif
|
||||
|
||||
extern int sched_yield(void);
|
||||
extern int sched_get_priority_min(int);
|
||||
extern int sched_get_priority_max(int);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SCHED_H_ */
|
||||
124
lib/libc/include/aarch64-macos-gnu/signal.h
Normal file
124
lib/libc/include/aarch64-macos-gnu/signal.h
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (c) 2000 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@
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1991, 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.
|
||||
*
|
||||
* @(#)signal.h 8.3 (Berkeley) 3/30/94
|
||||
*/
|
||||
|
||||
#ifndef _USER_SIGNAL_H
|
||||
#define _USER_SIGNAL_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <_types.h>
|
||||
#include <sys/signal.h>
|
||||
|
||||
#include <sys/_pthread/_pthread_types.h>
|
||||
#include <sys/_pthread/_pthread_t.h>
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
extern __const char *__const sys_signame[NSIG];
|
||||
extern __const char *__const sys_siglist[NSIG];
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
int raise(int);
|
||||
__END_DECLS
|
||||
|
||||
#ifndef _ANSI_SOURCE
|
||||
__BEGIN_DECLS
|
||||
void (* _Nullable bsd_signal(int, void (* _Nullable)(int)))(int);
|
||||
int kill(pid_t, int) __DARWIN_ALIAS(kill);
|
||||
int killpg(pid_t, int) __DARWIN_ALIAS(killpg);
|
||||
int pthread_kill(pthread_t, int);
|
||||
int pthread_sigmask(int, const sigset_t *, sigset_t *) __DARWIN_ALIAS(pthread_sigmask);
|
||||
int sigaction(int, const struct sigaction * __restrict,
|
||||
struct sigaction * __restrict);
|
||||
int sigaddset(sigset_t *, int);
|
||||
int sigaltstack(const stack_t * __restrict, stack_t * __restrict) __DARWIN_ALIAS(sigaltstack) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
|
||||
int sigdelset(sigset_t *, int);
|
||||
int sigemptyset(sigset_t *);
|
||||
int sigfillset(sigset_t *);
|
||||
int sighold(int);
|
||||
int sigignore(int);
|
||||
int siginterrupt(int, int);
|
||||
int sigismember(const sigset_t *, int);
|
||||
int sigpause(int) __DARWIN_ALIAS_C(sigpause);
|
||||
int sigpending(sigset_t *);
|
||||
int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict);
|
||||
int sigrelse(int);
|
||||
void (* _Nullable sigset(int, void (* _Nullable)(int)))(int);
|
||||
int sigsuspend(const sigset_t *) __DARWIN_ALIAS_C(sigsuspend);
|
||||
int sigwait(const sigset_t * __restrict, int * __restrict) __DARWIN_ALIAS_C(sigwait);
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
void psignal(unsigned int, const char *);
|
||||
int sigblock(int);
|
||||
int sigsetmask(int);
|
||||
int sigvec(int, struct sigvec *, struct sigvec *);
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
__END_DECLS
|
||||
|
||||
/* List definitions after function declarations, or Reiser cpp gets upset. */
|
||||
__header_always_inline int
|
||||
__sigbits(int __signo)
|
||||
{
|
||||
return __signo > __DARWIN_NSIG ? 0 : (1 << (__signo - 1));
|
||||
}
|
||||
|
||||
#define sigaddset(set, signo) (*(set) |= __sigbits(signo), 0)
|
||||
#define sigdelset(set, signo) (*(set) &= ~__sigbits(signo), 0)
|
||||
#define sigismember(set, signo) ((*(set) & __sigbits(signo)) != 0)
|
||||
#define sigemptyset(set) (*(set) = 0, 0)
|
||||
#define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
|
||||
#endif /* !_USER_SIGNAL_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user