Merge pull request #7035 from ziglang/macos-posix-headers
macOS libc headers: add POSIX headers
This commit is contained in:
1441
lib/libc/include/x86_64-macos-gnu/AssertMacros.h
Normal file
1441
lib/libc/include/x86_64-macos-gnu/AssertMacros.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -132,130 +132,7 @@
|
||||
#define __API_TO_BE_DEPRECATED 100000
|
||||
#endif
|
||||
|
||||
#ifndef __MAC_10_0
|
||||
#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_15 101500
|
||||
#define __MAC_10_15_1 101501
|
||||
#define __MAC_10_15_4 101504
|
||||
/* __MAC_NA is not defined to a value but is uses 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_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
|
||||
/* __IPHONE_NA is not defined to a value but is uses 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_13_0 130000
|
||||
#define __TVOS_13_2 130200
|
||||
#define __TVOS_13_3 130300
|
||||
#define __TVOS_13_4 130400
|
||||
|
||||
#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_6_0 60000
|
||||
#define __WATCHOS_6_1 60100
|
||||
#define __WATCHOS_6_2 60200
|
||||
|
||||
#define __DRIVERKIT_19_0 190000
|
||||
#endif /* __MAC_10_0 */
|
||||
|
||||
#include <AvailabilityVersions.h>
|
||||
#include <AvailabilityInternal.h>
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
#ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
|
||||
/* compiler sets __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ when -miphoneos-version-min is used */
|
||||
#define __IPHONE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
|
||||
/* set to 1 when RC_FALLBACK_PLATFORM=iphoneos */
|
||||
#elif 0
|
||||
#define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_14_0
|
||||
#endif
|
||||
#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED */
|
||||
|
||||
@@ -52,7 +55,7 @@
|
||||
#ifdef __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__
|
||||
/* compiler sets __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ when -mtvos-version-min is used */
|
||||
#define __TV_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__
|
||||
#define __TV_OS_VERSION_MAX_ALLOWED __TVOS_13_0
|
||||
#define __TV_OS_VERSION_MAX_ALLOWED __TVOS_14_2
|
||||
/* for compatibility with existing code. New code should use platform specific checks */
|
||||
#define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
|
||||
#endif
|
||||
@@ -62,7 +65,7 @@
|
||||
#ifdef __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__
|
||||
/* compiler sets __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ when -mwatchos-version-min is used */
|
||||
#define __WATCH_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__
|
||||
#define __WATCH_OS_VERSION_MAX_ALLOWED 60000
|
||||
#define __WATCH_OS_VERSION_MAX_ALLOWED __WATCHOS_7_1
|
||||
/* for compatibility with existing code. New code should use platform specific checks */
|
||||
#define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
|
||||
#endif
|
||||
@@ -72,7 +75,7 @@
|
||||
#ifdef __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__
|
||||
|
||||
#define __BRIDGE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__
|
||||
#define __BRIDGE_OS_VERSION_MAX_ALLOWED 20000
|
||||
#define __BRIDGE_OS_VERSION_MAX_ALLOWED 50000
|
||||
/* for compatibility with existing code. New code should use platform specific checks */
|
||||
#define __IPHONE_OS_VERSION_MIN_REQUIRED 110000
|
||||
#endif
|
||||
@@ -87,14 +90,14 @@
|
||||
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
/* make sure a default max version is set */
|
||||
#ifndef __MAC_OS_X_VERSION_MAX_ALLOWED
|
||||
#define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_15
|
||||
#define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_11_0
|
||||
#endif
|
||||
#endif /* __MAC_OS_X_VERSION_MIN_REQUIRED */
|
||||
|
||||
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
|
||||
/* make sure a default max version is set */
|
||||
#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED
|
||||
#define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_13_0
|
||||
#define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_14_2
|
||||
#endif
|
||||
/* make sure a valid min is set */
|
||||
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0
|
||||
@@ -2887,7 +2890,7 @@
|
||||
#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))
|
||||
#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 __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION __attribute__((availability(ios,introduced=4.0)))
|
||||
#define __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION_DEP__IPHONE_COMPAT_VERSION __attribute__((availability(ios,unavailable)))
|
||||
#define __AVAILABILITY_INTERNAL__IPHONE_COMPAT_VERSION_DEP__IPHONE_COMPAT_VERSION_MSG(_msg) __attribute__((availability(ios,unavailable)))
|
||||
|
||||
4015
lib/libc/include/x86_64-macos-gnu/AvailabilityMacros.h
Normal file
4015
lib/libc/include/x86_64-macos-gnu/AvailabilityMacros.h
Normal file
File diff suppressed because it is too large
Load Diff
208
lib/libc/include/x86_64-macos-gnu/AvailabilityVersions.h
Normal file
208
lib/libc/include/x86_64-macos-gnu/AvailabilityVersions.h
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* 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__ */
|
||||
|
||||
64
lib/libc/include/x86_64-macos-gnu/Block.h
Normal file
64
lib/libc/include/x86_64-macos-gnu/Block.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Block.h
|
||||
*
|
||||
* Copyright (c) 2008-2010 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LLVM_LICENSE_HEADER@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _Block_H_
|
||||
#define _Block_H_
|
||||
|
||||
#if !defined(BLOCK_EXPORT)
|
||||
# if defined(__cplusplus)
|
||||
# define BLOCK_EXPORT extern "C"
|
||||
# else
|
||||
# define BLOCK_EXPORT extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <Availability.h>
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Create a heap based copy of a Block or simply add a reference to an existing one.
|
||||
// This must be paired with Block_release to recover memory, even when running
|
||||
// under Objective-C Garbage Collection.
|
||||
BLOCK_EXPORT void *_Block_copy(const void *aBlock)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
|
||||
|
||||
// Lose the reference, and if heap based and last reference, recover the memory
|
||||
BLOCK_EXPORT void _Block_release(const void *aBlock)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
|
||||
|
||||
|
||||
// Used by the compiler. Do not call this function yourself.
|
||||
BLOCK_EXPORT void _Block_object_assign(void *, const void *, const int)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
|
||||
|
||||
// Used by the compiler. Do not call this function yourself.
|
||||
BLOCK_EXPORT void _Block_object_dispose(const void *, const int)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
|
||||
|
||||
// Used by the compiler. Do not use these variables yourself.
|
||||
BLOCK_EXPORT void * _NSConcreteGlobalBlock[32]
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
|
||||
BLOCK_EXPORT void * _NSConcreteStackBlock[32]
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
|
||||
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Type correct macros
|
||||
|
||||
#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))
|
||||
#define Block_release(...) _Block_release((const void *)(__VA_ARGS__))
|
||||
|
||||
|
||||
#endif
|
||||
619
lib/libc/include/x86_64-macos-gnu/ConditionalMacros.h
Normal file
619
lib/libc/include/x86_64-macos-gnu/ConditionalMacros.h
Normal file
@@ -0,0 +1,619 @@
|
||||
/*
|
||||
* Copyright (c) 1993-2011 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: ConditionalMacros.h
|
||||
|
||||
Contains: Set up for compiler independent conditionals
|
||||
|
||||
Version: CarbonCore-769~1
|
||||
|
||||
Bugs?: For bug reports, consult the following page on
|
||||
the World Wide Web:
|
||||
|
||||
http://developer.apple.com/bugreporter/
|
||||
|
||||
*/
|
||||
#ifndef __CONDITIONALMACROS__
|
||||
#define __CONDITIONALMACROS__
|
||||
|
||||
#include <Availability.h>
|
||||
/****************************************************************************************************
|
||||
UNIVERSAL_INTERFACES_VERSION
|
||||
|
||||
0x0400 --> version 4.0 (Mac OS X only)
|
||||
0x0335 --> version 3.4
|
||||
0x0331 --> version 3.3.1
|
||||
0x0330 --> version 3.3
|
||||
0x0320 --> version 3.2
|
||||
0x0310 --> version 3.1
|
||||
0x0301 --> version 3.0.1
|
||||
0x0300 --> version 3.0
|
||||
0x0210 --> version 2.1
|
||||
This conditional did not exist prior to version 2.1
|
||||
****************************************************************************************************/
|
||||
#define UNIVERSAL_INTERFACES_VERSION 0x0400
|
||||
/****************************************************************************************************
|
||||
|
||||
All TARGET_* condtionals are set up by TargetConditionals.h
|
||||
|
||||
****************************************************************************************************/
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************************************
|
||||
|
||||
PRAGMA_*
|
||||
These conditionals specify whether the compiler supports particular #pragma's
|
||||
|
||||
PRAGMA_IMPORT - Compiler supports: #pragma import on/off/reset
|
||||
PRAGMA_ONCE - Compiler supports: #pragma once
|
||||
PRAGMA_STRUCT_ALIGN - Compiler supports: #pragma options align=mac68k/power/reset
|
||||
PRAGMA_STRUCT_PACK - Compiler supports: #pragma pack(n)
|
||||
PRAGMA_STRUCT_PACKPUSH - Compiler supports: #pragma pack(push, n)/pack(pop)
|
||||
PRAGMA_ENUM_PACK - Compiler supports: #pragma options(!pack_enums)
|
||||
PRAGMA_ENUM_ALWAYSINT - Compiler supports: #pragma enumsalwaysint on/off/reset
|
||||
PRAGMA_ENUM_OPTIONS - Compiler supports: #pragma options enum=int/small/reset
|
||||
|
||||
|
||||
FOUR_CHAR_CODE
|
||||
This conditional is deprecated. It was used to work around a bug in one obscure compiler that did not pack multiple characters in single quotes rationally.
|
||||
It was never intended for endian swapping.
|
||||
|
||||
FOUR_CHAR_CODE('abcd') - Convert a four-char-code to the correct 32-bit value
|
||||
|
||||
|
||||
TYPE_*
|
||||
These conditionals specify whether the compiler supports particular types.
|
||||
|
||||
TYPE_LONGLONG - Compiler supports "long long" 64-bit integers
|
||||
TYPE_EXTENDED - Compiler supports "extended" 80/96 bit floating point
|
||||
TYPE_LONGDOUBLE_IS_DOUBLE - Compiler implements "long double" same as "double"
|
||||
|
||||
|
||||
FUNCTION_*
|
||||
These conditionals specify whether the compiler supports particular language extensions
|
||||
to function prototypes and definitions.
|
||||
|
||||
FUNCTION_PASCAL - Compiler supports "pascal void Foo()"
|
||||
FUNCTION_DECLSPEC - Compiler supports "__declspec(xxx) void Foo()"
|
||||
FUNCTION_WIN32CC - Compiler supports "void __cdecl Foo()" and "void __stdcall Foo()"
|
||||
|
||||
****************************************************************************************************/
|
||||
|
||||
#if defined(__GNUC__) && (defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__NEXT_CPP__) || defined(__MACOS_CLASSIC__))
|
||||
/*
|
||||
gcc based compilers used on Mac OS X
|
||||
*/
|
||||
#define PRAGMA_IMPORT 0
|
||||
#define PRAGMA_ONCE 0
|
||||
|
||||
#if __GNUC__ >= 4
|
||||
#define PRAGMA_STRUCT_PACK 1
|
||||
#define PRAGMA_STRUCT_PACKPUSH 1
|
||||
#else
|
||||
#define PRAGMA_STRUCT_PACK 0
|
||||
#define PRAGMA_STRUCT_PACKPUSH 0
|
||||
#endif
|
||||
|
||||
#if __LP64__ || __arm64__ || __ARM_ARCH_7K
|
||||
#define PRAGMA_STRUCT_ALIGN 0
|
||||
#else
|
||||
#define PRAGMA_STRUCT_ALIGN 1
|
||||
#endif
|
||||
|
||||
#define PRAGMA_ENUM_PACK 0
|
||||
#define PRAGMA_ENUM_ALWAYSINT 0
|
||||
#define PRAGMA_ENUM_OPTIONS 0
|
||||
#define FOUR_CHAR_CODE(x) (x)
|
||||
|
||||
#define TYPE_EXTENDED 0
|
||||
|
||||
#ifdef __ppc__
|
||||
#ifdef __LONG_DOUBLE_128__
|
||||
#define TYPE_LONGDOUBLE_IS_DOUBLE 0
|
||||
#else
|
||||
#define TYPE_LONGDOUBLE_IS_DOUBLE 1
|
||||
#endif
|
||||
#else
|
||||
#define TYPE_LONGDOUBLE_IS_DOUBLE 0
|
||||
#endif
|
||||
|
||||
#define TYPE_LONGLONG 1
|
||||
|
||||
#define FUNCTION_PASCAL 0
|
||||
#define FUNCTION_DECLSPEC 0
|
||||
#define FUNCTION_WIN32CC 0
|
||||
|
||||
#ifdef __MACOS_CLASSIC__
|
||||
#ifndef TARGET_API_MAC_CARBON /* gcc cfm cross compiler assumes you're building Carbon code */
|
||||
#define TARGET_API_MAC_CARBON 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#elif defined(__MWERKS__)
|
||||
/*
|
||||
CodeWarrior compiler from Metrowerks/Motorola
|
||||
*/
|
||||
#define PRAGMA_ONCE 1
|
||||
#define PRAGMA_IMPORT 0
|
||||
#define PRAGMA_STRUCT_ALIGN 1
|
||||
#define PRAGMA_STRUCT_PACK 1
|
||||
#define PRAGMA_STRUCT_PACKPUSH 0
|
||||
#define PRAGMA_ENUM_PACK 0
|
||||
#define PRAGMA_ENUM_ALWAYSINT 1
|
||||
#define PRAGMA_ENUM_OPTIONS 0
|
||||
#if __option(enumsalwaysint) && __option(ANSI_strict)
|
||||
#define FOUR_CHAR_CODE(x) ((long)(x)) /* otherwise compiler will complain about values with high bit set */
|
||||
#else
|
||||
#define FOUR_CHAR_CODE(x) (x)
|
||||
#endif
|
||||
#define FUNCTION_PASCAL 1
|
||||
#define FUNCTION_DECLSPEC 1
|
||||
#define FUNCTION_WIN32CC 0
|
||||
|
||||
#if __option(longlong)
|
||||
#define TYPE_LONGLONG 1
|
||||
#else
|
||||
#define TYPE_LONGLONG 0
|
||||
#endif
|
||||
#define TYPE_EXTENDED 0
|
||||
#define TYPE_LONGDOUBLE_IS_DOUBLE 1
|
||||
|
||||
|
||||
|
||||
#else
|
||||
/*
|
||||
Unknown compiler, perhaps set up from the command line
|
||||
*/
|
||||
#error unknown compiler
|
||||
#ifndef PRAGMA_IMPORT
|
||||
#define PRAGMA_IMPORT 0
|
||||
#endif
|
||||
#ifndef PRAGMA_STRUCT_ALIGN
|
||||
#define PRAGMA_STRUCT_ALIGN 0
|
||||
#endif
|
||||
#ifndef PRAGMA_ONCE
|
||||
#define PRAGMA_ONCE 0
|
||||
#endif
|
||||
#ifndef PRAGMA_STRUCT_PACK
|
||||
#define PRAGMA_STRUCT_PACK 0
|
||||
#endif
|
||||
#ifndef PRAGMA_STRUCT_PACKPUSH
|
||||
#define PRAGMA_STRUCT_PACKPUSH 0
|
||||
#endif
|
||||
#ifndef PRAGMA_ENUM_PACK
|
||||
#define PRAGMA_ENUM_PACK 0
|
||||
#endif
|
||||
#ifndef PRAGMA_ENUM_ALWAYSINT
|
||||
#define PRAGMA_ENUM_ALWAYSINT 0
|
||||
#endif
|
||||
#ifndef PRAGMA_ENUM_OPTIONS
|
||||
#define PRAGMA_ENUM_OPTIONS 0
|
||||
#endif
|
||||
#ifndef FOUR_CHAR_CODE
|
||||
#define FOUR_CHAR_CODE(x) (x)
|
||||
#endif
|
||||
|
||||
#ifndef TYPE_LONGDOUBLE_IS_DOUBLE
|
||||
#define TYPE_LONGDOUBLE_IS_DOUBLE 1
|
||||
#endif
|
||||
#ifndef TYPE_EXTENDED
|
||||
#define TYPE_EXTENDED 0
|
||||
#endif
|
||||
#ifndef TYPE_LONGLONG
|
||||
#define TYPE_LONGLONG 0
|
||||
#endif
|
||||
#ifndef FUNCTION_PASCAL
|
||||
#define FUNCTION_PASCAL 0
|
||||
#endif
|
||||
#ifndef FUNCTION_DECLSPEC
|
||||
#define FUNCTION_DECLSPEC 0
|
||||
#endif
|
||||
#ifndef FUNCTION_WIN32CC
|
||||
#define FUNCTION_WIN32CC 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************************************
|
||||
|
||||
Under MacOS, the classic 68k runtime has two calling conventions: pascal or C
|
||||
Under Win32, there are two calling conventions: __cdecl or __stdcall
|
||||
Headers and implementation files can use the following macros to make their
|
||||
source more portable by hiding the calling convention details:
|
||||
|
||||
EXTERN_API*
|
||||
These macros are used to specify the calling convention on a function prototype.
|
||||
|
||||
EXTERN_API - Classic 68k: pascal, Win32: __cdecl
|
||||
EXTERN_API_C - Classic 68k: C, Win32: __cdecl
|
||||
EXTERN_API_STDCALL - Classic 68k: pascal, Win32: __stdcall
|
||||
EXTERN_API_C_STDCALL - Classic 68k: C, Win32: __stdcall
|
||||
|
||||
|
||||
DEFINE_API*
|
||||
These macros are used to specify the calling convention on a function definition.
|
||||
|
||||
DEFINE_API - Classic 68k: pascal, Win32: __cdecl
|
||||
DEFINE_API_C - Classic 68k: C, Win32: __cdecl
|
||||
DEFINE_API_STDCALL - Classic 68k: pascal, Win32: __stdcall
|
||||
DEFINE_API_C_STDCALL - Classic 68k: C, Win32: __stdcall
|
||||
|
||||
|
||||
CALLBACK_API*
|
||||
These macros are used to specify the calling convention of a function pointer.
|
||||
|
||||
CALLBACK_API - Classic 68k: pascal, Win32: __stdcall
|
||||
CALLBACK_API_C - Classic 68k: C, Win32: __stdcall
|
||||
CALLBACK_API_STDCALL - Classic 68k: pascal, Win32: __cdecl
|
||||
CALLBACK_API_C_STDCALL - Classic 68k: C, Win32: __cdecl
|
||||
|
||||
****************************************************************************************************/
|
||||
|
||||
#if FUNCTION_PASCAL && !FUNCTION_DECLSPEC && !FUNCTION_WIN32CC
|
||||
/* compiler supports pascal keyword only */
|
||||
#define EXTERN_API(_type) extern pascal _type
|
||||
#define EXTERN_API_C(_type) extern _type
|
||||
#define EXTERN_API_STDCALL(_type) extern pascal _type
|
||||
#define EXTERN_API_C_STDCALL(_type) extern _type
|
||||
|
||||
#define DEFINE_API(_type) pascal _type
|
||||
#define DEFINE_API_C(_type) _type
|
||||
#define DEFINE_API_STDCALL(_type) pascal _type
|
||||
#define DEFINE_API_C_STDCALL(_type) _type
|
||||
|
||||
#define CALLBACK_API(_type, _name) pascal _type (*_name)
|
||||
#define CALLBACK_API_C(_type, _name) _type (*_name)
|
||||
#define CALLBACK_API_STDCALL(_type, _name) pascal _type (*_name)
|
||||
#define CALLBACK_API_C_STDCALL(_type, _name) _type (*_name)
|
||||
|
||||
#elif FUNCTION_PASCAL && FUNCTION_DECLSPEC && !FUNCTION_WIN32CC
|
||||
/* compiler supports pascal and __declspec() */
|
||||
#define EXTERN_API(_type) extern pascal __declspec(dllimport) _type
|
||||
#define EXTERN_API_C(_type) extern __declspec(dllimport) _type
|
||||
#define EXTERN_API_STDCALL(_type) extern pascal __declspec(dllimport) _type
|
||||
#define EXTERN_API_C_STDCALL(_type) extern __declspec(dllimport) _type
|
||||
|
||||
#define DEFINE_API(_type) pascal __declspec(dllexport) _type
|
||||
#define DEFINE_API_C(_type) __declspec(dllexport) _type
|
||||
#define DEFINE_API_STDCALL(_type) pascal __declspec(dllexport) _type
|
||||
#define DEFINE_API_C_STDCALL(_type) __declspec(dllexport) _type
|
||||
|
||||
#define CALLBACK_API(_type, _name) pascal _type (*_name)
|
||||
#define CALLBACK_API_C(_type, _name) _type (*_name)
|
||||
#define CALLBACK_API_STDCALL(_type, _name) pascal _type (*_name)
|
||||
#define CALLBACK_API_C_STDCALL(_type, _name) _type (*_name)
|
||||
|
||||
#elif !FUNCTION_PASCAL && FUNCTION_DECLSPEC && !FUNCTION_WIN32CC
|
||||
/* compiler supports __declspec() */
|
||||
#define EXTERN_API(_type) extern __declspec(dllimport) _type
|
||||
#define EXTERN_API_C(_type) extern __declspec(dllimport) _type
|
||||
#define EXTERN_API_STDCALL(_type) extern __declspec(dllimport) _type
|
||||
#define EXTERN_API_C_STDCALL(_type) extern __declspec(dllimport) _type
|
||||
|
||||
#define DEFINE_API(_type) __declspec(dllexport) _type
|
||||
#define DEFINE_API_C(_type) __declspec(dllexport) _type
|
||||
#define DEFINE_API_STDCALL(_type) __declspec(dllexport) _type
|
||||
#define DEFINE_API_C_STDCALL(_type) __declspec(dllexport) _type
|
||||
|
||||
#define CALLBACK_API(_type, _name) _type ( * _name)
|
||||
#define CALLBACK_API_C(_type, _name) _type ( * _name)
|
||||
#define CALLBACK_API_STDCALL(_type, _name) _type ( * _name)
|
||||
#define CALLBACK_API_C_STDCALL(_type, _name) _type ( * _name)
|
||||
|
||||
#elif !FUNCTION_PASCAL && FUNCTION_DECLSPEC && FUNCTION_WIN32CC
|
||||
/* compiler supports __declspec() and __cdecl */
|
||||
#define EXTERN_API(_type) __declspec(dllimport) _type __cdecl
|
||||
#define EXTERN_API_C(_type) __declspec(dllimport) _type __cdecl
|
||||
#define EXTERN_API_STDCALL(_type) __declspec(dllimport) _type __stdcall
|
||||
#define EXTERN_API_C_STDCALL(_type) __declspec(dllimport) _type __stdcall
|
||||
|
||||
#define DEFINE_API(_type) __declspec(dllexport) _type __cdecl
|
||||
#define DEFINE_API_C(_type) __declspec(dllexport) _type __cdecl
|
||||
#define DEFINE_API_STDCALL(_type) __declspec(dllexport) _type __stdcall
|
||||
#define DEFINE_API_C_STDCALL(_type) __declspec(dllexport) _type __stdcall
|
||||
|
||||
#define CALLBACK_API(_type, _name) _type (__cdecl * _name)
|
||||
#define CALLBACK_API_C(_type, _name) _type (__cdecl * _name)
|
||||
#define CALLBACK_API_STDCALL(_type, _name) _type (__stdcall * _name)
|
||||
#define CALLBACK_API_C_STDCALL(_type, _name) _type (__stdcall * _name)
|
||||
|
||||
#elif !FUNCTION_PASCAL && !FUNCTION_DECLSPEC && FUNCTION_WIN32CC
|
||||
/* compiler supports __cdecl */
|
||||
#define EXTERN_API(_type) _type __cdecl
|
||||
#define EXTERN_API_C(_type) _type __cdecl
|
||||
#define EXTERN_API_STDCALL(_type) _type __stdcall
|
||||
#define EXTERN_API_C_STDCALL(_type) _type __stdcall
|
||||
|
||||
#define DEFINE_API(_type) _type __cdecl
|
||||
#define DEFINE_API_C(_type) _type __cdecl
|
||||
#define DEFINE_API_STDCALL(_type) _type __stdcall
|
||||
#define DEFINE_API_C_STDCALL(_type) _type __stdcall
|
||||
|
||||
#define CALLBACK_API(_type, _name) _type (__cdecl * _name)
|
||||
#define CALLBACK_API_C(_type, _name) _type (__cdecl * _name)
|
||||
#define CALLBACK_API_STDCALL(_type, _name) _type (__stdcall * _name)
|
||||
#define CALLBACK_API_C_STDCALL(_type, _name) _type (__stdcall * _name)
|
||||
|
||||
#else
|
||||
/* compiler supports no extensions */
|
||||
#define EXTERN_API(_type) extern _type
|
||||
#define EXTERN_API_C(_type) extern _type
|
||||
#define EXTERN_API_STDCALL(_type) extern _type
|
||||
#define EXTERN_API_C_STDCALL(_type) extern _type
|
||||
|
||||
#define DEFINE_API(_type) _type
|
||||
#define DEFINE_API_C(_type) _type
|
||||
#define DEFINE_API_STDCALL(_type) _type
|
||||
#define DEFINE_API_C_STDCALL(_type) _type
|
||||
|
||||
#define CALLBACK_API(_type, _name) _type ( * _name)
|
||||
#define CALLBACK_API_C(_type, _name) _type ( * _name)
|
||||
#define CALLBACK_API_STDCALL(_type, _name) _type ( * _name)
|
||||
#define CALLBACK_API_C_STDCALL(_type, _name) _type ( * _name)
|
||||
#undef pascal
|
||||
#define pascal
|
||||
#endif
|
||||
|
||||
/****************************************************************************************************
|
||||
|
||||
Set up TARGET_API_*_* values
|
||||
|
||||
****************************************************************************************************/
|
||||
#if !defined(TARGET_API_MAC_OS8) && !defined(TARGET_API_MAC_OSX) && !defined(TARGET_API_MAC_CARBON)
|
||||
/* No TARGET_API_MAC_* predefined on command line */
|
||||
#if TARGET_RT_MAC_MACHO
|
||||
/* Looks like MachO style compiler */
|
||||
#define TARGET_API_MAC_OS8 0
|
||||
#define TARGET_API_MAC_CARBON 1
|
||||
#define TARGET_API_MAC_OSX 1
|
||||
#elif defined(TARGET_CARBON) && TARGET_CARBON
|
||||
/* grandfather in use of TARGET_CARBON */
|
||||
#define TARGET_API_MAC_OS8 0
|
||||
#define TARGET_API_MAC_CARBON 1
|
||||
#define TARGET_API_MAC_OSX 0
|
||||
#elif TARGET_CPU_PPC && TARGET_RT_MAC_CFM
|
||||
/* Looks like CFM style PPC compiler */
|
||||
#define TARGET_API_MAC_OS8 1
|
||||
#define TARGET_API_MAC_CARBON 0
|
||||
#define TARGET_API_MAC_OSX 0
|
||||
#else
|
||||
/* 68k or some other compiler */
|
||||
#define TARGET_API_MAC_OS8 1
|
||||
#define TARGET_API_MAC_CARBON 0
|
||||
#define TARGET_API_MAC_OSX 0
|
||||
#endif /* */
|
||||
|
||||
#else
|
||||
#ifndef TARGET_API_MAC_OS8
|
||||
#define TARGET_API_MAC_OS8 0
|
||||
#endif /* !defined(TARGET_API_MAC_OS8) */
|
||||
|
||||
#ifndef TARGET_API_MAC_OSX
|
||||
#define TARGET_API_MAC_OSX TARGET_RT_MAC_MACHO
|
||||
#endif /* !defined(TARGET_API_MAC_OSX) */
|
||||
|
||||
#ifndef TARGET_API_MAC_CARBON
|
||||
#define TARGET_API_MAC_CARBON TARGET_API_MAC_OSX
|
||||
#endif /* !defined(TARGET_API_MAC_CARBON) */
|
||||
|
||||
#endif /* !defined(TARGET_API_MAC_OS8) && !defined(TARGET_API_MAC_OSX) && !defined(TARGET_API_MAC_CARBON) */
|
||||
|
||||
#if TARGET_API_MAC_OS8 && TARGET_API_MAC_OSX
|
||||
#error TARGET_API_MAC_OS8 and TARGET_API_MAC_OSX are mutually exclusive
|
||||
#endif /* TARGET_API_MAC_OS8 && TARGET_API_MAC_OSX */
|
||||
|
||||
#if !TARGET_API_MAC_OS8 && !TARGET_API_MAC_CARBON && !TARGET_API_MAC_OSX
|
||||
#error At least one of TARGET_API_MAC_* must be true
|
||||
#endif /* !TARGET_API_MAC_OS8 && !TARGET_API_MAC_CARBON && !TARGET_API_MAC_OSX */
|
||||
|
||||
/* Support source code still using TARGET_CARBON */
|
||||
#ifndef TARGET_CARBON
|
||||
#if TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8
|
||||
#define TARGET_CARBON 1
|
||||
#else
|
||||
#define TARGET_CARBON 0
|
||||
#endif /* TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 */
|
||||
|
||||
#endif /* !defined(TARGET_CARBON) */
|
||||
|
||||
/****************************************************************************************************
|
||||
Backward compatibility for clients expecting 2.x version on ConditionalMacros.h
|
||||
|
||||
GENERATINGPOWERPC - Compiler is generating PowerPC instructions
|
||||
GENERATING68K - Compiler is generating 68k family instructions
|
||||
GENERATING68881 - Compiler is generating mc68881 floating point instructions
|
||||
GENERATINGCFM - Code being generated assumes CFM calling conventions
|
||||
CFMSYSTEMCALLS - No A-traps. Systems calls are made using CFM and UPP's
|
||||
PRAGMA_ALIGN_SUPPORTED - Compiler supports: #pragma options align=mac68k/power/reset
|
||||
PRAGMA_IMPORT_SUPPORTED - Compiler supports: #pragma import on/off/reset
|
||||
CGLUESUPPORTED - Clients can use all lowercase toolbox functions that take C strings instead of pascal strings
|
||||
|
||||
****************************************************************************************************/
|
||||
#if !TARGET_API_MAC_CARBON
|
||||
#define GENERATINGPOWERPC TARGET_CPU_PPC
|
||||
#define GENERATING68K 0
|
||||
#define GENERATING68881 TARGET_RT_MAC_68881
|
||||
#define GENERATINGCFM TARGET_RT_MAC_CFM
|
||||
#define CFMSYSTEMCALLS TARGET_RT_MAC_CFM
|
||||
#ifndef CGLUESUPPORTED
|
||||
#define CGLUESUPPORTED 0
|
||||
#endif /* !defined(CGLUESUPPORTED) */
|
||||
|
||||
#ifndef OLDROUTINELOCATIONS
|
||||
#define OLDROUTINELOCATIONS 0
|
||||
#endif /* !defined(OLDROUTINELOCATIONS) */
|
||||
|
||||
#define PRAGMA_ALIGN_SUPPORTED PRAGMA_STRUCT_ALIGN
|
||||
#define PRAGMA_IMPORT_SUPPORTED PRAGMA_IMPORT
|
||||
#else
|
||||
/* Carbon code should not use old conditionals */
|
||||
#define PRAGMA_ALIGN_SUPPORTED ..PRAGMA_ALIGN_SUPPORTED_is_obsolete..
|
||||
#define GENERATINGPOWERPC ..GENERATINGPOWERPC_is_obsolete..
|
||||
#define GENERATING68K ..GENERATING68K_is_obsolete..
|
||||
#define GENERATING68881 ..GENERATING68881_is_obsolete..
|
||||
#define GENERATINGCFM ..GENERATINGCFM_is_obsolete..
|
||||
#define CFMSYSTEMCALLS ..CFMSYSTEMCALLS_is_obsolete..
|
||||
#endif /* !TARGET_API_MAC_CARBON */
|
||||
|
||||
|
||||
|
||||
/****************************************************************************************************
|
||||
|
||||
OLDROUTINENAMES - "Old" names for Macintosh system calls are allowed in source code.
|
||||
(e.g. DisposPtr instead of DisposePtr). The names of system routine
|
||||
are now more sensitive to change because CFM binds by name. In the
|
||||
past, system routine names were compiled out to just an A-Trap.
|
||||
Macros have been added that each map an old name to its new name.
|
||||
This allows old routine names to be used in existing source files,
|
||||
but the macros only work if OLDROUTINENAMES is true. This support
|
||||
will be removed in the near future. Thus, all source code should
|
||||
be changed to use the new names! You can set OLDROUTINENAMES to false
|
||||
to see if your code has any old names left in it.
|
||||
|
||||
****************************************************************************************************/
|
||||
#ifndef OLDROUTINENAMES
|
||||
#define OLDROUTINENAMES 0
|
||||
#endif /* !defined(OLDROUTINENAMES) */
|
||||
|
||||
|
||||
|
||||
/****************************************************************************************************
|
||||
The following macros isolate the use of 68K inlines in function prototypes.
|
||||
On the Mac OS under the Classic 68K runtime, function prototypes were followed
|
||||
by a list of 68K opcodes which the compiler inserted in the generated code instead
|
||||
of a JSR. Under Classic 68K on the Mac OS, this macro will put the opcodes
|
||||
in the right syntax. For all other OS's and runtimes the macro suppress the opcodes.
|
||||
Example:
|
||||
|
||||
EXTERN_P void DrawPicture(PicHandle myPicture, const Rect *dstRect)
|
||||
ONEWORDINLINE(0xA8F6);
|
||||
|
||||
****************************************************************************************************/
|
||||
|
||||
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
|
||||
#define ONEWORDINLINE(w1) = w1
|
||||
#define TWOWORDINLINE(w1,w2) = {w1,w2}
|
||||
#define THREEWORDINLINE(w1,w2,w3) = {w1,w2,w3}
|
||||
#define FOURWORDINLINE(w1,w2,w3,w4) = {w1,w2,w3,w4}
|
||||
#define FIVEWORDINLINE(w1,w2,w3,w4,w5) = {w1,w2,w3,w4,w5}
|
||||
#define SIXWORDINLINE(w1,w2,w3,w4,w5,w6) = {w1,w2,w3,w4,w5,w6}
|
||||
#define SEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7) = {w1,w2,w3,w4,w5,w6,w7}
|
||||
#define EIGHTWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8) = {w1,w2,w3,w4,w5,w6,w7,w8}
|
||||
#define NINEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9) = {w1,w2,w3,w4,w5,w6,w7,w8,w9}
|
||||
#define TENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10}
|
||||
#define ELEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11}
|
||||
#define TWELVEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12) = {w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12}
|
||||
#else
|
||||
#define ONEWORDINLINE(w1)
|
||||
#define TWOWORDINLINE(w1,w2)
|
||||
#define THREEWORDINLINE(w1,w2,w3)
|
||||
#define FOURWORDINLINE(w1,w2,w3,w4)
|
||||
#define FIVEWORDINLINE(w1,w2,w3,w4,w5)
|
||||
#define SIXWORDINLINE(w1,w2,w3,w4,w5,w6)
|
||||
#define SEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7)
|
||||
#define EIGHTWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8)
|
||||
#define NINEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9)
|
||||
#define TENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10)
|
||||
#define ELEVENWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11)
|
||||
#define TWELVEWORDINLINE(w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12)
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************************************************************************
|
||||
|
||||
TARGET_CARBON - default: false. Switches all of the above as described. Overrides all others
|
||||
- NOTE: If you set TARGET_CARBON to 1, then the other switches will be setup by
|
||||
ConditionalMacros, and should not be set manually.
|
||||
|
||||
If you wish to do development for pre-Carbon Systems, you can set the following:
|
||||
|
||||
OPAQUE_TOOLBOX_STRUCTS - default: false. True for Carbon builds, hides struct fields.
|
||||
OPAQUE_UPP_TYPES - default: false. True for Carbon builds, UPP types are unique and opaque.
|
||||
ACCESSOR_CALLS_ARE_FUNCTIONS - default: false. True for Carbon builds, enables accessor functions.
|
||||
CALL_NOT_IN_CARBON - default: true. False for Carbon builds, hides calls not supported in Carbon.
|
||||
|
||||
Specifically, if you are building a non-Carbon application (one that links against InterfaceLib)
|
||||
but you wish to use some of the accessor functions, you can set ACCESSOR_CALLS_ARE_FUNCTIONS to 1
|
||||
and link with CarbonAccessors.o, which implements just the accessor functions. This will help you
|
||||
preserve source compatibility between your Carbon and non-Carbon application targets.
|
||||
|
||||
MIXEDMODE_CALLS_ARE_FUNCTIONS - deprecated.
|
||||
|
||||
****************************************************************************************************/
|
||||
#if TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8
|
||||
#ifndef OPAQUE_TOOLBOX_STRUCTS
|
||||
#define OPAQUE_TOOLBOX_STRUCTS 1
|
||||
#endif /* !defined(OPAQUE_TOOLBOX_STRUCTS) */
|
||||
|
||||
#ifndef OPAQUE_UPP_TYPES
|
||||
#define OPAQUE_UPP_TYPES 1
|
||||
#endif /* !defined(OPAQUE_UPP_TYPES) */
|
||||
|
||||
#ifndef ACCESSOR_CALLS_ARE_FUNCTIONS
|
||||
#define ACCESSOR_CALLS_ARE_FUNCTIONS 1
|
||||
#endif /* !defined(ACCESSOR_CALLS_ARE_FUNCTIONS) */
|
||||
|
||||
#ifndef CALL_NOT_IN_CARBON
|
||||
#define CALL_NOT_IN_CARBON 0
|
||||
#endif /* !defined(CALL_NOT_IN_CARBON) */
|
||||
|
||||
#ifndef MIXEDMODE_CALLS_ARE_FUNCTIONS
|
||||
#define MIXEDMODE_CALLS_ARE_FUNCTIONS 1
|
||||
#endif /* !defined(MIXEDMODE_CALLS_ARE_FUNCTIONS) */
|
||||
|
||||
#else
|
||||
#ifndef OPAQUE_TOOLBOX_STRUCTS
|
||||
#define OPAQUE_TOOLBOX_STRUCTS 0
|
||||
#endif /* !defined(OPAQUE_TOOLBOX_STRUCTS) */
|
||||
|
||||
#ifndef ACCESSOR_CALLS_ARE_FUNCTIONS
|
||||
#define ACCESSOR_CALLS_ARE_FUNCTIONS 0
|
||||
#endif /* !defined(ACCESSOR_CALLS_ARE_FUNCTIONS) */
|
||||
|
||||
/*
|
||||
* It's possible to have ACCESSOR_CALLS_ARE_FUNCTIONS set to true and OPAQUE_TOOLBOX_STRUCTS
|
||||
* set to false, but not the other way around, so make sure the defines are not set this way.
|
||||
*/
|
||||
#ifndef CALL_NOT_IN_CARBON
|
||||
#define CALL_NOT_IN_CARBON 1
|
||||
#endif /* !defined(CALL_NOT_IN_CARBON) */
|
||||
|
||||
#ifndef MIXEDMODE_CALLS_ARE_FUNCTIONS
|
||||
#define MIXEDMODE_CALLS_ARE_FUNCTIONS 0
|
||||
#endif /* !defined(MIXEDMODE_CALLS_ARE_FUNCTIONS) */
|
||||
|
||||
#endif /* TARGET_API_MAC_CARBON && !TARGET_API_MAC_OS8 */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __CONDITIONALMACROS__ */
|
||||
|
||||
808
lib/libc/include/x86_64-macos-gnu/MacTypes.h
Normal file
808
lib/libc/include/x86_64-macos-gnu/MacTypes.h
Normal file
@@ -0,0 +1,808 @@
|
||||
/*
|
||||
* Copyright (c) 1985-2011 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: MacTypes.h
|
||||
|
||||
Contains: Basic Macintosh data types.
|
||||
|
||||
Version: CarbonCore-769~1
|
||||
|
||||
Bugs?: For bug reports, consult the following page on
|
||||
the World Wide Web:
|
||||
|
||||
http://developer.apple.com/bugreporter/
|
||||
|
||||
*/
|
||||
#ifndef __MACTYPES__
|
||||
#define __MACTYPES__
|
||||
|
||||
#ifndef __CONDITIONALMACROS__
|
||||
#include <ConditionalMacros.h>
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <Availability.h>
|
||||
|
||||
#if PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#pragma pack(push, 2)
|
||||
|
||||
|
||||
/*
|
||||
CarbonCore Deprecation flags.
|
||||
|
||||
Certain Carbon API functions are deprecated in 10.3 and later
|
||||
systems. These will produce a warning when compiling on 10.3.
|
||||
|
||||
Other functions and constants do not produce meaningful
|
||||
results when building Carbon for Mac OS X. For these
|
||||
functions, no-op macros are provided, but only when the
|
||||
ALLOW_OBSOLETE_CARBON flag is defined to be 0: eg
|
||||
-DALLOW_OBSOLETE_CARBON=0.
|
||||
*/
|
||||
|
||||
#if ! defined(ALLOW_OBSOLETE_CARBON) || ! ALLOW_OBSOLETE_CARBON
|
||||
|
||||
#define ALLOW_OBSOLETE_CARBON_MACMEMORY 0
|
||||
#define ALLOW_OBSOLETE_CARBON_OSUTILS 0
|
||||
|
||||
#else
|
||||
|
||||
#define ALLOW_OBSOLETE_CARBON_MACMEMORY 1 /* Removes obsolete constants; turns HLock/HUnlock into no-op macros */
|
||||
#define ALLOW_OBSOLETE_CARBON_OSUTILS 1 /* Removes obsolete structures */
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL __DARWIN_NULL
|
||||
#endif /* ! NULL */
|
||||
#ifndef nil
|
||||
#if defined(__has_feature)
|
||||
#if __has_feature(cxx_nullptr)
|
||||
#define nil nullptr
|
||||
#else
|
||||
#define nil __DARWIN_NULL
|
||||
#endif
|
||||
#else
|
||||
#define nil __DARWIN_NULL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
Base integer types for all target OS's and CPU's
|
||||
|
||||
UInt8 8-bit unsigned integer
|
||||
SInt8 8-bit signed integer
|
||||
UInt16 16-bit unsigned integer
|
||||
SInt16 16-bit signed integer
|
||||
UInt32 32-bit unsigned integer
|
||||
SInt32 32-bit signed integer
|
||||
UInt64 64-bit unsigned integer
|
||||
SInt64 64-bit signed integer
|
||||
|
||||
*********************************************************************************/
|
||||
typedef unsigned char UInt8;
|
||||
typedef signed char SInt8;
|
||||
typedef unsigned short UInt16;
|
||||
typedef signed short SInt16;
|
||||
|
||||
#if __LP64__
|
||||
typedef unsigned int UInt32;
|
||||
typedef signed int SInt32;
|
||||
#else
|
||||
typedef unsigned long UInt32;
|
||||
typedef signed long SInt32;
|
||||
#endif
|
||||
|
||||
/* avoid redeclaration if libkern/OSTypes.h */
|
||||
#ifndef _OS_OSTYPES_H
|
||||
#if TARGET_RT_BIG_ENDIAN
|
||||
struct wide {
|
||||
SInt32 hi;
|
||||
UInt32 lo;
|
||||
};
|
||||
typedef struct wide wide;
|
||||
struct UnsignedWide {
|
||||
UInt32 hi;
|
||||
UInt32 lo;
|
||||
};
|
||||
typedef struct UnsignedWide UnsignedWide;
|
||||
#else
|
||||
struct wide {
|
||||
UInt32 lo;
|
||||
SInt32 hi;
|
||||
};
|
||||
typedef struct wide wide;
|
||||
struct UnsignedWide {
|
||||
UInt32 lo;
|
||||
UInt32 hi;
|
||||
};
|
||||
typedef struct UnsignedWide UnsignedWide;
|
||||
#endif /* TARGET_RT_BIG_ENDIAN */
|
||||
|
||||
#endif
|
||||
|
||||
#if TYPE_LONGLONG
|
||||
/*
|
||||
Note: wide and UnsignedWide must always be structs for source code
|
||||
compatibility. On the other hand UInt64 and SInt64 can be
|
||||
either a struct or a long long, depending on the compiler.
|
||||
|
||||
If you use UInt64 and SInt64 you should do all operations on
|
||||
those data types through the functions/macros in Math64.h.
|
||||
This will assure that your code compiles with compilers that
|
||||
support long long and those that don't.
|
||||
|
||||
The MS Visual C/C++ compiler uses __int64 instead of long long.
|
||||
*/
|
||||
#if defined(_MSC_VER) && !defined(__MWERKS__) && defined(_M_IX86)
|
||||
typedef signed __int64 SInt64;
|
||||
typedef unsigned __int64 UInt64;
|
||||
#else
|
||||
typedef signed long long SInt64;
|
||||
typedef unsigned long long UInt64;
|
||||
#endif
|
||||
#else
|
||||
|
||||
|
||||
typedef wide SInt64;
|
||||
typedef UnsignedWide UInt64;
|
||||
#endif /* TYPE_LONGLONG */
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
Base fixed point types
|
||||
|
||||
Fixed 16-bit signed integer plus 16-bit fraction
|
||||
UnsignedFixed 16-bit unsigned integer plus 16-bit fraction
|
||||
Fract 2-bit signed integer plus 30-bit fraction
|
||||
ShortFixed 8-bit signed integer plus 8-bit fraction
|
||||
|
||||
*********************************************************************************/
|
||||
typedef SInt32 Fixed;
|
||||
typedef Fixed * FixedPtr;
|
||||
typedef SInt32 Fract;
|
||||
typedef Fract * FractPtr;
|
||||
typedef UInt32 UnsignedFixed;
|
||||
typedef UnsignedFixed * UnsignedFixedPtr;
|
||||
typedef short ShortFixed;
|
||||
typedef ShortFixed * ShortFixedPtr;
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
Base floating point types
|
||||
|
||||
Float32 32 bit IEEE float: 1 sign bit, 8 exponent bits, 23 fraction bits
|
||||
Float64 64 bit IEEE float: 1 sign bit, 11 exponent bits, 52 fraction bits
|
||||
Float80 80 bit MacOS float: 1 sign bit, 15 exponent bits, 1 integer bit, 63 fraction bits
|
||||
Float96 96 bit 68881 float: 1 sign bit, 15 exponent bits, 16 pad bits, 1 integer bit, 63 fraction bits
|
||||
|
||||
Note: These are fixed size floating point types, useful when writing a floating
|
||||
point value to disk. If your compiler does not support a particular size
|
||||
float, a struct is used instead.
|
||||
Use one of the NCEG types (e.g. double_t) or an ANSI C type (e.g. double) if
|
||||
you want a floating point representation that is natural for any given
|
||||
compiler, but might be a different size on different compilers.
|
||||
|
||||
*********************************************************************************/
|
||||
typedef float Float32;
|
||||
typedef double Float64;
|
||||
struct Float80 {
|
||||
SInt16 exp;
|
||||
UInt16 man[4];
|
||||
};
|
||||
typedef struct Float80 Float80;
|
||||
|
||||
struct Float96 {
|
||||
SInt16 exp[2]; /* the second 16-bits are undefined */
|
||||
UInt16 man[4];
|
||||
};
|
||||
typedef struct Float96 Float96;
|
||||
struct Float32Point {
|
||||
Float32 x;
|
||||
Float32 y;
|
||||
};
|
||||
typedef struct Float32Point Float32Point;
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
MacOS Memory Manager types
|
||||
|
||||
Ptr Pointer to a non-relocatable block
|
||||
Handle Pointer to a master pointer to a relocatable block
|
||||
Size The number of bytes in a block (signed for historical reasons)
|
||||
|
||||
*********************************************************************************/
|
||||
typedef char * Ptr;
|
||||
typedef Ptr * Handle;
|
||||
typedef long Size;
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
Higher level basic types
|
||||
|
||||
OSErr 16-bit result error code
|
||||
OSStatus 32-bit result error code
|
||||
LogicalAddress Address in the clients virtual address space
|
||||
ConstLogicalAddress Address in the clients virtual address space that will only be read
|
||||
PhysicalAddress Real address as used on the hardware bus
|
||||
BytePtr Pointer to an array of bytes
|
||||
ByteCount The size of an array of bytes
|
||||
ByteOffset An offset into an array of bytes
|
||||
ItemCount 32-bit iteration count
|
||||
OptionBits Standard 32-bit set of bit flags
|
||||
PBVersion ?
|
||||
Duration 32-bit millisecond timer for drivers
|
||||
AbsoluteTime 64-bit clock
|
||||
ScriptCode A particular set of written characters (e.g. Roman vs Cyrillic) and their encoding
|
||||
LangCode A particular language (e.g. English), as represented using a particular ScriptCode
|
||||
RegionCode Designates a language as used in a particular region (e.g. British vs American
|
||||
English) together with other region-dependent characteristics (e.g. date format)
|
||||
FourCharCode A 32-bit value made by packing four 1 byte characters together
|
||||
OSType A FourCharCode used in the OS and file system (e.g. creator)
|
||||
ResType A FourCharCode used to tag resources (e.g. 'DLOG')
|
||||
|
||||
*********************************************************************************/
|
||||
typedef SInt16 OSErr;
|
||||
typedef SInt32 OSStatus;
|
||||
typedef void * LogicalAddress;
|
||||
typedef const void * ConstLogicalAddress;
|
||||
typedef void * PhysicalAddress;
|
||||
typedef UInt8 * BytePtr;
|
||||
typedef unsigned long ByteCount;
|
||||
typedef unsigned long ByteOffset;
|
||||
typedef SInt32 Duration;
|
||||
typedef UnsignedWide AbsoluteTime;
|
||||
typedef UInt32 OptionBits;
|
||||
typedef unsigned long ItemCount;
|
||||
typedef UInt32 PBVersion;
|
||||
typedef SInt16 ScriptCode;
|
||||
typedef SInt16 LangCode;
|
||||
typedef SInt16 RegionCode;
|
||||
typedef UInt32 FourCharCode;
|
||||
typedef FourCharCode OSType;
|
||||
typedef FourCharCode ResType;
|
||||
typedef OSType * OSTypePtr;
|
||||
typedef ResType * ResTypePtr;
|
||||
/********************************************************************************
|
||||
|
||||
Boolean types and values
|
||||
|
||||
Boolean Mac OS historic type, sizeof(Boolean)==1
|
||||
bool Defined in stdbool.h, ISO C/C++ standard type
|
||||
false Now defined in stdbool.h
|
||||
true Now defined in stdbool.h
|
||||
|
||||
*********************************************************************************/
|
||||
typedef unsigned char Boolean;
|
||||
/********************************************************************************
|
||||
|
||||
Function Pointer Types
|
||||
|
||||
ProcPtr Generic pointer to a function
|
||||
Register68kProcPtr Pointer to a 68K function that expects parameters in registers
|
||||
UniversalProcPtr Pointer to classic 68K code or a RoutineDescriptor
|
||||
|
||||
ProcHandle Pointer to a ProcPtr
|
||||
UniversalProcHandle Pointer to a UniversalProcPtr
|
||||
|
||||
*********************************************************************************/
|
||||
typedef CALLBACK_API_C( long , ProcPtr )(void);
|
||||
typedef CALLBACK_API( void , Register68kProcPtr )(void);
|
||||
#if TARGET_RT_MAC_CFM
|
||||
/* The RoutineDescriptor structure is defined in MixedMode.h */
|
||||
typedef struct RoutineDescriptor *UniversalProcPtr;
|
||||
#else
|
||||
typedef ProcPtr UniversalProcPtr;
|
||||
#endif /* TARGET_RT_MAC_CFM */
|
||||
|
||||
typedef ProcPtr * ProcHandle;
|
||||
typedef UniversalProcPtr * UniversalProcHandle;
|
||||
/********************************************************************************
|
||||
|
||||
RefCon Types
|
||||
|
||||
For access to private data in callbacks, etc.; refcons are generally
|
||||
used as a pointer to something, but in the 32-bit world refcons in
|
||||
different APIs have had various types: pointer, unsigned scalar, and
|
||||
signed scalar. The RefCon types defined here support the current 32-bit
|
||||
usage but provide normalization to pointer types for 64-bit.
|
||||
|
||||
PRefCon is preferred for new APIs; URefCon and SRefCon are primarily
|
||||
for compatibility with existing APIs.
|
||||
|
||||
*********************************************************************************/
|
||||
typedef void * PRefCon;
|
||||
#if __LP64__
|
||||
typedef void * URefCon;
|
||||
typedef void * SRefCon;
|
||||
#else
|
||||
typedef UInt32 URefCon;
|
||||
typedef SInt32 SRefCon;
|
||||
#endif /* __LP64__ */
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
Common Constants
|
||||
|
||||
noErr OSErr: function performed properly - no error
|
||||
kNilOptions OptionBits: all flags false
|
||||
kInvalidID KernelID: NULL is for pointers as kInvalidID is for ID's
|
||||
kVariableLengthArray array bounds: variable length array
|
||||
|
||||
Note: kVariableLengthArray was used in array bounds to specify a variable length array,
|
||||
usually the last field in a struct. Now that the C language supports
|
||||
the concept of flexible array members, you can instead use:
|
||||
|
||||
struct BarList
|
||||
{
|
||||
short listLength;
|
||||
Bar elements[];
|
||||
};
|
||||
|
||||
However, this changes the semantics somewhat, as sizeof( BarList ) contains
|
||||
no space for any of the elements, so to allocate a list with space for
|
||||
the count elements
|
||||
|
||||
struct BarList* l = (struct BarList*) malloc( sizeof(BarList) + count * sizeof(Bar) );
|
||||
|
||||
*********************************************************************************/
|
||||
enum {
|
||||
noErr = 0
|
||||
};
|
||||
|
||||
enum {
|
||||
kNilOptions = 0
|
||||
};
|
||||
|
||||
#define kInvalidID 0
|
||||
enum {
|
||||
kVariableLengthArray
|
||||
#ifdef __has_extension
|
||||
#if __has_extension(enumerator_attributes)
|
||||
__attribute__((deprecated))
|
||||
#endif
|
||||
#endif
|
||||
= 1
|
||||
};
|
||||
|
||||
enum {
|
||||
kUnknownType = 0x3F3F3F3F /* "????" QuickTime 3.0: default unknown ResType or OSType */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
String Types and Unicode Types
|
||||
|
||||
UnicodeScalarValue, A complete Unicode character in UTF-32 format, with
|
||||
UTF32Char values from 0 through 0x10FFFF (excluding the surrogate
|
||||
range 0xD800-0xDFFF and certain disallowed values).
|
||||
|
||||
UniChar, A 16-bit Unicode code value in the default UTF-16 format.
|
||||
UTF16Char UnicodeScalarValues 0-0xFFFF are expressed in UTF-16
|
||||
format using a single UTF16Char with the same value.
|
||||
UnicodeScalarValues 0x10000-0x10FFFF are expressed in
|
||||
UTF-16 format using a pair of UTF16Chars - one in the
|
||||
high surrogate range (0xD800-0xDBFF) followed by one in
|
||||
the low surrogate range (0xDC00-0xDFFF). All of the
|
||||
characters defined in Unicode versions through 3.0 are
|
||||
in the range 0-0xFFFF and can be expressed using a single
|
||||
UTF16Char, thus the term "Unicode character" generally
|
||||
refers to a UniChar = UTF16Char.
|
||||
|
||||
UTF8Char An 8-bit code value in UTF-8 format. UnicodeScalarValues
|
||||
0-0x7F are expressed in UTF-8 format using one UTF8Char
|
||||
with the same value. UnicodeScalarValues above 0x7F are
|
||||
expressed in UTF-8 format using 2-4 UTF8Chars, all with
|
||||
values in the range 0x80-0xF4 (UnicodeScalarValues
|
||||
0x100-0xFFFF use two or three UTF8Chars,
|
||||
UnicodeScalarValues 0x10000-0x10FFFF use four UTF8Chars).
|
||||
|
||||
UniCharCount A count of UTF-16 code values in an array or buffer.
|
||||
|
||||
StrNNN Pascal string holding up to NNN bytes
|
||||
StringPtr Pointer to a pascal string
|
||||
StringHandle Pointer to a StringPtr
|
||||
ConstStringPtr Pointer to a read-only pascal string
|
||||
ConstStrNNNParam For function parameters only - means string is const
|
||||
|
||||
CStringPtr Pointer to a C string (in C: char*)
|
||||
ConstCStringPtr Pointer to a read-only C string (in C: const char*)
|
||||
|
||||
Note: The length of a pascal string is stored as the first byte.
|
||||
A pascal string does not have a termination byte.
|
||||
A pascal string can hold at most 255 bytes of data.
|
||||
The first character in a pascal string is offset one byte from the start of the string.
|
||||
|
||||
A C string is terminated with a byte of value zero.
|
||||
A C string has no length limitation.
|
||||
The first character in a C string is the zeroth byte of the string.
|
||||
|
||||
|
||||
*********************************************************************************/
|
||||
typedef UInt32 UnicodeScalarValue;
|
||||
typedef UInt32 UTF32Char;
|
||||
typedef UInt16 UniChar;
|
||||
typedef UInt16 UTF16Char;
|
||||
typedef UInt8 UTF8Char;
|
||||
typedef UniChar * UniCharPtr;
|
||||
typedef unsigned long UniCharCount;
|
||||
typedef UniCharCount * UniCharCountPtr;
|
||||
typedef unsigned char Str255[256];
|
||||
typedef unsigned char Str63[64];
|
||||
typedef unsigned char Str32[33];
|
||||
typedef unsigned char Str31[32];
|
||||
typedef unsigned char Str27[28];
|
||||
typedef unsigned char Str15[16];
|
||||
/*
|
||||
The type Str32 is used in many AppleTalk based data structures.
|
||||
It holds up to 32 one byte chars. The problem is that with the
|
||||
length byte it is 33 bytes long. This can cause weird alignment
|
||||
problems in structures. To fix this the type "Str32Field" has
|
||||
been created. It should only be used to hold 32 chars, but
|
||||
it is 34 bytes long so that there are no alignment problems.
|
||||
*/
|
||||
typedef unsigned char Str32Field[34];
|
||||
/*
|
||||
QuickTime 3.0:
|
||||
The type StrFileName is used to make MacOS structs work
|
||||
cross-platform. For example FSSpec or SFReply previously
|
||||
contained a Str63 field. They now contain a StrFileName
|
||||
field which is the same when targeting the MacOS but is
|
||||
a 256 char buffer for Win32 and unix, allowing them to
|
||||
contain long file names.
|
||||
*/
|
||||
typedef Str63 StrFileName;
|
||||
typedef unsigned char * StringPtr;
|
||||
typedef StringPtr * StringHandle;
|
||||
typedef const unsigned char * ConstStringPtr;
|
||||
typedef const unsigned char * ConstStr255Param;
|
||||
typedef const unsigned char * ConstStr63Param;
|
||||
typedef const unsigned char * ConstStr32Param;
|
||||
typedef const unsigned char * ConstStr31Param;
|
||||
typedef const unsigned char * ConstStr27Param;
|
||||
typedef const unsigned char * ConstStr15Param;
|
||||
typedef ConstStr63Param ConstStrFileNameParam;
|
||||
#ifdef __cplusplus
|
||||
inline unsigned char StrLength(ConstStr255Param string) { return (*string); }
|
||||
#else
|
||||
#define StrLength(string) (*(const unsigned char *)(string))
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
||||
#if OLDROUTINENAMES
|
||||
#define Length(string) StrLength(string)
|
||||
#endif /* OLDROUTINENAMES */
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
Process Manager type ProcessSerialNumber (previously in Processes.h)
|
||||
|
||||
*********************************************************************************/
|
||||
/* type for unique process identifier */
|
||||
struct ProcessSerialNumber {
|
||||
UInt32 highLongOfPSN;
|
||||
UInt32 lowLongOfPSN;
|
||||
};
|
||||
typedef struct ProcessSerialNumber ProcessSerialNumber;
|
||||
typedef ProcessSerialNumber * ProcessSerialNumberPtr;
|
||||
/********************************************************************************
|
||||
|
||||
Quickdraw Types
|
||||
|
||||
Point 2D Quickdraw coordinate, range: -32K to +32K
|
||||
Rect Rectangular Quickdraw area
|
||||
Style Quickdraw font rendering styles
|
||||
StyleParameter Style when used as a parameter (historical 68K convention)
|
||||
StyleField Style when used as a field (historical 68K convention)
|
||||
CharParameter Char when used as a parameter (historical 68K convention)
|
||||
|
||||
Note: The original Macintosh toolbox in 68K Pascal defined Style as a SET.
|
||||
Both Style and CHAR occupy 8-bits in packed records or 16-bits when
|
||||
used as fields in non-packed records or as parameters.
|
||||
|
||||
*********************************************************************************/
|
||||
struct Point {
|
||||
short v;
|
||||
short h;
|
||||
};
|
||||
typedef struct Point Point;
|
||||
typedef Point * PointPtr;
|
||||
struct Rect {
|
||||
short top;
|
||||
short left;
|
||||
short bottom;
|
||||
short right;
|
||||
};
|
||||
typedef struct Rect Rect;
|
||||
typedef Rect * RectPtr;
|
||||
struct FixedPoint {
|
||||
Fixed x;
|
||||
Fixed y;
|
||||
};
|
||||
typedef struct FixedPoint FixedPoint;
|
||||
struct FixedRect {
|
||||
Fixed left;
|
||||
Fixed top;
|
||||
Fixed right;
|
||||
Fixed bottom;
|
||||
};
|
||||
typedef struct FixedRect FixedRect;
|
||||
|
||||
typedef short CharParameter;
|
||||
enum {
|
||||
normal = 0,
|
||||
bold = 1,
|
||||
italic = 2,
|
||||
underline = 4,
|
||||
outline = 8,
|
||||
shadow = 0x10,
|
||||
condense = 0x20,
|
||||
extend = 0x40
|
||||
};
|
||||
|
||||
typedef unsigned char Style;
|
||||
typedef short StyleParameter;
|
||||
typedef Style StyleField;
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
QuickTime TimeBase types (previously in Movies.h)
|
||||
|
||||
TimeValue Count of units
|
||||
TimeScale Units per second
|
||||
CompTimeValue 64-bit count of units (always a struct)
|
||||
TimeValue64 64-bit count of units (long long or struct)
|
||||
TimeBase An opaque reference to a time base
|
||||
TimeRecord Package of TimeBase, duration, and scale
|
||||
|
||||
*********************************************************************************/
|
||||
typedef SInt32 TimeValue;
|
||||
typedef SInt32 TimeScale;
|
||||
typedef wide CompTimeValue;
|
||||
typedef SInt64 TimeValue64;
|
||||
typedef struct TimeBaseRecord* TimeBase;
|
||||
struct TimeRecord {
|
||||
CompTimeValue value; /* units (duration or absolute) */
|
||||
TimeScale scale; /* units per second */
|
||||
TimeBase base; /* refernce to the time base */
|
||||
};
|
||||
typedef struct TimeRecord TimeRecord;
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
THINK C base objects
|
||||
|
||||
HandleObject Root class for handle based THINK C++ objects
|
||||
PascalObject Root class for pascal style objects in THINK C++
|
||||
|
||||
*********************************************************************************/
|
||||
#if defined(__SC__) && !defined(__STDC__) && defined(__cplusplus)
|
||||
class __machdl HandleObject {};
|
||||
#if TARGET_CPU_68K
|
||||
class __pasobj PascalObject {};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
||||
MacOS versioning structures
|
||||
|
||||
VersRec Contents of a 'vers' resource
|
||||
VersRecPtr Pointer to a VersRecPtr
|
||||
VersRecHndl Resource Handle containing a VersRec
|
||||
NumVersion Packed BCD version representation (e.g. "4.2.1a3" is 0x04214003)
|
||||
UniversalProcPtr Pointer to classic 68K code or a RoutineDescriptor
|
||||
|
||||
ProcHandle Pointer to a ProcPtr
|
||||
UniversalProcHandle Pointer to a UniversalProcPtr
|
||||
|
||||
*********************************************************************************/
|
||||
#if TARGET_RT_BIG_ENDIAN
|
||||
struct NumVersion {
|
||||
/* Numeric version part of 'vers' resource */
|
||||
UInt8 majorRev; /*1st part of version number in BCD*/
|
||||
UInt8 minorAndBugRev; /*2nd & 3rd part of version number share a byte*/
|
||||
UInt8 stage; /*stage code: dev, alpha, beta, final*/
|
||||
UInt8 nonRelRev; /*revision level of non-released version*/
|
||||
};
|
||||
typedef struct NumVersion NumVersion;
|
||||
#else
|
||||
struct NumVersion {
|
||||
/* Numeric version part of 'vers' resource accessable in little endian format */
|
||||
UInt8 nonRelRev; /*revision level of non-released version*/
|
||||
UInt8 stage; /*stage code: dev, alpha, beta, final*/
|
||||
UInt8 minorAndBugRev; /*2nd & 3rd part of version number share a byte*/
|
||||
UInt8 majorRev; /*1st part of version number in BCD*/
|
||||
};
|
||||
typedef struct NumVersion NumVersion;
|
||||
#endif /* TARGET_RT_BIG_ENDIAN */
|
||||
|
||||
enum {
|
||||
/* Version Release Stage Codes */
|
||||
developStage = 0x20,
|
||||
alphaStage = 0x40,
|
||||
betaStage = 0x60,
|
||||
finalStage = 0x80
|
||||
};
|
||||
|
||||
union NumVersionVariant {
|
||||
/* NumVersionVariant is a wrapper so NumVersion can be accessed as a 32-bit value */
|
||||
NumVersion parts;
|
||||
UInt32 whole;
|
||||
};
|
||||
typedef union NumVersionVariant NumVersionVariant;
|
||||
typedef NumVersionVariant * NumVersionVariantPtr;
|
||||
typedef NumVersionVariantPtr * NumVersionVariantHandle;
|
||||
struct VersRec {
|
||||
/* 'vers' resource format */
|
||||
NumVersion numericVersion; /*encoded version number*/
|
||||
short countryCode; /*country code from intl utilities*/
|
||||
Str255 shortVersion; /*version number string - worst case*/
|
||||
Str255 reserved; /*longMessage string packed after shortVersion*/
|
||||
};
|
||||
typedef struct VersRec VersRec;
|
||||
typedef VersRec * VersRecPtr;
|
||||
typedef VersRecPtr * VersRecHndl;
|
||||
/*********************************************************************************
|
||||
|
||||
Old names for types
|
||||
|
||||
*********************************************************************************/
|
||||
typedef UInt8 Byte;
|
||||
typedef SInt8 SignedByte;
|
||||
typedef wide * WidePtr;
|
||||
typedef UnsignedWide * UnsignedWidePtr;
|
||||
typedef Float80 extended80;
|
||||
typedef Float96 extended96;
|
||||
typedef SInt8 VHSelect;
|
||||
/*********************************************************************************
|
||||
|
||||
Debugger functions
|
||||
|
||||
*********************************************************************************/
|
||||
/*
|
||||
* Debugger()
|
||||
*
|
||||
* Availability:
|
||||
* Mac OS X: in version 10.0 and later in CoreServices.framework
|
||||
* CarbonLib: in CarbonLib 1.0 and later
|
||||
* Non-Carbon CFM: in InterfaceLib 7.1 and later
|
||||
*/
|
||||
extern void
|
||||
Debugger(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);
|
||||
|
||||
|
||||
/*
|
||||
* DebugStr()
|
||||
*
|
||||
* Availability:
|
||||
* Mac OS X: in version 10.0 and later in CoreServices.framework
|
||||
* CarbonLib: in CarbonLib 1.0 and later
|
||||
* Non-Carbon CFM: in InterfaceLib 7.1 and later
|
||||
*/
|
||||
extern void
|
||||
DebugStr(ConstStr255Param debuggerMsg) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);
|
||||
|
||||
|
||||
/*
|
||||
* debugstr()
|
||||
*
|
||||
* Availability:
|
||||
* Mac OS X: not available
|
||||
* CarbonLib: not available
|
||||
* Non-Carbon CFM: in InterfaceLib 7.1 and later
|
||||
*/
|
||||
|
||||
|
||||
#if TARGET_CPU_PPC
|
||||
/* Only for Mac OS native drivers */
|
||||
/*
|
||||
* SysDebug()
|
||||
*
|
||||
* Availability:
|
||||
* Mac OS X: not available
|
||||
* CarbonLib: not available
|
||||
* Non-Carbon CFM: in DriverServicesLib 1.0 and later
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* SysDebugStr()
|
||||
*
|
||||
* Availability:
|
||||
* Mac OS X: not available
|
||||
* CarbonLib: not available
|
||||
* Non-Carbon CFM: in DriverServicesLib 1.0 and later
|
||||
*/
|
||||
|
||||
|
||||
#endif /* TARGET_CPU_PPC */
|
||||
|
||||
/* SADE break points */
|
||||
/*
|
||||
* SysBreak()
|
||||
*
|
||||
* Availability:
|
||||
* Mac OS X: in version 10.0 and later in CoreServices.framework
|
||||
* CarbonLib: in CarbonLib 1.0 and later
|
||||
* Non-Carbon CFM: in InterfaceLib 7.1 and later
|
||||
*/
|
||||
extern void
|
||||
SysBreak(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);
|
||||
|
||||
|
||||
/*
|
||||
* SysBreakStr()
|
||||
*
|
||||
* Availability:
|
||||
* Mac OS X: in version 10.0 and later in CoreServices.framework
|
||||
* CarbonLib: in CarbonLib 1.0 and later
|
||||
* Non-Carbon CFM: in InterfaceLib 7.1 and later
|
||||
*/
|
||||
extern void
|
||||
SysBreakStr(ConstStr255Param debuggerMsg) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);
|
||||
|
||||
|
||||
/*
|
||||
* SysBreakFunc()
|
||||
*
|
||||
* Availability:
|
||||
* Mac OS X: in version 10.0 and later in CoreServices.framework
|
||||
* CarbonLib: in CarbonLib 1.0 and later
|
||||
* Non-Carbon CFM: in InterfaceLib 7.1 and later
|
||||
*/
|
||||
extern void
|
||||
SysBreakFunc(ConstStr255Param debuggerMsg) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_8, __IPHONE_NA, __IPHONE_NA);
|
||||
|
||||
|
||||
/* old names for Debugger and DebugStr */
|
||||
#if OLDROUTINENAMES && TARGET_CPU_68K
|
||||
#define Debugger68k() Debugger()
|
||||
#define DebugStr68k(s) DebugStr(s)
|
||||
#endif
|
||||
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MACTYPES__ */
|
||||
|
||||
508
lib/libc/include/x86_64-macos-gnu/TargetConditionals.h
Normal file
508
lib/libc/include/x86_64-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__ */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2002-2006, 2008-2010, 2012 Apple Inc. All rights reserved.
|
||||
* Copyright (c) 2000, 2002-2006, 2008-2010, 2012, 2020 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
@@ -23,5 +23,13 @@
|
||||
|
||||
#ifndef _CTERMID_H_
|
||||
#define _CTERMID_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
char *ctermid(char *);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
121
lib/libc/include/x86_64-macos-gnu/_regex.h
Normal file
121
lib/libc/include/x86_64-macos-gnu/_regex.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001-2009 Ville Laurikari <vl@iki.fi>
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER 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 COPYRIGHT
|
||||
* HOLDER 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) 1992 Henry Spencer.
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Henry Spencer of the University of Toronto.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)regex.h 8.2 (Berkeley) 1/3/94
|
||||
*/
|
||||
|
||||
/*
|
||||
* Common header for regex.h and xlocale/_regex.h
|
||||
*/
|
||||
|
||||
#ifndef __REGEX_H_
|
||||
#define __REGEX_H_
|
||||
|
||||
#include <_types.h>
|
||||
#include <Availability.h>
|
||||
#include <sys/_types/_size_t.h>
|
||||
|
||||
/*********/
|
||||
/* types */
|
||||
/*********/
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
|
||||
#include <sys/_types/_wchar_t.h>
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
|
||||
|
||||
typedef __darwin_off_t regoff_t;
|
||||
|
||||
typedef struct {
|
||||
int re_magic;
|
||||
size_t re_nsub; /* number of parenthesized subexpressions */
|
||||
const char *re_endp; /* end pointer for REG_PEND */
|
||||
struct re_guts *re_g; /* none of your business :-) */
|
||||
} regex_t;
|
||||
|
||||
typedef struct {
|
||||
regoff_t rm_so; /* start of match */
|
||||
regoff_t rm_eo; /* end of match */
|
||||
} regmatch_t;
|
||||
|
||||
#endif /* !__REGEX_H_ */
|
||||
33
lib/libc/include/x86_64-macos-gnu/_types/_nl_item.h
Normal file
33
lib/libc/include/x86_64-macos-gnu/_types/_nl_item.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 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 _NL_ITEM
|
||||
#define _NL_ITEM
|
||||
#include <_types.h>
|
||||
typedef __darwin_nl_item nl_item;
|
||||
#endif /* _NL_ITEM */
|
||||
37
lib/libc/include/x86_64-macos-gnu/_xlocale.h
Normal file
37
lib/libc/include/x86_64-macos-gnu/_xlocale.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2005 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 __XLOCALE_H_
|
||||
#define __XLOCALE_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
struct _xlocale; /* forward reference */
|
||||
typedef struct _xlocale * locale_t;
|
||||
|
||||
__BEGIN_DECLS
|
||||
int ___mb_cur_max(void);
|
||||
int ___mb_cur_max_l(locale_t);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __XLOCALE_H_ */
|
||||
37
lib/libc/include/x86_64-macos-gnu/aio.h
Normal file
37
lib/libc/include/x86_64-macos-gnu/aio.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 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@
|
||||
*/
|
||||
/*
|
||||
* File: aio.h
|
||||
* Author: Umesh Vaishampayan [umeshv@apple.com]
|
||||
* 05-Feb-2003 umeshv Created.
|
||||
*
|
||||
* Header file for POSIX Asynchronous IO APIs
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _AIO_H_
|
||||
#define _AIO_H_
|
||||
|
||||
#include <sys/aio.h>
|
||||
|
||||
#endif /* _AIO_H_ */
|
||||
381
lib/libc/include/x86_64-macos-gnu/architecture/byte_order.h
Normal file
381
lib/libc/include/x86_64-macos-gnu/architecture/byte_order.h
Normal file
@@ -0,0 +1,381 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 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) 1992 NeXT Computer, Inc.
|
||||
*
|
||||
* Byte ordering conversion.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ARCHITECTURE_BYTE_ORDER_H_
|
||||
#define _ARCHITECTURE_BYTE_ORDER_H_
|
||||
|
||||
/*
|
||||
* Please note that the byte ordering functions in this file are deprecated.
|
||||
* A replacement API exists in libkern/OSByteOrder.h
|
||||
*/
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
typedef unsigned long NXSwappedFloat;
|
||||
typedef unsigned long long NXSwappedDouble;
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapShort(
|
||||
unsigned short inv
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapInt16((uint16_t)inv);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapInt(
|
||||
unsigned int inv
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapInt32((uint32_t)inv);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapLong(
|
||||
unsigned long inv
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapInt32((uint32_t)inv);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapLongLong(
|
||||
unsigned long long inv
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapInt64((uint64_t)inv);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedFloat
|
||||
NXConvertHostFloatToSwapped(float x)
|
||||
{
|
||||
union fconv {
|
||||
float number;
|
||||
NXSwappedFloat sf;
|
||||
} u;
|
||||
u.number = x;
|
||||
return u.sf;
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
float
|
||||
NXConvertSwappedFloatToHost(NXSwappedFloat x)
|
||||
{
|
||||
union fconv {
|
||||
float number;
|
||||
NXSwappedFloat sf;
|
||||
} u;
|
||||
u.sf = x;
|
||||
return u.number;
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedDouble
|
||||
NXConvertHostDoubleToSwapped(double x)
|
||||
{
|
||||
union dconv {
|
||||
double number;
|
||||
NXSwappedDouble sd;
|
||||
} u;
|
||||
u.number = x;
|
||||
return u.sd;
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
double
|
||||
NXConvertSwappedDoubleToHost(NXSwappedDouble x)
|
||||
{
|
||||
union dconv {
|
||||
double number;
|
||||
NXSwappedDouble sd;
|
||||
} u;
|
||||
u.sd = x;
|
||||
return u.number;
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedFloat
|
||||
NXSwapFloat(NXSwappedFloat x)
|
||||
{
|
||||
return (NXSwappedFloat)OSSwapInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedDouble
|
||||
NXSwapDouble(NXSwappedDouble x)
|
||||
{
|
||||
return (NXSwappedDouble)OSSwapInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
/*
|
||||
* Identify the byte order
|
||||
* of the current host.
|
||||
*/
|
||||
|
||||
enum NXByteOrder {
|
||||
NX_UnknownByteOrder,
|
||||
NX_LittleEndian,
|
||||
NX_BigEndian
|
||||
};
|
||||
|
||||
static __inline__
|
||||
enum NXByteOrder
|
||||
NXHostByteOrder(void)
|
||||
{
|
||||
#if defined(__LITTLE_ENDIAN__)
|
||||
return NX_LittleEndian;
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
return NX_BigEndian;
|
||||
#else
|
||||
return NX_UnknownByteOrder;
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapBigShortToHost(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapBigToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapBigIntToHost(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapBigToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapBigLongToHost(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapBigToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapBigLongLongToHost(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapBigToHostInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
double
|
||||
NXSwapBigDoubleToHost(
|
||||
NXSwappedDouble x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapBigToHostInt64((uint64_t)x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
float
|
||||
NXSwapBigFloatToHost(
|
||||
NXSwappedFloat x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapBigToHostInt32((uint32_t)x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapHostShortToBig(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapHostToBigInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapHostIntToBig(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapHostToBigInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapHostLongToBig(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapHostToBigInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapHostLongLongToBig(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapHostToBigInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedDouble
|
||||
NXSwapHostDoubleToBig(
|
||||
double x
|
||||
)
|
||||
{
|
||||
return (NXSwappedDouble)OSSwapHostToBigInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedFloat
|
||||
NXSwapHostFloatToBig(
|
||||
float x
|
||||
)
|
||||
{
|
||||
return (NXSwappedFloat)OSSwapHostToBigInt32((uint32_t)NXConvertHostFloatToSwapped(x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapLittleShortToHost(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapLittleToHostInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapLittleIntToHost(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapLittleToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapLittleLongToHost(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapLittleToHostInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapLittleLongLongToHost(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapLittleToHostInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
double
|
||||
NXSwapLittleDoubleToHost(
|
||||
NXSwappedDouble x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedDoubleToHost((NXSwappedDouble)OSSwapLittleToHostInt64((uint64_t)x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
float
|
||||
NXSwapLittleFloatToHost(
|
||||
NXSwappedFloat x
|
||||
)
|
||||
{
|
||||
return NXConvertSwappedFloatToHost((NXSwappedFloat)OSSwapLittleToHostInt32((uint32_t)x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned short
|
||||
NXSwapHostShortToLittle(
|
||||
unsigned short x
|
||||
)
|
||||
{
|
||||
return (unsigned short)OSSwapHostToLittleInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned int
|
||||
NXSwapHostIntToLittle(
|
||||
unsigned int x
|
||||
)
|
||||
{
|
||||
return (unsigned int)OSSwapHostToLittleInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long
|
||||
NXSwapHostLongToLittle(
|
||||
unsigned long x
|
||||
)
|
||||
{
|
||||
return (unsigned long)OSSwapHostToLittleInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
unsigned long long
|
||||
NXSwapHostLongLongToLittle(
|
||||
unsigned long long x
|
||||
)
|
||||
{
|
||||
return (unsigned long long)OSSwapHostToLittleInt64((uint64_t)x);
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedDouble
|
||||
NXSwapHostDoubleToLittle(
|
||||
double x
|
||||
)
|
||||
{
|
||||
return (NXSwappedDouble)OSSwapHostToLittleInt64((uint64_t)NXConvertHostDoubleToSwapped(x));
|
||||
}
|
||||
|
||||
static __inline__ __attribute__((deprecated))
|
||||
NXSwappedFloat
|
||||
NXSwapHostFloatToLittle(
|
||||
float x
|
||||
)
|
||||
{
|
||||
return (NXSwappedFloat)OSSwapHostToLittleInt32((uint32_t)NXConvertHostFloatToSwapped(x));
|
||||
}
|
||||
|
||||
#endif /* _ARCHITECTURE_BYTE_ORDER_H_ */
|
||||
97
lib/libc/include/x86_64-macos-gnu/arpa/inet.h
Normal file
97
lib/libc/include/x86_64-macos-gnu/arpa/inet.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* ++Copyright++ 1983, 1993
|
||||
* -
|
||||
* Copyright (c) 1983, 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.
|
||||
* -
|
||||
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies, and that
|
||||
* the name of Digital Equipment Corporation not be used in advertising or
|
||||
* publicity pertaining to distribution of the document or software without
|
||||
* specific, written prior permission.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
|
||||
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
* -
|
||||
* --Copyright--
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)inet.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: inet.h,v 1.10 2006/02/01 18:09:47 majka Exp $
|
||||
*/
|
||||
|
||||
#ifndef _ARPA_INET_H_
|
||||
#define _ARPA_INET_H_
|
||||
|
||||
/* External definitions for functions in inet(3), addr2ascii(3) */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/_types.h>
|
||||
#include <stdint.h> /* uint32_t uint16_t */
|
||||
#include <machine/endian.h> /* htonl() and family if (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
#include <sys/_endian.h> /* htonl() and family if (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
#include <netinet/in.h> /* in_addr */
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
in_addr_t inet_addr(const char *);
|
||||
char *inet_ntoa(struct in_addr);
|
||||
const char *inet_ntop(int, const void *, char *, socklen_t);
|
||||
int inet_pton(int, const char *, void *);
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
int ascii2addr(int, const char *, void *);
|
||||
char *addr2ascii(int, const void *, int, char *);
|
||||
int inet_aton(const char *, struct in_addr *);
|
||||
in_addr_t inet_lnaof(struct in_addr);
|
||||
struct in_addr inet_makeaddr(in_addr_t, in_addr_t);
|
||||
in_addr_t inet_netof(struct in_addr);
|
||||
in_addr_t inet_network(const char *);
|
||||
char *inet_net_ntop(int, const void *, int, char *, __darwin_size_t);
|
||||
int inet_net_pton(int, const char *, void *, __darwin_size_t);
|
||||
char *inet_neta(in_addr_t, char *, __darwin_size_t);
|
||||
unsigned int inet_nsap_addr(const char *, unsigned char *, int);
|
||||
char *inet_nsap_ntoa(int, const unsigned char *, char *);
|
||||
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_ARPA_INET_H_ */
|
||||
391
lib/libc/include/x86_64-macos-gnu/bsm/audit.h
Normal file
391
lib/libc/include/x86_64-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 */
|
||||
133
lib/libc/include/x86_64-macos-gnu/copyfile.h
Normal file
133
lib/libc/include/x86_64-macos-gnu/copyfile.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2019 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 _COPYFILE_H_ /* version 0.1 */
|
||||
#define _COPYFILE_H_
|
||||
|
||||
/*
|
||||
* This API facilitates the copying of files and their associated
|
||||
* metadata. There are several open source projects that need
|
||||
* modifications to support preserving extended attributes and ACLs
|
||||
* and this API collapses several hundred lines of modifications into
|
||||
* one or two calls.
|
||||
*/
|
||||
|
||||
/* private */
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
struct _copyfile_state;
|
||||
typedef struct _copyfile_state * copyfile_state_t;
|
||||
typedef uint32_t copyfile_flags_t;
|
||||
|
||||
/* public */
|
||||
|
||||
/* receives:
|
||||
* from path to source file system object
|
||||
* to path to destination file system object
|
||||
* state opaque blob for future extensibility
|
||||
* Must be NULL in current implementation
|
||||
* flags (described below)
|
||||
* returns:
|
||||
* int negative for error
|
||||
*/
|
||||
|
||||
int copyfile(const char *from, const char *to, copyfile_state_t state, copyfile_flags_t flags);
|
||||
int fcopyfile(int from_fd, int to_fd, copyfile_state_t, copyfile_flags_t flags);
|
||||
|
||||
int copyfile_state_free(copyfile_state_t);
|
||||
copyfile_state_t copyfile_state_alloc(void);
|
||||
|
||||
|
||||
int copyfile_state_get(copyfile_state_t s, uint32_t flag, void * dst);
|
||||
int copyfile_state_set(copyfile_state_t s, uint32_t flag, const void * src);
|
||||
|
||||
typedef int (*copyfile_callback_t)(int, int, copyfile_state_t, const char *, const char *, void *);
|
||||
|
||||
#define COPYFILE_STATE_SRC_FD 1
|
||||
#define COPYFILE_STATE_SRC_FILENAME 2
|
||||
#define COPYFILE_STATE_DST_FD 3
|
||||
#define COPYFILE_STATE_DST_FILENAME 4
|
||||
#define COPYFILE_STATE_QUARANTINE 5
|
||||
#define COPYFILE_STATE_STATUS_CB 6
|
||||
#define COPYFILE_STATE_STATUS_CTX 7
|
||||
#define COPYFILE_STATE_COPIED 8
|
||||
#define COPYFILE_STATE_XATTRNAME 9
|
||||
#define COPYFILE_STATE_WAS_CLONED 10
|
||||
|
||||
|
||||
#define COPYFILE_DISABLE_VAR "COPYFILE_DISABLE"
|
||||
|
||||
/* flags for copyfile */
|
||||
|
||||
#define COPYFILE_ACL (1<<0)
|
||||
#define COPYFILE_STAT (1<<1)
|
||||
#define COPYFILE_XATTR (1<<2)
|
||||
#define COPYFILE_DATA (1<<3)
|
||||
|
||||
#define COPYFILE_SECURITY (COPYFILE_STAT | COPYFILE_ACL)
|
||||
#define COPYFILE_METADATA (COPYFILE_SECURITY | COPYFILE_XATTR)
|
||||
#define COPYFILE_ALL (COPYFILE_METADATA | COPYFILE_DATA)
|
||||
|
||||
#define COPYFILE_RECURSIVE (1<<15) /* Descend into hierarchies */
|
||||
#define COPYFILE_CHECK (1<<16) /* return flags for xattr or acls if set */
|
||||
#define COPYFILE_EXCL (1<<17) /* fail if destination exists */
|
||||
#define COPYFILE_NOFOLLOW_SRC (1<<18) /* don't follow if source is a symlink */
|
||||
#define COPYFILE_NOFOLLOW_DST (1<<19) /* don't follow if dst is a symlink */
|
||||
#define COPYFILE_MOVE (1<<20) /* unlink src after copy */
|
||||
#define COPYFILE_UNLINK (1<<21) /* unlink dst before copy */
|
||||
#define COPYFILE_NOFOLLOW (COPYFILE_NOFOLLOW_SRC | COPYFILE_NOFOLLOW_DST)
|
||||
|
||||
#define COPYFILE_PACK (1<<22)
|
||||
#define COPYFILE_UNPACK (1<<23)
|
||||
|
||||
#define COPYFILE_CLONE (1<<24)
|
||||
#define COPYFILE_CLONE_FORCE (1<<25)
|
||||
|
||||
#define COPYFILE_RUN_IN_PLACE (1<<26)
|
||||
|
||||
#define COPYFILE_DATA_SPARSE (1<<27)
|
||||
|
||||
#define COPYFILE_PRESERVE_DST_TRACKED (1<<28)
|
||||
|
||||
#define COPYFILE_VERBOSE (1<<30)
|
||||
|
||||
#define COPYFILE_RECURSE_ERROR 0
|
||||
#define COPYFILE_RECURSE_FILE 1
|
||||
#define COPYFILE_RECURSE_DIR 2
|
||||
#define COPYFILE_RECURSE_DIR_CLEANUP 3
|
||||
#define COPYFILE_COPY_DATA 4
|
||||
#define COPYFILE_COPY_XATTR 5
|
||||
|
||||
#define COPYFILE_START 1
|
||||
#define COPYFILE_FINISH 2
|
||||
#define COPYFILE_ERR 3
|
||||
#define COPYFILE_PROGRESS 4
|
||||
|
||||
#define COPYFILE_CONTINUE 0
|
||||
#define COPYFILE_SKIP 1
|
||||
#define COPYFILE_QUIT 2
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _COPYFILE_H_ */
|
||||
55
lib/libc/include/x86_64-macos-gnu/cpio.h
Normal file
55
lib/libc/include/x86_64-macos-gnu/cpio.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*-
|
||||
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
* $FreeBSD: src/include/cpio.h,v 1.1 2002/08/01 07:18:38 mike Exp $
|
||||
*/
|
||||
|
||||
#ifndef _CPIO_H_
|
||||
#define _CPIO_H_
|
||||
|
||||
#define C_ISSOCK 0140000 /* Socket. */
|
||||
#define C_ISLNK 0120000 /* Symbolic link. */
|
||||
#define C_ISCTG 0110000 /* Reserved. */
|
||||
#define C_ISREG 0100000 /* Regular file. */
|
||||
#define C_ISBLK 0060000 /* Block special. */
|
||||
#define C_ISDIR 0040000 /* Directory. */
|
||||
#define C_ISCHR 0020000 /* Character special. */
|
||||
#define C_ISFIFO 0010000 /* FIFO. */
|
||||
#define C_ISUID 0004000 /* Set user ID. */
|
||||
#define C_ISGID 0002000 /* Set group ID. */
|
||||
#define C_ISVTX 0001000 /* On directories, restricted deletion flag. */
|
||||
#define C_IRUSR 0000400 /* Read by owner. */
|
||||
#define C_IWUSR 0000200 /* Write by owner. */
|
||||
#define C_IXUSR 0000100 /* Execute by owner. */
|
||||
#define C_IRGRP 0000040 /* Read by group. */
|
||||
#define C_IWGRP 0000020 /* Write by group. */
|
||||
#define C_IXGRP 0000010 /* Execute by group. */
|
||||
#define C_IROTH 0000004 /* Read by others. */
|
||||
#define C_IWOTH 0000002 /* Write by others. */
|
||||
#define C_IXOTH 0000001 /* Execute by others. */
|
||||
|
||||
#define MAGIC "070707"
|
||||
|
||||
#endif /* _CPIO_H_ */
|
||||
47
lib/libc/include/x86_64-macos-gnu/crt_externs.h
Normal file
47
lib/libc/include/x86_64-macos-gnu/crt_externs.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved
|
||||
*/
|
||||
|
||||
/*
|
||||
** Prototypes for the functions to get environment information in
|
||||
** the world of dynamic libraries. Lifted from .c file of same name.
|
||||
** Fri Jun 23 12:56:47 PDT 1995
|
||||
** AOF (afreier@next.com)
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern char ***_NSGetArgv(void);
|
||||
extern int *_NSGetArgc(void);
|
||||
extern char ***_NSGetEnviron(void);
|
||||
extern char **_NSGetProgname(void);
|
||||
#ifdef __LP64__
|
||||
extern struct mach_header_64 *
|
||||
#else /* !__LP64__ */
|
||||
extern struct mach_header *
|
||||
#endif /* __LP64__ */
|
||||
_NSGetMachExecuteHeader(void);
|
||||
__END_DECLS
|
||||
118
lib/libc/include/x86_64-macos-gnu/device/device_types.h
Normal file
118
lib/libc/include/x86_64-macos-gnu/device/device_types.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2004 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 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.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
/*
|
||||
* Author: David B. Golub, Carnegie Mellon University
|
||||
* Date: 3/89
|
||||
*/
|
||||
|
||||
#ifndef DEVICE_TYPES_H
|
||||
#define DEVICE_TYPES_H
|
||||
|
||||
/*
|
||||
* Types for device interface.
|
||||
*/
|
||||
#include <mach/std_types.h>
|
||||
#include <mach/mach_types.h>
|
||||
#include <mach/message.h>
|
||||
#include <mach/port.h>
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* IO buffer - out-of-line array of characters.
|
||||
*/
|
||||
typedef char * io_buf_ptr_t;
|
||||
|
||||
/*
|
||||
* Some types for IOKit.
|
||||
*/
|
||||
|
||||
#ifdef IOKIT
|
||||
|
||||
/* must match device_types.defs */
|
||||
typedef char io_name_t[128];
|
||||
typedef char io_string_t[512];
|
||||
typedef char io_string_inband_t[4096];
|
||||
typedef char io_struct_inband_t[4096];
|
||||
|
||||
#if __LP64__
|
||||
typedef uint64_t io_user_scalar_t;
|
||||
typedef uint64_t io_user_reference_t;
|
||||
typedef io_user_scalar_t io_scalar_inband_t[16];
|
||||
typedef io_user_reference_t io_async_ref_t[8];
|
||||
typedef io_user_scalar_t io_scalar_inband64_t[16];
|
||||
typedef io_user_reference_t io_async_ref64_t[8];
|
||||
#else
|
||||
typedef int io_user_scalar_t;
|
||||
typedef natural_t io_user_reference_t;
|
||||
typedef io_user_scalar_t io_scalar_inband_t[16];
|
||||
typedef io_user_reference_t io_async_ref_t[8];
|
||||
typedef uint64_t io_scalar_inband64_t[16];
|
||||
typedef uint64_t io_async_ref64_t[8];
|
||||
#endif // __LP64__
|
||||
|
||||
|
||||
#ifndef __IOKIT_PORTS_DEFINED__
|
||||
#define __IOKIT_PORTS_DEFINED__
|
||||
typedef mach_port_t io_object_t;
|
||||
#endif /* __IOKIT_PORTS_DEFINED__ */
|
||||
|
||||
|
||||
#endif /* IOKIT */
|
||||
|
||||
#endif /* DEVICE_TYPES_H */
|
||||
191
lib/libc/include/x86_64-macos-gnu/dirent.h
Normal file
191
lib/libc/include/x86_64-macos-gnu/dirent.h
Normal file
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2002-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@
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 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.
|
||||
*
|
||||
* @(#)dirent.h 8.2 (Berkeley) 7/28/94
|
||||
*/
|
||||
|
||||
#ifndef _DIRENT_H_
|
||||
#define _DIRENT_H_
|
||||
|
||||
/*
|
||||
* The kernel defines the format of directory entries
|
||||
*/
|
||||
#include <_types.h>
|
||||
#include <sys/dirent.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <Availability.h>
|
||||
#include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_mutex_t */
|
||||
|
||||
struct _telldir; /* forward reference */
|
||||
|
||||
/* structure describing an open directory. */
|
||||
typedef struct {
|
||||
int __dd_fd; /* file descriptor associated with directory */
|
||||
long __dd_loc; /* offset in current buffer */
|
||||
long __dd_size; /* amount of data returned */
|
||||
char *__dd_buf; /* data buffer */
|
||||
int __dd_len; /* size of data buffer */
|
||||
long __dd_seek; /* magic cookie returned */
|
||||
__unused long __padding; /* (__dd_rewind space left for bincompat) */
|
||||
int __dd_flags; /* flags for readdir */
|
||||
__darwin_pthread_mutex_t __dd_lock; /* for thread locking */
|
||||
struct _telldir *__dd_td; /* telldir position recording */
|
||||
} DIR;
|
||||
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
|
||||
|
||||
/* definitions for library routines operating on directories. */
|
||||
#define DIRBLKSIZ 1024
|
||||
|
||||
/* flags for opendir2 */
|
||||
#define DTF_HIDEW 0x0001 /* hide whiteout entries */
|
||||
#define DTF_NODUP 0x0002 /* don't return duplicate names */
|
||||
#define DTF_REWIND 0x0004 /* rewind after reading union stack */
|
||||
#define __DTF_READALL 0x0008 /* everything has been read */
|
||||
#define __DTF_SKIPREAD 0x0010 /* assume internal buffer is populated */
|
||||
#define __DTF_ATEND 0x0020 /* there's nothing more to read in the kernel */
|
||||
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
|
||||
|
||||
#ifndef KERNEL
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int closedir(DIR *) __DARWIN_ALIAS(closedir);
|
||||
|
||||
DIR *opendir(const char *) __DARWIN_ALIAS_I(opendir);
|
||||
|
||||
struct dirent *readdir(DIR *) __DARWIN_INODE64(readdir);
|
||||
int readdir_r(DIR *, struct dirent *, struct dirent **) __DARWIN_INODE64(readdir_r);
|
||||
|
||||
void rewinddir(DIR *) __DARWIN_ALIAS_I(rewinddir);
|
||||
|
||||
void seekdir(DIR *, long) __DARWIN_ALIAS_I(seekdir);
|
||||
|
||||
long telldir(DIR *) __DARWIN_ALIAS_I(telldir);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
/* Additional functionality provided by:
|
||||
* POSIX.1-2008
|
||||
*/
|
||||
|
||||
#if __DARWIN_C_LEVEL >= 200809L
|
||||
__BEGIN_DECLS
|
||||
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
|
||||
DIR *fdopendir(int) __DARWIN_ALIAS_I(fdopendir);
|
||||
|
||||
int alphasort(const struct dirent **, const struct dirent **) __DARWIN_INODE64(alphasort);
|
||||
|
||||
#if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8) || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#define dirfd(dirp) ({ \
|
||||
DIR *_dirp = (dirp); \
|
||||
int ret = -1; \
|
||||
if (_dirp == NULL || _dirp->__dd_fd < 0) \
|
||||
errno = EINVAL; \
|
||||
else \
|
||||
ret = _dirp->__dd_fd; \
|
||||
ret; \
|
||||
})
|
||||
#else
|
||||
int dirfd(DIR *dirp) __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_6_0);
|
||||
#endif
|
||||
|
||||
int scandir(const char *, struct dirent ***,
|
||||
int (*)(const struct dirent *), int (*)(const struct dirent **, const struct dirent **)) __DARWIN_INODE64(scandir);
|
||||
#ifdef __BLOCKS__
|
||||
#if __has_attribute(noescape)
|
||||
#define __scandir_noescape __attribute__((__noescape__))
|
||||
#else
|
||||
#define __scandir_noescape
|
||||
#endif
|
||||
|
||||
int scandir_b(const char *, struct dirent ***,
|
||||
int (^)(const struct dirent *) __scandir_noescape,
|
||||
int (^)(const struct dirent **, const struct dirent **) __scandir_noescape)
|
||||
__DARWIN_INODE64(scandir_b) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
__END_DECLS
|
||||
#endif /* __DARWIN_C_LEVEL >= 200809L */
|
||||
|
||||
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
|
||||
__BEGIN_DECLS
|
||||
|
||||
int getdirentries(int, char *, int, long *)
|
||||
|
||||
#if __DARWIN_64_BIT_INO_T
|
||||
/*
|
||||
* getdirentries() doesn't work when 64-bit inodes is in effect, so we
|
||||
* generate a link error.
|
||||
*/
|
||||
__asm("_getdirentries_is_not_available_when_64_bit_inodes_are_in_effect")
|
||||
#else /* !__DARWIN_64_BIT_INO_T */
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_6, __IPHONE_2_0,__IPHONE_2_0)
|
||||
#endif /* __DARWIN_64_BIT_INO_T */
|
||||
;
|
||||
|
||||
DIR *__opendir2(const char *, int) __DARWIN_ALIAS_I(__opendir2);
|
||||
|
||||
__END_DECLS
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
|
||||
|
||||
#endif /* !KERNEL */
|
||||
|
||||
#endif /* !_DIRENT_H_ */
|
||||
306
lib/libc/include/x86_64-macos-gnu/dispatch/base.h
Normal file
306
lib/libc/include/x86_64-macos-gnu/dispatch/base.h
Normal file
@@ -0,0 +1,306 @@
|
||||
/*
|
||||
* 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_BASE__
|
||||
#define __DISPATCH_BASE__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
#if __GNUC__
|
||||
#define DISPATCH_NORETURN __attribute__((__noreturn__))
|
||||
#define DISPATCH_NOTHROW __attribute__((__nothrow__))
|
||||
#define DISPATCH_NONNULL1 __attribute__((__nonnull__(1)))
|
||||
#define DISPATCH_NONNULL2 __attribute__((__nonnull__(2)))
|
||||
#define DISPATCH_NONNULL3 __attribute__((__nonnull__(3)))
|
||||
#define DISPATCH_NONNULL4 __attribute__((__nonnull__(4)))
|
||||
#define DISPATCH_NONNULL5 __attribute__((__nonnull__(5)))
|
||||
#define DISPATCH_NONNULL6 __attribute__((__nonnull__(6)))
|
||||
#define DISPATCH_NONNULL7 __attribute__((__nonnull__(7)))
|
||||
#if __clang__ && __clang_major__ < 3
|
||||
// rdar://problem/6857843
|
||||
#define DISPATCH_NONNULL_ALL
|
||||
#else
|
||||
#define DISPATCH_NONNULL_ALL __attribute__((__nonnull__))
|
||||
#endif
|
||||
#define DISPATCH_SENTINEL __attribute__((__sentinel__))
|
||||
#define DISPATCH_PURE __attribute__((__pure__))
|
||||
#define DISPATCH_CONST __attribute__((__const__))
|
||||
#define DISPATCH_WARN_RESULT __attribute__((__warn_unused_result__))
|
||||
#define DISPATCH_MALLOC __attribute__((__malloc__))
|
||||
#define DISPATCH_ALWAYS_INLINE __attribute__((__always_inline__))
|
||||
#define DISPATCH_UNAVAILABLE __attribute__((__unavailable__))
|
||||
#define DISPATCH_UNAVAILABLE_MSG(msg) __attribute__((__unavailable__(msg)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define DISPATCH_NORETURN __declspec(noreturn)
|
||||
#define DISPATCH_NOTHROW __declspec(nothrow)
|
||||
#define DISPATCH_NONNULL1
|
||||
#define DISPATCH_NONNULL2
|
||||
#define DISPATCH_NONNULL3
|
||||
#define DISPATCH_NONNULL4
|
||||
#define DISPATCH_NONNULL5
|
||||
#define DISPATCH_NONNULL6
|
||||
#define DISPATCH_NONNULL7
|
||||
#define DISPATCH_NONNULL_ALL
|
||||
#define DISPATCH_SENTINEL
|
||||
#define DISPATCH_PURE
|
||||
#define DISPATCH_CONST
|
||||
#if (_MSC_VER >= 1700)
|
||||
#define DISPATCH_WARN_RESULT _Check_return_
|
||||
#else
|
||||
#define DISPATCH_WARN_RESULT
|
||||
#endif
|
||||
#define DISPATCH_MALLOC
|
||||
#define DISPATCH_ALWAYS_INLINE __forceinline
|
||||
#define DISPATCH_UNAVAILABLE
|
||||
#define DISPATCH_UNAVAILABLE_MSG(msg)
|
||||
#else
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NORETURN
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NOTHROW
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NONNULL1
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NONNULL2
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NONNULL3
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NONNULL4
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NONNULL5
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NONNULL6
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NONNULL7
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_NONNULL_ALL
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_SENTINEL
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_PURE
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_CONST
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_WARN_RESULT
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_MALLOC
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_ALWAYS_INLINE
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_UNAVAILABLE
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_UNAVAILABLE_MSG(msg)
|
||||
#endif
|
||||
|
||||
#define DISPATCH_LINUX_UNAVAILABLE()
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define DISPATCH_FREEBSD_UNAVAILABLE() \
|
||||
DISPATCH_UNAVAILABLE_MSG( \
|
||||
"This interface is unavailable on FreeBSD systems")
|
||||
#else
|
||||
#define DISPATCH_FREEBSD_UNAVAILABLE()
|
||||
#endif
|
||||
|
||||
#ifndef DISPATCH_ALIAS_V2
|
||||
#if TARGET_OS_MAC
|
||||
#define DISPATCH_ALIAS_V2(sym) __asm__("_" #sym "$V2")
|
||||
#else
|
||||
#define DISPATCH_ALIAS_V2(sym)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(__cplusplus)
|
||||
#define DISPATCH_EXPORT extern "C" __declspec(dllimport)
|
||||
#else
|
||||
#define DISPATCH_EXPORT extern __declspec(dllimport)
|
||||
#endif
|
||||
#elif __GNUC__
|
||||
#define DISPATCH_EXPORT extern __attribute__((visibility("default")))
|
||||
#else
|
||||
#define DISPATCH_EXPORT extern
|
||||
#endif
|
||||
|
||||
#if __GNUC__
|
||||
#define DISPATCH_INLINE static __inline__
|
||||
#else
|
||||
#define DISPATCH_INLINE static inline
|
||||
#endif
|
||||
|
||||
#if __GNUC__
|
||||
#define DISPATCH_EXPECT(x, v) __builtin_expect((x), (v))
|
||||
#define dispatch_compiler_barrier() __asm__ __volatile__("" ::: "memory")
|
||||
#else
|
||||
#define DISPATCH_EXPECT(x, v) (x)
|
||||
#define dispatch_compiler_barrier() do { } while (0)
|
||||
#endif
|
||||
|
||||
#if __has_attribute(not_tail_called)
|
||||
#define DISPATCH_NOT_TAIL_CALLED __attribute__((__not_tail_called__))
|
||||
#else
|
||||
#define DISPATCH_NOT_TAIL_CALLED
|
||||
#endif
|
||||
|
||||
#if __has_builtin(__builtin_assume)
|
||||
#define DISPATCH_COMPILER_CAN_ASSUME(expr) __builtin_assume(expr)
|
||||
#else
|
||||
#define DISPATCH_COMPILER_CAN_ASSUME(expr) ((void)(expr))
|
||||
#endif
|
||||
|
||||
#if __has_attribute(noescape)
|
||||
#define DISPATCH_NOESCAPE __attribute__((__noescape__))
|
||||
#else
|
||||
#define DISPATCH_NOESCAPE
|
||||
#endif
|
||||
|
||||
#if __has_attribute(cold)
|
||||
#define DISPATCH_COLD __attribute__((__cold__))
|
||||
#else
|
||||
#define DISPATCH_COLD
|
||||
#endif
|
||||
|
||||
#if __has_feature(assume_nonnull)
|
||||
#define DISPATCH_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
|
||||
#define DISPATCH_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
|
||||
#else
|
||||
#define DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
#define DISPATCH_ASSUME_NONNULL_END
|
||||
#endif
|
||||
|
||||
#if !__has_feature(nullability)
|
||||
#ifndef _Nullable
|
||||
#define _Nullable
|
||||
#endif
|
||||
#ifndef _Nonnull
|
||||
#define _Nonnull
|
||||
#endif
|
||||
#ifndef _Null_unspecified
|
||||
#define _Null_unspecified
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DISPATCH_RETURNS_RETAINED_BLOCK
|
||||
#if __has_attribute(ns_returns_retained)
|
||||
#define DISPATCH_RETURNS_RETAINED_BLOCK __attribute__((__ns_returns_retained__))
|
||||
#else
|
||||
#define DISPATCH_RETURNS_RETAINED_BLOCK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __has_attribute(enum_extensibility)
|
||||
#define __DISPATCH_ENUM_ATTR __attribute__((__enum_extensibility__(open)))
|
||||
#define __DISPATCH_ENUM_ATTR_CLOSED __attribute__((__enum_extensibility__(closed)))
|
||||
#else
|
||||
#define __DISPATCH_ENUM_ATTR
|
||||
#define __DISPATCH_ENUM_ATTR_CLOSED
|
||||
#endif // __has_attribute(enum_extensibility)
|
||||
|
||||
#if __has_attribute(flag_enum)
|
||||
#define __DISPATCH_OPTIONS_ATTR __attribute__((__flag_enum__))
|
||||
#else
|
||||
#define __DISPATCH_OPTIONS_ATTR
|
||||
#endif // __has_attribute(flag_enum)
|
||||
|
||||
|
||||
#if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums) || \
|
||||
__has_extension(cxx_fixed_enum) || defined(_WIN32)
|
||||
#define DISPATCH_ENUM(name, type, ...) \
|
||||
typedef enum : type { __VA_ARGS__ } __DISPATCH_ENUM_ATTR name##_t
|
||||
#define DISPATCH_OPTIONS(name, type, ...) \
|
||||
typedef enum : type { __VA_ARGS__ } __DISPATCH_OPTIONS_ATTR __DISPATCH_ENUM_ATTR name##_t
|
||||
#else
|
||||
#define DISPATCH_ENUM(name, type, ...) \
|
||||
enum { __VA_ARGS__ } __DISPATCH_ENUM_ATTR; typedef type name##_t
|
||||
#define DISPATCH_OPTIONS(name, type, ...) \
|
||||
enum { __VA_ARGS__ } __DISPATCH_OPTIONS_ATTR __DISPATCH_ENUM_ATTR; typedef type name##_t
|
||||
#endif // __has_feature(objc_fixed_enum) ...
|
||||
|
||||
|
||||
|
||||
#if __has_feature(enumerator_attributes)
|
||||
#define DISPATCH_ENUM_API_AVAILABLE(...) API_AVAILABLE(__VA_ARGS__)
|
||||
#define DISPATCH_ENUM_API_DEPRECATED(...) API_DEPRECATED(__VA_ARGS__)
|
||||
#define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...) \
|
||||
API_DEPRECATED_WITH_REPLACEMENT(__VA_ARGS__)
|
||||
#else
|
||||
#define DISPATCH_ENUM_API_AVAILABLE(...)
|
||||
#define DISPATCH_ENUM_API_DEPRECATED(...)
|
||||
#define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...)
|
||||
#endif
|
||||
|
||||
#ifdef __swift__
|
||||
#define DISPATCH_SWIFT3_OVERLAY 1
|
||||
#else // __swift__
|
||||
#define DISPATCH_SWIFT3_OVERLAY 0
|
||||
#endif // __swift__
|
||||
|
||||
#if __has_feature(attribute_availability_swift)
|
||||
#define DISPATCH_SWIFT_UNAVAILABLE(_msg) \
|
||||
__attribute__((__availability__(swift, unavailable, message=_msg)))
|
||||
#else
|
||||
#define DISPATCH_SWIFT_UNAVAILABLE(_msg)
|
||||
#endif
|
||||
|
||||
#if DISPATCH_SWIFT3_OVERLAY
|
||||
#define DISPATCH_SWIFT3_UNAVAILABLE(_msg) DISPATCH_SWIFT_UNAVAILABLE(_msg)
|
||||
#else
|
||||
#define DISPATCH_SWIFT3_UNAVAILABLE(_msg)
|
||||
#endif
|
||||
|
||||
#if __has_attribute(swift_private)
|
||||
#define DISPATCH_REFINED_FOR_SWIFT __attribute__((__swift_private__))
|
||||
#else
|
||||
#define DISPATCH_REFINED_FOR_SWIFT
|
||||
#endif
|
||||
|
||||
#if __has_attribute(swift_name)
|
||||
#define DISPATCH_SWIFT_NAME(_name) __attribute__((__swift_name__(#_name)))
|
||||
#else
|
||||
#define DISPATCH_SWIFT_NAME(_name)
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define DISPATCH_TRANSPARENT_UNION __attribute__((__transparent_union__))
|
||||
#else
|
||||
#define DISPATCH_TRANSPARENT_UNION
|
||||
#endif
|
||||
|
||||
typedef void (*dispatch_function_t)(void *_Nullable);
|
||||
|
||||
#endif
|
||||
428
lib/libc/include/x86_64-macos-gnu/dispatch/block.h
Normal file
428
lib/libc/include/x86_64-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__
|
||||
278
lib/libc/include/x86_64-macos-gnu/dispatch/data.h
Normal file
278
lib/libc/include/x86_64-macos-gnu/dispatch/data.h
Normal file
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
* Copyright (c) 2009-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_DATA__
|
||||
#define __DISPATCH_DATA__
|
||||
|
||||
#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
|
||||
|
||||
/*! @header
|
||||
* Dispatch data objects describe contiguous or sparse regions of memory that
|
||||
* may be managed by the system or by the application.
|
||||
* Dispatch data objects are immutable, any direct access to memory regions
|
||||
* represented by dispatch objects must not modify that memory.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_data_t
|
||||
* A dispatch object representing memory regions.
|
||||
*/
|
||||
DISPATCH_DATA_DECL(dispatch_data);
|
||||
|
||||
/*!
|
||||
* @var dispatch_data_empty
|
||||
* @discussion The singleton dispatch data object representing a zero-length
|
||||
* memory region.
|
||||
*/
|
||||
#define dispatch_data_empty \
|
||||
DISPATCH_GLOBAL_OBJECT(dispatch_data_t, _dispatch_data_empty)
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT struct dispatch_data_s _dispatch_data_empty;
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_DATA_DESTRUCTOR_DEFAULT
|
||||
* @discussion The default destructor for dispatch data objects.
|
||||
* Used at data object creation to indicate that the supplied buffer should
|
||||
* be copied into internal storage managed by the system.
|
||||
*/
|
||||
#define DISPATCH_DATA_DESTRUCTOR_DEFAULT NULL
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*! @parseOnly */
|
||||
#define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \
|
||||
DISPATCH_EXPORT const dispatch_block_t _dispatch_data_destructor_##name
|
||||
#else
|
||||
#define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \
|
||||
DISPATCH_EXPORT const dispatch_function_t \
|
||||
_dispatch_data_destructor_##name
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_DATA_DESTRUCTOR_FREE
|
||||
* @discussion The destructor for dispatch data objects created from a malloc'd
|
||||
* buffer. Used at data object creation to indicate that the supplied buffer
|
||||
* was allocated by the malloc() family and should be destroyed with free(3).
|
||||
*/
|
||||
#define DISPATCH_DATA_DESTRUCTOR_FREE (_dispatch_data_destructor_free)
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(free);
|
||||
|
||||
/*!
|
||||
* @const DISPATCH_DATA_DESTRUCTOR_MUNMAP
|
||||
* @discussion The destructor for dispatch data objects that have been created
|
||||
* from buffers that require deallocation with munmap(2).
|
||||
*/
|
||||
#define DISPATCH_DATA_DESTRUCTOR_MUNMAP (_dispatch_data_destructor_munmap)
|
||||
API_AVAILABLE(macos(10.9), ios(7.0))
|
||||
DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(munmap);
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @function dispatch_data_create
|
||||
* Creates a dispatch data object from the given contiguous buffer of memory. If
|
||||
* a non-default destructor is provided, ownership of the buffer remains with
|
||||
* the caller (i.e. the bytes will not be copied). The last release of the data
|
||||
* object will result in the invocation of the specified destructor on the
|
||||
* specified queue to free the buffer.
|
||||
*
|
||||
* If the DISPATCH_DATA_DESTRUCTOR_FREE destructor is provided the buffer will
|
||||
* be freed via free(3) and the queue argument ignored.
|
||||
*
|
||||
* If the DISPATCH_DATA_DESTRUCTOR_DEFAULT destructor is provided, data object
|
||||
* creation will copy the buffer into internal memory managed by the system.
|
||||
*
|
||||
* @param buffer A contiguous buffer of data.
|
||||
* @param size The size of the contiguous buffer of data.
|
||||
* @param queue The queue to which the destructor should be submitted.
|
||||
* @param destructor The destructor responsible for freeing the data when it
|
||||
* is no longer needed.
|
||||
* @result A newly created dispatch data object.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_data_t
|
||||
dispatch_data_create(const void *buffer,
|
||||
size_t size,
|
||||
dispatch_queue_t _Nullable queue,
|
||||
dispatch_block_t _Nullable destructor);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_data_get_size
|
||||
* Returns the logical size of the memory region(s) represented by the specified
|
||||
* dispatch data object.
|
||||
*
|
||||
* @param data The dispatch data object to query.
|
||||
* @result The number of bytes represented by the data object.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_PURE DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
size_t
|
||||
dispatch_data_get_size(dispatch_data_t data);
|
||||
|
||||
/*!
|
||||
* @function dispatch_data_create_map
|
||||
* Maps the memory represented by the specified dispatch data object as a single
|
||||
* contiguous memory region and returns a new data object representing it.
|
||||
* If non-NULL references to a pointer and a size variable are provided, they
|
||||
* are filled with the location and extent of that region. These allow direct
|
||||
* read access to the represented memory, but are only valid until the returned
|
||||
* object is released. Under ARC, if that object is held in a variable with
|
||||
* automatic storage, care needs to be taken to ensure that it is not released
|
||||
* by the compiler before memory access via the pointer has been completed.
|
||||
*
|
||||
* @param data The dispatch data object to map.
|
||||
* @param buffer_ptr A pointer to a pointer variable to be filled with the
|
||||
* location of the mapped contiguous memory region, or
|
||||
* NULL.
|
||||
* @param size_ptr A pointer to a size_t variable to be filled with the
|
||||
* size of the mapped contiguous memory region, or NULL.
|
||||
* @result A newly created dispatch data object.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_data_t
|
||||
dispatch_data_create_map(dispatch_data_t data,
|
||||
const void *_Nullable *_Nullable buffer_ptr,
|
||||
size_t *_Nullable size_ptr);
|
||||
|
||||
/*!
|
||||
* @function dispatch_data_create_concat
|
||||
* Returns a new dispatch data object representing the concatenation of the
|
||||
* specified data objects. Those objects may be released by the application
|
||||
* after the call returns (however, the system might not deallocate the memory
|
||||
* region(s) described by them until the newly created object has also been
|
||||
* released).
|
||||
*
|
||||
* @param data1 The data object representing the region(s) of memory to place
|
||||
* at the beginning of the newly created object.
|
||||
* @param data2 The data object representing the region(s) of memory to place
|
||||
* at the end of the newly created object.
|
||||
* @result A newly created object representing the concatenation of the
|
||||
* data1 and data2 objects.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_RETURNS_RETAINED
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_data_t
|
||||
dispatch_data_create_concat(dispatch_data_t data1, dispatch_data_t data2);
|
||||
|
||||
/*!
|
||||
* @function dispatch_data_create_subrange
|
||||
* Returns a new dispatch data object representing a subrange of the specified
|
||||
* data object, which may be released by the application after the call returns
|
||||
* (however, the system might not deallocate the memory region(s) described by
|
||||
* that object until the newly created object has also been released).
|
||||
*
|
||||
* @param data The data object representing the region(s) of memory to
|
||||
* create a subrange of.
|
||||
* @param offset The offset into the data object where the subrange
|
||||
* starts.
|
||||
* @param length The length of the range.
|
||||
* @result A newly created object representing the specified
|
||||
* subrange of the data object.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_data_t
|
||||
dispatch_data_create_subrange(dispatch_data_t data,
|
||||
size_t offset,
|
||||
size_t length);
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @typedef dispatch_data_applier_t
|
||||
* A block to be invoked for every contiguous memory region in a data object.
|
||||
*
|
||||
* @param region A data object representing the current region.
|
||||
* @param offset The logical offset of the current region to the start
|
||||
* of the data object.
|
||||
* @param buffer The location of the memory for the current region.
|
||||
* @param size The size of the memory for the current region.
|
||||
* @result A Boolean indicating whether traversal should continue.
|
||||
*/
|
||||
typedef bool (^dispatch_data_applier_t)(dispatch_data_t region,
|
||||
size_t offset,
|
||||
const void *buffer,
|
||||
size_t size);
|
||||
|
||||
/*!
|
||||
* @function dispatch_data_apply
|
||||
* Traverse the memory regions represented by the specified dispatch data object
|
||||
* in logical order and invoke the specified block once for every contiguous
|
||||
* memory region encountered.
|
||||
*
|
||||
* Each invocation of the block is passed a data object representing the current
|
||||
* region and its logical offset, along with the memory location and extent of
|
||||
* the region. These allow direct read access to the memory region, but are only
|
||||
* valid until the passed-in region object is released. Note that the region
|
||||
* object is released by the system when the block returns, it is the
|
||||
* responsibility of the application to retain it if the region object or the
|
||||
* associated memory location are needed after the block returns.
|
||||
*
|
||||
* @param data The data object to traverse.
|
||||
* @param applier The block to be invoked for every contiguous memory
|
||||
* region in the data object.
|
||||
* @result A Boolean indicating whether traversal completed
|
||||
* successfully.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
bool
|
||||
dispatch_data_apply(dispatch_data_t data,
|
||||
DISPATCH_NOESCAPE dispatch_data_applier_t applier);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_data_copy_region
|
||||
* Finds the contiguous memory region containing the specified location among
|
||||
* the regions represented by the specified object and returns a copy of the
|
||||
* internal dispatch data object representing that region along with its logical
|
||||
* offset in the specified object.
|
||||
*
|
||||
* @param data The dispatch data object to query.
|
||||
* @param location The logical position in the data object to query.
|
||||
* @param offset_ptr A pointer to a size_t variable to be filled with the
|
||||
* logical offset of the returned region object to the
|
||||
* start of the queried data object.
|
||||
* @result A newly created dispatch data object.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_RETURNS_RETAINED
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_data_t
|
||||
dispatch_data_copy_region(dispatch_data_t data,
|
||||
size_t location,
|
||||
size_t *offset_ptr);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif /* __DISPATCH_DATA__ */
|
||||
80
lib/libc/include/x86_64-macos-gnu/dispatch/dispatch.h
Normal file
80
lib/libc/include/x86_64-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/x86_64-macos-gnu/dispatch/group.h
Normal file
279
lib/libc/include/x86_64-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
|
||||
597
lib/libc/include/x86_64-macos-gnu/dispatch/io.h
Normal file
597
lib/libc/include/x86_64-macos-gnu/dispatch/io.h
Normal file
@@ -0,0 +1,597 @@
|
||||
/*
|
||||
* Copyright (c) 2009-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_IO__
|
||||
#define __DISPATCH_IO__
|
||||
|
||||
#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
|
||||
|
||||
/*! @header
|
||||
* Dispatch I/O provides both stream and random access asynchronous read and
|
||||
* write operations on file descriptors. One or more dispatch I/O channels may
|
||||
* be created from a file descriptor as either the DISPATCH_IO_STREAM type or
|
||||
* DISPATCH_IO_RANDOM type. Once a channel has been created the application may
|
||||
* schedule asynchronous read and write operations.
|
||||
*
|
||||
* The application may set policies on the dispatch I/O channel to indicate the
|
||||
* desired frequency of I/O handlers for long-running operations.
|
||||
*
|
||||
* Dispatch I/O also provides a memory management model for I/O buffers that
|
||||
* avoids unnecessary copying of data when pipelined between channels. Dispatch
|
||||
* I/O monitors the overall memory pressure and I/O access patterns for the
|
||||
* application to optimize resource utilization.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_fd_t
|
||||
* Native file descriptor type for the platform.
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
typedef intptr_t dispatch_fd_t;
|
||||
#else
|
||||
typedef int dispatch_fd_t;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @functiongroup Dispatch I/O Convenience API
|
||||
* Convenience wrappers around the dispatch I/O channel API, with simpler
|
||||
* callback handler semantics and no explicit management of channel objects.
|
||||
* File descriptors passed to the convenience API are treated as streams, and
|
||||
* scheduling multiple operations on one file descriptor via the convenience API
|
||||
* may incur more overhead than by using the dispatch I/O channel API directly.
|
||||
*/
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @function dispatch_read
|
||||
* Schedule a read operation for asynchronous execution on the specified file
|
||||
* descriptor. The specified handler is enqueued with the data read from the
|
||||
* file descriptor when the operation has completed or an error occurs.
|
||||
*
|
||||
* The data object passed to the handler will be automatically released by the
|
||||
* system when the handler returns. It is the responsibility of the application
|
||||
* to retain, concatenate or copy the data object if it is needed after the
|
||||
* handler returns.
|
||||
*
|
||||
* The data object passed to the handler will only contain as much data as is
|
||||
* currently available from the file descriptor (up to the specified length).
|
||||
*
|
||||
* If an unrecoverable error occurs on the file descriptor, the handler will be
|
||||
* enqueued with the appropriate error code along with a data object of any data
|
||||
* that could be read successfully.
|
||||
*
|
||||
* An invocation of the handler with an error code of zero and an empty data
|
||||
* object indicates that EOF was reached.
|
||||
*
|
||||
* The system takes control of the file descriptor until the handler is
|
||||
* enqueued, and during this time file descriptor flags such as O_NONBLOCK will
|
||||
* be modified by the system on behalf of the application. It is an error for
|
||||
* the application to modify a file descriptor directly while it is under the
|
||||
* control of the system, but it may create additional dispatch I/O convenience
|
||||
* operations or dispatch I/O channels associated with that file descriptor.
|
||||
*
|
||||
* @param fd The file descriptor from which to read the data.
|
||||
* @param length The length of data to read from the file descriptor,
|
||||
* or SIZE_MAX to indicate that all of the data currently
|
||||
* available from the file descriptor should be read.
|
||||
* @param queue The dispatch queue to which the handler should be
|
||||
* submitted.
|
||||
* @param handler The handler to enqueue when data is ready to be
|
||||
* delivered.
|
||||
* param data The data read from the file descriptor.
|
||||
* param error An errno condition for the read operation or
|
||||
* zero if the read was successful.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NONNULL4 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_read(dispatch_fd_t fd,
|
||||
size_t length,
|
||||
dispatch_queue_t queue,
|
||||
void (^handler)(dispatch_data_t data, int error));
|
||||
|
||||
/*!
|
||||
* @function dispatch_write
|
||||
* Schedule a write operation for asynchronous execution on the specified file
|
||||
* descriptor. The specified handler is enqueued when the operation has
|
||||
* completed or an error occurs.
|
||||
*
|
||||
* If an unrecoverable error occurs on the file descriptor, the handler will be
|
||||
* enqueued with the appropriate error code along with the data that could not
|
||||
* be successfully written.
|
||||
*
|
||||
* An invocation of the handler with an error code of zero indicates that the
|
||||
* data was fully written to the channel.
|
||||
*
|
||||
* The system takes control of the file descriptor until the handler is
|
||||
* enqueued, and during this time file descriptor flags such as O_NONBLOCK will
|
||||
* be modified by the system on behalf of the application. It is an error for
|
||||
* the application to modify a file descriptor directly while it is under the
|
||||
* control of the system, but it may create additional dispatch I/O convenience
|
||||
* operations or dispatch I/O channels associated with that file descriptor.
|
||||
*
|
||||
* @param fd The file descriptor to which to write the data.
|
||||
* @param data The data object to write to the file descriptor.
|
||||
* @param queue The dispatch queue to which the handler should be
|
||||
* submitted.
|
||||
* @param handler The handler to enqueue when the data has been written.
|
||||
* param data The data that could not be written to the I/O
|
||||
* channel, or NULL.
|
||||
* param error An errno condition for the write operation or
|
||||
* zero if the write was successful.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL3 DISPATCH_NONNULL4
|
||||
DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_write(dispatch_fd_t fd,
|
||||
dispatch_data_t data,
|
||||
dispatch_queue_t queue,
|
||||
void (^handler)(dispatch_data_t _Nullable data, int error));
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @functiongroup Dispatch I/O Channel API
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_io_t
|
||||
* A dispatch I/O channel represents the asynchronous I/O policy applied to a
|
||||
* file descriptor. I/O channels are first class dispatch objects and may be
|
||||
* retained and released, suspended and resumed, etc.
|
||||
*/
|
||||
DISPATCH_DECL(dispatch_io);
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_io_type_t
|
||||
* The type of a dispatch I/O channel:
|
||||
*
|
||||
* @const DISPATCH_IO_STREAM A dispatch I/O channel representing a stream of
|
||||
* bytes. Read and write operations on a channel of this type are performed
|
||||
* serially (in order of creation) and read/write data at the file pointer
|
||||
* position that is current at the time the operation starts executing.
|
||||
* Operations of different type (read vs. write) may be performed simultaneously.
|
||||
* Offsets passed to operations on a channel of this type are ignored.
|
||||
*
|
||||
* @const DISPATCH_IO_RANDOM A dispatch I/O channel representing a random
|
||||
* access file. Read and write operations on a channel of this type may be
|
||||
* performed concurrently and read/write data at the specified offset. Offsets
|
||||
* are interpreted relative to the file pointer position current at the time the
|
||||
* I/O channel is created. Attempting to create a channel of this type for a
|
||||
* file descriptor that is not seekable will result in an error.
|
||||
*/
|
||||
#define DISPATCH_IO_STREAM 0
|
||||
#define DISPATCH_IO_RANDOM 1
|
||||
|
||||
typedef unsigned long dispatch_io_type_t;
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @function dispatch_io_create
|
||||
* Create a dispatch I/O channel associated with a file descriptor. The system
|
||||
* takes control of the file descriptor until the channel is closed, an error
|
||||
* occurs on the file descriptor or all references to the channel are released.
|
||||
* At that time the specified cleanup handler will be enqueued and control over
|
||||
* the file descriptor relinquished.
|
||||
*
|
||||
* While a file descriptor is under the control of a dispatch I/O channel, file
|
||||
* descriptor flags such as O_NONBLOCK will be modified by the system on behalf
|
||||
* of the application. It is an error for the application to modify a file
|
||||
* descriptor directly while it is under the control of a dispatch I/O channel,
|
||||
* but it may create additional channels associated with that file descriptor.
|
||||
*
|
||||
* @param type The desired type of I/O channel (DISPATCH_IO_STREAM
|
||||
* or DISPATCH_IO_RANDOM).
|
||||
* @param fd The file descriptor to associate with the I/O channel.
|
||||
* @param queue The dispatch queue to which the handler should be submitted.
|
||||
* @param cleanup_handler The handler to enqueue when the system
|
||||
* relinquishes control over the file descriptor.
|
||||
* param error An errno condition if control is relinquished
|
||||
* because channel creation failed, zero otherwise.
|
||||
* @result The newly created dispatch I/O channel or NULL if an error
|
||||
* occurred (invalid type specified).
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
|
||||
DISPATCH_NOTHROW
|
||||
dispatch_io_t
|
||||
dispatch_io_create(dispatch_io_type_t type,
|
||||
dispatch_fd_t fd,
|
||||
dispatch_queue_t queue,
|
||||
void (^cleanup_handler)(int error));
|
||||
|
||||
/*!
|
||||
* @function dispatch_io_create_with_path
|
||||
* Create a dispatch I/O channel associated with a path name. The specified
|
||||
* path, oflag and mode parameters will be passed to open(2) when the first I/O
|
||||
* operation on the channel is ready to execute and the resulting file
|
||||
* descriptor will remain open and under the control of the system until the
|
||||
* channel is closed, an error occurs on the file descriptor or all references
|
||||
* to the channel are released. At that time the file descriptor will be closed
|
||||
* and the specified cleanup handler will be enqueued.
|
||||
*
|
||||
* @param type The desired type of I/O channel (DISPATCH_IO_STREAM
|
||||
* or DISPATCH_IO_RANDOM).
|
||||
* @param path The absolute path to associate with the I/O channel.
|
||||
* @param oflag The flags to pass to open(2) when opening the file at
|
||||
* path.
|
||||
* @param mode The mode to pass to open(2) when creating the file at
|
||||
* path (i.e. with flag O_CREAT), zero otherwise.
|
||||
* @param queue The dispatch queue to which the handler should be
|
||||
* submitted.
|
||||
* @param cleanup_handler The handler to enqueue when the system
|
||||
* has closed the file at path.
|
||||
* param error An errno condition if control is relinquished
|
||||
* because channel creation or opening of the
|
||||
* specified file failed, zero otherwise.
|
||||
* @result The newly created dispatch I/O channel or NULL if an error
|
||||
* occurred (invalid type or non-absolute path specified).
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_io_t
|
||||
dispatch_io_create_with_path(dispatch_io_type_t type,
|
||||
const char *path, int oflag, mode_t mode,
|
||||
dispatch_queue_t queue,
|
||||
void (^cleanup_handler)(int error));
|
||||
|
||||
/*!
|
||||
* @function dispatch_io_create_with_io
|
||||
* Create a new dispatch I/O channel from an existing dispatch I/O channel.
|
||||
* The new channel inherits the file descriptor or path name associated with
|
||||
* the existing channel, but not its channel type or policies.
|
||||
*
|
||||
* If the existing channel is associated with a file descriptor, control by the
|
||||
* system over that file descriptor is extended until the new channel is also
|
||||
* closed, an error occurs on the file descriptor, or all references to both
|
||||
* channels are released. At that time the specified cleanup handler will be
|
||||
* enqueued and control over the file descriptor relinquished.
|
||||
*
|
||||
* While a file descriptor is under the control of a dispatch I/O channel, file
|
||||
* descriptor flags such as O_NONBLOCK will be modified by the system on behalf
|
||||
* of the application. It is an error for the application to modify a file
|
||||
* descriptor directly while it is under the control of a dispatch I/O channel,
|
||||
* but it may create additional channels associated with that file descriptor.
|
||||
*
|
||||
* @param type The desired type of I/O channel (DISPATCH_IO_STREAM
|
||||
* or DISPATCH_IO_RANDOM).
|
||||
* @param io The existing channel to create the new I/O channel from.
|
||||
* @param queue The dispatch queue to which the handler should be submitted.
|
||||
* @param cleanup_handler The handler to enqueue when the system
|
||||
* relinquishes control over the file descriptor
|
||||
* (resp. closes the file at path) associated with
|
||||
* the existing channel.
|
||||
* param error An errno condition if control is relinquished
|
||||
* because channel creation failed, zero otherwise.
|
||||
* @result The newly created dispatch I/O channel or NULL if an error
|
||||
* occurred (invalid type specified).
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED
|
||||
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_io_t
|
||||
dispatch_io_create_with_io(dispatch_io_type_t type,
|
||||
dispatch_io_t io,
|
||||
dispatch_queue_t queue,
|
||||
void (^cleanup_handler)(int error));
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_io_handler_t
|
||||
* The prototype of I/O handler blocks for dispatch I/O operations.
|
||||
*
|
||||
* @param done A flag indicating whether the operation is complete.
|
||||
* @param data The data object to be handled.
|
||||
* @param error An errno condition for the operation.
|
||||
*/
|
||||
typedef void (^dispatch_io_handler_t)(bool done, dispatch_data_t _Nullable data,
|
||||
int error);
|
||||
|
||||
/*!
|
||||
* @function dispatch_io_read
|
||||
* Schedule a read operation for asynchronous execution on the specified I/O
|
||||
* channel. The I/O handler is enqueued one or more times depending on the
|
||||
* general load of the system and the policy specified on the I/O channel.
|
||||
*
|
||||
* Any data read from the channel is described by the dispatch data object
|
||||
* passed to the I/O handler. This object will be automatically released by the
|
||||
* system when the I/O handler returns. It is the responsibility of the
|
||||
* application to retain, concatenate or copy the data object if it is needed
|
||||
* after the I/O handler returns.
|
||||
*
|
||||
* Dispatch I/O handlers are not reentrant. The system will ensure that no new
|
||||
* I/O handler instance is invoked until the previously enqueued handler block
|
||||
* has returned.
|
||||
*
|
||||
* An invocation of the I/O handler with the done flag set indicates that the
|
||||
* read operation is complete and that the handler will not be enqueued again.
|
||||
*
|
||||
* If an unrecoverable error occurs on the I/O channel's underlying file
|
||||
* descriptor, the I/O handler will be enqueued with the done flag set, the
|
||||
* appropriate error code and a NULL data object.
|
||||
*
|
||||
* An invocation of the I/O handler with the done flag set, an error code of
|
||||
* zero and an empty data object indicates that EOF was reached.
|
||||
*
|
||||
* @param channel The dispatch I/O channel from which to read the data.
|
||||
* @param offset The offset relative to the channel position from which
|
||||
* to start reading (only for DISPATCH_IO_RANDOM).
|
||||
* @param length The length of data to read from the I/O channel, or
|
||||
* SIZE_MAX to indicate that data should be read until EOF
|
||||
* is reached.
|
||||
* @param queue The dispatch queue to which the I/O handler should be
|
||||
* submitted.
|
||||
* @param io_handler The I/O handler to enqueue when data is ready to be
|
||||
* delivered.
|
||||
* param done A flag indicating whether the operation is complete.
|
||||
* param data An object with the data most recently read from the
|
||||
* I/O channel as part of this read operation, or NULL.
|
||||
* param error An errno condition for the read operation or zero if
|
||||
* the read was successful.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL4 DISPATCH_NONNULL5
|
||||
DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_io_read(dispatch_io_t channel,
|
||||
off_t offset,
|
||||
size_t length,
|
||||
dispatch_queue_t queue,
|
||||
dispatch_io_handler_t io_handler);
|
||||
|
||||
/*!
|
||||
* @function dispatch_io_write
|
||||
* Schedule a write operation for asynchronous execution on the specified I/O
|
||||
* channel. The I/O handler is enqueued one or more times depending on the
|
||||
* general load of the system and the policy specified on the I/O channel.
|
||||
*
|
||||
* Any data remaining to be written to the I/O channel is described by the
|
||||
* dispatch data object passed to the I/O handler. This object will be
|
||||
* automatically released by the system when the I/O handler returns. It is the
|
||||
* responsibility of the application to retain, concatenate or copy the data
|
||||
* object if it is needed after the I/O handler returns.
|
||||
*
|
||||
* Dispatch I/O handlers are not reentrant. The system will ensure that no new
|
||||
* I/O handler instance is invoked until the previously enqueued handler block
|
||||
* has returned.
|
||||
*
|
||||
* An invocation of the I/O handler with the done flag set indicates that the
|
||||
* write operation is complete and that the handler will not be enqueued again.
|
||||
*
|
||||
* If an unrecoverable error occurs on the I/O channel's underlying file
|
||||
* descriptor, the I/O handler will be enqueued with the done flag set, the
|
||||
* appropriate error code and an object containing the data that could not be
|
||||
* written.
|
||||
*
|
||||
* An invocation of the I/O handler with the done flag set and an error code of
|
||||
* zero indicates that the data was fully written to the channel.
|
||||
*
|
||||
* @param channel The dispatch I/O channel on which to write the data.
|
||||
* @param offset The offset relative to the channel position from which
|
||||
* to start writing (only for DISPATCH_IO_RANDOM).
|
||||
* @param data The data to write to the I/O channel. The data object
|
||||
* will be retained by the system until the write operation
|
||||
* is complete.
|
||||
* @param queue The dispatch queue to which the I/O handler should be
|
||||
* submitted.
|
||||
* @param io_handler The I/O handler to enqueue when data has been delivered.
|
||||
* param done A flag indicating whether the operation is complete.
|
||||
* param data An object of the data remaining to be
|
||||
* written to the I/O channel as part of this write
|
||||
* operation, or NULL.
|
||||
* param error An errno condition for the write operation or zero
|
||||
* if the write was successful.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NONNULL4
|
||||
DISPATCH_NONNULL5 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_io_write(dispatch_io_t channel,
|
||||
off_t offset,
|
||||
dispatch_data_t data,
|
||||
dispatch_queue_t queue,
|
||||
dispatch_io_handler_t io_handler);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_io_close_flags_t
|
||||
* The type of flags you can set on a dispatch_io_close() call
|
||||
*
|
||||
* @const DISPATCH_IO_STOP Stop outstanding operations on a channel when
|
||||
* the channel is closed.
|
||||
*/
|
||||
#define DISPATCH_IO_STOP 0x1
|
||||
|
||||
typedef unsigned long dispatch_io_close_flags_t;
|
||||
|
||||
/*!
|
||||
* @function dispatch_io_close
|
||||
* Close the specified I/O channel to new read or write operations; scheduling
|
||||
* operations on a closed channel results in their handler returning an error.
|
||||
*
|
||||
* If the DISPATCH_IO_STOP flag is provided, the system will make a best effort
|
||||
* to interrupt any outstanding read and write operations on the I/O channel,
|
||||
* otherwise those operations will run to completion normally.
|
||||
* Partial results of read and write operations may be returned even after a
|
||||
* channel is closed with the DISPATCH_IO_STOP flag.
|
||||
* The final invocation of an I/O handler of an interrupted operation will be
|
||||
* passed an ECANCELED error code, as will the I/O handler of an operation
|
||||
* scheduled on a closed channel.
|
||||
*
|
||||
* @param channel The dispatch I/O channel to close.
|
||||
* @param flags The flags for the close operation.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_io_close(dispatch_io_t channel, dispatch_io_close_flags_t flags);
|
||||
|
||||
#ifdef __BLOCKS__
|
||||
/*!
|
||||
* @function dispatch_io_barrier
|
||||
* Schedule a barrier operation on the specified I/O channel; all previously
|
||||
* scheduled operations on the channel will complete before the provided
|
||||
* barrier block is enqueued onto the global queue determined by the channel's
|
||||
* target queue, and no subsequently scheduled operations will start until the
|
||||
* barrier block has returned.
|
||||
*
|
||||
* If multiple channels are associated with the same file descriptor, a barrier
|
||||
* operation scheduled on any of these channels will act as a barrier across all
|
||||
* channels in question, i.e. all previously scheduled operations on any of the
|
||||
* channels will complete before the barrier block is enqueued, and no
|
||||
* operations subsequently scheduled on any of the channels will start until the
|
||||
* barrier block has returned.
|
||||
*
|
||||
* While the barrier block is running, it may safely operate on the channel's
|
||||
* underlying file descriptor with fsync(2), lseek(2) etc. (but not close(2)).
|
||||
*
|
||||
* @param channel The dispatch I/O channel to schedule the barrier on.
|
||||
* @param barrier The barrier block.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_io_barrier(dispatch_io_t channel, dispatch_block_t barrier);
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*!
|
||||
* @function dispatch_io_get_descriptor
|
||||
* Returns the file descriptor underlying a dispatch I/O channel.
|
||||
*
|
||||
* Will return -1 for a channel closed with dispatch_io_close() and for a
|
||||
* channel associated with a path name that has not yet been open(2)ed.
|
||||
*
|
||||
* If called from a barrier block scheduled on a channel associated with a path
|
||||
* name that has not yet been open(2)ed, this will trigger the channel open(2)
|
||||
* operation and return the resulting file descriptor.
|
||||
*
|
||||
* @param channel The dispatch I/O channel to query.
|
||||
* @result The file descriptor underlying the channel, or -1.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_fd_t
|
||||
dispatch_io_get_descriptor(dispatch_io_t channel);
|
||||
|
||||
/*!
|
||||
* @function dispatch_io_set_high_water
|
||||
* Set a high water mark on the I/O channel for all operations.
|
||||
*
|
||||
* The system will make a best effort to enqueue I/O handlers with partial
|
||||
* results as soon the number of bytes processed by an operation (i.e. read or
|
||||
* written) reaches the high water mark.
|
||||
*
|
||||
* The size of data objects passed to I/O handlers for this channel will never
|
||||
* exceed the specified high water mark.
|
||||
*
|
||||
* The default value for the high water mark is unlimited (i.e. SIZE_MAX).
|
||||
*
|
||||
* @param channel The dispatch I/O channel on which to set the policy.
|
||||
* @param high_water The number of bytes to use as a high water mark.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_io_set_high_water(dispatch_io_t channel, size_t high_water);
|
||||
|
||||
/*!
|
||||
* @function dispatch_io_set_low_water
|
||||
* Set a low water mark on the I/O channel for all operations.
|
||||
*
|
||||
* The system will process (i.e. read or write) at least the low water mark
|
||||
* number of bytes for an operation before enqueueing I/O handlers with partial
|
||||
* results.
|
||||
*
|
||||
* The size of data objects passed to intermediate I/O handler invocations for
|
||||
* this channel (i.e. excluding the final invocation) will never be smaller than
|
||||
* the specified low water mark, except if the channel has an interval with the
|
||||
* DISPATCH_IO_STRICT_INTERVAL flag set or if EOF or an error was encountered.
|
||||
*
|
||||
* I/O handlers should be prepared to receive amounts of data significantly
|
||||
* larger than the low water mark in general. If an I/O handler requires
|
||||
* intermediate results of fixed size, set both the low and and the high water
|
||||
* mark to that size.
|
||||
*
|
||||
* The default value for the low water mark is unspecified, but must be assumed
|
||||
* to be such that intermediate handler invocations may occur.
|
||||
* If I/O handler invocations with partial results are not desired, set the
|
||||
* low water mark to SIZE_MAX.
|
||||
*
|
||||
* @param channel The dispatch I/O channel on which to set the policy.
|
||||
* @param low_water The number of bytes to use as a low water mark.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_io_set_low_water(dispatch_io_t channel, size_t low_water);
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_io_interval_flags_t
|
||||
* Type of flags to set on dispatch_io_set_interval()
|
||||
*
|
||||
* @const DISPATCH_IO_STRICT_INTERVAL Enqueue I/O handlers at a channel's
|
||||
* interval setting even if the amount of data ready to be delivered is inferior
|
||||
* to the low water mark (or zero).
|
||||
*/
|
||||
#define DISPATCH_IO_STRICT_INTERVAL 0x1
|
||||
|
||||
typedef unsigned long dispatch_io_interval_flags_t;
|
||||
|
||||
/*!
|
||||
* @function dispatch_io_set_interval
|
||||
* Set a nanosecond interval at which I/O handlers are to be enqueued on the
|
||||
* I/O channel for all operations.
|
||||
*
|
||||
* This allows an application to receive periodic feedback on the progress of
|
||||
* read and write operations, e.g. for the purposes of displaying progress bars.
|
||||
*
|
||||
* If the amount of data ready to be delivered to an I/O handler at the interval
|
||||
* is inferior to the channel low water mark, the handler will only be enqueued
|
||||
* if the DISPATCH_IO_STRICT_INTERVAL flag is set.
|
||||
*
|
||||
* Note that the system may defer enqueueing interval I/O handlers by a small
|
||||
* unspecified amount of leeway in order to align with other system activity for
|
||||
* improved system performance or power consumption.
|
||||
*
|
||||
* @param channel The dispatch I/O channel on which to set the policy.
|
||||
* @param interval The interval in nanoseconds at which delivery of the I/O
|
||||
* handler is desired.
|
||||
* @param flags Flags indicating desired data delivery behavior at
|
||||
* interval time.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.7), ios(5.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
|
||||
void
|
||||
dispatch_io_set_interval(dispatch_io_t channel,
|
||||
uint64_t interval,
|
||||
dispatch_io_interval_flags_t flags);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif /* __DISPATCH_IO__ */
|
||||
606
lib/libc/include/x86_64-macos-gnu/dispatch/object.h
Normal file
606
lib/libc/include/x86_64-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
|
||||
125
lib/libc/include/x86_64-macos-gnu/dispatch/once.h
Normal file
125
lib/libc/include/x86_64-macos-gnu/dispatch/once.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2010 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_ONCE__
|
||||
#define __DISPATCH_ONCE__
|
||||
|
||||
#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_once_t
|
||||
*
|
||||
* @abstract
|
||||
* A predicate for use with dispatch_once(). It must be initialized to zero.
|
||||
* Note: static and global variables default to zero.
|
||||
*/
|
||||
DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead")
|
||||
typedef intptr_t dispatch_once_t;
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__) || defined(__s390x__)
|
||||
#define DISPATCH_ONCE_INLINE_FASTPATH 1
|
||||
#elif defined(__APPLE__)
|
||||
#define DISPATCH_ONCE_INLINE_FASTPATH 1
|
||||
#else
|
||||
#define DISPATCH_ONCE_INLINE_FASTPATH 0
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function dispatch_once
|
||||
*
|
||||
* @abstract
|
||||
* Execute a block once and only once.
|
||||
*
|
||||
* @param predicate
|
||||
* A pointer to a dispatch_once_t that is used to test whether the block has
|
||||
* completed or not.
|
||||
*
|
||||
* @param block
|
||||
* The block to execute once.
|
||||
*
|
||||
* @discussion
|
||||
* Always call dispatch_once() before using or testing any variables that are
|
||||
* initialized by the block.
|
||||
*/
|
||||
#ifdef __BLOCKS__
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead")
|
||||
void
|
||||
dispatch_once(dispatch_once_t *predicate,
|
||||
DISPATCH_NOESCAPE dispatch_block_t block);
|
||||
|
||||
#if DISPATCH_ONCE_INLINE_FASTPATH
|
||||
DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
|
||||
DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead")
|
||||
void
|
||||
_dispatch_once(dispatch_once_t *predicate,
|
||||
DISPATCH_NOESCAPE dispatch_block_t block)
|
||||
{
|
||||
if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) {
|
||||
dispatch_once(predicate, block);
|
||||
} else {
|
||||
dispatch_compiler_barrier();
|
||||
}
|
||||
DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l);
|
||||
}
|
||||
#undef dispatch_once
|
||||
#define dispatch_once _dispatch_once
|
||||
#endif
|
||||
#endif // DISPATCH_ONCE_INLINE_FASTPATH
|
||||
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW
|
||||
DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead")
|
||||
void
|
||||
dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context,
|
||||
dispatch_function_t function);
|
||||
|
||||
#if DISPATCH_ONCE_INLINE_FASTPATH
|
||||
DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL1 DISPATCH_NONNULL3
|
||||
DISPATCH_NOTHROW
|
||||
DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead")
|
||||
void
|
||||
_dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context,
|
||||
dispatch_function_t function)
|
||||
{
|
||||
if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) {
|
||||
dispatch_once_f(predicate, context, function);
|
||||
} else {
|
||||
dispatch_compiler_barrier();
|
||||
}
|
||||
DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l);
|
||||
}
|
||||
#undef dispatch_once_f
|
||||
#define dispatch_once_f _dispatch_once_f
|
||||
#endif // DISPATCH_ONCE_INLINE_FASTPATH
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
1674
lib/libc/include/x86_64-macos-gnu/dispatch/queue.h
Normal file
1674
lib/libc/include/x86_64-macos-gnu/dispatch/queue.h
Normal file
File diff suppressed because it is too large
Load Diff
117
lib/libc/include/x86_64-macos-gnu/dispatch/semaphore.h
Normal file
117
lib/libc/include/x86_64-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/x86_64-macos-gnu/dispatch/source.h
Normal file
780
lib/libc/include/x86_64-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
|
||||
136
lib/libc/include/x86_64-macos-gnu/dispatch/time.h
Normal file
136
lib/libc/include/x86_64-macos-gnu/dispatch/time.h
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2011 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_TIME__
|
||||
#define __DISPATCH_TIME__
|
||||
|
||||
#ifndef __DISPATCH_INDIRECT__
|
||||
#error "Please #include <dispatch/dispatch.h> instead of this file directly."
|
||||
#include <dispatch/base.h> // for HeaderDoc
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// <rdar://problem/6368156&7563559>
|
||||
#if TARGET_OS_MAC
|
||||
#include <mach/clock_types.h>
|
||||
#endif
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#ifdef NSEC_PER_SEC
|
||||
#undef NSEC_PER_SEC
|
||||
#endif
|
||||
#ifdef USEC_PER_SEC
|
||||
#undef USEC_PER_SEC
|
||||
#endif
|
||||
#ifdef NSEC_PER_USEC
|
||||
#undef NSEC_PER_USEC
|
||||
#endif
|
||||
#ifdef NSEC_PER_MSEC
|
||||
#undef NSEC_PER_MSEC
|
||||
#endif
|
||||
#define NSEC_PER_SEC 1000000000ull
|
||||
#define NSEC_PER_MSEC 1000000ull
|
||||
#define USEC_PER_SEC 1000000ull
|
||||
#define NSEC_PER_USEC 1000ull
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
struct timespec;
|
||||
|
||||
/*!
|
||||
* @typedef dispatch_time_t
|
||||
*
|
||||
* @abstract
|
||||
* A somewhat abstract representation of time; where zero means "now" and
|
||||
* DISPATCH_TIME_FOREVER means "infinity" and every value in between is an
|
||||
* opaque encoding.
|
||||
*/
|
||||
typedef uint64_t dispatch_time_t;
|
||||
|
||||
enum {
|
||||
DISPATCH_WALLTIME_NOW DISPATCH_ENUM_API_AVAILABLE
|
||||
(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = ~1ull,
|
||||
};
|
||||
|
||||
#define DISPATCH_TIME_NOW (0ull)
|
||||
#define DISPATCH_TIME_FOREVER (~0ull)
|
||||
|
||||
/*!
|
||||
* @function dispatch_time
|
||||
*
|
||||
* @abstract
|
||||
* Create a dispatch_time_t relative to the current value of the default or
|
||||
* wall time clock, or modify an existing dispatch_time_t.
|
||||
*
|
||||
* @discussion
|
||||
* On Apple platforms, the default clock is based on mach_absolute_time().
|
||||
*
|
||||
* @param when
|
||||
* An optional dispatch_time_t to add nanoseconds to. If DISPATCH_TIME_NOW is
|
||||
* passed, then dispatch_time() will use the default clock (which is based on
|
||||
* mach_absolute_time() on Apple platforms). If DISPATCH_WALLTIME_NOW is used,
|
||||
* dispatch_time() will use the value returned by gettimeofday(3).
|
||||
* dispatch_time(DISPATCH_WALLTIME_NOW, delta) is equivalent to
|
||||
* dispatch_walltime(NULL, delta).
|
||||
*
|
||||
* @param delta
|
||||
* Nanoseconds to add.
|
||||
*
|
||||
* @result
|
||||
* A new dispatch_time_t.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_time_t
|
||||
dispatch_time(dispatch_time_t when, int64_t delta);
|
||||
|
||||
/*!
|
||||
* @function dispatch_walltime
|
||||
*
|
||||
* @abstract
|
||||
* Create a dispatch_time_t using the wall clock.
|
||||
*
|
||||
* @discussion
|
||||
* On Mac OS X the wall clock is based on gettimeofday(3).
|
||||
*
|
||||
* @param when
|
||||
* A struct timespec to add time to. If NULL is passed, then
|
||||
* dispatch_walltime() will use the result of gettimeofday(3).
|
||||
* dispatch_walltime(NULL, delta) returns the same value as
|
||||
* dispatch_time(DISPATCH_WALLTIME_NOW, delta).
|
||||
*
|
||||
* @param delta
|
||||
* Nanoseconds to add.
|
||||
*
|
||||
* @result
|
||||
* A new dispatch_time_t.
|
||||
*/
|
||||
API_AVAILABLE(macos(10.6), ios(4.0))
|
||||
DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW
|
||||
dispatch_time_t
|
||||
dispatch_walltime(const struct timespec *_Nullable when, int64_t delta);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
DISPATCH_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
163
lib/libc/include/x86_64-macos-gnu/dispatch/workloop.h
Normal file
163
lib/libc/include/x86_64-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
|
||||
97
lib/libc/include/x86_64-macos-gnu/dlfcn.h
Normal file
97
lib/libc/include/x86_64-macos-gnu/dlfcn.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2004-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@
|
||||
*/
|
||||
|
||||
/*
|
||||
Based on the dlcompat work done by:
|
||||
Jorge Acereda <jacereda@users.sourceforge.net> &
|
||||
Peter O'Gorman <ogorman@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
#ifndef _DLFCN_H_
|
||||
#define _DLFCN_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#include <stdbool.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#ifdef __DRIVERKIT_19_0
|
||||
#define __DYLDDL_DRIVERKIT_UNAVAILABLE __API_UNAVAILABLE(driverkit)
|
||||
#else
|
||||
#define __DYLDDL_DRIVERKIT_UNAVAILABLE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure filled in by dladdr().
|
||||
*/
|
||||
typedef struct dl_info {
|
||||
const char *dli_fname; /* Pathname of shared object */
|
||||
void *dli_fbase; /* Base address of shared object */
|
||||
const char *dli_sname; /* Name of nearest symbol */
|
||||
void *dli_saddr; /* Address of nearest symbol */
|
||||
} Dl_info;
|
||||
|
||||
extern int dladdr(const void *, Dl_info *);
|
||||
#else
|
||||
#define __DYLDDL_DRIVERKIT_UNAVAILABLE
|
||||
#endif /* not POSIX */
|
||||
|
||||
extern int dlclose(void * __handle) __DYLDDL_DRIVERKIT_UNAVAILABLE;
|
||||
extern char * dlerror(void) __DYLDDL_DRIVERKIT_UNAVAILABLE;
|
||||
extern void * dlopen(const char * __path, int __mode) __DYLDDL_DRIVERKIT_UNAVAILABLE;
|
||||
extern void * dlsym(void * __handle, const char * __symbol) __DYLDDL_DRIVERKIT_UNAVAILABLE;
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
extern bool dlopen_preflight(const char* __path) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) __DYLDDL_DRIVERKIT_UNAVAILABLE;
|
||||
#endif /* not POSIX */
|
||||
|
||||
|
||||
#define RTLD_LAZY 0x1
|
||||
#define RTLD_NOW 0x2
|
||||
#define RTLD_LOCAL 0x4
|
||||
#define RTLD_GLOBAL 0x8
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define RTLD_NOLOAD 0x10
|
||||
#define RTLD_NODELETE 0x80
|
||||
#define RTLD_FIRST 0x100 /* Mac OS X 10.5 and later */
|
||||
|
||||
/*
|
||||
* Special handle arguments for dlsym().
|
||||
*/
|
||||
#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */
|
||||
#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */
|
||||
#define RTLD_SELF ((void *) -3) /* Search this and subsequent objects (Mac OS X 10.5 and later) */
|
||||
#define RTLD_MAIN_ONLY ((void *) -5) /* Search main executable only (Mac OS X 10.5 and later) */
|
||||
#endif /* not POSIX */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _DLFCN_H_ */
|
||||
63
lib/libc/include/x86_64-macos-gnu/execinfo.h
Normal file
63
lib/libc/include/x86_64-macos-gnu/execinfo.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (c) 2007 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 _EXECINFO_H_
|
||||
#define _EXECINFO_H_ 1
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <Availability.h>
|
||||
#include <os/base.h>
|
||||
#include <os/availability.h>
|
||||
#include <stdint.h>
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int backtrace(void**,int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
|
||||
|
||||
API_AVAILABLE(macosx(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
OS_EXPORT
|
||||
int backtrace_from_fp(void *startfp, void **array, int size);
|
||||
|
||||
char** backtrace_symbols(void* const*,int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
|
||||
void backtrace_symbols_fd(void* const*,int,int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
|
||||
|
||||
struct image_offset {
|
||||
/*
|
||||
* The UUID of the image.
|
||||
*/
|
||||
uuid_t uuid;
|
||||
|
||||
/*
|
||||
* The offset is relative to the __TEXT section of the image.
|
||||
*/
|
||||
uint32_t offset;
|
||||
};
|
||||
|
||||
API_AVAILABLE(macosx(10.14), ios(12.0), tvos(12.0), watchos(5.0))
|
||||
OS_EXPORT
|
||||
void backtrace_image_offsets(void* const* array,
|
||||
struct image_offset *image_offsets, int size);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_EXECINFO_H_ */
|
||||
23
lib/libc/include/x86_64-macos-gnu/fcntl.h
Normal file
23
lib/libc/include/x86_64-macos-gnu/fcntl.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
#include <sys/fcntl.h>
|
||||
73
lib/libc/include/x86_64-macos-gnu/fmtmsg.h
Normal file
73
lib/libc/include/x86_64-macos-gnu/fmtmsg.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*-
|
||||
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
* $FreeBSD: src/include/fmtmsg.h,v 1.2 2002/08/05 16:37:05 mike Exp $
|
||||
*/
|
||||
|
||||
#ifndef _FMTMSG_H_
|
||||
#define _FMTMSG_H_
|
||||
|
||||
/* Source of condition is... */
|
||||
#define MM_HARD 0x0001 /* ...hardware. */
|
||||
#define MM_SOFT 0x0002 /* ...software. */
|
||||
#define MM_FIRM 0x0004 /* ...fireware. */
|
||||
|
||||
/* Condition detected by... */
|
||||
#define MM_APPL 0x0010 /* ...application. */
|
||||
#define MM_UTIL 0x0020 /* ...utility. */
|
||||
#define MM_OPSYS 0x0040 /* ...operating system. */
|
||||
|
||||
/* Display on... */
|
||||
#define MM_PRINT 0x0100 /* ...standard error. */
|
||||
#define MM_CONSOLE 0x0200 /* ...system console. */
|
||||
|
||||
#define MM_RECOVER 0x1000 /* Recoverable error. */
|
||||
#define MM_NRECOV 0x2000 /* Non-recoverable error. */
|
||||
|
||||
/* Severity levels. */
|
||||
#define MM_NOSEV 0 /* No severity level provided. */
|
||||
#define MM_HALT 1 /* Error causing application to halt. */
|
||||
#define MM_ERROR 2 /* Non-fault fault. */
|
||||
#define MM_WARNING 3 /* Unusual non-error condition. */
|
||||
#define MM_INFO 4 /* Informative message. */
|
||||
|
||||
/* Null options. */
|
||||
#define MM_NULLLBL (char *)0
|
||||
#define MM_NULLSEV 0
|
||||
#define MM_NULLMC 0L
|
||||
#define MM_NULLTXT (char *)0
|
||||
#define MM_NULLACT (char *)0
|
||||
#define MM_NULLTAG (char *)0
|
||||
|
||||
/* Return values. */
|
||||
#define MM_OK 0 /* Success. */
|
||||
#define MM_NOMSG 1 /* Failed to output to stderr. */
|
||||
#define MM_NOCON 2 /* Failed to output to console. */
|
||||
#define MM_NOTOK 3 /* Failed to output anything. */
|
||||
|
||||
int fmtmsg(long, const char *, int, const char *, const char *,
|
||||
const char *);
|
||||
|
||||
#endif /* !_FMTMSG_H_ */
|
||||
82
lib/libc/include/x86_64-macos-gnu/fnmatch.h
Normal file
82
lib/libc/include/x86_64-macos-gnu/fnmatch.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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) 1992, 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.
|
||||
*
|
||||
* @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
#ifndef _FNMATCH_H_
|
||||
#define _FNMATCH_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#define FNM_NOMATCH 1 /* Match failed. */
|
||||
|
||||
#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
|
||||
#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
|
||||
#define FNM_PERIOD 0x04 /* Period must be matched by period. */
|
||||
|
||||
#define FNM_NOSYS (-1) /* Reserved. */
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
|
||||
#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
|
||||
#define FNM_IGNORECASE FNM_CASEFOLD
|
||||
#define FNM_FILE_NAME FNM_PATHNAME
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
int fnmatch(const char *, const char *, int) __DARWIN_ALIAS(fnmatch);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_FNMATCH_H_ */
|
||||
60
lib/libc/include/x86_64-macos-gnu/ftw.h
Normal file
60
lib/libc/include/x86_64-macos-gnu/ftw.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* $OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Sponsored in part by the Defense Advanced Research Projects
|
||||
* Agency (DARPA) and Air Force Research Laboratory, Air Force
|
||||
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
|
||||
*/
|
||||
|
||||
#ifndef _FTW_H
|
||||
#define _FTW_H
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
/*
|
||||
* Valid flags for the 3rd argument to the function that is passed as the
|
||||
* second argument to ftw(3) and nftw(3). Say it three times fast!
|
||||
*/
|
||||
#define FTW_F 0 /* File. */
|
||||
#define FTW_D 1 /* Directory. */
|
||||
#define FTW_DNR 2 /* Directory without read permission. */
|
||||
#define FTW_DP 3 /* Directory with subdirectories visited. */
|
||||
#define FTW_NS 4 /* Unknown type; stat() failed. */
|
||||
#define FTW_SL 5 /* Symbolic link. */
|
||||
#define FTW_SLN 6 /* Sym link that names a nonexistent file. */
|
||||
|
||||
/*
|
||||
* Flags for use as the 4th argument to nftw(3). These may be ORed together.
|
||||
*/
|
||||
#define FTW_PHYS 0x01 /* Physical walk, don't follow sym links. */
|
||||
#define FTW_MOUNT 0x02 /* The walk does not cross a mount point. */
|
||||
#define FTW_DEPTH 0x04 /* Subdirs visited before the dir itself. */
|
||||
#define FTW_CHDIR 0x08 /* Change to a directory before reading it. */
|
||||
|
||||
struct FTW {
|
||||
int base;
|
||||
int level;
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
int ftw(const char *, int (*)(const char *, const struct stat *, int), int)
|
||||
__DARWIN_ALIAS_I(ftw);
|
||||
int nftw(const char *, int (*)(const char *, const struct stat *, int,
|
||||
struct FTW *), int, int) __DARWIN_ALIAS_I(nftw);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_FTW_H */
|
||||
42
lib/libc/include/x86_64-macos-gnu/gethostuuid.h
Normal file
42
lib/libc/include/x86_64-macos-gnu/gethostuuid.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2013 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 __GETHOSTUUID_H
|
||||
#define __GETHOSTUUID_H
|
||||
|
||||
#include <sys/_types/_timespec.h>
|
||||
#include <sys/_types/_uuid_t.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0)
|
||||
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_NA, __MAC_NA, __IPHONE_2_0, __IPHONE_5_0, "gethostuuid() is no longer supported");
|
||||
#else
|
||||
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
|
||||
#endif
|
||||
|
||||
#endif /* __GETHOSTUUID_H */
|
||||
130
lib/libc/include/x86_64-macos-gnu/glob.h
Normal file
130
lib/libc/include/x86_64-macos-gnu/glob.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Guido van Rossum.
|
||||
*
|
||||
* 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 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.
|
||||
*
|
||||
* @(#)glob.h 8.1 (Berkeley) 6/2/93
|
||||
* $FreeBSD: /repoman/r/ncvs/src/include/glob.h,v 1.7 2002/07/17 04:58:09 mikeh Exp $
|
||||
*/
|
||||
|
||||
#ifndef _GLOB_H_
|
||||
#define _GLOB_H_
|
||||
|
||||
#include <_types.h>
|
||||
#include <sys/cdefs.h>
|
||||
#include <Availability.h>
|
||||
#include <sys/_types/_size_t.h>
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
struct dirent;
|
||||
struct stat;
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
typedef struct {
|
||||
size_t gl_pathc; /* Count of total paths so far. */
|
||||
int gl_matchc; /* Count of paths matching pattern. */
|
||||
size_t gl_offs; /* Reserved at beginning of gl_pathv. */
|
||||
int gl_flags; /* Copy of flags parameter to glob. */
|
||||
char **gl_pathv; /* List of paths matching pattern. */
|
||||
/* Copy of errfunc parameter to glob. */
|
||||
#ifdef __BLOCKS__
|
||||
union {
|
||||
#endif /* __BLOCKS__ */
|
||||
int (*gl_errfunc)(const char *, int);
|
||||
#ifdef __BLOCKS__
|
||||
int (^gl_errblk)(const char *, int);
|
||||
};
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/*
|
||||
* Alternate filesystem access methods for glob; replacement
|
||||
* versions of closedir(3), readdir(3), opendir(3), stat(2)
|
||||
* and lstat(2).
|
||||
*/
|
||||
void (*gl_closedir)(void *);
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
struct dirent *(*gl_readdir)(void *);
|
||||
#else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
void *(*gl_readdir)(void *);
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
void *(*gl_opendir)(const char *);
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
int (*gl_lstat)(const char *, struct stat *);
|
||||
int (*gl_stat)(const char *, struct stat *);
|
||||
#else /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
|
||||
int (*gl_lstat)(const char *, void *);
|
||||
int (*gl_stat)(const char *, void *);
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
} glob_t;
|
||||
|
||||
/* Believed to have been introduced in 1003.2-1992 */
|
||||
#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
|
||||
#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
|
||||
#define GLOB_ERR 0x0004 /* Return on error. */
|
||||
#define GLOB_MARK 0x0008 /* Append / to matching directories. */
|
||||
#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
|
||||
#define GLOB_NOSORT 0x0020 /* Don't sort. */
|
||||
#define GLOB_NOESCAPE 0x2000 /* Disable backslash escaping. */
|
||||
|
||||
/* Error values returned by glob(3) */
|
||||
#define GLOB_NOSPACE (-1) /* Malloc call failed. */
|
||||
#define GLOB_ABORTED (-2) /* Unignored error. */
|
||||
#define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK was not set. */
|
||||
#define GLOB_NOSYS (-4) /* Obsolete: source comptability only. */
|
||||
|
||||
#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
|
||||
#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
|
||||
#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
|
||||
#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
|
||||
#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
|
||||
#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
|
||||
#define GLOB_LIMIT 0x1000 /* limit number of returned paths */
|
||||
#ifdef __BLOCKS__
|
||||
#define _GLOB_ERR_BLOCK 0x80000000 /* (internal) error callback is a block */
|
||||
#endif /* __BLOCKS__ */
|
||||
|
||||
/* source compatibility, these are the old names */
|
||||
#define GLOB_MAXPATH GLOB_LIMIT
|
||||
#define GLOB_ABEND GLOB_ABORTED
|
||||
|
||||
__BEGIN_DECLS
|
||||
int glob(const char * __restrict, int, int (*)(const char *, int),
|
||||
glob_t * __restrict) __DARWIN_INODE64(glob);
|
||||
#ifdef __BLOCKS__
|
||||
#if __has_attribute(noescape)
|
||||
#define __glob_noescape __attribute__((__noescape__))
|
||||
#else
|
||||
#define __glob_noescape
|
||||
#endif
|
||||
int glob_b(const char * __restrict, int, int (^)(const char *, int) __glob_noescape,
|
||||
glob_t * __restrict) __DARWIN_INODE64(glob_b) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
|
||||
#endif /* __BLOCKS__ */
|
||||
void globfree(glob_t *);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_GLOB_H_ */
|
||||
93
lib/libc/include/x86_64-macos-gnu/grp.h
Normal file
93
lib/libc/include/x86_64-macos-gnu/grp.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*-
|
||||
* Copyright (c) 1989, 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.
|
||||
*
|
||||
* @(#)grp.h 8.2 (Berkeley) 1/21/94
|
||||
*/
|
||||
/* Portions copyright (c) 2000-2018 Apple Inc. All rights reserved. */
|
||||
|
||||
#ifndef _GRP_H_
|
||||
#define _GRP_H_
|
||||
|
||||
#include <_types.h>
|
||||
#include <sys/_types/_gid_t.h> /* [XBD] */
|
||||
#include <sys/_types/_size_t.h> /* SUSv4 */
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
#define _PATH_GROUP "/etc/group"
|
||||
#endif
|
||||
|
||||
struct group {
|
||||
char *gr_name; /* [XBD] group name */
|
||||
char *gr_passwd; /* [???] group password */
|
||||
gid_t gr_gid; /* [XBD] group id */
|
||||
char **gr_mem; /* [XBD] group members */
|
||||
};
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
/* [XBD] */
|
||||
struct group *getgrgid(gid_t);
|
||||
struct group *getgrnam(const char *);
|
||||
/* [TSF] */
|
||||
int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
|
||||
int getgrnam_r(const char *, struct group *, char *, size_t, struct group **);
|
||||
/* [XSI] */
|
||||
struct group *getgrent(void);
|
||||
void setgrent(void);
|
||||
void endgrent(void);
|
||||
__END_DECLS
|
||||
|
||||
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
|
||||
#include <uuid/uuid.h>
|
||||
__BEGIN_DECLS
|
||||
char *group_from_gid(gid_t, int);
|
||||
struct group *getgruuid(uuid_t);
|
||||
int getgruuid_r(uuid_t, struct group *, char *, size_t, struct group **);
|
||||
__END_DECLS
|
||||
#endif
|
||||
|
||||
#if !defined(_XOPEN_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
__BEGIN_DECLS
|
||||
#if (!defined(LIBINFO_INSTALL_API) || !LIBINFO_INSTALL_API)
|
||||
void setgrfile(const char *);
|
||||
#endif
|
||||
int setgroupent(int);
|
||||
__END_DECLS
|
||||
#endif
|
||||
|
||||
#endif /* !_GRP_H_ */
|
||||
818
lib/libc/include/x86_64-macos-gnu/hfs/hfs_format.h
Normal file
818
lib/libc/include/x86_64-macos-gnu/hfs/hfs_format.h
Normal file
@@ -0,0 +1,818 @@
|
||||
/*
|
||||
* Copyright (c) 2000-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@
|
||||
*/
|
||||
#ifndef __HFS_FORMAT__
|
||||
#define __HFS_FORMAT__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/appleapiopts.h>
|
||||
#include "hfs_unistr.h"
|
||||
|
||||
/*
|
||||
* hfs_format.h
|
||||
*
|
||||
* This file describes the on-disk format for HFS and HFS Plus volumes.
|
||||
*
|
||||
* Note: Starting 10.9, definition of struct HFSUniStr255 exists in hfs_unitstr.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* some on-disk hfs structures have 68K alignment (misaligned) */
|
||||
|
||||
/* Signatures used to differentiate between HFS and HFS Plus volumes */
|
||||
enum {
|
||||
kHFSSigWord = 0x4244, /* 'BD' in ASCII */
|
||||
kHFSPlusSigWord = 0x482B, /* 'H+' in ASCII */
|
||||
kHFSXSigWord = 0x4858, /* 'HX' in ASCII */
|
||||
|
||||
kHFSPlusVersion = 0x0004, /* 'H+' volumes are version 4 only */
|
||||
kHFSXVersion = 0x0005, /* 'HX' volumes start with version 5 */
|
||||
|
||||
kHFSPlusMountVersion = 0x31302E30, /* '10.0' for Mac OS X */
|
||||
kHFSJMountVersion = 0x4846534a, /* 'HFSJ' for journaled HFS+ on OS X */
|
||||
kFSKMountVersion = 0x46534b21 /* 'FSK!' for failed journal replay */
|
||||
};
|
||||
|
||||
|
||||
#ifdef __APPLE_API_PRIVATE
|
||||
/*
|
||||
* Mac OS X has two special directories on HFS+ volumes for hardlinked files
|
||||
* and hardlinked directories as well as for open-unlinked files.
|
||||
*
|
||||
* These directories and their contents are not exported from the filesystem
|
||||
* under Mac OS X.
|
||||
*/
|
||||
#define HFSPLUSMETADATAFOLDER "\xE2\x90\x80\xE2\x90\x80\xE2\x90\x80\xE2\x90\x80HFS+ Private Data"
|
||||
#define HFSPLUS_DIR_METADATA_FOLDER ".HFS+ Private Directory Data\xd"
|
||||
|
||||
/*
|
||||
* Files in the "HFS+ Private Data" folder have one of the following prefixes
|
||||
* followed by a decimal number (no leading zeros) for the file ID.
|
||||
*
|
||||
* Note: Earlier version of Mac OS X used a 32 bit random number for the link
|
||||
* ref number instead of the file id.
|
||||
*
|
||||
* e.g. iNode7182000 and temp3296
|
||||
*/
|
||||
#define HFS_INODE_PREFIX "iNode"
|
||||
#define HFS_DELETE_PREFIX "temp"
|
||||
|
||||
/*
|
||||
* Files in the ".HFS+ Private Directory Data" folder have the following
|
||||
* prefix followed by a decimal number (no leading zeros) for the file ID.
|
||||
*
|
||||
* e.g. dir_555
|
||||
*/
|
||||
#define HFS_DIRINODE_PREFIX "dir_"
|
||||
|
||||
/*
|
||||
* Hardlink inodes save the head of the link chain in
|
||||
* an extended attribute named FIRST_LINK_XATTR_NAME.
|
||||
* The attribute data is the decimal value in ASCII
|
||||
* of the cnid for the first link in the chain.
|
||||
*
|
||||
* This extended attribute is private (i.e. its not
|
||||
* exported in the getxattr/listxattr POSIX APIs).
|
||||
*/
|
||||
#define FIRST_LINK_XATTR_NAME "com.apple.system.hfs.firstlink"
|
||||
#define FIRST_LINK_XATTR_REC_SIZE (sizeof(HFSPlusAttrData) - 2 + 12)
|
||||
|
||||
/*
|
||||
* The name space ID for generating an HFS volume UUID
|
||||
*
|
||||
* B3E20F39-F292-11D6-97A4-00306543ECAC
|
||||
*/
|
||||
#define HFS_UUID_NAMESPACE_ID "\xB3\xE2\x0F\x39\xF2\x92\x11\xD6\x97\xA4\x00\x30\x65\x43\xEC\xAC"
|
||||
|
||||
#endif /* __APPLE_API_PRIVATE */
|
||||
|
||||
/*
|
||||
* Indirect link files (hard links) have the following type/creator.
|
||||
*/
|
||||
enum {
|
||||
kHardLinkFileType = 0x686C6E6B, /* 'hlnk' */
|
||||
kHFSPlusCreator = 0x6866732B /* 'hfs+' */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* File type and creator for symbolic links
|
||||
*/
|
||||
enum {
|
||||
kSymLinkFileType = 0x736C6E6B, /* 'slnk' */
|
||||
kSymLinkCreator = 0x72686170 /* 'rhap' */
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
kHFSMaxVolumeNameChars = 27,
|
||||
kHFSMaxFileNameChars = 31,
|
||||
kHFSPlusMaxFileNameChars = 255
|
||||
};
|
||||
|
||||
|
||||
/* Extent overflow file data structures */
|
||||
|
||||
/* HFS Extent key */
|
||||
struct HFSExtentKey {
|
||||
u_int8_t keyLength; /* length of key, excluding this field */
|
||||
u_int8_t forkType; /* 0 = data fork, FF = resource fork */
|
||||
u_int32_t fileID; /* file ID */
|
||||
u_int16_t startBlock; /* first file allocation block number in this extent */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSExtentKey HFSExtentKey;
|
||||
|
||||
/* HFS Plus Extent key */
|
||||
struct HFSPlusExtentKey {
|
||||
u_int16_t keyLength; /* length of key, excluding this field */
|
||||
u_int8_t forkType; /* 0 = data fork, FF = resource fork */
|
||||
u_int8_t pad; /* make the other fields align on 32-bit boundary */
|
||||
u_int32_t fileID; /* file ID */
|
||||
u_int32_t startBlock; /* first file allocation block number in this extent */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusExtentKey HFSPlusExtentKey;
|
||||
|
||||
/* Number of extent descriptors per extent record */
|
||||
enum {
|
||||
kHFSExtentDensity = 3,
|
||||
kHFSPlusExtentDensity = 8
|
||||
};
|
||||
|
||||
/* HFS extent descriptor */
|
||||
struct HFSExtentDescriptor {
|
||||
u_int16_t startBlock; /* first allocation block */
|
||||
u_int16_t blockCount; /* number of allocation blocks */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSExtentDescriptor HFSExtentDescriptor;
|
||||
|
||||
/* HFS Plus extent descriptor */
|
||||
struct HFSPlusExtentDescriptor {
|
||||
u_int32_t startBlock; /* first allocation block */
|
||||
u_int32_t blockCount; /* number of allocation blocks */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusExtentDescriptor HFSPlusExtentDescriptor;
|
||||
|
||||
/* HFS extent record */
|
||||
typedef HFSExtentDescriptor HFSExtentRecord[3];
|
||||
|
||||
/* HFS Plus extent record */
|
||||
typedef HFSPlusExtentDescriptor HFSPlusExtentRecord[8];
|
||||
|
||||
|
||||
/* Finder information */
|
||||
struct FndrFileInfo {
|
||||
u_int32_t fdType; /* file type */
|
||||
u_int32_t fdCreator; /* file creator */
|
||||
u_int16_t fdFlags; /* Finder flags */
|
||||
struct {
|
||||
int16_t v; /* file's location */
|
||||
int16_t h;
|
||||
} fdLocation;
|
||||
int16_t opaque;
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct FndrFileInfo FndrFileInfo;
|
||||
|
||||
struct FndrDirInfo {
|
||||
struct { /* folder's window rectangle */
|
||||
int16_t top;
|
||||
int16_t left;
|
||||
int16_t bottom;
|
||||
int16_t right;
|
||||
} frRect;
|
||||
unsigned short frFlags; /* Finder flags */
|
||||
struct {
|
||||
u_int16_t v; /* folder's location */
|
||||
u_int16_t h;
|
||||
} frLocation;
|
||||
int16_t opaque;
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct FndrDirInfo FndrDirInfo;
|
||||
|
||||
struct FndrOpaqueInfo {
|
||||
int8_t opaque[16];
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct FndrOpaqueInfo FndrOpaqueInfo;
|
||||
|
||||
struct FndrExtendedDirInfo {
|
||||
u_int32_t document_id;
|
||||
u_int32_t date_added;
|
||||
u_int16_t extended_flags;
|
||||
u_int16_t reserved3;
|
||||
u_int32_t write_gen_counter;
|
||||
} __attribute__((aligned(2), packed));
|
||||
|
||||
struct FndrExtendedFileInfo {
|
||||
u_int32_t document_id;
|
||||
u_int32_t date_added;
|
||||
u_int16_t extended_flags;
|
||||
u_int16_t reserved2;
|
||||
u_int32_t write_gen_counter;
|
||||
} __attribute__((aligned(2), packed));
|
||||
|
||||
/* HFS Plus Fork data info - 80 bytes */
|
||||
struct HFSPlusForkData {
|
||||
u_int64_t logicalSize; /* fork's logical size in bytes */
|
||||
u_int32_t clumpSize; /* fork's clump size in bytes */
|
||||
u_int32_t totalBlocks; /* total blocks used by this fork */
|
||||
HFSPlusExtentRecord extents; /* initial set of extents */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusForkData HFSPlusForkData;
|
||||
|
||||
|
||||
/* Mac OS X has 16 bytes worth of "BSD" info.
|
||||
*
|
||||
* Note: Mac OS 9 implementations and applications
|
||||
* should preserve, but not change, this information.
|
||||
*/
|
||||
struct HFSPlusBSDInfo {
|
||||
u_int32_t ownerID; /* user-id of owner or hard link chain previous link */
|
||||
u_int32_t groupID; /* group-id of owner or hard link chain next link */
|
||||
u_int8_t adminFlags; /* super-user changeable flags */
|
||||
u_int8_t ownerFlags; /* owner changeable flags */
|
||||
u_int16_t fileMode; /* file type and permission bits */
|
||||
union {
|
||||
u_int32_t iNodeNum; /* indirect node number (hard links only) */
|
||||
u_int32_t linkCount; /* links that refer to this indirect node */
|
||||
u_int32_t rawDevice; /* special file device (FBLK and FCHR only) */
|
||||
} special;
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusBSDInfo HFSPlusBSDInfo;
|
||||
|
||||
/*
|
||||
* Hardlink "links" resolve to an inode
|
||||
* and the actual uid/gid comes from that
|
||||
* inode.
|
||||
*
|
||||
* We repurpose the links's uid/gid fields
|
||||
* for the hardlink link chain. The chain
|
||||
* consists of a doubly linked list of file
|
||||
* ids.
|
||||
*/
|
||||
|
||||
#define hl_firstLinkID reserved1 /* Valid only if HasLinkChain flag is set (indirect nodes only) */
|
||||
|
||||
#define hl_prevLinkID bsdInfo.ownerID /* Valid only if HasLinkChain flag is set */
|
||||
#define hl_nextLinkID bsdInfo.groupID /* Valid only if HasLinkChain flag is set */
|
||||
|
||||
#define hl_linkReference bsdInfo.special.iNodeNum
|
||||
#define hl_linkCount bsdInfo.special.linkCount
|
||||
|
||||
|
||||
/* Catalog file data structures */
|
||||
|
||||
enum {
|
||||
kHFSRootParentID = 1, /* Parent ID of the root folder */
|
||||
kHFSRootFolderID = 2, /* Folder ID of the root folder */
|
||||
kHFSExtentsFileID = 3, /* File ID of the extents file */
|
||||
kHFSCatalogFileID = 4, /* File ID of the catalog file */
|
||||
kHFSBadBlockFileID = 5, /* File ID of the bad allocation block file */
|
||||
kHFSAllocationFileID = 6, /* File ID of the allocation file (HFS Plus only) */
|
||||
kHFSStartupFileID = 7, /* File ID of the startup file (HFS Plus only) */
|
||||
kHFSAttributesFileID = 8, /* File ID of the attribute file (HFS Plus only) */
|
||||
kHFSAttributeDataFileID = 13, /* Used in Mac OS X runtime for extent based attributes */
|
||||
/* kHFSAttributeDataFileID is never stored on disk. */
|
||||
kHFSRepairCatalogFileID = 14, /* Used when rebuilding Catalog B-tree */
|
||||
kHFSBogusExtentFileID = 15, /* Used for exchanging extents in extents file */
|
||||
kHFSFirstUserCatalogNodeID = 16
|
||||
};
|
||||
|
||||
/* HFS catalog key */
|
||||
struct HFSCatalogKey {
|
||||
u_int8_t keyLength; /* key length (in bytes) */
|
||||
u_int8_t reserved; /* reserved (set to zero) */
|
||||
u_int32_t parentID; /* parent folder ID */
|
||||
u_int8_t nodeName[kHFSMaxFileNameChars + 1]; /* catalog node name */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSCatalogKey HFSCatalogKey;
|
||||
|
||||
/* HFS Plus catalog key */
|
||||
struct HFSPlusCatalogKey {
|
||||
u_int16_t keyLength; /* key length (in bytes) */
|
||||
u_int32_t parentID; /* parent folder ID */
|
||||
HFSUniStr255 nodeName; /* catalog node name */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusCatalogKey HFSPlusCatalogKey;
|
||||
|
||||
/* Catalog record types */
|
||||
enum {
|
||||
/* HFS Catalog Records */
|
||||
kHFSFolderRecord = 0x0100, /* Folder record */
|
||||
kHFSFileRecord = 0x0200, /* File record */
|
||||
kHFSFolderThreadRecord = 0x0300, /* Folder thread record */
|
||||
kHFSFileThreadRecord = 0x0400, /* File thread record */
|
||||
|
||||
/* HFS Plus Catalog Records */
|
||||
kHFSPlusFolderRecord = 1, /* Folder record */
|
||||
kHFSPlusFileRecord = 2, /* File record */
|
||||
kHFSPlusFolderThreadRecord = 3, /* Folder thread record */
|
||||
kHFSPlusFileThreadRecord = 4 /* File thread record */
|
||||
};
|
||||
|
||||
|
||||
/* Catalog file record flags */
|
||||
enum {
|
||||
kHFSFileLockedBit = 0x0000, /* file is locked and cannot be written to */
|
||||
kHFSFileLockedMask = 0x0001,
|
||||
|
||||
kHFSThreadExistsBit = 0x0001, /* a file thread record exists for this file */
|
||||
kHFSThreadExistsMask = 0x0002,
|
||||
|
||||
kHFSHasAttributesBit = 0x0002, /* object has extended attributes */
|
||||
kHFSHasAttributesMask = 0x0004,
|
||||
|
||||
kHFSHasSecurityBit = 0x0003, /* object has security data (ACLs) */
|
||||
kHFSHasSecurityMask = 0x0008,
|
||||
|
||||
kHFSHasFolderCountBit = 0x0004, /* only for HFSX, folder maintains a separate sub-folder count */
|
||||
kHFSHasFolderCountMask = 0x0010, /* (sum of folder records and directory hard links) */
|
||||
|
||||
kHFSHasLinkChainBit = 0x0005, /* has hardlink chain (inode or link) */
|
||||
kHFSHasLinkChainMask = 0x0020,
|
||||
|
||||
kHFSHasChildLinkBit = 0x0006, /* folder has a child that's a dir link */
|
||||
kHFSHasChildLinkMask = 0x0040,
|
||||
|
||||
kHFSHasDateAddedBit = 0x0007, /* File/Folder has the date-added stored in the finder info. */
|
||||
kHFSHasDateAddedMask = 0x0080,
|
||||
|
||||
kHFSFastDevPinnedBit = 0x0008, /* this file has been pinned to the fast-device by the hot-file code on cooperative fusion */
|
||||
kHFSFastDevPinnedMask = 0x0100,
|
||||
|
||||
kHFSDoNotFastDevPinBit = 0x0009, /* this file can not be pinned to the fast-device */
|
||||
kHFSDoNotFastDevPinMask = 0x0200,
|
||||
|
||||
kHFSFastDevCandidateBit = 0x000a, /* this item is a potential candidate for fast-dev pinning (as are any of its descendents */
|
||||
kHFSFastDevCandidateMask = 0x0400,
|
||||
|
||||
kHFSAutoCandidateBit = 0x000b, /* this item was automatically marked as a fast-dev candidate by the kernel */
|
||||
kHFSAutoCandidateMask = 0x0800
|
||||
|
||||
// There are only 4 flag bits remaining: 0x1000, 0x2000, 0x4000, 0x8000
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* HFS catalog folder record - 70 bytes */
|
||||
struct HFSCatalogFolder {
|
||||
int16_t recordType; /* == kHFSFolderRecord */
|
||||
u_int16_t flags; /* folder flags */
|
||||
u_int16_t valence; /* folder valence */
|
||||
u_int32_t folderID; /* folder ID */
|
||||
u_int32_t createDate; /* date and time of creation */
|
||||
u_int32_t modifyDate; /* date and time of last modification */
|
||||
u_int32_t backupDate; /* date and time of last backup */
|
||||
FndrDirInfo userInfo; /* Finder information */
|
||||
FndrOpaqueInfo finderInfo; /* additional Finder information */
|
||||
u_int32_t reserved[4]; /* reserved - initialized as zero */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSCatalogFolder HFSCatalogFolder;
|
||||
|
||||
/* HFS Plus catalog folder record - 88 bytes */
|
||||
struct HFSPlusCatalogFolder {
|
||||
int16_t recordType; /* == kHFSPlusFolderRecord */
|
||||
u_int16_t flags; /* file flags */
|
||||
u_int32_t valence; /* folder's item count */
|
||||
u_int32_t folderID; /* folder ID */
|
||||
u_int32_t createDate; /* date and time of creation */
|
||||
u_int32_t contentModDate; /* date and time of last content modification */
|
||||
u_int32_t attributeModDate; /* date and time of last attribute modification */
|
||||
u_int32_t accessDate; /* date and time of last access (MacOS X only) */
|
||||
u_int32_t backupDate; /* date and time of last backup */
|
||||
HFSPlusBSDInfo bsdInfo; /* permissions (for MacOS X) */
|
||||
FndrDirInfo userInfo; /* Finder information */
|
||||
FndrOpaqueInfo finderInfo; /* additional Finder information */
|
||||
u_int32_t textEncoding; /* hint for name conversions */
|
||||
u_int32_t folderCount; /* number of enclosed folders, active when HasFolderCount is set */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusCatalogFolder HFSPlusCatalogFolder;
|
||||
|
||||
/* HFS catalog file record - 102 bytes */
|
||||
struct HFSCatalogFile {
|
||||
int16_t recordType; /* == kHFSFileRecord */
|
||||
u_int8_t flags; /* file flags */
|
||||
int8_t fileType; /* file type (unused ?) */
|
||||
FndrFileInfo userInfo; /* Finder information */
|
||||
u_int32_t fileID; /* file ID */
|
||||
u_int16_t dataStartBlock; /* not used - set to zero */
|
||||
int32_t dataLogicalSize; /* logical EOF of data fork */
|
||||
int32_t dataPhysicalSize; /* physical EOF of data fork */
|
||||
u_int16_t rsrcStartBlock; /* not used - set to zero */
|
||||
int32_t rsrcLogicalSize; /* logical EOF of resource fork */
|
||||
int32_t rsrcPhysicalSize; /* physical EOF of resource fork */
|
||||
u_int32_t createDate; /* date and time of creation */
|
||||
u_int32_t modifyDate; /* date and time of last modification */
|
||||
u_int32_t backupDate; /* date and time of last backup */
|
||||
FndrOpaqueInfo finderInfo; /* additional Finder information */
|
||||
u_int16_t clumpSize; /* file clump size (not used) */
|
||||
HFSExtentRecord dataExtents; /* first data fork extent record */
|
||||
HFSExtentRecord rsrcExtents; /* first resource fork extent record */
|
||||
u_int32_t reserved; /* reserved - initialized as zero */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSCatalogFile HFSCatalogFile;
|
||||
|
||||
/* HFS Plus catalog file record - 248 bytes */
|
||||
struct HFSPlusCatalogFile {
|
||||
int16_t recordType; /* == kHFSPlusFileRecord */
|
||||
u_int16_t flags; /* file flags */
|
||||
u_int32_t reserved1; /* reserved - initialized as zero */
|
||||
u_int32_t fileID; /* file ID */
|
||||
u_int32_t createDate; /* date and time of creation */
|
||||
u_int32_t contentModDate; /* date and time of last content modification */
|
||||
u_int32_t attributeModDate; /* date and time of last attribute modification */
|
||||
u_int32_t accessDate; /* date and time of last access (MacOS X only) */
|
||||
u_int32_t backupDate; /* date and time of last backup */
|
||||
HFSPlusBSDInfo bsdInfo; /* permissions (for MacOS X) */
|
||||
FndrFileInfo userInfo; /* Finder information */
|
||||
FndrOpaqueInfo finderInfo; /* additional Finder information */
|
||||
u_int32_t textEncoding; /* hint for name conversions */
|
||||
u_int32_t reserved2; /* reserved - initialized as zero */
|
||||
|
||||
/* Note: these start on double long (64 bit) boundary */
|
||||
HFSPlusForkData dataFork; /* size and block data for data fork */
|
||||
HFSPlusForkData resourceFork; /* size and block data for resource fork */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusCatalogFile HFSPlusCatalogFile;
|
||||
|
||||
/* HFS catalog thread record - 46 bytes */
|
||||
struct HFSCatalogThread {
|
||||
int16_t recordType; /* == kHFSFolderThreadRecord or kHFSFileThreadRecord */
|
||||
int32_t reserved[2]; /* reserved - initialized as zero */
|
||||
u_int32_t parentID; /* parent ID for this catalog node */
|
||||
u_int8_t nodeName[kHFSMaxFileNameChars + 1]; /* name of this catalog node */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSCatalogThread HFSCatalogThread;
|
||||
|
||||
/* HFS Plus catalog thread record -- 264 bytes */
|
||||
struct HFSPlusCatalogThread {
|
||||
int16_t recordType; /* == kHFSPlusFolderThreadRecord or kHFSPlusFileThreadRecord */
|
||||
int16_t reserved; /* reserved - initialized as zero */
|
||||
u_int32_t parentID; /* parent ID for this catalog node */
|
||||
HFSUniStr255 nodeName; /* name of this catalog node (variable length) */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusCatalogThread HFSPlusCatalogThread;
|
||||
|
||||
#ifdef __APPLE_API_UNSTABLE
|
||||
/*
|
||||
* These are the types of records in the attribute B-tree. The values were
|
||||
* chosen so that they wouldn't conflict with the catalog record types.
|
||||
*/
|
||||
enum {
|
||||
kHFSPlusAttrInlineData = 0x10, /* attributes whose data fits in a b-tree node */
|
||||
kHFSPlusAttrForkData = 0x20, /* extent based attributes (data lives in extents) */
|
||||
kHFSPlusAttrExtents = 0x30 /* overflow extents for large attributes */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* HFSPlusAttrForkData
|
||||
* For larger attributes, whose value is stored in allocation blocks.
|
||||
* If the attribute has more than 8 extents, there will be additional
|
||||
* records (of type HFSPlusAttrExtents) for this attribute.
|
||||
*/
|
||||
struct HFSPlusAttrForkData {
|
||||
u_int32_t recordType; /* == kHFSPlusAttrForkData*/
|
||||
u_int32_t reserved;
|
||||
HFSPlusForkData theFork; /* size and first extents of value*/
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusAttrForkData HFSPlusAttrForkData;
|
||||
|
||||
/*
|
||||
* HFSPlusAttrExtents
|
||||
* This record contains information about overflow extents for large,
|
||||
* fragmented attributes.
|
||||
*/
|
||||
struct HFSPlusAttrExtents {
|
||||
u_int32_t recordType; /* == kHFSPlusAttrExtents*/
|
||||
u_int32_t reserved;
|
||||
HFSPlusExtentRecord extents; /* additional extents*/
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusAttrExtents HFSPlusAttrExtents;
|
||||
|
||||
/*
|
||||
* Atrributes B-tree Data Record
|
||||
*
|
||||
* For small attributes, whose entire value is stored
|
||||
* within a single B-tree record.
|
||||
*/
|
||||
struct HFSPlusAttrData {
|
||||
u_int32_t recordType; /* == kHFSPlusAttrInlineData */
|
||||
u_int32_t reserved[2];
|
||||
u_int32_t attrSize; /* size of attribute data in bytes */
|
||||
u_int8_t attrData[2]; /* variable length */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusAttrData HFSPlusAttrData;
|
||||
|
||||
|
||||
/* HFSPlusAttrInlineData is obsolete use HFSPlusAttrData instead */
|
||||
struct HFSPlusAttrInlineData {
|
||||
u_int32_t recordType;
|
||||
u_int32_t reserved;
|
||||
u_int32_t logicalSize;
|
||||
u_int8_t userData[2];
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusAttrInlineData HFSPlusAttrInlineData;
|
||||
|
||||
|
||||
/* A generic Attribute Record */
|
||||
union HFSPlusAttrRecord {
|
||||
u_int32_t recordType;
|
||||
HFSPlusAttrInlineData inlineData; /* NOT USED */
|
||||
HFSPlusAttrData attrData;
|
||||
HFSPlusAttrForkData forkData;
|
||||
HFSPlusAttrExtents overflowExtents;
|
||||
};
|
||||
typedef union HFSPlusAttrRecord HFSPlusAttrRecord;
|
||||
|
||||
/* Attribute key */
|
||||
enum { kHFSMaxAttrNameLen = 127 };
|
||||
struct HFSPlusAttrKey {
|
||||
u_int16_t keyLength; /* key length (in bytes) */
|
||||
u_int16_t pad; /* set to zero */
|
||||
u_int32_t fileID; /* file associated with attribute */
|
||||
u_int32_t startBlock; /* first allocation block number for extents */
|
||||
u_int16_t attrNameLen; /* number of unicode characters */
|
||||
u_int16_t attrName[kHFSMaxAttrNameLen]; /* attribute name (Unicode) */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusAttrKey HFSPlusAttrKey;
|
||||
|
||||
#define kHFSPlusAttrKeyMaximumLength (sizeof(HFSPlusAttrKey) - sizeof(u_int16_t))
|
||||
#define kHFSPlusAttrKeyMinimumLength (kHFSPlusAttrKeyMaximumLength - kHFSMaxAttrNameLen*sizeof(u_int16_t))
|
||||
|
||||
#endif /* __APPLE_API_UNSTABLE */
|
||||
|
||||
|
||||
/* Key and node lengths */
|
||||
enum {
|
||||
kHFSPlusExtentKeyMaximumLength = sizeof(HFSPlusExtentKey) - sizeof(u_int16_t),
|
||||
kHFSExtentKeyMaximumLength = sizeof(HFSExtentKey) - sizeof(u_int8_t),
|
||||
kHFSPlusCatalogKeyMaximumLength = sizeof(HFSPlusCatalogKey) - sizeof(u_int16_t),
|
||||
kHFSPlusCatalogKeyMinimumLength = kHFSPlusCatalogKeyMaximumLength - sizeof(HFSUniStr255) + sizeof(u_int16_t),
|
||||
kHFSCatalogKeyMaximumLength = sizeof(HFSCatalogKey) - sizeof(u_int8_t),
|
||||
kHFSCatalogKeyMinimumLength = kHFSCatalogKeyMaximumLength - (kHFSMaxFileNameChars + 1) + sizeof(u_int8_t),
|
||||
kHFSPlusCatalogMinNodeSize = 4096,
|
||||
kHFSPlusExtentMinNodeSize = 512,
|
||||
kHFSPlusAttrMinNodeSize = 4096
|
||||
};
|
||||
|
||||
/* HFS and HFS Plus volume attribute bits */
|
||||
enum {
|
||||
/* Bits 0-6 are reserved (always cleared by MountVol call) */
|
||||
kHFSVolumeHardwareLockBit = 7, /* volume is locked by hardware */
|
||||
kHFSVolumeUnmountedBit = 8, /* volume was successfully unmounted */
|
||||
kHFSVolumeSparedBlocksBit = 9, /* volume has bad blocks spared */
|
||||
kHFSVolumeNoCacheRequiredBit = 10, /* don't cache volume blocks (i.e. RAM or ROM disk) */
|
||||
kHFSBootVolumeInconsistentBit = 11, /* boot volume is inconsistent (System 7.6 and later) */
|
||||
kHFSCatalogNodeIDsReusedBit = 12,
|
||||
kHFSVolumeJournaledBit = 13, /* this volume has a journal on it */
|
||||
kHFSVolumeInconsistentBit = 14, /* serious inconsistencies detected at runtime */
|
||||
kHFSVolumeSoftwareLockBit = 15, /* volume is locked by software */
|
||||
/*
|
||||
* HFS only has 16 bits of attributes in the MDB, but HFS Plus has 32 bits.
|
||||
* Therefore, bits 16-31 can only be used on HFS Plus.
|
||||
*/
|
||||
kHFSUnusedNodeFixBit = 31, /* Unused nodes in the Catalog B-tree have been zero-filled. See Radar #6947811. */
|
||||
kHFSContentProtectionBit = 30, /* Volume has per-file content protection */
|
||||
|
||||
/*** Keep these in sync with the bits above ! ****/
|
||||
kHFSVolumeHardwareLockMask = 0x00000080,
|
||||
kHFSVolumeUnmountedMask = 0x00000100,
|
||||
kHFSVolumeSparedBlocksMask = 0x00000200,
|
||||
kHFSVolumeNoCacheRequiredMask = 0x00000400,
|
||||
kHFSBootVolumeInconsistentMask = 0x00000800,
|
||||
kHFSCatalogNodeIDsReusedMask = 0x00001000,
|
||||
kHFSVolumeJournaledMask = 0x00002000,
|
||||
kHFSVolumeInconsistentMask = 0x00004000,
|
||||
kHFSVolumeSoftwareLockMask = 0x00008000,
|
||||
|
||||
/* Bits 16-31 are allocated from high to low */
|
||||
|
||||
kHFSContentProtectionMask = 0x40000000,
|
||||
kHFSUnusedNodeFixMask = 0x80000000,
|
||||
|
||||
kHFSMDBAttributesMask = 0x8380
|
||||
};
|
||||
|
||||
enum {
|
||||
kHFSUnusedNodesFixDate = 0xc5ef2480 /* March 25, 2009 */
|
||||
};
|
||||
|
||||
/* HFS Master Directory Block - 162 bytes */
|
||||
/* Stored at sector #2 (3rd sector) and second-to-last sector. */
|
||||
struct HFSMasterDirectoryBlock {
|
||||
u_int16_t drSigWord; /* == kHFSSigWord */
|
||||
u_int32_t drCrDate; /* date and time of volume creation */
|
||||
u_int32_t drLsMod; /* date and time of last modification */
|
||||
u_int16_t drAtrb; /* volume attributes */
|
||||
u_int16_t drNmFls; /* number of files in root folder */
|
||||
u_int16_t drVBMSt; /* first block of volume bitmap */
|
||||
u_int16_t drAllocPtr; /* start of next allocation search */
|
||||
u_int16_t drNmAlBlks; /* number of allocation blocks in volume */
|
||||
u_int32_t drAlBlkSiz; /* size (in bytes) of allocation blocks */
|
||||
u_int32_t drClpSiz; /* default clump size */
|
||||
u_int16_t drAlBlSt; /* first allocation block in volume */
|
||||
u_int32_t drNxtCNID; /* next unused catalog node ID */
|
||||
u_int16_t drFreeBks; /* number of unused allocation blocks */
|
||||
u_int8_t drVN[kHFSMaxVolumeNameChars + 1]; /* volume name */
|
||||
u_int32_t drVolBkUp; /* date and time of last backup */
|
||||
u_int16_t drVSeqNum; /* volume backup sequence number */
|
||||
u_int32_t drWrCnt; /* volume write count */
|
||||
u_int32_t drXTClpSiz; /* clump size for extents overflow file */
|
||||
u_int32_t drCTClpSiz; /* clump size for catalog file */
|
||||
u_int16_t drNmRtDirs; /* number of directories in root folder */
|
||||
u_int32_t drFilCnt; /* number of files in volume */
|
||||
u_int32_t drDirCnt; /* number of directories in volume */
|
||||
u_int32_t drFndrInfo[8]; /* information used by the Finder */
|
||||
u_int16_t drEmbedSigWord; /* embedded volume signature (formerly drVCSize) */
|
||||
HFSExtentDescriptor drEmbedExtent; /* embedded volume location and size (formerly drVBMCSize and drCtlCSize) */
|
||||
u_int32_t drXTFlSize; /* size of extents overflow file */
|
||||
HFSExtentRecord drXTExtRec; /* extent record for extents overflow file */
|
||||
u_int32_t drCTFlSize; /* size of catalog file */
|
||||
HFSExtentRecord drCTExtRec; /* extent record for catalog file */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSMasterDirectoryBlock HFSMasterDirectoryBlock;
|
||||
|
||||
|
||||
#ifdef __APPLE_API_UNSTABLE
|
||||
#define SET_HFS_TEXT_ENCODING(hint) \
|
||||
(0x656e6300 | ((hint) & 0xff))
|
||||
#define GET_HFS_TEXT_ENCODING(hint) \
|
||||
(((hint) & 0xffffff00) == 0x656e6300 ? (hint) & 0x000000ff : 0xffffffffU)
|
||||
#endif /* __APPLE_API_UNSTABLE */
|
||||
|
||||
|
||||
/* HFS Plus Volume Header - 512 bytes */
|
||||
/* Stored at sector #2 (3rd sector) and second-to-last sector. */
|
||||
struct HFSPlusVolumeHeader {
|
||||
u_int16_t signature; /* == kHFSPlusSigWord */
|
||||
u_int16_t version; /* == kHFSPlusVersion */
|
||||
u_int32_t attributes; /* volume attributes */
|
||||
u_int32_t lastMountedVersion; /* implementation version which last mounted volume */
|
||||
u_int32_t journalInfoBlock; /* block addr of journal info (if volume is journaled, zero otherwise) */
|
||||
|
||||
u_int32_t createDate; /* date and time of volume creation */
|
||||
u_int32_t modifyDate; /* date and time of last modification */
|
||||
u_int32_t backupDate; /* date and time of last backup */
|
||||
u_int32_t checkedDate; /* date and time of last disk check */
|
||||
|
||||
u_int32_t fileCount; /* number of files in volume */
|
||||
u_int32_t folderCount; /* number of directories in volume */
|
||||
|
||||
u_int32_t blockSize; /* size (in bytes) of allocation blocks */
|
||||
u_int32_t totalBlocks; /* number of allocation blocks in volume (includes this header and VBM*/
|
||||
u_int32_t freeBlocks; /* number of unused allocation blocks */
|
||||
|
||||
u_int32_t nextAllocation; /* start of next allocation search */
|
||||
u_int32_t rsrcClumpSize; /* default resource fork clump size */
|
||||
u_int32_t dataClumpSize; /* default data fork clump size */
|
||||
u_int32_t nextCatalogID; /* next unused catalog node ID */
|
||||
|
||||
u_int32_t writeCount; /* volume write count */
|
||||
u_int64_t encodingsBitmap; /* which encodings have been use on this volume */
|
||||
|
||||
u_int8_t finderInfo[32]; /* information used by the Finder */
|
||||
|
||||
HFSPlusForkData allocationFile; /* allocation bitmap file */
|
||||
HFSPlusForkData extentsFile; /* extents B-tree file */
|
||||
HFSPlusForkData catalogFile; /* catalog B-tree file */
|
||||
HFSPlusForkData attributesFile; /* extended attributes B-tree file */
|
||||
HFSPlusForkData startupFile; /* boot file (secondary loader) */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSPlusVolumeHeader HFSPlusVolumeHeader;
|
||||
|
||||
|
||||
/* B-tree structures */
|
||||
|
||||
enum BTreeKeyLimits{
|
||||
kMaxKeyLength = 520
|
||||
};
|
||||
|
||||
union BTreeKey{
|
||||
u_int8_t length8;
|
||||
u_int16_t length16;
|
||||
u_int8_t rawData [kMaxKeyLength+2];
|
||||
};
|
||||
typedef union BTreeKey BTreeKey;
|
||||
|
||||
/* BTNodeDescriptor -- Every B-tree node starts with these fields. */
|
||||
struct BTNodeDescriptor {
|
||||
u_int32_t fLink; /* next node at this level*/
|
||||
u_int32_t bLink; /* previous node at this level*/
|
||||
int8_t kind; /* kind of node (leaf, index, header, map)*/
|
||||
u_int8_t height; /* zero for header, map; child is one more than parent*/
|
||||
u_int16_t numRecords; /* number of records in this node*/
|
||||
u_int16_t reserved; /* reserved - initialized as zero */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct BTNodeDescriptor BTNodeDescriptor;
|
||||
|
||||
/* Constants for BTNodeDescriptor kind */
|
||||
enum {
|
||||
kBTLeafNode = -1,
|
||||
kBTIndexNode = 0,
|
||||
kBTHeaderNode = 1,
|
||||
kBTMapNode = 2
|
||||
};
|
||||
|
||||
/* BTHeaderRec -- The first record of a B-tree header node */
|
||||
struct BTHeaderRec {
|
||||
u_int16_t treeDepth; /* maximum height (usually leaf nodes) */
|
||||
u_int32_t rootNode; /* node number of root node */
|
||||
u_int32_t leafRecords; /* number of leaf records in all leaf nodes */
|
||||
u_int32_t firstLeafNode; /* node number of first leaf node */
|
||||
u_int32_t lastLeafNode; /* node number of last leaf node */
|
||||
u_int16_t nodeSize; /* size of a node, in bytes */
|
||||
u_int16_t maxKeyLength; /* reserved */
|
||||
u_int32_t totalNodes; /* total number of nodes in tree */
|
||||
u_int32_t freeNodes; /* number of unused (free) nodes in tree */
|
||||
u_int16_t reserved1; /* unused */
|
||||
u_int32_t clumpSize; /* reserved */
|
||||
u_int8_t btreeType; /* reserved */
|
||||
u_int8_t keyCompareType; /* Key string Comparison Type */
|
||||
u_int32_t attributes; /* persistent attributes about the tree */
|
||||
u_int32_t reserved3[16]; /* reserved */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct BTHeaderRec BTHeaderRec;
|
||||
|
||||
/* Constants for BTHeaderRec attributes */
|
||||
enum {
|
||||
kBTBadCloseMask = 0x00000001, /* reserved */
|
||||
kBTBigKeysMask = 0x00000002, /* key length field is 16 bits */
|
||||
kBTVariableIndexKeysMask = 0x00000004 /* keys in index nodes are variable length */
|
||||
};
|
||||
|
||||
|
||||
/* Catalog Key Name Comparison Type */
|
||||
enum {
|
||||
kHFSCaseFolding = 0xCF, /* case folding (case-insensitive) */
|
||||
kHFSBinaryCompare = 0xBC /* binary compare (case-sensitive) */
|
||||
};
|
||||
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
/* JournalInfoBlock - Structure that describes where our journal lives */
|
||||
|
||||
// the original size of the reserved field in the JournalInfoBlock was
|
||||
// 32*sizeof(u_int32_t). To keep the total size of the structure the
|
||||
// same we subtract the size of new fields (currently: ext_jnl_uuid and
|
||||
// machine_uuid). If you add additional fields, place them before the
|
||||
// reserved field and subtract their size in this macro.
|
||||
//
|
||||
#define JIB_RESERVED_SIZE ((32*sizeof(u_int32_t)) - sizeof(uuid_string_t) - 48)
|
||||
|
||||
struct JournalInfoBlock {
|
||||
u_int32_t flags;
|
||||
u_int32_t device_signature[8]; // signature used to locate our device.
|
||||
u_int64_t offset; // byte offset to the journal on the device
|
||||
u_int64_t size; // size in bytes of the journal
|
||||
uuid_string_t ext_jnl_uuid;
|
||||
char machine_serial_num[48];
|
||||
char reserved[JIB_RESERVED_SIZE];
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct JournalInfoBlock JournalInfoBlock;
|
||||
|
||||
enum {
|
||||
kJIJournalInFSMask = 0x00000001,
|
||||
kJIJournalOnOtherDeviceMask = 0x00000002,
|
||||
kJIJournalNeedInitMask = 0x00000004
|
||||
};
|
||||
|
||||
//
|
||||
// This the content type uuid for "external journal" GPT
|
||||
// partitions. Each instance of a partition also has a
|
||||
// uuid that uniquely identifies that instance.
|
||||
//
|
||||
#define EXTJNL_CONTENT_TYPE_UUID "4A6F7572-6E61-11AA-AA11-00306543ECAC"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __HFS_FORMAT__ */
|
||||
64
lib/libc/include/x86_64-macos-gnu/hfs/hfs_unistr.h
Normal file
64
lib/libc/include/x86_64-macos-gnu/hfs/hfs_unistr.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2013 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 __HFS_UNISTR__
|
||||
#define __HFS_UNISTR__
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* hfs_unitstr.h
|
||||
*
|
||||
* This file contains definition of the unicode string used for HFS Plus
|
||||
* files and folder names, as described by the on-disk format.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _HFSUNISTR255_DEFINED_
|
||||
#define _HFSUNISTR255_DEFINED_
|
||||
/* Unicode strings are used for HFS Plus file and folder names */
|
||||
struct HFSUniStr255 {
|
||||
u_int16_t length; /* number of unicode characters */
|
||||
u_int16_t unicode[255]; /* unicode characters */
|
||||
} __attribute__((aligned(2), packed));
|
||||
typedef struct HFSUniStr255 HFSUniStr255;
|
||||
typedef const HFSUniStr255 *ConstHFSUniStr255Param;
|
||||
#endif /* _HFSUNISTR255_DEFINED_ */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __HFS_UNISTR__ */
|
||||
46
lib/libc/include/x86_64-macos-gnu/i386/_param.h
Normal file
46
lib/libc/include/x86_64-macos-gnu/i386/_param.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2008 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 _I386__PARAM_H_
|
||||
#define _I386__PARAM_H_
|
||||
|
||||
#include <i386/_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 /* _I386__PARAM_H_ */
|
||||
94
lib/libc/include/x86_64-macos-gnu/i386/eflags.h
Normal file
94
lib/libc/include/x86_64-macos-gnu/i386/eflags.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* 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 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.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
#ifndef _I386_EFLAGS_H_
|
||||
#define _I386_EFLAGS_H_
|
||||
|
||||
/*
|
||||
* i386 flags register
|
||||
*/
|
||||
|
||||
#ifndef EFL_CF
|
||||
#define EFL_CF 0x00000001 /* carry */
|
||||
#define EFL_PF 0x00000004 /* parity of low 8 bits */
|
||||
#define EFL_AF 0x00000010 /* carry out of bit 3 */
|
||||
#define EFL_ZF 0x00000040 /* zero */
|
||||
#define EFL_SF 0x00000080 /* sign */
|
||||
#define EFL_TF 0x00000100 /* trace trap */
|
||||
#define EFL_IF 0x00000200 /* interrupt enable */
|
||||
#define EFL_DF 0x00000400 /* direction */
|
||||
#define EFL_OF 0x00000800 /* overflow */
|
||||
#define EFL_IOPL 0x00003000 /* IO privilege level: */
|
||||
#define EFL_IOPL_KERNEL 0x00000000 /* kernel */
|
||||
#define EFL_IOPL_USER 0x00003000 /* user */
|
||||
#define EFL_NT 0x00004000 /* nested task */
|
||||
#define EFL_RF 0x00010000 /* resume without tracing */
|
||||
#define EFL_VM 0x00020000 /* virtual 8086 mode */
|
||||
#define EFL_AC 0x00040000 /* alignment check */
|
||||
#define EFL_VIF 0x00080000 /* virtual interrupt flag */
|
||||
#define EFL_VIP 0x00100000 /* virtual interrupt pending */
|
||||
#define EFL_ID 0x00200000 /* cpuID instruction */
|
||||
#endif
|
||||
|
||||
#define EFL_CLR 0xfff88028
|
||||
#define EFL_SET 0x00000002
|
||||
|
||||
#define EFL_USER_SET (EFL_IF)
|
||||
#define EFL_USER_CLEAR (EFL_IOPL|EFL_NT|EFL_RF)
|
||||
|
||||
#endif /* _I386_EFLAGS_H_ */
|
||||
171
lib/libc/include/x86_64-macos-gnu/i386/param.h
Normal file
171
lib/libc/include/x86_64-macos-gnu/i386/param.h
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2010 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) 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 Intel 386.
|
||||
*/
|
||||
|
||||
#ifndef _I386_PARAM_H_
|
||||
#define _I386_PARAM_H_
|
||||
|
||||
#include <i386/_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 (128 * 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 ((1024 * 1024) / MCLBYTES) /* cl map size: 1MB */
|
||||
#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 /* _I386_PARAM_H_ */
|
||||
193
lib/libc/include/x86_64-macos-gnu/iconv.h
Normal file
193
lib/libc/include/x86_64-macos-gnu/iconv.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/* Copyright (C) 1999-2003, 2005-2006 Free Software Foundation, Inc.
|
||||
This file is part of the GNU LIBICONV Library.
|
||||
|
||||
The GNU LIBICONV Library is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
The GNU LIBICONV Library is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU LIBICONV Library; see the file COPYING.LIB.
|
||||
If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
/* When installed, this file is called "iconv.h". */
|
||||
|
||||
#ifndef _LIBICONV_H
|
||||
#define _LIBICONV_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <_types.h>
|
||||
#include <sys/_types/_size_t.h>
|
||||
|
||||
#define _LIBICONV_VERSION 0x010B /* version number: (major<<8) + minor */
|
||||
|
||||
#if BUILDING_LIBICONV
|
||||
#define __LIBICONV_DLL_EXPORTED __attribute__((__visibility__("default")))
|
||||
#else
|
||||
#define __LIBICONV_DLL_EXPORTED
|
||||
#endif
|
||||
extern __LIBICONV_DLL_EXPORTED int _libiconv_version; /* Likewise */
|
||||
|
||||
/* We would like to #include any system header file which could define
|
||||
iconv_t, 1. in order to eliminate the risk that the user gets compilation
|
||||
errors because some other system header file includes /usr/include/iconv.h
|
||||
which defines iconv_t or declares iconv after this file, 2. when compiling
|
||||
for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
|
||||
binary compatible code.
|
||||
But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
|
||||
has been installed in /usr/local/include, there is no way any more to
|
||||
include the original /usr/include/iconv.h. We simply have to get away
|
||||
without it.
|
||||
Ad 1. The risk that a system header file does
|
||||
#include "iconv.h" or #include_next "iconv.h"
|
||||
is small. They all do #include <iconv.h>.
|
||||
Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
|
||||
has to be a scalar type because (iconv_t)(-1) is a possible return value
|
||||
from iconv_open().) */
|
||||
|
||||
/* Define iconv_t ourselves. */
|
||||
#ifndef _ICONV_T
|
||||
#define _ICONV_T
|
||||
typedef void* iconv_t;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Allocates descriptor for code conversion from encoding `fromcode' to
|
||||
encoding `tocode'. */
|
||||
extern __LIBICONV_DLL_EXPORTED iconv_t iconv_open (const char* __tocode, const char* __fromcode);
|
||||
|
||||
/* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes
|
||||
starting at `*inbuf', writing at most `*outbytesleft' bytes starting at
|
||||
`*outbuf'.
|
||||
Decrements `*inbytesleft' and increments `*inbuf' by the same amount.
|
||||
Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */
|
||||
extern __LIBICONV_DLL_EXPORTED size_t iconv (iconv_t __cd, char* * __restrict __inbuf, size_t * __restrict __inbytesleft, char* * __restrict __outbuf, size_t * __restrict __outbytesleft);
|
||||
|
||||
/* Frees resources allocated for conversion descriptor `cd'. */
|
||||
extern __LIBICONV_DLL_EXPORTED int iconv_close (iconv_t _cd);
|
||||
|
||||
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
|
||||
|
||||
/* Nonstandard extensions. */
|
||||
|
||||
#include <sys/_types/_wchar_t.h>
|
||||
|
||||
/* Control of attributes. */
|
||||
extern __LIBICONV_DLL_EXPORTED int iconvctl (iconv_t cd, int request, void* argument);
|
||||
|
||||
/* Hook performed after every successful conversion of a Unicode character. */
|
||||
typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data);
|
||||
/* Hook performed after every successful conversion of a wide character. */
|
||||
typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data);
|
||||
/* Set of hooks. */
|
||||
struct iconv_hooks {
|
||||
iconv_unicode_char_hook uc_hook;
|
||||
iconv_wide_char_hook wc_hook;
|
||||
void* data;
|
||||
};
|
||||
|
||||
/* Fallback function. Invoked when a small number of bytes could not be
|
||||
converted to a Unicode character. This function should process all
|
||||
bytes from inbuf and may produce replacement Unicode characters by calling
|
||||
the write_replacement callback repeatedly. */
|
||||
typedef void (*iconv_unicode_mb_to_uc_fallback)
|
||||
(const char* inbuf, size_t inbufsize,
|
||||
void (*write_replacement) (const unsigned int *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
/* Fallback function. Invoked when a Unicode character could not be converted
|
||||
to the target encoding. This function should process the character and
|
||||
may produce replacement bytes (in the target encoding) by calling the
|
||||
write_replacement callback repeatedly. */
|
||||
typedef void (*iconv_unicode_uc_to_mb_fallback)
|
||||
(unsigned int code,
|
||||
void (*write_replacement) (const char *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
#if 1
|
||||
/* Fallback function. Invoked when a number of bytes could not be converted to
|
||||
a wide character. This function should process all bytes from inbuf and may
|
||||
produce replacement wide characters by calling the write_replacement
|
||||
callback repeatedly. */
|
||||
typedef void (*iconv_wchar_mb_to_wc_fallback)
|
||||
(const char* inbuf, size_t inbufsize,
|
||||
void (*write_replacement) (const wchar_t *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
/* Fallback function. Invoked when a wide character could not be converted to
|
||||
the target encoding. This function should process the character and may
|
||||
produce replacement bytes (in the target encoding) by calling the
|
||||
write_replacement callback repeatedly. */
|
||||
typedef void (*iconv_wchar_wc_to_mb_fallback)
|
||||
(wchar_t code,
|
||||
void (*write_replacement) (const char *buf, size_t buflen,
|
||||
void* callback_arg),
|
||||
void* callback_arg,
|
||||
void* data);
|
||||
#else
|
||||
/* If the wchar_t type does not exist, these two fallback functions are never
|
||||
invoked. Their argument list therefore does not matter. */
|
||||
typedef void (*iconv_wchar_mb_to_wc_fallback) ();
|
||||
typedef void (*iconv_wchar_wc_to_mb_fallback) ();
|
||||
#endif
|
||||
/* Set of fallbacks. */
|
||||
struct iconv_fallbacks {
|
||||
iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback;
|
||||
iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback;
|
||||
iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback;
|
||||
iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback;
|
||||
void* data;
|
||||
};
|
||||
|
||||
/* Requests for iconvctl. */
|
||||
#define ICONV_TRIVIALP 0 /* int *argument */
|
||||
#define ICONV_GET_TRANSLITERATE 1 /* int *argument */
|
||||
#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */
|
||||
#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */
|
||||
#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */
|
||||
#define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */
|
||||
#define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */
|
||||
|
||||
/* Listing of locale independent encodings. */
|
||||
extern __LIBICONV_DLL_EXPORTED void iconvlist (int (*do_one) (unsigned int namescount,
|
||||
const char * const * names,
|
||||
void* data),
|
||||
void* data);
|
||||
|
||||
/* Canonicalize an encoding name.
|
||||
The result is either a canonical encoding name, or name itself. */
|
||||
extern __LIBICONV_DLL_EXPORTED const char * iconv_canonicalize (const char * name);
|
||||
|
||||
/* Support for relocatable packages. */
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
extern __LIBICONV_DLL_EXPORTED void libiconv_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
|
||||
#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _LIBICONV_H */
|
||||
120
lib/libc/include/x86_64-macos-gnu/langinfo.h
Normal file
120
lib/libc/include/x86_64-macos-gnu/langinfo.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/*-
|
||||
* Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
|
||||
*
|
||||
* $FreeBSD: /repoman/r/ncvs/src/include/langinfo.h,v 1.6 2002/09/18 05:54:25 mike Exp $
|
||||
*/
|
||||
|
||||
#ifndef _LANGINFO_H_
|
||||
#define _LANGINFO_H_
|
||||
|
||||
#include <_types.h>
|
||||
#include <_types/_nl_item.h>
|
||||
|
||||
#define CODESET 0 /* codeset name */
|
||||
#define D_T_FMT 1 /* string for formatting date and time */
|
||||
#define D_FMT 2 /* date format string */
|
||||
#define T_FMT 3 /* time format string */
|
||||
#define T_FMT_AMPM 4 /* a.m. or p.m. time formatting string */
|
||||
#define AM_STR 5 /* Ante Meridian affix */
|
||||
#define PM_STR 6 /* Post Meridian affix */
|
||||
|
||||
/* week day names */
|
||||
#define DAY_1 7
|
||||
#define DAY_2 8
|
||||
#define DAY_3 9
|
||||
#define DAY_4 10
|
||||
#define DAY_5 11
|
||||
#define DAY_6 12
|
||||
#define DAY_7 13
|
||||
|
||||
/* abbreviated week day names */
|
||||
#define ABDAY_1 14
|
||||
#define ABDAY_2 15
|
||||
#define ABDAY_3 16
|
||||
#define ABDAY_4 17
|
||||
#define ABDAY_5 18
|
||||
#define ABDAY_6 19
|
||||
#define ABDAY_7 20
|
||||
|
||||
/* month names */
|
||||
#define MON_1 21
|
||||
#define MON_2 22
|
||||
#define MON_3 23
|
||||
#define MON_4 24
|
||||
#define MON_5 25
|
||||
#define MON_6 26
|
||||
#define MON_7 27
|
||||
#define MON_8 28
|
||||
#define MON_9 29
|
||||
#define MON_10 30
|
||||
#define MON_11 31
|
||||
#define MON_12 32
|
||||
|
||||
/* abbreviated month names */
|
||||
#define ABMON_1 33
|
||||
#define ABMON_2 34
|
||||
#define ABMON_3 35
|
||||
#define ABMON_4 36
|
||||
#define ABMON_5 37
|
||||
#define ABMON_6 38
|
||||
#define ABMON_7 39
|
||||
#define ABMON_8 40
|
||||
#define ABMON_9 41
|
||||
#define ABMON_10 42
|
||||
#define ABMON_11 43
|
||||
#define ABMON_12 44
|
||||
|
||||
#define ERA 45 /* era description segments */
|
||||
#define ERA_D_FMT 46 /* era date format string */
|
||||
#define ERA_D_T_FMT 47 /* era date and time format string */
|
||||
#define ERA_T_FMT 48 /* era time format string */
|
||||
#define ALT_DIGITS 49 /* alternative symbols for digits */
|
||||
|
||||
#define RADIXCHAR 50 /* radix char */
|
||||
#define THOUSEP 51 /* separator for thousands */
|
||||
|
||||
#define YESEXPR 52 /* affirmative response expression */
|
||||
#define NOEXPR 53 /* negative response expression */
|
||||
|
||||
#if (__DARWIN_C_LEVEL > __DARWIN_C_ANSI && __DARWIN_C_LEVEL < 200112L) || __DARWIN_C_LEVEL == __DARWIN_C_FULL
|
||||
#define YESSTR 54 /* affirmative response for yes/no queries */
|
||||
#define NOSTR 55 /* negative response for yes/no queries */
|
||||
#endif
|
||||
|
||||
#define CRNCYSTR 56 /* currency symbol */
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
|
||||
#define D_MD_ORDER 57 /* month/day order (local extension) */
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
char *nl_langinfo(nl_item);
|
||||
__END_DECLS
|
||||
|
||||
#ifdef _USE_EXTENDED_LOCALES_
|
||||
#include <xlocale/_langinfo.h>
|
||||
#endif /* _USE_EXTENDED_LOCALES_ */
|
||||
|
||||
#endif /* !_LANGINFO_H_ */
|
||||
409
lib/libc/include/x86_64-macos-gnu/launch.h
Normal file
409
lib/libc/include/x86_64-macos-gnu/launch.h
Normal file
@@ -0,0 +1,409 @@
|
||||
#ifndef __XPC_LAUNCH_H__
|
||||
#define __XPC_LAUNCH_H__
|
||||
|
||||
/*!
|
||||
* @header
|
||||
* These interfaces were only ever documented for the purpose of allowing a
|
||||
* launchd job to obtain file descriptors associated with the sockets it
|
||||
* advertised in its launchd.plist(5). That functionality is now available in a
|
||||
* much more straightforward fashion through the {@link launch_activate_socket}
|
||||
* API.
|
||||
*
|
||||
* There are currently no replacements for other uses of the {@link launch_msg}
|
||||
* API, including submitting, removing, starting, stopping and listing jobs.
|
||||
*/
|
||||
|
||||
#include <os/base.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#include <mach/mach.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if __has_feature(assume_nonnull)
|
||||
_Pragma("clang assume_nonnull begin")
|
||||
#endif
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define LAUNCH_KEY_SUBMITJOB "SubmitJob"
|
||||
#define LAUNCH_KEY_REMOVEJOB "RemoveJob"
|
||||
#define LAUNCH_KEY_STARTJOB "StartJob"
|
||||
#define LAUNCH_KEY_STOPJOB "StopJob"
|
||||
#define LAUNCH_KEY_GETJOB "GetJob"
|
||||
#define LAUNCH_KEY_GETJOBS "GetJobs"
|
||||
#define LAUNCH_KEY_CHECKIN "CheckIn"
|
||||
|
||||
#define LAUNCH_JOBKEY_LABEL "Label"
|
||||
#define LAUNCH_JOBKEY_DISABLED "Disabled"
|
||||
#define LAUNCH_JOBKEY_USERNAME "UserName"
|
||||
#define LAUNCH_JOBKEY_GROUPNAME "GroupName"
|
||||
#define LAUNCH_JOBKEY_TIMEOUT "TimeOut"
|
||||
#define LAUNCH_JOBKEY_EXITTIMEOUT "ExitTimeOut"
|
||||
#define LAUNCH_JOBKEY_INITGROUPS "InitGroups"
|
||||
#define LAUNCH_JOBKEY_SOCKETS "Sockets"
|
||||
#define LAUNCH_JOBKEY_MACHSERVICES "MachServices"
|
||||
#define LAUNCH_JOBKEY_MACHSERVICELOOKUPPOLICIES "MachServiceLookupPolicies"
|
||||
#define LAUNCH_JOBKEY_INETDCOMPATIBILITY "inetdCompatibility"
|
||||
#define LAUNCH_JOBKEY_ENABLEGLOBBING "EnableGlobbing"
|
||||
#define LAUNCH_JOBKEY_PROGRAMARGUMENTS "ProgramArguments"
|
||||
#define LAUNCH_JOBKEY_PROGRAM "Program"
|
||||
#define LAUNCH_JOBKEY_ONDEMAND "OnDemand"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE "KeepAlive"
|
||||
#define LAUNCH_JOBKEY_LIMITLOADTOHOSTS "LimitLoadToHosts"
|
||||
#define LAUNCH_JOBKEY_LIMITLOADFROMHOSTS "LimitLoadFromHosts"
|
||||
#define LAUNCH_JOBKEY_LIMITLOADTOSESSIONTYPE "LimitLoadToSessionType"
|
||||
#define LAUNCH_JOBKEY_LIMITLOADTOHARDWARE "LimitLoadToHardware"
|
||||
#define LAUNCH_JOBKEY_LIMITLOADFROMHARDWARE "LimitLoadFromHardware"
|
||||
#define LAUNCH_JOBKEY_RUNATLOAD "RunAtLoad"
|
||||
#define LAUNCH_JOBKEY_ROOTDIRECTORY "RootDirectory"
|
||||
#define LAUNCH_JOBKEY_WORKINGDIRECTORY "WorkingDirectory"
|
||||
#define LAUNCH_JOBKEY_ENVIRONMENTVARIABLES "EnvironmentVariables"
|
||||
#define LAUNCH_JOBKEY_USERENVIRONMENTVARIABLES "UserEnvironmentVariables"
|
||||
#define LAUNCH_JOBKEY_UMASK "Umask"
|
||||
#define LAUNCH_JOBKEY_NICE "Nice"
|
||||
#define LAUNCH_JOBKEY_HOPEFULLYEXITSFIRST "HopefullyExitsFirst"
|
||||
#define LAUNCH_JOBKEY_HOPEFULLYEXITSLAST "HopefullyExitsLast"
|
||||
#define LAUNCH_JOBKEY_LOWPRIORITYIO "LowPriorityIO"
|
||||
#define LAUNCH_JOBKEY_LOWPRIORITYBACKGROUNDIO "LowPriorityBackgroundIO"
|
||||
#define LAUNCH_JOBKEY_MATERIALIZEDATALESSFILES "MaterializeDatalessFiles"
|
||||
#define LAUNCH_JOBKEY_SESSIONCREATE "SessionCreate"
|
||||
#define LAUNCH_JOBKEY_STARTONMOUNT "StartOnMount"
|
||||
#define LAUNCH_JOBKEY_SOFTRESOURCELIMITS "SoftResourceLimits"
|
||||
#define LAUNCH_JOBKEY_HARDRESOURCELIMITS "HardResourceLimits"
|
||||
#define LAUNCH_JOBKEY_STANDARDINPATH "StandardInPath"
|
||||
#define LAUNCH_JOBKEY_STANDARDOUTPATH "StandardOutPath"
|
||||
#define LAUNCH_JOBKEY_STANDARDERRORPATH "StandardErrorPath"
|
||||
#define LAUNCH_JOBKEY_DEBUG "Debug"
|
||||
#define LAUNCH_JOBKEY_WAITFORDEBUGGER "WaitForDebugger"
|
||||
#define LAUNCH_JOBKEY_QUEUEDIRECTORIES "QueueDirectories"
|
||||
#define LAUNCH_JOBKEY_HOMERELATIVEQUEUEDIRECTORIES "HomeRelativeQueueDirectories"
|
||||
#define LAUNCH_JOBKEY_WATCHPATHS "WatchPaths"
|
||||
#define LAUNCH_JOBKEY_STARTINTERVAL "StartInterval"
|
||||
#define LAUNCH_JOBKEY_STARTCALENDARINTERVAL "StartCalendarInterval"
|
||||
#define LAUNCH_JOBKEY_BONJOURFDS "BonjourFDs"
|
||||
#define LAUNCH_JOBKEY_LASTEXITSTATUS "LastExitStatus"
|
||||
#define LAUNCH_JOBKEY_PID "PID"
|
||||
#define LAUNCH_JOBKEY_THROTTLEINTERVAL "ThrottleInterval"
|
||||
#define LAUNCH_JOBKEY_LAUNCHONLYONCE "LaunchOnlyOnce"
|
||||
#define LAUNCH_JOBKEY_ABANDONPROCESSGROUP "AbandonProcessGroup"
|
||||
#define LAUNCH_JOBKEY_IGNOREPROCESSGROUPATSHUTDOWN \
|
||||
"IgnoreProcessGroupAtShutdown"
|
||||
#define LAUNCH_JOBKEY_LEGACYTIMERS "LegacyTimers"
|
||||
#define LAUNCH_JOBKEY_ENABLEPRESSUREDEXIT "EnablePressuredExit"
|
||||
#define LAUNCH_JOBKEY_ENABLETRANSACTIONS "EnableTransactions"
|
||||
#define LAUNCH_JOBKEY_DRAINMESSAGESONFAILEDINIT "DrainMessagesOnFailedInit"
|
||||
#define LAUNCH_JOBKEY_POLICIES "Policies"
|
||||
|
||||
#define LAUNCH_JOBKEY_PUBLISHESEVENTS "PublishesEvents"
|
||||
#define LAUNCH_KEY_PUBLISHESEVENTS_DOMAININTERNAL "DomainInternal"
|
||||
|
||||
#define LAUNCH_JOBPOLICY_DENYCREATINGOTHERJOBS "DenyCreatingOtherJobs"
|
||||
|
||||
#define LAUNCH_JOBINETDCOMPATIBILITY_WAIT "Wait"
|
||||
#define LAUNCH_JOBINETDCOMPATIBILITY_INSTANCES "Instances"
|
||||
|
||||
#define LAUNCH_JOBKEY_MACH_RESETATCLOSE "ResetAtClose"
|
||||
#define LAUNCH_JOBKEY_MACH_HIDEUNTILCHECKIN "HideUntilCheckIn"
|
||||
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_SUCCESSFULEXIT "SuccessfulExit"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_NETWORKSTATE "NetworkState"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_PATHSTATE "PathState"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_HOMERELATIVEPATHSTATE "HomeRelativePathState"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBACTIVE "OtherJobActive"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_OTHERJOBENABLED "OtherJobEnabled"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_AFTERINITIALDEMAND "AfterInitialDemand"
|
||||
#define LAUNCH_JOBKEY_KEEPALIVE_CRASHED "Crashed"
|
||||
|
||||
#define LAUNCH_JOBKEY_LAUNCHEVENTS "LaunchEvents"
|
||||
|
||||
#define LAUNCH_JOBKEY_CAL_MINUTE "Minute"
|
||||
#define LAUNCH_JOBKEY_CAL_HOUR "Hour"
|
||||
#define LAUNCH_JOBKEY_CAL_DAY "Day"
|
||||
#define LAUNCH_JOBKEY_CAL_WEEKDAY "Weekday"
|
||||
#define LAUNCH_JOBKEY_CAL_MONTH "Month"
|
||||
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_CORE "Core"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_CPU "CPU"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_DATA "Data"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_FSIZE "FileSize"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_MEMLOCK "MemoryLock"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_NOFILE "NumberOfFiles"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_NPROC "NumberOfProcesses"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_RSS "ResidentSetSize"
|
||||
#define LAUNCH_JOBKEY_RESOURCELIMIT_STACK "Stack"
|
||||
|
||||
#define LAUNCH_JOBKEY_DISABLED_MACHINETYPE "MachineType"
|
||||
#define LAUNCH_JOBKEY_DISABLED_MODELNAME "ModelName"
|
||||
|
||||
#define LAUNCH_JOBKEY_DATASTORES "Datastores"
|
||||
#define LAUNCH_JOBKEY_DATASTORES_SIZELIMIT "SizeLimit"
|
||||
|
||||
#define LAUNCH_JOBSOCKETKEY_TYPE "SockType"
|
||||
#define LAUNCH_JOBSOCKETKEY_PASSIVE "SockPassive"
|
||||
#define LAUNCH_JOBSOCKETKEY_BONJOUR "Bonjour"
|
||||
#define LAUNCH_JOBSOCKETKEY_SECUREWITHKEY "SecureSocketWithKey"
|
||||
#define LAUNCH_JOBSOCKETKEY_PATHNAME "SockPathName"
|
||||
#define LAUNCH_JOBSOCKETKEY_PATHMODE "SockPathMode"
|
||||
#define LAUNCH_JOBSOCKETKEY_PATHOWNER "SockPathOwner"
|
||||
#define LAUNCH_JOBSOCKETKEY_PATHGROUP "SockPathGroup"
|
||||
#define LAUNCH_JOBSOCKETKEY_NODENAME "SockNodeName"
|
||||
#define LAUNCH_JOBSOCKETKEY_SERVICENAME "SockServiceName"
|
||||
#define LAUNCH_JOBSOCKETKEY_FAMILY "SockFamily"
|
||||
#define LAUNCH_JOBSOCKETKEY_PROTOCOL "SockProtocol"
|
||||
#define LAUNCH_JOBSOCKETKEY_MULTICASTGROUP "MulticastGroup"
|
||||
|
||||
#define LAUNCH_JOBKEY_PROCESSTYPE "ProcessType"
|
||||
#define LAUNCH_KEY_PROCESSTYPE_APP "App"
|
||||
#define LAUNCH_KEY_PROCESSTYPE_STANDARD "Standard"
|
||||
#define LAUNCH_KEY_PROCESSTYPE_BACKGROUND "Background"
|
||||
#define LAUNCH_KEY_PROCESSTYPE_INTERACTIVE "Interactive"
|
||||
#define LAUNCH_KEY_PROCESSTYPE_ADAPTIVE "Adaptive"
|
||||
|
||||
/*!
|
||||
* @function launch_activate_socket
|
||||
*
|
||||
* @abstract
|
||||
* Retrieves the file descriptors for sockets specified in the process'
|
||||
* launchd.plist(5).
|
||||
*
|
||||
* @param name
|
||||
* The name of the socket entry in the service's Sockets dictionary.
|
||||
*
|
||||
* @param fds
|
||||
* On return, this parameter will be populated with an array of file
|
||||
* descriptors. One socket can have many descriptors associated with it
|
||||
* depending on the characteristics of the network interfaces on the system.
|
||||
* The descriptors in this array are the results of calling getaddrinfo(3) with
|
||||
* the parameters described in launchd.plist(5).
|
||||
*
|
||||
* The caller is responsible for calling free(3) on the returned pointer.
|
||||
*
|
||||
* @param cnt
|
||||
* The number of file descriptor entries in the returned array.
|
||||
*
|
||||
* @result
|
||||
* On success, zero is returned. Otherwise, an appropriate POSIX-domain is
|
||||
* returned. Possible error codes are:
|
||||
*
|
||||
* ENOENT -> There was no socket of the specified name owned by the caller.
|
||||
* ESRCH -> The caller is not a process managed by launchd.
|
||||
* EALREADY -> The socket has already been activated by the caller.
|
||||
*/
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1 OS_NONNULL2 OS_NONNULL3
|
||||
int
|
||||
launch_activate_socket(const char *name,
|
||||
int * _Nonnull * _Nullable fds, size_t *cnt);
|
||||
|
||||
typedef struct _launch_data *launch_data_t;
|
||||
typedef void (*launch_data_dict_iterator_t)(const launch_data_t lval,
|
||||
const char *key, void * _Nullable ctx);
|
||||
|
||||
typedef enum {
|
||||
LAUNCH_DATA_DICTIONARY = 1,
|
||||
LAUNCH_DATA_ARRAY,
|
||||
LAUNCH_DATA_FD,
|
||||
LAUNCH_DATA_INTEGER,
|
||||
LAUNCH_DATA_REAL,
|
||||
LAUNCH_DATA_BOOL,
|
||||
LAUNCH_DATA_STRING,
|
||||
LAUNCH_DATA_OPAQUE,
|
||||
LAUNCH_DATA_ERRNO,
|
||||
LAUNCH_DATA_MACHPORT,
|
||||
} launch_data_type_t;
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT
|
||||
launch_data_t
|
||||
launch_data_alloc(launch_data_type_t type);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT OS_NONNULL1
|
||||
launch_data_t
|
||||
launch_data_copy(launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
launch_data_type_t
|
||||
launch_data_get_type(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1
|
||||
void
|
||||
launch_data_free(launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1 OS_NONNULL2 OS_NONNULL3
|
||||
bool
|
||||
launch_data_dict_insert(launch_data_t ldict, const launch_data_t lval,
|
||||
const char *key);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1 OS_NONNULL2
|
||||
launch_data_t _Nullable
|
||||
launch_data_dict_lookup(const launch_data_t ldict, const char *key);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1 OS_NONNULL2
|
||||
bool
|
||||
launch_data_dict_remove(launch_data_t ldict, const char *key);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1 OS_NONNULL2
|
||||
void
|
||||
launch_data_dict_iterate(const launch_data_t ldict,
|
||||
launch_data_dict_iterator_t iterator, void * _Nullable ctx);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
size_t
|
||||
launch_data_dict_get_count(const launch_data_t ldict);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1 OS_NONNULL2
|
||||
bool
|
||||
launch_data_array_set_index(launch_data_t larray, const launch_data_t lval,
|
||||
size_t idx);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
launch_data_t
|
||||
launch_data_array_get_index(const launch_data_t larray, size_t idx);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
size_t
|
||||
launch_data_array_get_count(const launch_data_t larray);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT
|
||||
launch_data_t
|
||||
launch_data_new_fd(int fd);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT
|
||||
launch_data_t
|
||||
launch_data_new_machport(mach_port_t val);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT
|
||||
launch_data_t
|
||||
launch_data_new_integer(long long val);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT
|
||||
launch_data_t
|
||||
launch_data_new_bool(bool val);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT
|
||||
launch_data_t
|
||||
launch_data_new_real(double val);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT
|
||||
launch_data_t
|
||||
launch_data_new_string(const char *val);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT
|
||||
launch_data_t
|
||||
launch_data_new_opaque(const void *bytes, size_t sz);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1
|
||||
bool
|
||||
launch_data_set_fd(launch_data_t ld, int fd);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1
|
||||
bool
|
||||
launch_data_set_machport(launch_data_t ld, mach_port_t mp);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1
|
||||
bool
|
||||
launch_data_set_integer(launch_data_t ld, long long val);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1
|
||||
bool
|
||||
launch_data_set_bool(launch_data_t ld, bool val);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1
|
||||
bool
|
||||
launch_data_set_real(launch_data_t ld, double val);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1
|
||||
bool
|
||||
launch_data_set_string(launch_data_t ld, const char *val);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_NONNULL1
|
||||
bool
|
||||
launch_data_set_opaque(launch_data_t ld, const void *bytes, size_t sz);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
int
|
||||
launch_data_get_fd(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
mach_port_t
|
||||
launch_data_get_machport(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
long long
|
||||
launch_data_get_integer(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
bool
|
||||
launch_data_get_bool(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
double
|
||||
launch_data_get_real(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
const char *
|
||||
launch_data_get_string(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
void *
|
||||
launch_data_get_opaque(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
size_t
|
||||
launch_data_get_opaque_size(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT OS_NONNULL1
|
||||
int
|
||||
launch_data_get_errno(const launch_data_t ld);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_WARN_RESULT
|
||||
int
|
||||
launch_get_fd(void);
|
||||
|
||||
__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_10, __IPHONE_2_0, __IPHONE_8_0)
|
||||
OS_EXPORT OS_MALLOC OS_WARN_RESULT OS_NONNULL1
|
||||
launch_data_t
|
||||
launch_msg(const launch_data_t request);
|
||||
|
||||
__END_DECLS
|
||||
#if __has_feature(assume_nonnull)
|
||||
_Pragma("clang assume_nonnull end")
|
||||
#endif
|
||||
|
||||
#endif // __XPC_LAUNCH_H__
|
||||
47
lib/libc/include/x86_64-macos-gnu/libDER/DERItem.h
Normal file
47
lib/libc/include/x86_64-macos-gnu/libDER/DERItem.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 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 _DER_ITEM_H_
|
||||
#define _DER_ITEM_H_
|
||||
|
||||
#if __has_include(<security_libDER/libDER/libDER_config.h>)
|
||||
#include <security_libDER/libDER/libDER_config.h>
|
||||
#else
|
||||
#include <libDER/libDER_config.h>
|
||||
#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Primary representation of a block of memory.
|
||||
*/
|
||||
typedef struct {
|
||||
DERByte *data;
|
||||
DERSize length;
|
||||
} DERItem;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _DER_ITEM_H_ */
|
||||
|
||||
|
||||
121
lib/libc/include/x86_64-macos-gnu/libDER/libDER_config.h
Normal file
121
lib/libc/include/x86_64-macos-gnu/libDER/libDER_config.h
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* Copyright (c) 2005-2007,2011-2012,2014 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@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* libDER_config.h - platform dependent #defines and typedefs for libDER
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LIB_DER_CONFIG_H_
|
||||
#define _LIB_DER_CONFIG_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(WIN32) && defined(__cplusplus)
|
||||
|
||||
#if !defined(__BEGIN_DECLS) || !defined(__END_DECLS)
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
#endif // __BEGIN_DECLS || __END_DECLS
|
||||
|
||||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#endif // defined(WIN32) && defined(__cplusplus)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Basic data types: unsigned 8-bit integer, unsigned 32-bit integer
|
||||
*/
|
||||
typedef uint8_t DERByte;
|
||||
typedef uint16_t DERShort;
|
||||
typedef size_t DERSize;
|
||||
|
||||
|
||||
/*
|
||||
* Use these #defines of you have memset, memmove, and memcmp; else
|
||||
* write your own equivalents.
|
||||
*/
|
||||
|
||||
#define DERMemset(ptr, c, len) memset(ptr, c, len)
|
||||
#define DERMemmove(dst, src, len) memmove(dst, src, len)
|
||||
#define DERMemcmp(b1, b2, len) memcmp(b1, b2, len)
|
||||
|
||||
|
||||
/***
|
||||
*** Compile time options to trim size of the library.
|
||||
***/
|
||||
|
||||
/* enable general DER encode */
|
||||
#define DER_ENCODE_ENABLE 1
|
||||
|
||||
/* enable general DER decode */
|
||||
#define DER_DECODE_ENABLE 1
|
||||
|
||||
#ifndef DER_MULTIBYTE_TAGS
|
||||
/* enable multibyte tag support. */
|
||||
#define DER_MULTIBYTE_TAGS 1
|
||||
#endif
|
||||
|
||||
#ifndef DER_TAG_SIZE
|
||||
/* Iff DER_MULTIBYTE_TAGS is 1 this is the sizeof(DERTag) in bytes. Note that
|
||||
tags are still encoded and decoded from a minimally encoded DER
|
||||
represantation. This value maintains compatibility with libImg4Decode/Encode. */
|
||||
#define DER_TAG_SIZE 8
|
||||
#endif
|
||||
|
||||
|
||||
/* ---------------------- Do not edit below this line ---------------------- */
|
||||
|
||||
/*
|
||||
* Logical representation of a tag (the encoded representation is always in
|
||||
* the minimal number of bytes). The top 3 bits encode class and method
|
||||
* The remaining bits encode the tag value. To obtain smaller DERItemSpecs
|
||||
* sizes, choose the smallest type that fits your needs. Most standard ASN.1
|
||||
* usage only needs single byte tags, but ocasionally custom applications
|
||||
* require a larger tag namespace.
|
||||
*/
|
||||
#if DER_MULTIBYTE_TAGS
|
||||
|
||||
#if DER_TAG_SIZE == 1
|
||||
typedef uint8_t DERTag;
|
||||
#elif DER_TAG_SIZE == 2
|
||||
typedef uint16_t DERTag;
|
||||
#elif DER_TAG_SIZE == 4
|
||||
typedef uint32_t DERTag;
|
||||
#elif DER_TAG_SIZE == 8
|
||||
typedef uint64_t DERTag;
|
||||
#else
|
||||
#error DER_TAG_SIZE invalid
|
||||
#endif
|
||||
|
||||
#else /* DER_MULTIBYTE_TAGS */
|
||||
typedef DERByte DERTag;
|
||||
#endif /* !DER_MULTIBYTE_TAGS */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _LIB_DER_CONFIG_H_ */
|
||||
63
lib/libc/include/x86_64-macos-gnu/libgen.h
Normal file
63
lib/libc/include/x86_64-macos-gnu/libgen.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* $OpenBSD: libgen.h,v 1.4 1999/05/28 22:00:22 espie Exp $ */
|
||||
/* $FreeBSD: src/include/libgen.h,v 1.1.2.1 2000/11/12 18:01:51 adrian Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
* 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. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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.
|
||||
*/
|
||||
|
||||
#ifndef _LIBGEN_H_
|
||||
#define _LIBGEN_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __DARWIN_UNIX03
|
||||
|
||||
char *basename(char *);
|
||||
char *dirname(char *);
|
||||
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
|
||||
char *basename(const char *);
|
||||
char *dirname(const char *);
|
||||
|
||||
#endif /* __DARWIN_UNIX_03 */
|
||||
|
||||
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
|
||||
#include <Availability.h>
|
||||
char *basename_r(const char *, char *)
|
||||
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
|
||||
__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
|
||||
|
||||
char *dirname_r(const char *, char *)
|
||||
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
|
||||
__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
|
||||
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _LIBGEN_H_ */
|
||||
47
lib/libc/include/x86_64-macos-gnu/libkern/OSAtomic.h
Normal file
47
lib/libc/include/x86_64-macos-gnu/libkern/OSAtomic.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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 _OSATOMIC_H_
|
||||
#define _OSATOMIC_H_
|
||||
|
||||
/*! @header
|
||||
* These are deprecated legacy interfaces for atomic and synchronization
|
||||
* operations.
|
||||
*
|
||||
* Define OSATOMIC_USE_INLINED=1 to get inline implementations of the
|
||||
* OSAtomic interfaces in terms of the <stdatomic.h> primitives.
|
||||
*
|
||||
* Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of the
|
||||
* OSSpinLock interfaces in terms of the <os/lock.h> primitives.
|
||||
*
|
||||
* These are intended as a transition convenience, direct use of those
|
||||
* primitives should be preferred.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include "OSAtomicDeprecated.h"
|
||||
#include "OSSpinLockDeprecated.h"
|
||||
#include "OSAtomicQueue.h"
|
||||
|
||||
#endif /* _OSATOMIC_H_ */
|
||||
1266
lib/libc/include/x86_64-macos-gnu/libkern/OSAtomicDeprecated.h
Normal file
1266
lib/libc/include/x86_64-macos-gnu/libkern/OSAtomicDeprecated.h
Normal file
File diff suppressed because it is too large
Load Diff
115
lib/libc/include/x86_64-macos-gnu/libkern/OSAtomicQueue.h
Normal file
115
lib/libc/include/x86_64-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/x86_64-macos-gnu/libkern/OSByteOrder.h
Normal file
317
lib/libc/include/x86_64-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 */
|
||||
212
lib/libc/include/x86_64-macos-gnu/libkern/OSSpinLockDeprecated.h
Normal file
212
lib/libc/include/x86_64-macos-gnu/libkern/OSSpinLockDeprecated.h
Normal file
@@ -0,0 +1,212 @@
|
||||
/*
|
||||
* 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 _OSSPINLOCK_DEPRECATED_H_
|
||||
#define _OSSPINLOCK_DEPRECATED_H_
|
||||
|
||||
/*! @header
|
||||
* These are deprecated legacy interfaces for userspace spinlocks.
|
||||
*
|
||||
* These interfaces should no longer be used, particularily in situations where
|
||||
* threads of differing priorities may contend on the same spinlock.
|
||||
*
|
||||
* The interfaces in <os/lock.h> should be used instead in cases where a very
|
||||
* low-level lock primitive is required. In general however, using higher level
|
||||
* synchronization primitives such as those provided by the pthread or dispatch
|
||||
* subsystems should be preferred.
|
||||
*
|
||||
* Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of these
|
||||
* interfaces in terms of the <os/lock.h> primitives. This is intended as a
|
||||
* transition convenience, direct use of those primitives is preferred.
|
||||
*/
|
||||
|
||||
#ifndef OSSPINLOCK_DEPRECATED
|
||||
#define OSSPINLOCK_DEPRECATED 1
|
||||
#define OSSPINLOCK_DEPRECATED_MSG(_r) "Use " #_r "() from <os/lock.h> instead"
|
||||
#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r) \
|
||||
__OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSSPINLOCK_DEPRECATED_MSG(_r)) \
|
||||
__OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
|
||||
__OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
|
||||
__OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSSPINLOCK_DEPRECATED_MSG(_r))
|
||||
#else
|
||||
#undef OSSPINLOCK_DEPRECATED
|
||||
#define OSSPINLOCK_DEPRECATED 0
|
||||
#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r)
|
||||
#endif
|
||||
|
||||
#if !(defined(OSSPINLOCK_USE_INLINED) && OSSPINLOCK_USE_INLINED)
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <Availability.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*! @abstract The default value for an <code>OSSpinLock</code>.
|
||||
@discussion
|
||||
The convention is that unlocked is zero, locked is nonzero.
|
||||
*/
|
||||
#define OS_SPINLOCK_INIT 0
|
||||
|
||||
|
||||
/*! @abstract Data type for a spinlock.
|
||||
@discussion
|
||||
You should always initialize a spinlock to {@link OS_SPINLOCK_INIT} before
|
||||
using it.
|
||||
*/
|
||||
typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
|
||||
|
||||
|
||||
/*! @abstract Locks a spinlock if it would not block
|
||||
@result
|
||||
Returns <code>false</code> if the lock was already held by another thread,
|
||||
<code>true</code> if it took the lock successfully.
|
||||
*/
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
|
||||
bool OSSpinLockTry( volatile OSSpinLock *__lock );
|
||||
|
||||
|
||||
/*! @abstract Locks a spinlock
|
||||
@discussion
|
||||
Although the lock operation spins, it employs various strategies to back
|
||||
off if the lock is held.
|
||||
*/
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
|
||||
void OSSpinLockLock( volatile OSSpinLock *__lock );
|
||||
|
||||
|
||||
/*! @abstract Unlocks a spinlock */
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
|
||||
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
|
||||
void OSSpinLockUnlock( volatile OSSpinLock *__lock );
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#else /* OSSPINLOCK_USE_INLINED */
|
||||
|
||||
/*
|
||||
* Inline implementations of the legacy OSSpinLock interfaces in terms of the
|
||||
* of the <os/lock.h> primitives. Direct use of those primitives is preferred.
|
||||
*
|
||||
* NOTE: the locked value of os_unfair_lock is implementation defined and
|
||||
* subject to change, code that relies on the specific locked value used by the
|
||||
* legacy OSSpinLock interface WILL break when using these inline
|
||||
* implementations in terms of os_unfair_lock.
|
||||
*/
|
||||
|
||||
#if !OSSPINLOCK_USE_INLINED_TRANSPARENT
|
||||
|
||||
#include <os/lock.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if __has_attribute(always_inline)
|
||||
#define OSSPINLOCK_INLINE static __inline
|
||||
#else
|
||||
#define OSSPINLOCK_INLINE static __inline __attribute__((__always_inline__))
|
||||
#endif
|
||||
|
||||
#define OS_SPINLOCK_INIT 0
|
||||
typedef int32_t OSSpinLock;
|
||||
|
||||
#if __has_extension(c_static_assert)
|
||||
_Static_assert(sizeof(OSSpinLock) == sizeof(os_unfair_lock),
|
||||
"Incompatible os_unfair_lock type");
|
||||
#endif
|
||||
|
||||
OSSPINLOCK_INLINE
|
||||
void
|
||||
OSSpinLockLock(volatile OSSpinLock *__lock)
|
||||
{
|
||||
os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
|
||||
return os_unfair_lock_lock(lock);
|
||||
}
|
||||
|
||||
OSSPINLOCK_INLINE
|
||||
bool
|
||||
OSSpinLockTry(volatile OSSpinLock *__lock)
|
||||
{
|
||||
os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
|
||||
return os_unfair_lock_trylock(lock);
|
||||
}
|
||||
|
||||
OSSPINLOCK_INLINE
|
||||
void
|
||||
OSSpinLockUnlock(volatile OSSpinLock *__lock)
|
||||
{
|
||||
os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
|
||||
return os_unfair_lock_unlock(lock);
|
||||
}
|
||||
|
||||
#undef OSSPINLOCK_INLINE
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#else /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#define OS_NOSPIN_LOCK_AVAILABILITY \
|
||||
__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) \
|
||||
__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define OS_SPINLOCK_INIT 0
|
||||
typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
|
||||
typedef volatile OSSpinLock *_os_nospin_lock_t
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_t);
|
||||
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
|
||||
OS_NOSPIN_LOCK_AVAILABILITY
|
||||
void _os_nospin_lock_lock(_os_nospin_lock_t lock);
|
||||
#undef OSSpinLockLock
|
||||
#define OSSpinLockLock(lock) _os_nospin_lock_lock(lock)
|
||||
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
|
||||
OS_NOSPIN_LOCK_AVAILABILITY
|
||||
bool _os_nospin_lock_trylock(_os_nospin_lock_t lock);
|
||||
#undef OSSpinLockTry
|
||||
#define OSSpinLockTry(lock) _os_nospin_lock_trylock(lock)
|
||||
|
||||
OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
|
||||
OS_NOSPIN_LOCK_AVAILABILITY
|
||||
void _os_nospin_lock_unlock(_os_nospin_lock_t lock);
|
||||
#undef OSSpinLockUnlock
|
||||
#define OSSpinLockUnlock(lock) _os_nospin_lock_unlock(lock)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
|
||||
|
||||
#endif /* OSSPINLOCK_USE_INLINED */
|
||||
|
||||
#endif /* _OSSPINLOCK_DEPRECATED_H_ */
|
||||
42
lib/libc/include/x86_64-macos-gnu/libkern/OSTypes.h
Normal file
42
lib/libc/include/x86_64-macos-gnu/libkern/OSTypes.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2012 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@
|
||||
*/
|
||||
|
||||
#include <MacTypes.h>
|
||||
|
||||
#ifndef _OS_OSTYPES_H
|
||||
#define _OS_OSTYPES_H
|
||||
|
||||
#define OSTYPES_K64_REV 2
|
||||
|
||||
typedef unsigned int UInt;
|
||||
typedef signed int SInt;
|
||||
|
||||
|
||||
#include <sys/_types/_os_inline.h>
|
||||
|
||||
#endif /* _OS_OSTYPES_H */
|
||||
@@ -41,14 +41,14 @@
|
||||
|
||||
/* Macros for swapping constant values in the preprocessing stage. */
|
||||
#define __DARWIN_OSSwapConstInt16(x) \
|
||||
((__uint16_t)((((__uint16_t)(x) & 0xff00) >> 8) | \
|
||||
(((__uint16_t)(x) & 0x00ff) << 8)))
|
||||
((__uint16_t)((((__uint16_t)(x) & 0xff00U) >> 8) | \
|
||||
(((__uint16_t)(x) & 0x00ffU) << 8)))
|
||||
|
||||
#define __DARWIN_OSSwapConstInt32(x) \
|
||||
((__uint32_t)((((__uint32_t)(x) & 0xff000000) >> 24) | \
|
||||
(((__uint32_t)(x) & 0x00ff0000) >> 8) | \
|
||||
(((__uint32_t)(x) & 0x0000ff00) << 8) | \
|
||||
(((__uint32_t)(x) & 0x000000ff) << 24)))
|
||||
((__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) | \
|
||||
@@ -62,10 +62,23 @@
|
||||
|
||||
#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) \
|
||||
@@ -81,16 +94,6 @@
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
|
||||
#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
|
||||
|
||||
__DARWIN_OS_INLINE
|
||||
uint16_t
|
||||
_OSSwapInt16(
|
||||
|
||||
112
lib/libc/include/x86_64-macos-gnu/libkern/i386/OSByteOrder.h
Normal file
112
lib/libc/include/x86_64-macos-gnu/libkern/i386/OSByteOrder.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (c) 1999-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_OSBYTEORDERI386_H
|
||||
#define _OS_OSBYTEORDERI386_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <libkern/i386/_OSByteOrder.h>
|
||||
#include <sys/_types/_os_inline.h>
|
||||
|
||||
/* Functions for byte reversed loads. */
|
||||
|
||||
OS_INLINE
|
||||
uint16_t
|
||||
OSReadSwapInt16(
|
||||
const volatile void * base,
|
||||
uintptr_t byteOffset
|
||||
)
|
||||
{
|
||||
uint16_t result;
|
||||
|
||||
result = *(volatile uint16_t *)((uintptr_t)base + byteOffset);
|
||||
return _OSSwapInt16(result);
|
||||
}
|
||||
|
||||
OS_INLINE
|
||||
uint32_t
|
||||
OSReadSwapInt32(
|
||||
const volatile void * base,
|
||||
uintptr_t byteOffset
|
||||
)
|
||||
{
|
||||
uint32_t result;
|
||||
|
||||
result = *(volatile uint32_t *)((uintptr_t)base + byteOffset);
|
||||
return _OSSwapInt32(result);
|
||||
}
|
||||
|
||||
OS_INLINE
|
||||
uint64_t
|
||||
OSReadSwapInt64(
|
||||
const volatile void * base,
|
||||
uintptr_t byteOffset
|
||||
)
|
||||
{
|
||||
uint64_t result;
|
||||
|
||||
result = *(volatile uint64_t *)((uintptr_t)base + byteOffset);
|
||||
return _OSSwapInt64(result);
|
||||
}
|
||||
|
||||
/* Functions for byte reversed stores. */
|
||||
|
||||
OS_INLINE
|
||||
void
|
||||
OSWriteSwapInt16(
|
||||
volatile void * base,
|
||||
uintptr_t byteOffset,
|
||||
uint16_t data
|
||||
)
|
||||
{
|
||||
*(volatile uint16_t *)((uintptr_t)base + byteOffset) = _OSSwapInt16(data);
|
||||
}
|
||||
|
||||
OS_INLINE
|
||||
void
|
||||
OSWriteSwapInt32(
|
||||
volatile void * base,
|
||||
uintptr_t byteOffset,
|
||||
uint32_t data
|
||||
)
|
||||
{
|
||||
*(volatile uint32_t *)((uintptr_t)base + byteOffset) = _OSSwapInt32(data);
|
||||
}
|
||||
|
||||
OS_INLINE
|
||||
void
|
||||
OSWriteSwapInt64(
|
||||
volatile void * base,
|
||||
uintptr_t byteOffset,
|
||||
uint64_t data
|
||||
)
|
||||
{
|
||||
*(volatile uint64_t *)((uintptr_t)base + byteOffset) = _OSSwapInt64(data);
|
||||
}
|
||||
|
||||
#endif /* ! _OS_OSBYTEORDERI386_H */
|
||||
272
lib/libc/include/x86_64-macos-gnu/mach-o/dyld.h
Normal file
272
lib/libc/include/x86_64-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/x86_64-macos-gnu/mach-o/loader.h
Normal file
1601
lib/libc/include/x86_64-macos-gnu/mach-o/loader.h
Normal file
File diff suppressed because it is too large
Load Diff
88
lib/libc/include/x86_64-macos-gnu/mach/boolean.h
Normal file
88
lib/libc/include/x86_64-macos-gnu/mach/boolean.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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: mach/boolean.h
|
||||
*
|
||||
* Boolean data type.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_BOOLEAN_H_
|
||||
#define _MACH_BOOLEAN_H_
|
||||
|
||||
/*
|
||||
* Pick up "boolean_t" type definition
|
||||
*/
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
#include <mach/machine/boolean.h>
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
/*
|
||||
* Define TRUE and FALSE if not defined.
|
||||
*/
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif /* TRUE */
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif /* FALSE */
|
||||
|
||||
#endif /* _MACH_BOOLEAN_H_ */
|
||||
245
lib/libc/include/x86_64-macos-gnu/mach/clock.h
Normal file
245
lib/libc/include/x86_64-macos-gnu/mach/clock.h
Normal file
@@ -0,0 +1,245 @@
|
||||
#ifndef _clock_user_
|
||||
#define _clock_user_
|
||||
|
||||
/* Module clock */
|
||||
|
||||
#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 clock_MSG_COUNT
|
||||
#define clock_MSG_COUNT 3
|
||||
#endif /* clock_MSG_COUNT */
|
||||
|
||||
#include <mach/std_types.h>
|
||||
#include <mach/mig.h>
|
||||
#include <mach/mig.h>
|
||||
#include <mach/mach_types.h>
|
||||
#include <mach/mach_types.h>
|
||||
|
||||
#ifdef __BeforeMigUserHeader
|
||||
__BeforeMigUserHeader
|
||||
#endif /* __BeforeMigUserHeader */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
/* Routine clock_get_time */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t clock_get_time
|
||||
(
|
||||
clock_serv_t clock_serv,
|
||||
mach_timespec_t *cur_time
|
||||
);
|
||||
|
||||
/* Routine clock_get_attributes */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t clock_get_attributes
|
||||
(
|
||||
clock_serv_t clock_serv,
|
||||
clock_flavor_t flavor,
|
||||
clock_attr_t clock_attr,
|
||||
mach_msg_type_number_t *clock_attrCnt
|
||||
);
|
||||
|
||||
/* Routine clock_alarm */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t clock_alarm
|
||||
(
|
||||
clock_serv_t clock_serv,
|
||||
alarm_type_t alarm_type,
|
||||
mach_timespec_t alarm_time,
|
||||
clock_reply_t alarm_port
|
||||
);
|
||||
|
||||
__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__clock_subsystem__defined
|
||||
#define __Request__clock_subsystem__defined
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
} __Request__clock_get_time_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;
|
||||
clock_flavor_t flavor;
|
||||
mach_msg_type_number_t clock_attrCnt;
|
||||
} __Request__clock_get_attributes_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 alarm_port;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
alarm_type_t alarm_type;
|
||||
mach_timespec_t alarm_time;
|
||||
} __Request__clock_alarm_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Request__clock_subsystem__defined */
|
||||
|
||||
/* union of all requests */
|
||||
|
||||
#ifndef __RequestUnion__clock_subsystem__defined
|
||||
#define __RequestUnion__clock_subsystem__defined
|
||||
union __RequestUnion__clock_subsystem {
|
||||
__Request__clock_get_time_t Request_clock_get_time;
|
||||
__Request__clock_get_attributes_t Request_clock_get_attributes;
|
||||
__Request__clock_alarm_t Request_clock_alarm;
|
||||
};
|
||||
#endif /* !__RequestUnion__clock_subsystem__defined */
|
||||
/* typedefs for all replies */
|
||||
|
||||
#ifndef __Reply__clock_subsystem__defined
|
||||
#define __Reply__clock_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_timespec_t cur_time;
|
||||
} __Reply__clock_get_time_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;
|
||||
mach_msg_type_number_t clock_attrCnt;
|
||||
int clock_attr[1];
|
||||
} __Reply__clock_get_attributes_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__clock_alarm_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Reply__clock_subsystem__defined */
|
||||
|
||||
/* union of all replies */
|
||||
|
||||
#ifndef __ReplyUnion__clock_subsystem__defined
|
||||
#define __ReplyUnion__clock_subsystem__defined
|
||||
union __ReplyUnion__clock_subsystem {
|
||||
__Reply__clock_get_time_t Reply_clock_get_time;
|
||||
__Reply__clock_get_attributes_t Reply_clock_get_attributes;
|
||||
__Reply__clock_alarm_t Reply_clock_alarm;
|
||||
};
|
||||
#endif /* !__RequestUnion__clock_subsystem__defined */
|
||||
|
||||
#ifndef subsystem_to_name_map_clock
|
||||
#define subsystem_to_name_map_clock \
|
||||
{ "clock_get_time", 1000 },\
|
||||
{ "clock_get_attributes", 1001 },\
|
||||
{ "clock_alarm", 1002 }
|
||||
#endif
|
||||
|
||||
#ifdef __AfterMigUserHeader
|
||||
__AfterMigUserHeader
|
||||
#endif /* __AfterMigUserHeader */
|
||||
|
||||
#endif /* _clock_user_ */
|
||||
199
lib/libc/include/x86_64-macos-gnu/mach/clock_priv.h
Normal file
199
lib/libc/include/x86_64-macos-gnu/mach/clock_priv.h
Normal file
@@ -0,0 +1,199 @@
|
||||
#ifndef _clock_priv_user_
|
||||
#define _clock_priv_user_
|
||||
|
||||
/* Module clock_priv */
|
||||
|
||||
#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 clock_priv_MSG_COUNT
|
||||
#define clock_priv_MSG_COUNT 2
|
||||
#endif /* clock_priv_MSG_COUNT */
|
||||
|
||||
#include <mach/std_types.h>
|
||||
#include <mach/mig.h>
|
||||
#include <mach/mig.h>
|
||||
#include <mach/mach_types.h>
|
||||
#include <mach/mach_types.h>
|
||||
|
||||
#ifdef __BeforeMigUserHeader
|
||||
__BeforeMigUserHeader
|
||||
#endif /* __BeforeMigUserHeader */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
/* Routine clock_set_time */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t clock_set_time
|
||||
(
|
||||
clock_ctrl_t clock_ctrl,
|
||||
mach_timespec_t new_time
|
||||
);
|
||||
|
||||
/* Routine clock_set_attributes */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t clock_set_attributes
|
||||
(
|
||||
clock_ctrl_t clock_ctrl,
|
||||
clock_flavor_t flavor,
|
||||
clock_attr_t clock_attr,
|
||||
mach_msg_type_number_t clock_attrCnt
|
||||
);
|
||||
|
||||
__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__clock_priv_subsystem__defined
|
||||
#define __Request__clock_priv_subsystem__defined
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
mach_timespec_t new_time;
|
||||
} __Request__clock_set_time_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;
|
||||
clock_flavor_t flavor;
|
||||
mach_msg_type_number_t clock_attrCnt;
|
||||
int clock_attr[1];
|
||||
} __Request__clock_set_attributes_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Request__clock_priv_subsystem__defined */
|
||||
|
||||
/* union of all requests */
|
||||
|
||||
#ifndef __RequestUnion__clock_priv_subsystem__defined
|
||||
#define __RequestUnion__clock_priv_subsystem__defined
|
||||
union __RequestUnion__clock_priv_subsystem {
|
||||
__Request__clock_set_time_t Request_clock_set_time;
|
||||
__Request__clock_set_attributes_t Request_clock_set_attributes;
|
||||
};
|
||||
#endif /* !__RequestUnion__clock_priv_subsystem__defined */
|
||||
/* typedefs for all replies */
|
||||
|
||||
#ifndef __Reply__clock_priv_subsystem__defined
|
||||
#define __Reply__clock_priv_subsystem__defined
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
kern_return_t RetCode;
|
||||
} __Reply__clock_set_time_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__clock_set_attributes_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Reply__clock_priv_subsystem__defined */
|
||||
|
||||
/* union of all replies */
|
||||
|
||||
#ifndef __ReplyUnion__clock_priv_subsystem__defined
|
||||
#define __ReplyUnion__clock_priv_subsystem__defined
|
||||
union __ReplyUnion__clock_priv_subsystem {
|
||||
__Reply__clock_set_time_t Reply_clock_set_time;
|
||||
__Reply__clock_set_attributes_t Reply_clock_set_attributes;
|
||||
};
|
||||
#endif /* !__RequestUnion__clock_priv_subsystem__defined */
|
||||
|
||||
#ifndef subsystem_to_name_map_clock_priv
|
||||
#define subsystem_to_name_map_clock_priv \
|
||||
{ "clock_set_time", 1200 },\
|
||||
{ "clock_set_attributes", 1201 }
|
||||
#endif
|
||||
|
||||
#ifdef __AfterMigUserHeader
|
||||
__AfterMigUserHeader
|
||||
#endif /* __AfterMigUserHeader */
|
||||
|
||||
#endif /* _clock_priv_user_ */
|
||||
127
lib/libc/include/x86_64-macos-gnu/mach/clock_types.h
Normal file
127
lib/libc/include/x86_64-macos-gnu/mach/clock_types.h
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
/*
|
||||
* File: clock_types.h
|
||||
* Purpose: Clock facility header definitions. These
|
||||
* definitons are needed by both kernel and
|
||||
* user-level software.
|
||||
*/
|
||||
|
||||
/*
|
||||
* All interfaces defined here are obsolete.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_CLOCK_TYPES_H_
|
||||
#define _MACH_CLOCK_TYPES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <mach/time_value.h>
|
||||
|
||||
/*
|
||||
* Type definitions.
|
||||
*/
|
||||
typedef int alarm_type_t; /* alarm time type */
|
||||
typedef int sleep_type_t; /* sleep time type */
|
||||
typedef int clock_id_t; /* clock identification type */
|
||||
typedef int clock_flavor_t; /* clock flavor type */
|
||||
typedef int *clock_attr_t; /* clock attribute type */
|
||||
typedef int clock_res_t; /* clock resolution type */
|
||||
|
||||
/*
|
||||
* Normal time specification used by the kernel clock facility.
|
||||
*/
|
||||
struct mach_timespec {
|
||||
unsigned int tv_sec; /* seconds */
|
||||
clock_res_t tv_nsec; /* nanoseconds */
|
||||
};
|
||||
typedef struct mach_timespec mach_timespec_t;
|
||||
|
||||
/*
|
||||
* Reserved clock id values for default clocks.
|
||||
*/
|
||||
#define SYSTEM_CLOCK 0
|
||||
#define CALENDAR_CLOCK 1
|
||||
|
||||
#define REALTIME_CLOCK 0
|
||||
|
||||
/*
|
||||
* Attribute names.
|
||||
*/
|
||||
#define CLOCK_GET_TIME_RES 1 /* get_time call resolution */
|
||||
/* 2 * was map_time call resolution */
|
||||
#define CLOCK_ALARM_CURRES 3 /* current alarm resolution */
|
||||
#define CLOCK_ALARM_MINRES 4 /* minimum alarm resolution */
|
||||
#define CLOCK_ALARM_MAXRES 5 /* maximum alarm resolution */
|
||||
|
||||
#define NSEC_PER_USEC 1000ull /* nanoseconds per microsecond */
|
||||
#define USEC_PER_SEC 1000000ull /* microseconds per second */
|
||||
#define NSEC_PER_SEC 1000000000ull /* nanoseconds per second */
|
||||
#define NSEC_PER_MSEC 1000000ull /* nanoseconds per millisecond */
|
||||
|
||||
#define BAD_MACH_TIMESPEC(t) \
|
||||
((t)->tv_nsec < 0 || (t)->tv_nsec >= (long)NSEC_PER_SEC)
|
||||
|
||||
/* t1 <=> t2, also (t1 - t2) in nsec with max of +- 1 sec */
|
||||
#define CMP_MACH_TIMESPEC(t1, t2) \
|
||||
((t1)->tv_sec > (t2)->tv_sec ? (long) +NSEC_PER_SEC : \
|
||||
((t1)->tv_sec < (t2)->tv_sec ? (long) -NSEC_PER_SEC : \
|
||||
(t1)->tv_nsec - (t2)->tv_nsec))
|
||||
|
||||
/* t1 += t2 */
|
||||
#define ADD_MACH_TIMESPEC(t1, t2) \
|
||||
do { \
|
||||
if (((t1)->tv_nsec += (t2)->tv_nsec) >= (long) NSEC_PER_SEC) { \
|
||||
(t1)->tv_nsec -= (long) NSEC_PER_SEC; \
|
||||
(t1)->tv_sec += 1; \
|
||||
} \
|
||||
(t1)->tv_sec += (t2)->tv_sec; \
|
||||
} while (0)
|
||||
|
||||
/* t1 -= t2 */
|
||||
#define SUB_MACH_TIMESPEC(t1, t2) \
|
||||
do { \
|
||||
if (((t1)->tv_nsec -= (t2)->tv_nsec) < 0) { \
|
||||
(t1)->tv_nsec += (long) NSEC_PER_SEC; \
|
||||
(t1)->tv_sec -= 1; \
|
||||
} \
|
||||
(t1)->tv_sec -= (t2)->tv_sec; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Alarm parameter defines.
|
||||
*/
|
||||
#define ALRMTYPE 0xff /* type (8-bit field) */
|
||||
#define TIME_ABSOLUTE 0x00 /* absolute time */
|
||||
#define TIME_RELATIVE 0x01 /* relative time */
|
||||
|
||||
#define BAD_ALRMTYPE(t) (((t) &~ TIME_RELATIVE) != 0)
|
||||
|
||||
#endif /* _MACH_CLOCK_TYPES_H_ */
|
||||
66
lib/libc/include/x86_64-macos-gnu/mach/dyld_kernel.h
Normal file
66
lib/libc/include/x86_64-macos-gnu/mach/dyld_kernel.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2016 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_DYLIB_INFO_H_
|
||||
#define _MACH_DYLIB_INFO_H_
|
||||
|
||||
#include <mach/boolean.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/_types/_fsid_t.h>
|
||||
#include <sys/_types/_u_int32_t.h>
|
||||
#include <sys/_types/_fsobj_id_t.h>
|
||||
#include <sys/_types/_uuid_t.h>
|
||||
|
||||
/* These definitions must be kept in sync with the ones in
|
||||
* osfmk/mach/mach_types.defs.
|
||||
*/
|
||||
|
||||
struct dyld_kernel_image_info {
|
||||
uuid_t uuid;
|
||||
fsobj_id_t fsobjid;
|
||||
fsid_t fsid;
|
||||
uint64_t load_addr;
|
||||
};
|
||||
|
||||
struct dyld_kernel_process_info {
|
||||
struct dyld_kernel_image_info cache_image_info;
|
||||
uint64_t timestamp; // mach_absolute_time of last time dyld change to image list
|
||||
uint32_t imageCount; // number of images currently loaded into process
|
||||
uint32_t initialImageCount; // number of images statically loaded into process (before any dlopen() calls)
|
||||
uint8_t dyldState; // one of dyld_process_state_* values
|
||||
boolean_t no_cache; // process is running without a dyld cache
|
||||
boolean_t private_cache; // process is using a private copy of its dyld cache
|
||||
};
|
||||
|
||||
/* typedefs so our MIG is sane */
|
||||
|
||||
typedef struct dyld_kernel_image_info dyld_kernel_image_info_t;
|
||||
typedef struct dyld_kernel_process_info dyld_kernel_process_info_t;
|
||||
typedef dyld_kernel_image_info_t *dyld_kernel_image_info_array_t;
|
||||
|
||||
#endif /* _MACH_DYLIB_INFO_H_ */
|
||||
114
lib/libc/include/x86_64-macos-gnu/mach/error.h
Normal file
114
lib/libc/include/x86_64-macos-gnu/mach/error.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* 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: mach/error.h
|
||||
* Purpose:
|
||||
* error module definitions
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ERROR_H_
|
||||
#define _MACH_ERROR_H_
|
||||
|
||||
#include <mach/kern_return.h>
|
||||
|
||||
/*
|
||||
* error number layout as follows:
|
||||
*
|
||||
* hi lo
|
||||
* | system(6) | subsystem(12) | code(14) |
|
||||
*/
|
||||
|
||||
|
||||
#define err_none (mach_error_t)0
|
||||
#define ERR_SUCCESS (mach_error_t)0
|
||||
#define ERR_ROUTINE_NIL (mach_error_fn_t)0
|
||||
|
||||
|
||||
#define err_system(x) ((signed)((((unsigned)(x))&0x3f)<<26))
|
||||
#define err_sub(x) (((x)&0xfff)<<14)
|
||||
|
||||
#define err_get_system(err) (((err)>>26)&0x3f)
|
||||
#define err_get_sub(err) (((err)>>14)&0xfff)
|
||||
#define err_get_code(err) ((err)&0x3fff)
|
||||
|
||||
#define system_emask (err_system(0x3f))
|
||||
#define sub_emask (err_sub(0xfff))
|
||||
#define code_emask (0x3fff)
|
||||
|
||||
|
||||
/* major error systems */
|
||||
#define err_kern err_system(0x0) /* kernel */
|
||||
#define err_us err_system(0x1) /* user space library */
|
||||
#define err_server err_system(0x2) /* user space servers */
|
||||
#define err_ipc err_system(0x3) /* old ipc errors */
|
||||
#define err_mach_ipc err_system(0x4) /* mach-ipc errors */
|
||||
#define err_dipc err_system(0x7) /* distributed ipc */
|
||||
#define err_local err_system(0x3e) /* user defined errors */
|
||||
#define err_ipc_compat err_system(0x3f) /* (compatibility) mach-ipc errors */
|
||||
|
||||
#define err_max_system 0x3f
|
||||
|
||||
|
||||
/* unix errors get lumped into one subsystem */
|
||||
#define unix_err(errno) (err_kern|err_sub(3)|errno)
|
||||
|
||||
typedef kern_return_t mach_error_t;
|
||||
typedef mach_error_t (* mach_error_fn_t)( void );
|
||||
|
||||
#endif /* _MACH_ERROR_H_ */
|
||||
204
lib/libc/include/x86_64-macos-gnu/mach/exception_types.h
Normal file
204
lib/libc/include/x86_64-macos-gnu/mach/exception_types.h
Normal file
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_EXCEPTION_TYPES_H_
|
||||
#define _MACH_EXCEPTION_TYPES_H_
|
||||
|
||||
#include <mach/machine/exception.h>
|
||||
|
||||
/*
|
||||
* Machine-independent exception definitions.
|
||||
*/
|
||||
|
||||
#define EXC_BAD_ACCESS 1 /* Could not access memory */
|
||||
/* Code contains kern_return_t describing error. */
|
||||
/* Subcode contains bad memory address. */
|
||||
|
||||
#define EXC_BAD_INSTRUCTION 2 /* Instruction failed */
|
||||
/* Illegal or undefined instruction or operand */
|
||||
|
||||
#define EXC_ARITHMETIC 3 /* Arithmetic exception */
|
||||
/* Exact nature of exception is in code field */
|
||||
|
||||
#define EXC_EMULATION 4 /* Emulation instruction */
|
||||
/* Emulation support instruction encountered */
|
||||
/* Details in code and subcode fields */
|
||||
|
||||
#define EXC_SOFTWARE 5 /* Software generated exception */
|
||||
/* Exact exception is in code field. */
|
||||
/* Codes 0 - 0xFFFF reserved to hardware */
|
||||
/* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix) */
|
||||
|
||||
#define EXC_BREAKPOINT 6 /* Trace, breakpoint, etc. */
|
||||
/* Details in code field. */
|
||||
|
||||
#define EXC_SYSCALL 7 /* System calls. */
|
||||
|
||||
#define EXC_MACH_SYSCALL 8 /* Mach system calls. */
|
||||
|
||||
#define EXC_RPC_ALERT 9 /* RPC alert */
|
||||
|
||||
#define EXC_CRASH 10 /* Abnormal process exit */
|
||||
|
||||
#define EXC_RESOURCE 11 /* Hit resource consumption limit */
|
||||
/* Exact resource is in code field. */
|
||||
|
||||
#define EXC_GUARD 12 /* Violated guarded resource protections */
|
||||
|
||||
#define EXC_CORPSE_NOTIFY 13 /* Abnormal process exited to corpse state */
|
||||
|
||||
#define EXC_CORPSE_VARIANT_BIT 0x100 /* bit set for EXC_*_CORPSE variants of EXC_* */
|
||||
|
||||
|
||||
/*
|
||||
* Machine-independent exception behaviors
|
||||
*/
|
||||
|
||||
# define EXCEPTION_DEFAULT 1
|
||||
/* Send a catch_exception_raise message including the identity.
|
||||
*/
|
||||
|
||||
# define EXCEPTION_STATE 2
|
||||
/* Send a catch_exception_raise_state message including the
|
||||
* thread state.
|
||||
*/
|
||||
|
||||
# define EXCEPTION_STATE_IDENTITY 3
|
||||
/* Send a catch_exception_raise_state_identity message including
|
||||
* the thread identity and state.
|
||||
*/
|
||||
|
||||
#define MACH_EXCEPTION_ERRORS 0x40000000
|
||||
/* include additional exception specific errors, not used yet. */
|
||||
|
||||
#define MACH_EXCEPTION_CODES 0x80000000
|
||||
/* Send 64-bit code and subcode in the exception header */
|
||||
|
||||
#define MACH_EXCEPTION_MASK (MACH_EXCEPTION_CODES | MACH_EXCEPTION_ERRORS)
|
||||
/*
|
||||
* Masks for exception definitions, above
|
||||
* bit zero is unused, therefore 1 word = 31 exception types
|
||||
*/
|
||||
|
||||
#define EXC_MASK_BAD_ACCESS (1 << EXC_BAD_ACCESS)
|
||||
#define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION)
|
||||
#define EXC_MASK_ARITHMETIC (1 << EXC_ARITHMETIC)
|
||||
#define EXC_MASK_EMULATION (1 << EXC_EMULATION)
|
||||
#define EXC_MASK_SOFTWARE (1 << EXC_SOFTWARE)
|
||||
#define EXC_MASK_BREAKPOINT (1 << EXC_BREAKPOINT)
|
||||
#define EXC_MASK_SYSCALL (1 << EXC_SYSCALL)
|
||||
#define EXC_MASK_MACH_SYSCALL (1 << EXC_MACH_SYSCALL)
|
||||
#define EXC_MASK_RPC_ALERT (1 << EXC_RPC_ALERT)
|
||||
#define EXC_MASK_CRASH (1 << EXC_CRASH)
|
||||
#define EXC_MASK_RESOURCE (1 << EXC_RESOURCE)
|
||||
#define EXC_MASK_GUARD (1 << EXC_GUARD)
|
||||
#define EXC_MASK_CORPSE_NOTIFY (1 << EXC_CORPSE_NOTIFY)
|
||||
|
||||
#define EXC_MASK_ALL (EXC_MASK_BAD_ACCESS | \
|
||||
EXC_MASK_BAD_INSTRUCTION | \
|
||||
EXC_MASK_ARITHMETIC | \
|
||||
EXC_MASK_EMULATION | \
|
||||
EXC_MASK_SOFTWARE | \
|
||||
EXC_MASK_BREAKPOINT | \
|
||||
EXC_MASK_SYSCALL | \
|
||||
EXC_MASK_MACH_SYSCALL | \
|
||||
EXC_MASK_RPC_ALERT | \
|
||||
EXC_MASK_RESOURCE | \
|
||||
EXC_MASK_GUARD | \
|
||||
EXC_MASK_MACHINE)
|
||||
|
||||
|
||||
#define FIRST_EXCEPTION 1 /* ZERO is illegal */
|
||||
|
||||
/*
|
||||
* Machine independent codes for EXC_SOFTWARE
|
||||
* Codes 0x10000 - 0x1FFFF reserved for OS emulation (Unix)
|
||||
* 0x10000 - 0x10002 in use for unix signals
|
||||
* 0x20000 - 0x2FFFF reserved for MACF
|
||||
*/
|
||||
#define EXC_SOFT_SIGNAL 0x10003 /* Unix signal exceptions */
|
||||
|
||||
#define EXC_MACF_MIN 0x20000 /* MACF exceptions */
|
||||
#define EXC_MACF_MAX 0x2FFFF
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
|
||||
#include <mach/port.h>
|
||||
#include <mach/thread_status.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
/*
|
||||
* Exported types
|
||||
*/
|
||||
|
||||
typedef int exception_type_t;
|
||||
typedef integer_t exception_data_type_t;
|
||||
typedef int64_t mach_exception_data_type_t;
|
||||
typedef int exception_behavior_t;
|
||||
typedef exception_data_type_t *exception_data_t;
|
||||
typedef mach_exception_data_type_t *mach_exception_data_t;
|
||||
typedef unsigned int exception_mask_t;
|
||||
typedef exception_mask_t *exception_mask_array_t;
|
||||
typedef exception_behavior_t *exception_behavior_array_t;
|
||||
typedef thread_state_flavor_t *exception_flavor_array_t;
|
||||
typedef mach_port_t *exception_port_array_t;
|
||||
typedef mach_exception_data_type_t mach_exception_code_t;
|
||||
typedef mach_exception_data_type_t mach_exception_subcode_t;
|
||||
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#endif /* _MACH_EXCEPTION_TYPES_H_ */
|
||||
260
lib/libc/include/x86_64-macos-gnu/mach/host_info.h
Normal file
260
lib/libc/include/x86_64-macos-gnu/mach/host_info.h
Normal file
@@ -0,0 +1,260 @@
|
||||
/*
|
||||
* Copyright (c) 2000-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 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/host_info.h
|
||||
*
|
||||
* Definitions for host_info call.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_HOST_INFO_H_
|
||||
#define _MACH_HOST_INFO_H_
|
||||
|
||||
#include <mach/message.h>
|
||||
#include <mach/vm_statistics.h>
|
||||
#include <mach/machine.h>
|
||||
#include <mach/machine/vm_types.h>
|
||||
#include <mach/time_value.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/*
|
||||
* Generic information structure to allow for expansion.
|
||||
*/
|
||||
typedef integer_t *host_info_t; /* varying array of int. */
|
||||
typedef integer_t *host_info64_t; /* varying array of int. */
|
||||
|
||||
#define HOST_INFO_MAX (1024) /* max array size */
|
||||
typedef integer_t host_info_data_t[HOST_INFO_MAX];
|
||||
|
||||
#define KERNEL_VERSION_MAX (512)
|
||||
typedef char kernel_version_t[KERNEL_VERSION_MAX];
|
||||
|
||||
#define KERNEL_BOOT_INFO_MAX (4096)
|
||||
typedef char kernel_boot_info_t[KERNEL_BOOT_INFO_MAX];
|
||||
|
||||
/*
|
||||
* Currently defined information.
|
||||
*/
|
||||
/* host_info() */
|
||||
typedef integer_t host_flavor_t;
|
||||
#define HOST_BASIC_INFO 1 /* basic info */
|
||||
#define HOST_SCHED_INFO 3 /* scheduling info */
|
||||
#define HOST_RESOURCE_SIZES 4 /* kernel struct sizes */
|
||||
#define HOST_PRIORITY_INFO 5 /* priority information */
|
||||
#define HOST_SEMAPHORE_TRAPS 7 /* Has semaphore traps */
|
||||
#define HOST_MACH_MSG_TRAP 8 /* Has mach_msg_trap */
|
||||
#define HOST_VM_PURGABLE 9 /* purg'e'able memory info */
|
||||
#define HOST_DEBUG_INFO_INTERNAL 10 /* Used for kernel internal development tests only */
|
||||
#define HOST_CAN_HAS_DEBUGGER 11
|
||||
#define HOST_PREFERRED_USER_ARCH 12 /* Get the preferred user-space architecture */
|
||||
|
||||
|
||||
struct host_can_has_debugger_info {
|
||||
boolean_t can_has_debugger;
|
||||
};
|
||||
typedef struct host_can_has_debugger_info host_can_has_debugger_info_data_t;
|
||||
typedef struct host_can_has_debugger_info *host_can_has_debugger_info_t;
|
||||
#define HOST_CAN_HAS_DEBUGGER_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(host_can_has_debugger_info_data_t)/sizeof(integer_t)))
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
struct host_basic_info {
|
||||
integer_t max_cpus; /* max number of CPUs possible */
|
||||
integer_t avail_cpus; /* number of CPUs now available */
|
||||
natural_t memory_size; /* size of memory in bytes, capped at 2 GB */
|
||||
cpu_type_t cpu_type; /* cpu type */
|
||||
cpu_subtype_t cpu_subtype; /* cpu subtype */
|
||||
cpu_threadtype_t cpu_threadtype; /* cpu threadtype */
|
||||
integer_t physical_cpu; /* number of physical CPUs now available */
|
||||
integer_t physical_cpu_max; /* max number of physical CPUs possible */
|
||||
integer_t logical_cpu; /* number of logical cpu now available */
|
||||
integer_t logical_cpu_max; /* max number of physical CPUs possible */
|
||||
uint64_t max_mem; /* actual size of physical memory */
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct host_basic_info host_basic_info_data_t;
|
||||
typedef struct host_basic_info *host_basic_info_t;
|
||||
#define HOST_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(host_basic_info_data_t)/sizeof(integer_t)))
|
||||
|
||||
struct host_sched_info {
|
||||
integer_t min_timeout; /* minimum timeout in milliseconds */
|
||||
integer_t min_quantum; /* minimum quantum in milliseconds */
|
||||
};
|
||||
|
||||
typedef struct host_sched_info host_sched_info_data_t;
|
||||
typedef struct host_sched_info *host_sched_info_t;
|
||||
#define HOST_SCHED_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(host_sched_info_data_t)/sizeof(integer_t)))
|
||||
|
||||
struct kernel_resource_sizes {
|
||||
natural_t task;
|
||||
natural_t thread;
|
||||
natural_t port;
|
||||
natural_t memory_region;
|
||||
natural_t memory_object;
|
||||
};
|
||||
|
||||
typedef struct kernel_resource_sizes kernel_resource_sizes_data_t;
|
||||
typedef struct kernel_resource_sizes *kernel_resource_sizes_t;
|
||||
#define HOST_RESOURCE_SIZES_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t)))
|
||||
|
||||
struct host_priority_info {
|
||||
integer_t kernel_priority;
|
||||
integer_t system_priority;
|
||||
integer_t server_priority;
|
||||
integer_t user_priority;
|
||||
integer_t depress_priority;
|
||||
integer_t idle_priority;
|
||||
integer_t minimum_priority;
|
||||
integer_t maximum_priority;
|
||||
};
|
||||
|
||||
typedef struct host_priority_info host_priority_info_data_t;
|
||||
typedef struct host_priority_info *host_priority_info_t;
|
||||
#define HOST_PRIORITY_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(host_priority_info_data_t)/sizeof(integer_t)))
|
||||
|
||||
/* host_statistics() */
|
||||
#define HOST_LOAD_INFO 1 /* System loading stats */
|
||||
#define HOST_VM_INFO 2 /* Virtual memory stats */
|
||||
#define HOST_CPU_LOAD_INFO 3 /* CPU load stats */
|
||||
|
||||
/* host_statistics64() */
|
||||
#define HOST_VM_INFO64 4 /* 64-bit virtual memory stats */
|
||||
#define HOST_EXTMOD_INFO64 5 /* External modification stats */
|
||||
#define HOST_EXPIRED_TASK_INFO 6 /* Statistics for expired tasks */
|
||||
|
||||
|
||||
struct host_load_info {
|
||||
integer_t avenrun[3]; /* scaled by LOAD_SCALE */
|
||||
integer_t mach_factor[3]; /* scaled by LOAD_SCALE */
|
||||
};
|
||||
|
||||
typedef struct host_load_info host_load_info_data_t;
|
||||
typedef struct host_load_info *host_load_info_t;
|
||||
#define HOST_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(host_load_info_data_t)/sizeof(integer_t)))
|
||||
|
||||
typedef struct vm_purgeable_info host_purgable_info_data_t;
|
||||
typedef struct vm_purgeable_info *host_purgable_info_t;
|
||||
#define HOST_VM_PURGABLE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(host_purgable_info_data_t)/sizeof(integer_t)))
|
||||
|
||||
/* in <mach/vm_statistics.h> */
|
||||
/* vm_statistics64 */
|
||||
#define HOST_VM_INFO64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(vm_statistics64_data_t)/sizeof(integer_t)))
|
||||
|
||||
/* size of the latest version of the structure */
|
||||
#define HOST_VM_INFO64_LATEST_COUNT HOST_VM_INFO64_COUNT
|
||||
#define HOST_VM_INFO64_REV1_COUNT HOST_VM_INFO64_LATEST_COUNT
|
||||
/* previous versions: adjust the size according to what was added each time */
|
||||
#define HOST_VM_INFO64_REV0_COUNT /* added compression and swapper info (14 ints) */ \
|
||||
((mach_msg_type_number_t) \
|
||||
(HOST_VM_INFO64_REV1_COUNT - 14))
|
||||
|
||||
/* in <mach/vm_statistics.h> */
|
||||
/* vm_extmod_statistics */
|
||||
#define HOST_EXTMOD_INFO64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(vm_extmod_statistics_data_t)/sizeof(integer_t)))
|
||||
|
||||
/* size of the latest version of the structure */
|
||||
#define HOST_EXTMOD_INFO64_LATEST_COUNT HOST_EXTMOD_INFO64_COUNT
|
||||
|
||||
/* vm_statistics */
|
||||
#define HOST_VM_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(vm_statistics_data_t)/sizeof(integer_t)))
|
||||
|
||||
/* size of the latest version of the structure */
|
||||
#define HOST_VM_INFO_LATEST_COUNT HOST_VM_INFO_COUNT
|
||||
#define HOST_VM_INFO_REV2_COUNT HOST_VM_INFO_LATEST_COUNT
|
||||
/* previous versions: adjust the size according to what was added each time */
|
||||
#define HOST_VM_INFO_REV1_COUNT /* added "speculative_count" (1 int) */ \
|
||||
((mach_msg_type_number_t) \
|
||||
(HOST_VM_INFO_REV2_COUNT - 1))
|
||||
#define HOST_VM_INFO_REV0_COUNT /* added "purgable" info (2 ints) */ \
|
||||
((mach_msg_type_number_t) \
|
||||
(HOST_VM_INFO_REV1_COUNT - 2))
|
||||
|
||||
struct host_cpu_load_info { /* number of ticks while running... */
|
||||
natural_t cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
|
||||
};
|
||||
|
||||
typedef struct host_cpu_load_info host_cpu_load_info_data_t;
|
||||
typedef struct host_cpu_load_info *host_cpu_load_info_t;
|
||||
#define HOST_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof (host_cpu_load_info_data_t) / sizeof (integer_t)))
|
||||
|
||||
struct host_preferred_user_arch {
|
||||
cpu_type_t cpu_type; /* Preferred user-space cpu type */
|
||||
cpu_subtype_t cpu_subtype; /* Preferred user-space cpu subtype */
|
||||
};
|
||||
|
||||
typedef struct host_preferred_user_arch host_preferred_user_arch_data_t;
|
||||
typedef struct host_preferred_user_arch *host_preferred_user_arch_t;
|
||||
#define HOST_PREFERRED_USER_ARCH_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(host_preferred_user_arch_data_t)/sizeof(integer_t)))
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* _MACH_HOST_INFO_H_ */
|
||||
39
lib/libc/include/x86_64-macos-gnu/mach/host_notify.h
Normal file
39
lib/libc/include/x86_64-macos-gnu/mach/host_notify.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2003 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_HOST_NOTIFY_H_
|
||||
#define _MACH_HOST_NOTIFY_H_
|
||||
|
||||
#define HOST_NOTIFY_CALENDAR_CHANGE 0
|
||||
#define HOST_NOTIFY_CALENDAR_SET 1
|
||||
#define HOST_NOTIFY_TYPE_MAX 1
|
||||
|
||||
#define HOST_CALENDAR_CHANGED_REPLYID 950
|
||||
#define HOST_CALENDAR_SET_REPLYID 951
|
||||
|
||||
#endif /* _MACH_HOST_NOTIFY_H_ */
|
||||
1163
lib/libc/include/x86_64-macos-gnu/mach/host_priv.h
Normal file
1163
lib/libc/include/x86_64-macos-gnu/mach/host_priv.h
Normal file
File diff suppressed because it is too large
Load Diff
221
lib/libc/include/x86_64-macos-gnu/mach/host_security.h
Normal file
221
lib/libc/include/x86_64-macos-gnu/mach/host_security.h
Normal file
@@ -0,0 +1,221 @@
|
||||
#ifndef _host_security_user_
|
||||
#define _host_security_user_
|
||||
|
||||
/* Module host_security */
|
||||
|
||||
#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 host_security_MSG_COUNT
|
||||
#define host_security_MSG_COUNT 2
|
||||
#endif /* host_security_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 host_security_create_task_token */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t host_security_create_task_token
|
||||
(
|
||||
host_security_t host_security,
|
||||
task_t parent_task,
|
||||
security_token_t sec_token,
|
||||
audit_token_t audit_token,
|
||||
host_t host,
|
||||
ledger_array_t ledgers,
|
||||
mach_msg_type_number_t ledgersCnt,
|
||||
boolean_t inherit_memory,
|
||||
task_t *child_task
|
||||
);
|
||||
|
||||
/* Routine host_security_set_task_token */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t host_security_set_task_token
|
||||
(
|
||||
host_security_t host_security,
|
||||
task_t target_task,
|
||||
security_token_t sec_token,
|
||||
audit_token_t audit_token,
|
||||
host_t host
|
||||
);
|
||||
|
||||
__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__host_security_subsystem__defined
|
||||
#define __Request__host_security_subsystem__defined
|
||||
|
||||
#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 parent_task;
|
||||
mach_msg_port_descriptor_t host;
|
||||
mach_msg_ool_ports_descriptor_t ledgers;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
security_token_t sec_token;
|
||||
audit_token_t audit_token;
|
||||
mach_msg_type_number_t ledgersCnt;
|
||||
boolean_t inherit_memory;
|
||||
} __Request__host_security_create_task_token_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 target_task;
|
||||
mach_msg_port_descriptor_t host;
|
||||
/* end of the kernel processed data */
|
||||
NDR_record_t NDR;
|
||||
security_token_t sec_token;
|
||||
audit_token_t audit_token;
|
||||
} __Request__host_security_set_task_token_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Request__host_security_subsystem__defined */
|
||||
|
||||
/* union of all requests */
|
||||
|
||||
#ifndef __RequestUnion__host_security_subsystem__defined
|
||||
#define __RequestUnion__host_security_subsystem__defined
|
||||
union __RequestUnion__host_security_subsystem {
|
||||
__Request__host_security_create_task_token_t Request_host_security_create_task_token;
|
||||
__Request__host_security_set_task_token_t Request_host_security_set_task_token;
|
||||
};
|
||||
#endif /* !__RequestUnion__host_security_subsystem__defined */
|
||||
/* typedefs for all replies */
|
||||
|
||||
#ifndef __Reply__host_security_subsystem__defined
|
||||
#define __Reply__host_security_subsystem__defined
|
||||
|
||||
#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 child_task;
|
||||
/* end of the kernel processed data */
|
||||
} __Reply__host_security_create_task_token_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__host_security_set_task_token_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Reply__host_security_subsystem__defined */
|
||||
|
||||
/* union of all replies */
|
||||
|
||||
#ifndef __ReplyUnion__host_security_subsystem__defined
|
||||
#define __ReplyUnion__host_security_subsystem__defined
|
||||
union __ReplyUnion__host_security_subsystem {
|
||||
__Reply__host_security_create_task_token_t Reply_host_security_create_task_token;
|
||||
__Reply__host_security_set_task_token_t Reply_host_security_set_task_token;
|
||||
};
|
||||
#endif /* !__RequestUnion__host_security_subsystem__defined */
|
||||
|
||||
#ifndef subsystem_to_name_map_host_security
|
||||
#define subsystem_to_name_map_host_security \
|
||||
{ "host_security_create_task_token", 600 },\
|
||||
{ "host_security_set_task_token", 601 }
|
||||
#endif
|
||||
|
||||
#ifdef __AfterMigUserHeader
|
||||
__AfterMigUserHeader
|
||||
#endif /* __AfterMigUserHeader */
|
||||
|
||||
#endif /* _host_security_user_ */
|
||||
281
lib/libc/include/x86_64-macos-gnu/mach/host_special_ports.h
Normal file
281
lib/libc/include/x86_64-macos-gnu/mach/host_special_ports.h
Normal file
@@ -0,0 +1,281 @@
|
||||
/*
|
||||
* Copyright (c) 2003 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 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/host_special_ports.h
|
||||
*
|
||||
* Defines codes for access to host-wide special ports.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_HOST_SPECIAL_PORTS_H_
|
||||
#define _MACH_HOST_SPECIAL_PORTS_H_
|
||||
|
||||
/*
|
||||
* Cannot be set or gotten from user space
|
||||
*/
|
||||
#define HOST_SECURITY_PORT 0
|
||||
|
||||
#define HOST_MIN_SPECIAL_PORT HOST_SECURITY_PORT
|
||||
|
||||
/*
|
||||
* Always provided by kernel (cannot be set from user-space).
|
||||
*/
|
||||
#define HOST_PORT 1
|
||||
#define HOST_PRIV_PORT 2
|
||||
#define HOST_IO_MASTER_PORT 3
|
||||
#define HOST_MAX_SPECIAL_KERNEL_PORT 7 /* room to grow */
|
||||
|
||||
#define HOST_LAST_SPECIAL_KERNEL_PORT HOST_IO_MASTER_PORT
|
||||
|
||||
/*
|
||||
* Not provided by kernel
|
||||
*/
|
||||
#define HOST_DYNAMIC_PAGER_PORT (1 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_AUDIT_CONTROL_PORT (2 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_USER_NOTIFICATION_PORT (3 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_AUTOMOUNTD_PORT (4 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_LOCKD_PORT (5 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_KTRACE_BACKGROUND_PORT (6 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_SEATBELT_PORT (7 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_KEXTD_PORT (8 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_LAUNCHCTL_PORT (9 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_UNFREED_PORT (10 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_AMFID_PORT (11 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_GSSD_PORT (12 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_TELEMETRY_PORT (13 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_ATM_NOTIFICATION_PORT (14 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_COALITION_PORT (15 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_SYSDIAGNOSE_PORT (16 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_XPC_EXCEPTION_PORT (17 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_CONTAINERD_PORT (18 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_NODE_PORT (19 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_RESOURCE_NOTIFY_PORT (20 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_CLOSURED_PORT (21 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_SYSPOLICYD_PORT (22 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_FILECOORDINATIOND_PORT (23 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
#define HOST_FAIRPLAYD_PORT (24 + HOST_MAX_SPECIAL_KERNEL_PORT)
|
||||
|
||||
#define HOST_MAX_SPECIAL_PORT HOST_FAIRPLAYD_PORT
|
||||
/* MAX = last since rdar://35861175 */
|
||||
|
||||
/* obsolete name */
|
||||
#define HOST_CHUD_PORT HOST_LAUNCHCTL_PORT
|
||||
|
||||
/*
|
||||
* Special node identifier to always represent the local node.
|
||||
*/
|
||||
#define HOST_LOCAL_NODE -1
|
||||
|
||||
/*
|
||||
* Definitions for ease of use.
|
||||
*
|
||||
* In the get call, the host parameter can be any host, but will generally
|
||||
* be the local node host port. In the set call, the host must the per-node
|
||||
* host port for the node being affected.
|
||||
*/
|
||||
#define host_get_host_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_PORT, (port)))
|
||||
#define host_set_host_port(host, port) (KERN_INVALID_ARGUMENT)
|
||||
|
||||
#define host_get_host_priv_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_PRIV_PORT, (port)))
|
||||
#define host_set_host_priv_port(host, port) (KERN_INVALID_ARGUMENT)
|
||||
|
||||
#define host_get_io_master_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_IO_MASTER_PORT, (port)))
|
||||
#define host_set_io_master_port(host, port) (KERN_INVALID_ARGUMENT)
|
||||
|
||||
/*
|
||||
* User-settable special ports.
|
||||
*/
|
||||
#define host_get_dynamic_pager_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_DYNAMIC_PAGER_PORT, (port)))
|
||||
#define host_set_dynamic_pager_port(host, port) \
|
||||
(host_set_special_port((host), HOST_DYNAMIC_PAGER_PORT, (port)))
|
||||
|
||||
#define host_get_audit_control_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_AUDIT_CONTROL_PORT, (port)))
|
||||
#define host_set_audit_control_port(host, port) \
|
||||
(host_set_special_port((host), HOST_AUDIT_CONTROL_PORT, (port)))
|
||||
|
||||
#define host_get_user_notification_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_USER_NOTIFICATION_PORT, (port)))
|
||||
#define host_set_user_notification_port(host, port) \
|
||||
(host_set_special_port((host), HOST_USER_NOTIFICATION_PORT, (port)))
|
||||
|
||||
#define host_get_automountd_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_AUTOMOUNTD_PORT, (port)))
|
||||
#define host_set_automountd_port(host, port) \
|
||||
(host_set_special_port((host), HOST_AUTOMOUNTD_PORT, (port)))
|
||||
|
||||
#define host_get_lockd_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_LOCKD_PORT, (port)))
|
||||
#define host_set_lockd_port(host, port) \
|
||||
(host_set_special_port((host), HOST_LOCKD_PORT, (port)))
|
||||
|
||||
#define host_get_ktrace_background_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_KTRACE_BACKGROUND_PORT, (port)))
|
||||
#define host_set_ktrace_background_port(host, port) \
|
||||
(host_set_special_port((host), HOST_KTRACE_BACKGROUND_PORT, (port)))
|
||||
|
||||
#define host_get_kextd_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_KEXTD_PORT, (port)))
|
||||
#define host_set_kextd_port(host, port) \
|
||||
(host_set_special_port((host), HOST_KEXTD_PORT, (port)))
|
||||
|
||||
#define host_get_launchctl_port(host, port) \
|
||||
(host_get_special_port((host), HOST_LOCAL_NODE, HOST_LAUNCHCTL_PORT, \
|
||||
(port)))
|
||||
#define host_set_launchctl_port(host, port) \
|
||||
(host_set_special_port((host), HOST_LAUNCHCTL_PORT, (port)))
|
||||
|
||||
#define host_get_chud_port(host, port) host_get_launchctl_port(host, port)
|
||||
#define host_set_chud_port(host, port) host_set_launchctl_port(host, port)
|
||||
|
||||
#define host_get_unfreed_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_UNFREED_PORT, (port)))
|
||||
#define host_set_unfreed_port(host, port) \
|
||||
(host_set_special_port((host), HOST_UNFREED_PORT, (port)))
|
||||
|
||||
#define host_get_amfid_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_AMFID_PORT, (port)))
|
||||
#define host_set_amfid_port(host, port) \
|
||||
(host_set_special_port((host), HOST_AMFID_PORT, (port)))
|
||||
|
||||
#define host_get_gssd_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_GSSD_PORT, (port)))
|
||||
#define host_set_gssd_port(host, port) \
|
||||
(host_set_special_port((host), HOST_GSSD_PORT, (port)))
|
||||
|
||||
#define host_get_telemetry_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_TELEMETRY_PORT, (port)))
|
||||
#define host_set_telemetry_port(host, port) \
|
||||
(host_set_special_port((host), HOST_TELEMETRY_PORT, (port)))
|
||||
|
||||
#define host_get_atm_notification_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_ATM_NOTIFICATION_PORT, (port)))
|
||||
#define host_set_atm_notification_port(host, port) \
|
||||
(host_set_special_port((host), HOST_ATM_NOTIFICATION_PORT, (port)))
|
||||
|
||||
#define host_get_coalition_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_COALITION_PORT, (port)))
|
||||
#define host_set_coalition_port(host, port) \
|
||||
(host_set_special_port((host), HOST_COALITION_PORT, (port)))
|
||||
|
||||
#define host_get_sysdiagnose_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_SYSDIAGNOSE_PORT, (port)))
|
||||
#define host_set_sysdiagnose_port(host, port) \
|
||||
(host_set_special_port((host), HOST_SYSDIAGNOSE_PORT, (port)))
|
||||
|
||||
#define host_get_container_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_CONTAINERD_PORT, (port)))
|
||||
#define host_set_container_port(host, port) \
|
||||
(host_set_special_port((host), HOST_CONTAINERD_PORT, (port)))
|
||||
|
||||
#define host_get_node_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_NODE_PORT, (port)))
|
||||
#define host_set_node_port(host, port) \
|
||||
(host_set_special_port((host), HOST_NODE_PORT, (port)))
|
||||
|
||||
#define host_get_closured_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_CLOSURED_PORT, (port)))
|
||||
#define host_set_closured_port(host, port) \
|
||||
(host_set_special_port((host), HOST_CLOSURED_PORT, (port)))
|
||||
|
||||
#define host_get_syspolicyd_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_SYSPOLICYD_PORT, (port)))
|
||||
#define host_set_syspolicyd_port(host, port) \
|
||||
(host_set_special_port((host), HOST_SYSPOLICYD_PORT, (port)))
|
||||
|
||||
#define host_get_filecoordinationd_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_FILECOORDINATIOND_PORT, (port)))
|
||||
#define host_set_filecoordinationd_port(host, port) \
|
||||
(host_set_special_port((host), HOST_FILECOORDINATIOND_PORT, (port)))
|
||||
|
||||
#define host_get_fairplayd_port(host, port) \
|
||||
(host_get_special_port((host), \
|
||||
HOST_LOCAL_NODE, HOST_FAIRPLAYD_PORT, (port)))
|
||||
#define host_set_fairplayd_port(host, port) \
|
||||
(host_set_special_port((host), HOST_FAIRPLAYD_PORT, (port)))
|
||||
|
||||
/* HOST_RESOURCE_NOTIFY_PORT doesn't #defines these conveniences.
|
||||
* All lookups go through send_resource_violation()
|
||||
*/
|
||||
|
||||
#endif /* _MACH_HOST_SPECIAL_PORTS_H_ */
|
||||
@@ -603,7 +603,48 @@ _STRUCT_X86_DEBUG_STATE32
|
||||
unsigned int __dr6;
|
||||
unsigned int __dr7;
|
||||
};
|
||||
|
||||
#define _STRUCT_X86_INSTRUCTION_STATE struct __x86_instruction_state
|
||||
_STRUCT_X86_INSTRUCTION_STATE
|
||||
{
|
||||
int __insn_stream_valid_bytes;
|
||||
int __insn_offset;
|
||||
int __out_of_synch; /*
|
||||
* non-zero when the cacheline that includes the insn_offset
|
||||
* is replaced in the insn_bytes array due to a mismatch
|
||||
* detected when comparing it with the same cacheline in memory
|
||||
*/
|
||||
#define _X86_INSTRUCTION_STATE_MAX_INSN_BYTES (2448 - 64 - 4)
|
||||
__uint8_t __insn_bytes[_X86_INSTRUCTION_STATE_MAX_INSN_BYTES];
|
||||
#define _X86_INSTRUCTION_STATE_CACHELINE_SIZE 64
|
||||
__uint8_t __insn_cacheline[_X86_INSTRUCTION_STATE_CACHELINE_SIZE];
|
||||
};
|
||||
|
||||
#define _STRUCT_LAST_BRANCH_RECORD struct __last_branch_record
|
||||
_STRUCT_LAST_BRANCH_RECORD
|
||||
{
|
||||
__uint64_t __from_ip;
|
||||
__uint64_t __to_ip;
|
||||
__uint32_t __mispredict : 1,
|
||||
__tsx_abort : 1,
|
||||
__in_tsx : 1,
|
||||
__cycle_count: 16,
|
||||
__reserved : 13;
|
||||
};
|
||||
|
||||
#define _STRUCT_LAST_BRANCH_STATE struct __last_branch_state
|
||||
_STRUCT_LAST_BRANCH_STATE
|
||||
{
|
||||
int __lbr_count;
|
||||
__uint32_t __lbr_supported_tsx : 1,
|
||||
__lbr_supported_cycle_count : 1,
|
||||
__reserved : 30;
|
||||
#define __LASTBRANCH_MAX 32
|
||||
_STRUCT_LAST_BRANCH_RECORD __lbrs[__LASTBRANCH_MAX];
|
||||
};
|
||||
|
||||
#else /* !__DARWIN_UNIX03 */
|
||||
|
||||
#define _STRUCT_X86_DEBUG_STATE32 struct x86_debug_state32
|
||||
_STRUCT_X86_DEBUG_STATE32
|
||||
{
|
||||
@@ -616,6 +657,45 @@ _STRUCT_X86_DEBUG_STATE32
|
||||
unsigned int dr6;
|
||||
unsigned int dr7;
|
||||
};
|
||||
|
||||
#define _STRUCT_X86_INSTRUCTION_STATE struct __x86_instruction_state
|
||||
_STRUCT_X86_INSTRUCTION_STATE
|
||||
{
|
||||
int insn_stream_valid_bytes;
|
||||
int insn_offset;
|
||||
int out_of_synch; /*
|
||||
* non-zero when the cacheline that includes the insn_offset
|
||||
* is replaced in the insn_bytes array due to a mismatch
|
||||
* detected when comparing it with the same cacheline in memory
|
||||
*/
|
||||
#define x86_INSTRUCTION_STATE_MAX_INSN_BYTES (2448 - 64 - 4)
|
||||
__uint8_t insn_bytes[x86_INSTRUCTION_STATE_MAX_INSN_BYTES];
|
||||
#define x86_INSTRUCTION_STATE_CACHELINE_SIZE 64
|
||||
__uint8_t insn_cacheline[x86_INSTRUCTION_STATE_CACHELINE_SIZE];
|
||||
};
|
||||
|
||||
#define _STRUCT_LAST_BRANCH_RECORD struct __last_branch_record
|
||||
_STRUCT_LAST_BRANCH_RECORD
|
||||
{
|
||||
__uint64_t from_ip;
|
||||
__uint64_t to_ip;
|
||||
__uint32_t mispredict : 1,
|
||||
tsx_abort : 1,
|
||||
in_tsx : 1,
|
||||
cycle_count: 16,
|
||||
reserved : 13;
|
||||
};
|
||||
|
||||
#define _STRUCT_LAST_BRANCH_STATE struct __last_branch_state
|
||||
_STRUCT_LAST_BRANCH_STATE
|
||||
{
|
||||
int lbr_count;
|
||||
__uint32_t lbr_supported_tsx : 1,
|
||||
lbr_supported_cycle_count : 1,
|
||||
reserved : 30;
|
||||
#define __LASTBRANCH_MAX 32
|
||||
_STRUCT_LAST_BRANCH_RECORD lbrs[__LASTBRANCH_MAX];
|
||||
};
|
||||
#endif /* !__DARWIN_UNIX03 */
|
||||
|
||||
#define _STRUCT_X86_PAGEIN_STATE struct __x86_pagein_state
|
||||
|
||||
74
lib/libc/include/x86_64-macos-gnu/mach/i386/boolean.h
Normal file
74
lib/libc/include/x86_64-macos-gnu/mach/i386/boolean.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 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 I386.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_I386_BOOLEAN_H_
|
||||
#define _MACH_I386_BOOLEAN_H_
|
||||
|
||||
#if defined(__x86_64__) && !defined(KERNEL)
|
||||
typedef unsigned int boolean_t;
|
||||
#else
|
||||
typedef int boolean_t;
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_I386_BOOLEAN_H_ */
|
||||
135
lib/libc/include/x86_64-macos-gnu/mach/i386/exception.h
Normal file
135
lib/libc/include/x86_64-macos-gnu/mach/i386/exception.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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 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.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
#ifndef _MACH_I386_EXCEPTION_H_
|
||||
#define _MACH_I386_EXCEPTION_H_
|
||||
|
||||
/*
|
||||
* No machine dependent types for the 80386
|
||||
*/
|
||||
|
||||
#define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */
|
||||
|
||||
/*
|
||||
* Codes and subcodes for 80386 exceptions.
|
||||
*/
|
||||
|
||||
#define EXCEPTION_CODE_MAX 2 /* currently code and subcode */
|
||||
|
||||
/*
|
||||
* EXC_BAD_INSTRUCTION
|
||||
*/
|
||||
|
||||
#define EXC_I386_INVOP 1
|
||||
|
||||
/*
|
||||
* EXC_ARITHMETIC
|
||||
*/
|
||||
|
||||
#define EXC_I386_DIV 1
|
||||
#define EXC_I386_INTO 2
|
||||
#define EXC_I386_NOEXT 3
|
||||
#define EXC_I386_EXTOVR 4
|
||||
#define EXC_I386_EXTERR 5
|
||||
#define EXC_I386_EMERR 6
|
||||
#define EXC_I386_BOUND 7
|
||||
#define EXC_I386_SSEEXTERR 8
|
||||
|
||||
/*
|
||||
* EXC_SOFTWARE
|
||||
* Note: 0x10000-0x10003 in use for unix signal
|
||||
*/
|
||||
|
||||
/*
|
||||
* EXC_BAD_ACCESS
|
||||
*/
|
||||
|
||||
/*
|
||||
* EXC_BREAKPOINT
|
||||
*/
|
||||
|
||||
#define EXC_I386_SGL 1
|
||||
#define EXC_I386_BPT 2
|
||||
|
||||
#define EXC_I386_DIVERR 0 /* divide by 0 eprror */
|
||||
#define EXC_I386_SGLSTP 1 /* single step */
|
||||
#define EXC_I386_NMIFLT 2 /* NMI */
|
||||
#define EXC_I386_BPTFLT 3 /* breakpoint fault */
|
||||
#define EXC_I386_INTOFLT 4 /* INTO overflow fault */
|
||||
#define EXC_I386_BOUNDFLT 5 /* BOUND instruction fault */
|
||||
#define EXC_I386_INVOPFLT 6 /* invalid opcode fault */
|
||||
#define EXC_I386_NOEXTFLT 7 /* extension not available fault*/
|
||||
#define EXC_I386_DBLFLT 8 /* double fault */
|
||||
#define EXC_I386_EXTOVRFLT 9 /* extension overrun fault */
|
||||
#define EXC_I386_INVTSSFLT 10 /* invalid TSS fault */
|
||||
#define EXC_I386_SEGNPFLT 11 /* segment not present fault */
|
||||
#define EXC_I386_STKFLT 12 /* stack fault */
|
||||
#define EXC_I386_GPFLT 13 /* general protection fault */
|
||||
#define EXC_I386_PGFLT 14 /* page fault */
|
||||
#define EXC_I386_EXTERRFLT 16 /* extension error fault */
|
||||
#define EXC_I386_ALIGNFLT 17 /* Alignment fault */
|
||||
#define EXC_I386_ENDPERR 33 /* emulated extension error flt */
|
||||
#define EXC_I386_ENOEXTFLT 32 /* emulated ext not present */
|
||||
|
||||
|
||||
/*
|
||||
* machine dependent exception masks
|
||||
*/
|
||||
#define EXC_MASK_MACHINE 0
|
||||
|
||||
#endif /* _MACH_I386_EXCEPTION_H_ */
|
||||
118
lib/libc/include/x86_64-macos-gnu/mach/i386/fp_reg.h
Normal file
118
lib/libc/include/x86_64-macos-gnu/mach/i386/fp_reg.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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) 1992-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.
|
||||
*/
|
||||
/*
|
||||
*/
|
||||
|
||||
#ifndef _I386_FP_SAVE_H_
|
||||
#define _I386_FP_SAVE_H_
|
||||
|
||||
/*
|
||||
* Control register
|
||||
*/
|
||||
#define FPC_IE 0x0001 /* enable invalid operation
|
||||
* exception */
|
||||
#define FPC_IM FPC_IE
|
||||
#define FPC_DE 0x0002 /* enable denormalized operation
|
||||
* exception */
|
||||
#define FPC_DM FPC_DE
|
||||
#define FPC_ZE 0x0004 /* enable zero-divide exception */
|
||||
#define FPC_ZM FPC_ZE
|
||||
#define FPC_OE 0x0008 /* enable overflow exception */
|
||||
#define FPC_OM FPC_OE
|
||||
#define FPC_UE 0x0010 /* enable underflow exception */
|
||||
#define FPC_PE 0x0020 /* enable precision exception */
|
||||
#define FPC_PC 0x0300 /* precision control: */
|
||||
#define FPC_PC_24 0x0000 /* 24 bits */
|
||||
#define FPC_PC_53 0x0200 /* 53 bits */
|
||||
#define FPC_PC_64 0x0300 /* 64 bits */
|
||||
#define FPC_RC 0x0c00 /* rounding control: */
|
||||
#define FPC_RC_RN 0x0000 /* round to nearest or even */
|
||||
#define FPC_RC_RD 0x0400 /* round down */
|
||||
#define FPC_RC_RU 0x0800 /* round up */
|
||||
#define FPC_RC_CHOP 0x0c00 /* chop */
|
||||
#define FPC_IC 0x1000 /* infinity control (obsolete) */
|
||||
#define FPC_IC_PROJ 0x0000 /* projective infinity */
|
||||
#define FPC_IC_AFF 0x1000 /* affine infinity (std) */
|
||||
|
||||
/*
|
||||
* Status register
|
||||
*/
|
||||
#define FPS_IE 0x0001 /* invalid operation */
|
||||
#define FPS_DE 0x0002 /* denormalized operand */
|
||||
#define FPS_ZE 0x0004 /* divide by zero */
|
||||
#define FPS_OE 0x0008 /* overflow */
|
||||
#define FPS_UE 0x0010 /* underflow */
|
||||
#define FPS_PE 0x0020 /* precision */
|
||||
#define FPS_SF 0x0040 /* stack flag */
|
||||
#define FPS_ES 0x0080 /* error summary */
|
||||
#define FPS_C0 0x0100 /* condition code bit 0 */
|
||||
#define FPS_C1 0x0200 /* condition code bit 1 */
|
||||
#define FPS_C2 0x0400 /* condition code bit 2 */
|
||||
#define FPS_TOS 0x3800 /* top-of-stack pointer */
|
||||
#define FPS_TOS_SHIFT 11
|
||||
#define FPS_C3 0x4000 /* condition code bit 3 */
|
||||
#define FPS_BUSY 0x8000 /* FPU busy */
|
||||
|
||||
/*
|
||||
* Kind of floating-point support provided by kernel.
|
||||
*/
|
||||
#define FP_NO 0 /* no floating point */
|
||||
#define FP_SOFT 1 /* software FP emulator */
|
||||
#define FP_287 2 /* 80287 */
|
||||
#define FP_387 3 /* 80387 or 80486 */
|
||||
#define FP_FXSR 4 /* Fast save/restore SIMD Extension */
|
||||
|
||||
#endif /* _I386_FP_SAVE_H_ */
|
||||
74
lib/libc/include/x86_64-macos-gnu/mach/i386/kern_return.h
Normal file
74
lib/libc/include/x86_64-macos-gnu/mach/i386/kern_return.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 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_I386_KERN_RETURN_H_
|
||||
#define _MACH_I386_KERN_RETURN_H_
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
typedef int kern_return_t;
|
||||
#endif /* ASSEMBLER */
|
||||
|
||||
#endif /* _MACH_I386_KERN_RETURN_H_ */
|
||||
37
lib/libc/include/x86_64-macos-gnu/mach/i386/processor_info.h
Normal file
37
lib/libc/include/x86_64-macos-gnu/mach/i386/processor_info.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
/*
|
||||
* File: mach/i386/processor_info.h
|
||||
*
|
||||
* Data structure definitions for i386 specific processor control
|
||||
*/
|
||||
|
||||
#ifndef _MACH_I386_PROCESSOR_INFO_H_
|
||||
#define _MACH_I386_PROCESSOR_INFO_H_
|
||||
|
||||
#endif /* _MACH_I386_PROCESSOR_INFO_H_ */
|
||||
35
lib/libc/include/x86_64-macos-gnu/mach/i386/rpc.h
Normal file
35
lib/libc/include/x86_64-macos-gnu/mach/i386/rpc.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2002,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@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_I386_RPC_H_
|
||||
#define _MACH_I386_RPC_H_
|
||||
|
||||
#endif /* _MACH_I386_RPC_H_ */
|
||||
42
lib/libc/include/x86_64-macos-gnu/mach/i386/thread_state.h
Normal file
42
lib/libc/include/x86_64-macos-gnu/mach/i386/thread_state.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
|
||||
#ifndef _MACH_I386_THREAD_STATE_H_
|
||||
#define _MACH_I386_THREAD_STATE_H_
|
||||
|
||||
/* Size of maximum exported thread state in 32-bit words */
|
||||
#define I386_THREAD_STATE_MAX (614) /* Size of biggest state possible */
|
||||
|
||||
#if defined (__i386__) || defined(__x86_64__)
|
||||
#define THREAD_STATE_MAX I386_THREAD_STATE_MAX
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_I386_THREAD_STATE_H_ */
|
||||
362
lib/libc/include/x86_64-macos-gnu/mach/i386/thread_status.h
Normal file
362
lib/libc/include/x86_64-macos-gnu/mach/i386/thread_status.h
Normal file
@@ -0,0 +1,362 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2020 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* @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: thread_status.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1985
|
||||
*
|
||||
* This file contains the structure definitions for the thread
|
||||
* state as applied to I386 processors.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_I386_THREAD_STATUS_H_
|
||||
#define _MACH_I386_THREAD_STATUS_H_
|
||||
|
||||
#include <mach/machine/_structs.h>
|
||||
#include <mach/message.h>
|
||||
#include <mach/i386/fp_reg.h>
|
||||
#include <mach/i386/thread_state.h>
|
||||
#include <i386/eflags.h>
|
||||
|
||||
|
||||
/*
|
||||
* the i386_xxxx form is kept for legacy purposes since these types
|
||||
* are externally known... eventually they should be deprecated.
|
||||
* our internal implementation has moved to the following naming convention
|
||||
*
|
||||
* x86_xxxx32 names are used to deal with 32 bit states
|
||||
* x86_xxxx64 names are used to deal with 64 bit states
|
||||
* x86_xxxx names are used to deal with either 32 or 64 bit states
|
||||
* via a self-describing mechanism
|
||||
*/
|
||||
|
||||
/*
|
||||
* these are the legacy names which should be deprecated in the future
|
||||
* they are externally known which is the only reason we don't just get
|
||||
* rid of them
|
||||
*/
|
||||
#define i386_THREAD_STATE 1
|
||||
#define i386_FLOAT_STATE 2
|
||||
#define i386_EXCEPTION_STATE 3
|
||||
|
||||
/*
|
||||
* THREAD_STATE_FLAVOR_LIST 0
|
||||
* these are the supported flavors
|
||||
*/
|
||||
#define x86_THREAD_STATE32 1
|
||||
#define x86_FLOAT_STATE32 2
|
||||
#define x86_EXCEPTION_STATE32 3
|
||||
#define x86_THREAD_STATE64 4
|
||||
#define x86_FLOAT_STATE64 5
|
||||
#define x86_EXCEPTION_STATE64 6
|
||||
#define x86_THREAD_STATE 7
|
||||
#define x86_FLOAT_STATE 8
|
||||
#define x86_EXCEPTION_STATE 9
|
||||
#define x86_DEBUG_STATE32 10
|
||||
#define x86_DEBUG_STATE64 11
|
||||
#define x86_DEBUG_STATE 12
|
||||
#define THREAD_STATE_NONE 13
|
||||
/* 14 and 15 are used for the internal x86_SAVED_STATE flavours */
|
||||
/* Arrange for flavors to take sequential values, 32-bit, 64-bit, non-specific */
|
||||
#define x86_AVX_STATE32 16
|
||||
#define x86_AVX_STATE64 (x86_AVX_STATE32 + 1)
|
||||
#define x86_AVX_STATE (x86_AVX_STATE32 + 2)
|
||||
#define x86_AVX512_STATE32 19
|
||||
#define x86_AVX512_STATE64 (x86_AVX512_STATE32 + 1)
|
||||
#define x86_AVX512_STATE (x86_AVX512_STATE32 + 2)
|
||||
#define x86_PAGEIN_STATE 22
|
||||
#define x86_THREAD_FULL_STATE64 23
|
||||
#define x86_INSTRUCTION_STATE 24
|
||||
#define x86_LAST_BRANCH_STATE 25
|
||||
|
||||
/*
|
||||
* Largest state on this machine:
|
||||
* (be sure mach/machine/thread_state.h matches!)
|
||||
*/
|
||||
#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
|
||||
|
||||
/*
|
||||
* VALID_THREAD_STATE_FLAVOR is a platform specific macro that when passed
|
||||
* an exception flavor will return if that is a defined flavor for that
|
||||
* platform. The macro must be manually updated to include all of the valid
|
||||
* exception flavors as defined above.
|
||||
*/
|
||||
#define VALID_THREAD_STATE_FLAVOR(x) \
|
||||
((x == x86_THREAD_STATE32) || \
|
||||
(x == x86_FLOAT_STATE32) || \
|
||||
(x == x86_EXCEPTION_STATE32) || \
|
||||
(x == x86_DEBUG_STATE32) || \
|
||||
(x == x86_THREAD_STATE64) || \
|
||||
(x == x86_THREAD_FULL_STATE64) || \
|
||||
(x == x86_FLOAT_STATE64) || \
|
||||
(x == x86_EXCEPTION_STATE64) || \
|
||||
(x == x86_DEBUG_STATE64) || \
|
||||
(x == x86_THREAD_STATE) || \
|
||||
(x == x86_FLOAT_STATE) || \
|
||||
(x == x86_EXCEPTION_STATE) || \
|
||||
(x == x86_DEBUG_STATE) || \
|
||||
(x == x86_AVX_STATE32) || \
|
||||
(x == x86_AVX_STATE64) || \
|
||||
(x == x86_AVX_STATE) || \
|
||||
(x == x86_AVX512_STATE32) || \
|
||||
(x == x86_AVX512_STATE64) || \
|
||||
(x == x86_AVX512_STATE) || \
|
||||
(x == x86_PAGEIN_STATE) || \
|
||||
(x == x86_INSTRUCTION_STATE) || \
|
||||
(x == x86_LAST_BRANCH_STATE) || \
|
||||
(x == THREAD_STATE_NONE))
|
||||
|
||||
struct x86_state_hdr {
|
||||
uint32_t flavor;
|
||||
uint32_t count;
|
||||
};
|
||||
typedef struct x86_state_hdr x86_state_hdr_t;
|
||||
|
||||
/*
|
||||
* Default segment register values.
|
||||
*/
|
||||
|
||||
#define USER_CODE_SELECTOR 0x0017
|
||||
#define USER_DATA_SELECTOR 0x001f
|
||||
#define KERN_CODE_SELECTOR 0x0008
|
||||
#define KERN_DATA_SELECTOR 0x0010
|
||||
|
||||
/*
|
||||
* to be deprecated in the future
|
||||
*/
|
||||
typedef _STRUCT_X86_THREAD_STATE32 i386_thread_state_t;
|
||||
#define i386_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (i386_thread_state_t) / sizeof (int) ))
|
||||
|
||||
typedef _STRUCT_X86_THREAD_STATE32 x86_thread_state32_t;
|
||||
#define x86_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (x86_thread_state32_t) / sizeof (int) ))
|
||||
|
||||
/*
|
||||
* to be deprecated in the future
|
||||
*/
|
||||
typedef _STRUCT_X86_FLOAT_STATE32 i386_float_state_t;
|
||||
#define i386_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(i386_float_state_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef _STRUCT_X86_FLOAT_STATE32 x86_float_state32_t;
|
||||
#define x86_FLOAT_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_float_state32_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef _STRUCT_X86_AVX_STATE32 x86_avx_state32_t;
|
||||
#define x86_AVX_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_avx_state32_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef _STRUCT_X86_AVX512_STATE32 x86_avx512_state32_t;
|
||||
#define x86_AVX512_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_avx512_state32_t)/sizeof(unsigned int)))
|
||||
|
||||
/*
|
||||
* to be deprecated in the future
|
||||
*/
|
||||
typedef _STRUCT_X86_EXCEPTION_STATE32 i386_exception_state_t;
|
||||
#define i386_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (i386_exception_state_t) / sizeof (int) ))
|
||||
|
||||
typedef _STRUCT_X86_EXCEPTION_STATE32 x86_exception_state32_t;
|
||||
#define x86_EXCEPTION_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (x86_exception_state32_t) / sizeof (int) ))
|
||||
|
||||
#define I386_EXCEPTION_STATE_COUNT i386_EXCEPTION_STATE_COUNT
|
||||
|
||||
typedef _STRUCT_X86_DEBUG_STATE32 x86_debug_state32_t;
|
||||
#define x86_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (x86_debug_state32_t) / sizeof (int) ))
|
||||
|
||||
#define X86_DEBUG_STATE32_COUNT x86_DEBUG_STATE32_COUNT
|
||||
|
||||
typedef _STRUCT_X86_THREAD_STATE64 x86_thread_state64_t;
|
||||
#define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (x86_thread_state64_t) / sizeof (int) ))
|
||||
|
||||
typedef _STRUCT_X86_THREAD_FULL_STATE64 x86_thread_full_state64_t;
|
||||
#define x86_THREAD_FULL_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (x86_thread_full_state64_t) / sizeof (int) ))
|
||||
|
||||
typedef _STRUCT_X86_FLOAT_STATE64 x86_float_state64_t;
|
||||
#define x86_FLOAT_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_float_state64_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef _STRUCT_X86_AVX_STATE64 x86_avx_state64_t;
|
||||
#define x86_AVX_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_avx_state64_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef _STRUCT_X86_AVX512_STATE64 x86_avx512_state64_t;
|
||||
#define x86_AVX512_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_avx512_state64_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef _STRUCT_X86_EXCEPTION_STATE64 x86_exception_state64_t;
|
||||
#define x86_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (x86_exception_state64_t) / sizeof (int) ))
|
||||
|
||||
#define X86_EXCEPTION_STATE64_COUNT x86_EXCEPTION_STATE64_COUNT
|
||||
|
||||
typedef _STRUCT_X86_DEBUG_STATE64 x86_debug_state64_t;
|
||||
#define x86_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (x86_debug_state64_t) / sizeof (int) ))
|
||||
|
||||
#define X86_DEBUG_STATE64_COUNT x86_DEBUG_STATE64_COUNT
|
||||
|
||||
typedef _STRUCT_X86_PAGEIN_STATE x86_pagein_state_t;
|
||||
#define x86_PAGEIN_STATE_COUNT \
|
||||
((mach_msg_type_number_t)(sizeof(x86_pagein_state_t) / sizeof(int)))
|
||||
|
||||
#define X86_PAGEIN_STATE_COUNT x86_PAGEIN_STATE_COUNT
|
||||
|
||||
typedef _STRUCT_X86_INSTRUCTION_STATE x86_instruction_state_t;
|
||||
#define x86_INSTRUCTION_STATE_COUNT \
|
||||
((mach_msg_type_number_t)(sizeof(x86_instruction_state_t) / sizeof(int)))
|
||||
|
||||
#define X86_INSTRUCTION_STATE_COUNT x86_INSTRUCTION_STATE_COUNT
|
||||
|
||||
typedef _STRUCT_LAST_BRANCH_STATE last_branch_state_t;
|
||||
#define x86_LAST_BRANCH_STATE_COUNT \
|
||||
((mach_msg_type_number_t)(sizeof(last_branch_state_t) / sizeof(int)))
|
||||
|
||||
#define X86_LAST_BRANCH_STATE_COUNT x86_LAST_BRANCH_STATE_COUNT
|
||||
|
||||
|
||||
/*
|
||||
* Combined thread, float and exception states
|
||||
*/
|
||||
struct x86_thread_state {
|
||||
x86_state_hdr_t tsh;
|
||||
union {
|
||||
x86_thread_state32_t ts32;
|
||||
x86_thread_state64_t ts64;
|
||||
} uts;
|
||||
};
|
||||
|
||||
struct x86_float_state {
|
||||
x86_state_hdr_t fsh;
|
||||
union {
|
||||
x86_float_state32_t fs32;
|
||||
x86_float_state64_t fs64;
|
||||
} ufs;
|
||||
};
|
||||
|
||||
struct x86_exception_state {
|
||||
x86_state_hdr_t esh;
|
||||
union {
|
||||
x86_exception_state32_t es32;
|
||||
x86_exception_state64_t es64;
|
||||
} ues;
|
||||
};
|
||||
|
||||
struct x86_debug_state {
|
||||
x86_state_hdr_t dsh;
|
||||
union {
|
||||
x86_debug_state32_t ds32;
|
||||
x86_debug_state64_t ds64;
|
||||
} uds;
|
||||
};
|
||||
|
||||
struct x86_avx_state {
|
||||
x86_state_hdr_t ash;
|
||||
union {
|
||||
x86_avx_state32_t as32;
|
||||
x86_avx_state64_t as64;
|
||||
} ufs;
|
||||
};
|
||||
|
||||
struct x86_avx512_state {
|
||||
x86_state_hdr_t ash;
|
||||
union {
|
||||
x86_avx512_state32_t as32;
|
||||
x86_avx512_state64_t as64;
|
||||
} ufs;
|
||||
};
|
||||
|
||||
typedef struct x86_thread_state x86_thread_state_t;
|
||||
#define x86_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
( sizeof (x86_thread_state_t) / sizeof (int) ))
|
||||
|
||||
typedef struct x86_float_state x86_float_state_t;
|
||||
#define x86_FLOAT_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_float_state_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef struct x86_exception_state x86_exception_state_t;
|
||||
#define x86_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_exception_state_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef struct x86_debug_state x86_debug_state_t;
|
||||
#define x86_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_debug_state_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef struct x86_avx_state x86_avx_state_t;
|
||||
#define x86_AVX_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_avx_state_t)/sizeof(unsigned int)))
|
||||
|
||||
typedef struct x86_avx512_state x86_avx512_state_t;
|
||||
#define x86_AVX512_STATE_COUNT ((mach_msg_type_number_t) \
|
||||
(sizeof(x86_avx512_state_t)/sizeof(unsigned int)))
|
||||
|
||||
/*
|
||||
* Machine-independent way for servers and Mach's exception mechanism to
|
||||
* choose the most efficient state flavor for exception RPC's:
|
||||
*/
|
||||
#define MACHINE_THREAD_STATE x86_THREAD_STATE
|
||||
#define MACHINE_THREAD_STATE_COUNT x86_THREAD_STATE_COUNT
|
||||
|
||||
|
||||
#endif /* _MACH_I386_THREAD_STATUS_H_ */
|
||||
157
lib/libc/include/x86_64-macos-gnu/mach/i386/vm_param.h
Normal file
157
lib/libc/include/x86_64-macos-gnu/mach/i386/vm_param.h
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright (c) 2000-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@
|
||||
*/
|
||||
/*
|
||||
* @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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 The University of Utah and
|
||||
* the Computer Systems Laboratory at the University of Utah (CSL).
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software is hereby
|
||||
* granted provided that (1) source code retains these copyright, permission,
|
||||
* and disclaimer notices, and (2) redistributions including binaries
|
||||
* reproduce the notices in supporting documentation, and (3) all advertising
|
||||
* materials mentioning features or use of this software display the following
|
||||
* acknowledgement: ``This product includes software developed by the
|
||||
* Computer Systems Laboratory at the University of Utah.''
|
||||
*
|
||||
* THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS
|
||||
* IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF
|
||||
* ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* CSL requests users of this software to return to csl-dist@cs.utah.edu any
|
||||
* improvements that they make and grant CSL redistribution rights.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: vm_param.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1985
|
||||
*
|
||||
* I386 machine dependent virtual memory parameters.
|
||||
* Most of the declarations are preceeded by I386_ (or i386_)
|
||||
* which is OK because only I386 specific code will be using
|
||||
* them.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_I386_VM_PARAM_H_
|
||||
#define _MACH_I386_VM_PARAM_H_
|
||||
|
||||
#if !defined(KERNEL) && !defined(__ASSEMBLER__)
|
||||
|
||||
#include <mach/vm_page_size.h>
|
||||
#endif
|
||||
|
||||
#define BYTE_SIZE 8 /* byte size in bits */
|
||||
|
||||
#define I386_PGBYTES 4096 /* bytes per 80386 page */
|
||||
#define I386_PGSHIFT 12 /* bitshift for pages */
|
||||
|
||||
|
||||
#if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || (__MAC_OS_X_VERSION_MIN_REQUIRED < 101600)
|
||||
#define PAGE_SHIFT I386_PGSHIFT
|
||||
#define PAGE_SIZE I386_PGBYTES
|
||||
#define PAGE_MASK (PAGE_SIZE-1)
|
||||
#else /* !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || (__MAC_OS_X_VERSION_MIN_REQUIRED < 101600) */
|
||||
#define PAGE_SHIFT vm_page_shift
|
||||
#define PAGE_SIZE vm_page_size
|
||||
#define PAGE_MASK vm_page_mask
|
||||
#endif /* !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || (__MAC_OS_X_VERSION_MIN_REQUIRED < 101600) */
|
||||
|
||||
#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_MIN_ADDRESS64 ((user_addr_t) 0x0000000000000000ULL)
|
||||
/*
|
||||
* default top of user stack... it grows down from here
|
||||
*/
|
||||
#define VM_USRSTACK64 ((user_addr_t) 0x00007FFEEFC00000ULL)
|
||||
|
||||
/*
|
||||
* XXX TODO: Obsolete?
|
||||
*/
|
||||
#define VM_DYLD64 ((user_addr_t) 0x00007FFF5FC00000ULL)
|
||||
#define VM_LIB64_SHR_DATA ((user_addr_t) 0x00007FFF60000000ULL)
|
||||
#define VM_LIB64_SHR_TEXT ((user_addr_t) 0x00007FFF80000000ULL)
|
||||
/*
|
||||
* the end of the usable user address space , for now about 47 bits.
|
||||
* the 64 bit commpage is past the end of this
|
||||
*/
|
||||
#define VM_MAX_PAGE_ADDRESS ((user_addr_t) 0x00007FFFFFE00000ULL)
|
||||
/*
|
||||
* canonical end of user address space for limits checking
|
||||
*/
|
||||
#define VM_MAX_USER_PAGE_ADDRESS ((user_addr_t)0x00007FFFFFFFF000ULL)
|
||||
|
||||
|
||||
/* system-wide values */
|
||||
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
|
||||
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_PAGE_ADDRESS)
|
||||
|
||||
/* process-relative values (all 32-bit legacy only for now) */
|
||||
#define VM_MIN_ADDRESS ((vm_offset_t) 0)
|
||||
#define VM_USRSTACK32 ((vm_offset_t) 0xC0000000) /* ASLR slides stack down by up to 1 MB */
|
||||
#define VM_MAX_ADDRESS ((vm_offset_t) 0xFFE00000)
|
||||
|
||||
|
||||
|
||||
#endif /* _MACH_I386_VM_PARAM_H_ */
|
||||
141
lib/libc/include/x86_64-macos-gnu/mach/i386/vm_types.h
Normal file
141
lib/libc/include/x86_64-macos-gnu/mach/i386/vm_types.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2016 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: vm_types.h
|
||||
* Author: Avadis Tevanian, Jr.
|
||||
* Date: 1985
|
||||
*
|
||||
* Header file for VM data types. I386 version.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_I386_VM_TYPES_H_
|
||||
#define _MACH_I386_VM_TYPES_H_
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
|
||||
#include <i386/_types.h>
|
||||
#include <stdint.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 support x86 ABIs that do not follow either of
|
||||
* these 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;
|
||||
#else /* __LP64__ */
|
||||
typedef natural_t vm_offset_t;
|
||||
#endif /* __LP64__ */
|
||||
|
||||
/*
|
||||
* A vm_size_t is the proper type for e.g.
|
||||
* expressing the difference between two
|
||||
* vm_offset_t entities.
|
||||
*/
|
||||
#ifdef __LP64__
|
||||
typedef uintptr_t vm_size_t;
|
||||
#else /* __LP64__ */
|
||||
typedef natural_t vm_size_t;
|
||||
#endif /* __LP64__ */
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
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;
|
||||
|
||||
typedef mach_vm_address_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_I386_VM_TYPES_H_ */
|
||||
334
lib/libc/include/x86_64-macos-gnu/mach/kern_return.h
Normal file
334
lib/libc/include/x86_64-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_ */
|
||||
180
lib/libc/include/x86_64-macos-gnu/mach/kmod.h
Normal file
180
lib/libc/include/x86_64-macos-gnu/mach/kmod.h
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_KMOD_H_
|
||||
#define _MACH_KMOD_H_
|
||||
|
||||
#include <mach/kern_return.h>
|
||||
#include <mach/mach_types.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if PRAGMA_MARK
|
||||
#pragma mark Basic macros & typedefs
|
||||
#endif
|
||||
/***********************************************************************
|
||||
* Basic macros & typedefs
|
||||
***********************************************************************/
|
||||
#define KMOD_MAX_NAME 64
|
||||
|
||||
#define KMOD_RETURN_SUCCESS KERN_SUCCESS
|
||||
#define KMOD_RETURN_FAILURE KERN_FAILURE
|
||||
|
||||
typedef int kmod_t;
|
||||
|
||||
struct kmod_info;
|
||||
typedef kern_return_t kmod_start_func_t(struct kmod_info * ki, void * data);
|
||||
typedef kern_return_t kmod_stop_func_t(struct kmod_info * ki, void * data);
|
||||
|
||||
#if PRAGMA_MARK
|
||||
#pragma mark Structure definitions
|
||||
#endif
|
||||
/***********************************************************************
|
||||
* Structure definitions
|
||||
*
|
||||
* All structures must be #pragma pack(4).
|
||||
***********************************************************************/
|
||||
#pragma pack(push, 4)
|
||||
|
||||
/* Run-time struct only; never saved to a file */
|
||||
typedef struct kmod_reference {
|
||||
struct kmod_reference * next;
|
||||
struct kmod_info * info;
|
||||
} kmod_reference_t;
|
||||
|
||||
/***********************************************************************
|
||||
* Warning: Any changes to the kmod_info structure affect the
|
||||
* KMOD_..._DECL macros below.
|
||||
***********************************************************************/
|
||||
|
||||
/* The kmod_info_t structure is only safe to use inside the running
|
||||
* kernel. If you need to work with a kmod_info_t structure outside
|
||||
* the kernel, please use the compatibility definitions below.
|
||||
*/
|
||||
typedef struct kmod_info {
|
||||
struct kmod_info * next;
|
||||
int32_t info_version; // version of this structure
|
||||
uint32_t id;
|
||||
char name[KMOD_MAX_NAME];
|
||||
char version[KMOD_MAX_NAME];
|
||||
int32_t reference_count; // # linkage refs to this
|
||||
kmod_reference_t * reference_list; // who this refs (links on)
|
||||
vm_address_t address; // starting address
|
||||
vm_size_t size; // total size
|
||||
vm_size_t hdr_size; // unwired hdr size
|
||||
kmod_start_func_t * start;
|
||||
kmod_stop_func_t * stop;
|
||||
} kmod_info_t;
|
||||
|
||||
/* A compatibility definition of kmod_info_t for 32-bit kexts.
|
||||
*/
|
||||
typedef struct kmod_info_32_v1 {
|
||||
uint32_t next_addr;
|
||||
int32_t info_version;
|
||||
uint32_t id;
|
||||
uint8_t name[KMOD_MAX_NAME];
|
||||
uint8_t version[KMOD_MAX_NAME];
|
||||
int32_t reference_count;
|
||||
uint32_t reference_list_addr;
|
||||
uint32_t address;
|
||||
uint32_t size;
|
||||
uint32_t hdr_size;
|
||||
uint32_t start_addr;
|
||||
uint32_t stop_addr;
|
||||
} kmod_info_32_v1_t;
|
||||
|
||||
/* A compatibility definition of kmod_info_t for 64-bit kexts.
|
||||
*/
|
||||
typedef struct kmod_info_64_v1 {
|
||||
uint64_t next_addr;
|
||||
int32_t info_version;
|
||||
uint32_t id;
|
||||
uint8_t name[KMOD_MAX_NAME];
|
||||
uint8_t version[KMOD_MAX_NAME];
|
||||
int32_t reference_count;
|
||||
uint64_t reference_list_addr;
|
||||
uint64_t address;
|
||||
uint64_t size;
|
||||
uint64_t hdr_size;
|
||||
uint64_t start_addr;
|
||||
uint64_t stop_addr;
|
||||
} kmod_info_64_v1_t;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#if PRAGMA_MARK
|
||||
#pragma mark Kmod structure declaration macros
|
||||
#endif
|
||||
/***********************************************************************
|
||||
* Kmod structure declaration macros
|
||||
***********************************************************************/
|
||||
#define KMOD_INFO_NAME kmod_info
|
||||
#define KMOD_INFO_VERSION 1
|
||||
|
||||
#define KMOD_DECL(name, version) \
|
||||
static kmod_start_func_t name ## _module_start; \
|
||||
static kmod_stop_func_t name ## _module_stop; \
|
||||
kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1U, \
|
||||
{ #name }, { version }, -1, 0, 0, 0, 0, \
|
||||
name ## _module_start, \
|
||||
name ## _module_stop };
|
||||
|
||||
#define KMOD_EXPLICIT_DECL(name, version, start, stop) \
|
||||
kmod_info_t KMOD_INFO_NAME = { 0, KMOD_INFO_VERSION, -1U, \
|
||||
{ #name }, { version }, -1, 0, 0, 0, 0, \
|
||||
start, stop };
|
||||
|
||||
#if PRAGMA_MARK
|
||||
#pragma mark Kernel private declarations
|
||||
#endif
|
||||
/***********************************************************************
|
||||
* Kernel private declarations.
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
#if PRAGMA_MARK
|
||||
#pragma mark Obsolete kmod stuff
|
||||
#endif
|
||||
/***********************************************************************
|
||||
* These 3 should be dropped but they're referenced by MIG declarations.
|
||||
***********************************************************************/
|
||||
typedef void * kmod_args_t;
|
||||
typedef int kmod_control_flavor_t;
|
||||
typedef kmod_info_t * kmod_info_array_t;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACH_KMOD_H_ */
|
||||
350
lib/libc/include/x86_64-macos-gnu/mach/lock_set.h
Normal file
350
lib/libc/include/x86_64-macos-gnu/mach/lock_set.h
Normal file
@@ -0,0 +1,350 @@
|
||||
#ifndef _lock_set_user_
|
||||
#define _lock_set_user_
|
||||
|
||||
/* Module lock_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 lock_set_MSG_COUNT
|
||||
#define lock_set_MSG_COUNT 6
|
||||
#endif /* lock_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 lock_acquire */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t lock_acquire
|
||||
(
|
||||
lock_set_t lock_set,
|
||||
int lock_id
|
||||
);
|
||||
|
||||
/* Routine lock_release */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t lock_release
|
||||
(
|
||||
lock_set_t lock_set,
|
||||
int lock_id
|
||||
);
|
||||
|
||||
/* Routine lock_try */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t lock_try
|
||||
(
|
||||
lock_set_t lock_set,
|
||||
int lock_id
|
||||
);
|
||||
|
||||
/* Routine lock_make_stable */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t lock_make_stable
|
||||
(
|
||||
lock_set_t lock_set,
|
||||
int lock_id
|
||||
);
|
||||
|
||||
/* Routine lock_handoff */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t lock_handoff
|
||||
(
|
||||
lock_set_t lock_set,
|
||||
int lock_id
|
||||
);
|
||||
|
||||
/* Routine lock_handoff_accept */
|
||||
#ifdef mig_external
|
||||
mig_external
|
||||
#else
|
||||
extern
|
||||
#endif /* mig_external */
|
||||
kern_return_t lock_handoff_accept
|
||||
(
|
||||
lock_set_t lock_set,
|
||||
int lock_id
|
||||
);
|
||||
|
||||
__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__lock_set_subsystem__defined
|
||||
#define __Request__lock_set_subsystem__defined
|
||||
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(push, 4)
|
||||
#endif
|
||||
typedef struct {
|
||||
mach_msg_header_t Head;
|
||||
NDR_record_t NDR;
|
||||
int lock_id;
|
||||
} __Request__lock_acquire_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 lock_id;
|
||||
} __Request__lock_release_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 lock_id;
|
||||
} __Request__lock_try_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 lock_id;
|
||||
} __Request__lock_make_stable_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 lock_id;
|
||||
} __Request__lock_handoff_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 lock_id;
|
||||
} __Request__lock_handoff_accept_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Request__lock_set_subsystem__defined */
|
||||
|
||||
/* union of all requests */
|
||||
|
||||
#ifndef __RequestUnion__lock_set_subsystem__defined
|
||||
#define __RequestUnion__lock_set_subsystem__defined
|
||||
union __RequestUnion__lock_set_subsystem {
|
||||
__Request__lock_acquire_t Request_lock_acquire;
|
||||
__Request__lock_release_t Request_lock_release;
|
||||
__Request__lock_try_t Request_lock_try;
|
||||
__Request__lock_make_stable_t Request_lock_make_stable;
|
||||
__Request__lock_handoff_t Request_lock_handoff;
|
||||
__Request__lock_handoff_accept_t Request_lock_handoff_accept;
|
||||
};
|
||||
#endif /* !__RequestUnion__lock_set_subsystem__defined */
|
||||
/* typedefs for all replies */
|
||||
|
||||
#ifndef __Reply__lock_set_subsystem__defined
|
||||
#define __Reply__lock_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;
|
||||
} __Reply__lock_acquire_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__lock_release_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__lock_try_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__lock_make_stable_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__lock_handoff_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__lock_handoff_accept_t __attribute__((unused));
|
||||
#ifdef __MigPackStructs
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
#endif /* !__Reply__lock_set_subsystem__defined */
|
||||
|
||||
/* union of all replies */
|
||||
|
||||
#ifndef __ReplyUnion__lock_set_subsystem__defined
|
||||
#define __ReplyUnion__lock_set_subsystem__defined
|
||||
union __ReplyUnion__lock_set_subsystem {
|
||||
__Reply__lock_acquire_t Reply_lock_acquire;
|
||||
__Reply__lock_release_t Reply_lock_release;
|
||||
__Reply__lock_try_t Reply_lock_try;
|
||||
__Reply__lock_make_stable_t Reply_lock_make_stable;
|
||||
__Reply__lock_handoff_t Reply_lock_handoff;
|
||||
__Reply__lock_handoff_accept_t Reply_lock_handoff_accept;
|
||||
};
|
||||
#endif /* !__RequestUnion__lock_set_subsystem__defined */
|
||||
|
||||
#ifndef subsystem_to_name_map_lock_set
|
||||
#define subsystem_to_name_map_lock_set \
|
||||
{ "lock_acquire", 617000 },\
|
||||
{ "lock_release", 617001 },\
|
||||
{ "lock_try", 617002 },\
|
||||
{ "lock_make_stable", 617003 },\
|
||||
{ "lock_handoff", 617004 },\
|
||||
{ "lock_handoff_accept", 617005 }
|
||||
#endif
|
||||
|
||||
#ifdef __AfterMigUserHeader
|
||||
__AfterMigUserHeader
|
||||
#endif /* __AfterMigUserHeader */
|
||||
|
||||
#endif /* _lock_set_user_ */
|
||||
245
lib/libc/include/x86_64-macos-gnu/mach/mach.h
Normal file
245
lib/libc/include/x86_64-macos-gnu/mach/mach.h
Normal file
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2014 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 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Includes all the types that a normal user
|
||||
* of Mach programs should need
|
||||
*/
|
||||
|
||||
#ifndef _MACH_H_
|
||||
#define _MACH_H_
|
||||
|
||||
#define __MACH30__
|
||||
#define MACH_IPC_FLAVOR UNTYPED
|
||||
|
||||
#include <mach/std_types.h>
|
||||
#include <mach/mach_types.h>
|
||||
#include <mach/mach_interface.h>
|
||||
#include <mach/mach_port.h>
|
||||
#include <mach/mach_init.h>
|
||||
#include <mach/mach_host.h>
|
||||
#include <mach/thread_switch.h>
|
||||
|
||||
#include <mach/rpc.h> /* for compatibility only */
|
||||
#include <mach/mig.h>
|
||||
|
||||
#include <mach/mig_errors.h>
|
||||
#include <mach/mach_error.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
/*
|
||||
* Standard prototypes
|
||||
*/
|
||||
extern void panic_init(mach_port_t);
|
||||
extern void panic(const char *, ...);
|
||||
|
||||
extern void safe_gets(char *,
|
||||
char *,
|
||||
int);
|
||||
|
||||
extern void slot_name(cpu_type_t,
|
||||
cpu_subtype_t,
|
||||
char **,
|
||||
char **);
|
||||
|
||||
extern void mig_reply_setup(mach_msg_header_t *,
|
||||
mach_msg_header_t *);
|
||||
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern void mach_msg_destroy(mach_msg_header_t *);
|
||||
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern mach_msg_return_t mach_msg_receive(mach_msg_header_t *);
|
||||
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern mach_msg_return_t mach_msg_send(mach_msg_header_t *);
|
||||
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern mach_msg_return_t mach_msg_server_once(boolean_t (*)
|
||||
(mach_msg_header_t *,
|
||||
mach_msg_header_t *),
|
||||
mach_msg_size_t,
|
||||
mach_port_t,
|
||||
mach_msg_options_t);
|
||||
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern mach_msg_return_t mach_msg_server(boolean_t (*)
|
||||
(mach_msg_header_t *,
|
||||
mach_msg_header_t *),
|
||||
mach_msg_size_t,
|
||||
mach_port_t,
|
||||
mach_msg_options_t);
|
||||
|
||||
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
|
||||
extern mach_msg_return_t mach_msg_server_importance(boolean_t (*)
|
||||
(mach_msg_header_t *,
|
||||
mach_msg_header_t *),
|
||||
mach_msg_size_t,
|
||||
mach_port_t,
|
||||
mach_msg_options_t);
|
||||
|
||||
/*
|
||||
* Prototypes for compatibility
|
||||
*/
|
||||
extern kern_return_t clock_get_res(mach_port_t,
|
||||
clock_res_t *);
|
||||
extern kern_return_t clock_set_res(mach_port_t,
|
||||
clock_res_t);
|
||||
|
||||
extern kern_return_t clock_sleep(mach_port_t,
|
||||
int,
|
||||
mach_timespec_t,
|
||||
mach_timespec_t *);
|
||||
|
||||
/*!
|
||||
* @group voucher_mach_msg Prototypes
|
||||
*/
|
||||
|
||||
#define VOUCHER_MACH_MSG_API_VERSION 20140205
|
||||
|
||||
/*!
|
||||
* @typedef voucher_mach_msg_state_t
|
||||
*
|
||||
* @abstract
|
||||
* Opaque object encapsulating state changed by voucher_mach_msg_adopt().
|
||||
*/
|
||||
typedef struct voucher_mach_msg_state_s *voucher_mach_msg_state_t;
|
||||
|
||||
/*!
|
||||
* @const VOUCHER_MACH_MSG_STATE_UNCHANGED
|
||||
*
|
||||
* @discussion
|
||||
* Constant indicating no state change occurred.
|
||||
*/
|
||||
#define VOUCHER_MACH_MSG_STATE_UNCHANGED ((voucher_mach_msg_state_t)~0ul)
|
||||
|
||||
/*!
|
||||
* @function voucher_mach_msg_set
|
||||
*
|
||||
* @abstract
|
||||
* Change specified message header to contain current mach voucher with a
|
||||
* COPY_SEND disposition.
|
||||
* Does not change message if it already has non-zero MACH_MSGH_BITS_VOUCHER.
|
||||
*
|
||||
* @discussion
|
||||
* Borrows reference to current thread voucher so message should be sent
|
||||
* immediately (without intervening calls that might change that voucher).
|
||||
*
|
||||
* @param msg
|
||||
* The message to modify.
|
||||
*
|
||||
* @result
|
||||
* True if header was changed.
|
||||
*/
|
||||
extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg);
|
||||
|
||||
/*!
|
||||
* @function voucher_mach_msg_clear
|
||||
*
|
||||
* @abstract
|
||||
* Removes changes made to specified message header by voucher_mach_msg_set()
|
||||
* and any mach_msg() send operations (successful or not).
|
||||
* If the message is not needed further, mach_msg_destroy() should be called
|
||||
* instead.
|
||||
*
|
||||
* @discussion
|
||||
* Not intended to be called if voucher_mach_msg_set() returned false.
|
||||
* Releases reference to message mach voucher if an extra reference was
|
||||
* acquired due to an unsuccessful send operation (pseudo-receive).
|
||||
*
|
||||
* @param msg
|
||||
* The message to modify.
|
||||
*/
|
||||
extern void voucher_mach_msg_clear(mach_msg_header_t *msg);
|
||||
|
||||
/*!
|
||||
* @function voucher_mach_msg_adopt
|
||||
*
|
||||
* @abstract
|
||||
* Adopt the voucher contained in the specified message on the current thread
|
||||
* and return the previous thread voucher state.
|
||||
*
|
||||
* @discussion
|
||||
* Ownership of the mach voucher in the message is transferred to the current
|
||||
* thread and the message header voucher fields are cleared.
|
||||
*
|
||||
* @param msg
|
||||
* The message to query and modify.
|
||||
*
|
||||
* @result
|
||||
* The previous thread voucher state or VOUCHER_MACH_MSG_STATE_UNCHANGED if no
|
||||
* state change occurred.
|
||||
*/
|
||||
extern voucher_mach_msg_state_t voucher_mach_msg_adopt(mach_msg_header_t *msg);
|
||||
|
||||
/*!
|
||||
* @function voucher_mach_msg_revert
|
||||
*
|
||||
* @abstract
|
||||
* Restore thread voucher state previously modified by voucher_mach_msg_adopt().
|
||||
*
|
||||
* @discussion
|
||||
* Current thread voucher reference is released.
|
||||
* No change to thread voucher state if passed VOUCHER_MACH_MSG_STATE_UNCHANGED.
|
||||
*
|
||||
* @param state
|
||||
* The thread voucher state to restore.
|
||||
*/
|
||||
|
||||
extern void voucher_mach_msg_revert(voucher_mach_msg_state_t state);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACH_H_ */
|
||||
93
lib/libc/include/x86_64-macos-gnu/mach/mach_error.h
Normal file
93
lib/libc/include/x86_64-macos-gnu/mach/mach_error.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 1999 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 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
|
||||
* 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 the
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
/*
|
||||
* File: mach_error.h
|
||||
* Author: Douglas Orr, Carnegie Mellon University
|
||||
* Date: Mar. 1988
|
||||
*
|
||||
* Definitions of routines in mach_error.c
|
||||
*/
|
||||
|
||||
#ifndef _MACH_ERROR_
|
||||
#define _MACH_ERROR_ 1
|
||||
|
||||
#include <mach/error.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
char *mach_error_string(
|
||||
/*
|
||||
* Returns a string appropriate to the error argument given
|
||||
*/
|
||||
mach_error_t error_value
|
||||
);
|
||||
|
||||
void mach_error(
|
||||
/*
|
||||
* Prints an appropriate message on the standard error stream
|
||||
*/
|
||||
const char *str,
|
||||
mach_error_t error_value
|
||||
);
|
||||
|
||||
char *mach_error_type(
|
||||
/*
|
||||
* Returns a string with the error system, subsystem and code
|
||||
*/
|
||||
mach_error_t error_value
|
||||
);
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACH_ERROR_ */
|
||||
1295
lib/libc/include/x86_64-macos-gnu/mach/mach_host.h
Normal file
1295
lib/libc/include/x86_64-macos-gnu/mach/mach_host.h
Normal file
File diff suppressed because it is too large
Load Diff
110
lib/libc/include/x86_64-macos-gnu/mach/mach_init.h
Normal file
110
lib/libc/include/x86_64-macos-gnu/mach/mach_init.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 1999 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,1986 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Items provided by the Mach environment initialization.
|
||||
*/
|
||||
|
||||
#ifndef _MACH_INIT_
|
||||
#define _MACH_INIT_ 1
|
||||
|
||||
#include <mach/mach_types.h>
|
||||
#include <mach/vm_page_size.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/*
|
||||
* Kernel-related ports; how a task/thread controls itself
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern mach_port_t mach_host_self(void);
|
||||
extern mach_port_t mach_thread_self(void);
|
||||
extern kern_return_t host_page_size(host_t, vm_size_t *);
|
||||
|
||||
extern mach_port_t mach_task_self_;
|
||||
#define mach_task_self() mach_task_self_
|
||||
#define current_task() mach_task_self()
|
||||
|
||||
__END_DECLS
|
||||
#include <mach/mach_traps.h>
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* Other important ports in the Mach user environment
|
||||
*/
|
||||
|
||||
extern mach_port_t bootstrap_port;
|
||||
|
||||
/*
|
||||
* Where these ports occur in the "mach_ports_register"
|
||||
* collection... only servers or the runtime library need know.
|
||||
*/
|
||||
|
||||
#define NAME_SERVER_SLOT 0
|
||||
#define ENVIRONMENT_SLOT 1
|
||||
#define SERVICE_SLOT 2
|
||||
|
||||
#define MACH_PORTS_SLOTS_USED 3
|
||||
|
||||
/*
|
||||
* fprintf_stderr uses vprintf_stderr_func to produce
|
||||
* error messages, this can be overridden by a user
|
||||
* application to point to a user-specified output function
|
||||
*/
|
||||
extern int (*vprintf_stderr_func)(const char *format, va_list ap);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _MACH_INIT_ */
|
||||
53
lib/libc/include/x86_64-macos-gnu/mach/mach_interface.h
Normal file
53
lib/libc/include/x86_64-macos-gnu/mach/mach_interface.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) Apple Computer 1998
|
||||
* ALL Rights Reserved
|
||||
*/
|
||||
/*
|
||||
* This file represents the interfaces that used to come
|
||||
* from creating the user headers from the mach.defs file.
|
||||
* Because mach.defs was decomposed, this file now just
|
||||
* wraps up all the new interface headers generated from
|
||||
* each of the new .defs resulting from that decomposition.
|
||||
*/
|
||||
#ifndef _MACH_INTERFACE_H_
|
||||
#define _MACH_INTERFACE_H_
|
||||
|
||||
#include <mach/clock_priv.h>
|
||||
#include <mach/host_priv.h>
|
||||
#include <mach/host_security.h>
|
||||
#include <mach/lock_set.h>
|
||||
#include <mach/processor.h>
|
||||
#include <mach/processor_set.h>
|
||||
#include <mach/semaphore.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/thread_act.h>
|
||||
#include <mach/vm_map.h>
|
||||
|
||||
#endif /* _MACH_INTERFACE_H_ */
|
||||
1808
lib/libc/include/x86_64-macos-gnu/mach/mach_port.h
Normal file
1808
lib/libc/include/x86_64-macos-gnu/mach/mach_port.h
Normal file
File diff suppressed because it is too large
Load Diff
297
lib/libc/include/x86_64-macos-gnu/mach/mach_traps.h
Normal file
297
lib/libc/include/x86_64-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/x86_64-macos-gnu/mach/mach_types.h
Normal file
283
lib/libc/include/x86_64-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_ */
|
||||
245
lib/libc/include/x86_64-macos-gnu/mach/mach_voucher_types.h
Normal file
245
lib/libc/include/x86_64-macos-gnu/mach/mach_voucher_types.h
Normal file
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Copyright (c) 2013 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_VOUCHER_TYPES_H_
|
||||
#define _MACH_VOUCHER_TYPES_H_
|
||||
|
||||
#include <mach/std_types.h>
|
||||
#include <mach/port.h>
|
||||
|
||||
/*
|
||||
* Mach Voucher - an immutable collection of attribute value handles.
|
||||
*
|
||||
* The mach voucher is such that it can be passed between processes
|
||||
* as a Mach port send right (by convention in the mach_msg_header_t’s
|
||||
* msgh_voucher field).
|
||||
*
|
||||
* You may construct a new mach voucher by passing a construction
|
||||
* recipe to host_create_mach_voucher(). The construction recipe supports
|
||||
* generic commands for copying, removing, and redeeming attribute value
|
||||
* handles from previous vouchers, or running attribute-mananger-specific
|
||||
* commands within the recipe.
|
||||
*
|
||||
* Once the set of attribute value handles is constructed and returned,
|
||||
* that set will not change for the life of the voucher (just because the
|
||||
* attribute value handle itself doesn't change, the value the handle refers
|
||||
* to is free to change at will).
|
||||
*/
|
||||
typedef mach_port_t mach_voucher_t;
|
||||
#define MACH_VOUCHER_NULL ((mach_voucher_t) 0)
|
||||
|
||||
typedef mach_port_name_t mach_voucher_name_t;
|
||||
#define MACH_VOUCHER_NAME_NULL ((mach_voucher_name_t) 0)
|
||||
|
||||
typedef mach_voucher_name_t *mach_voucher_name_array_t;
|
||||
#define MACH_VOUCHER_NAME_ARRAY_NULL ((mach_voucher_name_array_t) 0)
|
||||
|
||||
/*
|
||||
* This type changes appearance between user-space and kernel. It is
|
||||
* a port at user-space and a reference to an ipc_voucher structure in-kernel.
|
||||
*/
|
||||
typedef mach_voucher_t ipc_voucher_t;
|
||||
#define IPC_VOUCHER_NULL ((ipc_voucher_t) 0)
|
||||
|
||||
/*
|
||||
* mach_voucher_selector_t - A means of specifying which thread/task value to extract -
|
||||
* the current voucher set at this level, or a voucher representing
|
||||
* the full [layered] effective value for the task/thread.
|
||||
*/
|
||||
typedef uint32_t mach_voucher_selector_t;
|
||||
#define MACH_VOUCHER_SELECTOR_CURRENT ((mach_voucher_selector_t)0)
|
||||
#define MACH_VOUCHER_SELECTOR_EFFECTIVE ((mach_voucher_selector_t)1)
|
||||
|
||||
|
||||
/*
|
||||
* mach_voucher_attr_key_t - The key used to identify a particular managed resource or
|
||||
* to select the specific resource manager’s data associated
|
||||
* with a given voucher.
|
||||
*/
|
||||
typedef uint32_t mach_voucher_attr_key_t;
|
||||
typedef mach_voucher_attr_key_t *mach_voucher_attr_key_array_t;
|
||||
|
||||
#define MACH_VOUCHER_ATTR_KEY_ALL ((mach_voucher_attr_key_t)~0)
|
||||
#define MACH_VOUCHER_ATTR_KEY_NONE ((mach_voucher_attr_key_t)0)
|
||||
|
||||
/* other well-known-keys will be added here */
|
||||
#define MACH_VOUCHER_ATTR_KEY_ATM ((mach_voucher_attr_key_t)1)
|
||||
#define MACH_VOUCHER_ATTR_KEY_IMPORTANCE ((mach_voucher_attr_key_t)2)
|
||||
#define MACH_VOUCHER_ATTR_KEY_BANK ((mach_voucher_attr_key_t)3)
|
||||
#define MACH_VOUCHER_ATTR_KEY_PTHPRIORITY ((mach_voucher_attr_key_t)4)
|
||||
|
||||
#define MACH_VOUCHER_ATTR_KEY_USER_DATA ((mach_voucher_attr_key_t)7)
|
||||
#define MACH_VOUCHER_ATTR_KEY_BITS MACH_VOUCHER_ATTR_KEY_USER_DATA /* deprecated */
|
||||
#define MACH_VOUCHER_ATTR_KEY_TEST ((mach_voucher_attr_key_t)8)
|
||||
|
||||
#define MACH_VOUCHER_ATTR_KEY_NUM_WELL_KNOWN MACH_VOUCHER_ATTR_KEY_TEST
|
||||
|
||||
/*
|
||||
* mach_voucher_attr_content_t
|
||||
*
|
||||
* Data passed to a resource manager for modifying an attribute
|
||||
* value or returned from the resource manager in response to a
|
||||
* request to externalize the current value for that attribute.
|
||||
*/
|
||||
typedef uint8_t *mach_voucher_attr_content_t;
|
||||
typedef uint32_t mach_voucher_attr_content_size_t;
|
||||
|
||||
/*
|
||||
* mach_voucher_attr_command_t - The private verbs implemented by each voucher
|
||||
* attribute manager via mach_voucher_attr_command().
|
||||
*/
|
||||
typedef uint32_t mach_voucher_attr_command_t;
|
||||
|
||||
/*
|
||||
* mach_voucher_attr_recipe_command_t
|
||||
*
|
||||
* The verbs used to create/morph a voucher attribute value.
|
||||
* We define some system-wide commands here - related to creation, and transport of
|
||||
* vouchers and attributes. Additional commands can be defined by, and supported by,
|
||||
* individual attribute resource managers.
|
||||
*/
|
||||
typedef uint32_t mach_voucher_attr_recipe_command_t;
|
||||
typedef mach_voucher_attr_recipe_command_t *mach_voucher_attr_recipe_command_array_t;
|
||||
|
||||
#define MACH_VOUCHER_ATTR_NOOP ((mach_voucher_attr_recipe_command_t)0)
|
||||
#define MACH_VOUCHER_ATTR_COPY ((mach_voucher_attr_recipe_command_t)1)
|
||||
#define MACH_VOUCHER_ATTR_REMOVE ((mach_voucher_attr_recipe_command_t)2)
|
||||
#define MACH_VOUCHER_ATTR_SET_VALUE_HANDLE ((mach_voucher_attr_recipe_command_t)3)
|
||||
#define MACH_VOUCHER_ATTR_AUTO_REDEEM ((mach_voucher_attr_recipe_command_t)4)
|
||||
#define MACH_VOUCHER_ATTR_SEND_PREPROCESS ((mach_voucher_attr_recipe_command_t)5)
|
||||
|
||||
/* redeem is on its way out? */
|
||||
#define MACH_VOUCHER_ATTR_REDEEM ((mach_voucher_attr_recipe_command_t)10)
|
||||
|
||||
/* recipe command(s) for importance attribute manager */
|
||||
#define MACH_VOUCHER_ATTR_IMPORTANCE_SELF ((mach_voucher_attr_recipe_command_t)200)
|
||||
|
||||
/* recipe command(s) for bit-store attribute manager */
|
||||
#define MACH_VOUCHER_ATTR_USER_DATA_STORE ((mach_voucher_attr_recipe_command_t)211)
|
||||
#define MACH_VOUCHER_ATTR_BITS_STORE MACH_VOUCHER_ATTR_USER_DATA_STORE /* deprecated */
|
||||
|
||||
/* recipe command(s) for test attribute manager */
|
||||
#define MACH_VOUCHER_ATTR_TEST_STORE MACH_VOUCHER_ATTR_USER_DATA_STORE
|
||||
|
||||
/*
|
||||
* mach_voucher_attr_recipe_t
|
||||
*
|
||||
* An element in a recipe list to create a voucher.
|
||||
*/
|
||||
#pragma pack(push, 1)
|
||||
|
||||
typedef struct mach_voucher_attr_recipe_data {
|
||||
mach_voucher_attr_key_t key;
|
||||
mach_voucher_attr_recipe_command_t command;
|
||||
mach_voucher_name_t previous_voucher;
|
||||
mach_voucher_attr_content_size_t content_size;
|
||||
uint8_t content[];
|
||||
} mach_voucher_attr_recipe_data_t;
|
||||
typedef mach_voucher_attr_recipe_data_t *mach_voucher_attr_recipe_t;
|
||||
typedef mach_msg_type_number_t mach_voucher_attr_recipe_size_t;
|
||||
|
||||
/* Make the above palatable to MIG */
|
||||
typedef uint8_t *mach_voucher_attr_raw_recipe_t;
|
||||
typedef mach_voucher_attr_raw_recipe_t mach_voucher_attr_raw_recipe_array_t;
|
||||
typedef mach_msg_type_number_t mach_voucher_attr_raw_recipe_size_t;
|
||||
typedef mach_msg_type_number_t mach_voucher_attr_raw_recipe_array_size_t;
|
||||
|
||||
#define MACH_VOUCHER_ATTR_MAX_RAW_RECIPE_ARRAY_SIZE 5120
|
||||
#define MACH_VOUCHER_TRAP_STACK_LIMIT 256
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/*
|
||||
* VOUCHER ATTRIBUTE MANAGER Writer types
|
||||
*/
|
||||
|
||||
/*
|
||||
* mach_voucher_attr_manager_t
|
||||
*
|
||||
* A handle through which the mach voucher mechanism communicates with the voucher
|
||||
* attribute manager for a given attribute key.
|
||||
*/
|
||||
typedef mach_port_t mach_voucher_attr_manager_t;
|
||||
#define MACH_VOUCHER_ATTR_MANAGER_NULL ((mach_voucher_attr_manager_t) 0)
|
||||
|
||||
/*
|
||||
* mach_voucher_attr_control_t
|
||||
*
|
||||
* A handle provided to the voucher attribute manager for a given attribute key
|
||||
* through which it makes inquiries or control operations of the mach voucher mechanism.
|
||||
*/
|
||||
typedef mach_port_t mach_voucher_attr_control_t;
|
||||
#define MACH_VOUCHER_ATTR_CONTROL_NULL ((mach_voucher_attr_control_t) 0)
|
||||
|
||||
/*
|
||||
* These types are different in-kernel vs user-space. They are ports in user-space,
|
||||
* pointers to opaque structs in most of the kernel, and pointers to known struct
|
||||
* types in the Mach portion of the kernel.
|
||||
*/
|
||||
typedef mach_port_t ipc_voucher_attr_manager_t;
|
||||
typedef mach_port_t ipc_voucher_attr_control_t;
|
||||
#define IPC_VOUCHER_ATTR_MANAGER_NULL ((ipc_voucher_attr_manager_t) 0)
|
||||
#define IPC_VOUCHER_ATTR_CONTROL_NULL ((ipc_voucher_attr_control_t) 0)
|
||||
|
||||
/*
|
||||
* mach_voucher_attr_value_handle_t
|
||||
*
|
||||
* The private handle that the voucher attribute manager provides to
|
||||
* the mach voucher mechanism to represent a given attr content/value.
|
||||
*/
|
||||
typedef uint64_t mach_voucher_attr_value_handle_t;
|
||||
typedef mach_voucher_attr_value_handle_t *mach_voucher_attr_value_handle_array_t;
|
||||
|
||||
typedef mach_msg_type_number_t mach_voucher_attr_value_handle_array_size_t;
|
||||
#define MACH_VOUCHER_ATTR_VALUE_MAX_NESTED ((mach_voucher_attr_value_handle_array_size_t)4)
|
||||
|
||||
typedef uint32_t mach_voucher_attr_value_reference_t;
|
||||
typedef uint32_t mach_voucher_attr_value_flags_t;
|
||||
#define MACH_VOUCHER_ATTR_VALUE_FLAGS_NONE ((mach_voucher_attr_value_flags_t)0)
|
||||
#define MACH_VOUCHER_ATTR_VALUE_FLAGS_PERSIST ((mach_voucher_attr_value_flags_t)1)
|
||||
|
||||
/* USE - TBD */
|
||||
typedef uint32_t mach_voucher_attr_control_flags_t;
|
||||
#define MACH_VOUCHER_ATTR_CONTROL_FLAGS_NONE ((mach_voucher_attr_control_flags_t)0)
|
||||
|
||||
/*
|
||||
* Commands and types for the IPC Importance Attribute Manager
|
||||
*
|
||||
* These are the valid mach_voucher_attr_command() options with the
|
||||
* MACH_VOUCHER_ATTR_KEY_IMPORTANCE key.
|
||||
*/
|
||||
#define MACH_VOUCHER_IMPORTANCE_ATTR_ADD_EXTERNAL 1 /* Add some number of external refs (not supported) */
|
||||
#define MACH_VOUCHER_IMPORTANCE_ATTR_DROP_EXTERNAL 2 /* Drop some number of external refs */
|
||||
typedef uint32_t mach_voucher_attr_importance_refs;
|
||||
|
||||
/*
|
||||
* Activity id Generation defines
|
||||
*/
|
||||
#define MACH_ACTIVITY_ID_COUNT_MAX 16
|
||||
|
||||
#endif /* _MACH_VOUCHER_TYPES_H_ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user