darwin: update macOS libc headers

Add aarch64-macos.13 and x86_64-macos.13 libc headers, and remove
x86_64-macos.10 headers.
This commit is contained in:
Jakub Konka
2022-10-25 16:16:22 +02:00
parent cf2ac99f84
commit 304eb54169
252 changed files with 14060 additions and 34202 deletions

View File

@@ -0,0 +1,13 @@
/*
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
*/
#ifndef _ARM__LIMITS_H_
#define _ARM__LIMITS_H_
#if defined (__arm__) || defined (__arm64__)
#define __DARWIN_CLK_TCK 100 /* ticks per second */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM__LIMITS_H_ */

View File

@@ -0,0 +1,95 @@
/*
* Copyright (c) 2003-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef __ARM_MCONTEXT_H_
#define __ARM_MCONTEXT_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
#include <sys/appleapiopts.h>
#include <mach/machine/_structs.h>
#ifndef _STRUCT_MCONTEXT32
#if __DARWIN_UNIX03
#define _STRUCT_MCONTEXT32 struct __darwin_mcontext32
_STRUCT_MCONTEXT32
{
_STRUCT_ARM_EXCEPTION_STATE __es;
_STRUCT_ARM_THREAD_STATE __ss;
_STRUCT_ARM_VFP_STATE __fs;
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_MCONTEXT32 struct mcontext32
_STRUCT_MCONTEXT32
{
_STRUCT_ARM_EXCEPTION_STATE es;
_STRUCT_ARM_THREAD_STATE ss;
_STRUCT_ARM_VFP_STATE fs;
};
#endif /* __DARWIN_UNIX03 */
#endif /* _STRUCT_MCONTEXT32 */
#ifndef _STRUCT_MCONTEXT64
#if __DARWIN_UNIX03
#define _STRUCT_MCONTEXT64 struct __darwin_mcontext64
_STRUCT_MCONTEXT64
{
_STRUCT_ARM_EXCEPTION_STATE64 __es;
_STRUCT_ARM_THREAD_STATE64 __ss;
_STRUCT_ARM_NEON_STATE64 __ns;
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_MCONTEXT64 struct mcontext64
_STRUCT_MCONTEXT64
{
_STRUCT_ARM_EXCEPTION_STATE64 es;
_STRUCT_ARM_THREAD_STATE64 ss;
_STRUCT_ARM_NEON_STATE64 ns;
};
#endif /* __DARWIN_UNIX03 */
#endif /* _STRUCT_MCONTEXT32 */
#ifndef _MCONTEXT_T
#define _MCONTEXT_T
#if defined(__arm64__)
typedef _STRUCT_MCONTEXT64 *mcontext_t;
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT64
#else
typedef _STRUCT_MCONTEXT32 *mcontext_t;
#define _STRUCT_MCONTEXT _STRUCT_MCONTEXT32
#endif
#endif /* _MCONTEXT_T */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* __ARM_MCONTEXT_H_ */

View File

@@ -0,0 +1,25 @@
/*
* Copyright (c) 2006-2007 Apple Inc. All rights reserved.
*/
#ifndef _ARM__PARAM_H_
#define _ARM__PARAM_H_
#if defined (__arm__) || defined (__arm64__)
#include <arm/_types.h>
/*
* Round p (pointer or byte index) up to a correctly-aligned value for all
* data types (int, long, ...). The result is unsigned int and must be
* cast to any desired pointer type.
*/
#define __DARWIN_ALIGNBYTES (sizeof(__darwin_size_t) - 1)
#define __DARWIN_ALIGN(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES) &~ __DARWIN_ALIGNBYTES)
#define __DARWIN_ALIGNBYTES32 (sizeof(__uint32_t) - 1)
#define __DARWIN_ALIGN32(p) ((__darwin_size_t)((__darwin_size_t)(p) + __DARWIN_ALIGNBYTES32) &~ __DARWIN_ALIGNBYTES32)
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM__PARAM_H_ */

View File

@@ -0,0 +1,102 @@
/*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
#ifndef _BSD_ARM__TYPES_H_
#define _BSD_ARM__TYPES_H_
#if defined (__arm__) || defined (__arm64__)
/*
* This header file contains integer types. It's intended to also contain
* flotaing point and other arithmetic types, as needed, later.
*/
#ifdef __GNUC__
typedef __signed char __int8_t;
#else /* !__GNUC__ */
typedef char __int8_t;
#endif /* !__GNUC__ */
typedef unsigned char __uint8_t;
typedef short __int16_t;
typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef long long __int64_t;
typedef unsigned long long __uint64_t;
typedef long __darwin_intptr_t;
typedef unsigned int __darwin_natural_t;
/*
* The rune type below is declared to be an ``int'' instead of the more natural
* ``unsigned long'' or ``long''. Two things are happening here. It is not
* unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
* it looks like 10646 will be a 31 bit standard. This means that if your
* ints cannot hold 32 bits, you will be in trouble. The reason an int was
* chosen over a long is that the is*() and to*() routines take ints (says
* ANSI C), but they use __darwin_ct_rune_t instead of int. By changing it
* here, you lose a bit of ANSI conformance, but your programs will still
* work.
*
* NOTE: rune_t is not covered by ANSI nor other standards, and should not
* be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and
* rune_t must be the same type. Also wint_t must be no narrower than
* wchar_t, and should also be able to hold all members of the largest
* character set plus one extra value (WEOF). wint_t must be at least 16 bits.
*/
typedef int __darwin_ct_rune_t; /* ct_rune_t */
/*
* mbstate_t is an opaque object to keep conversion state, during multibyte
* stream conversions. The content must not be referenced by user programs.
*/
typedef union {
char __mbstate8[128];
long long _mbstateL; /* for alignment */
} __mbstate_t;
typedef __mbstate_t __darwin_mbstate_t; /* mbstate_t */
#if defined(__PTRDIFF_TYPE__)
typedef __PTRDIFF_TYPE__ __darwin_ptrdiff_t; /* ptr1 - ptr2 */
#elif defined(__LP64__)
typedef long __darwin_ptrdiff_t; /* ptr1 - ptr2 */
#else
typedef int __darwin_ptrdiff_t; /* ptr1 - ptr2 */
#endif /* __GNUC__ */
#if defined(__SIZE_TYPE__)
typedef __SIZE_TYPE__ __darwin_size_t; /* sizeof() */
#else
typedef unsigned long __darwin_size_t; /* sizeof() */
#endif
#if (__GNUC__ > 2)
typedef __builtin_va_list __darwin_va_list; /* va_list */
#else
typedef void * __darwin_va_list; /* va_list */
#endif
#if defined(__WCHAR_TYPE__)
typedef __WCHAR_TYPE__ __darwin_wchar_t; /* wchar_t */
#else
typedef __darwin_ct_rune_t __darwin_wchar_t; /* wchar_t */
#endif
typedef __darwin_wchar_t __darwin_rune_t; /* rune_t */
#if defined(__WINT_TYPE__)
typedef __WINT_TYPE__ __darwin_wint_t; /* wint_t */
#else
typedef __darwin_ct_rune_t __darwin_wint_t; /* wint_t */
#endif
typedef unsigned long __darwin_clock_t; /* clock() */
typedef __uint32_t __darwin_socklen_t; /* socklen_t (duh) */
typedef long __darwin_ssize_t; /* byte count or error */
typedef long __darwin_time_t; /* time() */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _BSD_ARM__TYPES_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Apple Inc. All rights reserved.
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -25,18 +25,47 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _ARM_ARCH_H
#define _ARM_ARCH_H
#ifndef __GETHOSTUUID_H
#define __GETHOSTUUID_H
#if defined (__arm__) || defined (__arm64__)
#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);
/* Collect the __ARM_ARCH_*__ compiler flags into something easier to use. */
#if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7S__) || defined (__ARM_ARCH_7F__) || defined (__ARM_ARCH_7K__)
#define _ARM_ARCH_7
#endif
#endif /* __GETHOSTUUID_H */
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__)
#define _ARM_ARCH_6K
#endif
#if defined (_ARM_ARCH_7) || defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__)
#define _ARM_ARCH_6Z
#endif
#if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) || \
defined (_ARM_ARCH_6Z) || defined (_ARM_ARCH_6K)
#define _ARM_ARCH_6
#endif
#if defined (_ARM_ARCH_6) || defined (__ARM_ARCH_5E__) || \
defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5TEJ__)
#define _ARM_ARCH_5E
#endif
#if defined (_ARM_ARCH_5E) || defined (__ARM_ARCH_5__) || \
defined (__ARM_ARCH_5T__)
#define _ARM_ARCH_5
#endif
#if defined (_ARM_ARCH_5) || defined (__ARM_ARCH_4T__)
#define _ARM_ARCH_4T
#endif
#if defined (_ARM_ARCH_4T) || defined (__ARM_ARCH_4__)
#define _ARM_ARCH_4
#endif
#endif /* defined (__arm__) || defined (__arm64__) */
#endif

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
*/
/*
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)endian.h 8.1 (Berkeley) 6/11/93
*/
#ifndef _ARM__ENDIAN_H_
#define _ARM__ENDIAN_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h>
/*
* Define _NOQUAD if the compiler does NOT support 64-bit integers.
*/
/* #define _NOQUAD */
/*
* Define the order of 32-bit words in 64-bit words.
*/
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
#define __DARWIN_LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define __DARWIN_BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define __DARWIN_PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define __DARWIN_BYTE_ORDER __DARWIN_LITTLE_ENDIAN
#if defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
#define BIG_ENDIAN __DARWIN_BIG_ENDIAN
#define PDP_ENDIAN __DARWIN_PDP_ENDIAN
#define BYTE_ORDER __DARWIN_BYTE_ORDER
#include <sys/_endian.h>
#endif /* defined(KERNEL) || (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* !_ARM__ENDIAN_H_ */

View File

@@ -0,0 +1,114 @@
/*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*/
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)limits.h 8.3 (Berkeley) 1/4/94
*/
#ifndef _ARM_LIMITS_H_
#define _ARM_LIMITS_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h>
#include <arm/_limits.h>
#define CHAR_BIT 8 /* number of bits in a char */
#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#define CLK_TCK __DARWIN_CLK_TCK /* ticks per second */
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/*
* According to ANSI (section 2.2.4.2), the values below must be usable by
* #if preprocessing directives. Additionally, the expression must have the
* same type as would an expression that is an object of the corresponding
* type converted according to the integral promotions. The subtraction for
* INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an
* unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).
* These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values
* are written as hex so that GCC will be quiet about large integer constants.
*/
#define SCHAR_MAX 127 /* min value for a signed char */
#define SCHAR_MIN (-128) /* max value for a signed char */
#define UCHAR_MAX 255 /* max value for an unsigned char */
#define CHAR_MAX 127 /* max value for a char */
#define CHAR_MIN (-128) /* min value for a char */
#define USHRT_MAX 65535 /* max value for an unsigned short */
#define SHRT_MAX 32767 /* max value for a short */
#define SHRT_MIN (-32768) /* min value for a short */
#define UINT_MAX 0xffffffff /* max value for an unsigned int */
#define INT_MAX 2147483647 /* max value for an int */
#define INT_MIN (-2147483647-1) /* min value for an int */
#ifdef __LP64__
#define ULONG_MAX 0xffffffffffffffffUL /* max unsigned long */
#define LONG_MAX 0x7fffffffffffffffL /* max signed long */
#define LONG_MIN (-0x7fffffffffffffffL-1) /* min signed long */
#else /* !__LP64__ */
#define ULONG_MAX 0xffffffffUL /* max unsigned long */
#define LONG_MAX 2147483647L /* max signed long */
#define LONG_MIN (-2147483647L-1) /* min signed long */
#endif /* __LP64__ */
#define ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */
#define LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */
#define LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */
#if !defined(_ANSI_SOURCE)
#ifdef __LP64__
#define LONG_BIT 64
#else /* !__LP64__ */
#define LONG_BIT 32
#endif /* __LP64__ */
#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
#define WORD_BIT 32
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */
#define UQUAD_MAX ULLONG_MAX
#define QUAD_MAX LLONG_MAX
#define QUAD_MIN LLONG_MIN
#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
#endif /* !_ANSI_SOURCE */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_LIMITS_H_ */

View File

@@ -0,0 +1,151 @@
/*
* Copyright (c) 2000-2010 Apple Inc. All rights reserved.
*/
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
* All or some portions of this file are derived from material licensed
* to the University of California by American Telephone and Telegraph
* Co. or Unix System Laboratories, Inc. and are reproduced herein with
* the permission of UNIX System Laboratories, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)param.h 8.1 (Berkeley) 4/4/95
*/
/*
* Machine dependent constants for ARM
*/
#ifndef _ARM_PARAM_H_
#define _ARM_PARAM_H_
#if defined (__arm__) || defined (__arm64__)
#include <arm/_param.h>
/*
* Round p (pointer or byte index) up to a correctly-aligned value for all
* data types (int, long, ...). The result is unsigned int and must be
* cast to any desired pointer type.
*/
#define ALIGNBYTES __DARWIN_ALIGNBYTES
#define ALIGN(p) __DARWIN_ALIGN(p)
#define NBPG 4096 /* bytes/page */
#define PGOFSET (NBPG-1) /* byte offset into page */
#define PGSHIFT 12 /* LOG2(NBPG) */
#define DEV_BSIZE 512
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define BLKDEV_IOSIZE 2048
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
#define CLSIZE 1
#define CLSIZELOG2 0
/*
* Constants related to network buffer management.
* MCLBYTES must be no larger than CLBYTES (the software page size), and,
* on machines that exchange pages of input or output buffers with mbuf
* clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
* of the hardware page size.
*/
#define MSIZESHIFT 8 /* 256 */
#define MSIZE (1 << MSIZESHIFT) /* size of an mbuf */
#define MCLSHIFT 11 /* 2048 */
#define MCLBYTES (1 << MCLSHIFT) /* size of an mbuf cluster */
#define MBIGCLSHIFT 12 /* 4096 */
#define MBIGCLBYTES (1 << MBIGCLSHIFT) /* size of a big cluster */
#define M16KCLSHIFT 14 /* 16384 */
#define M16KCLBYTES (1 << M16KCLSHIFT) /* size of a jumbo cluster */
#define MCLOFSET (MCLBYTES - 1)
#ifndef NMBCLUSTERS
#define NMBCLUSTERS CONFIG_NMBCLUSTERS /* cl map size */
#endif
/*
* Some macros for units conversion
*/
/* Core clicks (NeXT_page_size bytes) to segments and vice versa */
#define ctos(x) (x)
#define stoc(x) (x)
/* Core clicks (4096 bytes) to disk blocks */
#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))
#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))
#define dtob(x) ((x)<<DEV_BSHIFT)
/* clicks to bytes */
#define ctob(x) ((x)<<PGSHIFT)
/* bytes to clicks */
#define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT)
#ifdef __APPLE__
#define btodb(bytes, devBlockSize) \
((unsigned)(bytes) / devBlockSize)
#define dbtob(db, devBlockSize) \
((unsigned)(db) * devBlockSize)
#else
#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
((unsigned)(bytes) >> DEV_BSHIFT)
#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
((unsigned)(db) << DEV_BSHIFT)
#endif
/*
* Map a ``block device block'' to a file system block.
* This should be device dependent, and will be if we
* add an entry to cdevsw/bdevsw for that purpose.
* For now though just use DEV_BSIZE.
*/
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
/*
* Macros to decode (and encode) processor status word.
*/
#define STATUS_WORD(rpl, ipl) (((ipl) << 8) | (rpl))
#define USERMODE(x) (((x) & 3) == 3)
#define BASEPRI(x) (((x) & (255 << 8)) == 0)
#if defined(KERNEL) || defined(STANDALONE)
#define DELAY(n) delay(n)
#else /* defined(KERNEL) || defined(STANDALONE) */
#define DELAY(n) { int N = (n); while (--N > 0); }
#endif /* defined(KERNEL) || defined(STANDALONE) */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_PARAM_H_ */

View File

@@ -0,0 +1,22 @@
/*
* Copyright (c) 2000-2009 Apple, Inc. All rights reserved.
*/
/*
* Copyright (c) 1992 NeXT Computer, Inc.
*
*/
#ifndef _ARM_SIGNAL_
#define _ARM_SIGNAL_ 1
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h>
#ifndef _ANSI_SOURCE
typedef int sig_atomic_t;
#endif /* ! _ANSI_SOURCE */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_SIGNAL_ */

View File

@@ -0,0 +1,111 @@
/*
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
*/
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
*/
/*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)types.h 8.3 (Berkeley) 1/5/94
*/
#ifndef _ARM_MACHTYPES_H_
#define _ARM_MACHTYPES_H_
#define _MACHTYPES_H_
#if defined (__arm__) || defined (__arm64__)
#ifndef __ASSEMBLER__
#include <arm/_types.h>
#include <sys/cdefs.h>
/*
* Basic integral types. Omit the typedef if
* not possible for a machine/compiler combination.
*/
#include <sys/_types/_int8_t.h>
#include <sys/_types/_int16_t.h>
#include <sys/_types/_int32_t.h>
#include <sys/_types/_int64_t.h>
#include <sys/_types/_u_int8_t.h>
#include <sys/_types/_u_int16_t.h>
#include <sys/_types/_u_int32_t.h>
#include <sys/_types/_u_int64_t.h>
#if __LP64__
typedef int64_t register_t;
#else
typedef int32_t register_t;
#endif
#include <sys/_types/_intptr_t.h>
#include <sys/_types/_uintptr_t.h>
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
/* These types are used for reserving the largest possible size. */
#ifdef __arm64__
typedef u_int64_t user_addr_t;
typedef u_int64_t user_size_t;
typedef int64_t user_ssize_t;
typedef int64_t user_long_t;
typedef u_int64_t user_ulong_t;
typedef int64_t user_time_t;
typedef int64_t user_off_t;
#else
typedef u_int32_t user_addr_t;
typedef u_int32_t user_size_t;
typedef int32_t user_ssize_t;
typedef int32_t user_long_t;
typedef u_int32_t user_ulong_t;
typedef int32_t user_time_t;
typedef int64_t user_off_t;
#endif
#define USER_ADDR_NULL ((user_addr_t) 0)
#define CAST_USER_ADDR_T(a_ptr) ((user_addr_t)((uintptr_t)(a_ptr)))
#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
/* This defines the size of syscall arguments after copying into the kernel: */
#if defined(__arm__)
typedef u_int32_t syscall_arg_t;
#elif defined(__arm64__)
typedef u_int64_t syscall_arg_t;
#else
#error Unknown architecture.
#endif
#endif /* __ASSEMBLER__ */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_MACHTYPES_H_ */

View File

@@ -35,13 +35,14 @@
* is preferred.
*/
#include <Availability.h>
#if !(defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED)
#include <sys/cdefs.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <Availability.h>
#ifndef OSATOMIC_DEPRECATED
#define OSATOMIC_DEPRECATED 1
@@ -161,7 +162,7 @@ __OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
int32_t OSAtomicAdd32Barrier( int32_t __theAmount, volatile int32_t *__theValue );
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT
/*! @abstract Atomically increments a 32-bit value.
@result Returns the new value.
@@ -248,7 +249,7 @@ int64_t OSAtomicAdd64Barrier( int64_t __theAmount,
volatile OSAtomic_int64_aligned64_t *__theValue );
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_10 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_1 || TARGET_OS_DRIVERKIT
/*! @abstract Atomically increments a 64-bit value.
@result Returns the new value.
@@ -361,7 +362,7 @@ int32_t OSAtomicOr32Orig( uint32_t __theMask, volatile uint32_t *__theValue );
This function performs the bitwise OR of the value given by <code>__theMask</code>
with the value in the memory location referenced by <code>__theValue</code>,
storing the result back to that memory location atomically.
This function is equivalent to {@link OSAtomicOr32Orig}
except that it also introduces a barrier.
@result Returns the original value referenced by <code>__theValue</code>.
@@ -481,7 +482,7 @@ int32_t OSAtomicXor32Orig( uint32_t __theMask, volatile uint32_t *__theValue );
OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_xor)
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_2)
int32_t OSAtomicXor32OrigBarrier( uint32_t __theMask, volatile uint32_t *__theValue );
/*! @group Compare and swap
* Functions in this group return true if the swap occured. There are several versions,
@@ -587,7 +588,7 @@ bool OSAtomicCompareAndSwapIntBarrier( int __oldValue, int __newValue, volatile
match, this function stores the value from <code>__newValue</code> into
that memory location atomically.
This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures,
This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures,
or {@link OSAtomicCompareAndSwap64} on 64-bit architectures.
@result Returns TRUE on a match, FALSE otherwise.
*/
@@ -606,7 +607,7 @@ bool OSAtomicCompareAndSwapLong( long __oldValue, long __newValue, volatile long
This function is equivalent to {@link OSAtomicCompareAndSwapLong}
except that it also introduces a barrier.
This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures,
This function is equivalent to {@link OSAtomicCompareAndSwap32} on 32-bit architectures,
or {@link OSAtomicCompareAndSwap64} on 64-bit architectures.
@result Returns TRUE on a match, FALSE otherwise.
*/
@@ -706,7 +707,7 @@ bool OSAtomicTestAndSetBarrier( uint32_t __n, volatile void *__theAddress );
For example, if <code>__theAddress</code> points to a 64-bit value,
to compare the value of the most significant bit, you would specify
<code>56</code> for <code>__n</code>.
@result
Returns the original value of the bit being tested.
*/
@@ -719,15 +720,15 @@ bool OSAtomicTestAndClear( uint32_t __n, volatile void *__theAddress );
@discussion
This function tests a bit in the value referenced by <code>__theAddress</code>
and if it is not cleared, clears it.
The bit is chosen by the value of <code>__n</code> such that the
operation will be performed on bit <code>(0x80 >> (__n & 7))</code>
of byte <code>((char *)__theAddress + (n >> 3))</code>.
For example, if <code>__theAddress</code> points to a 64-bit value,
to compare the value of the most significant bit, you would specify
<code>56</code> for <code>__n</code>.
This function is equivalent to {@link OSAtomicTestAndSet}
except that it also introduces a barrier.
@result
@@ -736,7 +737,7 @@ bool OSAtomicTestAndClear( uint32_t __n, volatile void *__theAddress );
OSATOMIC_BARRIER_DEPRECATED_REPLACE_WITH(atomic_fetch_and)
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
bool OSAtomicTestAndClearBarrier( uint32_t __n, volatile void *__theAddress );
/*! @group Memory barriers */
@@ -1174,4 +1175,92 @@ __END_DECLS
#endif // defined(OSATOMIC_USE_INLINED) && OSATOMIC_USE_INLINED
#if TARGET_OS_OSX || TARGET_OS_DRIVERKIT
__BEGIN_DECLS
/*! @group Lockless atomic fifo enqueue and dequeue
* These routines manipulate singly-linked FIFO lists.
*
* This API is deprecated and no longer recommended
*/
/*! @abstract The data structure for a fifo queue head.
@discussion
You should always initialize a fifo queue head structure with the
initialization vector {@link OS_ATOMIC_FIFO_QUEUE_INIT} before use.
*/
#if defined(__LP64__)
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} __attribute__ ((aligned (16))) OSFifoQueueHead;
#else
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} OSFifoQueueHead;
#endif
/*! @abstract The initialization vector for a fifo queue head. */
#define OS_ATOMIC_FIFO_QUEUE_INIT { NULL, 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.
@note
This API is deprecated and no longer recommended
*/
__API_DEPRECATED("No longer supported", macos(10.7, 11.0))
void OSAtomicFifoEnqueue( OSFifoQueueHead *__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.
@result
Returns the oldest enqueued element, or <code>NULL</code> if the
list is empty.
@note
This API is deprecated and no longer recommended
*/
__API_DEPRECATED("No longer supported", macos(10.7, 11.0))
void* OSAtomicFifoDequeue( OSFifoQueueHead *__list, size_t __offset);
__END_DECLS
#endif /* TARGET_OS_OSX || TARGET_OS_DRIVERKIT */
#endif /* _OSATOMIC_DEPRECATED_H_ */

View File

@@ -28,6 +28,7 @@
#include <sys/cdefs.h>
#include <stdint.h>
#include <stdbool.h>
#include "OSAtomicDeprecated.h"
#include <Availability.h>
@@ -109,83 +110,6 @@ void OSAtomicEnqueue( OSQueueHead *__list, void *__new, size_t __offset);
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0)
void* OSAtomicDequeue( OSQueueHead *__list, size_t __offset);
#if defined(__x86_64__) || defined(__i386__)
/*! @group Lockless atomic fifo enqueue and dequeue
* These routines manipulate singly-linked FIFO lists.
*/
/*! @abstract The data structure for a fifo queue head.
@discussion
You should always initialize a fifo queue head structure with the
initialization vector {@link OS_ATOMIC_FIFO_QUEUE_INIT} before use.
*/
#if defined(__x86_64__)
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} __attribute__ ((aligned (16))) OSFifoQueueHead;
#else
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} OSFifoQueueHead;
#endif
/*! @abstract The initialization vector for a fifo queue head. */
#define OS_ATOMIC_FIFO_QUEUE_INIT { NULL, 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_7, __IPHONE_NA)
void OSAtomicFifoEnqueue( OSFifoQueueHead *__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.
@result
Returns the oldest enqueued element, or <code>NULL</code> if the
list is empty.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA)
void* OSAtomicFifoDequeue( OSFifoQueueHead *__list, size_t __offset);
#endif /* __i386__ || __x86_64__ */
__END_DECLS
#endif /* _OSATOMICQUEUE_H_ */

View File

@@ -0,0 +1,216 @@
/*
* Copyright (c) 1999-2007 Apple Inc. All rights reserved.
*/
#ifndef _OS_OSBYTEORDERARM_H
#define _OS_OSBYTEORDERARM_H
#include <stdint.h>
#include <arm/arch.h> /* for _ARM_ARCH_6 */
/* Generic byte swapping functions. */
__DARWIN_OS_INLINE
uint16_t
_OSSwapInt16(
uint16_t _data
)
{
/* Reduces to 'rev16' with clang */
return (uint16_t)(_data << 8 | _data >> 8);
}
__DARWIN_OS_INLINE
uint32_t
_OSSwapInt32(
uint32_t _data
)
{
#if defined(__llvm__)
_data = __builtin_bswap32(_data);
#else
/* This actually generates the best code */
_data = (((_data ^ (_data >> 16 | (_data << 16))) & 0xFF00FFFF) >> 8) ^ (_data >> 8 | _data << 24);
#endif
return _data;
}
__DARWIN_OS_INLINE
uint64_t
_OSSwapInt64(
uint64_t _data
)
{
#if defined(__llvm__)
return __builtin_bswap64(_data);
#else
union {
uint64_t _ull;
uint32_t _ul[2];
} _u;
/* This actually generates the best code */
_u._ul[0] = (uint32_t)(_data >> 32);
_u._ul[1] = (uint32_t)(_data & 0xffffffff);
_u._ul[0] = _OSSwapInt32(_u._ul[0]);
_u._ul[1] = _OSSwapInt32(_u._ul[1]);
return _u._ull;
#endif
}
/* Functions for byte reversed loads. */
struct _OSUnalignedU16 {
volatile uint16_t __val;
} __attribute__((__packed__));
struct _OSUnalignedU32 {
volatile uint32_t __val;
} __attribute__((__packed__));
struct _OSUnalignedU64 {
volatile uint64_t __val;
} __attribute__((__packed__));
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
uint16_t
_OSReadSwapInt16(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val);
}
#else
__DARWIN_OS_INLINE
uint16_t
OSReadSwapInt16(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt16(((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val);
}
#endif
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
uint32_t
_OSReadSwapInt32(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val);
}
#else
__DARWIN_OS_INLINE
uint32_t
OSReadSwapInt32(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt32(((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val);
}
#endif
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
uint64_t
_OSReadSwapInt64(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val);
}
#else
__DARWIN_OS_INLINE
uint64_t
OSReadSwapInt64(
const volatile void * _base,
uintptr_t _offset
)
{
return _OSSwapInt64(((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val);
}
#endif
/* Functions for byte reversed stores. */
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
void
_OSWriteSwapInt16(
volatile void * _base,
uintptr_t _offset,
uint16_t _data
)
{
((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data);
}
#else
__DARWIN_OS_INLINE
void
OSWriteSwapInt16(
volatile void * _base,
uintptr_t _offset,
uint16_t _data
)
{
((struct _OSUnalignedU16 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt16(_data);
}
#endif
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
void
_OSWriteSwapInt32(
volatile void * _base,
uintptr_t _offset,
uint32_t _data
)
{
((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data);
}
#else
__DARWIN_OS_INLINE
void
OSWriteSwapInt32(
volatile void * _base,
uintptr_t _offset,
uint32_t _data
)
{
((struct _OSUnalignedU32 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt32(_data);
}
#endif
#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
__DARWIN_OS_INLINE
void
_OSWriteSwapInt64(
volatile void * _base,
uintptr_t _offset,
uint64_t _data
)
{
((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data);
}
#else
__DARWIN_OS_INLINE
void
OSWriteSwapInt64(
volatile void * _base,
uintptr_t _offset,
uint64_t _data
)
{
((struct _OSUnalignedU64 *)((uintptr_t)_base + _offset))->__val = _OSSwapInt64(_data);
}
#endif
#endif /* ! _OS_OSBYTEORDERARM_H */

View File

@@ -0,0 +1,683 @@
/*
* Copyright (c) 2004-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _MACH_ARM__STRUCTS_H_
#define _MACH_ARM__STRUCTS_H_
#if defined (__arm__) || defined (__arm64__)
#include <sys/cdefs.h> /* __DARWIN_UNIX03 */
#include <machine/types.h> /* __uint32_t */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_EXCEPTION_STATE struct __darwin_arm_exception_state
_STRUCT_ARM_EXCEPTION_STATE
{
__uint32_t __exception; /* number of arm exception taken */
__uint32_t __fsr; /* Fault status */
__uint32_t __far; /* Virtual Fault Address */
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_EXCEPTION_STATE struct arm_exception_state
_STRUCT_ARM_EXCEPTION_STATE
{
__uint32_t exception; /* number of arm exception taken */
__uint32_t fsr; /* Fault status */
__uint32_t far; /* Virtual Fault Address */
};
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_EXCEPTION_STATE64 struct __darwin_arm_exception_state64
_STRUCT_ARM_EXCEPTION_STATE64
{
__uint64_t __far; /* Virtual Fault Address */
__uint32_t __esr; /* Exception syndrome */
__uint32_t __exception; /* number of arm exception taken */
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_EXCEPTION_STATE64 struct arm_exception_state64
_STRUCT_ARM_EXCEPTION_STATE64
{
__uint64_t far; /* Virtual Fault Address */
__uint32_t esr; /* Exception syndrome */
__uint32_t exception; /* number of arm exception taken */
};
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_THREAD_STATE struct __darwin_arm_thread_state
_STRUCT_ARM_THREAD_STATE
{
__uint32_t __r[13]; /* General purpose register r0-r12 */
__uint32_t __sp; /* Stack pointer r13 */
__uint32_t __lr; /* Link register r14 */
__uint32_t __pc; /* Program counter r15 */
__uint32_t __cpsr; /* Current program status register */
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_THREAD_STATE struct arm_thread_state
_STRUCT_ARM_THREAD_STATE
{
__uint32_t r[13]; /* General purpose register r0-r12 */
__uint32_t sp; /* Stack pointer r13 */
__uint32_t lr; /* Link register r14 */
__uint32_t pc; /* Program counter r15 */
__uint32_t cpsr; /* Current program status register */
};
#endif /* __DARWIN_UNIX03 */
/*
* By default, the pointer fields in the arm_thread_state64_t structure are
* opaque on the arm64e architecture and require the use of accessor macros.
* This mode can also be enabled on the arm64 architecture by building with
* -D__DARWIN_OPAQUE_ARM_THREAD_STATE64=1.
*/
#if defined(__arm64__) && defined(__LP64__)
#if __has_feature(ptrauth_calls)
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 1
#define __DARWIN_PTRAUTH_ARM_THREAD_STATE64 1
#endif /* __has_feature(ptrauth_calls) */
#ifndef __DARWIN_OPAQUE_ARM_THREAD_STATE64
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
#endif
#else /* defined(__arm64__) && defined(__LP64__) */
#undef __DARWIN_OPAQUE_ARM_THREAD_STATE64
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
#endif /* defined(__arm64__) && defined(__LP64__) */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_THREAD_STATE64 struct __darwin_arm_thread_state64
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
_STRUCT_ARM_THREAD_STATE64
{
__uint64_t __x[29]; /* General purpose registers x0-x28 */
void* __opaque_fp; /* Frame pointer x29 */
void* __opaque_lr; /* Link register x30 */
void* __opaque_sp; /* Stack pointer x31 */
void* __opaque_pc; /* Program counter */
__uint32_t __cpsr; /* Current program status register */
__uint32_t __opaque_flags; /* Flags describing structure format */
};
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
_STRUCT_ARM_THREAD_STATE64
{
__uint64_t __x[29]; /* General purpose registers x0-x28 */
__uint64_t __fp; /* Frame pointer x29 */
__uint64_t __lr; /* Link register x30 */
__uint64_t __sp; /* Stack pointer x31 */
__uint64_t __pc; /* Program counter */
__uint32_t __cpsr; /* Current program status register */
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
};
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_THREAD_STATE64 struct arm_thread_state64
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
_STRUCT_ARM_THREAD_STATE64
{
__uint64_t x[29]; /* General purpose registers x0-x28 */
void* __opaque_fp; /* Frame pointer x29 */
void* __opaque_lr; /* Link register x30 */
void* __opaque_sp; /* Stack pointer x31 */
void* __opaque_pc; /* Program counter */
__uint32_t cpsr; /* Current program status register */
__uint32_t __opaque_flags; /* Flags describing structure format */
};
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
_STRUCT_ARM_THREAD_STATE64
{
__uint64_t x[29]; /* General purpose registers x0-x28 */
__uint64_t fp; /* Frame pointer x29 */
__uint64_t lr; /* Link register x30 */
__uint64_t sp; /* Stack pointer x31 */
__uint64_t pc; /* Program counter */
__uint32_t cpsr; /* Current program status register */
__uint32_t __pad; /* Same size for 32-bit or 64-bit clients */
};
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
/* Accessor macros for arm_thread_state64_t pointer fields */
#if __has_feature(ptrauth_calls) && defined(__LP64__)
#include <ptrauth.h>
#if !__DARWIN_OPAQUE_ARM_THREAD_STATE64 || !__DARWIN_PTRAUTH_ARM_THREAD_STATE64
#error "Invalid configuration"
#endif
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH 0x1
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC 0x4
#define __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR 0x8
#define __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK 0xff000000
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_pc(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(uintptr_t)(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_data(__tsp->__opaque_pc, \
ptrauth_key_process_independent_code, \
((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC) == 0 && \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("pc")) : \
ptrauth_string_discriminator("pc")) : __tsp->__opaque_pc); })
/* Return pc field of arm_thread_state64_t as a function pointer. May return
* NULL if a valid function pointer cannot be constructed, the caller should
* fall back to the __darwin_arm_thread_state64_get_pc() macro in that case. */
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(__tsp->__opaque_pc && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_function(__tsp->__opaque_pc, \
ptrauth_key_process_independent_code, \
((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC) == 0 && \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("pc")) : \
ptrauth_string_discriminator("pc")) : NULL); })
/* Set pc field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
__typeof__(fptr) __f = (fptr); __tsp->__opaque_pc = \
(__f ? (!(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
ptrauth_key_process_independent_code, \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("pc")) : \
ptrauth_string_discriminator("pc")) : ptrauth_auth_data(__f, \
ptrauth_key_function_pointer, 0)) : __f); \
__tsp->__opaque_flags &= \
~__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC; })
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_lr(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(uintptr_t)(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
ptrauth_auth_data(__tsp->__opaque_lr, \
ptrauth_key_process_independent_code, \
((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR) == 0 && \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("lr")) : \
ptrauth_string_discriminator("lr")) : __tsp->__opaque_lr); })
/* Return lr field of arm_thread_state64_t as a function pointer. May return
* NULL if a valid function pointer cannot be constructed, the caller should
* fall back to the __darwin_arm_thread_state64_get_lr() macro in that case. */
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(__tsp->__opaque_lr && !(__tsp->__opaque_flags & ( \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? \
ptrauth_auth_function(__tsp->__opaque_lr, \
ptrauth_key_process_independent_code, \
((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR) == 0 && \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK)) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("lr")) : \
ptrauth_string_discriminator("lr")) : NULL); })
/* Set lr field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
__typeof__(fptr) __f = (fptr); __tsp->__opaque_lr = \
(__f ? (!(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? (__tsp->__opaque_flags \
&= ~__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR , \
ptrauth_auth_and_resign(__f, ptrauth_key_function_pointer, 0, \
ptrauth_key_process_independent_code, \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK) ? \
ptrauth_blend_discriminator((void *)(unsigned long) \
(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK), \
ptrauth_string_discriminator("lr")) : \
ptrauth_string_discriminator("lr"))) : ptrauth_auth_data(__f, \
ptrauth_key_function_pointer, 0)) : __f); __tsp->__opaque_flags &= \
~__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR; })
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_sp(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(uintptr_t)(__tsp->__opaque_sp && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_data(__tsp->__opaque_sp, \
ptrauth_key_process_independent_data, \
ptrauth_string_discriminator("sp")) : __tsp->__opaque_sp); })
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_sp = \
(__p && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_sign_unauthenticated(__p, \
ptrauth_key_process_independent_data, \
ptrauth_string_discriminator("sp")) : __p); })
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_fp(ts) \
__extension__ ({ const _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
(uintptr_t)(__tsp->__opaque_fp && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_auth_data(__tsp->__opaque_fp, \
ptrauth_key_process_independent_data, \
ptrauth_string_discriminator("fp")) : __tsp->__opaque_fp); })
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
void *__p = (void*)(uintptr_t)(ptr); __tsp->__opaque_fp = \
(__p && !(__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? \
ptrauth_sign_unauthenticated(__p, \
ptrauth_key_process_independent_data, \
ptrauth_string_discriminator("fp")) : __p); })
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
__extension__ ({ _STRUCT_ARM_THREAD_STATE64 *__tsp = &(ts); \
__tsp->__opaque_pc = ((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_pc : \
ptrauth_strip(__tsp->__opaque_pc, ptrauth_key_process_independent_code)); \
__tsp->__opaque_lr = ((__tsp->__opaque_flags & \
(__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH | \
__DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR)) ? __tsp->__opaque_lr : \
ptrauth_strip(__tsp->__opaque_lr, ptrauth_key_process_independent_code)); \
__tsp->__opaque_sp = ((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_sp : \
ptrauth_strip(__tsp->__opaque_sp, ptrauth_key_process_independent_data)); \
__tsp->__opaque_fp = ((__tsp->__opaque_flags & \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH) ? __tsp->__opaque_fp : \
ptrauth_strip(__tsp->__opaque_fp, ptrauth_key_process_independent_data)); \
__tsp->__opaque_flags |= \
__DARWIN_ARM_THREAD_STATE64_FLAGS_NO_PTRAUTH; __tsp->__opaque_flags &= \
~(__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC | \
__DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR); })
#else /* __has_feature(ptrauth_calls) && defined(__LP64__) */
#if __DARWIN_OPAQUE_ARM_THREAD_STATE64
#ifndef __LP64__
#error "Invalid configuration"
#endif
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_pc(ts) \
((uintptr_t)((ts).__opaque_pc))
/* Return pc field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
((ts).__opaque_pc)
/* Set pc field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
((ts).__opaque_pc = (fptr))
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_lr(ts) \
((uintptr_t)((ts).__opaque_lr))
/* Return lr field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
((ts).__opaque_lr)
/* Set lr field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
((ts).__opaque_lr = (fptr))
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_sp(ts) \
((uintptr_t)((ts).__opaque_sp))
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
((ts).__opaque_sp = (void*)(uintptr_t)(ptr))
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_fp(ts) \
((uintptr_t)((ts).__opaque_fp))
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
((ts).__opaque_fp = (void*)(uintptr_t)(ptr))
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
(void)(ts)
#else /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
#if __DARWIN_UNIX03
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_pc(ts) \
((ts).__pc)
/* Return pc field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
((void*)(uintptr_t)((ts).__pc))
/* Set pc field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
((ts).__pc = (uintptr_t)(fptr))
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_lr(ts) \
((ts).__lr)
/* Return lr field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
((void*)(uintptr_t)((ts).__lr))
/* Set lr field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
((ts).__lr = (uintptr_t)(fptr))
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_sp(ts) \
((ts).__sp)
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
((ts).__sp = (uintptr_t)(ptr))
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_fp(ts) \
((ts).__fp)
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
((ts).__fp = (uintptr_t)(ptr))
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
(void)(ts)
#else /* __DARWIN_UNIX03 */
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_pc(ts) \
((ts).pc)
/* Return pc field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_pc_fptr(ts) \
((void*)(uintptr_t)((ts).pc))
/* Set pc field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_pc_fptr(ts, fptr) \
((ts).pc = (uintptr_t)(fptr))
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_lr(ts) \
((ts).lr)
/* Return lr field of arm_thread_state64_t as a function pointer */
#define __darwin_arm_thread_state64_get_lr_fptr(ts) \
((void*)(uintptr_t)((ts).lr))
/* Set lr field of arm_thread_state64_t to a function pointer */
#define __darwin_arm_thread_state64_set_lr_fptr(ts, fptr) \
((ts).lr = (uintptr_t)(fptr))
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_sp(ts) \
((ts).sp)
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_sp(ts, ptr) \
((ts).sp = (uintptr_t)(ptr))
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define __darwin_arm_thread_state64_get_fp(ts) \
((ts).fp)
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define __darwin_arm_thread_state64_set_fp(ts, ptr) \
((ts).fp = (uintptr_t)(ptr))
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define __darwin_arm_thread_state64_ptrauth_strip(ts) \
(void)(ts)
#endif /* __DARWIN_UNIX03 */
#endif /* __DARWIN_OPAQUE_ARM_THREAD_STATE64 */
#endif /* __has_feature(ptrauth_calls) && defined(__LP64__) */
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_VFP_STATE struct __darwin_arm_vfp_state
_STRUCT_ARM_VFP_STATE
{
__uint32_t __r[64];
__uint32_t __fpscr;
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_VFP_STATE struct arm_vfp_state
_STRUCT_ARM_VFP_STATE
{
__uint32_t r[64];
__uint32_t fpscr;
};
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_NEON_STATE64 struct __darwin_arm_neon_state64
#define _STRUCT_ARM_NEON_STATE struct __darwin_arm_neon_state
#if defined(__arm64__)
_STRUCT_ARM_NEON_STATE64
{
__uint128_t __v[32];
__uint32_t __fpsr;
__uint32_t __fpcr;
};
_STRUCT_ARM_NEON_STATE
{
__uint128_t __v[16];
__uint32_t __fpsr;
__uint32_t __fpcr;
};
#elif defined(__arm__)
/*
* No 128-bit intrinsic for ARM; leave it opaque for now.
*/
_STRUCT_ARM_NEON_STATE64
{
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
} __attribute__((aligned(16)));
_STRUCT_ARM_NEON_STATE
{
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
} __attribute__((aligned(16)));
#else
#error Unknown architecture.
#endif
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_NEON_STATE64 struct arm_neon_state64
#define _STRUCT_ARM_NEON_STATE struct arm_neon_state
#if defined(__arm64__)
_STRUCT_ARM_NEON_STATE64
{
__uint128_t q[32];
uint32_t fpsr;
uint32_t fpcr;
};
_STRUCT_ARM_NEON_STATE
{
__uint128_t q[16];
uint32_t fpsr;
uint32_t fpcr;
};
#elif defined(__arm__)
/*
* No 128-bit intrinsic for ARM; leave it opaque for now.
*/
_STRUCT_ARM_NEON_STATE64
{
char opaque[(32 * 16) + (2 * sizeof(__uint32_t))];
} __attribute__((aligned(16)));
_STRUCT_ARM_NEON_STATE
{
char opaque[(16 * 16) + (2 * sizeof(__uint32_t))];
} __attribute__((aligned(16)));
#else
#error Unknown architecture.
#endif
#endif /* __DARWIN_UNIX03 */
#define _STRUCT_ARM_PAGEIN_STATE struct __arm_pagein_state
_STRUCT_ARM_PAGEIN_STATE
{
int __pagein_error;
};
/*
* Debug State
*/
#if defined(__arm__)
/* Old-fashioned debug state is only for ARM */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_DEBUG_STATE struct __darwin_arm_debug_state
_STRUCT_ARM_DEBUG_STATE
{
__uint32_t __bvr[16];
__uint32_t __bcr[16];
__uint32_t __wvr[16];
__uint32_t __wcr[16];
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_DEBUG_STATE struct arm_debug_state
_STRUCT_ARM_DEBUG_STATE
{
__uint32_t bvr[16];
__uint32_t bcr[16];
__uint32_t wvr[16];
__uint32_t wcr[16];
};
#endif /* __DARWIN_UNIX03 */
#elif defined(__arm64__)
/* ARM's arm_debug_state is ARM64's arm_legacy_debug_state */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct __arm_legacy_debug_state
_STRUCT_ARM_LEGACY_DEBUG_STATE
{
__uint32_t __bvr[16];
__uint32_t __bcr[16];
__uint32_t __wvr[16];
__uint32_t __wcr[16];
};
#else /* __DARWIN_UNIX03 */
#define _STRUCT_ARM_LEGACY_DEBUG_STATE struct arm_legacy_debug_state
_STRUCT_ARM_LEGACY_DEBUG_STATE
{
__uint32_t bvr[16];
__uint32_t bcr[16];
__uint32_t wvr[16];
__uint32_t wcr[16];
};
#endif /* __DARWIN_UNIX03 */
#else
#error unknown architecture
#endif
#if __DARWIN_UNIX03
#define _STRUCT_ARM_DEBUG_STATE32 struct __darwin_arm_debug_state32
_STRUCT_ARM_DEBUG_STATE32
{
__uint32_t __bvr[16];
__uint32_t __bcr[16];
__uint32_t __wvr[16];
__uint32_t __wcr[16];
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
};
#define _STRUCT_ARM_DEBUG_STATE64 struct __darwin_arm_debug_state64
_STRUCT_ARM_DEBUG_STATE64
{
__uint64_t __bvr[16];
__uint64_t __bcr[16];
__uint64_t __wvr[16];
__uint64_t __wcr[16];
__uint64_t __mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
};
#else /* !__DARWIN_UNIX03 */
#define _STRUCT_ARM_DEBUG_STATE32 struct arm_debug_state32
_STRUCT_ARM_DEBUG_STATE32
{
__uint32_t bvr[16];
__uint32_t bcr[16];
__uint32_t wvr[16];
__uint32_t wcr[16];
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
};
#define _STRUCT_ARM_DEBUG_STATE64 struct arm_debug_state64
_STRUCT_ARM_DEBUG_STATE64
{
__uint64_t bvr[16];
__uint64_t bcr[16];
__uint64_t wvr[16];
__uint64_t wcr[16];
__uint64_t mdscr_el1; /* Bit 0 is SS (Hardware Single Step) */
};
#endif /* __DARWIN_UNIX03 */
#if __DARWIN_UNIX03
#define _STRUCT_ARM_CPMU_STATE64 struct __darwin_arm_cpmu_state64
_STRUCT_ARM_CPMU_STATE64
{
__uint64_t __ctrs[16];
};
#else /* __DARWIN_UNIX03 */
#define _STRUCT_ARM_CPMU_STATE64 struct arm_cpmu_state64
_STRUCT_ARM_CPMU_STATE64
{
__uint64_t ctrs[16];
};
#endif /* !__DARWIN_UNIX03 */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM__STRUCTS_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -30,7 +30,7 @@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
@@ -55,19 +55,20 @@
*/
/*
*/
/*
* File: mach/vm_param.h
* Author: Avadis Tevanian, Jr., Michael Wayne Young
* Date: 1985
*
* Machine independent virtual memory parameters.
* File: boolean.h
*
* Boolean type, for ARM.
*/
#ifndef _MACH_VM_PARAM_H_
#define _MACH_VM_PARAM_H_
#ifndef _MACH_ARM_BOOLEAN_H_
#define _MACH_ARM_BOOLEAN_H_
#include <mach/machine/vm_param.h>
#if defined (__arm__) || defined (__arm64__)
typedef int boolean_t;
#endif /* _MACH_VM_PARAM_H_ */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_BOOLEAN_H_ */

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _MACH_ARM_EXCEPTION_H_
#define _MACH_ARM_EXCEPTION_H_
#if defined (__arm__) || defined (__arm64__)
#define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */
#define EXC_MASK_MACHINE 0
#define EXCEPTION_CODE_MAX 2 /* code and subcode */
/*
* Trap numbers as defined by the hardware exception vectors.
*/
/*
* EXC_BAD_INSTRUCTION
*/
#define EXC_ARM_UNDEFINED 1 /* Undefined */
/*
* EXC_ARITHMETIC
*/
#define EXC_ARM_FP_UNDEFINED 0 /* Undefined Floating Point Exception */
#define EXC_ARM_FP_IO 1 /* Invalid Floating Point Operation */
#define EXC_ARM_FP_DZ 2 /* Floating Point Divide by Zero */
#define EXC_ARM_FP_OF 3 /* Floating Point Overflow */
#define EXC_ARM_FP_UF 4 /* Floating Point Underflow */
#define EXC_ARM_FP_IX 5 /* Inexact Floating Point Result */
#define EXC_ARM_FP_ID 6 /* Floating Point Denormal Input */
/*
* EXC_BAD_ACCESS
* Note: do not conflict with kern_return_t values returned by vm_fault
*/
#define EXC_ARM_DA_ALIGN 0x101 /* Alignment Fault */
#define EXC_ARM_DA_DEBUG 0x102 /* Debug (watch/break) Fault */
#define EXC_ARM_SP_ALIGN 0x103 /* SP Alignment Fault */
#define EXC_ARM_SWP 0x104 /* SWP instruction */
#define EXC_ARM_PAC_FAIL 0x105 /* PAC authentication failure */
/*
* EXC_BREAKPOINT
*/
#define EXC_ARM_BREAKPOINT 1 /* breakpoint trap */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_EXCEPTION_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -30,7 +30,7 @@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
@@ -55,29 +55,24 @@
*/
/*
*/
/*
* File: mach/thread_special_ports.h
*
* Defines codes for special_purpose thread ports. These are NOT
* port identifiers - they are only used for the thread_get_special_port
* and thread_set_special_port routines.
*
*/
#ifndef _MACH_THREAD_SPECIAL_PORTS_H_
#define _MACH_THREAD_SPECIAL_PORTS_H_
#define THREAD_KERNEL_PORT 1 /* Represents the thread to the outside
* world.*/
/*
* Definitions for ease of use
* File: kern_return.h
* Author: Avadis Tevanian, Jr., Michael Wayne Young
* Date: 1985
*
* Machine-dependent kernel return definitions.
*/
#define thread_get_kernel_port(thread, port) \
(thread_get_special_port((thread), THREAD_KERNEL_PORT, (port)))
#ifndef _MACH_ARM_KERN_RETURN_H_
#define _MACH_ARM_KERN_RETURN_H_
#define thread_set_kernel_port(thread, port) \
(thread_set_special_port((thread), THREAD_KERNEL_PORT, (port)))
#if defined (__arm__) || defined (__arm64__)
#endif /* _MACH_THREAD_SPECIAL_PORTS_H_ */
#ifndef ASSEMBLER
typedef int kern_return_t;
#endif /* ASSEMBLER */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_KERN_RETURN_H_ */

View File

@@ -0,0 +1,76 @@
/*
* Copyright (c) 2007-2018 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _MACH_ARM_PROCESSOR_INFO_H_
#define _MACH_ARM_PROCESSOR_INFO_H_
#if defined (__arm__) || defined (__arm64__)
#define PROCESSOR_CPU_STAT 0x10000003 /* Low-level CPU statistics */
#define PROCESSOR_CPU_STAT64 0x10000004 /* Low-level CPU statistics, in full 64-bit */
#include <stdint.h> /* uint32_t, uint64_t */
struct processor_cpu_stat {
uint32_t irq_ex_cnt;
uint32_t ipi_cnt;
uint32_t timer_cnt;
uint32_t undef_ex_cnt;
uint32_t unaligned_cnt;
uint32_t vfp_cnt;
uint32_t vfp_shortv_cnt;
uint32_t data_ex_cnt;
uint32_t instr_ex_cnt;
};
typedef struct processor_cpu_stat processor_cpu_stat_data_t;
typedef struct processor_cpu_stat *processor_cpu_stat_t;
#define PROCESSOR_CPU_STAT_COUNT ((mach_msg_type_number_t) \
(sizeof(processor_cpu_stat_data_t) / sizeof(natural_t)))
struct processor_cpu_stat64 {
uint64_t irq_ex_cnt;
uint64_t ipi_cnt;
uint64_t timer_cnt;
uint64_t undef_ex_cnt;
uint64_t unaligned_cnt;
uint64_t vfp_cnt;
uint64_t vfp_shortv_cnt;
uint64_t data_ex_cnt;
uint64_t instr_ex_cnt;
uint64_t pmi_cnt;
} __attribute__((packed, aligned(4)));
typedef struct processor_cpu_stat64 processor_cpu_stat64_data_t;
typedef struct processor_cpu_stat64 *processor_cpu_stat64_t;
#define PROCESSOR_CPU_STAT64_COUNT ((mach_msg_type_number_t) \
(sizeof(processor_cpu_stat64_data_t) / sizeof(integer_t)))
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_PROCESSOR_INFO_H_ */

View File

@@ -25,14 +25,15 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
#ifndef _MACH_MACHINE_RPC_H_
#define _MACH_MACHINE_RPC_H_
#ifndef _MACH_ARM_RPC_H_
#define _MACH_ARM_RPC_H_
#if defined (__i386__) || defined(__x86_64__)
#include "mach/i386/rpc.h"
#else
#error architecture not supported
#endif
#if defined (__arm__) || defined (__arm64__)
#endif /* _MACH_MACHINE_RPC_H_ */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_RPC_H_ */

View File

@@ -26,15 +26,17 @@
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
* @OSF_COPYRIGHT@
*/
#ifndef _BSD_MACHINE_TYPES_H_
#define _BSD_MACHINE_TYPES_H_
#if defined (__i386__) || defined(__x86_64__)
#include "i386/types.h"
#else
#error architecture not supported
#endif
#ifndef _MACH_ARM_THREAD_STATE_H_
#define _MACH_ARM_THREAD_STATE_H_
#endif /* _BSD_MACHINE_TYPES_H_ */
#if defined (__arm__) || defined (__arm64__)
/* Size of maximum exported thread state in words */
#define ARM_THREAD_STATE_MAX (1296) /* Size of biggest state possible */
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_THREAD_STATE_H_ */

View File

@@ -0,0 +1,236 @@
/*
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* FILE_ID: thread_status.h
*/
#ifndef _ARM_THREAD_STATUS_H_
#define _ARM_THREAD_STATUS_H_
#if defined (__arm__) || defined (__arm64__)
#include <mach/machine/_structs.h>
#include <mach/machine/thread_state.h>
#include <mach/message.h>
#include <mach/vm_types.h>
/*
* Support for determining the state of a thread
*/
/*
* Flavors
*/
#define ARM_THREAD_STATE 1
#define ARM_UNIFIED_THREAD_STATE ARM_THREAD_STATE
#define ARM_VFP_STATE 2
#define ARM_EXCEPTION_STATE 3
#define ARM_DEBUG_STATE 4 /* pre-armv8 */
#define THREAD_STATE_NONE 5
#define ARM_THREAD_STATE64 6
#define ARM_EXCEPTION_STATE64 7
// ARM_THREAD_STATE_LAST 8 /* legacy */
#define ARM_THREAD_STATE32 9
/* API */
#define ARM_DEBUG_STATE32 14
#define ARM_DEBUG_STATE64 15
#define ARM_NEON_STATE 16
#define ARM_NEON_STATE64 17
#define ARM_CPMU_STATE64 18
#define ARM_PAGEIN_STATE 27
#ifndef ARM_STATE_FLAVOR_IS_OTHER_VALID
#define ARM_STATE_FLAVOR_IS_OTHER_VALID(_flavor_) 0
#endif
#define VALID_THREAD_STATE_FLAVOR(x) \
((x == ARM_THREAD_STATE) || \
(x == ARM_VFP_STATE) || \
(x == ARM_EXCEPTION_STATE) || \
(x == ARM_DEBUG_STATE) || \
(x == THREAD_STATE_NONE) || \
(x == ARM_THREAD_STATE32) || \
(x == ARM_THREAD_STATE64) || \
(x == ARM_EXCEPTION_STATE64) || \
(x == ARM_NEON_STATE) || \
(x == ARM_NEON_STATE64) || \
(x == ARM_DEBUG_STATE32) || \
(x == ARM_DEBUG_STATE64) || \
(x == ARM_PAGEIN_STATE) || \
(ARM_STATE_FLAVOR_IS_OTHER_VALID(x)))
struct arm_state_hdr {
uint32_t flavor;
uint32_t count;
};
typedef struct arm_state_hdr arm_state_hdr_t;
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state_t;
typedef _STRUCT_ARM_THREAD_STATE arm_thread_state32_t;
typedef _STRUCT_ARM_THREAD_STATE64 arm_thread_state64_t;
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__)
/* Accessor macros for arm_thread_state64_t pointer fields */
/* Return pc field of arm_thread_state64_t as a data pointer value */
#define arm_thread_state64_get_pc(ts) \
__darwin_arm_thread_state64_get_pc(ts)
/* Return pc field of arm_thread_state64_t as a function pointer. May return
* NULL if a valid function pointer cannot be constructed, the caller should
* fall back to the arm_thread_state64_get_pc() macro in that case. */
#define arm_thread_state64_get_pc_fptr(ts) \
__darwin_arm_thread_state64_get_pc_fptr(ts)
/* Set pc field of arm_thread_state64_t to a function pointer */
#define arm_thread_state64_set_pc_fptr(ts, fptr) \
__darwin_arm_thread_state64_set_pc_fptr(ts, fptr)
/* Return lr field of arm_thread_state64_t as a data pointer value */
#define arm_thread_state64_get_lr(ts) \
__darwin_arm_thread_state64_get_lr(ts)
/* Return lr field of arm_thread_state64_t as a function pointer. May return
* NULL if a valid function pointer cannot be constructed, the caller should
* fall back to the arm_thread_state64_get_lr() macro in that case. */
#define arm_thread_state64_get_lr_fptr(ts) \
__darwin_arm_thread_state64_get_lr_fptr(ts)
/* Set lr field of arm_thread_state64_t to a function pointer */
#define arm_thread_state64_set_lr_fptr(ts, fptr) \
__darwin_arm_thread_state64_set_lr_fptr(ts, fptr)
/* Return sp field of arm_thread_state64_t as a data pointer value */
#define arm_thread_state64_get_sp(ts) \
__darwin_arm_thread_state64_get_sp(ts)
/* Set sp field of arm_thread_state64_t to a data pointer value */
#define arm_thread_state64_set_sp(ts, ptr) \
__darwin_arm_thread_state64_set_sp(ts, ptr)
/* Return fp field of arm_thread_state64_t as a data pointer value */
#define arm_thread_state64_get_fp(ts) \
__darwin_arm_thread_state64_get_fp(ts)
/* Set fp field of arm_thread_state64_t to a data pointer value */
#define arm_thread_state64_set_fp(ts, ptr) \
__darwin_arm_thread_state64_set_fp(ts, ptr)
/* Strip ptr auth bits from pc, lr, sp and fp field of arm_thread_state64_t */
#define arm_thread_state64_ptrauth_strip(ts) \
__darwin_arm_thread_state64_ptrauth_strip(ts)
#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL && defined(__arm64__) */
struct arm_unified_thread_state {
arm_state_hdr_t ash;
union {
arm_thread_state32_t ts_32;
arm_thread_state64_t ts_64;
} uts;
};
#define ts_32 uts.ts_32
#define ts_64 uts.ts_64
typedef struct arm_unified_thread_state arm_unified_thread_state_t;
#define ARM_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_thread_state_t)/sizeof(uint32_t)))
#define ARM_THREAD_STATE32_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_thread_state32_t)/sizeof(uint32_t)))
#define ARM_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_thread_state64_t)/sizeof(uint32_t)))
#define ARM_UNIFIED_THREAD_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_unified_thread_state_t)/sizeof(uint32_t)))
typedef _STRUCT_ARM_VFP_STATE arm_vfp_state_t;
typedef _STRUCT_ARM_NEON_STATE arm_neon_state_t;
typedef _STRUCT_ARM_NEON_STATE arm_neon_state32_t;
typedef _STRUCT_ARM_NEON_STATE64 arm_neon_state64_t;
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state_t;
typedef _STRUCT_ARM_EXCEPTION_STATE arm_exception_state32_t;
typedef _STRUCT_ARM_EXCEPTION_STATE64 arm_exception_state64_t;
typedef _STRUCT_ARM_DEBUG_STATE32 arm_debug_state32_t;
typedef _STRUCT_ARM_DEBUG_STATE64 arm_debug_state64_t;
typedef _STRUCT_ARM_PAGEIN_STATE arm_pagein_state_t;
/*
* Otherwise not ARM64 kernel and we must preserve legacy ARM definitions of
* arm_debug_state for binary compatability of userland consumers of this file.
*/
#if defined(__arm__)
typedef _STRUCT_ARM_DEBUG_STATE arm_debug_state_t;
#elif defined(__arm64__)
typedef _STRUCT_ARM_LEGACY_DEBUG_STATE arm_debug_state_t;
#else /* defined(__arm__) */
#error Undefined architecture
#endif /* defined(__arm__) */
#define ARM_VFP_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_vfp_state_t)/sizeof(uint32_t)))
#define ARM_EXCEPTION_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_exception_state_t)/sizeof(uint32_t)))
#define ARM_EXCEPTION_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_exception_state64_t)/sizeof(uint32_t)))
#define ARM_DEBUG_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_debug_state_t)/sizeof(uint32_t)))
#define ARM_DEBUG_STATE32_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_debug_state32_t)/sizeof(uint32_t)))
#define ARM_PAGEIN_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_pagein_state_t)/sizeof(uint32_t)))
#define ARM_DEBUG_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_debug_state64_t)/sizeof(uint32_t)))
#define ARM_NEON_STATE_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_neon_state_t)/sizeof(uint32_t)))
#define ARM_NEON_STATE64_COUNT ((mach_msg_type_number_t) \
(sizeof (arm_neon_state64_t)/sizeof(uint32_t)))
#define MACHINE_THREAD_STATE ARM_THREAD_STATE
#define MACHINE_THREAD_STATE_COUNT ARM_UNIFIED_THREAD_STATE_COUNT
/*
* Largest state on this machine:
*/
#define THREAD_MACHINE_STATE_MAX THREAD_STATE_MAX
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _ARM_THREAD_STATUS_H_ */

View File

@@ -0,0 +1,112 @@
/*
* Copyright (c) 2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* FILE_ID: vm_param.h
*/
/*
* ARM machine dependent virtual memory parameters.
*/
#ifndef _MACH_ARM_VM_PARAM_H_
#define _MACH_ARM_VM_PARAM_H_
#if defined (__arm__) || defined (__arm64__)
#if !defined (KERNEL) && !defined (__ASSEMBLER__)
#include <mach/vm_page_size.h>
#endif
#define BYTE_SIZE 8 /* byte size in bits */
#define PAGE_SHIFT vm_page_shift
#define PAGE_SIZE vm_page_size
#define PAGE_MASK vm_page_mask
#define VM_PAGE_SIZE vm_page_size
#define machine_ptob(x) ((x) << PAGE_SHIFT)
#define PAGE_MAX_SHIFT 14
#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT)
#define PAGE_MAX_MASK (PAGE_MAX_SIZE-1)
#define PAGE_MIN_SHIFT 12
#define PAGE_MIN_SIZE (1 << PAGE_MIN_SHIFT)
#define PAGE_MIN_MASK (PAGE_MIN_SIZE-1)
#define VM_MAX_PAGE_ADDRESS MACH_VM_MAX_ADDRESS
#ifndef __ASSEMBLER__
#if defined (__arm__)
#define VM_MIN_ADDRESS ((vm_address_t) 0x00000000)
#define VM_MAX_ADDRESS ((vm_address_t) 0x80000000)
/* system-wide values */
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) 0)
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) VM_MAX_ADDRESS)
#elif defined (__arm64__)
#define VM_MIN_ADDRESS ((vm_address_t) 0x0000000000000000ULL)
#define VM_MAX_ADDRESS ((vm_address_t) 0x00000000F0000000ULL)
/* system-wide values */
#define MACH_VM_MIN_ADDRESS_RAW 0x0ULL
#define MACH_VM_MAX_ADDRESS_RAW 0x00007FFFFE000000ULL
#define MACH_VM_MIN_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_ADDRESS_RAW)
#define MACH_VM_MAX_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_ADDRESS_RAW)
#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW 0x0000001000000000ULL
#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW 0x0000007000000000ULL
#define MACH_VM_MIN_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MIN_GPU_CARVEOUT_ADDRESS_RAW)
#define MACH_VM_MAX_GPU_CARVEOUT_ADDRESS ((mach_vm_offset_t) MACH_VM_MAX_GPU_CARVEOUT_ADDRESS_RAW)
#else /* defined(__arm64__) */
#error architecture not supported
#endif
#define VM_MAP_MIN_ADDRESS VM_MIN_ADDRESS
#define VM_MAP_MAX_ADDRESS VM_MAX_ADDRESS
#endif /* !__ASSEMBLER__ */
#define SWI_SYSCALL 0x80
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_VM_PARAM_H_ */

View File

@@ -0,0 +1,162 @@
/*
* Copyright (c) 2000-2007 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
/*
* File: vm_types.h
* Author: Avadis Tevanian, Jr.
* Date: 1985
*
* Header file for VM data types. ARM version.
*/
#ifndef _MACH_ARM_VM_TYPES_H_
#define _MACH_ARM_VM_TYPES_H_
#if defined (__arm__) || defined (__arm64__)
#ifndef ASSEMBLER
#include <arm/_types.h>
#include <stdint.h>
#include <Availability.h>
#include <sys/cdefs.h>
/*
* natural_t and integer_t are Mach's legacy types for machine-
* independent integer types (unsigned, and signed, respectively).
* Their original purpose was to define other types in a machine/
* compiler independent way.
*
* They also had an implicit "same size as pointer" characteristic
* to them (i.e. Mach's traditional types are very ILP32 or ILP64
* centric). We will likely support x86 ABIs that do not follow
* either ofthese models (specifically LP64). Therefore, we had to
* make a choice between making these types scale with pointers or stay
* tied to integers. Because their use is predominantly tied to
* to the size of an integer, we are keeping that association and
* breaking free from pointer size guarantees.
*
* New use of these types is discouraged.
*/
typedef __darwin_natural_t natural_t;
typedef int integer_t;
/*
* A vm_offset_t is a type-neutral pointer,
* e.g. an offset into a virtual memory space.
*/
#ifdef __LP64__
typedef uintptr_t vm_offset_t __kernel_ptr_semantics;
typedef uintptr_t vm_size_t;
typedef uint64_t mach_vm_address_t __kernel_ptr_semantics;
typedef uint64_t mach_vm_offset_t __kernel_ptr_semantics;
typedef uint64_t mach_vm_size_t;
typedef uint64_t vm_map_offset_t __kernel_ptr_semantics;
typedef uint64_t vm_map_address_t __kernel_ptr_semantics;
typedef uint64_t vm_map_size_t;
#else
typedef natural_t vm_offset_t __kernel_ptr_semantics;
/*
* A vm_size_t is the proper type for e.g.
* expressing the difference between two
* vm_offset_t entities.
*/
typedef natural_t vm_size_t;
/*
* This new type is independent of a particular vm map's
* implementation size - and represents appropriate types
* for all possible maps. This is used for interfaces
* where the size of the map is not known - or we don't
* want to have to distinguish.
*/
#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0)
typedef uint32_t mach_vm_address_t;
typedef uint32_t mach_vm_offset_t;
typedef uint32_t mach_vm_size_t;
#else
typedef uint64_t mach_vm_address_t __kernel_ptr_semantics;
typedef uint64_t mach_vm_offset_t __kernel_ptr_semantics;
typedef uint64_t mach_vm_size_t;
#endif
typedef uint32_t vm_map_offset_t __kernel_ptr_semantics;
typedef uint32_t vm_map_address_t __kernel_ptr_semantics;
typedef uint32_t vm_map_size_t;
#endif /* __LP64__ */
typedef uint32_t vm32_offset_t;
typedef uint32_t vm32_address_t;
typedef uint32_t vm32_size_t;
typedef vm_offset_t mach_port_context_t;
#endif /* ASSEMBLER */
/*
* If composing messages by hand (please do not)
*/
#define MACH_MSG_TYPE_INTEGER_T MACH_MSG_TYPE_INTEGER_32
#endif /* defined (__arm__) || defined (__arm64__) */
#endif /* _MACH_ARM_VM_TYPES_H_ */

View File

@@ -31,6 +31,14 @@
#include <sys/cdefs.h>
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RENAME_SECLUDE 0x00000001
#define RENAME_SWAP 0x00000002
#define RENAME_EXCL 0x00000004
#define RENAME_RESERVED1 0x00000008
#define RENAME_NOFOLLOW_ANY 0x00000010
#endif
#if __DARWIN_C_LEVEL >= 200809L
#include <Availability.h>
@@ -40,9 +48,6 @@ int renameat(int, const char *, int, const char *) __OSX_AVAILABLE_STARTING(
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RENAME_SECLUDE 0x00000001
#define RENAME_SWAP 0x00000002
#define RENAME_EXCL 0x00000004
int renamex_np(const char *, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
int renameatx_np(int, const char *, int, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);

View File

@@ -31,14 +31,6 @@
#include <sys/cdefs.h>
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RENAME_SECLUDE 0x00000001
#define RENAME_SWAP 0x00000002
#define RENAME_EXCL 0x00000004
#define RENAME_RESERVED1 0x00000008
#define RENAME_NOFOLLOW_ANY 0x00000010
#endif
#if __DARWIN_C_LEVEL >= 200809L
#include <Availability.h>
@@ -48,6 +40,9 @@ int renameat(int, const char *, int, const char *) __OSX_AVAILABLE_STARTING(
#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
#define RENAME_SECLUDE 0x00000001
#define RENAME_SWAP 0x00000002
#define RENAME_EXCL 0x00000004
int renamex_np(const char *, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
int renameatx_np(int, const char *, int, const char *, unsigned int) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);

View File

@@ -132,130 +132,37 @@
#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 */
#ifndef __API_TO_BE_DEPRECATED_MACOS
#define __API_TO_BE_DEPRECATED_MACOS 100000
#endif
#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 */
#ifndef __API_TO_BE_DEPRECATED_IOS
#define __API_TO_BE_DEPRECATED_IOS 100000
#endif
#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
#ifndef __API_TO_BE_DEPRECATED_TVOS
#define __API_TO_BE_DEPRECATED_TVOS 100000
#endif
#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
#ifndef __API_TO_BE_DEPRECATED_WATCHOS
#define __API_TO_BE_DEPRECATED_WATCHOS 100000
#endif
#define __DRIVERKIT_19_0 190000
#endif /* __MAC_10_0 */
#ifndef __API_TO_BE_DEPRECATED_BRIDGEOS
#endif
#ifndef __API_TO_BE_DEPRECATED_MACCATALYST
#define __API_TO_BE_DEPRECATED_MACCATALYST 100000
#endif
#ifndef __API_TO_BE_DEPRECATED_DRIVERKIT
#define __API_TO_BE_DEPRECATED_DRIVERKIT 100000
#endif
#include <AvailabilityVersions.h>
#include <AvailabilityInternal.h>
#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
@@ -454,6 +361,8 @@
#endif
/* for use marking APIs unavailable for swift */
#if defined(__has_feature)
#if __has_feature(attribute_availability_swift)
@@ -501,9 +410,9 @@
* __API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0))
* __API_AVAILABLE(driverkit(19.0))
*/
#define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__)
#define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE8, __API_AVAILABLE7, __API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__)
#define __API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE_BEGIN7, __API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__)
#define __API_AVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_AVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_AVAILABLE_BEGIN8, __API_AVAILABLE_BEGIN7, __API_AVAILABLE_BEGIN6, __API_AVAILABLE_BEGIN5, __API_AVAILABLE_BEGIN4, __API_AVAILABLE_BEGIN3, __API_AVAILABLE_BEGIN2, __API_AVAILABLE_BEGIN1, 0)(__VA_ARGS__)
#define __API_AVAILABLE_END _Pragma("clang attribute pop")
/*
@@ -522,13 +431,13 @@
* __API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0))
* __API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0))
*/
#define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__)
#define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG9, __API_DEPRECATED_MSG8,__API_DEPRECATED_MSG7,__API_DEPRECATED_MSG6,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP9,__API_DEPRECATED_REP8,__API_DEPRECATED_REP7,__API_DEPRECATED_REP6,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_MSG9, __API_DEPRECATED_BEGIN_MSG8,__API_DEPRECATED_BEGIN_MSG7, __API_DEPRECATED_BEGIN_MSG6, __API_DEPRECATED_BEGIN_MSG5, __API_DEPRECATED_BEGIN_MSG4, __API_DEPRECATED_BEGIN_MSG3, __API_DEPRECATED_BEGIN_MSG2, __API_DEPRECATED_BEGIN_MSG1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_END _Pragma("clang attribute pop")
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_WITH_REPLACEMENT_BEGIN(...) _Pragma("clang attribute push") __API_DEPRECATED_BEGIN_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_BEGIN_REP9, __API_DEPRECATED_BEGIN_REP8,__API_DEPRECATED_BEGIN_REP7, __API_DEPRECATED_BEGIN_REP6, __API_DEPRECATED_BEGIN_REP5, __API_DEPRECATED_BEGIN_REP4, __API_DEPRECATED_BEGIN_REP3, __API_DEPRECATED_BEGIN_REP2, __API_DEPRECATED_BEGIN_REP1, 0)(__VA_ARGS__)
#define __API_DEPRECATED_WITH_REPLACEMENT_END _Pragma("clang attribute pop")
/*
@@ -539,9 +448,9 @@
* __API_UNAVAILABLE(macos)
* __API_UNAVAILABLE(watchos, tvos)
*/
#define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
#define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE8,__API_UNAVAILABLE7,__API_UNAVAILABLE6,__API_UNAVAILABLE5,__API_UNAVAILABLE4,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1, 0)(__VA_ARGS__)
#define __API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__)
#define __API_UNAVAILABLE_BEGIN(...) _Pragma("clang attribute push") __API_UNAVAILABLE_BEGIN_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE_BEGIN8,__API_UNAVAILABLE_BEGIN7,__API_UNAVAILABLE_BEGIN6, __API_UNAVAILABLE_BEGIN5, __API_UNAVAILABLE_BEGIN4, __API_UNAVAILABLE_BEGIN3, __API_UNAVAILABLE_BEGIN2, __API_UNAVAILABLE_BEGIN1, 0)(__VA_ARGS__)
#define __API_UNAVAILABLE_END _Pragma("clang attribute pop")
#else

View File

@@ -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 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_16_1
/* 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_9_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 70100
/* 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_13_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_16_1
#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)))
@@ -4452,6 +4455,7 @@
#endif
#define __API_AVAILABLE_PLATFORM_driverkit(x) driverkit,introduced=x
#if defined(__has_attribute)
#if __has_attribute(availability)
#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))
@@ -4469,7 +4473,8 @@
#define __API_AVAILABLE5(x,y,z,t,b) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b)
#define __API_AVAILABLE6(x,y,z,t,b,m) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) __API_A(m)
#define __API_AVAILABLE7(x,y,z,t,b,m,d) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) __API_A(m) __API_A(d)
#define __API_AVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME
#define __API_AVAILABLE8(x,y,z,t,b,m,d,l) __API_A(x) __API_A(y) __API_A(z) __API_A(t) __API_A(b) __API_A(m) __API_A(d) __API_A(l)
#define __API_AVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_APPLY_TO any(record, enum, enum_constant, function, objc_method, objc_category, objc_protocol, objc_interface, objc_property, type_alias, variable, field)
#define __API_RANGE_STRINGIFY(x) __API_RANGE_STRINGIFY2(x)
@@ -4484,7 +4489,8 @@
#define __API_AVAILABLE_BEGIN5(a,b,c,d,e) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e)
#define __API_AVAILABLE_BEGIN6(a,b,c,d,e,f) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) __API_A_BEGIN(f)
#define __API_AVAILABLE_BEGIN7(a,b,c,d,e,f,g) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) __API_A_BEGIN(f) __API_A_BEGIN(g)
#define __API_AVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME
#define __API_AVAILABLE_BEGIN8(a,b,c,d,e,f,g,h) __API_A_BEGIN(a) __API_A_BEGIN(b) __API_A_BEGIN(c) __API_A_BEGIN(d) __API_A_BEGIN(e) __API_A_BEGIN(f) __API_A_BEGIN(g) __API_A_BEGIN(h)
#define __API_AVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_PLATFORM_macos(x,y) macos,introduced=x,deprecated=y
@@ -4500,6 +4506,7 @@
#endif
#define __API_DEPRECATED_PLATFORM_driverkit(x,y) driverkit,introduced=x,deprecated=y
#if defined(__has_attribute)
#if __has_attribute(availability)
#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))
@@ -4517,7 +4524,8 @@
#define __API_DEPRECATED_MSG6(msg,x,y,z,t,b) __API_DEPRECATED_MSG5(msg,x,y,z,t) __API_D(msg,b)
#define __API_DEPRECATED_MSG7(msg,x,y,z,t,b,m) __API_DEPRECATED_MSG6(msg,x,y,z,t,b) __API_D(msg,m)
#define __API_DEPRECATED_MSG8(msg,x,y,z,t,b,m,d) __API_DEPRECATED_MSG7(msg,x,y,z,t,b,m) __API_D(msg,d)
#define __API_DEPRECATED_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_MSG9(msg,x,y,z,t,b,m,d,l) __API_DEPRECATED_MSG8(msg,x,y,z,t,b,m,d) __API_D(msg,l)
#define __API_DEPRECATED_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
#define __API_D_BEGIN(msg, x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg))), apply_to = __API_APPLY_TO)))
@@ -4528,7 +4536,8 @@
#define __API_DEPRECATED_BEGIN_MSG6(msg,a,b,c,d,e) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e)
#define __API_DEPRECATED_BEGIN_MSG7(msg,a,b,c,d,e,f) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) __API_D_BEGIN(msg,f)
#define __API_DEPRECATED_BEGIN_MSG8(msg,a,b,c,d,e,f,g) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) __API_D_BEGIN(msg,f) __API_D_BEGIN(msg,g)
#define __API_DEPRECATED_BEGIN_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_BEGIN_MSG9(msg,a,b,c,d,e,f,g,h) __API_D_BEGIN(msg,a) __API_D_BEGIN(msg,b) __API_D_BEGIN(msg,c) __API_D_BEGIN(msg,d) __API_D_BEGIN(msg,e) __API_D_BEGIN(msg,f) __API_D_BEGIN(msg,g) __API_D_BEGIN(msg,h)
#define __API_DEPRECATED_BEGIN_MSG_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
#if __has_feature(attribute_availability_with_replacement)
#define __API_R(rep,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,replacement=rep)))
@@ -4543,7 +4552,8 @@
#define __API_DEPRECATED_REP6(rep,x,y,z,t,b) __API_DEPRECATED_REP5(rep,x,y,z,t) __API_R(rep,b)
#define __API_DEPRECATED_REP7(rep,x,y,z,t,b,m) __API_DEPRECATED_REP6(rep,x,y,z,t,b) __API_R(rep,m)
#define __API_DEPRECATED_REP8(rep,x,y,z,t,b,m,d) __API_DEPRECATED_REP7(rep,x,y,z,t,b,m) __API_R(rep,d)
#define __API_DEPRECATED_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_REP9(rep,x,y,z,t,b,m,d,l) __API_DEPRECATED_REP8(rep,x,y,z,t,b,m,d) __API_R(rep,l)
#define __API_DEPRECATED_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
#if __has_feature(attribute_availability_with_replacement)
#define __API_R_BEGIN(rep,x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_DEPRECATED_PLATFORM_##x,replacement=rep))), apply_to = __API_APPLY_TO)))
@@ -4558,7 +4568,9 @@
#define __API_DEPRECATED_BEGIN_REP6(rep,a,b,c,d,e) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e)
#define __API_DEPRECATED_BEGIN_REP7(rep,a,b,c,d,e,f) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) __API_R_BEGIN(rep,f)
#define __API_DEPRECATED_BEGIN_REP8(rep,a,b,c,d,e,f,g) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) __API_R_BEGIN(rep,f) __API_R_BEGIN(rep,g)
#define __API_DEPRECATED_BEGIN_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_DEPRECATED_BEGIN_REP9(rep,a,b,c,d,e,f,g,h) __API_R_BEGIN(rep,a) __API_R_BEGIN(rep,b) __API_R_BEGIN(rep,c) __API_R_BEGIN(rep,d) __API_R_BEGIN(rep,e) __API_R_BEGIN(rep,f) __API_R_BEGIN(rep,g) __API_R_BEGIN(rep,h)
#define __API_DEPRECATED_BEGIN_REP_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
/*
* API Unavailability
@@ -4581,6 +4593,7 @@
#endif
#define __API_UNAVAILABLE_PLATFORM_driverkit driverkit,unavailable
#if defined(__has_attribute)
#if __has_attribute(availability)
#define __API_U(x) __attribute__((availability(__API_UNAVAILABLE_PLATFORM_##x)))
@@ -4598,7 +4611,8 @@
#define __API_UNAVAILABLE5(x,y,z,t,b) __API_UNAVAILABLE4(x,y,z,t) __API_U(b)
#define __API_UNAVAILABLE6(x,y,z,t,b,m) __API_UNAVAILABLE5(x,y,z,t,b) __API_U(m)
#define __API_UNAVAILABLE7(x,y,z,t,b,m,d) __API_UNAVAILABLE6(x,y,z,t,b,m) __API_U(d)
#define __API_UNAVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME
#define __API_UNAVAILABLE8(x,y,z,t,b,m,d,l) __API_UNAVAILABLE7(x,y,z,t,b,m,d) __API_U(l)
#define __API_UNAVAILABLE_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define __API_U_BEGIN(x) _Pragma(__API_RANGE_STRINGIFY (clang attribute (__attribute__((availability(__API_UNAVAILABLE_PLATFORM_##x))), apply_to = __API_APPLY_TO)))
@@ -4608,8 +4622,9 @@
#define __API_UNAVAILABLE_BEGIN4(a,b,c,d) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d)
#define __API_UNAVAILABLE_BEGIN5(a,b,c,d,e) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e)
#define __API_UNAVAILABLE_BEGIN6(a,b,c,d,e,f) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f)
#define __API_UNAVAILABLE_BEGIN7(a,b,c,d,e,f) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) __API_U_BEGIN(g)
#define __API_UNAVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,NAME,...) NAME
#define __API_UNAVAILABLE_BEGIN7(a,b,c,d,e,f,g) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) __API_U_BEGIN(g)
#define __API_UNAVAILABLE_BEGIN8(a,b,c,d,e,f,g,h) __API_U_BEGIN(a) __API_U_BEGIN(b) __API_U_BEGIN(c) __API_U_BEGIN(d) __API_U_BEGIN(e) __API_U_BEGIN(f) __API_U_BEGIN(g) __API_U_BEGIN(h)
#define __API_UNAVAILABLE_BEGIN_GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#else
/*
@@ -4643,7 +4658,7 @@
/*
* Swift compiler version
* Allows for project-agnostic epochs for frameworks imported into Swift via the Clang importer, like #if _compiler_version for Swift
* Allows for project-agnostic "epochs" for frameworks imported into Swift via the Clang importer, like #if _compiler_version for Swift
* Example:
*
* #if __swift_compiler_version_at_least(800, 2, 20)

View File

@@ -117,9 +117,14 @@
#define MAC_OS_X_VERSION_10_14_1 101401
#define MAC_OS_X_VERSION_10_14_4 101404
#define MAC_OS_X_VERSION_10_15 101500
#define MAC_OS_X_VERSION_10_15_1 101501
#define MAC_OS_VERSION_11_0 110000
#define MAC_OS_VERSION_11_1 110100
#define MAC_OS_VERSION_11_3 110300
#define MAC_OS_VERSION_12_0 120000
#define MAC_OS_VERSION_13_0 130000
#define MAC_OS_VERSION_13_1 130100
/*
/*
* If min OS not specified, assume 10.4 for intel
* Note: compiler driver may set _ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED_ based on MACOSX_DEPLOYMENT_TARGET environment variable
*/
@@ -144,10 +149,10 @@
* if max OS not specified, assume larger of (10.15, min)
*/
#ifndef MAC_OS_X_VERSION_MAX_ALLOWED
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_15
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_VERSION_13_1
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_MIN_REQUIRED
#else
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_15
#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_VERSION_13_1
#endif
#endif

View File

@@ -0,0 +1,255 @@
/*
* 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
#define __MAC_11_1 110100
#define __MAC_11_3 110300
#define __MAC_11_4 110400
#define __MAC_11_5 110500
#define __MAC_11_6 110600
#define __MAC_12_0 120000
#define __MAC_12_1 120100
#define __MAC_12_2 120200
#define __MAC_12_3 120300
#define __MAC_13_0 130000
/* __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
#define __IPHONE_14_3 140300
#define __IPHONE_14_5 140500
#define __IPHONE_14_6 140600
#define __IPHONE_14_7 140700
#define __IPHONE_14_8 140800
#define __IPHONE_15_0 150000
#define __IPHONE_15_1 150100
#define __IPHONE_15_2 150200
#define __IPHONE_15_3 150300
#define __IPHONE_15_4 150400
#define __IPHONE_16_0 160000
#define __IPHONE_16_1 160100
/* __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 __TVOS_14_3 140300
#define __TVOS_14_5 140500
#define __TVOS_14_6 140600
#define __TVOS_14_7 140700
#define __TVOS_15_0 150000
#define __TVOS_15_1 150100
#define __TVOS_15_2 150200
#define __TVOS_15_3 150300
#define __TVOS_15_4 150400
#define __TVOS_16_0 160000
#define __TVOS_16_1 160100
#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
#define __WATCHOS_7_2 70200
#define __WATCHOS_7_3 70300
#define __WATCHOS_7_4 70400
#define __WATCHOS_7_5 70500
#define __WATCHOS_7_6 70600
#define __WATCHOS_8_0 80000
#define __WATCHOS_8_1 80100
#define __WATCHOS_8_3 80300
#define __WATCHOS_8_4 80400
#define __WATCHOS_8_5 80500
#define __WATCHOS_9_0 90000
#define __WATCHOS_9_1 90100
/*
* 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
#define MAC_OS_VERSION_12_0 120000
#define MAC_OS_VERSION_13_0 130000
#endif /* #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE) */
#define __DRIVERKIT_19_0 190000
#define __DRIVERKIT_20_0 200000
#define __DRIVERKIT_21_0 210000
#endif /* __AVAILABILITY_VERSIONS__ */

View File

@@ -0,0 +1,65 @@
/*
* 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>
#include <sys/cdefs.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 *__single _Block_copy(const void *__single 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 *__single 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

View File

@@ -0,0 +1,137 @@
/*
* Copyright (c) 2004-2021 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
__ptrcheck_abi_assume_single()
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 *__unsafe_indexable from, const char *__unsafe_indexable 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 *__unsafe_indexable, const char *__unsafe_indexable, 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_STATE_SRC_BSIZE 11
#define COPYFILE_STATE_DST_BSIZE 12
#define COPYFILE_STATE_BSIZE 13
#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_ */

View File

@@ -127,6 +127,33 @@
#define DISPATCH_UNAVAILABLE_MSG(msg)
#endif
#if defined(__cplusplus)
# if __cplusplus >= 201703L
# define DISPATCH_FALLTHROUGH [[fallthrough]]
# elif __cplusplus >= 201103L
# if defined(__clang__)
# define DISPATCH_FALLTHROUGH [[clang::fallthrough]]
# elif defined(__GNUC__) && __GNUC__ >= 7
# define DISPATCH_FALLTHROUGH [[gnu::fallthrough]]
# else
# define DISPATCH_FALLTHROUGH
# endif
# else
# define DISPATCH_FALLTHROUGH
# endif
#elif defined(__GNUC__) && __GNUC__ >= 7
# define DISPATCH_FALLTHROUGH __attribute__((__fallthrough__))
#elif defined(__clang__)
# if __has_attribute(fallthrough) && __clang_major__ >= 5
# define DISPATCH_FALLTHROUGH __attribute__((__fallthrough__))
# else
# define DISPATCH_FALLTHROUGH
# endif
#else
# define DISPATCH_FALLTHROUGH
#endif
#define DISPATCH_LINUX_UNAVAILABLE()
#ifdef __FreeBSD__
@@ -203,6 +230,20 @@
#define DISPATCH_ASSUME_NONNULL_END
#endif
#if __has_feature(bounds_attributes)
#define DISPATCH_ASSUME_ABI_SINGLE_BEGIN _Pragma("clang abi_ptr_attr set(single)")
#define DISPATCH_ASSUME_ABI_SINGLE_END _Pragma("clang abi_ptr_attr set(unsafe_indexable)")
#define DISPATCH_UNSAFE_INDEXABLE __attribute__((__unsafe_indexable__))
#define DISPATCH_COUNTED_BY(X) __attribute__((__counted_by__(X)))
#define DISPATCH_SIZED_BY(X) __attribute__((__sized_by__(X)))
#else
#define DISPATCH_ASSUME_ABI_SINGLE_BEGIN
#define DISPATCH_ASSUME_ABI_SINGLE_END
#define DISPATCH_UNSAFE_INDEXABLE
#define DISPATCH_COUNTED_BY(X)
#define DISPATCH_SIZED_BY(X)
#endif
#if !__has_feature(nullability)
#ifndef _Nullable
#define _Nullable
@@ -301,6 +342,10 @@
#define DISPATCH_TRANSPARENT_UNION
#endif
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
typedef void (*dispatch_function_t)(void *_Nullable);
DISPATCH_ASSUME_ABI_SINGLE_END
#endif

View File

@@ -33,6 +33,7 @@
*/
DISPATCH_ASSUME_NONNULL_BEGIN
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
__BEGIN_DECLS
@@ -323,7 +324,7 @@ dispatch_block_perform(dispatch_block_flags_t flags,
*/
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
long
intptr_t
dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);
/*!
@@ -416,11 +417,12 @@ dispatch_block_cancel(dispatch_block_t block);
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
long
intptr_t
dispatch_block_testcancel(dispatch_block_t block);
__END_DECLS
DISPATCH_ASSUME_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif // __BLOCKS__

View File

@@ -0,0 +1,280 @@
/*
* 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
DISPATCH_ASSUME_ABI_SINGLE_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 *DISPATCH_SIZED_BY(size) 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 DISPATCH_SIZED_BY(*size_ptr) *_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 *DISPATCH_SIZED_BY(size) 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_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif /* __DISPATCH_DATA__ */

View File

@@ -27,6 +27,7 @@
#endif
DISPATCH_ASSUME_NONNULL_BEGIN
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
/*!
* @typedef dispatch_group_t
@@ -160,7 +161,7 @@ dispatch_group_async_f(dispatch_group_t group,
*/
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
long
intptr_t
dispatch_group_wait(dispatch_group_t group, dispatch_time_t timeout);
/*!
@@ -274,6 +275,7 @@ dispatch_group_leave(dispatch_group_t group);
__END_DECLS
DISPATCH_ASSUME_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif

View File

@@ -0,0 +1,599 @@
/*
* 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
DISPATCH_ASSUME_ABI_SINGLE_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 *DISPATCH_UNSAFE_INDEXABLE 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_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif /* __DISPATCH_IO__ */

View File

@@ -31,6 +31,7 @@
#endif
DISPATCH_ASSUME_NONNULL_BEGIN
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
/*!
* @typedef dispatch_object_t
@@ -456,7 +457,7 @@ dispatch_set_qos_class_floor(dispatch_object_t object,
*/
DISPATCH_UNAVAILABLE
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
long
intptr_t
dispatch_wait(void *object, dispatch_time_t timeout);
#if __has_extension(c_generic_selections)
#define dispatch_wait(object, timeout) \
@@ -554,7 +555,7 @@ dispatch_cancel(void *object);
DISPATCH_UNAVAILABLE
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
long
intptr_t
dispatch_testcancel(void *object);
#if __has_extension(c_generic_selections)
#define dispatch_testcancel(object) \
@@ -591,16 +592,19 @@ 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, ...);
dispatch_debug(dispatch_object_t object,
const char *DISPATCH_UNSAFE_INDEXABLE 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);
dispatch_debugv(dispatch_object_t object,
const char *DISPATCH_UNSAFE_INDEXABLE message, va_list ap);
__END_DECLS
DISPATCH_ASSUME_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif

View File

@@ -0,0 +1,127 @@
/*
* 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
DISPATCH_ASSUME_ABI_SINGLE_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_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif

View File

@@ -27,6 +27,7 @@
#endif
DISPATCH_ASSUME_NONNULL_BEGIN
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
/*!
* @header
@@ -336,7 +337,7 @@ dispatch_sync_f(dispatch_queue_t queue,
* <b>Differences with dispatch_sync()</b>
*
* Work items submitted to a queue with dispatch_async_and_wait() observe all
* queue attributes of that queue when invoked (inluding autorelease frequency
* queue attributes of that queue when invoked (including autorelease frequency
* or QOS class).
*
* When the runtime has brought up a thread to invoke the asynchronous workitems
@@ -473,6 +474,9 @@ dispatch_async_and_wait_f(dispatch_queue_t queue,
* @param block
* The block to be invoked the specified number of iterations.
* The result of passing NULL in this parameter is undefined.
* This function performs a Block_copy() and Block_release() of the input block
* on behalf of the callers. To elide the additional block allocation,
* dispatch_apply_f may be used instead.
*/
#ifdef __BLOCKS__
API_AVAILABLE(macos(10.6), ios(4.0))
@@ -480,7 +484,7 @@ DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NOTHROW
void
dispatch_apply(size_t iterations,
dispatch_queue_t DISPATCH_APPLY_QUEUE_ARG_NULLABILITY queue,
DISPATCH_NOESCAPE void (^block)(size_t));
DISPATCH_NOESCAPE void (^block)(size_t iteration));
#endif
/*!
@@ -515,7 +519,7 @@ DISPATCH_EXPORT DISPATCH_NONNULL4 DISPATCH_NOTHROW
void
dispatch_apply_f(size_t iterations,
dispatch_queue_t DISPATCH_APPLY_QUEUE_ARG_NULLABILITY queue,
void *_Nullable context, void (*work)(void *_Nullable, size_t));
void *_Nullable context, void (*work)(void *_Nullable context, size_t iteration));
/*!
* @function dispatch_get_current_queue
@@ -661,7 +665,7 @@ typedef long dispatch_queue_priority_t;
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_CONST DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_queue_global_t
dispatch_get_global_queue(long identifier, unsigned long flags);
dispatch_get_global_queue(intptr_t identifier, uintptr_t flags);
/*!
* @typedef dispatch_queue_attr_t
@@ -988,7 +992,7 @@ API_AVAILABLE(macos(10.12), ios(10.0), tvos(10.0), watchos(3.0))
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
DISPATCH_NOTHROW
dispatch_queue_t
dispatch_queue_create_with_target(const char *_Nullable label,
dispatch_queue_create_with_target(const char *_Nullable DISPATCH_UNSAFE_INDEXABLE label,
dispatch_queue_attr_t _Nullable attr, dispatch_queue_t _Nullable target)
DISPATCH_ALIAS_V2(dispatch_queue_create_with_target);
@@ -1023,6 +1027,8 @@ dispatch_queue_create_with_target(const char *_Nullable label,
* When no quality of service class is specified, the target queue of a newly
* created dispatch queue is the default priority global concurrent queue.
*
* Unless explicitly specified via the attribute, queues are created active.
*
* @param label
* A string label to attach to the queue.
* This parameter is optional and may be NULL.
@@ -1039,7 +1045,7 @@ API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
DISPATCH_NOTHROW
dispatch_queue_t
dispatch_queue_create(const char *_Nullable label,
dispatch_queue_create(const char *_Nullable DISPATCH_UNSAFE_INDEXABLE label,
dispatch_queue_attr_t _Nullable attr);
/*!
@@ -1157,7 +1163,9 @@ dispatch_queue_get_qos_class(dispatch_queue_t queue,
* terminated.
*
* If a dispatch queue is active and targeted by other dispatch objects,
* changing its target queue results in undefined behavior.
* changing its target queue results in undefined behavior. Instead, it is
* recommended to create dispatch objects in an inactive state, set up the
* relevant target queues and then activate them.
*
* @param object
* The object to modify.
@@ -1669,6 +1677,7 @@ dispatch_assert_queue_not(dispatch_queue_t queue)
__END_DECLS
DISPATCH_ASSUME_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif

View File

@@ -27,6 +27,7 @@
#endif
DISPATCH_ASSUME_NONNULL_BEGIN
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
/*!
* @typedef dispatch_semaphore_t
@@ -61,7 +62,7 @@ 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(long value);
dispatch_semaphore_create(intptr_t value);
/*!
* @function dispatch_semaphore_wait
@@ -71,7 +72,9 @@ dispatch_semaphore_create(long value);
*
* @discussion
* Decrement the counting semaphore. If the resulting value is less than zero,
* this function waits for a signal to occur before returning.
* this function waits for a signal to occur before returning. If the timeout is
* reached without a signal being received, the semaphore is re-incremented
* before the function returns.
*
* @param dsema
* The semaphore. The result of passing NULL in this parameter is undefined.
@@ -85,7 +88,7 @@ dispatch_semaphore_create(long value);
*/
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
long
intptr_t
dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);
/*!
@@ -107,11 +110,12 @@ dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);
*/
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
long
intptr_t
dispatch_semaphore_signal(dispatch_semaphore_t dsema);
__END_DECLS
DISPATCH_ASSUME_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif /* __DISPATCH_SEMAPHORE__ */

View File

@@ -36,6 +36,7 @@
#endif
DISPATCH_ASSUME_NONNULL_BEGIN
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
/*!
* @header
@@ -389,7 +390,7 @@ DISPATCH_NOTHROW
dispatch_source_t
dispatch_source_create(dispatch_source_type_t type,
uintptr_t handle,
unsigned long mask,
uintptr_t mask,
dispatch_queue_t _Nullable queue);
/*!
@@ -537,7 +538,7 @@ dispatch_source_cancel(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
long
intptr_t
dispatch_source_testcancel(dispatch_source_t source);
/*!
@@ -601,7 +602,7 @@ dispatch_source_get_handle(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
unsigned long
uintptr_t
dispatch_source_get_mask(dispatch_source_t source);
/*!
@@ -640,7 +641,7 @@ dispatch_source_get_mask(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
unsigned long
uintptr_t
dispatch_source_get_data(dispatch_source_t source);
/*!
@@ -662,7 +663,7 @@ dispatch_source_get_data(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_source_merge_data(dispatch_source_t source, unsigned long value);
dispatch_source_merge_data(dispatch_source_t source, uintptr_t value);
/*!
* @function dispatch_source_set_timer
@@ -775,6 +776,7 @@ dispatch_source_set_registration_handler_f(dispatch_source_t source,
__END_DECLS
DISPATCH_ASSUME_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif

View File

@@ -0,0 +1,138 @@
/*
* 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
DISPATCH_ASSUME_ABI_SINGLE_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_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif

View File

@@ -27,6 +27,7 @@
#endif
DISPATCH_ASSUME_NONNULL_BEGIN
DISPATCH_ASSUME_ABI_SINGLE_BEGIN
__BEGIN_DECLS
@@ -39,7 +40,9 @@ __BEGIN_DECLS
* @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).
* ordering). Dispatch workloops are an exclusion context and it is guaranteed
* that only one work item submitted to the dispatch workloop will be invoked at
* a time.
*
* Between each workitem invocation, the workloop will evaluate whether higher
* priority workitems have since been submitted, either directly to the
@@ -75,7 +78,7 @@ 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);
dispatch_workloop_create(const char *DISPATCH_UNSAFE_INDEXABLE _Nullable label);
/*!
* @function dispatch_workloop_create_inactive
@@ -101,7 +104,7 @@ 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);
dispatch_workloop_create_inactive(const char *DISPATCH_UNSAFE_INDEXABLE _Nullable label);
/*!
* @function dispatch_workloop_set_autorelease_frequency
@@ -129,8 +132,36 @@ 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_ABI_SINGLE_END
DISPATCH_ASSUME_NONNULL_END
#endif

View 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);
#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_ */

View File

@@ -0,0 +1,411 @@
#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_BUNDLEPROGRAM "BundleProgram"
#define LAUNCH_JOBKEY_ASSOCIATEDBUNDLEIDENTIFIERS "AssociatedBundleIdentifiers"
#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 * _Nullable
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__

View File

@@ -31,10 +31,12 @@
#include <sys/resource.h>
#include <stdint.h>
#include <stdbool.h>
#include <mach/message.h> /* for audit_token_t */
#include <sys/proc_info.h>
#include <Availability.h>
#include <os/availability.h>
/*
* This header file contains private interfaces to obtain process information.
@@ -98,6 +100,7 @@ int proc_name(int pid, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_START
int proc_regionfilename(int pid, uint64_t address, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_kmsgbuf(void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_pidpath(int pid, void * buffer, uint32_t buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
int proc_pidpath_audittoken(audit_token_t *audittoken, void * buffer, uint32_t buffersize) API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
int proc_libversion(int *major, int * minor) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
/*
@@ -125,28 +128,46 @@ int proc_get_dirty(pid_t pid, uint32_t *flags);
int proc_clear_dirty(pid_t pid, uint32_t flags);
int proc_terminate(pid_t pid, int *sig);
int proc_terminate_all_rsr(int sig);
#ifdef PRIVATE
#include <sys/event.h>
/*
* Enumerate potential userspace pointers embedded in kernel data structures.
* Currently inspects kqueues only.
* NO_SMT means that on an SMT CPU, this thread must be scheduled alone,
* with the paired CPU idle.
*
* NOTE: returned "pointers" are opaque user-supplied values and thus not
* guaranteed to address valid objects or be pointers at all.
*
* Returns the number of pointers found (which may exceed buffersize), or -1 on
* failure and errno set appropriately.
* Set NO_SMT on the current proc (all existing and future threads)
* This attribute is inherited on fork and exec
*/
int proc_list_uptrs(pid_t pid, uint64_t *buffer, uint32_t buffersize);
int proc_set_no_smt(void) __API_AVAILABLE(macos(11.0));
int proc_list_dynkqueueids(int pid, kqueue_id_t *buf, uint32_t bufsz);
int proc_piddynkqueueinfo(int pid, int flavor, kqueue_id_t kq_id, void *buffer,
int buffersize);
#endif /* PRIVATE */
/* Set NO_SMT on the current thread */
int proc_setthread_no_smt(void) __API_AVAILABLE(macos(11.0));
/*
* CPU Security Mitigation APIs
*
* Set CPU security mitigation on the current proc (all existing and future threads)
* This attribute is inherited on fork and exec
*/
int proc_set_csm(uint32_t flags) __API_AVAILABLE(macos(11.0));
/* Set CPU security mitigation on the current thread */
int proc_setthread_csm(uint32_t flags) __API_AVAILABLE(macos(11.0));
/*
* flags for CPU Security Mitigation APIs
* PROC_CSM_ALL should be used in most cases,
* the individual flags are provided only for performance evaluation etc
*/
#define PROC_CSM_ALL 0x0001 /* Set all available mitigations */
#define PROC_CSM_NOSMT 0x0002 /* Set NO_SMT - see above */
#define PROC_CSM_TECS 0x0004 /* Execute VERW on every return to user mode */
int proc_udata_info(int pid, int flavor, void *buffer, int buffersize);
#if __has_include(<libproc_private.h>)
#include <libproc_private.h>
#endif
__END_DECLS
#endif /*_LIBPROC_H_ */

View File

@@ -0,0 +1,159 @@
/*
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#ifndef _MACH_O_ARCH_H_
#define _MACH_O_ARCH_H_
/*
* Copyright (c) 1997 Apple Computer, Inc.
*
* Functions that deal with information about architectures.
*
*/
#include <stdint.h>
#include <mach/machine.h>
#include <architecture/byte_order.h>
#include <Availability.h>
#include <TargetConditionals.h>
#ifndef __CCTOOLS_DEPRECATED
#define __CCTOOLS_DEPRECATED __API_DEPRECATED("No longer supported", macos(10.0, 13.0), ios(1.0, 16.0), watchos(1.0, 8.0), tvos(1.0, 16.0))
#define __CCTOOLS_DEPRECATED_MSG(_msg) __API_DEPRECATED_WITH_REPLACEMENT(_msg, macos(10.0, 13.0), ios(1.0, 16.0), watchos(1.0, 8.0), tvos(1.0, 16.0))
#endif
/* The NXArchInfo structs contain the architectures symbolic name
* (such as "ppc"), its CPU type and CPU subtype as defined in
* mach/machine.h, the byte order for the architecture, and a
* describing string (such as "PowerPC").
* There will both be entries for specific CPUs (such as ppc604e) as
* well as generic "family" entries (such as ppc).
*/
struct NXArchInfo {
const char *name;
cpu_type_t cputype;
cpu_subtype_t cpusubtype;
enum NXByteOrder byteorder;
const char *description;
} __CCTOOLS_DEPRECATED;
typedef struct NXArchInfo NXArchInfo __CCTOOLS_DEPRECATED;
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* NXGetAllArchInfos() returns a pointer to an array of all known
* NXArchInfo structures. The last NXArchInfo is marked by a NULL name.
*/
extern const NXArchInfo *NXGetAllArchInfos(void) __CCTOOLS_DEPRECATED;
/* NXGetLocalArchInfo() returns the NXArchInfo for the local host, or NULL
* if none is known.
*/
extern const NXArchInfo *NXGetLocalArchInfo(void) __CCTOOLS_DEPRECATED_MSG("use macho_arch_name_for_mach_header()");
/* NXGetArchInfoFromName() and NXGetArchInfoFromCpuType() return the
* NXArchInfo from the architecture's name or cputype/cpusubtype
* combination. A cpusubtype of CPU_SUBTYPE_MULTIPLE can be used
* to request the most general NXArchInfo known for the given cputype.
* NULL is returned if no matching NXArchInfo can be found.
*/
extern const NXArchInfo *NXGetArchInfoFromName(const char *name) __CCTOOLS_DEPRECATED_MSG("use macho_cpu_type_for_arch_name()");
extern const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
cpu_subtype_t cpusubtype) __CCTOOLS_DEPRECATED_MSG("use macho_arch_name_for_cpu_type()");
/* The above interfaces that return pointers to NXArchInfo structs in normal
* cases returns a pointer from the array returned in NXGetAllArchInfos().
* In some cases when the cputype is CPU_TYPE_I386 or CPU_TYPE_POWERPC it will
* retun malloc(3)'ed NXArchInfo struct which contains a string in the
* description field also a malloc(3)'ed pointer. To allow programs not to
* leak memory they can call NXFreeArchInfo() on pointers returned from the
* above interfaces. Since this is a new API on older systems can use the
* code below. Going forward the above interfaces will only return pointers
* from the array returned in NXGetAllArchInfos().
*/
extern void NXFreeArchInfo(const NXArchInfo *x) __CCTOOLS_DEPRECATED_MSG("NXArchInfo is deprecated");
/* The code that can be used for NXFreeArchInfo() when it is not available is:
*
* static void NXFreeArchInfo(
* const NXArchInfo *x)
* {
* const NXArchInfo *p;
*
* p = NXGetAllArchInfos();
* while(p->name != NULL){
* if(x == p)
* return;
* p++;
* }
* free((char *)x->description);
* free((NXArchInfo *)x);
* }
*/
/* NXFindBestFatArch() is passed a cputype and cpusubtype and a set of
* fat_arch structs and selects the best one that matches (if any) and returns
* a pointer to that fat_arch struct (or NULL). The fat_arch structs must be
* in the host byte order and correct such that the fat_archs really points to
* enough memory for nfat_arch structs. It is possible that this routine could
* fail if new cputypes or cpusubtypes are added and an old version of this
* routine is used. But if there is an exact match between the cputype and
* cpusubtype and one of the fat_arch structs this routine will always succeed.
*/
extern struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
cpu_subtype_t cpusubtype,
struct fat_arch *fat_archs,
uint32_t nfat_archs) __CCTOOLS_DEPRECATED_MSG("use macho_best_slice()");
/* NXFindBestFatArch_64() is passed a cputype and cpusubtype and a set of
* fat_arch_64 structs and selects the best one that matches (if any) and
* returns a pointer to that fat_arch_64 struct (or NULL). The fat_arch_64
* structs must be in the host byte order and correct such that the fat_archs64
* really points to enough memory for nfat_arch structs. It is possible that
* this routine could fail if new cputypes or cpusubtypes are added and an old
* version of this routine is used. But if there is an exact match between the
* cputype and cpusubtype and one of the fat_arch_64 structs this routine will
* always succeed.
*/
extern struct fat_arch_64 *NXFindBestFatArch_64(cpu_type_t cputype,
cpu_subtype_t cpusubtype,
struct fat_arch_64 *fat_archs64,
uint32_t nfat_archs) __CCTOOLS_DEPRECATED_MSG("use macho_best_slice()");
/* NXCombineCpuSubtypes() returns the resulting cpusubtype when combining two
* different cpusubtypes for the specified cputype. If the two cpusubtypes
* can't be combined (the specific subtypes are mutually exclusive) -1 is
* returned indicating it is an error to combine them. This can also fail and
* return -1 if new cputypes or cpusubtypes are added and an old version of
* this routine is used. But if the cpusubtypes are the same they can always
* be combined and this routine will return the cpusubtype pass in.
*/
extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype,
cpu_subtype_t cpusubtype1,
cpu_subtype_t cpusubtype2) __CCTOOLS_DEPRECATED_MSG("cpu subtypes are no longer combinable");
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _MACH_O_ARCH_H_ */

View File

@@ -0,0 +1,86 @@
/*
* Copyright (c) 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 _MACH_O_FAT_H_
#define _MACH_O_FAT_H_
/*
* This header file describes the structures of the file format for "fat"
* architecture specific file (wrapper design). At the begining of the file
* there is one fat_header structure followed by a number of fat_arch
* structures. For each architecture in the file, specified by a pair of
* cputype and cpusubtype, the fat_header describes the file offset, file
* size and alignment in the file of the architecture specific member.
* The padded bytes in the file to place each member on it's specific alignment
* are defined to be read as zeros and can be left as "holes" if the file system
* can support them as long as they read as zeros.
*
* All structures defined here are always written and read to/from disk
* in big-endian order.
*/
/*
* <mach/machine.h> is needed here for the cpu_type_t and cpu_subtype_t types
* and contains the constants for the possible values of these types.
*/
#include <stdint.h>
#include <mach/machine.h>
#if __has_include(<architecture/byte_order.h>)
#include <architecture/byte_order.h>
#endif
#define FAT_MAGIC 0xcafebabe
#define FAT_CIGAM 0xbebafeca /* NXSwapLong(FAT_MAGIC) */
struct fat_header {
uint32_t magic; /* FAT_MAGIC or FAT_MAGIC_64 */
uint32_t nfat_arch; /* number of structs that follow */
};
struct fat_arch {
cpu_type_t cputype; /* cpu specifier (int) */
cpu_subtype_t cpusubtype; /* machine specifier (int) */
uint32_t offset; /* file offset to this object file */
uint32_t size; /* size of this object file */
uint32_t align; /* alignment as a power of 2 */
};
/*
* The support for the 64-bit fat file format described here is a work in
* progress and not yet fully supported in all the Apple Developer Tools.
*
* When a slice is greater than 4mb or an offset to a slice is greater than 4mb
* then the 64-bit fat file format is used.
*/
#define FAT_MAGIC_64 0xcafebabf
#define FAT_CIGAM_64 0xbfbafeca /* NXSwapLong(FAT_MAGIC_64) */
struct fat_arch_64 {
cpu_type_t cputype; /* cpu specifier (int) */
cpu_subtype_t cpusubtype; /* machine specifier (int) */
uint64_t offset; /* file offset to this object file */
uint64_t size; /* size of this object file */
uint32_t align; /* alignment as a power of 2 */
uint32_t reserved; /* reserved */
};
#endif /* _MACH_O_FAT_H_ */

View File

@@ -32,20 +32,28 @@
* <mach/machine.h> is needed here for the cpu_type_t and cpu_subtype_t types
* and contains the constants for the possible values of these types.
*/
#if __has_include(<mach/machine.h>)
#include <mach/machine.h>
#endif
/*
* <mach/vm_prot.h> is needed here for the vm_prot_t type and contains the
* constants that are or'ed together for the possible values of this type.
*/
#if __has_include(<mach/vm_prot.h>)
#include <mach/vm_prot.h>
#endif
/*
* <machine/thread_status.h> is expected to define the flavors of the thread
* states and the structures of those flavors for each machine.
*/
#if __has_include(<mach/machine/thread_status.h>)
#include <mach/machine/thread_status.h>
#endif
#if __has_include(<architecture/byte_order.h>)
#include <architecture/byte_order.h>
#endif
/*
* The 32-bit mach header appears at the very beginning of the object file for
@@ -53,8 +61,8 @@
*/
struct mach_header {
uint32_t magic; /* mach magic number identifier */
cpu_type_t cputype; /* cpu specifier */
cpu_subtype_t cpusubtype; /* machine specifier */
int32_t cputype; /* cpu specifier */
int32_t cpusubtype; /* machine specifier */
uint32_t filetype; /* type of file */
uint32_t ncmds; /* number of load commands */
uint32_t sizeofcmds; /* the size of all the load commands */
@@ -71,8 +79,8 @@ struct mach_header {
*/
struct mach_header_64 {
uint32_t magic; /* mach magic number identifier */
cpu_type_t cputype; /* cpu specifier */
cpu_subtype_t cpusubtype; /* machine specifier */
int32_t cputype; /* cpu specifier */
int32_t cpusubtype; /* machine specifier */
uint32_t filetype; /* type of file */
uint32_t ncmds; /* number of load commands */
uint32_t sizeofcmds; /* the size of all the load commands */
@@ -115,11 +123,17 @@ struct mach_header_64 {
#define MH_DYLIB 0x6 /* dynamically bound shared library */
#define MH_DYLINKER 0x7 /* dynamic link editor */
#define MH_BUNDLE 0x8 /* dynamically bound bundle file */
#define MH_DYLIB_STUB 0x9 /* shared library stub for static */
/* linking only, no section contents */
#define MH_DSYM 0xa /* companion file with only debug */
/* sections */
#define MH_DYLIB_STUB 0x9 /* shared library stub for static
linking only, no section contents */
#define MH_DSYM 0xa /* companion file with only debug
sections */
#define MH_KEXT_BUNDLE 0xb /* x86_64 kexts */
#define MH_FILESET 0xc /* a file composed of other Mach-Os to
be run in the same userspace sharing
a single linkedit. */
#define MH_GPU_EXECUTE 0xd /* gpu program */
#define MH_GPU_DYLIB 0xe /* gpu support functions */
/* Constants for the flags field of the mach_header */
#define MH_NOUNDEFS 0x1 /* the object file has no undefined
@@ -322,6 +336,7 @@ struct load_command {
#define LC_BUILD_VERSION 0x32 /* build for platform min OS version */
#define LC_DYLD_EXPORTS_TRIE (0x33 | LC_REQ_DYLD) /* used with linkedit_data_command, payload is trie */
#define LC_DYLD_CHAINED_FIXUPS (0x34 | LC_REQ_DYLD) /* used with linkedit_data_command */
#define LC_FILESET_ENTRY (0x35 | LC_REQ_DYLD) /* used with fileset_entry_command */
/*
* A variable length string in a load command is represented by an lc_str
@@ -358,8 +373,8 @@ struct segment_command { /* for 32-bit architectures */
uint32_t vmsize; /* memory size of this segment */
uint32_t fileoff; /* file offset of this segment */
uint32_t filesize; /* amount to map from the file */
vm_prot_t maxprot; /* maximum VM protection */
vm_prot_t initprot; /* initial VM protection */
int32_t maxprot; /* maximum VM protection */
int32_t initprot; /* initial VM protection */
uint32_t nsects; /* number of sections in segment */
uint32_t flags; /* flags */
};
@@ -378,8 +393,8 @@ struct segment_command_64 { /* for 64-bit architectures */
uint64_t vmsize; /* memory size of this segment */
uint64_t fileoff; /* file offset of this segment */
uint64_t filesize; /* amount to map from the file */
vm_prot_t maxprot; /* maximum VM protection */
vm_prot_t initprot; /* initial VM protection */
int32_t maxprot; /* maximum VM protection */
int32_t initprot; /* initial VM protection */
uint32_t nsects; /* number of sections in segment */
uint32_t flags; /* flags */
};
@@ -1259,24 +1274,45 @@ struct build_tool_version {
};
/* Known values for the platform field above. */
#define PLATFORM_UNKNOWN 0
#define PLATFORM_ANY 0xFFFFFFFF
#define PLATFORM_MACOS 1
#define PLATFORM_IOS 2
#define PLATFORM_TVOS 3
#define PLATFORM_WATCHOS 4
#define PLATFORM_BRIDGEOS 5
#define PLATFORM_MACCATALYST 6
#if (!defined(PLATFORM_MACCATALYST))
#define PLATFORM_MACCATALYST 6
#endif
#define PLATFORM_IOSSIMULATOR 7
#define PLATFORM_TVOSSIMULATOR 8
#define PLATFORM_WATCHOSSIMULATOR 9
#define PLATFORM_DRIVERKIT 10
#ifndef __OPEN_SOURCE__
#endif /* __OPEN_SOURCE__ */
#define PLATFORM_FIRMWARE 13
#define PLATFORM_SEPOS 14
#ifndef __OPEN_SOURCE__
#endif /* __OPEN_SOURCE__ */
/* Known values for the tool field above. */
#define TOOL_CLANG 1
#define TOOL_SWIFT 2
#define TOOL_LD 3
#define TOOL_LLD 4
/* values for gpu tools (1024 to 1048) */
#define TOOL_METAL 1024
#define TOOL_AIRLLD 1025
#define TOOL_AIRNT 1026
#define TOOL_AIRNT_PLUGIN 1027
#define TOOL_AIRPACK 1028
#define TOOL_GPUARCHIVER 1031
#define TOOL_METAL_FRAMEWORK 1032
/*
* The dyld_info_command contains the file offsets and sizes of
@@ -1455,6 +1491,8 @@ struct dyld_info_command {
#define EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION 0x04
#define EXPORT_SYMBOL_FLAGS_REEXPORT 0x08
#define EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER 0x10
#define EXPORT_SYMBOL_FLAGS_STATIC_RESOLVER 0x20
/*
* The linker_option_command contains linker options embedded in object files.
@@ -1574,4 +1612,27 @@ struct note_command {
uint64_t size; /* length of data region */
};
/*
* LC_FILESET_ENTRY commands describe constituent Mach-O files that are part
* of a fileset. In one implementation, entries are dylibs with individual
* mach headers and repositionable text and data segments. Each entry is
* further described by its own mach header.
*/
struct fileset_entry_command {
uint32_t cmd; /* LC_FILESET_ENTRY */
uint32_t cmdsize; /* includes entry_id string */
uint64_t vmaddr; /* memory address of the entry */
uint64_t fileoff; /* file offset of the entry */
union lc_str entry_id; /* contained entry id */
uint32_t reserved; /* reserved */
};
/*
* These deprecated values may still be used within Apple but are mechanically
* removed from public API. The mechanical process may produce unusual results.
*/
#if (!defined(PLATFORM_MACCATALYST))
#define PLATFORM_MACCATALYST PLATFORM_MACCATALYST
#endif
#endif /* _MACHO_LOADER_H_ */

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t;
#define clock_MSG_COUNT 3
#endif /* clock_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t;
#define clock_priv_MSG_COUNT 2
#endif /* clock_priv_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>

View File

@@ -102,34 +102,42 @@
#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
#define EXCEPTION_DEFAULT 1
/* Send a catch_exception_raise message including the identity.
*/
# define EXCEPTION_STATE 2
#define EXCEPTION_STATE 2
/* Send a catch_exception_raise_state message including the
* thread state.
*/
# define EXCEPTION_STATE_IDENTITY 3
#define EXCEPTION_STATE_IDENTITY 3
/* Send a catch_exception_raise_state_identity message including
* the thread identity and state.
*/
#define EXCEPTION_IDENTITY_PROTECTED 4
/* Send a catch_exception_raise_identity_protected message including protected task
* and thread identity.
*/
#define MACH_EXCEPTION_BACKTRACE_PREFERRED 0x20000000
/* Prefer sending a catch_exception_raice_backtrace message, if applicable */
#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)
#define MACH_EXCEPTION_MASK (MACH_EXCEPTION_CODES | \
MACH_EXCEPTION_ERRORS | \
MACH_EXCEPTION_BACKTRACE_PREFERRED)
/*
* Masks for exception definitions, above
* bit zero is unused, therefore 1 word = 31 exception types
@@ -181,6 +189,7 @@
#include <mach/port.h>
#include <mach/thread_status.h>
#include <mach/machine/vm_types.h>
#include <mach_debug/ipc_info.h>
/*
* Exported types
*/
@@ -196,6 +205,7 @@ 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 ipc_info_port_t *exception_port_info_array_t;
typedef mach_exception_data_type_t mach_exception_code_t;
typedef mach_exception_data_type_t mach_exception_subcode_t;

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t;
#define host_priv_MSG_COUNT 26
#endif /* host_priv_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t;
#define host_security_MSG_COUNT 2
#endif /* host_security_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>

View File

@@ -76,10 +76,10 @@
*/
#define HOST_PORT 1
#define HOST_PRIV_PORT 2
#define HOST_IO_MASTER_PORT 3
#define HOST_IO_MAIN_PORT 3
#define HOST_MAX_SPECIAL_KERNEL_PORT 7 /* room to grow */
#define HOST_LAST_SPECIAL_KERNEL_PORT HOST_IO_MASTER_PORT
#define HOST_LAST_SPECIAL_KERNEL_PORT HOST_IO_MAIN_PORT
/*
* Not provided by kernel
@@ -108,9 +108,11 @@
#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_IOCOMPRESSIONSTATS_PORT (25 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_MEMORY_ERROR_PORT (26 + HOST_MAX_SPECIAL_KERNEL_PORT)
#define HOST_MAX_SPECIAL_PORT HOST_FAIRPLAYD_PORT
/* MAX = last since rdar://35861175 */
#define HOST_MAX_SPECIAL_PORT HOST_MEMORY_ERROR_PORT
/* MAX = last since rdar://59872249 */
/* obsolete name */
#define HOST_CHUD_PORT HOST_LAUNCHCTL_PORT
@@ -137,10 +139,10 @@
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) \
#define host_get_io_main_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)
HOST_LOCAL_NODE, HOST_IO_MAIN_PORT, (port)))
#define host_set_io_main_port(host, port) (KERN_INVALID_ARGUMENT)
/*
* User-settable special ports.
@@ -274,6 +276,18 @@
#define host_set_fairplayd_port(host, port) \
(host_set_special_port((host), HOST_FAIRPLAYD_PORT, (port)))
#define host_get_iocompressionstats_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_IOCOMPRESSIONSTATS_PORT, (port)))
#define host_set_iocompressionstats_port(host, port) \
(host_set_special_port((host), HOST_IOCOMPRESSIONSTATS_PORT, (port)))
#define host_get_memory_error_port(host, port) \
(host_get_special_port((host), \
HOST_LOCAL_NODE, HOST_MEMORY_ERROR_PORT, (port)))
#define host_set_memory_error_port(host, port) \
(host_set_special_port((host), HOST_MEMORY_ERROR_PORT, (port)))
/* HOST_RESOURCE_NOTIFY_PORT doesn't #defines these conveniences.
* All lookups go through send_resource_violation()
*/

View File

@@ -85,10 +85,6 @@ __BEGIN_DECLS
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 **,
@@ -237,9 +233,9 @@ extern voucher_mach_msg_state_t voucher_mach_msg_adopt(mach_msg_header_t *msg);
* @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_ */

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t;
#define mach_host_MSG_COUNT 35
#endif /* mach_host_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
@@ -74,8 +78,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t host_info
(
host_t host,
@@ -139,16 +142,16 @@ kern_return_t host_processor_info
mach_msg_type_number_t *out_processor_infoCnt
);
/* Routine host_get_io_master */
/* Routine host_get_io_main */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t host_get_io_master
kern_return_t host_get_io_main
(
host_t host,
io_master_t *io_master
io_main_t *io_main
);
/* Routine host_get_clock_service */
@@ -251,8 +254,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t host_request_notification
(
host_t host,
@@ -308,8 +310,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t host_create_mach_voucher
(
host_t host,
@@ -324,8 +325,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t host_register_mach_voucher_attr_manager
(
host_t host,
@@ -341,8 +341,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t host_register_well_known_mach_voucher_attr_manager
(
host_t host,
@@ -358,8 +357,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t host_set_atm_diagnostic_flag
(
host_t host,
@@ -372,8 +370,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t host_get_atm_diagnostic_flag
(
host_t host,
@@ -532,7 +529,7 @@ __END_DECLS
#endif
typedef struct {
mach_msg_header_t Head;
} __Request__host_get_io_master_t __attribute__((unused));
} __Request__host_get_io_main_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
@@ -802,7 +799,7 @@ union __RequestUnion__mach_host_subsystem {
__Request___host_page_size_t Request__host_page_size;
__Request__mach_memory_object_memory_entry_t Request_mach_memory_object_memory_entry;
__Request__host_processor_info_t Request_host_processor_info;
__Request__host_get_io_master_t Request_host_get_io_master;
__Request__host_get_io_main_t Request_host_get_io_main;
__Request__host_get_clock_service_t Request_host_get_clock_service;
__Request__kmod_get_info_t Request_kmod_get_info;
__Request__host_virtual_physical_table_info_t Request_host_virtual_physical_table_info;
@@ -911,9 +908,9 @@ union __RequestUnion__mach_host_subsystem {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t io_master;
mach_msg_port_descriptor_t io_main;
/* end of the kernel processed data */
} __Reply__host_get_io_master_t __attribute__((unused));
} __Reply__host_get_io_main_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
@@ -1232,7 +1229,7 @@ union __ReplyUnion__mach_host_subsystem {
__Reply___host_page_size_t Reply__host_page_size;
__Reply__mach_memory_object_memory_entry_t Reply_mach_memory_object_memory_entry;
__Reply__host_processor_info_t Reply_host_processor_info;
__Reply__host_get_io_master_t Reply_host_get_io_master;
__Reply__host_get_io_main_t Reply_host_get_io_main;
__Reply__host_get_clock_service_t Reply_host_get_clock_service;
__Reply__kmod_get_info_t Reply_kmod_get_info;
__Reply__host_virtual_physical_table_info_t Reply_host_virtual_physical_table_info;
@@ -1264,7 +1261,7 @@ union __ReplyUnion__mach_host_subsystem {
{ "_host_page_size", 202 },\
{ "mach_memory_object_memory_entry", 203 },\
{ "host_processor_info", 204 },\
{ "host_get_io_master", 205 },\
{ "host_get_io_main", 205 },\
{ "host_get_clock_service", 206 },\
{ "kmod_get_info", 207 },\
{ "host_virtual_physical_table_info", 209 },\

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -26,24 +26,27 @@
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
* Copyright (C) Apple Computer 1998
* ALL Rights Reserved
*/
#ifndef _MACH_SYNC_POLICY_H_
#define _MACH_SYNC_POLICY_H_
typedef int sync_policy_t;
/*
* These options define the wait ordering of the synchronizers
* 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.
*/
#define SYNC_POLICY_FIFO 0x0
#define SYNC_POLICY_FIXED_PRIORITY 0x1
#define SYNC_POLICY_REVERSED 0x2
#define SYNC_POLICY_ORDER_MASK 0x3
#define SYNC_POLICY_LIFO (SYNC_POLICY_FIFO|SYNC_POLICY_REVERSED)
#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/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>
#define SYNC_POLICY_MAX 0x7
#endif /* _MACH_SYNC_POLICY_H_ */
#endif /* _MACH_INTERFACE_H_ */

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t;
#endif /* AUTOTEST */
#ifndef mach_port_MSG_COUNT
#define mach_port_MSG_COUNT 40
#define mach_port_MSG_COUNT 43
#endif /* mach_port_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
@@ -113,8 +117,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t mach_port_allocate_name
(
ipc_space_t task,
@@ -141,6 +144,9 @@ mig_external
#else
extern
#endif /* mig_external */
__API_DEPRECATED("Inherently unsafe API: instead manage rights with "
"mach_port_destruct(), mach_port_deallocate() or mach_port_mod_refs()",
macos(10.0, 12.0), ios(2.0, 15.0), tvos(9.0, 15.0), watchos(2.0, 8.0))
kern_return_t mach_port_destroy
(
ipc_space_t task,
@@ -226,7 +232,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_get_set_status
(
ipc_space_inspect_t task,
ipc_space_read_t task,
mach_port_name_t name,
mach_port_name_array_t *members,
mach_msg_type_number_t *membersCnt
@@ -312,7 +318,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_get_attributes
(
ipc_space_inspect_t task,
ipc_space_read_t task,
mach_port_name_t name,
mach_port_flavor_t flavor,
mach_port_info_t port_info_out,
@@ -369,8 +375,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_set_port_space
(
ipc_space_t task,
@@ -398,7 +403,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_space_info
(
ipc_space_inspect_t task,
ipc_space_read_t space,
ipc_info_space_t *space_info,
ipc_info_name_array_t *table_info,
mach_msg_type_number_t *table_infoCnt,
@@ -428,7 +433,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_kernel_object
(
ipc_space_inspect_t task,
ipc_space_read_t task,
mach_port_name_t name,
unsigned *object_type,
unsigned *object_addr
@@ -468,7 +473,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_get_context
(
ipc_space_inspect_t task,
ipc_space_read_t task,
mach_port_name_t name,
mach_port_context_t *context
);
@@ -494,7 +499,7 @@ extern
#endif /* mig_external */
kern_return_t mach_port_kobject
(
ipc_space_inspect_t task,
ipc_space_read_t task,
mach_port_name_t name,
natural_t *object_type,
mach_vm_address_t *object_addr
@@ -603,13 +608,55 @@ extern
#endif /* mig_external */
kern_return_t mach_port_kobject_description
(
ipc_space_inspect_t task,
ipc_space_read_t task,
mach_port_name_t name,
natural_t *object_type,
mach_vm_address_t *object_addr,
kobject_description_t description
);
/* Routine mach_port_is_connection_for_service */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t mach_port_is_connection_for_service
(
ipc_space_t task,
mach_port_name_t connection_port,
mach_port_name_t service_port,
uint64_t *filter_policy_id
);
/* Routine mach_port_get_service_port_info */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t mach_port_get_service_port_info
(
ipc_space_read_t task,
mach_port_name_t name,
mach_service_port_info_data_t *sp_info_out
);
/* Routine mach_port_assert_attributes */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t mach_port_assert_attributes
(
ipc_space_t task,
mach_port_name_t name,
mach_port_flavor_t flavor,
mach_port_info_t info,
mach_msg_type_number_t infoCnt
);
__END_DECLS
/********************** Caution **************************/
@@ -1139,6 +1186,46 @@ __END_DECLS
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
mach_port_name_t connection_port;
mach_port_name_t service_port;
} __Request__mach_port_is_connection_for_service_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
mach_port_name_t name;
} __Request__mach_port_get_service_port_info_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
mach_port_name_t name;
mach_port_flavor_t flavor;
mach_msg_type_number_t infoCnt;
integer_t info[17];
} __Request__mach_port_assert_attributes_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__mach_port_subsystem__defined */
/* union of all requests */
@@ -1185,6 +1272,9 @@ union __RequestUnion__mach_port_subsystem {
__Request__mach_port_guard_with_flags_t Request_mach_port_guard_with_flags;
__Request__mach_port_swap_guard_t Request_mach_port_swap_guard;
__Request__mach_port_kobject_description_t Request_mach_port_kobject_description;
__Request__mach_port_is_connection_for_service_t Request_mach_port_is_connection_for_service;
__Request__mach_port_get_service_port_info_t Request_mach_port_get_service_port_info;
__Request__mach_port_assert_attributes_t Request_mach_port_assert_attributes;
};
#endif /* !__RequestUnion__mach_port_subsystem__defined */
/* typedefs for all replies */
@@ -1709,6 +1799,44 @@ union __RequestUnion__mach_port_subsystem {
#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;
uint64_t filter_policy_id;
} __Reply__mach_port_is_connection_for_service_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_service_port_info_data_t sp_info_out;
} __Reply__mach_port_get_service_port_info_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__mach_port_assert_attributes_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__mach_port_subsystem__defined */
/* union of all replies */
@@ -1755,6 +1883,9 @@ union __ReplyUnion__mach_port_subsystem {
__Reply__mach_port_guard_with_flags_t Reply_mach_port_guard_with_flags;
__Reply__mach_port_swap_guard_t Reply_mach_port_swap_guard;
__Reply__mach_port_kobject_description_t Reply_mach_port_kobject_description;
__Reply__mach_port_is_connection_for_service_t Reply_mach_port_is_connection_for_service;
__Reply__mach_port_get_service_port_info_t Reply_mach_port_get_service_port_info;
__Reply__mach_port_assert_attributes_t Reply_mach_port_assert_attributes;
};
#endif /* !__RequestUnion__mach_port_subsystem__defined */
@@ -1798,7 +1929,10 @@ union __ReplyUnion__mach_port_subsystem {
{ "mach_port_space_basic_info", 3235 },\
{ "mach_port_guard_with_flags", 3237 },\
{ "mach_port_swap_guard", 3238 },\
{ "mach_port_kobject_description", 3239 }
{ "mach_port_kobject_description", 3239 },\
{ "mach_port_is_connection_for_service", 3240 },\
{ "mach_port_get_service_port_info", 3241 },\
{ "mach_port_assert_attributes", 3242 }
#endif
#ifdef __AfterMigUserHeader

View File

@@ -117,12 +117,17 @@
*/
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;
@@ -138,7 +143,10 @@ 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 suid_cred_t;
typedef mach_port_t ipc_eventlink_t;
typedef mach_port_t eventlink_port_pair_t[2];
typedef mach_port_t task_id_token_t;
typedef mach_port_t kcdata_object_t;
/*
@@ -157,8 +165,11 @@ 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 io_main_t;
typedef mach_port_t UNDServerRef;
typedef mach_port_t mach_eventlink_t;
typedef ipc_info_port_t exception_handler_info_t;
/*
* Mig doesn't translate the components of an array.
@@ -207,17 +218,19 @@ 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;
typedef char nspace_name_t[1024]; /* 1024 == PATH_MAX */
#define TASK_NULL ((task_t) 0)
#define TASK_NAME_NULL ((task_name_t) 0)
#define TASK_INSPECT_NULL ((task_inspect_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)
@@ -232,10 +245,33 @@ typedef uint32_t suid_cred_uid_t;
#define CLOCK_NULL ((clock_t) 0)
#define UND_SERVER_NULL ((UNDServerRef) 0)
#define ARCADE_REG_NULL ((arcade_register_t) 0)
#define SUID_CRED_NULL ((suid_cred_t) 0)
#define MACH_EVENTLINK_NULL ((mach_eventlink_t) 0)
#define IPC_EVENTLINK_NULL ((ipc_eventlink_t) 0)
#define TASK_ID_TOKEN_NULL ((task_id_token_t) 0)
#define KCDATA_OBJECT_NULL ((kcdata_object_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 */
#define TASK_FLAVOR_MAX TASK_FLAVOR_NAME
/* 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 */
#define THREAD_FLAVOR_MAX THREAD_FLAVOR_INSPECT
/* DEPRECATED */
typedef natural_t ledger_item_t;
typedef natural_t ledger_item_t;
#define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0))
typedef int64_t ledger_amount_t;

View File

@@ -31,6 +31,7 @@
#include <mach/std_types.h>
#include <mach/port.h>
#include <mach/message.h>
/*
* Mach Voucher - an immutable collection of attribute value handles.
@@ -91,12 +92,14 @@ typedef mach_voucher_attr_key_t *mach_voucher_attr_key_array_t;
#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)
/* following keys have been removed from embedded platforms */
#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_BITS MACH_VOUCHER_ATTR_KEY_USER_DATA
#define MACH_VOUCHER_ATTR_KEY_TEST ((mach_voucher_attr_key_t)8)
/* not used, for compatibility only */
#define MACH_VOUCHER_ATTR_KEY_NUM_WELL_KNOWN MACH_VOUCHER_ATTR_KEY_TEST
/*
@@ -212,7 +215,7 @@ typedef mach_port_t ipc_voucher_attr_control_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 uint64_t mach_voucher_attr_value_handle_t __kernel_ptr_semantics;
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;

View File

@@ -118,6 +118,10 @@ typedef integer_t cpu_threadtype_t;
#define CPU_TYPE_POWERPC ((cpu_type_t) 18)
#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
/* skip ((cpu_type_t) 19) */
/* skip ((cpu_type_t) 20 */
/* skip ((cpu_type_t) 21 */
/* skip ((cpu_type_t) 22 */
/* skip ((cpu_type_t) 23 */
/*
* Machine subtypes (these are defined here, instead of in a machine
@@ -130,7 +134,14 @@ typedef integer_t cpu_threadtype_t;
*/
#define CPU_SUBTYPE_MASK 0xff000000 /* mask for feature flags */
#define CPU_SUBTYPE_LIB64 0x80000000 /* 64 bit libraries */
#define CPU_SUBTYPE_PTRAUTH_ABI 0x80000000 /* pointer authentication with versioned ABI */
/*
* When selecting a slice, ANY will pick the slice with the best
* grading for the selected cpu_type_t, unlike the "ALL" subtypes,
* which are the slices that can run on any hardware for that cpu type.
*/
#define CPU_SUBTYPE_ANY ((cpu_subtype_t) -1)
/*
* Object files that are hand-crafted to run on any
@@ -365,12 +376,8 @@ typedef integer_t cpu_threadtype_t;
#define CPUFAMILY_INTEL_BROADWELL 0x582ed09c
#define CPUFAMILY_INTEL_SKYLAKE 0x37fc219f
#define CPUFAMILY_INTEL_KABYLAKE 0x0f817246
#if !defined(RC_HIDE_XNU_ICELAKE)
#define CPUFAMILY_INTEL_ICELAKE 0x38435547
#endif /* not RC_HIDE_XNU_ICELAKE */
#if !defined(RC_HIDE_XNU_COMETLAKE)
#define CPUFAMILY_INTEL_COMETLAKE 0x1cf8a03e
#endif /* not RC_HIDE_XNU_COMETLAKE */
#define CPUFAMILY_ARM_9 0xe73283ae
#define CPUFAMILY_ARM_11 0x8ff620d8
#define CPUFAMILY_ARM_XSCALE 0x53b005f5
@@ -386,6 +393,17 @@ typedef integer_t cpu_threadtype_t;
#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
#define CPUFAMILY_ARM_BLIZZARD_AVALANCHE 0xda33d83d
#define CPUFAMILY_ARM_EVEREST_SAWTOOTH 0x8765edea
/* Described in rdar://64125549 */
#define CPUSUBFAMILY_UNKNOWN 0
#define CPUSUBFAMILY_ARM_HP 1
#define CPUSUBFAMILY_ARM_HG 2
#define CPUSUBFAMILY_ARM_M 3
#define CPUSUBFAMILY_ARM_HS 4
#define CPUSUBFAMILY_ARM_HC_HD 5
/* The following synonyms are deprecated: */
#define CPUFAMILY_INTEL_6_23 CPUFAMILY_INTEL_PENRYN

View File

@@ -228,6 +228,7 @@ typedef unsigned int mach_msg_priority_t;
#define MACH_MSG_PRIORITY_UNSPECIFIED (mach_msg_priority_t) 0
typedef unsigned int mach_msg_type_name_t;
#define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive right */
@@ -277,16 +278,18 @@ typedef unsigned int mach_msg_descriptor_type_t;
#define MACH_MSG_OOL_VOLATILE_DESCRIPTOR 3
#define MACH_MSG_GUARDED_PORT_DESCRIPTOR 4
#define MACH_MSG_DESCRIPTOR_MAX MACH_MSG_GUARDED_PORT_DESCRIPTOR
#pragma pack(push, 4)
typedef struct{
typedef struct {
natural_t pad1;
mach_msg_size_t pad2;
unsigned int pad3 : 24;
mach_msg_descriptor_type_t type : 8;
} mach_msg_type_descriptor_t;
typedef struct{
typedef struct {
mach_port_t name;
// Pad to 8 bytes everywhere except the K64 kernel where mach_port_t is 8 bytes
mach_msg_size_t pad1;
@@ -295,7 +298,8 @@ typedef struct{
mach_msg_descriptor_type_t type : 8;
} mach_msg_port_descriptor_t;
typedef struct{
typedef struct {
uint32_t address;
mach_msg_size_t size;
boolean_t deallocate: 8;
@@ -304,7 +308,7 @@ typedef struct{
mach_msg_descriptor_type_t type: 8;
} mach_msg_ool_descriptor32_t;
typedef struct{
typedef struct {
uint64_t address;
boolean_t deallocate: 8;
mach_msg_copy_options_t copy: 8;
@@ -313,7 +317,7 @@ typedef struct{
mach_msg_size_t size;
} mach_msg_ool_descriptor64_t;
typedef struct{
typedef struct {
void* address;
#if !defined(__LP64__)
mach_msg_size_t size;
@@ -327,7 +331,7 @@ typedef struct{
#endif
} mach_msg_ool_descriptor_t;
typedef struct{
typedef struct {
uint32_t address;
mach_msg_size_t count;
boolean_t deallocate: 8;
@@ -336,7 +340,7 @@ typedef struct{
mach_msg_descriptor_type_t type : 8;
} mach_msg_ool_ports_descriptor32_t;
typedef struct{
typedef struct {
uint64_t address;
boolean_t deallocate: 8;
mach_msg_copy_options_t copy: 8;
@@ -345,7 +349,7 @@ typedef struct{
mach_msg_size_t count;
} mach_msg_ool_ports_descriptor64_t;
typedef struct{
typedef struct {
void* address;
#if !defined(__LP64__)
mach_msg_size_t count;
@@ -359,7 +363,7 @@ typedef struct{
#endif
} mach_msg_ool_ports_descriptor_t;
typedef struct{
typedef struct {
uint32_t context;
mach_port_name_t name;
mach_msg_guard_flags_t flags : 16;
@@ -367,7 +371,7 @@ typedef struct{
mach_msg_descriptor_type_t type : 8;
} mach_msg_guarded_port_descriptor32_t;
typedef struct{
typedef struct {
uint64_t context;
mach_msg_guard_flags_t flags : 16;
mach_msg_type_name_t disposition : 8;
@@ -375,7 +379,7 @@ typedef struct{
mach_port_name_t name;
} mach_msg_guarded_port_descriptor64_t;
typedef struct{
typedef struct {
mach_port_context_t context;
#if !defined(__LP64__)
mach_port_name_t name;
@@ -401,30 +405,32 @@ typedef union{
mach_msg_guarded_port_descriptor_t guarded_port;
} mach_msg_descriptor_t;
typedef struct{
typedef struct {
mach_msg_size_t msgh_descriptor_count;
} mach_msg_body_t;
#define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0
#define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0
#define MACH_MSG_BODY_NULL ((mach_msg_body_t *) 0)
#define MACH_MSG_DESCRIPTOR_NULL ((mach_msg_descriptor_t *) 0)
typedef struct{
mach_msg_bits_t msgh_bits;
mach_msg_size_t msgh_size;
mach_port_t msgh_remote_port;
mach_port_t msgh_local_port;
mach_port_name_t msgh_voucher_port;
mach_msg_id_t msgh_id;
typedef struct {
mach_msg_bits_t msgh_bits;
mach_msg_size_t msgh_size;
mach_port_t msgh_remote_port;
mach_port_t msgh_local_port;
mach_port_name_t msgh_voucher_port;
mach_msg_id_t msgh_id;
} mach_msg_header_t;
#define msgh_reserved msgh_voucher_port
#define MACH_MSG_NULL (mach_msg_header_t *) 0
typedef struct{
mach_msg_header_t header;
mach_msg_body_t body;
#define msgh_reserved msgh_voucher_port
#define MACH_MSG_NULL ((mach_msg_header_t *) 0)
typedef struct {
mach_msg_header_t header;
mach_msg_body_t body;
} mach_msg_base_t;
typedef unsigned int mach_msg_trailer_type_t;
#define MACH_MSG_TRAILER_FORMAT_0 0
@@ -432,7 +438,7 @@ typedef unsigned int mach_msg_trailer_type_t;
typedef unsigned int mach_msg_trailer_size_t;
typedef char *mach_msg_trailer_info_t;
typedef struct{
typedef struct {
mach_msg_trailer_type_t msgh_trailer_type;
mach_msg_trailer_size_t msgh_trailer_size;
} mach_msg_trailer_t;
@@ -446,17 +452,17 @@ typedef struct{
* multiple threads receive and/or process received
* messages.
*/
typedef struct{
typedef struct {
mach_msg_trailer_type_t msgh_trailer_type;
mach_msg_trailer_size_t msgh_trailer_size;
mach_port_seqno_t msgh_seqno;
} mach_msg_seqno_trailer_t;
typedef struct{
typedef struct {
unsigned int val[2];
} security_token_t;
typedef struct{
typedef struct {
mach_msg_trailer_type_t msgh_trailer_type;
mach_msg_trailer_size_t msgh_trailer_size;
mach_port_seqno_t msgh_seqno;
@@ -472,11 +478,11 @@ typedef struct{
* of the subject identity within the token may change
* over time.
*/
typedef struct{
typedef struct {
unsigned int val[8];
} audit_token_t;
typedef struct{
typedef struct {
mach_msg_trailer_type_t msgh_trailer_type;
mach_msg_trailer_size_t msgh_trailer_size;
mach_port_seqno_t msgh_seqno;
@@ -484,7 +490,7 @@ typedef struct{
audit_token_t msgh_audit;
} mach_msg_audit_trailer_t;
typedef struct{
typedef struct {
mach_msg_trailer_type_t msgh_trailer_type;
mach_msg_trailer_size_t msgh_trailer_size;
mach_port_seqno_t msgh_seqno;
@@ -495,23 +501,26 @@ typedef struct{
typedef struct{
typedef struct {
mach_port_name_t sender;
} msg_labels_t;
typedef int mach_msg_filter_id;
#define MACH_MSG_FILTER_POLICY_ALLOW (mach_msg_filter_id)0
/*
* Trailer type to pass MAC policy label info as a mach message trailer.
*
*/
typedef struct{
typedef struct {
mach_msg_trailer_type_t msgh_trailer_type;
mach_msg_trailer_size_t msgh_trailer_size;
mach_port_seqno_t msgh_seqno;
security_token_t msgh_sender;
audit_token_t msgh_audit;
mach_port_context_t msgh_context;
int msgh_ad;
mach_msg_filter_id msgh_ad;
msg_labels_t msgh_labels;
} mach_msg_mac_trailer_t;
@@ -553,11 +562,13 @@ extern const audit_token_t KERNEL_AUDIT_TOKEN;
typedef integer_t mach_msg_options_t;
typedef struct{
#define MACH_MSG_HEADER_EMPTY (mach_msg_header_t){ }
typedef struct {
mach_msg_header_t header;
} mach_msg_empty_send_t;
typedef struct{
typedef struct {
mach_msg_header_t header;
mach_msg_trailer_t trailer;
} mach_msg_empty_rcv_t;
@@ -658,11 +669,12 @@ typedef integer_t mach_msg_option_t;
#define MACH_SEND_INTERRUPT 0x00000040 /* don't restart interrupted sends */
#define MACH_SEND_NOTIFY 0x00000080 /* arm send-possible notify */
#define MACH_SEND_ALWAYS 0x00010000 /* ignore qlimits - kernel only */
#define MACH_SEND_FILTER_NONFATAL 0x00010000 /* rejection by message filter should return failure - user only */
#define MACH_SEND_TRAILER 0x00020000 /* sender-provided trailer */
#define MACH_SEND_NOIMPORTANCE 0x00040000 /* msg won't carry importance */
#define MACH_SEND_NODENAP MACH_SEND_NOIMPORTANCE
#define MACH_SEND_IMPORTANCE 0x00080000 /* msg carries importance - kernel only */
#define MACH_SEND_SYNC_OVERRIDE 0x00100000 /* msg should do sync ipc override */
#define MACH_SEND_SYNC_OVERRIDE 0x00100000 /* msg should do sync IPC override (on legacy kernels) */
#define MACH_SEND_PROPAGATE_QOS 0x00200000 /* IPC should propagate the caller's QoS */
#define MACH_SEND_SYNC_USE_THRPRI MACH_SEND_PROPAGATE_QOS /* obsolete name */
#define MACH_SEND_KERNEL 0x00400000 /* full send from kernel space - kernel only */
@@ -795,10 +807,18 @@ typedef kern_return_t mach_msg_return_t;
/* The trailer to be sent does not match kernel format. */
#define MACH_SEND_INVALID_CONTEXT 0x10000012
/* The sending thread context did not match the context on the dest port */
#define MACH_SEND_INVALID_OPTIONS 0x10000013
/* Send options are invalid. */
#define MACH_SEND_INVALID_RT_OOL_SIZE 0x10000015
/* compatibility: no longer a returned error */
#define MACH_SEND_NO_GRANT_DEST 0x10000016
/* The destination port doesn't accept ports in body */
#define MACH_SEND_MSG_FILTERED 0x10000017
/* Message send was rejected by message filter */
#define MACH_SEND_AUX_TOO_SMALL 0x10000018
/* Message auxiliary data is too small */
#define MACH_SEND_AUX_TOO_LARGE 0x10000019
/* Message auxiliary data is too large */
#define MACH_RCV_IN_PROGRESS 0x10004001
/* Thread is waiting for receive. (Internal use only.) */
@@ -834,6 +854,8 @@ typedef kern_return_t mach_msg_return_t;
/* Waiting for receive with timeout. (Internal use only.) */
#define MACH_RCV_INVALID_REPLY 0x10004012
/* invalid reply port used in a STRICT_REPLY message */
#define MACH_RCV_INVALID_ARGUMENTS 0x10004013
/* invalid receive arguments, receive has not started */
@@ -886,11 +908,12 @@ extern mach_msg_return_t mach_msg(
mach_msg_timeout_t timeout,
mach_port_name_t notify);
/*
* Routine: mach_voucher_deallocate
* Purpose:
* Deallocate a mach voucher created or received in a message. Drops
* one (send right) reference to the voucher.
* Routine: mach_voucher_deallocate
* Purpose:
* Deallocate a mach voucher created or received in a message. Drops
* one (send right) reference to the voucher.
*/
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
extern kern_return_t mach_voucher_deallocate(

View File

@@ -211,7 +211,6 @@ typedef mach_port_type_t *mach_port_type_array_t;
#define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */
/* Convenient combinations. */
#define MACH_PORT_TYPE_SEND_RECEIVE \
@@ -293,9 +292,13 @@ typedef struct mach_port_info_ext {
uint32_t reserved[6];
} mach_port_info_ext_t;
typedef struct mach_port_guard_info {
uint64_t mpgi_guard; /* guard value */
} mach_port_guard_info_t;
typedef integer_t *mach_port_info_t; /* varying array of natural_t */
/* Flavors for mach_port_get/set_attributes() */
/* Flavors for mach_port_get/set/assert_attributes() */
typedef int mach_port_flavor_t;
#define MACH_PORT_LIMITS_INFO 1 /* uses mach_port_limits_t */
#define MACH_PORT_RECEIVE_STATUS 2 /* uses mach_port_status_t */
@@ -304,6 +307,7 @@ typedef int mach_port_flavor_t;
#define MACH_PORT_IMPORTANCE_RECEIVER 5 /* indicates recieve right accepts priority donation */
#define MACH_PORT_DENAP_RECEIVER 6 /* indicates receive right accepts de-nap donation */
#define MACH_PORT_INFO_EXT 7 /* uses mach_port_info_ext_t */
#define MACH_PORT_GUARD_INFO 8 /* asserts if the strict guard value is correct */
#define MACH_PORT_LIMITS_INFO_COUNT ((natural_t) \
(sizeof(mach_port_limits_t)/sizeof(natural_t)))
@@ -312,6 +316,9 @@ typedef int mach_port_flavor_t;
#define MACH_PORT_DNREQUESTS_SIZE_COUNT 1
#define MACH_PORT_INFO_EXT_COUNT ((natural_t) \
(sizeof(mach_port_info_ext_t)/sizeof(natural_t)))
#define MACH_PORT_GUARD_INFO_COUNT ((natural_t) \
(sizeof(mach_port_guard_info_t)/sizeof(natural_t)))
/*
* Structure used to pass information about port allocation requests.
* Must be padded to 64-bits total length.
@@ -323,7 +330,20 @@ typedef struct mach_port_qos {
natural_t len;
} mach_port_qos_t;
/* Mach Port Guarding definitions */
/*
* Structure used to pass information about the service port
*/
#define MACH_SERVICE_PORT_INFO_STRING_NAME_MAX_BUF_LEN 255 /* Maximum length of the port string name buffer */
typedef struct mach_service_port_info {
char mspi_string_name[MACH_SERVICE_PORT_INFO_STRING_NAME_MAX_BUF_LEN]; /* Service port's string name */
uint8_t mspi_domain_type; /* Service port domain */
} mach_service_port_info_data_t;
#define MACH_SERVICE_PORT_INFO_COUNT ((char) \
(sizeof(mach_service_port_info_data_t)/sizeof(char)))
typedef struct mach_service_port_info * mach_service_port_info_t;
/*
* Flags for mach_port_options (used for
@@ -331,14 +351,23 @@ typedef struct mach_port_qos {
* Indicates attributes to be set for the newly
* allocated port.
*/
#define MPO_CONTEXT_AS_GUARD 0x01 /* Add guard to the port */
#define MPO_QLIMIT 0x02 /* Set qlimit for the port msg queue */
#define MPO_TEMPOWNER 0x04 /* Set the tempowner bit of the port */
#define MPO_IMPORTANCE_RECEIVER 0x08 /* Mark the port as importance receiver */
#define MPO_INSERT_SEND_RIGHT 0x10 /* Insert a send right for the port */
#define MPO_STRICT 0x20 /* Apply strict guarding for port */
#define MPO_DENAP_RECEIVER 0x40 /* Mark the port as App de-nap receiver */
#define MPO_IMMOVABLE_RECEIVE 0x80 /* Mark the port as immovable; protected by the guard context */
#define MPO_CONTEXT_AS_GUARD 0x01 /* Add guard to the port */
#define MPO_QLIMIT 0x02 /* Set qlimit for the port msg queue */
#define MPO_TEMPOWNER 0x04 /* Set the tempowner bit of the port */
#define MPO_IMPORTANCE_RECEIVER 0x08 /* Mark the port as importance receiver */
#define MPO_INSERT_SEND_RIGHT 0x10 /* Insert a send right for the port */
#define MPO_STRICT 0x20 /* Apply strict guarding for port */
#define MPO_DENAP_RECEIVER 0x40 /* Mark the port as App de-nap receiver */
#define MPO_IMMOVABLE_RECEIVE 0x80 /* Mark the port as immovable; protected by the guard context */
#define MPO_FILTER_MSG 0x100 /* Allow message filtering */
#define MPO_TG_BLOCK_TRACKING 0x200 /* Track blocking relationship for thread group during sync IPC */
#define MPO_SERVICE_PORT 0x400 /* Create a service port with the given name; should be used only by launchd */
#define MPO_CONNECTION_PORT 0x800 /* Derive new peer connection port from a given service port */
#define MPO_REPLY_PORT 0x1000 /* Designate port as a reply port. */
#define MPO_ENFORCE_REPLY_PORT_SEMANTICS 0x2000 /* When talking to this port, local port of mach msg needs to follow reply port semantics.*/
#define MPO_PROVISIONAL_REPLY_PORT 0x4000 /* Designate port as a provisional reply port. */
/*
* Structure to define optional attributes for a newly
* constructed port.
@@ -346,11 +375,18 @@ typedef struct mach_port_qos {
typedef struct mach_port_options {
uint32_t flags; /* Flags defining attributes for port */
mach_port_limits_t mpl; /* Message queue limit for port */
uint64_t reserved[2]; /* Reserved */
union {
uint64_t reserved[2]; /* Reserved */
mach_port_name_t work_interval_port; /* Work interval port */
mach_service_port_info_t service_port_info; /* Service port (MPO_SERVICE_PORT) */
mach_port_name_t service_port_name; /* Service port (MPO_CONNECTION_PORT) */
};
}mach_port_options_t;
typedef mach_port_options_t *mach_port_options_ptr_t;
/* Mach Port Guarding definitions */
/*
* EXC_GUARD represents a guard violation for both
* mach ports and file descriptors. GUARD_TYPE_ is used
@@ -360,13 +396,15 @@ typedef mach_port_options_t *mach_port_options_ptr_t;
/* Reasons for exception for a guarded mach port */
enum mach_port_guard_exception_codes {
kGUARD_EXC_DESTROY = 1u << 0,
kGUARD_EXC_MOD_REFS = 1u << 1,
kGUARD_EXC_SET_CONTEXT = 1u << 2,
kGUARD_EXC_DESTROY = 1,
kGUARD_EXC_MOD_REFS = 2,
kGUARD_EXC_INVALID_OPTIONS = 3,
kGUARD_EXC_SET_CONTEXT = 4,
kGUARD_EXC_UNGUARDED = 1u << 3,
kGUARD_EXC_INCORRECT_GUARD = 1u << 4,
kGUARD_EXC_IMMOVABLE = 1u << 5,
kGUARD_EXC_STRICT_REPLY = 1u << 6,
kGUARD_EXC_MSG_FILTERED = 1u << 7,
/* start of [optionally] non-fatal guards */
kGUARD_EXC_INVALID_RIGHT = 1u << 8,
kGUARD_EXC_INVALID_NAME = 1u << 9,
@@ -380,10 +418,21 @@ enum mach_port_guard_exception_codes {
kGUARD_EXC_SEND_INVALID_VOUCHER = 1u << 17,
kGUARD_EXC_SEND_INVALID_RIGHT = 1u << 18,
kGUARD_EXC_RCV_INVALID_NAME = 1u << 19,
kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* should never be fatal; for development only */
/* start of always non-fatal guards */
kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* for development only */
kGUARD_EXC_MOD_REFS_NON_FATAL = 1u << 21,
kGUARD_EXC_IMMOVABLE_NON_FATAL = 1u << 22,
kGUARD_EXC_REQUIRE_REPLY_PORT_SEMANTICS = 1u << 23,
};
#define MAX_FATAL_kGUARD_EXC_CODE (1u << 6)
#define MAX_FATAL_kGUARD_EXC_CODE (1u << 7)
/*
* Mach port guard flags.
*/
#define MPG_FLAGS_NONE (0x00ull)
#define MAX_OPTIONAL_kGUARD_EXC_CODE (1u << 19)
/*
* These flags are used as bits in the subcode of kGUARD_EXC_STRICT_REPLY exceptions.
@@ -395,6 +444,18 @@ enum mach_port_guard_exception_codes {
#define MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA (0x10ull << 56)
#define MPG_FLAGS_STRICT_REPLY_MASK (0xffull << 56)
/*
* These flags are used as bits in the subcode of kGUARD_EXC_MOD_REFS exceptions.
*/
#define MPG_FLAGS_MOD_REFS_PINNED_DEALLOC (0x01ull << 56)
#define MPG_FLAGS_MOD_REFS_PINNED_DESTROY (0x02ull << 56)
#define MPG_FLAGS_MOD_REFS_PINNED_COPYIN (0x04ull << 56)
/*
* These flags are used as bits in the subcode of kGUARD_EXC_IMMOVABLE exceptions.
*/
#define MPG_FLAGS_IMMOVABLE_PINNED (0x01ull << 56)
/*
* Flags for mach_port_guard_with_flags. These flags extend
* the attributes associated with a guarded port.

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -52,6 +55,7 @@ typedef function_table_entry *function_table_t;
#define processor_MSG_COUNT 6
#endif /* processor_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>

View File

@@ -0,0 +1,156 @@
/*
* 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.
*/
/*
*/
/*
* File: mach/processor_info.h
* Author: David L. Black
* Date: 1988
*
* Data structure definitions for processor_info, processor_set_info
*/
#ifndef _MACH_PROCESSOR_INFO_H_
#define _MACH_PROCESSOR_INFO_H_
#include <mach/message.h>
#include <mach/machine.h>
#include <mach/machine/processor_info.h>
/*
* Generic information structure to allow for expansion.
*/
typedef integer_t *processor_info_t; /* varying array of int. */
typedef integer_t *processor_info_array_t; /* varying array of int */
#define PROCESSOR_INFO_MAX (1024) /* max array size */
typedef integer_t processor_info_data_t[PROCESSOR_INFO_MAX];
typedef integer_t *processor_set_info_t; /* varying array of int. */
#define PROCESSOR_SET_INFO_MAX (1024) /* max array size */
typedef integer_t processor_set_info_data_t[PROCESSOR_SET_INFO_MAX];
/*
* Currently defined information.
*/
typedef int processor_flavor_t;
#define PROCESSOR_BASIC_INFO 1 /* basic information */
#define PROCESSOR_CPU_LOAD_INFO 2 /* cpu load information */
#define PROCESSOR_PM_REGS_INFO 0x10000001 /* performance monitor register info */
#define PROCESSOR_TEMPERATURE 0x10000002 /* Processor core temperature */
struct processor_basic_info {
cpu_type_t cpu_type; /* type of cpu */
cpu_subtype_t cpu_subtype; /* subtype of cpu */
boolean_t running; /* is processor running */
int slot_num; /* slot number */
union {
boolean_t is_master; /* deprecated */
boolean_t is_main; /* is this the main processor */
};
};
typedef struct processor_basic_info processor_basic_info_data_t;
typedef struct processor_basic_info *processor_basic_info_t;
#define PROCESSOR_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof(processor_basic_info_data_t)/sizeof(natural_t)))
struct processor_cpu_load_info { /* number of ticks while running... */
unsigned int cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
};
typedef struct processor_cpu_load_info processor_cpu_load_info_data_t;
typedef struct processor_cpu_load_info *processor_cpu_load_info_t;
#define PROCESSOR_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof(processor_cpu_load_info_data_t)/sizeof(natural_t)))
/*
* Scaling factor for load_average, mach_factor.
*/
#define LOAD_SCALE 1000
typedef int processor_set_flavor_t;
#define PROCESSOR_SET_BASIC_INFO 5 /* basic information */
struct processor_set_basic_info {
int processor_count; /* How many processors */
int default_policy; /* When others not enabled */
};
typedef struct processor_set_basic_info processor_set_basic_info_data_t;
typedef struct processor_set_basic_info *processor_set_basic_info_t;
#define PROCESSOR_SET_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof(processor_set_basic_info_data_t)/sizeof(natural_t)))
#define PROCESSOR_SET_LOAD_INFO 4 /* scheduling statistics */
struct processor_set_load_info {
int task_count; /* How many tasks */
int thread_count; /* How many threads */
integer_t load_average; /* Scaled */
integer_t mach_factor; /* Scaled */
};
typedef struct processor_set_load_info processor_set_load_info_data_t;
typedef struct processor_set_load_info *processor_set_load_info_t;
#define PROCESSOR_SET_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
(sizeof(processor_set_load_info_data_t)/sizeof(natural_t)))
#endif /* _MACH_PROCESSOR_INFO_H_ */

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t;
#endif /* AUTOTEST */
#ifndef processor_set_MSG_COUNT
#define processor_set_MSG_COUNT 10
#define processor_set_MSG_COUNT 11
#endif /* processor_set_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
@@ -200,6 +204,20 @@ kern_return_t processor_set_info
mach_msg_type_number_t *info_outCnt
);
/* Routine processor_set_tasks_with_flavor */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t processor_set_tasks_with_flavor
(
processor_set_t processor_set,
mach_task_flavor_t flavor,
task_array_t *task_list,
mach_msg_type_number_t *task_listCnt
);
__END_DECLS
/********************** Caution **************************/
@@ -336,6 +354,18 @@ __END_DECLS
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
mach_task_flavor_t flavor;
} __Request__processor_set_tasks_with_flavor_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__processor_set_subsystem__defined */
/* union of all requests */
@@ -353,6 +383,7 @@ union __RequestUnion__processor_set_subsystem {
__Request__processor_set_policy_control_t Request_processor_set_policy_control;
__Request__processor_set_stack_usage_t Request_processor_set_stack_usage;
__Request__processor_set_info_t Request_processor_set_info;
__Request__processor_set_tasks_with_flavor_t Request_processor_set_tasks_with_flavor;
};
#endif /* !__RequestUnion__processor_set_subsystem__defined */
/* typedefs for all replies */
@@ -499,6 +530,22 @@ union __RequestUnion__processor_set_subsystem {
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_ool_ports_descriptor_t task_list;
/* end of the kernel processed data */
NDR_record_t NDR;
mach_msg_type_number_t task_listCnt;
} __Reply__processor_set_tasks_with_flavor_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__processor_set_subsystem__defined */
/* union of all replies */
@@ -516,6 +563,7 @@ union __ReplyUnion__processor_set_subsystem {
__Reply__processor_set_policy_control_t Reply_processor_set_policy_control;
__Reply__processor_set_stack_usage_t Reply_processor_set_stack_usage;
__Reply__processor_set_info_t Reply_processor_set_info;
__Reply__processor_set_tasks_with_flavor_t Reply_processor_set_tasks_with_flavor;
};
#endif /* !__RequestUnion__processor_set_subsystem__defined */
@@ -530,7 +578,8 @@ union __ReplyUnion__processor_set_subsystem {
{ "processor_set_threads", 4006 },\
{ "processor_set_policy_control", 4007 },\
{ "processor_set_stack_usage", 4008 },\
{ "processor_set_info", 4009 }
{ "processor_set_info", 4009 },\
{ "processor_set_tasks_with_flavor", 4010 }
#endif
#ifdef __AfterMigUserHeader

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t;
#endif /* AUTOTEST */
#ifndef task_MSG_COUNT
#define task_MSG_COUNT 55
#define task_MSG_COUNT 65
#endif /* task_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
@@ -111,8 +115,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t mach_ports_register
(
task_t target_task,
@@ -126,8 +129,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t mach_ports_lookup
(
task_t target_task,
@@ -155,8 +157,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_set_info
(
task_t target_task,
@@ -171,11 +172,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_suspend
(
task_t target_task
task_read_t target_task
);
/* Routine task_resume */
@@ -184,11 +184,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_resume
(
task_t target_task
task_read_t target_task
);
/* Routine task_get_special_port */
@@ -197,8 +196,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_get_special_port
(
task_inspect_t task,
@@ -212,8 +210,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_set_special_port
(
task_t task,
@@ -227,8 +224,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_create
(
task_t parent_task,
@@ -241,8 +237,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_create_running
(
task_t parent_task,
@@ -258,8 +253,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_set_exception_ports
(
task_t task,
@@ -275,11 +269,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_get_exception_ports
(
task_inspect_t task,
task_t task,
exception_mask_t exception_mask,
exception_mask_array_t masks,
mach_msg_type_number_t *masksCnt,
@@ -294,8 +287,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_swap_exception_ports
(
task_t task,
@@ -305,7 +297,7 @@ kern_return_t task_swap_exception_ports
thread_state_flavor_t new_flavor,
exception_mask_array_t masks,
mach_msg_type_number_t *masksCnt,
exception_handler_array_t old_handlerss,
exception_handler_array_t old_handlers,
exception_behavior_array_t old_behaviors,
exception_flavor_array_t old_flavors
);
@@ -368,11 +360,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_policy_set
(
task_t task,
task_policy_set_t task,
task_policy_flavor_t flavor,
task_policy_t policy_info,
mach_msg_type_number_t policy_infoCnt
@@ -384,11 +375,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_policy_get
(
task_t task,
task_policy_get_t task,
task_policy_flavor_t flavor,
task_policy_t policy_info,
mach_msg_type_number_t *policy_infoCnt,
@@ -483,11 +473,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_zone_info
(
task_t target_task,
task_inspect_t target_task,
mach_zone_name_array_t *names,
mach_msg_type_number_t *namesCnt,
task_zone_info_array_t *info,
@@ -527,7 +516,7 @@ extern
#endif /* mig_external */
kern_return_t task_get_assignment
(
task_t task,
task_inspect_t task,
processor_set_name_t *assigned_set
);
@@ -555,11 +544,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_get_state
(
task_t task,
task_read_t task,
thread_state_flavor_t flavor,
thread_state_t old_state,
mach_msg_type_number_t *old_stateCnt
@@ -571,8 +559,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_set_state
(
task_t task,
@@ -587,8 +574,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_set_phys_footprint_limit
(
task_t task,
@@ -602,11 +588,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_suspend2
(
task_t target_task,
task_read_t target_task,
task_suspension_token_t *suspend_token
);
@@ -616,8 +601,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_resume2
(
task_suspension_token_t suspend_token
@@ -631,7 +615,7 @@ extern
#endif /* mig_external */
kern_return_t task_purgable_info
(
task_t task,
task_inspect_t task,
task_purgable_info_t *stats
);
@@ -641,11 +625,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_get_mach_voucher
(
task_t task,
task_read_t task,
mach_voucher_selector_t which,
ipc_voucher_t *voucher
);
@@ -656,8 +639,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_set_mach_voucher
(
task_t task,
@@ -670,8 +652,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_swap_mach_voucher
(
task_t task,
@@ -687,7 +668,7 @@ extern
#endif /* mig_external */
kern_return_t task_generate_corpse
(
task_t task,
task_read_t task,
mach_port_t *corpse_task_port
);
@@ -700,7 +681,7 @@ extern
kern_return_t task_map_corpse_info
(
task_t task,
task_t corspe_task,
task_read_t corspe_task,
vm_address_t *kcd_addr_begin,
uint32_t *kcd_size
);
@@ -739,7 +720,7 @@ extern
#endif /* mig_external */
kern_return_t task_get_dyld_image_infos
(
task_inspect_t task,
task_read_t task,
dyld_kernel_image_info_array_t *dyld_images,
mach_msg_type_number_t *dyld_imagesCnt
);
@@ -791,7 +772,7 @@ extern
kern_return_t task_map_corpse_info_64
(
task_t task,
task_t corspe_task,
task_read_t corspe_task,
mach_vm_address_t *kcd_addr_begin,
mach_vm_size_t *kcd_size
);
@@ -834,18 +815,122 @@ kern_return_t task_set_exc_guard_behavior
task_exc_guard_behavior_t behavior
);
/* Routine task_create_suid_cred */
/* Routine task_dyld_process_info_notify_register */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t task_create_suid_cred
kern_return_t task_dyld_process_info_notify_register
(
task_read_t target_task,
mach_port_t notify
);
/* Routine task_create_identity_token */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t task_create_identity_token
(
task_t task,
suid_cred_path_t path,
suid_cred_uid_t uid,
suid_cred_t *delegation
task_id_token_t *token
);
/* Routine task_identity_token_get_task_port */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t task_identity_token_get_task_port
(
task_id_token_t token,
task_flavor_t flavor,
mach_port_t *task_port
);
/* Routine task_dyld_process_info_notify_deregister */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t task_dyld_process_info_notify_deregister
(
task_read_t target_task,
mach_port_name_t notify
);
/* Routine task_get_exception_ports_info */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t task_get_exception_ports_info
(
mach_port_t port,
exception_mask_t exception_mask,
exception_mask_array_t masks,
mach_msg_type_number_t *masksCnt,
exception_handler_info_array_t old_handlers_info,
exception_behavior_array_t old_behaviors,
exception_flavor_array_t old_flavors
);
/* Routine task_test_sync_upcall */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t task_test_sync_upcall
(
task_t task,
mach_port_t port
);
/* Routine task_set_corpse_forking_behavior */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t task_set_corpse_forking_behavior
(
task_t task,
task_corpse_forking_behavior_t behavior
);
/* Routine task_test_async_upcall_propagation */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t task_test_async_upcall_propagation
(
task_t task,
mach_port_t port,
int qos,
int iotier
);
/* Routine task_map_kcdata_object_64 */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t task_map_kcdata_object_64
(
task_t task,
kcdata_object_t kcdata_object,
mach_vm_address_t *kcd_addr_begin,
mach_vm_size_t *kcd_size
);
__END_DECLS
@@ -950,7 +1035,7 @@ __END_DECLS
NDR_record_t NDR;
task_flavor_t flavor;
mach_msg_type_number_t task_info_inCnt;
integer_t task_info_in[87];
integer_t task_info_in[90];
} __Request__task_set_info_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@@ -1022,7 +1107,7 @@ __END_DECLS
NDR_record_t NDR;
thread_state_flavor_t flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[614];
natural_t new_state[1296];
} __Request__thread_create_running_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@@ -1331,7 +1416,7 @@ __END_DECLS
NDR_record_t NDR;
thread_state_flavor_t flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[614];
natural_t new_state[1296];
} __Request__task_set_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@@ -1572,17 +1657,119 @@ __END_DECLS
#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 notify;
/* end of the kernel processed data */
} __Request__task_dyld_process_info_notify_register_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
} __Request__task_create_identity_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;
mach_msg_type_number_t pathOffset; /* MiG doesn't use it */
mach_msg_type_number_t pathCnt;
char path[1024];
suid_cred_uid_t uid;
} __Request__task_create_suid_cred_t __attribute__((unused));
task_flavor_t flavor;
} __Request__task_identity_token_get_task_port_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
mach_port_name_t notify;
} __Request__task_dyld_process_info_notify_deregister_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;
exception_mask_t exception_mask;
} __Request__task_get_exception_ports_info_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t port;
/* end of the kernel processed data */
} __Request__task_test_sync_upcall_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;
task_corpse_forking_behavior_t behavior;
} __Request__task_set_corpse_forking_behavior_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 port;
/* end of the kernel processed data */
NDR_record_t NDR;
int qos;
int iotier;
} __Request__task_test_async_upcall_propagation_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 kcdata_object;
/* end of the kernel processed data */
} __Request__task_map_kcdata_object_64_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
@@ -1647,7 +1834,15 @@ union __RequestUnion__task_subsystem {
__Request__task_inspect_t Request_task_inspect;
__Request__task_get_exc_guard_behavior_t Request_task_get_exc_guard_behavior;
__Request__task_set_exc_guard_behavior_t Request_task_set_exc_guard_behavior;
__Request__task_create_suid_cred_t Request_task_create_suid_cred;
__Request__task_dyld_process_info_notify_register_t Request_task_dyld_process_info_notify_register;
__Request__task_create_identity_token_t Request_task_create_identity_token;
__Request__task_identity_token_get_task_port_t Request_task_identity_token_get_task_port;
__Request__task_dyld_process_info_notify_deregister_t Request_task_dyld_process_info_notify_deregister;
__Request__task_get_exception_ports_info_t Request_task_get_exception_ports_info;
__Request__task_test_sync_upcall_t Request_task_test_sync_upcall;
__Request__task_set_corpse_forking_behavior_t Request_task_set_corpse_forking_behavior;
__Request__task_test_async_upcall_propagation_t Request_task_test_async_upcall_propagation;
__Request__task_map_kcdata_object_64_t Request_task_map_kcdata_object_64;
};
#endif /* !__RequestUnion__task_subsystem__defined */
/* typedefs for all replies */
@@ -1733,7 +1928,7 @@ union __RequestUnion__task_subsystem {
NDR_record_t NDR;
kern_return_t RetCode;
mach_msg_type_number_t task_info_outCnt;
integer_t task_info_out[87];
integer_t task_info_out[90];
} __Reply__task_info_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@@ -1867,7 +2062,7 @@ union __RequestUnion__task_subsystem {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t old_handlerss[32];
mach_msg_port_descriptor_t old_handlers[32];
/* end of the kernel processed data */
NDR_record_t NDR;
mach_msg_type_number_t masksCnt;
@@ -2111,7 +2306,7 @@ union __RequestUnion__task_subsystem {
NDR_record_t NDR;
kern_return_t RetCode;
mach_msg_type_number_t old_stateCnt;
natural_t old_state[614];
natural_t old_state[1296];
} __Reply__task_get_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@@ -2379,6 +2574,18 @@ union __RequestUnion__task_subsystem {
#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__task_dyld_process_info_notify_register_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
@@ -2386,9 +2593,102 @@ union __RequestUnion__task_subsystem {
mach_msg_header_t Head;
/* start of the kernel processed data */
mach_msg_body_t msgh_body;
mach_msg_port_descriptor_t delegation;
mach_msg_port_descriptor_t token;
/* end of the kernel processed data */
} __Reply__task_create_suid_cred_t __attribute__((unused));
} __Reply__task_create_identity_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 task_port;
/* end of the kernel processed data */
} __Reply__task_identity_token_get_task_port_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__task_dyld_process_info_notify_deregister_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 masksCnt;
exception_mask_t masks[32];
exception_handler_info_t old_handlers_info[32];
exception_behavior_t old_behaviors[32];
thread_state_flavor_t old_flavors[32];
} __Reply__task_get_exception_ports_info_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#ifdef __MigPackStructs
#pragma pack(push, 4)
#endif
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
} __Reply__task_test_sync_upcall_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__task_set_corpse_forking_behavior_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__task_test_async_upcall_propagation_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_vm_address_t kcd_addr_begin;
mach_vm_size_t kcd_size;
} __Reply__task_map_kcdata_object_64_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
@@ -2453,7 +2753,15 @@ union __ReplyUnion__task_subsystem {
__Reply__task_inspect_t Reply_task_inspect;
__Reply__task_get_exc_guard_behavior_t Reply_task_get_exc_guard_behavior;
__Reply__task_set_exc_guard_behavior_t Reply_task_set_exc_guard_behavior;
__Reply__task_create_suid_cred_t Reply_task_create_suid_cred;
__Reply__task_dyld_process_info_notify_register_t Reply_task_dyld_process_info_notify_register;
__Reply__task_create_identity_token_t Reply_task_create_identity_token;
__Reply__task_identity_token_get_task_port_t Reply_task_identity_token_get_task_port;
__Reply__task_dyld_process_info_notify_deregister_t Reply_task_dyld_process_info_notify_deregister;
__Reply__task_get_exception_ports_info_t Reply_task_get_exception_ports_info;
__Reply__task_test_sync_upcall_t Reply_task_test_sync_upcall;
__Reply__task_set_corpse_forking_behavior_t Reply_task_set_corpse_forking_behavior;
__Reply__task_test_async_upcall_propagation_t Reply_task_test_async_upcall_propagation;
__Reply__task_map_kcdata_object_64_t Reply_task_map_kcdata_object_64;
};
#endif /* !__RequestUnion__task_subsystem__defined */
@@ -2513,7 +2821,15 @@ union __ReplyUnion__task_subsystem {
{ "task_inspect", 3451 },\
{ "task_get_exc_guard_behavior", 3452 },\
{ "task_set_exc_guard_behavior", 3453 },\
{ "task_create_suid_cred", 3454 }
{ "task_dyld_process_info_notify_register", 3456 },\
{ "task_create_identity_token", 3457 },\
{ "task_identity_token_get_task_port", 3458 },\
{ "task_dyld_process_info_notify_deregister", 3459 },\
{ "task_get_exception_ports_info", 3460 },\
{ "task_test_sync_upcall", 3461 },\
{ "task_set_corpse_forking_behavior", 3462 },\
{ "task_test_async_upcall_propagation", 3463 },\
{ "task_map_kcdata_object_64", 3464 }
#endif
#ifdef __AfterMigUserHeader

View File

@@ -110,8 +110,7 @@ typedef integer_t *task_policy_t;
#define TASK_BASE_LATENCY_QOS_POLICY 10
#define TASK_BASE_THROUGHPUT_QOS_POLICY 11
enum task_role {
typedef enum task_role {
TASK_RENICED = -1,
TASK_UNSPECIFIED = 0,
TASK_FOREGROUND_APPLICATION = 1,
@@ -122,9 +121,7 @@ enum task_role {
TASK_NONUI_APPLICATION = 6,
TASK_DEFAULT_APPLICATION = 7,
TASK_DARWINBG_APPLICATION = 8,
};
typedef integer_t task_role_t;
} task_role_t;
struct task_category_policy {
task_role_t role;
@@ -184,6 +181,4 @@ typedef struct task_qos_policy *task_qos_policy_t;
#define PROC_FLAG_IOS_APPLICATION PROC_FLAG_APPLICATION /* Process is an application */
#endif /* _MACH_TASK_POLICY_H_ */

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t;
#endif /* AUTOTEST */
#ifndef thread_act_MSG_COUNT
#define thread_act_MSG_COUNT 28
#define thread_act_MSG_COUNT 31
#endif /* thread_act_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
@@ -71,8 +75,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_terminate
(
thread_act_t target_act
@@ -84,11 +87,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t act_get_state
(
thread_act_t target_act,
thread_read_t target_act,
int flavor,
thread_state_t old_state,
mach_msg_type_number_t *old_stateCnt
@@ -100,8 +102,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t act_set_state
(
thread_act_t target_act,
@@ -119,7 +120,7 @@ extern
__WATCHOS_PROHIBITED
kern_return_t thread_get_state
(
thread_act_t target_act,
thread_read_t target_act,
thread_state_flavor_t flavor,
thread_state_t old_state,
mach_msg_type_number_t *old_stateCnt
@@ -149,7 +150,7 @@ extern
__WATCHOS_PROHIBITED
kern_return_t thread_suspend
(
thread_act_t target_act
thread_read_t target_act
);
/* Routine thread_resume */
@@ -161,7 +162,7 @@ extern
__WATCHOS_PROHIBITED
kern_return_t thread_resume
(
thread_act_t target_act
thread_read_t target_act
);
/* Routine thread_abort */
@@ -194,8 +195,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_depress_abort
(
thread_act_t thread
@@ -207,11 +207,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_get_special_port
(
thread_act_t thr_act,
thread_inspect_t thr_act,
int which_port,
mach_port_t *special_port
);
@@ -222,8 +221,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_set_special_port
(
thread_act_t thr_act,
@@ -251,8 +249,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_set_exception_ports
(
thread_act_t thread,
@@ -268,11 +265,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_get_exception_ports
(
thread_inspect_t thread,
thread_act_t thread,
exception_mask_t exception_mask,
exception_mask_array_t masks,
mach_msg_type_number_t *masksCnt,
@@ -287,8 +283,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_swap_exception_ports
(
thread_act_t thread,
@@ -402,7 +397,7 @@ extern
#endif /* mig_external */
kern_return_t thread_get_assignment
(
thread_act_t thread,
thread_inspect_t thread,
processor_set_name_t *assigned_set
);
@@ -429,11 +424,10 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_get_mach_voucher
(
thread_act_t thr_act,
thread_read_t thr_act,
mach_voucher_selector_t which,
ipc_voucher_t *voucher
);
@@ -444,8 +438,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_set_mach_voucher
(
thread_act_t thr_act,
@@ -458,8 +451,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t thread_swap_mach_voucher
(
thread_act_t thr_act,
@@ -467,6 +459,40 @@ kern_return_t thread_swap_mach_voucher
ipc_voucher_t *old_voucher
);
/* Routine thread_convert_thread_state */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t thread_convert_thread_state
(
thread_act_t thread,
int direction,
thread_state_flavor_t flavor,
thread_state_t in_state,
mach_msg_type_number_t in_stateCnt,
thread_state_t out_state,
mach_msg_type_number_t *out_stateCnt
);
/* Routine thread_get_exception_ports_info */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t thread_get_exception_ports_info
(
mach_port_t port,
exception_mask_t exception_mask,
exception_mask_array_t masks,
mach_msg_type_number_t *masksCnt,
exception_handler_info_array_t old_handlers_info,
exception_behavior_array_t old_behaviors,
exception_flavor_array_t old_flavors
);
__END_DECLS
/********************** Caution **************************/
@@ -516,7 +542,7 @@ __END_DECLS
NDR_record_t NDR;
int flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[614];
natural_t new_state[1296];
} __Request__act_set_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@@ -543,7 +569,7 @@ __END_DECLS
NDR_record_t NDR;
thread_state_flavor_t flavor;
mach_msg_type_number_t new_stateCnt;
natural_t new_state[614];
natural_t new_state[1296];
} __Request__thread_set_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@@ -851,6 +877,34 @@ __END_DECLS
#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 direction;
thread_state_flavor_t flavor;
mach_msg_type_number_t in_stateCnt;
natural_t in_state[1296];
mach_msg_type_number_t out_stateCnt;
} __Request__thread_convert_thread_state_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;
exception_mask_t exception_mask;
} __Request__thread_get_exception_ports_info_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__thread_act_subsystem__defined */
/* union of all requests */
@@ -886,6 +940,8 @@ union __RequestUnion__thread_act_subsystem {
__Request__thread_get_mach_voucher_t Request_thread_get_mach_voucher;
__Request__thread_set_mach_voucher_t Request_thread_set_mach_voucher;
__Request__thread_swap_mach_voucher_t Request_thread_swap_mach_voucher;
__Request__thread_convert_thread_state_t Request_thread_convert_thread_state;
__Request__thread_get_exception_ports_info_t Request_thread_get_exception_ports_info;
};
#endif /* !__RequestUnion__thread_act_subsystem__defined */
/* typedefs for all replies */
@@ -913,7 +969,7 @@ union __RequestUnion__thread_act_subsystem {
NDR_record_t NDR;
kern_return_t RetCode;
mach_msg_type_number_t old_stateCnt;
natural_t old_state[614];
natural_t old_state[1296];
} __Reply__act_get_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@@ -939,7 +995,7 @@ union __RequestUnion__thread_act_subsystem {
NDR_record_t NDR;
kern_return_t RetCode;
mach_msg_type_number_t old_stateCnt;
natural_t old_state[614];
natural_t old_state[1296];
} __Reply__thread_get_state_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
@@ -1259,6 +1315,37 @@ union __RequestUnion__thread_act_subsystem {
#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 out_stateCnt;
natural_t out_state[1296];
} __Reply__thread_convert_thread_state_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 masksCnt;
exception_mask_t masks[32];
exception_handler_info_t old_handlers_info[32];
exception_behavior_t old_behaviors[32];
thread_state_flavor_t old_flavors[32];
} __Reply__thread_get_exception_ports_info_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__thread_act_subsystem__defined */
/* union of all replies */
@@ -1294,6 +1381,8 @@ union __ReplyUnion__thread_act_subsystem {
__Reply__thread_get_mach_voucher_t Reply_thread_get_mach_voucher;
__Reply__thread_set_mach_voucher_t Reply_thread_set_mach_voucher;
__Reply__thread_swap_mach_voucher_t Reply_thread_swap_mach_voucher;
__Reply__thread_convert_thread_state_t Reply_thread_convert_thread_state;
__Reply__thread_get_exception_ports_info_t Reply_thread_get_exception_ports_info;
};
#endif /* !__RequestUnion__thread_act_subsystem__defined */
@@ -1326,7 +1415,9 @@ union __ReplyUnion__thread_act_subsystem {
{ "thread_set_policy", 3624 },\
{ "thread_get_mach_voucher", 3625 },\
{ "thread_set_mach_voucher", 3626 },\
{ "thread_swap_mach_voucher", 3627 }
{ "thread_swap_mach_voucher", 3627 },\
{ "thread_convert_thread_state", 3628 },\
{ "thread_get_exception_ports_info", 3630 }
#endif
#ifdef __AfterMigUserHeader

View File

@@ -131,7 +131,11 @@ typedef struct thread_extended_policy *thread_extended_policy_t;
*
* computation: This is the nominal amount of computation
* time needed during a separate processing arrival, specified
* in absolute time units.
* in absolute time units. The thread may be preempted after
* the computation time has elapsed.
* If (computation < constraint/2) it will be forced to
* constraint/2 to avoid unintended preemption and associated
* timer interrupts.
*
* constraint: This is the maximum amount of real time that
* may elapse from the start of a separate processing arrival
@@ -139,11 +143,11 @@ typedef struct thread_extended_policy *thread_extended_policy_t;
* specified in absolute time units. Must be (>= computation).
* Note that latency = (constraint - computation).
*
* preemptible: This indicates that the computation may be
* interrupted, subject to the constraint specified above.
* preemptible: IGNORED (This indicates that the computation may be
* interrupted, subject to the constraint specified above.)
*/
#define THREAD_TIME_CONSTRAINT_POLICY 2
#define THREAD_TIME_CONSTRAINT_POLICY 2
struct thread_time_constraint_policy {
uint32_t period;
@@ -261,6 +265,4 @@ typedef struct thread_throughput_qos_policy *thread_throughput_qos_policy_t;
(sizeof (thread_throughput_qos_policy_data_t) / sizeof (integer_t)))
#endif /* _MACH_THREAD_POLICY_H_ */

View File

@@ -25,7 +25,10 @@
#ifdef __cplusplus
extern "C" {
#endif
extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import));
#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
#endif
extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
#ifdef __cplusplus
}
#endif
@@ -41,7 +44,7 @@ extern "C" {
#define FUNCTION_PTR_T
typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
typedef struct {
char *name;
char * name;
function_ptr_t function;
} function_table_entry;
typedef function_table_entry *function_table_t;
@@ -49,9 +52,10 @@ typedef function_table_entry *function_table_t;
#endif /* AUTOTEST */
#ifndef vm_map_MSG_COUNT
#define vm_map_MSG_COUNT 32
#define vm_map_MSG_COUNT 33
#endif /* vm_map_MSG_COUNT */
#include <Availability.h>
#include <mach/std_types.h>
#include <mach/mig.h>
#include <mach/mig.h>
@@ -74,7 +78,7 @@ extern
#endif /* mig_external */
kern_return_t vm_region
(
vm_map_t target_task,
vm_map_read_t target_task,
vm_address_t *address,
vm_size_t *size,
vm_region_flavor_t flavor,
@@ -147,7 +151,7 @@ extern
#endif /* mig_external */
kern_return_t vm_read
(
vm_map_t target_task,
vm_map_read_t target_task,
vm_address_t address,
vm_size_t size,
vm_offset_t *data,
@@ -162,7 +166,7 @@ extern
#endif /* mig_external */
kern_return_t vm_read_list
(
vm_map_t target_task,
vm_map_read_t target_task,
vm_read_entry_t data_list,
natural_t count
);
@@ -203,7 +207,7 @@ extern
#endif /* mig_external */
kern_return_t vm_read_overwrite
(
vm_map_t target_task,
vm_map_read_t target_task,
vm_address_t address,
vm_size_t size,
vm_address_t data,
@@ -301,8 +305,7 @@ mig_external
#else
extern
#endif /* mig_external */
__WATCHOS_PROHIBITED
__TVOS_PROHIBITED
__TVOS_PROHIBITED __WATCHOS_PROHIBITED
kern_return_t task_wire
(
vm_map_t target_task,
@@ -333,7 +336,7 @@ extern
#endif /* mig_external */
kern_return_t vm_map_page_query
(
vm_map_t target_map,
vm_map_read_t target_map,
vm_offset_t offset,
integer_t *disposition,
integer_t *ref_count
@@ -347,7 +350,7 @@ extern
#endif /* mig_external */
kern_return_t mach_vm_region_info
(
vm_map_t task,
vm_map_read_t task,
vm_address_t address,
vm_info_region_t *region,
vm_info_object_array_t *objects,
@@ -362,7 +365,7 @@ extern
#endif /* mig_external */
kern_return_t vm_mapped_pages_info
(
vm_map_t task,
vm_map_read_t task,
page_address_array_t *pages,
mach_msg_type_number_t *pagesCnt
);
@@ -375,7 +378,7 @@ extern
#endif /* mig_external */
kern_return_t vm_region_recurse
(
vm_map_t target_task,
vm_map_read_t target_task,
vm_address_t *address,
vm_size_t *size,
natural_t *nesting_depth,
@@ -391,7 +394,7 @@ extern
#endif /* mig_external */
kern_return_t vm_region_recurse_64
(
vm_map_t target_task,
vm_map_read_t target_task,
vm_address_t *address,
vm_size_t *size,
natural_t *nesting_depth,
@@ -407,7 +410,7 @@ extern
#endif /* mig_external */
kern_return_t mach_vm_region_info_64
(
vm_map_t task,
vm_map_read_t task,
vm_address_t address,
vm_info_region_64_t *region,
vm_info_object_array_t *objects,
@@ -422,7 +425,7 @@ extern
#endif /* mig_external */
kern_return_t vm_region_64
(
vm_map_t target_task,
vm_map_read_t target_task,
vm_address_t *address,
vm_size_t *size,
vm_region_flavor_t flavor,
@@ -493,6 +496,27 @@ kern_return_t vm_map_exec_lockdown
vm_map_t target_task
);
/* Routine vm_remap_new */
#ifdef mig_external
mig_external
#else
extern
#endif /* mig_external */
kern_return_t vm_remap_new
(
vm_map_t target_task,
vm_address_t *target_address,
vm_size_t size,
vm_address_t mask,
int flags,
vm_map_read_t src_task,
vm_address_t src_address,
boolean_t copy,
vm_prot_t *cur_protection,
vm_prot_t *max_protection,
vm_inherit_t inheritance
);
__END_DECLS
/********************** Caution **************************/
@@ -924,6 +948,30 @@ __END_DECLS
#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 src_task;
/* end of the kernel processed data */
NDR_record_t NDR;
vm_address_t target_address;
vm_size_t size;
vm_address_t mask;
int flags;
vm_address_t src_address;
boolean_t copy;
vm_prot_t cur_protection;
vm_prot_t max_protection;
vm_inherit_t inheritance;
} __Request__vm_remap_new_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Request__vm_map_subsystem__defined */
/* union of all requests */
@@ -959,6 +1007,7 @@ union __RequestUnion__vm_map_subsystem {
__Request__vm_map_64_t Request_vm_map_64;
__Request__vm_purgable_control_t Request_vm_purgable_control;
__Request__vm_map_exec_lockdown_t Request_vm_map_exec_lockdown;
__Request__vm_remap_new_t Request_vm_remap_new;
};
#endif /* !__RequestUnion__vm_map_subsystem__defined */
/* typedefs for all replies */
@@ -1363,6 +1412,21 @@ union __RequestUnion__vm_map_subsystem {
#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;
vm_address_t target_address;
vm_prot_t cur_protection;
vm_prot_t max_protection;
} __Reply__vm_remap_new_t __attribute__((unused));
#ifdef __MigPackStructs
#pragma pack(pop)
#endif
#endif /* !__Reply__vm_map_subsystem__defined */
/* union of all replies */
@@ -1398,6 +1462,7 @@ union __ReplyUnion__vm_map_subsystem {
__Reply__vm_map_64_t Reply_vm_map_64;
__Reply__vm_purgable_control_t Reply_vm_purgable_control;
__Reply__vm_map_exec_lockdown_t Reply_vm_map_exec_lockdown;
__Reply__vm_remap_new_t Reply_vm_remap_new;
};
#endif /* !__RequestUnion__vm_map_subsystem__defined */
@@ -1430,7 +1495,8 @@ union __ReplyUnion__vm_map_subsystem {
{ "mach_make_memory_entry_64", 3825 },\
{ "vm_map_64", 3826 },\
{ "vm_purgable_control", 3830 },\
{ "vm_map_exec_lockdown", 3831 }
{ "vm_map_exec_lockdown", 3831 },\
{ "vm_remap_new", 3832 }
#endif
#ifdef __AfterMigUserHeader

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
* Copyright (c) 2000-2021 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -96,6 +96,13 @@ typedef int vm_prot_t;
#define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
/*
* This is an alias to VM_PROT_EXECUTE to identify callers that
* want to allocate an hardware assisted Read-only/read-write
* trusted path in userland.
*/
#define VM_PROT_RORW_TP (VM_PROT_EXECUTE)
/*
* An invalid protection value.
* Used only by memory_object_lock_request to indicate no change
@@ -103,7 +110,8 @@ typedef int vm_prot_t;
* looks like VM_PROT_ALL and then some.
*/
#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x08)
#define VM_PROT_NO_CHANGE_LEGACY ((vm_prot_t) 0x08)
#define VM_PROT_NO_CHANGE ((vm_prot_t) 0x01000000)
/*
* When a caller finds that he cannot obtain write permission on a
@@ -149,4 +157,22 @@ typedef int vm_prot_t;
#define VM_PROT_STRIP_READ ((vm_prot_t) 0x80)
#define VM_PROT_EXECUTE_ONLY (VM_PROT_EXECUTE|VM_PROT_STRIP_READ)
#if defined(__x86_64__)
/*
* Another invalid protection value to support specifying different
* execute permissions for user- and supervisor- modes. When
* MBE is enabled in a VM, VM_PROT_EXECUTE is used to indicate
* supervisor-mode execute permission, and VM_PROT_UEXEC specifies
* user-mode execute permission. Currently only used by the
* x86 Hypervisor kext.
*/
#define VM_PROT_UEXEC ((vm_prot_t) 0x8) /* User-mode Execute Permission */
#define VM_PROT_ALLEXEC (VM_PROT_EXECUTE | VM_PROT_UEXEC)
#else
#define VM_PROT_ALLEXEC (VM_PROT_EXECUTE)
#endif /* defined(__x86_64__) */
#endif /* _MACH_VM_PROT_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -66,8 +66,12 @@
#ifndef _MACH_VM_STATISTICS_H_
#define _MACH_VM_STATISTICS_H_
#include <mach/machine/vm_types.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
#include <mach/machine/vm_types.h>
#include <mach/machine/kern_return.h>
/*
* vm_statistics
@@ -167,6 +171,8 @@ struct vm_statistics64 {
typedef struct vm_statistics64 *vm_statistics64_t;
typedef struct vm_statistics64 vm_statistics64_data_t;
kern_return_t vm_stats(void *info, unsigned int *count);
/*
* VM_STATISTICS_TRUNCATE_TO_32_BIT
*
@@ -225,7 +231,6 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
#define VM_PAGE_QUERY_PAGE_CS_NX 0x400
#define VM_PAGE_QUERY_PAGE_REUSABLE 0x800
/*
* VM allocation flags:
*
@@ -258,24 +263,26 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
* cached so that they will be stolen first if memory runs low.
*/
#define VM_FLAGS_FIXED 0x0000
#define VM_FLAGS_ANYWHERE 0x0001
#define VM_FLAGS_PURGABLE 0x0002
#define VM_FLAGS_4GB_CHUNK 0x0004
#define VM_FLAGS_RANDOM_ADDR 0x0008
#define VM_FLAGS_NO_CACHE 0x0010
#define VM_FLAGS_RESILIENT_CODESIGN 0x0020
#define VM_FLAGS_RESILIENT_MEDIA 0x0040
#define VM_FLAGS_OVERWRITE 0x4000 /* delete any existing mappings first */
#define VM_FLAGS_FIXED 0x00000000
#define VM_FLAGS_ANYWHERE 0x00000001
#define VM_FLAGS_PURGABLE 0x00000002
#define VM_FLAGS_4GB_CHUNK 0x00000004
#define VM_FLAGS_RANDOM_ADDR 0x00000008
#define VM_FLAGS_NO_CACHE 0x00000010
#define VM_FLAGS_RESILIENT_CODESIGN 0x00000020
#define VM_FLAGS_RESILIENT_MEDIA 0x00000040
#define VM_FLAGS_PERMANENT 0x00000080
#define VM_FLAGS_TPRO 0x00001000
#define VM_FLAGS_OVERWRITE 0x00004000 /* delete any existing mappings first */
/*
* VM_FLAGS_SUPERPAGE_MASK
* 3 bits that specify whether large pages should be used instead of
* base pages (!=0), as well as the requested page size.
*/
#define VM_FLAGS_SUPERPAGE_MASK 0x70000 /* bits 0x10000, 0x20000, 0x40000 */
#define VM_FLAGS_RETURN_DATA_ADDR 0x100000 /* Return address of target data, rather than base of page */
#define VM_FLAGS_RETURN_4K_DATA_ADDR 0x800000 /* Return 4K aligned address of target data */
#define VM_FLAGS_ALIAS_MASK 0xFF000000
#define VM_FLAGS_SUPERPAGE_MASK 0x00070000 /* bits 0x10000, 0x20000, 0x40000 */
#define VM_FLAGS_RETURN_DATA_ADDR 0x00100000 /* Return address of target data, rather than base of page */
#define VM_FLAGS_RETURN_4K_DATA_ADDR 0x00800000 /* Return 4K aligned address of target data */
#define VM_FLAGS_ALIAS_MASK 0xFF000000
#define VM_GET_FLAGS_ALIAS(flags, alias) \
(alias) = ((flags) & VM_FLAGS_ALIAS_MASK) >> 24
#define VM_SET_FLAGS_ALIAS(flags, alias) \
@@ -289,8 +296,10 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
VM_FLAGS_4GB_CHUNK | \
VM_FLAGS_RANDOM_ADDR | \
VM_FLAGS_NO_CACHE | \
VM_FLAGS_PERMANENT | \
VM_FLAGS_OVERWRITE | \
VM_FLAGS_SUPERPAGE_MASK | \
VM_FLAGS_TPRO | \
VM_FLAGS_ALIAS_MASK)
#define VM_FLAGS_USER_MAP (VM_FLAGS_USER_ALLOCATE | \
VM_FLAGS_RETURN_4K_DATA_ADDR | \
@@ -318,7 +327,10 @@ typedef struct vm_purgeable_info *vm_purgeable_info_t;
/* Reasons for exception for virtual memory */
enum virtual_memory_guard_exception_codes {
kGUARD_EXC_DEALLOC_GAP = 1u << 0
kGUARD_EXC_DEALLOC_GAP = 1u << 0,
kGUARD_EXC_RECLAIM_COPYIO_FAILURE = 1u << 1,
kGUARD_EXC_RECLAIM_INDEX_FAILURE = 1u << 2,
kGUARD_EXC_RECLAIM_DEALLOCATE_FAILURE = 1u << 3,
};
@@ -333,9 +345,12 @@ enum virtual_memory_guard_exception_codes {
#define VM_LEDGER_TAG_GRAPHICS 0x00000004
#define VM_LEDGER_TAG_NEURAL 0x00000005
#define VM_LEDGER_TAG_MAX 0x00000005
#define VM_LEDGER_TAG_UNCHANGED ((int)-1)
/* individual bits: */
#define VM_LEDGER_FLAG_NO_FOOTPRINT 0x00000001
#define VM_LEDGER_FLAGS (VM_LEDGER_FLAG_NO_FOOTPRINT)
#define VM_LEDGER_FLAG_NO_FOOTPRINT (1 << 0)
#define VM_LEDGER_FLAG_NO_FOOTPRINT_FOR_DEBUG (1 << 1)
#define VM_LEDGER_FLAGS (VM_LEDGER_FLAG_NO_FOOTPRINT | VM_LEDGER_FLAG_NO_FOOTPRINT_FOR_DEBUG)
#define VM_MEMORY_MALLOC 1
@@ -352,6 +367,8 @@ enum virtual_memory_guard_exception_codes {
#define VM_MEMORY_MALLOC_NANO 11
#define VM_MEMORY_MALLOC_MEDIUM 12
#define VM_MEMORY_MALLOC_PGUARD 13 // Will be removed
#define VM_MEMORY_MALLOC_PROB_GUARD 13
#define VM_MEMORY_MACH_MSG 20
#define VM_MEMORY_IOKIT 21
@@ -512,12 +529,38 @@ enum virtual_memory_guard_exception_codes {
/* memory allocated by CoreMedia for global image registration of frames */
#define VM_MEMORY_CM_REGWARP 101
/* memory allocated by EmbeddedAcousticRecognition for speech decoder */
#define VM_MEMORY_EAR_DECODER 102
/* CoreUI cached image data */
#define VM_MEMORY_COREUI_CACHED_IMAGE_DATA 103
/* ColorSync is using mmap for read-only copies of ICC profile data */
#define VM_MEMORY_COLORSYNC 104
/* backtrace info for simulated crashes */
#define VM_MEMORY_BTINFO 105
/* Reserve 230-239 for Rosetta */
#define VM_MEMORY_ROSETTA 230
#define VM_MEMORY_ROSETTA_THREAD_CONTEXT 231
#define VM_MEMORY_ROSETTA_INDIRECT_BRANCH_MAP 232
#define VM_MEMORY_ROSETTA_RETURN_STACK 233
#define VM_MEMORY_ROSETTA_EXECUTABLE_HEAP 234
#define VM_MEMORY_ROSETTA_USER_LDT 235
#define VM_MEMORY_ROSETTA_ARENA 236
#define VM_MEMORY_ROSETTA_10 239
/* Reserve 240-255 for application */
#define VM_MEMORY_APPLICATION_SPECIFIC_1 240
#define VM_MEMORY_APPLICATION_SPECIFIC_16 255
#define VM_MEMORY_COUNT 256
#define VM_MAKE_TAG(tag) ((tag) << 24)
__END_DECLS
#endif /* _MACH_VM_STATISTICS_H_ */

View File

@@ -36,9 +36,10 @@
#include <mach/machine/vm_types.h>
#include <stdint.h>
#include <sys/cdefs.h>
typedef vm_offset_t pointer_t;
typedef vm_offset_t vm_address_t;
typedef vm_offset_t pointer_t __kernel_ptr_semantics;
typedef vm_offset_t vm_address_t __kernel_ptr_semantics;
/*
* We use addr64_t for 64-bit addresses that are used on both
@@ -70,10 +71,12 @@ typedef uint32_t ppnum_t; /* Physical page number */
typedef mach_port_t vm_map_t;
typedef mach_port_t vm_map_t, vm_map_read_t, vm_map_inspect_t;
#define VM_MAP_NULL ((vm_map_t) 0)
#define VM_MAP_INSPECT_NULL ((vm_map_inspect_t) 0)
#define VM_MAP_READ_NULL ((vm_map_read_t) 0)
/*
* Evolving definitions, likely to change.
@@ -82,6 +85,20 @@ typedef mach_port_t vm_map_t;
typedef uint64_t vm_object_offset_t;
typedef uint64_t vm_object_size_t;
/*!
* @typedef
*
* @brief
* Pair of a min/max address used to denote a memory region.
*
* @discussion
* @c min_address must be smaller or equal to @c max_address.
*/
typedef struct mach_vm_range {
mach_vm_offset_t min_address;
mach_vm_offset_t max_address;
} *mach_vm_range_t;

View File

@@ -78,7 +78,7 @@
typedef struct ipc_info_space {
natural_t iis_genno_mask; /* generation number mask */
natural_t iis_table_size; /* size of table */
natural_t iis_table_next; /* next possible size of table */
natural_t iis_table_next; /* next possible size of table (UNUSED) */
natural_t iis_tree_size; /* size of tree (UNUSED) */
natural_t iis_tree_small; /* # of small entries in tree (UNUSED) */
natural_t iis_tree_hash; /* # of hashed entries in tree (UNUSED) */
@@ -87,7 +87,7 @@ typedef struct ipc_info_space {
typedef struct ipc_info_space_basic {
natural_t iisb_genno_mask; /* generation number mask */
natural_t iisb_table_size; /* size of table */
natural_t iisb_table_next; /* next possible size of table */
natural_t iisb_table_next; /* next possible size of table (UNUSED) */
natural_t iisb_table_inuse; /* number of entries in use */
natural_t iisb_reserved[2]; /* future expansion */
} ipc_info_space_basic_t;
@@ -113,4 +113,11 @@ typedef struct ipc_info_tree_name {
typedef ipc_info_tree_name_t *ipc_info_tree_name_array_t;
typedef struct ipc_info_port {
natural_t iip_port_object; /* port object identifier */
natural_t iip_receiver_object; /* receiver task identifier (if any) */
} ipc_info_port_t;
typedef ipc_info_port_t *exception_handler_info_array_t;
#endif /* _MACH_DEBUG_IPC_INFO_H_ */

View File

@@ -0,0 +1,200 @@
/*
* 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.
*/
/*
*/
/*
* Mach kernel debugging interface type declarations
*/
#ifndef _MACH_DEBUG_MACH_DEBUG_TYPES_H_
#define _MACH_DEBUG_MACH_DEBUG_TYPES_H_
#include <mach_debug/ipc_info.h>
#include <mach_debug/vm_info.h>
#include <mach_debug/zone_info.h>
#include <mach_debug/page_info.h>
#include <mach_debug/hash_info.h>
#include <mach_debug/lockgroup_info.h>
#define MACH_CORE_FILEHEADER_SIGNATURE 0x0063614d20646152ULL
#define MACH_CORE_FILEHEADER_V2_SIGNATURE 0x63614d2073736f42ULL
#define MACH_CORE_FILEHEADER_MAXFILES 16
#define MACH_CORE_FILEHEADER_NAMELEN 16
/* The following are defined for mach_core_fileheader_v2 */
#define MACH_CORE_FILEHEADER_V2_FLAG_LOG_ENCRYPTED_AEA (1ULL << 0) /* The log is encrypted using AEA */
#define MACH_CORE_FILEHEADER_V2_FLAG_EXISTING_COREFILE_KEY_FORMAT_NIST_P256 (1ULL << 8) /* The public key is an NIST-P256 ECC key */
#define MACH_CORE_FILEHEADER_V2_FLAG_NEXT_COREFILE_KEY_FORMAT_NIST_P256 (1ULL << 16) /* The next public key is an NIST-P256 ECC key */
#define MACH_CORE_FILEHEADER_V2_FLAGS_EXISTING_COREFILE_KEY_FORMAT_MASK (0x1ULL << 8) /* A bit-mask for all supported key formats */
#define MACH_CORE_FILEHEADER_V2_FLAGS_NEXT_COREFILE_KEY_FORMAT_MASK (0x1ULL << 16) /* A bit-mask for all supported next key formats */
#define MACH_CORE_FILEHEADER_V2_FLAGS_NEXT_KEY_FORMAT_TO_KEY_FORMAT(x) (((x) >> 8) & MACH_CORE_FILEHEADER_V2_FLAGS_EXISTING_COREFILE_KEY_FORMAT_MASK)
/* The following are defined for mach_core_details_v2 */
#define MACH_CORE_DETAILS_V2_FLAG_ENCRYPTED_AEA (1ULL << 0) /* This core is encrypted using AEA */
#define MACH_CORE_DETAILS_V2_FLAG_COMPRESSED_ZLIB (1ULL << 8) /* This core is compressed using ZLib */
#define MACH_CORE_DETAILS_V2_FLAG_COMPRESSED_LZ4 (1ULL << 9) /* This core is compressed using LZ4 */
typedef char symtab_name_t[32];
/*
***********************
*
* Mach corefile layout
*
***********************
*
* uint64_t signature
* uint64_t log_offset >---+
* uint64_t log_length |
* mach_core_details files[MACH_CORE_FILEHEADER_MAXFILES] |
* |--> uint64_t gzip_offset >---+ |
* | uint64_t gzip_length | |
* | char core_name[] | |
* |--> uint64_t gzip_offset >---+ | |
* | uint64_t gzip_length | | |
* | char core_name[] | | |
* |--> [...] | | |
* [log data. Plain-text] | | <---+
* [core #1 data. Zlib compressed] | <---+
* [core #2 data. Zlib compressed] <---+
* [core #x data...]
*/
struct mach_core_details {
uint64_t gzip_offset;
uint64_t gzip_length;
char core_name[MACH_CORE_FILEHEADER_NAMELEN];
};
struct mach_core_fileheader {
uint64_t signature; /* MACH_CORE_FILEHEADER_SIGNATURE */
uint64_t log_offset;
uint64_t log_length;
uint64_t num_files;
struct mach_core_details files[MACH_CORE_FILEHEADER_MAXFILES];
};
/*
* Mach corefile V2 headers are denoted with MACH_CORE_FILEHEADER_V2_SIGNATURE.
* Note that the V2 headers contain a version field that further indicates the version of the
* header's contents. For example, if a V2 header's 'version' field indicates version 5, then
* the header follows the format of the 'mach_core_fileheader_v5' structure.
*
* Further note that 'mach_core_details_' structures are not bound to the same versioning scheme
* as the header itself. This means that it's perfectly acceptable for a 'mach_core_fileheader_v5' header
* to make use of 'mach_core_details_v2'
*
**************************
*
* Mach corefile layout V2 (using a version 2 header struct as an example)
*
**************************
*
* uint64_t signature
* uint32_t version
* uint64_t flags
* uint64_t pub_key_offset >---+
* uint16_t pub_key_length |
* uint64_t log_offset >---+ |
* uint64_t log_length | |
* uint64_t num_files | |
* mach_core_details_v2 files[] | |
* |--> uint64_t flags | |
* | uint64_t offset >---+ | |
* | uint64_t length | | |
* | char core_name[] | | |
* |--> uint64_t flags | | |
* | uint64_t offset >---+ | | |
* | uint64_t length | | | |
* | char core_name[] | | | |
* |--> [...] | | | |
* [public key data] | | | <---+
* [log data. Plain-text or an AEA container] | | <---+
* [core #1 data. Zlib/LZ4 compressed. Possibly in an AEA container] | <---+
* [core #2 data. Zlib/LZ4 compressed. Possibly in an AEA container] <---+
* [core #x data...]
*/
struct mach_core_details_v2 {
uint64_t flags; /* See the MACH_CORE_DETAILS_V2_FLAG_* definitions */
uint64_t offset;
uint64_t length;
char core_name[MACH_CORE_FILEHEADER_NAMELEN];
};
struct mach_core_fileheader_base {
uint64_t signature; /* MACH_CORE_FILEHEADER_V2_SIGNATURE */
uint32_t version;
};
struct mach_core_fileheader_v2 {
uint64_t signature; /* MACH_CORE_FILEHEADER_V2_SIGNATURE */
uint32_t version; /* 2 */
uint64_t flags; /* See the MACH_CORE_FILEHEADER_V2_FLAG_* definitions */
uint64_t pub_key_offset; /* Offset of the public key */
uint16_t pub_key_length; /* Length of the public key */
uint64_t log_offset;
uint64_t log_length;
uint64_t num_files;
struct mach_core_details_v2 files[];
};
#define KOBJECT_DESCRIPTION_LENGTH 512
typedef char kobject_description_t[KOBJECT_DESCRIPTION_LENGTH];
#endif /* _MACH_DEBUG_MACH_DEBUG_TYPES_H_ */

View File

@@ -97,6 +97,10 @@ typedef struct _malloc_zone_t {
* not yet been allocated. False negatives are not allowed.
*/
boolean_t (* MALLOC_ZONE_FN_PTR(claimed_address))(struct _malloc_zone_t *zone, void *ptr);
/* For zone 0 implementations: try to free ptr, promising to call find_zone_and_free
* if it turns out not to belong to us */
void (* MALLOC_ZONE_FN_PTR(try_free_default))(struct _malloc_zone_t *zone, void *ptr);
} malloc_zone_t;
/********* Creation and destruction ************/
@@ -216,7 +220,7 @@ typedef void vm_range_recorder_t(task_t, void *, unsigned type, vm_range_t *, un
/* given a task and context, "records" the specified addresses */
/* Print function for the print_task() operation. */
typedef void print_task_printer_t(const char *fmt, ...);
typedef void print_task_printer_t(const char *fmt, ...) __printflike(1,2);
typedef struct malloc_introspection_t {
kern_return_t (* MALLOC_INTROSPECT_FN_PTR(enumerator))(task_t task, void *, unsigned type_mask, vm_address_t zone_address, memory_reader_t reader, vm_range_recorder_t recorder); /* enumerates all the malloc pointers in use */
@@ -309,6 +313,37 @@ extern void malloc_zone_enumerate_discharged_pointers(malloc_zone_t *zone, void
extern void malloc_zone_enumerate_discharged_pointers(malloc_zone_t *zone, void *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
#endif /* __BLOCKS__ */
/********* Zone version summary ************/
// Version 0, but optional:
// malloc_zone_t::batch_malloc
// malloc_zone_t::batch_free
// Version 5:
// malloc_zone_t::memalign
// Version 6:
// malloc_zone_t::free_definite_size
// Version 7:
// malloc_introspection_t::enable_discharge_checking
// malloc_introspection_t::disable_discharge_checking
// malloc_introspection_t::discharge
// Version 8:
// malloc_zone_t::pressure_relief
// Version 9:
// malloc_introspection_t::reinit_lock
// Version 10:
// malloc_zone_t::claimed_address
// Version 11:
// malloc_introspection_t::print_task
// Version 12:
// malloc_introspection_t::task_statistics
// Version 13:
// - malloc_zone_t::malloc and malloc_zone_t::calloc assume responsibility for
// setting errno to ENOMEM on failure
// - malloc_zone_t::try_free_default
// These functions are optional and calling them requires two checks:
// * Check zone version to ensure zone struct is large enough to include the member.
// * Check that the function pointer is not null.
__END_DECLS
#endif /* _MALLOC_MALLOC_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
* Copyright (c) 2000-2021 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -63,28 +63,30 @@
#ifndef _NET_IF_H_
#define _NET_IF_H_
#include <sys/cdefs.h>
#include <net/net_kev.h>
#define IF_NAMESIZE 16
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#include <sys/cdefs.h>
#include <sys/appleapiopts.h>
#ifdef __APPLE__
#include <net/if_var.h>
#include <net/net_kev.h>
#include <sys/types.h>
#include <sys/socket.h>
#endif
#ifndef IFNAMSIZ
#define IFNAMSIZ IF_NAMESIZE
#endif
struct if_clonereq {
int ifcr_total; /* total cloners (out) */
int ifcr_count; /* room for this many in user buffer */
char *ifcr_buffer; /* buffer for cloner names */
};
#define IFF_UP 0x1 /* interface is up */
#define IFF_BROADCAST 0x2 /* broadcast address valid */
#define IFF_DEBUG 0x4 /* turn on debugging */
@@ -104,7 +106,6 @@ struct if_clonereq {
#define IFF_MULTICAST 0x8000 /* supports multicast */
/*
* Capabilities that interfaces can advertise.
*
@@ -149,9 +150,14 @@ struct if_clonereq {
#define IFQ_MAXLEN 128
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
#define IFQ_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */
#define IFQ_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */
#define IFQ_DEF_C_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */
#define IFQ_DEF_C_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */
#define IFQ_DEF_L4S_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */
#define IFQ_DEF_L4S_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */
#define IFQ_LL_C_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */
#define IFQ_LL_C_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */
#define IFQ_LL_L4S_TARGET_DELAY (10ULL * 1000 * 1000) /* 10 ms */
#define IFQ_LL_L4S_UPDATE_INTERVAL (100ULL * 1000 * 1000) /* 100 ms */
/*
* Message format for use in obtaining information about interfaces
* from sysctl and the routing socket
@@ -278,16 +284,17 @@ struct ifkpi {
#pragma pack()
/*
* Interface request structure used for socket
* ioctl's. All interface ioctl's must have parameter
* definitions which begin with ifr_name. The
* remainder may be interface specific.
*/
#ifdef IFREQ_OPAQUE
struct ifreq;
#else
struct ifreq {
#ifndef IFNAMSIZ
#define IFNAMSIZ IF_NAMESIZE
#endif
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct sockaddr ifru_addr;
@@ -343,12 +350,19 @@ struct ifreq {
((ifr).ifr_addr.sa_len > sizeof (struct sockaddr) ? \
(sizeof (struct ifreq) - sizeof (struct sockaddr) + \
(ifr).ifr_addr.sa_len) : sizeof (struct ifreq))
#endif /* IFREQ_OPAQUE */
struct ifaliasreq {
char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
#if __has_ptrcheck
struct sockaddr_in ifra_addr;
struct sockaddr_in ifra_broadaddr;
struct sockaddr_in ifra_mask;
#else
struct sockaddr ifra_addr;
struct sockaddr ifra_broadaddr;
struct sockaddr ifra_mask;
#endif /* __has_ptrcheck */
};
struct rslvmulti_req {
@@ -371,7 +385,6 @@ struct ifmediareq {
#pragma pack()
#pragma pack(4)
struct ifdrv {
char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */
@@ -413,7 +426,6 @@ struct ifconf {
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
/*
* DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure
*/
@@ -423,7 +435,6 @@ struct kev_dl_proto_data {
u_int32_t proto_remaining_count;
};
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
struct if_nameindex {
@@ -439,4 +450,5 @@ void if_freenameindex(struct if_nameindex *);
__END_DECLS
#endif /* !_NET_IF_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2008 Apple Inc. All rights reserved.
* Copyright (c) 2000-2011 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -25,9 +25,8 @@
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
/*
* Copyright (c) 1982, 1986, 1993, 1994
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -58,43 +57,72 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)uio.h 8.5 (Berkeley) 2/22/94
* @(#)if_dl.h 8.1 (Berkeley) 6/10/93
* $FreeBSD: src/sys/net/if_dl.h,v 1.10 2000/03/01 02:46:25 archie Exp $
*/
#ifndef _SYS_UIO_H_
#define _SYS_UIO_H_
#ifndef _NET_IF_DL_H_
#define _NET_IF_DL_H_
#include <sys/appleapiopts.h>
#include <sys/types.h>
#include <sys/cdefs.h>
#include <sys/_types.h>
/*
* [XSI] The ssize_t and size_t types shall be defined as described
* in <sys/types.h>.
* A Link-Level Sockaddr may specify the interface in one of two
* ways: either by means of a system-provided index number (computed
* anew and possibly differently on every reboot), or by a human-readable
* string such as "il0" (for managerial convenience).
*
* Census taking actions, such as something akin to SIOCGCONF would return
* both the index and the human name.
*
* High volume transactions (such as giving a link-level ``from'' address
* in a recvfrom or recvmsg call) may be likely only to provide the indexed
* form, (which requires fewer copy operations and less space).
*
* The form and interpretation of the link-level address is purely a matter
* of convention between the device driver and its consumers; however, it is
* expected that all drivers for an interface of a given if_type will agree.
*/
#include <sys/_types/_size_t.h>
#include <sys/_types/_ssize_t.h>
/*
* [XSI] Structure whose address is passed as the second parameter to the
* readv() and writev() functions.
* Structure of a Link-Level sockaddr:
*/
#include <sys/_types/_iovec_t.h>
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
/*
* IO direction for uio_t.
* UIO_READ - data moves into iovec(s) associated with uio_t
* UIO_WRITE - data moves out of iovec(s) associated with uio_t
*/
enum uio_rw { UIO_READ, UIO_WRITE };
#if __has_ptrcheck
#define DLIL_SDLDATACOUNT __counted_by(sdl_len - 8)
#else
#define DLIL_SDLDATACOUNT 12
#endif
struct sockaddr_dl {
u_char sdl_len; /* Total length of sockaddr */
u_char sdl_family; /* AF_LINK */
u_short sdl_index; /* if != 0, system given index for interface */
u_char sdl_type; /* interface type */
u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */
u_char sdl_alen; /* link level address length */
u_char sdl_slen; /* link layer selector length */
char sdl_data[DLIL_SDLDATACOUNT];
/* minimum work area, can be larger;
* contains both if name and ll address */
#ifndef __APPLE__
/* For TokenRing */
u_short sdl_rcf; /* source routing control */
u_short sdl_route[16]; /* source routing information */
#endif
};
#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
#include <sys/cdefs.h>
__BEGIN_DECLS
ssize_t readv(int, const struct iovec *, int) __DARWIN_ALIAS_C(readv);
ssize_t writev(int, const struct iovec *, int) __DARWIN_ALIAS_C(writev);
void link_addr(const char *, struct sockaddr_dl *);
char *link_ntoa(const struct sockaddr_dl *);
__END_DECLS
#endif /* !_SYS_UIO_H_ */
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2019 Apple Inc. All rights reserved.
* Copyright (c) 2000-2021 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -70,6 +70,7 @@
#include <sys/time.h>
#include <sys/queue.h> /* get TAILQ macros */
#ifdef BSD_KERN_PRIVATE
#include <net/pktsched/pktsched.h>
#include <sys/eventhandler.h>
#endif
@@ -90,7 +91,7 @@
#define APPLE_IF_FAM_FIREWIRE 13
#define APPLE_IF_FAM_BOND 14
#define APPLE_IF_FAM_CELLULAR 15
#define APPLE_IF_FAM_6LOWPAN 16
#define APPLE_IF_FAM_UNUSED_16 16 /* Un-used */
#define APPLE_IF_FAM_UTUN 17
#define APPLE_IF_FAM_IPSEC 18
#endif /* __APPLE__ */
@@ -223,6 +224,13 @@ struct if_data64 {
#pragma pack()
#if defined(DRIVERKIT) || defined(PRIVATE) || defined(DRIVERKIT_PRIVATE)
#include <net/if_var_status.h>
#else
struct ifnet_interface_advisory;
#endif /* defined(DRIVERKIT) || defined(PRIVATE) || defined(DRIVERKIT_PRIVATE) */
/*
* Structure defining a queue for a network interface.
*/
@@ -236,7 +244,4 @@ struct ifqueue {
#endif /* !_NET_IF_VAR_H_ */

View File

@@ -84,7 +84,7 @@ struct rt_metrics {
u_int32_t rmx_rttvar; /* estimated rtt variance */
u_int32_t rmx_pksent; /* packets sent using this route */
u_int32_t rmx_state; /* route state */
u_int32_t rmx_filler[3]; /* will be used for T/TCP later */
u_int32_t rmx_filler[3]; /* will be used for TCP's peer-MSS cache */
};
/*
@@ -92,8 +92,6 @@ struct rt_metrics {
*/
#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
#define RTF_UP 0x1 /* route usable */
#define RTF_GATEWAY 0x2 /* destination is a gateway */
#define RTF_HOST 0x4 /* host entry (net otherwise) */
@@ -127,7 +125,8 @@ struct rt_metrics {
#define RTF_PROXY 0x8000000 /* proxying, no interface scope */
#define RTF_ROUTER 0x10000000 /* host is a router */
#define RTF_DEAD 0x20000000 /* Route entry is being freed */
/* 0x40000000 and up unassigned */
#define RTF_GLOBAL 0x40000000 /* route to destination of the global internet */
/* 0x80000000 unassigned */
#define RTPRF_OURS RTF_PROTO3 /* set on routes we manage */
#define RTF_BITS \
@@ -135,10 +134,15 @@ struct rt_metrics {
"\10DELCLONE\11CLONING\12XRESOLVE\13LLINFO\14STATIC\15BLACKHOLE" \
"\16NOIFREF\17PROTO2\20PROTO1\21PRCLONING\22WASCLONED\23PROTO3" \
"\25PINNED\26LOCAL\27BROADCAST\30MULTICAST\31IFSCOPE\32CONDEMNED" \
"\33IFREF\34PROXY\35ROUTER"
"\33IFREF\34PROXY\35ROUTER\37GLOBAL"
#define IS_DIRECT_HOSTROUTE(rt) \
(((rt)->rt_flags & (RTF_HOST | RTF_GATEWAY)) == RTF_HOST)
#define IS_DYNAMIC_DIRECT_HOSTROUTE(rt) \
(((rt)->rt_flags & (RTF_CLONING | RTF_PRCLONING | RTF_HOST | RTF_LLINFO |\
RTF_WASCLONED | RTF_GATEWAY)) ==\
(RTF_HOST | RTF_LLINFO | RTF_WASCLONED))
/*
* Routing statistics.
*/
@@ -184,7 +188,6 @@ struct rt_msghdr2 {
struct rt_metrics rtm_rmx; /* metrics themselves */
};
#define RTM_VERSION 5 /* Up the ante and ignore older versions */
/*

View File

@@ -63,14 +63,14 @@
#ifndef _NETINET_IN_H_
#define _NETINET_IN_H_
#include <sys/appleapiopts.h>
#include <sys/_types.h>
#include <stdint.h> /* uint(8|16|32)_t */
#include <Availability.h>
#include <sys/_types/_in_addr_t.h>
#include <sys/_types/_in_addr_t.h>
#include <sys/_types/_in_port_t.h>
/*
@@ -360,7 +360,6 @@ struct in_addr {
(((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \
(((u_int32_t)(i) & 0xffff0000) == 0xc0a80000))
#define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & 0xffffff00) == 0xe0000000)
#define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
@@ -384,7 +383,6 @@ struct sockaddr_in {
(bcmp(&(a)->s_addr, &(b)->s_addr, \
sizeof (struct in_addr)) == 0)
#define INET_ADDRSTRLEN 16
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
@@ -435,6 +433,7 @@ struct ip_opts {
#define IP_PKTINFO 26 /* get pktinfo on recv socket, set src on sent dgram */
#define IP_RECVPKTINFO IP_PKTINFO /* receive pktinfo w/dgram */
#define IP_RECVTOS 27 /* bool; receive IP TOS w/dgram */
#define IP_DONTFRAG 28 /* don't fragment packet */
#define IP_FW_ADD 40 /* add a firewall rule to chain */
#define IP_FW_DEL 41 /* delete a firewall rule from chain */
@@ -628,7 +627,6 @@ struct in_pktinfo {
*/
#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */
/*
* Names for IP sysctl objects
*/
@@ -660,7 +658,6 @@ struct in_pktinfo {
#undef __KAME_NETINET_IN_H_INCLUDED_
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
__BEGIN_DECLS
int bindresvport(int, struct sockaddr_in *);
@@ -668,4 +665,6 @@ struct sockaddr;
int bindresvport_sa(int, struct sockaddr *);
__END_DECLS
#endif
#endif /* _NETINET_IN_H_ */

View File

@@ -63,10 +63,15 @@
#ifndef _NETINET_TCP_H_
#define _NETINET_TCP_H_
#include <sys/types.h>
#include <sys/appleapiopts.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <machine/endian.h>
#include <machine/types.h> /* __uint32_t */
#include <netinet/in.h>
#include <sys/types.h>
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
typedef __uint32_t tcp_seq;
@@ -101,8 +106,11 @@ struct tcphdr {
#define TH_URG 0x20
#define TH_ECE 0x40
#define TH_CWR 0x80
#define TH_AE 0x100 /* maps into th_x2 */
#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG|TH_ECE|TH_CWR)
#define TH_FLAGS_ALL (TH_FLAGS|TH_PUSH)
#define TH_ACCEPT (TH_FIN|TH_SYN|TH_RST|TH_ACK)
#define TH_ACE (TH_AE|TH_CWR|TH_ECE)
unsigned short th_win; /* window */
unsigned short th_sum; /* checksum */
@@ -143,6 +151,11 @@ struct tcphdr {
#define TCPOPT_FASTOPEN 34
#define TCPOLEN_FASTOPEN_REQ 2
#define TCPOPT_ACCECN0 0xAC /* AccECN Order 0 */
#define TCPOPT_ACCECN1 0XAE /* AccECN Order 1 */
#define TCPOLEN_ACCECN_EMPTY 2 /* Empty option contains kind and length */
#define TCPOLEN_ACCECN_COUNTER 3 /* Length of each AccECN counter */
/* Option definitions */
#define TCPOPT_SACK_PERMIT_HDR \
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK_PERMITTED<<8|TCPOLEN_SACK_PERMITTED)
@@ -229,7 +242,6 @@ struct tcphdr {
#define TCP_NOTSENT_LOWAT 0x201 /* Low water mark for TCP unsent data */
struct tcp_connection_info {
u_int8_t tcpi_state; /* connection state */
u_int8_t tcpi_snd_wscale; /* Window scale for send window */
@@ -280,4 +292,5 @@ struct tcp_connection_info {
};
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2018 Apple Inc. All rights reserved.
* Copyright (c) 2008-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
@@ -98,6 +98,7 @@
#ifndef _NETINET6_IN6_H_
#define _NETINET6_IN6_H_
#include <sys/appleapiopts.h>
#include <sys/_types.h>
#include <sys/_types/_sa_family_t.h>
@@ -206,6 +207,7 @@ struct sockaddr_in6 {
#define IN6ADDR_V4MAPPED_INIT \
{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
#define IN6ADDR_MULTICAST_PREFIX IN6MASK8
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
extern const struct in6_addr in6addr_any;
@@ -297,6 +299,16 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
*/
#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
#define IPV6_ADDR_MC_FLAGS(a) ((a)->s6_addr[1] & 0xf0)
#define IPV6_ADDR_MC_FLAGS_TRANSIENT 0x10
#define IPV6_ADDR_MC_FLAGS_PREFIX 0x20
#define IPV6_ADDR_MC_FLAGS_UNICAST_BASED (IPV6_ADDR_MC_FLAGS_TRANSIENT | IPV6_ADDR_MC_FLAGS_PREFIX)
#define IN6_IS_ADDR_UNICAST_BASED_MULTICAST(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_FLAGS(a) == IPV6_ADDR_MC_FLAGS_UNICAST_BASED))
/*
* Unique Local IPv6 Unicast Addresses (per RFC 4193)
*/
@@ -311,8 +323,9 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
(IPV6_ADDR_MC_FLAGS(a) != IPV6_ADDR_MC_FLAGS_UNICAST_BASED) && \
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
#define IN6_IS_ADDR_MC_SITELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) && \
@@ -325,8 +338,6 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
(__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
/*
* Options for use with [gs]etsockopt at the IPV6 level.
* First word of comment is data type; bool is stored in int.
@@ -369,9 +380,9 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
#define IPV6_MULTICAST_IF 9 /* __uint8_t; set/get IP6 multicast i/f */
#define IPV6_MULTICAST_HOPS 10 /* __uint8_t; set/get IP6 multicast hops */
#define IPV6_MULTICAST_LOOP 11 /* __uint8_t; set/get IP6 mcast loopback */
#define IPV6_MULTICAST_IF 9 /* u_int; set/get IP6 multicast i/f */
#define IPV6_MULTICAST_HOPS 10 /* int; set/get IP6 multicast hops */
#define IPV6_MULTICAST_LOOP 11 /* u_int; set/get IP6 mcast loopback */
#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
@@ -493,7 +504,6 @@ extern const struct in6_addr in6addr_linklocal_allv2routers;
#define IPV6_BOUND_IF 125 /* int; set/get bound interface */
/* to define items, should talk with KAME guys first, for *BSD compatibility */
#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. */
@@ -613,15 +623,13 @@ struct ip6_mtuinfo {
#define IPV6CTL_MAXIFDEFROUTERS 48
#define IPV6CTL_MAXDYNROUTES 49
#define ICMPV6CTL_ND6_ONLINKNSRFC4861 50
#define IPV6CTL_ULA_USETEMPADDR 51
/* New entries should be added here from current IPV6CTL_MAXID value. */
/* to define items, should talk with KAME guys first, for *BSD compatibility */
#define IPV6CTL_MAXID 51
__BEGIN_DECLS
struct cmsghdr;

View File

@@ -8,7 +8,7 @@
#include <TargetConditionals.h>
#include <objc/objc.h>
#if __LP64__ || 0 || NS_BUILD_32_LIKE_64
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else

View File

@@ -36,12 +36,8 @@ struct objc_super {
__unsafe_unretained _Nonnull id receiver;
/// Specifies the particular superclass of the instance to message.
#if !defined(__cplusplus) && !__OBJC2__
/* For compatibility with old objc-runtime.h header */
__unsafe_unretained _Nonnull Class class;
#else
__unsafe_unretained _Nonnull Class super_class;
#endif
/* super_class is the first class to search */
};
#endif
@@ -316,73 +312,4 @@ _objc_msgForward_stret(id _Nonnull receiver, SEL _Nonnull sel, ...)
OBJC_ARM64_UNAVAILABLE;
#endif
/* Variable-argument Messaging Primitives
*
* Use these functions to call methods with a list of arguments, such
* as the one passed to forward:: .
*
* The contents of the argument list are architecture-specific.
* Consult your local function call ABI documentation for details.
*
* These functions must be cast to an appropriate function pointer type
* before being called, except for objc_msgSendv_stret() which must not
* be cast to a struct-returning type.
*/
typedef void* marg_list;
OBJC_EXPORT id _Nullable
objc_msgSendv(id _Nullable self, SEL _Nonnull op, size_t arg_size,
marg_list _Nonnull arg_frame)
OBJC2_UNAVAILABLE;
OBJC_EXPORT void
objc_msgSendv_stret(void * _Nonnull stretAddr, id _Nullable self,
SEL _Nonnull op, size_t arg_size,
marg_list _Nullable arg_frame)
OBJC2_UNAVAILABLE;
/* Note that objc_msgSendv_stret() does not return a structure type,
* and should not be cast to do so. This is unlike objc_msgSend_stret()
* and objc_msgSendSuper_stret().
*/
#if defined(__i386__)
OBJC_EXPORT double
objc_msgSendv_fpret(id _Nullable self, SEL _Nonnull op,
unsigned arg_size, marg_list _Nullable arg_frame)
OBJC2_UNAVAILABLE;
#endif
/* The following marg_list macros are of marginal utility. They
* are included for compatibility with the old objc-class.h header. */
#if !__OBJC2__
#define marg_prearg_size 0
#define marg_malloc(margs, method) \
do { \
margs = (marg_list *)malloc (marg_prearg_size + ((7 + method_getSizeOfArguments(method)) & ~7)); \
} while (0)
#define marg_free(margs) \
do { \
free(margs); \
} while (0)
#define marg_adjustedOffset(method, offset) \
(marg_prearg_size + offset)
#define marg_getRef(margs, offset, type) \
( (type *)((char *)margs + marg_adjustedOffset(method,offset) ) )
#define marg_getValue(margs, offset, type) \
( *marg_getRef(margs, offset, type) )
#define marg_setValue(margs, offset, type, value) \
( marg_getValue(margs, offset, type) = (value) )
#endif
#endif

View File

@@ -28,6 +28,7 @@
#include <Availability.h>
#include <AvailabilityMacros.h>
#include <TargetConditionals.h>
#include <stddef.h>
#include <sys/types.h>
#ifndef __has_feature
@@ -96,6 +97,12 @@
# define NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER 1
#endif
/* The arm64 ABI requires proper casting to ensure arguments are passed
* * correctly. */
#if defined(__arm64__) && !__swift__
# undef OBJC_OLD_DISPATCH_PROTOTYPES
# define OBJC_OLD_DISPATCH_PROTOTYPES 0
#endif
/* OBJC_OLD_DISPATCH_PROTOTYPES == 0 enforces the rule that the dispatch
* functions must be cast to an appropriate function pointer type. */
@@ -147,25 +154,7 @@
/* OBJC_ISA_AVAILABILITY: `isa` will be deprecated or unavailable
* in the future */
#if !defined(OBJC_ISA_AVAILABILITY)
# if __OBJC2__
# define OBJC_ISA_AVAILABILITY __attribute__((deprecated))
# else
# define OBJC_ISA_AVAILABILITY /* still available */
# endif
#endif
/* OBJC2_UNAVAILABLE: unavailable in objc 2.0, deprecated in Leopard */
#if !defined(OBJC2_UNAVAILABLE)
# if __OBJC2__
# define OBJC2_UNAVAILABLE UNAVAILABLE_ATTRIBUTE
# else
/* plain C code also falls here, but this is close enough */
# define OBJC2_UNAVAILABLE \
__OSX_DEPRECATED(10.5, 10.5, "not available in __OBJC2__") \
__IOS_DEPRECATED(2.0, 2.0, "not available in __OBJC2__") \
__TVOS_UNAVAILABLE __WATCHOS_UNAVAILABLE
# endif
# define OBJC_ISA_AVAILABILITY __attribute__((deprecated))
#endif
/* OBJC_UNAVAILABLE: unavailable, with a message where supported */
@@ -227,9 +216,7 @@
#endif
#if !defined(OBJC_VISIBLE)
# define OBJC_VISIBLE __attribute__((visibility("default")))
#endif
#if !defined(OBJC_EXPORT)
@@ -277,4 +264,41 @@
# endif
#endif
/* OBJC_COLD: very rarely called, e.g. on error path */
#if !defined(OBJC_COLD)
# if __OBJC__ && __has_attribute(cold)
# define OBJC_COLD __attribute__((cold))
# else
# define OBJC_COLD
# endif
#endif
/* OBJC_NORETURN: does not return normally, but may throw */
#if !defined(OBJC_NORETURN)
# if __OBJC__ && __has_attribute(noreturn)
# define OBJC_NORETURN __attribute__((noreturn))
# else
# define OBJC_NORETURN
# endif
#endif
/* OBJC_NOESCAPE: marks a block as nonescaping */
#if !defined(OBJC_NOESCAPE)
# if __has_attribute(noescape)
# define OBJC_NOESCAPE __attribute__((noescape))
# else
# define OBJC_NOESCAPE
# endif
#endif
/* OBJC_REFINED_FOR_SWIFT: hide the definition from Swift as we have a
better one in the overlay */
#if !defined(OBJC_REFINED_FOR_SWIFT)
# if __has_attribute(swift_private)
# define OBJC_REFINED_FOR_SWIFT __attribute__((swift_private))
# else
# define OBJC_REFINED_FOR_SWIFT
# endif
#endif
#endif

View File

@@ -0,0 +1,236 @@
/*
* Copyright (c) 1999-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@
*/
/*
* objc.h
* Copyright 1988-1996, NeXT Software, Inc.
*/
#ifndef _OBJC_OBJC_H_
#define _OBJC_OBJC_H_
#include <stdlib.h>
#include <Availability.h>
#include <objc/objc-api.h>
#include <stdbool.h>
#if !OBJC_TYPES_DEFINED
/// An opaque type that represents an Objective-C class.
typedef struct objc_class *Class;
/// Represents an instance of a class.
struct objc_object {
Class _Nonnull isa OBJC_ISA_AVAILABILITY;
};
/// A pointer to an instance of a class.
typedef struct objc_object *id;
#endif
/// An opaque type that represents a method selector.
typedef struct objc_selector *SEL;
/// A pointer to the function of a method implementation.
#if !OBJC_OLD_DISPATCH_PROTOTYPES
typedef void (*IMP)(void /* id, SEL, ... */ );
#else
typedef id _Nullable (*IMP)(id _Nonnull, SEL _Nonnull, ...);
#endif
/// Type to represent a boolean value.
#if defined(__OBJC_BOOL_IS_BOOL)
// Honor __OBJC_BOOL_IS_BOOL when available.
# if __OBJC_BOOL_IS_BOOL
# define OBJC_BOOL_IS_BOOL 1
# else
# define OBJC_BOOL_IS_BOOL 0
# endif
#else
// __OBJC_BOOL_IS_BOOL not set.
# if TARGET_OS_OSX || TARGET_OS_MACCATALYST || ((TARGET_OS_IOS || 0) && !__LP64__ && !__ARM_ARCH_7K)
# define OBJC_BOOL_IS_BOOL 0
# else
# define OBJC_BOOL_IS_BOOL 1
# endif
#endif
#if OBJC_BOOL_IS_BOOL
typedef bool BOOL;
#else
# define OBJC_BOOL_IS_CHAR 1
typedef signed char BOOL;
// BOOL is explicitly signed so @encode(BOOL) == "c" rather than "C"
// even if -funsigned-char is used.
#endif
#define OBJC_BOOL_DEFINED
#if __has_feature(objc_bool)
#define YES __objc_yes
#define NO __objc_no
#else
#define YES ((BOOL)1)
#define NO ((BOOL)0)
#endif
#ifndef Nil
# if __has_feature(cxx_nullptr)
# define Nil nullptr
# else
# define Nil __DARWIN_NULL
# endif
#endif
#ifndef nil
# if __has_feature(cxx_nullptr)
# define nil nullptr
# else
# define nil __DARWIN_NULL
# endif
#endif
#ifndef __strong
# if !__has_feature(objc_arc)
# define __strong /* empty */
# endif
#endif
#ifndef __unsafe_unretained
# if !__has_feature(objc_arc)
# define __unsafe_unretained /* empty */
# endif
#endif
#ifndef __autoreleasing
# if !__has_feature(objc_arc)
# define __autoreleasing /* empty */
# endif
#endif
/// Forward declaration for zone support
typedef struct _malloc_zone_t *objc_zone_t;
/**
* Returns the name of the method specified by a given selector.
*
* @param sel A pointer of type \c SEL. Pass the selector whose name you wish to determine.
*
* @return A C string indicating the name of the selector.
*/
OBJC_EXPORT const char * _Nonnull sel_getName(SEL _Nonnull sel)
OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
/**
* Registers a method with the Objective-C runtime system, maps the method
* name to a selector, and returns the selector value.
*
* @param str A pointer to a C string. Pass the name of the method you wish to register.
*
* @return A pointer of type SEL specifying the selector for the named method.
*
* @note You must register a method name with the Objective-C runtime system to obtain the
* methods selector before you can add the method to a class definition. If the method name
* has already been registered, this function simply returns the selector.
*/
OBJC_EXPORT SEL _Nonnull sel_registerName(const char * _Nonnull str)
OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
/**
* Returns the class name of a given object.
*
* @param obj An Objective-C object.
*
* @return The name of the class of which \e obj is an instance.
*/
OBJC_EXPORT const char * _Nonnull object_getClassName(id _Nullable obj)
OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
/**
* Returns a pointer to any extra bytes allocated with an instance given object.
*
* @param obj An Objective-C object.
*
* @return A pointer to any extra bytes allocated with \e obj. If \e obj was
* not allocated with any extra bytes, then dereferencing the returned pointer is undefined.
*
* @note This function returns a pointer to any extra bytes allocated with the instance
* (as specified by \c class_createInstance with extraBytes>0). This memory follows the
* object's ordinary ivars, but may not be adjacent to the last ivar.
* @note The returned pointer is guaranteed to be pointer-size aligned, even if the area following
* the object's last ivar is less aligned than that. Alignment greater than pointer-size is never
* guaranteed, even if the area following the object's last ivar is more aligned than that.
* @note In a garbage-collected environment, the memory is scanned conservatively.
*/
OBJC_EXPORT void * _Nullable object_getIndexedIvars(id _Nullable obj)
OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
/**
* Identifies a selector as being valid or invalid.
*
* @param sel The selector you want to identify.
*
* @return YES if selector is valid and has a function implementation, NO otherwise.
*
* @warning On some platforms, an invalid reference (to invalid memory addresses) can cause
* a crash.
*/
OBJC_EXPORT BOOL sel_isMapped(SEL _Nonnull sel)
OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
/**
* Registers a method name with the Objective-C runtime system.
*
* @param str A pointer to a C string. Pass the name of the method you wish to register.
*
* @return A pointer of type SEL specifying the selector for the named method.
*
* @note The implementation of this method is identical to the implementation of \c sel_registerName.
* @note Prior to OS X version 10.0, this method tried to find the selector mapped to the given name
* and returned \c NULL if the selector was not found. This was changed for safety, because it was
* observed that many of the callers of this function did not check the return value for \c NULL.
*/
OBJC_EXPORT SEL _Nonnull sel_getUid(const char * _Nonnull str)
OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
typedef const void* objc_objectptr_t;
// Obsolete ARC conversions.
OBJC_EXPORT id _Nullable objc_retainedObject(objc_objectptr_t _Nullable obj)
#if !OBJC_DECLARE_SYMBOLS
OBJC_UNAVAILABLE("use CFBridgingRelease() or a (__bridge_transfer id) cast instead")
#endif
;
OBJC_EXPORT id _Nullable objc_unretainedObject(objc_objectptr_t _Nullable obj)
#if !OBJC_DECLARE_SYMBOLS
OBJC_UNAVAILABLE("use a (__bridge id) cast instead")
#endif
;
OBJC_EXPORT objc_objectptr_t _Nullable objc_unretainedPointer(id _Nullable obj)
#if !OBJC_DECLARE_SYMBOLS
OBJC_UNAVAILABLE("use a __bridge cast instead")
#endif
;
#endif /* _OBJC_OBJC_H_ */

View File

@@ -32,7 +32,7 @@
#include <TargetConditionals.h>
#if TARGET_OS_MAC
#include <sys/types.h>
#include <stdlib.h>
#endif
@@ -52,24 +52,6 @@ typedef struct objc_category *Category;
/// An opaque type that represents an Objective-C declared property.
typedef struct objc_property *objc_property_t;
struct objc_class {
Class _Nonnull isa OBJC_ISA_AVAILABILITY;
#if !__OBJC2__
Class _Nullable super_class OBJC2_UNAVAILABLE;
const char * _Nonnull name OBJC2_UNAVAILABLE;
long version OBJC2_UNAVAILABLE;
long info OBJC2_UNAVAILABLE;
long instance_size OBJC2_UNAVAILABLE;
struct objc_ivar_list * _Nullable ivars OBJC2_UNAVAILABLE;
struct objc_method_list * _Nullable * _Nullable methodLists OBJC2_UNAVAILABLE;
struct objc_cache * _Nonnull cache OBJC2_UNAVAILABLE;
struct objc_protocol_list * _Nullable protocols OBJC2_UNAVAILABLE;
#endif
} OBJC2_UNAVAILABLE;
/* Use `Class` instead of `struct objc_class *` */
#endif
#ifdef __OBJC__
@@ -277,13 +259,8 @@ object_getInstanceVariable(id _Nullable obj, const char * _Nonnull name,
* @return The Class object for the named class, or \c nil
* if the class is not registered with the Objective-C runtime.
*
* @note \c objc_getClass is different from \c objc_lookUpClass in that if the class
* is not registered, \c objc_getClass calls the class handler callback and then checks
* a second time to see whether the class is registered. \c objc_lookUpClass does
* not call the class handler callback.
*
* @warning Earlier implementations of this function (prior to OS X v10.0)
* terminate the program if the class does not exist.
* @note The implementation of \c objc_getClass is identical to the implementation
* of \c objc_lookUpClass.
*/
OBJC_EXPORT Class _Nullable
objc_getClass(const char * _Nonnull name)
@@ -314,9 +291,8 @@ objc_getMetaClass(const char * _Nonnull name)
* @return The Class object for the named class, or \c nil if the class
* is not registered with the Objective-C runtime.
*
* @note \c objc_getClass is different from this function in that if the class is not
* registered, \c objc_getClass calls the class handler callback and then checks a second
* time to see whether the class is registered. This function does not call the class handler callback.
* @note The implementation of \c objc_lookUpClass is identical to the implementation
* of \c objc_getClass.
*/
OBJC_EXPORT Class _Nullable
objc_lookUpClass(const char * _Nonnull name)
@@ -330,7 +306,6 @@ objc_lookUpClass(const char * _Nonnull name)
* @return The Class object for the named class.
*
* @note This function is the same as \c objc_getClass, but kills the process if the class is not found.
* @note This function is used by ZeroLink, where failing to find a class would be a compile-time link error without ZeroLink.
*/
OBJC_EXPORT Class _Nonnull
objc_getRequiredClass(const char * _Nonnull name)
@@ -373,6 +348,32 @@ OBJC_EXPORT Class _Nonnull * _Nullable
objc_copyClassList(unsigned int * _Nullable outCount)
OBJC_AVAILABLE(10.7, 3.1, 9.0, 1.0, 2.0);
/**
* Enumerates classes, filtering by image, name, protocol conformance and superclass.
*
* @param image The image to search. Can be NULL (search the caller's image),
* OBJC_DYNAMIC_CLASSES (search dynamically registered classes),
* a handle returned by dlopen(3), or the Mach header of an image
* loaded into the current process.
* @param namePrefix If non-NULL, a required prefix for the class name.
* @param conformingTo If non-NULL, a protocol to which the enumerated classes
* must conform.
* @param subclassing If non-NULL, a class which the enumerated classes must
* subclass.
* @param block A block that is called for each matching class. Can abort
* enumeration by setting *stop to YES.
*
*/
#define OBJC_DYNAMIC_CLASSES ((const void *)-1)
OBJC_EXPORT void
objc_enumerateClasses(const void * _Nullable image,
const char * _Nullable namePrefix,
Protocol * _Nullable conformingTo,
Class _Nullable subclassing,
void (^ _Nonnull block)(Class _Nonnull aClass, BOOL * _Nonnull stop)
OBJC_NOESCAPE)
OBJC_AVAILABLE(13.0, 16.0, 16.0, 9.0, 7.0)
OBJC_REFINED_FOR_SWIFT;
/* Working with Classes */
@@ -1063,7 +1064,7 @@ method_getDescription(Method _Nonnull m)
* Sets the implementation of a method.
*
* @param m The method for which to set an implementation.
* @param imp The implemention to set to this method.
* @param imp The implementation to set to this method.
*
* @return The previous implementation of the method.
*/
@@ -1556,6 +1557,8 @@ OBJC_EXPORT void
objc_setForwardHandler(void * _Nonnull fwd, void * _Nonnull fwd_stret)
OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0);
#if !0
/**
* Creates a pointer to a function that will call the block
* when the method is called.
@@ -1598,6 +1601,8 @@ OBJC_EXPORT BOOL
imp_removeBlock(IMP _Nonnull anImp)
OBJC_AVAILABLE(10.7, 4.3, 9.0, 1.0, 2.0);
#endif
/**
* This loads the object referenced by a weak pointer and returns it, after
* retaining and autoreleasing the object to ensure that it stays alive
@@ -1765,43 +1770,6 @@ OBJC_EXPORT void objc_setHook_getClass(objc_hook_getClass _Nonnull newValue,
OBJC_AVAILABLE(10.14.4, 12.2, 12.2, 5.2, 3.2);
#endif
/**
* Function type for a hook that assists objc_setAssociatedObject().
*
* @param object The source object for the association.
* @param key The key for the association.
* @param value The value to associate with the key key for object. Pass nil to clear an existing association.
* @param policy The policy for the association. For possible values, see Associative Object Behaviors.
*
* @see objc_setAssociatedObject
* @see objc_setHook_setAssociatedObject
*/
typedef void (*objc_hook_setAssociatedObject)(id _Nonnull object, const void * _Nonnull key,
id _Nullable value, objc_AssociationPolicy policy);
/**
* Install a hook for objc_setAssociatedObject().
*
* @param newValue The hook function to install.
* @param outOldValue The address of a function pointer variable. On return,
* the old hook function is stored in the variable.
*
* @note The store to *outOldValue is thread-safe: the variable will be
* updated before objc_setAssociatedObject() calls your new hook to read it,
* even if your new hook is called from another thread before this
* setter completes.
* @note Your hook should always call the previous hook.
*
* @see objc_setAssociatedObject
* @see objc_hook_setAssociatedObject
*/
#if !(TARGET_OS_OSX && __i386__)
#define OBJC_SETASSOCIATEDOBJECTHOOK_DEFINED 1
OBJC_EXPORT void objc_setHook_setAssociatedObject(objc_hook_setAssociatedObject _Nonnull newValue,
objc_hook_setAssociatedObject _Nullable * _Nonnull outOldValue)
OBJC_AVAILABLE(10.15, 13.0, 13.0, 6.0, 4.0);
#endif
/**
* Function type for a function that is called when an image is loaded.
*
@@ -1829,7 +1797,39 @@ typedef void (*objc_func_loadImage)(const struct mach_header * _Nonnull header);
OBJC_EXPORT void objc_addLoadImageFunc(objc_func_loadImage _Nonnull func)
OBJC_AVAILABLE(10.15, 13.0, 13.0, 6.0, 4.0);
/**
/**
* Function type for a hook that provides a name for lazily named classes.
*
* @param cls The class to generate a name for.
* @return The name of the class, or NULL if the name isn't known or can't me generated.
*
* @see objc_setHook_lazyClassNamer
*/
typedef const char * _Nullable (*objc_hook_lazyClassNamer)(_Nonnull Class cls);
/**
* Install a hook to provide a name for lazily-named classes.
*
* @param newValue The hook function to install.
* @param outOldValue The address of a function pointer variable. On return,
* the old hook function is stored in the variable.
*
* @note The store to *outOldValue is thread-safe: the variable will be
* updated before objc_getClass() calls your new hook to read it,
* even if your new hook is called from another thread before this
* setter completes.
* @note Your hook must call the previous hook for class names
* that you do not recognize.
*/
#if !(TARGET_OS_OSX && __i386__)
#define OBJC_SETHOOK_LAZYCLASSNAMER_DEFINED 1
OBJC_EXPORT
void objc_setHook_lazyClassNamer(_Nonnull objc_hook_lazyClassNamer newValue,
_Nonnull objc_hook_lazyClassNamer * _Nonnull oldOutValue)
OBJC_AVAILABLE(11.0, 14.0, 14.0, 7.0, 5.0);
#endif
/**
* Callback from Objective-C to Swift to perform Swift class initialization.
*/
#if !(TARGET_OS_OSX && __i386__)
@@ -1850,188 +1850,58 @@ _objc_realizeClassFromSwift(Class _Nullable cls, void * _Nullable previously)
OBJC_AVAILABLE(10.14.4, 12.2, 12.2, 5.2, 3.2);
#endif
// Type encoding characters
#define _C_ID '@'
#define _C_CLASS '#'
#define _C_SEL ':'
#define _C_CHR 'c'
#define _C_UCHR 'C'
#define _C_SHT 's'
#define _C_USHT 'S'
#define _C_INT 'i'
#define _C_UINT 'I'
#define _C_LNG 'l'
#define _C_ULNG 'L'
#define _C_LNG_LNG 'q'
#define _C_ULNG_LNG 'Q'
#define _C_INT128 't'
#define _C_UINT128 'T'
#define _C_FLT 'f'
#define _C_DBL 'd'
#define _C_LNG_DBL 'D'
#define _C_BFLD 'b'
#define _C_BOOL 'B'
#define _C_VOID 'v'
#define _C_UNDEF '?'
#define _C_PTR '^'
#define _C_CHARPTR '*'
#define _C_ATOM '%'
#define _C_ARY_B '['
#define _C_ARY_E ']'
#define _C_UNION_B '('
#define _C_UNION_E ')'
#define _C_STRUCT_B '{'
#define _C_STRUCT_E '}'
#define _C_VECTOR '!'
#define _C_ID '@'
#define _C_CLASS '#'
#define _C_SEL ':'
#define _C_CHR 'c'
#define _C_UCHR 'C'
#define _C_SHT 's'
#define _C_USHT 'S'
#define _C_INT 'i'
#define _C_UINT 'I'
#define _C_LNG 'l'
#define _C_ULNG 'L'
#define _C_LNG_LNG 'q'
#define _C_ULNG_LNG 'Q'
#define _C_FLT 'f'
#define _C_DBL 'd'
#define _C_BFLD 'b'
#define _C_BOOL 'B'
#define _C_VOID 'v'
#define _C_UNDEF '?'
#define _C_PTR '^'
#define _C_CHARPTR '*'
#define _C_ATOM '%'
#define _C_ARY_B '['
#define _C_ARY_E ']'
#define _C_UNION_B '('
#define _C_UNION_E ')'
#define _C_STRUCT_B '{'
#define _C_STRUCT_E '}'
#define _C_VECTOR '!'
#define _C_CONST 'r'
/* Obsolete types */
#if !__OBJC2__
#define CLS_GETINFO(cls,infomask) ((cls)->info & (infomask))
#define CLS_SETINFO(cls,infomask) ((cls)->info |= (infomask))
// class is not a metaclass
#define CLS_CLASS 0x1
// class is a metaclass
#define CLS_META 0x2
// class's +initialize method has completed
#define CLS_INITIALIZED 0x4
// class is posing
#define CLS_POSING 0x8
// unused
#define CLS_MAPPED 0x10
// class and subclasses need cache flush during image loading
#define CLS_FLUSH_CACHE 0x20
// method cache should grow when full
#define CLS_GROW_CACHE 0x40
// unused
#define CLS_NEED_BIND 0x80
// methodLists is array of method lists
#define CLS_METHOD_ARRAY 0x100
// the JavaBridge constructs classes with these markers
#define CLS_JAVA_HYBRID 0x200
#define CLS_JAVA_CLASS 0x400
// thread-safe +initialize
#define CLS_INITIALIZING 0x800
// bundle unloading
#define CLS_FROM_BUNDLE 0x1000
// C++ ivar support
#define CLS_HAS_CXX_STRUCTORS 0x2000
// Lazy method list arrays
#define CLS_NO_METHOD_ARRAY 0x4000
// +load implementation
#define CLS_HAS_LOAD_METHOD 0x8000
// objc_allocateClassPair API
#define CLS_CONSTRUCTING 0x10000
// class compiled with bigger class structure
#define CLS_EXT 0x20000
struct objc_method_description_list {
int count;
struct objc_method_description list[1];
};
struct objc_protocol_list {
struct objc_protocol_list * _Nullable next;
long count;
__unsafe_unretained Protocol * _Nullable list[1];
};
struct objc_category {
char * _Nonnull category_name OBJC2_UNAVAILABLE;
char * _Nonnull class_name OBJC2_UNAVAILABLE;
struct objc_method_list * _Nullable instance_methods OBJC2_UNAVAILABLE;
struct objc_method_list * _Nullable class_methods OBJC2_UNAVAILABLE;
struct objc_protocol_list * _Nullable protocols OBJC2_UNAVAILABLE;
} OBJC2_UNAVAILABLE;
struct objc_ivar {
char * _Nullable ivar_name OBJC2_UNAVAILABLE;
char * _Nullable ivar_type OBJC2_UNAVAILABLE;
int ivar_offset OBJC2_UNAVAILABLE;
#ifdef __LP64__
int space OBJC2_UNAVAILABLE;
#endif
} OBJC2_UNAVAILABLE;
struct objc_ivar_list {
int ivar_count OBJC2_UNAVAILABLE;
#ifdef __LP64__
int space OBJC2_UNAVAILABLE;
#endif
/* variable length structure */
struct objc_ivar ivar_list[1] OBJC2_UNAVAILABLE;
} OBJC2_UNAVAILABLE;
struct objc_method {
SEL _Nonnull method_name OBJC2_UNAVAILABLE;
char * _Nullable method_types OBJC2_UNAVAILABLE;
IMP _Nonnull method_imp OBJC2_UNAVAILABLE;
} OBJC2_UNAVAILABLE;
struct objc_method_list {
struct objc_method_list * _Nullable obsolete OBJC2_UNAVAILABLE;
int method_count OBJC2_UNAVAILABLE;
#ifdef __LP64__
int space OBJC2_UNAVAILABLE;
#endif
/* variable length structure */
struct objc_method method_list[1] OBJC2_UNAVAILABLE;
} OBJC2_UNAVAILABLE;
typedef struct objc_symtab *Symtab OBJC2_UNAVAILABLE;
struct objc_symtab {
unsigned long sel_ref_cnt OBJC2_UNAVAILABLE;
SEL _Nonnull * _Nullable refs OBJC2_UNAVAILABLE;
unsigned short cls_def_cnt OBJC2_UNAVAILABLE;
unsigned short cat_def_cnt OBJC2_UNAVAILABLE;
void * _Nullable defs[1] /* variable size */ OBJC2_UNAVAILABLE;
} OBJC2_UNAVAILABLE;
typedef struct objc_cache *Cache OBJC2_UNAVAILABLE;
#define CACHE_BUCKET_NAME(B) ((B)->method_name)
#define CACHE_BUCKET_IMP(B) ((B)->method_imp)
#define CACHE_BUCKET_VALID(B) (B)
#ifndef __LP64__
#define CACHE_HASH(sel, mask) (((uintptr_t)(sel)>>2) & (mask))
#else
#define CACHE_HASH(sel, mask) (((unsigned int)((uintptr_t)(sel)>>3)) & (mask))
#endif
struct objc_cache {
unsigned int mask /* total = mask + 1 */ OBJC2_UNAVAILABLE;
unsigned int occupied OBJC2_UNAVAILABLE;
Method _Nullable buckets[1] OBJC2_UNAVAILABLE;
};
typedef struct objc_module *Module OBJC2_UNAVAILABLE;
struct objc_module {
unsigned long version OBJC2_UNAVAILABLE;
unsigned long size OBJC2_UNAVAILABLE;
const char * _Nullable name OBJC2_UNAVAILABLE;
Symtab _Nullable symtab OBJC2_UNAVAILABLE;
} OBJC2_UNAVAILABLE;
#else
// Modifiers
#define _C_COMPLEX 'j'
#define _C_ATOMIC 'A'
#define _C_CONST 'r'
#define _C_IN 'n'
#define _C_INOUT 'N'
#define _C_OUT 'o'
#define _C_BYCOPY 'O'
#define _C_BYREF 'R'
#define _C_ONEWAY 'V'
#define _C_GNUREGISTER '+'
struct objc_method_list;
#endif
/* Obsolete functions */
#if !0
OBJC_EXPORT IMP _Nullable
class_lookupMethod(Class _Nullable cls, SEL _Nonnull sel)
__OSX_DEPRECATED(10.0, 10.5, "use class_getMethodImplementation instead")
@@ -2062,108 +1932,11 @@ OBJC_EXPORT id _Nullable
object_copyFromZone(id _Nullable anObject, size_t nBytes, void * _Nullable z)
OBJC_OSX_DEPRECATED_OTHERS_UNAVAILABLE(10.0, 10.5, "use object_copy instead");
OBJC_EXPORT id _Nullable
object_realloc(id _Nullable anObject, size_t nBytes)
OBJC2_UNAVAILABLE;
OBJC_EXPORT id _Nullable
object_reallocFromZone(id _Nullable anObject, size_t nBytes, void * _Nullable z)
OBJC2_UNAVAILABLE;
#define OBSOLETE_OBJC_GETCLASSES 1
OBJC_EXPORT void * _Nonnull
objc_getClasses(void)
OBJC2_UNAVAILABLE;
OBJC_EXPORT void
objc_addClass(Class _Nonnull myClass)
OBJC2_UNAVAILABLE;
OBJC_EXPORT void
objc_setClassHandler(int (* _Nullable )(const char * _Nonnull))
OBJC2_UNAVAILABLE;
OBJC_EXPORT void
objc_setMultithreaded(BOOL flag)
OBJC2_UNAVAILABLE;
OBJC_EXPORT id _Nullable
class_createInstanceFromZone(Class _Nullable, size_t idxIvars,
void * _Nullable z)
OBJC_OSX_DEPRECATED_OTHERS_UNAVAILABLE(10.0, 10.5, "use class_createInstance instead");
OBJC_EXPORT void
class_addMethods(Class _Nullable, struct objc_method_list * _Nonnull)
OBJC2_UNAVAILABLE;
OBJC_EXPORT void
class_removeMethods(Class _Nullable, struct objc_method_list * _Nonnull)
OBJC2_UNAVAILABLE;
OBJC_EXPORT void
_objc_resolve_categories_for_class(Class _Nonnull cls)
OBJC2_UNAVAILABLE;
OBJC_EXPORT Class _Nonnull
class_poseAs(Class _Nonnull imposter, Class _Nonnull original)
OBJC2_UNAVAILABLE;
OBJC_EXPORT unsigned int
method_getSizeOfArguments(Method _Nonnull m)
OBJC2_UNAVAILABLE;
OBJC_EXPORT unsigned
method_getArgumentInfo(struct objc_method * _Nonnull m, int arg,
const char * _Nullable * _Nonnull type,
int * _Nonnull offset)
UNAVAILABLE_ATTRIBUTE // This function was accidentally deleted in 10.9.
OBJC2_UNAVAILABLE;
OBJC_EXPORT Class _Nullable
objc_getOrigClass(const char * _Nonnull name)
OBJC2_UNAVAILABLE;
#define OBJC_NEXT_METHOD_LIST 1
OBJC_EXPORT struct objc_method_list * _Nullable
class_nextMethodList(Class _Nullable, void * _Nullable * _Nullable)
OBJC2_UNAVAILABLE;
// usage for nextMethodList
//
// void *iterator = 0;
// struct objc_method_list *mlist;
// while ( mlist = class_nextMethodList( cls, &iterator ) )
// ;
OBJC_EXPORT id _Nullable
(* _Nonnull _alloc)(Class _Nullable, size_t)
OBJC2_UNAVAILABLE;
OBJC_EXPORT id _Nullable
(* _Nonnull _copy)(id _Nullable, size_t)
OBJC2_UNAVAILABLE;
OBJC_EXPORT id _Nullable
(* _Nonnull _realloc)(id _Nullable, size_t)
OBJC2_UNAVAILABLE;
OBJC_EXPORT id _Nullable
(* _Nonnull _dealloc)(id _Nullable)
OBJC2_UNAVAILABLE;
OBJC_EXPORT id _Nullable
(* _Nonnull _zoneAlloc)(Class _Nullable, size_t, void * _Nullable)
OBJC2_UNAVAILABLE;
OBJC_EXPORT id _Nullable
(* _Nonnull _zoneRealloc)(id _Nullable, size_t, void * _Nullable)
OBJC2_UNAVAILABLE;
OBJC_EXPORT id _Nullable
(* _Nonnull _zoneCopy)(id _Nullable, size_t, void * _Nullable)
OBJC2_UNAVAILABLE;
OBJC_EXPORT void
(* _Nonnull _error)(id _Nullable, const char * _Nonnull, va_list)
OBJC2_UNAVAILABLE;
#endif
#endif

Some files were not shown because too many files have changed in this diff Show More