]> git.saurik.com Git - apple/xnu.git/commitdiff
xnu-3789.51.2.tar.gz macos-10124 v3789.51.2
authorApple <opensource@apple.com>
Wed, 29 Mar 2017 20:09:26 +0000 (20:09 +0000)
committerApple <opensource@apple.com>
Wed, 29 Mar 2017 20:09:26 +0000 (20:09 +0000)
329 files changed:
EXTERNAL_HEADERS/Availability.h
EXTERNAL_HEADERS/AvailabilityInternal.h
EXTERNAL_HEADERS/AvailabilityMacros.h
EXTERNAL_HEADERS/Makefile
EXTERNAL_HEADERS/corecrypto/cc_config.h
EXTERNAL_HEADERS/corecrypto/cc_debug.h
EXTERNAL_HEADERS/corecrypto/cccmac.h
EXTERNAL_HEADERS/stdatomic.h [new file with mode: 0644]
EXTERNAL_HEADERS/stddef.h
bsd/bsm/audit_fcntl.h
bsd/conf/Makefile.template
bsd/conf/files
bsd/dev/dtrace/dtrace.c
bsd/dev/i386/fbt_x86.c
bsd/dev/i386/sysctl.c
bsd/dev/i386/systemcalls.c
bsd/kern/bsd_init.c
bsd/kern/chunklist.h [new file with mode: 0644]
bsd/kern/imageboot.c
bsd/kern/kdebug.c
bsd/kern/kern_csr.c
bsd/kern/kern_descrip.c
bsd/kern/kern_exec.c
bsd/kern/kern_exit.c
bsd/kern/kern_fork.c
bsd/kern/kern_ktrace.c
bsd/kern/kern_lockf.c
bsd/kern/kern_malloc.c
bsd/kern/kern_memorystatus.c
bsd/kern/kern_proc.c
bsd/kern/kern_shutdown.c
bsd/kern/kern_symfile.c
bsd/kern/kern_sysctl.c
bsd/kern/kpi_socket.c
bsd/kern/kpi_socketfilter.c
bsd/kern/mach_loader.c
bsd/kern/mach_process.c
bsd/kern/policy_check.c
bsd/kern/proc_info.c
bsd/kern/process_policy.c
bsd/kern/pthread_shims.c
bsd/kern/subr_log.c
bsd/kern/sys_generic.c
bsd/kern/sys_ulock.c
bsd/kern/syscalls.master
bsd/kern/sysv_sem.c
bsd/kern/sysv_shm.c
bsd/kern/trace_codes
bsd/kern/ubc_subr.c
bsd/kern/uipc_mbuf.c
bsd/kern/uipc_mbuf2.c
bsd/kern/uipc_socket.c
bsd/kern/uipc_socket2.c
bsd/kern/uipc_syscalls.c
bsd/man/man2/clonefile.2
bsd/man/man2/fcntl.2
bsd/man/man2/getattrlist.2
bsd/man/man2/getattrlistbulk.2
bsd/man/man2/lseek.2
bsd/man/man2/pathconf.2
bsd/man/man2/stat.2
bsd/man/man2/statfs.2
bsd/man/man4/ip.4
bsd/man/man4/ip6.4
bsd/net/bpf.c
bsd/net/content_filter.c
bsd/net/if.c
bsd/net/if_var.h
bsd/net/kext_net.h
bsd/net/necp.c
bsd/net/necp.h
bsd/net/necp_client.c
bsd/net/network_agent.c
bsd/net/network_agent.h
bsd/net/route.c
bsd/net/route.h
bsd/net/rtsock.c
bsd/netinet/flow_divert.c
bsd/netinet/in.c
bsd/netinet/in.h
bsd/netinet/in_pcb.h
bsd/netinet/in_var.h
bsd/netinet/ip6.h
bsd/netinet/ip_input.c
bsd/netinet/ip_output.c
bsd/netinet/mptcp_subr.c
bsd/netinet/mptcp_usrreq.c
bsd/netinet/mptcp_var.h
bsd/netinet/tcp.h
bsd/netinet/tcp_input.c
bsd/netinet/tcp_output.c
bsd/netinet/tcp_subr.c
bsd/netinet/tcp_timer.c
bsd/netinet/tcp_usrreq.c
bsd/netinet/tcp_var.h
bsd/netinet/udp_usrreq.c
bsd/netinet/udp_var.h
bsd/netinet6/in6_mcast.c
bsd/netinet6/ipsec.c
bsd/netinet6/udp6_usrreq.c
bsd/netkey/key_debug.c
bsd/nfs/nfs.h
bsd/nfs/nfs4_vnops.c
bsd/nfs/nfs_serv.c
bsd/nfs/nfs_subs.c
bsd/nfs/nfs_vfsops.c
bsd/nfs/nfs_vnops.c
bsd/pgo/profile_runtime.c
bsd/pgo/profile_runtime_data.c [new file with mode: 0644]
bsd/security/audit/audit_arg.c
bsd/security/audit/audit_bsm_fcntl.c
bsd/security/audit/audit_pipe.c
bsd/security/audit/audit_session.c
bsd/sys/_types/_seek_set.h
bsd/sys/attr.h
bsd/sys/cprotect.h
bsd/sys/csr.h
bsd/sys/decmpfs.h
bsd/sys/event.h
bsd/sys/fcntl.h
bsd/sys/fsctl.h
bsd/sys/fsevents.h
bsd/sys/imageboot.h
bsd/sys/ioctl.h
bsd/sys/kern_memorystatus.h
bsd/sys/kernel_types.h
bsd/sys/malloc.h
bsd/sys/mbuf.h
bsd/sys/mcache.h
bsd/sys/mount.h
bsd/sys/mount_internal.h
bsd/sys/priv.h
bsd/sys/proc_uuid_policy.h
bsd/sys/protosw.h
bsd/sys/pthread_shims.h
bsd/sys/random.h
bsd/sys/reboot.h
bsd/sys/snapshot.h
bsd/sys/socket.h
bsd/sys/socketvar.h
bsd/sys/ubc.h
bsd/sys/unistd.h
bsd/sys/user.h
bsd/sys/vnode.h
bsd/sys/vnode_if.h
bsd/sys/vnode_internal.h
bsd/vfs/kpi_vfs.c
bsd/vfs/vfs_attrlist.c
bsd/vfs/vfs_bio.c
bsd/vfs/vfs_cache.c
bsd/vfs/vfs_cluster.c
bsd/vfs/vfs_cprotect.c
bsd/vfs/vfs_fsevents.c
bsd/vfs/vfs_init.c
bsd/vfs/vfs_subr.c
bsd/vfs/vfs_syscalls.c
bsd/vfs/vnode_if.c
bsd/vm/vm_compressor_backing_file.c
bsd/vm/vm_unix.c
config/BSDKernel.exports
config/MASTER
config/MASTER.x86_64
config/MasterVersion
config/Private.exports
iokit/IOKit/IOHibernatePrivate.h
iokit/Kernel/IOCommandGate.cpp
iokit/Kernel/IOHibernateIO.cpp
iokit/Kernel/IOPMrootDomain.cpp
libkdd/KCDBasicTypeDescription.m
libkdd/kcdtypes.c
libkdd/kdd.xcodeproj/project.pbxproj
libkdd/tests/Tests.swift
libkdd/tests/stackshot-with-waitinfo [new file with mode: 0644]
libkdd/tests/stackshot-with-waitinfo.plist.gz [new file with mode: 0644]
libkern/c++/OSKext.cpp
libkern/firehose/Makefile
libkern/firehose/chunk_private.h [new file with mode: 0644]
libkern/firehose/firehose_types_private.h
libkern/firehose/private.h
libkern/firehose/tracepoint_private.h
libkern/kxld/kxld_object.c
libkern/kxld/kxld_seg.c
libkern/kxld/kxld_seg.h
libkern/kxld/kxld_util.c
libkern/libkern/OSKextLibPrivate.h
libkern/libkern/c++/OSKext.h
libkern/libkern/kxld_types.h
libkern/os/log.c
libkern/os/trace_internal.h
libsa/bootstrap.cpp
libsyscall/mach/mach_vm.c
libsyscall/wrappers/cancelable/fcntl-base.c
libsyscall/wrappers/fs_snapshot.c
libsyscall/wrappers/legacy/munmap.c
libsyscall/wrappers/unix03/munmap.c
libsyscall/xcodescripts/mach_install_mig.sh
makedefs/MakeInc.def
makedefs/MakeInc.top
osfmk/console/serial_console.c
osfmk/console/serial_general.c
osfmk/console/serial_protos.h
osfmk/corpses/corpse.c
osfmk/corpses/task_corpse.h
osfmk/i386/AT386/model_dep.c
osfmk/i386/atomic.h
osfmk/i386/bsd_i386.c
osfmk/i386/i386_init.c
osfmk/i386/locks.h
osfmk/i386/locks_i386.c
osfmk/i386/machine_routines.c
osfmk/i386/machine_routines.h
osfmk/i386/mp.c
osfmk/ipc/ipc_mqueue.c
osfmk/ipc/ipc_mqueue.h
osfmk/ipc/ipc_object.h
osfmk/ipc/ipc_port.c
osfmk/ipc/ipc_port.h
osfmk/ipc/ipc_pset.h
osfmk/ipc/ipc_right.c
osfmk/ipc/ipc_space.h
osfmk/kdp/kdp.c
osfmk/kdp/kdp_core.h
osfmk/kdp/kdp_udp.c
osfmk/kern/Makefile
osfmk/kern/assert.h
osfmk/kern/block_hint.h [new file with mode: 0644]
osfmk/kern/bsd_kern.c
osfmk/kern/debug.h
osfmk/kern/ipc_tt.c
osfmk/kern/ipc_tt.h
osfmk/kern/kcdata.h
osfmk/kern/kern_stackshot.c
osfmk/kern/ledger.c
osfmk/kern/locks.c
osfmk/kern/machine.c
osfmk/kern/mk_timer.c
osfmk/kern/policy_internal.h
osfmk/kern/sched_prim.c
osfmk/kern/sched_prim.h
osfmk/kern/sync_sema.c
osfmk/kern/syscall_subr.c
osfmk/kern/syscall_sw.c
osfmk/kern/task.c
osfmk/kern/task.h
osfmk/kern/task_policy.c
osfmk/kern/thread.c
osfmk/kern/thread.h
osfmk/kern/thread_call.c
osfmk/kern/waitq.h
osfmk/kern/zalloc.c
osfmk/kern/zalloc.h
osfmk/kperf/task_samplers.c
osfmk/mach/Makefile
osfmk/mach/mach_port.defs
osfmk/mach/mach_traps.h
osfmk/mach/mach_types.defs
osfmk/mach/mach_types.h
osfmk/mach/mk_timer.h
osfmk/mach/syscall_sw.h
osfmk/mach/task.defs
osfmk/mach/thread_act.defs
osfmk/machine/atomic.h
osfmk/vm/vm_compressor.c
osfmk/vm/vm_fault.c
osfmk/vm/vm_map.c
osfmk/vm/vm_map.h
osfmk/vm/vm_object.c
osfmk/vm/vm_pageout.c
osfmk/vm/vm_protos.h
osfmk/vm/vm_resident.c
osfmk/x86_64/loose_ends.c
osfmk/x86_64/pmap.c
pexpert/gen/bootargs.c
pexpert/i386/pe_kprintf.c
pexpert/i386/pe_serial.c
security/mac_framework.h
security/mac_policy.h
security/mac_vfs.c
tools/lldbmacros/core/cvalue.py
tools/lldbmacros/core/standard.py
tools/lldbmacros/ioreg.py
tools/lldbmacros/kcdata.py
tools/lldbmacros/ktrace.py
tools/lldbmacros/memory.py
tools/lldbmacros/pmap.py
tools/lldbmacros/process.py
tools/lldbmacros/utils.py
tools/lldbmacros/xnu.py
tools/lldbmacros/xnudefines.py
tools/tests/Makefile
tools/tests/darwintests/Makefile
tools/tests/darwintests/backtracing.c
tools/tests/darwintests/data_protection.c [new file with mode: 0644]
tools/tests/darwintests/gettimeofday.c
tools/tests/darwintests/host_notifications.c
tools/tests/darwintests/jumbo_va_spaces_28530648.c [new file with mode: 0644]
tools/tests/darwintests/jumbo_va_spaces_28530648.entitlements [new file with mode: 0644]
tools/tests/darwintests/kdebug.c
tools/tests/darwintests/kevent_continuous_time.c
tools/tests/darwintests/kperf.c
tools/tests/darwintests/kperf_backtracing.c
tools/tests/darwintests/kqueue_fifo_18776047.c
tools/tests/darwintests/mach_boottime_usec.c
tools/tests/darwintests/mach_continuous_time.c
tools/tests/darwintests/mach_get_times.c
tools/tests/darwintests/mach_timebase_info.c
tools/tests/darwintests/perf_compressor.c [new file with mode: 0644]
tools/tests/darwintests/perf_exit.c
tools/tests/darwintests/perf_exit_proc.c [new file with mode: 0644]
tools/tests/darwintests/perf_kdebug.c [new file with mode: 0644]
tools/tests/darwintests/perf_spawn_fork.c
tools/tests/darwintests/poll.c [new file with mode: 0644]
tools/tests/darwintests/poll_select_kevent_paired_fds.c [new file with mode: 0644]
tools/tests/darwintests/proc_core_name_24152432.c
tools/tests/darwintests/proc_uuid_policy_26567533.c
tools/tests/darwintests/pwrite_avoid_sigxfsz_28581610.c [new file with mode: 0644]
tools/tests/darwintests/regression_17272465.c [new file with mode: 0644]
tools/tests/darwintests/socket_poll_close_25786011.c
tools/tests/darwintests/stackshot_block_owner_14362384.m [new file with mode: 0644]
tools/tests/darwintests/stackshot_idle_25570396.m
tools/tests/darwintests/task_inspect.c [new file with mode: 0644]
tools/tests/darwintests/task_inspect.entitlements [new file with mode: 0644]
tools/tests/darwintests/voucher_entry_18826844.c
tools/tests/darwintests/xnu_quick_test.c [new file with mode: 0644]
tools/tests/mktimer/Makefile [new file with mode: 0644]
tools/tests/mktimer/mktimer_test.c [new file with mode: 0644]
tools/tests/testkext/pgokext/Info.plist [new file with mode: 0644]
tools/tests/testkext/pgokext/pgokext.c [new file with mode: 0644]
tools/tests/testkext/testkext.xcodeproj/project.pbxproj

index 4875d6171308b577eba01b4979b1cc210fd8aa15..f8f44634fda7614c82455162f4ba206bfd6ba90a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2015 by Apple Inc.. All rights reserved.
+ * Copyright (c) 2007-2016 by Apple Inc.. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
 #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
 /* __MAC_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */
 
 #define __IPHONE_2_0      20000
 #define __IPHONE_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
 /* __IPHONE_NA is not defined to a value but is uses as a token by macros to indicate that the API is unavailable */
 
 #define __TVOS_9_0        90000
+#define __TVOS_9_1        90100
 #define __TVOS_9_2        90200
 #define __TVOS_10_0      100000
+#define __TVOS_10_0_1    100001
+#define __TVOS_10_1      100100
+#define __TVOS_10_2      100200
 
 #define __WATCHOS_1_0     10000
 #define __WATCHOS_2_0     20000
 #define __WATCHOS_3_0     30000
+#define __WATCHOS_3_1     30100
+#define __WATCHOS_3_1_1   30101
+#define __WATCHOS_3_2     30200
 
 #include <AvailabilityInternal.h>
 
   #if __has_feature(attribute_availability_with_message)
     #define __OS_AVAILABILITY(_target, _availability)            __attribute__((availability(_target,_availability)))
     #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)  __attribute__((availability(_target,_availability,message=_msg)))
+  #elif __has_feature(attribute_availability)
+    #define __OS_AVAILABILITY(_target, _availability)            __attribute__((availability(_target,_availability)))
+    #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)  __attribute__((availability(_target,_availability)))
   #else
     #define __OS_AVAILABILITY(_target, _availability)
     #define __OS_AVAILABILITY_MSG(_target, _availability, _msg)
 
 
 /* for use marking APIs available info for Mac OSX */
-#if defined(__has_feature)
+#if defined(__has_attribute)
   #if __has_attribute(availability)
     #define __OSX_UNAVAILABLE                    __OS_AVAILABILITY(macosx,unavailable)
     #define __OSX_AVAILABLE(_vers)               __OS_AVAILABILITY(macosx,introduced=_vers)
 
 
 /* for use marking APIs available info for iOS */
-#if defined(__has_feature)
+#if defined(__has_attribute)
   #if __has_attribute(availability)
     #define __IOS_UNAVAILABLE                    __OS_AVAILABILITY(ios,unavailable)
     #define __IOS_PROHIBITED                     __OS_AVAILABILITY(ios,unavailable)
   #define __WATCHOS_DEPRECATED(_start, _dep, _msg)
 #endif
 
+
+/* for use marking APIs unavailable for swift */
+#if defined(__has_feature)
+  #if __has_feature(attribute_availability_swift)
+    #define __SWIFT_UNAVAILABLE                   __OS_AVAILABILITY(swift,unavailable)
+    #define __SWIFT_UNAVAILABLE_MSG(_msg)         __OS_AVAILABILITY_MSG(swift,unavailable,_msg)
+  #endif
+#endif
+
+#ifndef __SWIFT_UNAVAILABLE
+  #define __SWIFT_UNAVAILABLE
+#endif
+
+#ifndef __SWIFT_UNAVAILABLE_MSG
+  #define __SWIFT_UNAVAILABLE_MSG(_msg)
+#endif
+
 #if __has_include(<AvailabilityProhibitedInternal.h>)
   #include <AvailabilityProhibitedInternal.h>
 #endif
 
+/*
+ Macros for defining which versions/platform a given symbol can be used.
+ @see http://clang.llvm.org/docs/AttributeReference.html#availability
+ */
+
+/*
+ * API Introductions
+ *
+ * Use to specify the release that a particular API became available.
+ *
+ * Platform names:
+ *   macos, ios, tvos, watchos
+ *
+ * Examples:
+ *    __API_AVAILABLE(macos(10.10))
+ *    __API_AVAILABLE(macos(10.9), ios(10.0))
+ *    __API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0))
+ */
+#define __API_AVAILABLE(...) __API_AVAILABLE_GET_MACRO(__VA_ARGS__,__API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1)(__VA_ARGS__)
+
+
+/*
+ * API Deprecations
+ *
+ * Use to specify the release that a particular API became unavailable.
+ *
+ * Platform names:
+ *   macos, ios, tvos, watchos
+ *
+ * Examples:
+ *
+ *    __API_DEPRECATED("No longer supported", macos(10.4, 10.8))
+ *    __API_DEPRECATED("No longer supported", macos(10.4, 10.8), ios(2.0, 3.0), watchos(2.0, 3.0), tvos(9.0, 10.0))
+ *
+ *    __API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0))
+ *    __API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0))
+ */
+#define __API_DEPRECATED(...) __API_DEPRECATED_MSG_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_MSG5,__API_DEPRECATED_MSG4,__API_DEPRECATED_MSG3,__API_DEPRECATED_MSG2,__API_DEPRECATED_MSG1)(__VA_ARGS__)
+#define __API_DEPRECATED_WITH_REPLACEMENT(...) __API_DEPRECATED_REP_GET_MACRO(__VA_ARGS__,__API_DEPRECATED_REP5,__API_DEPRECATED_REP4,__API_DEPRECATED_REP3,__API_DEPRECATED_REP2,__API_DEPRECATED_REP1)(__VA_ARGS__)
+
+/*
+ * API Unavailability
+ * Use to specify that an API is unavailable for a particular platform.
+ *
+ * Example:
+ *    __API_UNAVAILABLE(macos)
+ *    __API_UNAVAILABLE(watchos, tvos)
+ */
+#define __API_UNAVAILABLE(...) __API_UNAVAILABLE_GET_MACRO(__VA_ARGS__,__API_UNAVAILABLE3,__API_UNAVAILABLE2,__API_UNAVAILABLE1)(__VA_ARGS__)
+
 #endif /* __AVAILABILITY__ */
index 7e71e61456d72aad90beee2dc6063aa6e0549be6..a0cb4a49c4bcacb9a57272071ce40686911b3d5e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007-2015 by Apple Inc.. All rights reserved.
+ * Copyright (c) 2007-2016 by Apple Inc.. All rights reserved.
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
@@ -43,7 +43,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 __IPHONE_9_0
+        #define __TV_OS_VERSION_MAX_ALLOWED __TVOS_10_0 
         /* for compatibility with existing code.  New code should use platform specific checks */
         #define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
     #endif
@@ -53,7 +53,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 20000
+        #define __WATCH_OS_VERSION_MAX_ALLOWED 30000
         /* for compatibility with existing code.  New code should use platform specific checks */
         #define __IPHONE_OS_VERSION_MIN_REQUIRED 90000
     #endif
@@ -80,7 +80,7 @@
 #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_10_0
+        #define __IPHONE_OS_VERSION_MAX_ALLOWED     __IPHONE_10_3
     #endif
     /* make sure a valid min is set */
     #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=2.0,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=2.0,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=2.0,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=2.0,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=2.0,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.0,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=2.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=2.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_2_1                    __attribute__((availability(ios,introduced=2.1)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=2.1,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=2.1,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=2.1,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=2.1,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=2.1,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.1,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=2.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=2.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_2_2                    __attribute__((availability(ios,introduced=2.2)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=2.2,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=2.2,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=2.2,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=2.2,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=2.2,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=2.2,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=2.2)))
             #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=2.2)))
             #define __AVAILABILITY_INTERNAL__IPHONE_3_0                    __attribute__((availability(ios,introduced=3.0)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=3.0,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=3.0,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=3.0,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=3.0,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=3.0,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.0,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=3.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=3.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_3_1                    __attribute__((availability(ios,introduced=3.1)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=3.1,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=3.1,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=3.1,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=3.1,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=3.1,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.1,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=3.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=3.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_3_2                    __attribute__((availability(ios,introduced=3.2)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=3.2,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=3.2,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=3.2,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=3.2,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=3.2,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=3.2,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=3.2)))
             #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=3.2)))
             #define __AVAILABILITY_INTERNAL__IPHONE_4_0                    __attribute__((availability(ios,introduced=4.0)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=4.0,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=4.0,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=4.0,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=4.0,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=4.0,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.0,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=4.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=4.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_4_1                    __attribute__((availability(ios,introduced=4.1)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=4.1,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=4.1,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=4.1,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=4.1,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=4.1,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.1,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=4.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=4.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_4_2                    __attribute__((availability(ios,introduced=4.2)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=4.2,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=4.2,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=4.2,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=4.2,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=4.2,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.2,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=4.2)))
             #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=4.2)))
             #define __AVAILABILITY_INTERNAL__IPHONE_4_3                    __attribute__((availability(ios,introduced=4.3)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=4.3,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=4.3,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=4.3,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=4.3,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=4.3,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=4.3,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=4.3)))
             #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=4.3)))
             #define __AVAILABILITY_INTERNAL__IPHONE_5_0                    __attribute__((availability(ios,introduced=5.0)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=5.0,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=5.0,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=5.0,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=5.0,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=5.0,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=5.0,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=5.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=5.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_5_1                    __attribute__((availability(ios,introduced=5.1)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=5.1,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=5.1,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=5.1,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=5.1,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=5.1,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=5.1,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=5.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=5.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_6_0                    __attribute__((availability(ios,introduced=6.0)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=6.0,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=6.0,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=6.0,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=6.0,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=6.0,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=6.0,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=6.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=6.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_6_1                    __attribute__((availability(ios,introduced=6.1)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=6.1,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=6.1,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=6.1,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=6.1,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=6.1,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=6.1,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=6.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=6.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_7_0                    __attribute__((availability(ios,introduced=7.0)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=7.0,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=7.0,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=7.0,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=7.0,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=7.0,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=7.0,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=7.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=7.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_7_1                    __attribute__((availability(ios,introduced=7.1)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=7.1,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=7.1,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=7.1,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=7.1,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=7.1,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=7.1,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=7.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=7.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_0                    __attribute__((availability(ios,introduced=8.0)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=8.0,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=8.0,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=8.0,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=8.0,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=8.0,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.0,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=8.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=8.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_1                    __attribute__((availability(ios,introduced=8.1)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=8.1,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=8.1,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=8.1,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=8.1,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=8.1,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.1,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=8.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=8.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_2                    __attribute__((availability(ios,introduced=8.2)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=8.2,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=8.2,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=8.2,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=8.2,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=8.2,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.2,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=8.2)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=8.2)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_3                    __attribute__((availability(ios,introduced=8.3)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=8.3,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=8.3,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=8.3,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=8.3,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=8.3,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.3,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=8.3)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=8.3)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_4                    __attribute__((availability(ios,introduced=8.4)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=8.4,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=8.4,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=8.4,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=8.4,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=8.4,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=8.4,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=8.4)))
             #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=8.4)))
             #define __AVAILABILITY_INTERNAL__IPHONE_9_0                    __attribute__((availability(ios,introduced=9.0)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=9.0,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=9.0,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=10.0)))
             #endif
-            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=9.0)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=9.0,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=9.0,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=9.0,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.0,deprecated=10.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=9.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=9.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1                    __attribute__((availability(ios,introduced=9.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_1    __attribute__((availability(ios,introduced=9.1,deprecated=9.1)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=9.1,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=9.1,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=9.1,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=9.1,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=9.1,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.1,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=9.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=9.1)))
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2                    __attribute__((availability(ios,introduced=9.2)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=9.2)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=9.2,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=9.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=9.2,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
                     #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=10.0,message=_msg)))
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=9.2,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=9.2,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=9.2,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.2,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=9.2)))
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=9.2)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3                    __attribute__((availability(ios,introduced=9.3)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3    __attribute__((availability(ios,introduced=9.3,deprecated=9.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=9.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=9.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=9.3,deprecated=10.0)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=10.0,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=10.0)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=9.3,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=9.3,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=9.3,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=9.3,deprecated=10.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=9.3)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=9.3)))
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0                    __attribute__((availability(ios,introduced=10.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0    __attribute__((availability(ios,introduced=10.0,deprecated=10.0)))
             #if __has_feature(attribute_availability_with_message)
             #else
                     #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __attribute__((availability(ios,introduced=10.0,deprecated=10.0)))
             #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=10.0,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=10.0,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=10.0,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=10.0,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=10.0,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=10.0,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=10.0,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=10.0,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=10.0,deprecated=10.3)))
+            #endif
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=10.0)))
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=10.0)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1                    __attribute__((availability(ios,introduced=10.1)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1    __attribute__((availability(ios,introduced=10.1,deprecated=10.1)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=10.1,deprecated=10.1,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __attribute__((availability(ios,introduced=10.1,deprecated=10.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=10.1,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=10.1,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=10.1,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=10.1,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=10.1,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=10.1,deprecated=10.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=10.1)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=10.1)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2                    __attribute__((availability(ios,introduced=10.2)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2    __attribute__((availability(ios,introduced=10.2,deprecated=10.2)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=10.2,deprecated=10.2,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __attribute__((availability(ios,introduced=10.2,deprecated=10.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=10.2,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=10.2,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=10.2,deprecated=10.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=10.2)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=10.2)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3                    __attribute__((availability(ios,introduced=10.3)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3    __attribute__((availability(ios,introduced=10.3,deprecated=10.3)))
+            #if __has_feature(attribute_availability_with_message)
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=10.3,deprecated=10.3,message=_msg)))
+            #else
+                    #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __attribute__((availability(ios,introduced=10.3,deprecated=10.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_NA               __attribute__((availability(ios,introduced=10.3)))
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_NA_MSG(_msg)     __attribute__((availability(ios,introduced=10.3)))
             #define __AVAILABILITY_INTERNAL__IPHONE_NA                               __attribute__((availability(ios,unavailable)))
             #define __AVAILABILITY_INTERNAL__IPHONE_NA_DEP__IPHONE_NA                __attribute__((availability(ios,unavailable)))
             #define __AVAILABILITY_INTERNAL__IPHONE_NA_DEP__IPHONE_NA_MSG(_msg)      __attribute__((availability(ios,unavailable)))
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_2              __AVAILABILITY_INTERNAL_DEPRECATED
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
         #endif
+        /* set up old style internal macros (up to 9.3) */
+        #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3                      __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3                      __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3                      __AVAILABILITY_INTERNAL_REGULAR
+        #endif
+        #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_NA           __AVAILABILITY_INTERNAL__IPHONE_9_3
+        #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_NA_MSG(_msg) __AVAILABILITY_INTERNAL__IPHONE_9_3
+        #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+        #else
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_9_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #endif
         /* set up old style internal macros (up to 10.0) */
         #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0                      __AVAILABILITY_INTERNAL_UNAVAILABLE
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_2_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_2_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_2_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_2_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_3_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_3_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_3_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_3_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_3_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_3_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_3
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_3
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_4_3
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_5_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_5_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_5_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_5_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_6_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_6_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_6_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_6_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_7_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_7_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_7_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_7_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_3
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_3
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_3
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_4
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_4
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_8_4
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_0
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_1
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_1
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_2
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_2
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
         #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
             #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
             #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL__IPHONE_10_0
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
         #else
             #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_DEPRECATED
             #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0              __AVAILABILITY_INTERNAL_DEPRECATED
             #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_0_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
         #endif
+        /* set up old style internal macros (up to 10.1) */
+        #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1                      __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1                      __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1                      __AVAILABILITY_INTERNAL_REGULAR
+        #endif
+        #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_NA           __AVAILABILITY_INTERNAL__IPHONE_10_1
+        #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_NA_MSG(_msg) __AVAILABILITY_INTERNAL__IPHONE_10_1
+        #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL__IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_1
+        #else
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #endif
+        /* set up old style internal macros (up to 10.2) */
+        #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2                      __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2                      __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2                      __AVAILABILITY_INTERNAL_REGULAR
+        #endif
+        #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_NA           __AVAILABILITY_INTERNAL__IPHONE_10_2
+        #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_NA_MSG(_msg) __AVAILABILITY_INTERNAL__IPHONE_10_2
+        #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL__IPHONE_10_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_2
+        #else
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #endif
+        /* set up old style internal macros (up to 10.3) */
+        #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3                      __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3                      __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3                      __AVAILABILITY_INTERNAL_REGULAR
+        #endif
+        #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_NA           __AVAILABILITY_INTERNAL__IPHONE_10_3
+        #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_NA_MSG(_msg) __AVAILABILITY_INTERNAL__IPHONE_10_3
+        #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_2_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_2_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_3_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_3_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_4_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_4_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_5_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_5_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_6_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_6_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_7_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_7_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_8_4
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_8_4
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_9_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_9_3
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_0
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_0
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_1
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_1
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_2
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_2
+        #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_REGULAR
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL__IPHONE_10_3
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL__IPHONE_10_3
+        #else
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_3_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_4_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_5_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_6_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_7_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_8_4_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_9_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_0_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_1_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_2_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__IPHONE_10_3_DEP__IPHONE_10_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #endif
         /* set up internal macros (n/a) */
         #define __AVAILABILITY_INTERNAL__IPHONE_NA                               __AVAILABILITY_INTERNAL_UNAVAILABLE
         #define __AVAILABILITY_INTERNAL__IPHONE_NA_DEP__IPHONE_NA                __AVAILABILITY_INTERNAL_UNAVAILABLE
     #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_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_12
+        #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_12_4
     #endif
 
     #if defined(__has_attribute) && defined(__has_feature)
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.0,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.0)))
             #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.0)))
             #define __AVAILABILITY_INTERNAL__MAC_10_1                  __attribute__((availability(macosx,introduced=10.1)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11)))
             #endif
-            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11.2)))
             #if __has_feature(attribute_availability_with_message)
-                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12,message=_msg)))
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11.2,message=_msg)))
             #else
-                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12)))
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.11.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.1,deprecated=10.12.4)))
             #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.1)))
             #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.1)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.2,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.2)))
             #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.2)))
             #define __AVAILABILITY_INTERNAL__MAC_10_3                  __attribute__((availability(macosx,introduced=10.3)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.3,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.3)))
             #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.3)))
             #define __AVAILABILITY_INTERNAL__MAC_10_4                  __attribute__((availability(macosx,introduced=10.4)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.4,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.4)))
             #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.4)))
             #define __AVAILABILITY_INTERNAL__MAC_10_5                  __attribute__((availability(macosx,introduced=10.5)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.5,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.5)))
             #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.5)))
             #define __AVAILABILITY_INTERNAL__MAC_10_6                  __attribute__((availability(macosx,introduced=10.6)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.6,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.6)))
             #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.6)))
             #define __AVAILABILITY_INTERNAL__MAC_10_7                  __attribute__((availability(macosx,introduced=10.7)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.7,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.7)))
             #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.7)))
             #define __AVAILABILITY_INTERNAL__MAC_10_8                  __attribute__((availability(macosx,introduced=10.8)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.8,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.8)))
             #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.8)))
             #define __AVAILABILITY_INTERNAL__MAC_10_9                  __attribute__((availability(macosx,introduced=10.9)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.9,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.9)))
             #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.9)))
             #define __AVAILABILITY_INTERNAL__MAC_10_10                  __attribute__((availability(macosx,introduced=10.10)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.10)))
             #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.10)))
             #define __AVAILABILITY_INTERNAL__MAC_10_10_2                  __attribute__((availability(macosx,introduced=10.10.2)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.2,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.10.2)))
             #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.10.2)))
             #define __AVAILABILITY_INTERNAL__MAC_10_10_3                  __attribute__((availability(macosx,introduced=10.10.3)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.10.3,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.10.3)))
             #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.10.3)))
             #define __AVAILABILITY_INTERNAL__MAC_10_11                  __attribute__((availability(macosx,introduced=10.11)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.11.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
                 #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12,message=_msg)))
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.11)))
             #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.11)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2                  __attribute__((availability(macosx,introduced=10.11.2)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_2    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.11.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.11.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.11.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.11.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.2,deprecated=10.12.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.11.2)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.11.2)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3                  __attribute__((availability(macosx,introduced=10.11.3)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_3    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.11.3)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.11.3,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_3_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.11.3)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.11.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.3,deprecated=10.12.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.11.3)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.11.3)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4                  __attribute__((availability(macosx,introduced=10.11.4)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_11_4    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.11.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.11.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_11_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.11.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.11.4,deprecated=10.12.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.11.4)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.11.4)))
             #define __AVAILABILITY_INTERNAL__MAC_10_12                  __attribute__((availability(macosx,introduced=10.12)))
             #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12)))
             #if __has_feature(attribute_availability_with_message)
             #else
                 #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12)))
             #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12,deprecated=10.12.4)))
+            #endif
             #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.12)))
             #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.12)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1                  __attribute__((availability(macosx,introduced=10.12.1)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_1    __attribute__((availability(macosx,introduced=10.12.1,deprecated=10.12.1)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.1,deprecated=10.12.1,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_1_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.1,deprecated=10.12.1)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.12.1,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.1,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.1,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.12.1,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.1,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.1,deprecated=10.12.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.12.1)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.12.1)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2                  __attribute__((availability(macosx,introduced=10.12.2)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_2    __attribute__((availability(macosx,introduced=10.12.2,deprecated=10.12.2)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.2,deprecated=10.12.2,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_2_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.2,deprecated=10.12.2)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.12.2,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.2,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.2,deprecated=10.12.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.12.2)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.12.2)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4                  __attribute__((availability(macosx,introduced=10.12.4)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_10_12_4    __attribute__((availability(macosx,introduced=10.12.4,deprecated=10.12.4)))
+            #if __has_feature(attribute_availability_with_message)
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.4,deprecated=10.12.4,message=_msg)))
+            #else
+                #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_10_12_4_MSG(_msg)    __attribute__((availability(macosx,introduced=10.12.4,deprecated=10.12.4)))
+            #endif
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_NA_MSG(_msg)      __attribute__((availability(macosx,introduced=10.12.4)))
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_NA                __attribute__((availability(macosx,introduced=10.12.4)))
             #define __AVAILABILITY_INTERNAL__MAC_NA                        __attribute__((availability(macosx,unavailable)))
             #define __AVAILABILITY_INTERNAL__MAC_NA_DEP__MAC_NA            __attribute__((availability(macosx,unavailable)))
             #define __AVAILABILITY_INTERNAL__MAC_NA_DEP__MAC_NA_MSG(_msg)  __attribute__((availability(macosx,unavailable)))
 
     #ifndef __AVAILABILITY_INTERNAL__MAC_10_0
         /* use old style attributes */
+        #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_12_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4        __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4        __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4        __AVAILABILITY_INTERNAL_REGULAR
+        #endif
+        #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_12_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2        __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2        __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2        __AVAILABILITY_INTERNAL_REGULAR
+        #endif
+        #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_12_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1        __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1        __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1        __AVAILABILITY_INTERNAL_REGULAR
+        #endif
         #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_12
             #define __AVAILABILITY_INTERNAL__MAC_10_12        __AVAILABILITY_INTERNAL_UNAVAILABLE
         #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_12
         #else
             #define __AVAILABILITY_INTERNAL__MAC_10_12        __AVAILABILITY_INTERNAL_REGULAR
         #endif
+        #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4        __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4        __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4        __AVAILABILITY_INTERNAL_REGULAR
+        #endif
+        #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3        __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3        __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3        __AVAILABILITY_INTERNAL_REGULAR
+        #endif
+        #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2        __AVAILABILITY_INTERNAL_UNAVAILABLE
+        #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2        __AVAILABILITY_INTERNAL_WEAK_IMPORT
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2        __AVAILABILITY_INTERNAL_REGULAR
+        #endif
         #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_11
             #define __AVAILABILITY_INTERNAL__MAC_10_11        __AVAILABILITY_INTERNAL_UNAVAILABLE
         #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_11
             #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11              __AVAILABILITY_INTERNAL__MAC_10_11
             #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11
         #endif
+        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_2              __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_2
+        #endif
+        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_3              __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_3_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_3
+        #endif
+        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_11_4              __AVAILABILITY_INTERNAL__MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_11_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_4
+        #endif
         #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12
             #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12              __AVAILABILITY_INTERNAL_DEPRECATED
             #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
             #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
             #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12              __AVAILABILITY_INTERNAL_DEPRECATED
             #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
             #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12              __AVAILABILITY_INTERNAL_DEPRECATED
             #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
         #else
             #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_3
             #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12              __AVAILABILITY_INTERNAL__MAC_10_11
             #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12              __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12              __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12              __AVAILABILITY_INTERNAL__MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_4
             #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12              __AVAILABILITY_INTERNAL__MAC_10_12
             #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12
         #endif
+        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_12
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_1              __AVAILABILITY_INTERNAL__MAC_10_12_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_1_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12_1
+        #endif
+        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_12
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_12_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_2              __AVAILABILITY_INTERNAL__MAC_10_12_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_2_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12_2
+        #endif
+        #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL_DEPRECATED
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL_DEPRECATED_MSG(_msg)
+        #else
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_0
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_5
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_6
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_7_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_7
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_8_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_8
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_9_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_9
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_2_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_10_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_3
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_11_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_12
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_12_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12_1
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_12_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12_2
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_10_12_4              __AVAILABILITY_INTERNAL__MAC_10_12_4
+            #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_10_12_4_MSG(_msg)    __AVAILABILITY_INTERNAL__MAC_10_12_4
+        #endif
         #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_0
         #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_0
         #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_1
         #define __AVAILABILITY_INTERNAL__MAC_10_10_3_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_10_3
         #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_11
         #define __AVAILABILITY_INTERNAL__MAC_10_11_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_11
+        #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_11_2
+        #define __AVAILABILITY_INTERNAL__MAC_10_11_2_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_11_2
+        #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_11_3
+        #define __AVAILABILITY_INTERNAL__MAC_10_11_3_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_11_3
+        #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_11_4
+        #define __AVAILABILITY_INTERNAL__MAC_10_11_4_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_11_4
         #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_12
         #define __AVAILABILITY_INTERNAL__MAC_10_12_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_12
+        #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_12_1
+        #define __AVAILABILITY_INTERNAL__MAC_10_12_1_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_12_1
+        #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_12_2
+        #define __AVAILABILITY_INTERNAL__MAC_10_12_2_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_12_2
+        #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_NA             __AVAILABILITY_INTERNAL__MAC_10_12_4
+        #define __AVAILABILITY_INTERNAL__MAC_10_12_4_DEP__MAC_NA_MSG(_msg)   __AVAILABILITY_INTERNAL__MAC_10_12_4
         #define __AVAILABILITY_INTERNAL__MAC_NA_DEP__MAC_NA               __AVAILABILITY_INTERNAL_UNAVAILABLE
         #define __AVAILABILITY_INTERNAL__MAC_NA_DEP__MAC_NA_MSG(_msg)     __AVAILABILITY_INTERNAL_UNAVAILABLE
     #endif
 #endif
 
+/*
+ Macros for defining which versions/platform a given symbol can be used.
+ @see http://clang.llvm.org/docs/AttributeReference.html#availability
+ */
+
+/*
+ * API Introductions
+ *
+ * Use to specify the release that a particular API became available.
+ *
+ * Platform names:
+ *   macos, ios, tvos, watchos
+ *
+ * Examples:
+ *    __API_AVAILABLE(macos(10.10))
+ *    __API_AVAILABLE(macos(10.9), ios(10.0))
+ *    __API_AVAILABLE(macos(10.4), ios(8.0), watchos(2.0), tvos(10.0))
+ */
+#define __API_AVAILABLE_PLATFORM_macos(x) macos,introduced=x
+#define __API_AVAILABLE_PLATFORM_macosx(x) macosx,introduced=x
+#define __API_AVAILABLE_PLATFORM_ios(x) ios,introduced=x
+#define __API_AVAILABLE_PLATFORM_watchos(x) watchos,introduced=x
+#define __API_AVAILABLE_PLATFORM_tvos(x) tvos,introduced=x
+
+#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))
+#define __API_AVAILABLE1(x) __API_A(x)
+#define __API_AVAILABLE2(x,y) __API_A(x) __API_A(y)
+#define __API_AVAILABLE3(x,y,z)  __API_A(x) __API_A(y) __API_A(z)
+#define __API_AVAILABLE4(x,y,z,t) __API_A(x) __API_A(y) __API_A(z) __API_A(t)
+#define __API_AVAILABLE_GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
+
+/*
+ * API Deprecations
+ *
+ * Use to specify the release that a particular API became unavailable.
+ *
+ * Platform names:
+ *   macos, ios, tvos, watchos
+ *
+ * Examples:
+ *
+ *    __API_DEPRECATED("No longer supported", macos(10.4, 10.8))
+ *    __API_DEPRECATED("No longer supported", macos(10.4, 10.8), ios(2.0, 3.0), watchos(2.0, 3.0), tvos(9.0, 10.0))
+ *
+ *    __API_DEPRECATED_WITH_REPLACEMENT("-setName:", tvos(10.0, 10.4), ios(9.0, 10.0))
+ *    __API_DEPRECATED_WITH_REPLACEMENT("SomeClassName", macos(10.4, 10.6), watchos(2.0, 3.0))
+ */
+#define __API_DEPRECATED_PLATFORM_macos(x,y) macos,introduced=x,deprecated=y
+#define __API_DEPRECATED_PLATFORM_macosx(x,y) macosx,introduced=x,deprecated=y
+#define __API_DEPRECATED_PLATFORM_ios(x,y) ios,introduced=x,deprecated=y
+#define __API_DEPRECATED_PLATFORM_watchos(x,y) watchos,introduced=x,deprecated=y
+#define __API_DEPRECATED_PLATFORM_tvos(x,y) tvos,introduced=x,deprecated=y
+
+#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))
+#define __API_DEPRECATED_MSG2(msg,x) __API_D(msg,x)
+#define __API_DEPRECATED_MSG3(msg,x,y) __API_D(msg,x) __API_D(msg,y)
+#define __API_DEPRECATED_MSG4(msg,x,y,z) __API_DEPRECATED_MSG3(msg,x,y) __API_D(msg,z)
+#define __API_DEPRECATED_MSG5(msg,x,y,z,t) __API_DEPRECATED_MSG4(msg,x,y,z) __API_D(msg,t)
+#define __API_DEPRECATED_MSG_GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
+
+#if defined(__has_feature)
+    #if __has_feature(attribute_availability_with_replacement)
+        #define __API_R(rep,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,replacement=rep)))
+    #else
+        #define __API_R(rep,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x)))
+    #endif
+#else
+    #define __API_R(rep,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x)))
+#endif
+
+#define __API_DEPRECATED_REP2(rep,x) __API_R(rep,x)
+#define __API_DEPRECATED_REP3(rep,x,y) __API_R(rep,x) __API_R(rep,y)
+#define __API_DEPRECATED_REP4(rep,x,y,z)  __API_DEPRECATED_REP3(rep,x,y) __API_R(rep,z)
+#define __API_DEPRECATED_REP5(rep,x,y,z,t) __API_DEPRECATED_REP4(rep,x,y,z) __API_R(rep,t)
+#define __API_DEPRECATED_REP_GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
+
+/*
+ * API Unavailability
+ * Use to specify that an API is unavailable for a particular platform.
+ *
+ * Example:
+ *    __API_UNAVAILABLE(macos)
+ *    __API_UNAVAILABLE(watchos, tvos)
+ */
+#define __API_UNAVAILABLE_PLATFORM_macos macos,unavailable
+#define __API_UNAVAILABLE_PLATFORM_macosx macosx,unavailable
+#define __API_UNAVAILABLE_PLATFORM_ios ios,unavailable
+#define __API_UNAVAILABLE_PLATFORM_watchos watchos,unavailable
+#define __API_UNAVAILABLE_PLATFORM_tvos tvos,unavailable
+
+#define __API_U(x) __attribute__((availability(__API_UNAVAILABLE_PLATFORM_##x)))
+#define __API_UNAVAILABLE1(x) __API_U(x)
+#define __API_UNAVAILABLE2(x,y) __API_U(x) __API_U(y)
+#define __API_UNAVAILABLE3(x,y,z) __API_UNAVAILABLE2(x,y) __API_U(z)
+#define __API_UNAVAILABLE_GET_MACRO(_1,_2,_3,NAME,...) NAME
+
+/*
+ * Swift compiler version
+ * 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)
+ *  - (nonnull NSString *)description;
+ *  #else
+ *  - (NSString *)description;
+ *  #endif
+ */
+#ifdef __SWIFT_COMPILER_VERSION
+    #define __swift_compiler_version_at_least_impl(X, Y, Z, a, b, ...) \
+    __SWIFT_COMPILER_VERSION >= ((X * UINT64_C(1000) * 1000 * 1000) + (Z * 1000 * 1000) + (a * 1000) + b)
+    #define __swift_compiler_version_at_least(...) __swift_compiler_version_at_least_impl(__VA_ARGS__, 0, 0, 0, 0)
+#else
+    #define __swift_compiler_version_at_least(...) 1
+#endif
+
 #endif /* __AVAILABILITY_INTERNAL__ */
index f0bbfe240da22372295ba556f6c8b590330ec674..a9027a58a421792774f8b9720f08e34eb7706c65 100644 (file)
@@ -24,7 +24,7 @@
 /*
      File:       AvailabilityMacros.h
  
-     More Info:  See TechNote 2064
+     More Info:  See the SDK Compatibility Guide
 
      Contains:   Autoconfiguration of AVAILABLE_ macros for Mac OS X
 
 #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
 
 /* 
  * If min OS not specified, assume 10.4 for intel
 #endif
 
 /*
- * if max OS not specified, assume larger of (10.12, min)
+ * if max OS not specified, assume larger of (10.12.4, min)
  */
 #ifndef MAC_OS_X_VERSION_MAX_ALLOWED
-    #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_12
+    #if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_12_4
         #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_12
+        #define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_12_4
     #endif
 #endif
 
 #endif
 
 
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER
+ * 
+ * Used on declarations introduced in Mac OS X 10.11.2 
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER     __OSX_AVAILABLE_STARTING(__MAC_10_11_2, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER     UNAVAILABLE_ATTRIBUTE
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER     WEAK_IMPORT_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in Mac OS X 10.11.2,
+ * and deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED     __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_2, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED    AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.0,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.1,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.2,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.3,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.4,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.5,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.6,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.7,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_7, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.8,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.9,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_9, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.10,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.10.2,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_2, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.10.3,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_3, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2
+ *
+ * Used on declarations introduced in Mac OS X 10.11,
+ * but later deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2    AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2_AND_LATER
+ *
+ * Used on types deprecated in Mac OS X 10.11.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2_AND_LATER    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_11_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_2
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2_AND_LATER    DEPRECATED_ATTRIBUTE
+#else
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_11_2_AND_LATER
+#endif
+
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER
+ * 
+ * Used on declarations introduced in Mac OS X 10.11.3 
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER     __OSX_AVAILABLE_STARTING(__MAC_10_11_3, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER     UNAVAILABLE_ATTRIBUTE
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER     WEAK_IMPORT_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in Mac OS X 10.11.3,
+ * and deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED     __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_3, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED    AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.0,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.1,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.2,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.3,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.4,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.5,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.6,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.7,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_7, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.8,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.9,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_9, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.10,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.10.2,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_2, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.10.3,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_3, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.11,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3
+ *
+ * Used on declarations introduced in Mac OS X 10.11.2,
+ * but later deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_2, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3    AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3_AND_LATER
+ *
+ * Used on types deprecated in Mac OS X 10.11.3
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3_AND_LATER    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_11_3, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_3
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3_AND_LATER    DEPRECATED_ATTRIBUTE
+#else
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_11_3_AND_LATER
+#endif
+
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER
+ * 
+ * Used on declarations introduced in Mac OS X 10.11.4 
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER     __OSX_AVAILABLE_STARTING(__MAC_10_11_4, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER     UNAVAILABLE_ATTRIBUTE
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER     WEAK_IMPORT_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in Mac OS X 10.11.4,
+ * and deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED     __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_4, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED    AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.0,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.1,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.2,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.3,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.4,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.5,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.6,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.7,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_7, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.8,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.9,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_9, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.10,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.10.2,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_2, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.10.3,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_3, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.11,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.11.2,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_2, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4
+ *
+ * Used on declarations introduced in Mac OS X 10.11.3,
+ * but later deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_3, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4    AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4_AND_LATER
+ *
+ * Used on types deprecated in Mac OS X 10.11.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4_AND_LATER    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_11_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11_4
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4_AND_LATER    DEPRECATED_ATTRIBUTE
+#else
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_11_4_AND_LATER
+#endif
+
+
 /*
  * AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
  * 
- * Used on declarations introduced in Mac OS X 10.12 
+ * Used on declarations introduced in Mac OS X 10.12 
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER     __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER     UNAVAILABLE_ATTRIBUTE
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER     WEAK_IMPORT_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in Mac OS X 10.12,
+ * and deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED     __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED    AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.0,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.1,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.2,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.3,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.4,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.5,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.6,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.7,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_7, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.8,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.9,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_9, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.10,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.10.2,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_2, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.10.3,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_3, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.11,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.11.2,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_2, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.11.3,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_3, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ *
+ * Used on declarations introduced in Mac OS X 10.11.4,
+ * but later deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_4, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_MAC_OS_X_VERSION_10_12_AND_LATER
+ *
+ * Used on types deprecated in Mac OS X 10.12
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_AND_LATER    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_AND_LATER    DEPRECATED_ATTRIBUTE
+#else
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_AND_LATER
+#endif
+
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER
+ * 
+ * Used on declarations introduced in Mac OS X 10.12.1 
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER     __OSX_AVAILABLE_STARTING(__MAC_10_12_1, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER     UNAVAILABLE_ATTRIBUTE
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER     WEAK_IMPORT_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in Mac OS X 10.12.1,
+ * and deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED     __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12_1, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED    AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.0,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.1,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.2,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.3,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.4,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.5,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.6,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.7,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_7, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.8,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.9,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_9, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.10,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.10.2,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_2, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.10.3,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_3, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.11,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.11.2,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_2, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.11.3,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_3, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.11.4,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_4, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1
+ *
+ * Used on declarations introduced in Mac OS X 10.12,
+ * but later deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1    AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1_AND_LATER
+ *
+ * Used on types deprecated in Mac OS X 10.12.1
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1_AND_LATER    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12_1, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_1
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1_AND_LATER    DEPRECATED_ATTRIBUTE
+#else
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_1_AND_LATER
+#endif
+
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER
+ * 
+ * Used on declarations introduced in Mac OS X 10.12.2 
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER     __OSX_AVAILABLE_STARTING(__MAC_10_12_2, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER     UNAVAILABLE_ATTRIBUTE
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER     WEAK_IMPORT_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in Mac OS X 10.12.2,
+ * and deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER_BUT_DEPRECATED     __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12_2, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER_BUT_DEPRECATED    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER_BUT_DEPRECATED    AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.0,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.1,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.2,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.3,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.4,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.5,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.6,
+ * but later deprecated in Mac OS X 10.12.2
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER     __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER     UNAVAILABLE_ATTRIBUTE
-#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER     WEAK_IMPORT_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED
+ * AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.7,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_7, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.8,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.9,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_9, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.10,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.10.2,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_2, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.10.3,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_3, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.11,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.11.2,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_2, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.11.3,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_3, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.11.4,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_4, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
  *
  * Used on declarations introduced in Mac OS X 10.12,
- * and deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.2
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED     __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED    AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2
+ *
+ * Used on declarations introduced in Mac OS X 10.12.1,
+ * but later deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12_1, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2    AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2_AND_LATER
+ *
+ * Used on types deprecated in Mac OS X 10.12.2
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2_AND_LATER    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12_2, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_2
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2_AND_LATER    DEPRECATED_ATTRIBUTE
+#else
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_2_AND_LATER
+#endif
+
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER
+ * 
+ * Used on declarations introduced in Mac OS X 10.12.4 
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER     __OSX_AVAILABLE_STARTING(__MAC_10_12_4, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER     UNAVAILABLE_ATTRIBUTE
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER     WEAK_IMPORT_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER_BUT_DEPRECATED
+ *
+ * Used on declarations introduced in Mac OS X 10.12.4,
+ * and deprecated in Mac OS X 10.12.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER_BUT_DEPRECATED     __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12_4, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER_BUT_DEPRECATED    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER_BUT_DEPRECATED    AVAILABLE_MAC_OS_X_VERSION_10_12_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.0,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.1,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.2,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_2, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.3,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_3, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.4,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.5,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.6,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_6, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.7,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_7, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_7, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.8,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_8, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.9,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_9, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_9, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_9_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.10,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.10.2,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_2, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_2, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_10_2_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.10.3,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_3, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_10_3, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_10_3_AND_LATER
 #endif
 
 /*
- * AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
  * Used on declarations introduced in Mac OS X 10.11,
- * but later deprecated in Mac OS X 10.12
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12    AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_11_AND_LATER
 #endif
 
 /*
- * DEPRECATED_IN_MAC_OS_X_VERSION_10_12_AND_LATER
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
  *
- * Used on types deprecated in Mac OS X 10.12
+ * Used on declarations introduced in Mac OS X 10.11.2,
+ * but later deprecated in Mac OS X 10.12.4
  */
 #if __AVAILABILITY_MACROS_USES_AVAILABILITY
-    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_AND_LATER    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_4_0, __IPHONE_4_0)
-#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
-    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_AND_LATER    DEPRECATED_ATTRIBUTE
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_2, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
 #else
-    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_AND_LATER
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_11_2_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
+ *
+ * Used on declarations introduced in Mac OS X 10.11.3,
+ * but later deprecated in Mac OS X 10.12.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_3, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_11_3_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
+ *
+ * Used on declarations introduced in Mac OS X 10.11.4,
+ * but later deprecated in Mac OS X 10.12.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_11_4, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_11_4_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
+ *
+ * Used on declarations introduced in Mac OS X 10.12,
+ * but later deprecated in Mac OS X 10.12.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_12_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
+ *
+ * Used on declarations introduced in Mac OS X 10.12.1,
+ * but later deprecated in Mac OS X 10.12.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12_1, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_12_1_AND_LATER
+#endif
+
+/*
+ * AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4
+ *
+ * Used on declarations introduced in Mac OS X 10.12.2,
+ * but later deprecated in Mac OS X 10.12.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_12_2, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    DEPRECATED_ATTRIBUTE
+#else
+    #define AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4    AVAILABLE_MAC_OS_X_VERSION_10_12_2_AND_LATER
+#endif
+
+/*
+ * DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4_AND_LATER
+ *
+ * Used on types deprecated in Mac OS X 10.12.4
+ */
+#if __AVAILABILITY_MACROS_USES_AVAILABILITY
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4_AND_LATER    __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12_4, __IPHONE_4_0, __IPHONE_4_0)
+#elif MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12_4
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4_AND_LATER    DEPRECATED_ATTRIBUTE
+#else
+    #define DEPRECATED_IN_MAC_OS_X_VERSION_10_12_4_AND_LATER
 #endif
 
 
index 988c22cee950d0bc37f229b59f51a23a3628aaff..b99d5b4510be2c923802852383b035fc0b2eb053 100644 (file)
@@ -25,12 +25,13 @@ INSTINC_SUBDIRS_ARM64 =     \
 EXPORT_FILES = \
        Availability.h  \
        AvailabilityInternal.h  \
-       AvailabilityMacros.h    \
-       stddef.h
+       AvailabilityMacros.h
 
 KERNEL_FILES = \
        stdarg.h        \
+       stdatomic.h     \
        stdbool.h       \
+       stddef.h        \
        stdint.h
 
 INSTALL_MI_LIST =
index 807d58cea6bad74591f0c3443e89ba78449160c6..464f32b1822165134661e837cd057e94e6bb6f95 100644 (file)
 #endif
 
 #if !defined(CC_USE_HEAP_FOR_WORKSPACE)
- #if CC_USE_L4 || CC_IBOOT || CC_BASEBAND || defined(_MSC_VER)
+ #if CC_USE_L4 || CC_IBOOT || defined(_MSC_VER)
  /* For L4, stack is too short, need to use HEAP for some computations */
  /* CC_USE_HEAP_FOR_WORKSPACE not supported for KERNEL!  */
   #define CC_USE_HEAP_FOR_WORKSPACE 1
index 77aa6d0d02d4b33d0ac8a181148a1477000d6013..5c8ebbdc7f511141a231f6ef65d0f192d181c9e3 100644 (file)
@@ -24,7 +24,7 @@
 #include <pexpert/pexpert.h>
 #define cc_printf(x...) kprintf(x)
 extern int printf(const char *format, ...) __printflike(1,2);
-#elif CC_USE_S3 || CC_IBOOT
+#elif CC_USE_S3
 #include <stdio.h>
 #define cc_printf(x...) printf(x)
 #else
index 5d4ca87c272df68a22cd5941c994c53d22a6ced8..75918fe8483fe94a4994f27c86a85496642dd615 100644 (file)
@@ -175,9 +175,15 @@ int cccmac_one_shot_verify(const struct ccmode_cbc *cbc,
 int cccmac_init(const struct ccmode_cbc *cbc,
                   cccmac_ctx_t ctx,
                   size_t key_nbytes, const void *key)
-// This is the good prototype! The deprecate warning is only for clients using the old function (now defined as macro)
 __attribute__((deprecated("see guidelines in corecrypto/cccmac.h for migration", "define 'CC_CHANGEFUNCTION_28544056_cccmac_init' and use new cccmac_init with parameter key_nbytes")));
+// If you see this deprecate warning
+// Define CC_CHANGEFUNCTION_28544056_cccmac_init and use "cccmac_init(...,...,16,...)"
+// This will be removed with 28544056
+#define cccmac_init(cbc,ctx,key) cccmac_init(cbc,ctx,16,key)
+
 #else
+
+// This is the authoritative prototype, which will be left after 28544056
 int cccmac_init(const struct ccmode_cbc *cbc,
                 cccmac_ctx_t ctx,
                 size_t key_nbytes, const void *key);
@@ -236,8 +242,6 @@ int cccmac_final_verify(cccmac_ctx_t ctx,
 
  ==============================================================================*/
 
-#ifndef CC_CHANGEFUNCTION_28544056_cccmac_init
-
 /*
  Guidelines for switching to new CMAC functions
 
@@ -252,17 +256,6 @@ int cccmac_final_verify(cccmac_ctx_t ctx,
 
  */
 
-/*!
- @function   cccmac_init
- @abstract   Initialize CMAC context with 128bit key
- Define CC_CHANGEFUNCTION_28544056_cccmac_init and use "cccmac_init(...,...,16,...)"
-
- */
-#define cccmac_init(cbc,ctx,key) cccmac_init(cbc,ctx,16,key)
-
-#endif /* CC_CHANGEFUNCTION_28544056_cccmac_init - TO BE REMOVED WITH 28544056 */
-
 /*!
  @function   cccmac_block_update
  @abstract   Process data
diff --git a/EXTERNAL_HEADERS/stdatomic.h b/EXTERNAL_HEADERS/stdatomic.h
new file mode 100644 (file)
index 0000000..261c653
--- /dev/null
@@ -0,0 +1,198 @@
+/*===---- stdatomic.h - Standard header for atomic types and operations -----===
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *===-----------------------------------------------------------------------===
+ */
+
+#ifndef __clang__
+#error unsupported compiler
+#endif
+
+#ifndef __CLANG_STDATOMIC_H
+#define __CLANG_STDATOMIC_H
+
+/* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for
+ * example, already has a Clang-compatible stdatomic.h header.
+ */
+#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
+# include_next <stdatomic.h>
+#else
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* 7.17.1 Introduction */
+
+#define ATOMIC_BOOL_LOCK_FREE       __GCC_ATOMIC_BOOL_LOCK_FREE
+#define ATOMIC_CHAR_LOCK_FREE       __GCC_ATOMIC_CHAR_LOCK_FREE
+#define ATOMIC_CHAR16_T_LOCK_FREE   __GCC_ATOMIC_CHAR16_T_LOCK_FREE
+#define ATOMIC_CHAR32_T_LOCK_FREE   __GCC_ATOMIC_CHAR32_T_LOCK_FREE
+#define ATOMIC_WCHAR_T_LOCK_FREE    __GCC_ATOMIC_WCHAR_T_LOCK_FREE
+#define ATOMIC_SHORT_T_LOCK_FREE    __GCC_ATOMIC_SHORT_T_LOCK_FREE
+#define ATOMIC_INT_T_LOCK_FREE      __GCC_ATOMIC_INT_T_LOCK_FREE
+#define ATOMIC_LONG_T_LOCK_FREE     __GCC_ATOMIC_LONG_T_LOCK_FREE
+#define ATOMIC_LLONG_T_LOCK_FREE    __GCC_ATOMIC_LLONG_T_LOCK_FREE
+#define ATOMIC_POINTER_T_LOCK_FREE  __GCC_ATOMIC_POINTER_T_LOCK_FREE
+
+/* 7.17.2 Initialization */
+
+#define ATOMIC_VAR_INIT(value) (value)
+#define atomic_init __c11_atomic_init
+
+/* 7.17.3 Order and consistency */
+
+typedef enum memory_order {
+  memory_order_relaxed = __ATOMIC_RELAXED,
+  memory_order_consume = __ATOMIC_CONSUME,
+  memory_order_acquire = __ATOMIC_ACQUIRE,
+  memory_order_release = __ATOMIC_RELEASE,
+  memory_order_acq_rel = __ATOMIC_ACQ_REL,
+  memory_order_seq_cst = __ATOMIC_SEQ_CST
+} memory_order;
+
+#define kill_dependency(y) (y)
+
+/* 7.17.4 Fences */
+
+#ifndef KERNEL
+/* These should be provided by the libc implementation. */
+void atomic_thread_fence(memory_order);
+void atomic_signal_fence(memory_order);
+#endif
+
+#define atomic_thread_fence(order) __c11_atomic_thread_fence(order)
+#define atomic_signal_fence(order) __c11_atomic_signal_fence(order)
+
+/* 7.17.5 Lock-free property */
+
+#define atomic_is_lock_free(obj) __c11_atomic_is_lock_free(sizeof(*(obj)))
+
+/* 7.17.6 Atomic integer types */
+
+#ifdef __cplusplus
+typedef _Atomic(bool)               atomic_bool;
+#else
+typedef _Atomic(_Bool)              atomic_bool;
+#endif
+typedef _Atomic(char)               atomic_char;
+typedef _Atomic(signed char)        atomic_schar;
+typedef _Atomic(unsigned char)      atomic_uchar;
+typedef _Atomic(short)              atomic_short;
+typedef _Atomic(unsigned short)     atomic_ushort;
+typedef _Atomic(int)                atomic_int;
+typedef _Atomic(unsigned int)       atomic_uint;
+typedef _Atomic(long)               atomic_long;
+typedef _Atomic(unsigned long)      atomic_ulong;
+typedef _Atomic(long long)          atomic_llong;
+typedef _Atomic(unsigned long long) atomic_ullong;
+typedef _Atomic(uint_least16_t)     atomic_char16_t;
+typedef _Atomic(uint_least32_t)     atomic_char32_t;
+typedef _Atomic(wchar_t)            atomic_wchar_t;
+typedef _Atomic(int_least8_t)       atomic_int_least8_t;
+typedef _Atomic(uint_least8_t)      atomic_uint_least8_t;
+typedef _Atomic(int_least16_t)      atomic_int_least16_t;
+typedef _Atomic(uint_least16_t)     atomic_uint_least16_t;
+typedef _Atomic(int_least32_t)      atomic_int_least32_t;
+typedef _Atomic(uint_least32_t)     atomic_uint_least32_t;
+typedef _Atomic(int_least64_t)      atomic_int_least64_t;
+typedef _Atomic(uint_least64_t)     atomic_uint_least64_t;
+typedef _Atomic(int_fast8_t)        atomic_int_fast8_t;
+typedef _Atomic(uint_fast8_t)       atomic_uint_fast8_t;
+typedef _Atomic(int_fast16_t)       atomic_int_fast16_t;
+typedef _Atomic(uint_fast16_t)      atomic_uint_fast16_t;
+typedef _Atomic(int_fast32_t)       atomic_int_fast32_t;
+typedef _Atomic(uint_fast32_t)      atomic_uint_fast32_t;
+typedef _Atomic(int_fast64_t)       atomic_int_fast64_t;
+typedef _Atomic(uint_fast64_t)      atomic_uint_fast64_t;
+typedef _Atomic(intptr_t)           atomic_intptr_t;
+typedef _Atomic(uintptr_t)          atomic_uintptr_t;
+typedef _Atomic(size_t)             atomic_size_t;
+typedef _Atomic(ptrdiff_t)          atomic_ptrdiff_t;
+typedef _Atomic(intmax_t)           atomic_intmax_t;
+typedef _Atomic(uintmax_t)          atomic_uintmax_t;
+
+/* 7.17.7 Operations on atomic types */
+
+#define atomic_store(object, desired) __c11_atomic_store(object, desired, __ATOMIC_SEQ_CST)
+#define atomic_store_explicit __c11_atomic_store
+
+#define atomic_load(object) __c11_atomic_load(object, __ATOMIC_SEQ_CST)
+#define atomic_load_explicit __c11_atomic_load
+
+#define atomic_exchange(object, desired) __c11_atomic_exchange(object, desired, __ATOMIC_SEQ_CST)
+#define atomic_exchange_explicit __c11_atomic_exchange
+
+#define atomic_compare_exchange_strong(object, expected, desired) __c11_atomic_compare_exchange_strong(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
+#define atomic_compare_exchange_strong_explicit __c11_atomic_compare_exchange_strong
+
+#define atomic_compare_exchange_weak(object, expected, desired) __c11_atomic_compare_exchange_weak(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
+#define atomic_compare_exchange_weak_explicit __c11_atomic_compare_exchange_weak
+
+#define atomic_fetch_add(object, operand) __c11_atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_add_explicit __c11_atomic_fetch_add
+
+#define atomic_fetch_sub(object, operand) __c11_atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_sub_explicit __c11_atomic_fetch_sub
+
+#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_or_explicit __c11_atomic_fetch_or
+
+#define atomic_fetch_xor(object, operand) __c11_atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_xor_explicit __c11_atomic_fetch_xor
+
+#define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
+#define atomic_fetch_and_explicit __c11_atomic_fetch_and
+
+/* 7.17.8 Atomic flag type and operations */
+
+typedef struct atomic_flag { atomic_bool _Value; } atomic_flag;
+
+#define ATOMIC_FLAG_INIT { 0 }
+
+#ifndef KERNEL
+/* These should be provided by the libc implementation. */
+#ifdef __cplusplus
+bool atomic_flag_test_and_set(volatile atomic_flag *);
+bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
+#else
+_Bool atomic_flag_test_and_set(volatile atomic_flag *);
+_Bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
+#endif
+void atomic_flag_clear(volatile atomic_flag *);
+void atomic_flag_clear_explicit(volatile atomic_flag *, memory_order);
+#endif
+
+#define atomic_flag_test_and_set(object) __c11_atomic_exchange(&(object)->_Value, 1, __ATOMIC_SEQ_CST)
+#define atomic_flag_test_and_set_explicit(object, order) __c11_atomic_exchange(&(object)->_Value, 1, order)
+
+#define atomic_flag_clear(object) __c11_atomic_store(&(object)->_Value, 0, __ATOMIC_SEQ_CST)
+#define atomic_flag_clear_explicit(object, order) __c11_atomic_store(&(object)->_Value, 0, order)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STDC_HOSTED__ */
+#endif /* __CLANG_STDATOMIC_H */
+
index 9e87ee89b3b91a14d4ccd4cb7b88723d4744e986..d9bb51e83205c050ff17bd57ca69bc679369bfa5 100644 (file)
@@ -49,7 +49,9 @@ typedef __WCHAR_TYPE__ wchar_t;
 #define NULL ((void*)0)
 #endif
 
+#ifndef offsetof
 #define offsetof(t, d) __builtin_offsetof(t, d)
+#endif
 
 #endif /* __STDDEF_H */
 
index 5a5995ee2aabbaaa9b555da7d2ae0442b20d2e77..5024fb9cf9300f3fc1583683e794cb55f42c16d4 100644 (file)
 #define        BSM_F_ADDSIGS           359     /* Darwin-specific. */
 #define        BSM_F_MARKDEPENDENCY    360     /* Darwin-specific. */
 #define        BSM_F_BARRIERFSYNC      361     /* Darwin-specific. */
+#define        BSM_F_PUNCHHOLE         362     /* Darwin-specific. */
+#define        BSM_F_TRIM_ACTIVE_FILE          363     /* Darwin-specific. */
 
 /*
  * Darwin file system specific (400-499).
index d6bb6100449bc58bf5915ac56f3e34c84fb1b846..edfd0c7679baf1b60b0efc5ff3f5ce6d4f74192b 100644 (file)
@@ -224,6 +224,41 @@ OBJS_NO_CAST_ALIGN =                       \
 
 $(foreach file,$(OBJS_NO_CAST_ALIGN),$(eval $(call add_perfile_cflags,$(file),-Wno-cast-align)))
 
+# Relax -Waddress-of-packed-member on networking (28123676)
+OBJS_NO_PACKED_ADDRESS =    \
+               ah_core.o           \
+               ah_input.o          \
+               esp_input.o         \
+               esp_output.o        \
+               frag6.o             \
+               icmp6.o             \
+               if_stf.o            \
+               in6_cksum.o         \
+               in6_gif.o           \
+               ip6_forward.o       \
+               ip6_input.o         \
+               ip6_output.o        \
+               ipsec.o             \
+               mld6.o              \
+               mptcp_opt.o         \
+               nd6.o               \
+               nd6_nbr.o           \
+               nd6_prproxy.o       \
+               nd6_rtr.o           \
+               necp.o              \
+               pf.o                \
+               pf_norm.o           \
+               pktap.o             \
+               raw_ip6.o           \
+               tcp_input.o         \
+               tcp_subr.o          \
+               udp6_output.o       \
+               udp6_usrreq.o       \
+               udp_usrreq.o
+
+$(foreach file,$(OBJS_NO_PACKED_ADDRESS),$(eval $(call add_perfile_cflags,$(file),-Wno-unknown-warning-option)))
+$(foreach file,$(OBJS_NO_PACKED_ADDRESS),$(eval $(call add_perfile_cflags,$(file),-Wno-address-of-packed-member)))
+
 #
 # This rule insures that the subr_prof.c does NOT get compiled with
 # profiling. It implements mcount() and profiling it leads to recursion.
index fcf0d489066a627c51c75d365b1bfb2f8a6a7d2e..89d1de965ccafa011da70713dd072bad7c4ff495 100644 (file)
@@ -505,7 +505,8 @@ bsd/kern/kern_kpc.c                 optional kpc
 
 bsd/kern/proc_uuid_policy.c            optional config_proc_uuid_policy
 
-bsd/pgo/profile_runtime.c              standard
+bsd/pgo/profile_runtime.c              optional pgo
+bsd/pgo/profile_runtime_data.c         standard
 
 bsd/miscfs/nullfs/null_subr.c       optional nullfs
 bsd/miscfs/nullfs/null_vfsops.c     optional nullfs
index 30d41336c551bb14fa079c3927dcb625d030372e..f1f32ea70bd47e56df61edbf9b75fafc13cd3a9a 100644 (file)
@@ -7622,7 +7622,7 @@ dtrace_cond_provider_match(dtrace_probedesc_t *desc, void *data)
 
        dtrace_probekey_f *func = dtrace_probekey_func(desc->dtpd_provider);
 
-       return func(desc->dtpd_provider, (char*)data, 0);
+       return func((char*)data, desc->dtpd_provider, 0);
 }
 
 /*
@@ -13067,7 +13067,12 @@ dtrace_state_create(dev_t *devp, cred_t *cr, dtrace_state_t **new_state)
        /* Cause restart */
        *new_state = NULL;
        
-       minor = getminor(*devp);
+       if (devp != NULL) {
+               minor = getminor(*devp);
+       }
+       else {
+               minor = DTRACE_NCLIENTS - 1;
+       }
 
        state = dtrace_state_allocate(minor);
        if (NULL == state) {
index 541cad6e9ef30dba864a01107ed991e851b66a88..54f00f290cb02fae8c028903b39a6852b24e1467 100644 (file)
@@ -650,6 +650,14 @@ __provide_probe_64(struct modctl *ctl, uintptr_t instrLow, uintptr_t instrHigh,
        machine_inst_t *instr, *limit, theInstr, i1, i2, i3;
        int size;
                
+       /*
+        * Guard against null symbols
+        */
+       if (!symbolStart || !instrLow || !instrHigh) {
+               kprintf("dtrace: %s has an invalid address\n", symbolName);
+               return;
+       }
+
        for (j = 0, instr = symbolStart, theInstr = 0;
             (j < 4) && ((uintptr_t)instr >= instrLow) && (instrHigh > (uintptr_t)(instr + 2)); 
             j++) {
index f80926b6de7b8a22192c6c6424d85ae42cae7966..1dc26017a24240b72c5979ad99169b0155fd966f 100644 (file)
@@ -839,6 +839,9 @@ SYSCTL_QUAD(_machdep, OID_AUTO, reportphyreadabs,
 SYSCTL_INT(_machdep, OID_AUTO, reportphyreadosbt,
                CTLFLAG_KERN | CTLFLAG_RW | CTLFLAG_LOCKED,
                &reportphyreadosbt, 0, "");
+SYSCTL_INT(_machdep, OID_AUTO, phyreaddelaypanic,
+               CTLFLAG_KERN | CTLFLAG_RW | CTLFLAG_LOCKED,
+               &phyreadpanic, 0, "");
 
 extern int pmap_pagezero_mitigation;
 extern int pmap_asserts_enabled, pmap_asserts_traced;
index f2398a723f13afc261108d65bf93c86246db58ca..9d7d476f991798711fa5d5493826e6f14ce01e56 100644 (file)
@@ -106,9 +106,7 @@ unix_syscall(x86_saved_state_t *state)
        thread = current_thread();
        uthread = get_bsdthread_info(thread);
 
-#if PROC_REF_DEBUG
        uthread_reset_proc_refcount(uthread);
-#endif
 
        /* Get the approriate proc; may be different from task's for vfork() */
        is_vfork = uthread->uu_flag & UT_VFORK;
@@ -285,9 +283,7 @@ unix_syscall64(x86_saved_state_t *state)
        thread = current_thread();
        uthread = get_bsdthread_info(thread);
 
-#if PROC_REF_DEBUG
        uthread_reset_proc_refcount(uthread);
-#endif
 
        /* Get the approriate proc; may be different from task's for vfork() */
        if (__probable(!(uthread->uu_flag & UT_VFORK)))
index 1d2c04c9d5b25d540f1ffc0bd2fe21d961a978a5..232e966eeea95f41dedff1a4d87beef0e43da0c0 100644 (file)
@@ -312,7 +312,6 @@ kern_return_t bsd_autoconf(void);
 void bsd_utaskbootstrap(void);
 
 static void parse_bsd_args(void);
-extern task_t bsd_init_task;
 #if CONFIG_DEV_KMEM
 extern void dev_kmem_init(void);
 #endif
@@ -389,6 +388,7 @@ lck_attr_t * proc_lck_attr;
 lck_mtx_t * proc_list_mlock;
 lck_mtx_t * proc_klist_mlock;
 
+
 extern lck_mtx_t * execargs_cache_lock;
 
 /* hook called after root is mounted XXX temporary hack */
@@ -482,6 +482,7 @@ bsd_init(void)
        proc_ucred_mlock_grp = lck_grp_alloc_init("proc-ucred-mlock",  proc_lck_grp_attr);
        proc_mlock_grp = lck_grp_alloc_init("proc-mlock",  proc_lck_grp_attr);
 #endif
+
        /* Allocate proc lock attribute */
        proc_lck_attr = lck_attr_alloc_init();
 #if 0
@@ -1028,7 +1029,6 @@ bsd_init(void)
        consider_zone_gc();
 #endif
 
-
        bsd_init_kprintf("done\n");
 }
 
@@ -1052,11 +1052,11 @@ bsdinit_task(void)
 
        ut = (uthread_t)get_bsdthread_info(thread);
 
-       bsd_init_task = get_threadtask(thread);
-
 #if CONFIG_MACF
        mac_cred_label_associate_user(p->p_ucred);
 #endif
+
+
        load_init_program(p);
        lock_trace = 1;
 }
diff --git a/bsd/kern/chunklist.h b/bsd/kern/chunklist.h
new file mode 100644 (file)
index 0000000..bae2133
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef _CHUNKLIST_H
+#define _CHUNKLIST_H
+
+
+#include <libkern/crypto/sha2.h>
+
+/*
+ * Chunklist file format
+ */
+
+#define CHUNKLIST_MAGIC               0x4C4B4E43
+#define CHUNKLIST_FILE_VERSION_10     1
+#define CHUNKLIST_CHUNK_METHOD_10     1
+#define CHUNKLIST_SIGNATURE_METHOD_10 1
+#define CHUNKLIST_SIG_LEN             256
+#define CHUNKLIST_PUBKEY_LEN          (2048/8)
+
+struct chunklist_hdr {
+       uint32_t cl_magic;
+       uint32_t cl_header_size;
+       uint8_t  cl_file_ver;
+       uint8_t  cl_chunk_method;
+       uint8_t  cl_sig_method;
+       uint8_t  __unused1;
+       uint64_t cl_chunk_count;
+       uint64_t cl_chunk_offset;
+       uint64_t cl_sig_offset;
+} __attribute__((packed));
+
+struct chunklist_chunk {
+       uint32_t chunk_size;
+       uint8_t  chunk_sha256[SHA256_DIGEST_LENGTH];
+} __attribute__((packed));
+
+struct chunklist_sig {
+       uint8_t  cl_sig[CHUNKLIST_SIG_LEN];
+};
+
+
+/*
+ * Chunklist signing public keys
+ */
+
+struct chunklist_pubkey {
+       const bool isprod;
+       const uint8_t key[CHUNKLIST_PUBKEY_LEN];
+};
+
+const struct chunklist_pubkey chunklist_pubkeys[] = {
+
+};
+
+#define CHUNKLIST_NPUBKEYS (sizeof(chunklist_pubkeys)/sizeof(chunklist_pubkeys[0]))
+
+#endif
index 9fa89e44315a16552add539388182f767683de18..8f492566b87fa4aedcd1698ed7f48db38ff6adc1 100644 (file)
 #include <sys/imageboot.h>
 #include <kern/assert.h>
 
+#include <sys/namei.h>
+#include <sys/fcntl.h>
+#include <sys/vnode.h>
+#include <sys/sysproto.h>
+#include <sys/csr.h>
+#include <libkern/crypto/sha2.h>
+#include <libkern/crypto/rsa.h>
+#include <libkern/OSKextLibPrivate.h>
+
+#include <kern/kalloc.h>
+
 #include <pexpert/pexpert.h>
+#include <kern/chunklist.h>
 
 extern struct filedesc filedesc0;
 
@@ -85,12 +97,13 @@ imageboot_needed(void)
                panic("%s: M_NAMEI zone exhausted", __FUNCTION__);
 
        /* Check for first layer */
-       if (!(PE_parse_boot_argn("rp0", root_path, MAXPATHLEN) || 
+       if (!(PE_parse_boot_argn("rp0", root_path, MAXPATHLEN) ||
                        PE_parse_boot_argn("rp", root_path, MAXPATHLEN) ||
-                       PE_parse_boot_argn(IMAGEBOOT_ROOT_ARG, root_path, MAXPATHLEN))) {
+                       PE_parse_boot_argn(IMAGEBOOT_ROOT_ARG, root_path, MAXPATHLEN) ||
+                       PE_parse_boot_argn(IMAGEBOOT_AUTHROOT_ARG, root_path, MAXPATHLEN))) {
                goto out;
        }
-       
+
        /* Sanity-check first layer */
        if (imageboot_format_is_valid(root_path)) {
                DBG_TRACE("%s: Found %s\n", __FUNCTION__, root_path);
@@ -202,18 +215,635 @@ imageboot_mount_image(const char *root_path, int height)
        return 0;
 }
 
-static boolean_t 
+
+/*
+ * Authenticated root-dmg support
+ */
+
+#define AUTHDBG(fmt, args...) do { printf("%s: " fmt "\n", __func__, ##args); } while (0)
+#define AUTHPRNT(fmt, args...) do { printf("%s: " fmt "\n", __func__, ##args); } while (0)
+
+#define kfree_safe(x) do { if ((x)) { kfree_addr((x)); (x) = NULL; } } while (0)
+
+enum {
+       MISSING_SIG = -1,
+       INVALID_SIG = -2
+};
+
+static void
+key_byteswap(void *_dst, const void *_src, size_t len)
+{
+       uint32_t *dst __attribute__((align_value(1))) = _dst;
+       const uint32_t *src __attribute__((align_value(1))) = _src;
+
+       assert(len % sizeof(uint32_t) == 0);
+
+       len = len / sizeof(uint32_t);
+       for (size_t i = 0; i < len; i++) {
+               dst[len-i-1] = OSSwapInt32(src[i]);
+       }
+}
+
+static int
+read_file(const char *path, void **bufp, size_t *bufszp)
+{
+       int err = 0;
+       struct nameidata ndp = {};
+       struct vnode *vp = NULL;
+       off_t fsize = 0;
+       int resid = 0;
+       char *buf = NULL;
+       bool doclose = false;
+
+       vfs_context_t ctx = vfs_context_kernel();
+       proc_t p = vfs_context_proc(ctx);
+       kauth_cred_t kerncred = vfs_context_ucred(ctx);
+
+       NDINIT(&ndp, LOOKUP, OP_OPEN, LOCKLEAF, UIO_SYSSPACE, path, ctx);
+       if ((err = namei(&ndp)) != 0) {
+               AUTHPRNT("namei failed (%s)", path);
+               goto out;
+       }
+       nameidone(&ndp);
+       vp = ndp.ni_vp;
+
+       if ((err = vnode_size(vp, &fsize, ctx)) != 0) {
+               AUTHPRNT("failed to get vnode size");
+               goto out;
+       }
+       if (fsize < 0) {
+               panic("negative file size");
+       }
+
+       if ((err = VNOP_OPEN(vp, FREAD, ctx)) != 0) {
+               AUTHPRNT("failed to open vnode");
+               goto out;
+       }
+       doclose = true;
+
+       /* if bufsz is non-zero, cap the read at bufsz bytes */
+       if (*bufszp && *bufszp < (size_t)fsize) {
+               fsize = *bufszp;
+       }
+
+       buf = kalloc(fsize);
+       if (buf == NULL) {
+               err = ENOMEM;
+               goto out;
+       }
+
+       if ((err = vn_rdwr(UIO_READ, vp, (caddr_t)buf, fsize, 0, UIO_SYSSPACE, IO_NODELOCKED, kerncred, &resid, p)) != 0) {
+               AUTHPRNT("vn_rdwr() failed");
+               goto out;
+       }
+
+       if (resid) {
+               /* didnt get everything we wanted */
+               AUTHPRNT("vn_rdwr resid = %d", resid);
+               err = EINVAL;
+               goto out;
+       }
+
+out:
+       if (doclose) {
+               VNOP_CLOSE(vp, FREAD, ctx);
+       }
+       if (vp) {
+               vnode_put(vp);
+               vp = NULL;
+       }
+
+       if (err) {
+               kfree_safe(buf);
+       } else {
+               *bufp = buf;
+               *bufszp = fsize;
+       }
+
+       return err;
+}
+
+static int
+validate_signature(const uint8_t *key_msb, size_t keylen, uint8_t *sig_msb, size_t siglen, uint8_t *digest)
+{
+       int err = 0;
+       bool sig_valid = false;
+       uint8_t *sig = NULL;
+
+       const uint8_t exponent[] = { 0x01, 0x00, 0x01 };
+       uint8_t *modulus = kalloc(keylen);
+       rsa_pub_ctx *rsa_ctx = kalloc(sizeof(rsa_pub_ctx));
+       sig = kalloc(siglen);
+
+       if (modulus == NULL || rsa_ctx == NULL || sig == NULL) {
+               err = ENOMEM;
+               goto out;
+       }
+
+       bzero(rsa_ctx, sizeof(rsa_pub_ctx));
+       key_byteswap(modulus, key_msb, keylen);
+       key_byteswap(sig, sig_msb, siglen);
+
+       err = rsa_make_pub(rsa_ctx,
+                       sizeof(exponent), exponent,
+                       CHUNKLIST_PUBKEY_LEN, modulus);
+       if (err) {
+               AUTHPRNT("rsa_make_pub() failed");
+               goto out;
+       }
+
+       err = rsa_verify_pkcs1v15(rsa_ctx, CC_DIGEST_OID_SHA256,
+                       SHA256_DIGEST_LENGTH, digest,
+                       siglen, sig,
+                       &sig_valid);
+       if (err) {
+               sig_valid = false;
+               AUTHPRNT("rsa_verify() failed");
+               err = EINVAL;
+               goto out;
+       }
+
+out:
+       kfree_safe(sig);
+       kfree_safe(rsa_ctx);
+       kfree_safe(modulus);
+
+       if (err) {
+               return err;
+       } else if (sig_valid == true) {
+               return 0; /* success */
+       } else {
+               return INVALID_SIG;
+       }
+}
+
+static int
+validate_chunklist(void *buf, size_t len)
+{
+       int err = 0;
+       size_t sigsz = 0;
+       size_t sig_end = 0;
+       size_t chunks_end = 0;
+       bool valid_sig = false;
+       struct chunklist_hdr *hdr = buf;
+
+       if (len < sizeof(struct chunklist_hdr)) {
+               AUTHPRNT("no space for header");
+               return EINVAL;
+       }
+
+       /* recognized file format? */
+       if (hdr->cl_magic != CHUNKLIST_MAGIC ||
+                       hdr->cl_file_ver != CHUNKLIST_FILE_VERSION_10 ||
+                       hdr->cl_chunk_method != CHUNKLIST_SIGNATURE_METHOD_10 ||
+                       hdr->cl_sig_method != CHUNKLIST_SIGNATURE_METHOD_10) {
+               AUTHPRNT("unrecognized chunklist format");
+               return EINVAL;
+       }
+
+       /* does the chunk list fall within the bounds of the buffer? */
+       if (os_mul_and_add_overflow(hdr->cl_chunk_count, sizeof(struct chunklist_chunk), hdr->cl_chunk_offset, &chunks_end) ||
+                       hdr->cl_chunk_offset < sizeof(struct chunklist_hdr) || chunks_end > len) {
+               AUTHPRNT("invalid chunk_count (%llu) or chunk_offset (%llu)",
+                               hdr->cl_chunk_count, hdr->cl_chunk_offset);
+               return EINVAL;
+       }
+
+       /* does the signature fall within the bounds of the buffer? */
+       if (os_add_overflow(hdr->cl_sig_offset, sizeof(struct chunklist_sig), &sig_end) ||
+                       hdr->cl_sig_offset < sizeof(struct chunklist_hdr) ||
+                       hdr->cl_sig_offset < chunks_end ||
+                       hdr->cl_sig_offset > len) {
+               AUTHPRNT("invalid signature offset (%llu)", hdr->cl_sig_offset);
+               return EINVAL;
+       }
+
+       if (sig_end > len || os_sub_overflow(len, hdr->cl_sig_offset, &sigsz) || sigsz != CHUNKLIST_SIG_LEN) {
+               /* missing or incorrect signature size */
+               return MISSING_SIG;
+       }
+
+       AUTHDBG("hashing chunklist");
+
+       /* hash the chunklist (excluding the signature) */
+       uint8_t sha_digest[SHA256_DIGEST_LENGTH];
+       SHA256_CTX sha_ctx;
+       SHA256_Init(&sha_ctx);
+       SHA256_Update(&sha_ctx, buf, hdr->cl_sig_offset);
+       SHA256_Final(sha_digest, &sha_ctx);
+
+       AUTHDBG("validating chunklist signature against pub keys");
+       for (size_t i = 0; i < CHUNKLIST_NPUBKEYS; i++) {
+               const struct chunklist_pubkey *key = &chunklist_pubkeys[i];
+               err = validate_signature(key->key, CHUNKLIST_PUBKEY_LEN,
+                               buf + hdr->cl_sig_offset, sigsz, sha_digest);
+               if (err == 0) {
+                       AUTHDBG("validated chunklist signature with key %lu (prod=%d)", i, key->isprod);
+                       valid_sig = key->isprod;
+#if IMAGEBOOT_ALLOW_DEVKEYS
+                       if (!key->isprod) {
+                               /* allow dev keys in dev builds only */
+                               AUTHDBG("*** allowing DEV key: this will fail in customer builds ***");
+                               valid_sig = true;
+                       }
+#endif
+                       goto out;
+               } else if (err == INVALID_SIG) {
+                       /* try the next key */
+               } else {
+                       goto out; /* something bad happened */
+               }
+       }
+
+       /* At this point we tried all the keys: nothing went wrong but none of them
+        * signed our chunklist. */
+       AUTHPRNT("signature did not verify against any known public key");
+
+out:
+       if (err) {
+               return err;
+       } else if (valid_sig == true) {
+               return 0; /* signed, and everything checked out */
+       } else {
+               return EINVAL;
+       }
+}
+
+static int
+validate_root_image(const char *root_path, void *chunklist)
+{
+       int err = 0;
+       struct chunklist_hdr *hdr = chunklist;
+       struct chunklist_chunk *chk = NULL;
+       size_t ch = 0;
+       struct nameidata ndp = {};
+       struct vnode *vp = NULL;
+       off_t fsize = 0;
+       off_t offset = 0;
+       bool doclose = false;
+       size_t bufsz = 0;
+       void *buf = NULL;
+
+       vfs_context_t ctx = vfs_context_kernel();
+       kauth_cred_t kerncred = vfs_context_ucred(ctx);
+       proc_t p = vfs_context_proc(ctx);
+
+       AUTHDBG("validating root dmg %s", root_path);
+
+       /*
+        * Open the DMG
+        */
+       NDINIT(&ndp, LOOKUP, OP_OPEN, LOCKLEAF, UIO_SYSSPACE, root_path, ctx);
+       if ((err = namei(&ndp)) != 0) {
+               AUTHPRNT("namei failed (%s)", root_path);
+               goto out;
+       }
+       nameidone(&ndp);
+       vp = ndp.ni_vp;
+
+       if (vp->v_type != VREG) {
+               err = EINVAL;
+               goto out;
+       }
+
+       if ((err = vnode_size(vp, &fsize, ctx)) != 0) {
+               AUTHPRNT("failed to get vnode size");
+               goto out;
+       }
+
+       if ((err = VNOP_OPEN(vp, FREAD, ctx)) != 0) {
+               AUTHPRNT("failed to open vnode");
+               goto out;
+       }
+       doclose = true;
+
+       /*
+        * Iterate the chunk list and check each chunk
+        */
+       chk = chunklist + hdr->cl_chunk_offset;
+       for (ch = 0; ch < hdr->cl_chunk_count; ch++) {
+               int resid = 0;
+
+               if (!buf) {
+                       /* allocate buffer based on first chunk size */
+                       buf = kalloc(chk->chunk_size);
+                       if (buf == NULL) {
+                               err = ENOMEM;
+                               goto out;
+                       }
+                       bufsz = chk->chunk_size;
+               }
+
+               if (chk->chunk_size > bufsz) {
+                       AUTHPRNT("chunk size too big");
+                       err = EINVAL;
+                       goto out;
+               }
+
+               err = vn_rdwr(UIO_READ, vp, (caddr_t)buf, chk->chunk_size, offset, UIO_SYSSPACE, IO_NODELOCKED, kerncred, &resid, p);
+               if (err) {
+                       AUTHPRNT("vn_rdrw fail (err = %d, resid = %d)", err, resid);
+                       goto out;
+               }
+               if (resid) {
+                       err = EINVAL;
+                       AUTHPRNT("chunk covered non-existant part of image");
+                       goto out;
+               }
+
+               /* calculate the SHA256 of this chunk */
+               uint8_t sha_digest[SHA256_DIGEST_LENGTH];
+               SHA256_CTX sha_ctx;
+               SHA256_Init(&sha_ctx);
+               SHA256_Update(&sha_ctx, buf, chk->chunk_size);
+               SHA256_Final(sha_digest, &sha_ctx);
+
+               /* Check the calculated SHA matches the chunk list */
+               if (bcmp(sha_digest, chk->chunk_sha256, SHA256_DIGEST_LENGTH) != 0) {
+                       AUTHPRNT("SHA mismatch on chunk %lu (offset %lld, size %u)", ch, offset, chk->chunk_size);
+                       err = EINVAL;
+                       goto out;
+               }
+
+               if (os_add_overflow(offset, chk->chunk_size, &offset)) {
+                       err = EINVAL;
+                       goto out;
+               }
+               chk++;
+       }
+
+       if (offset != fsize) {
+               AUTHPRNT("chunklist did not cover entire file (offset = %lld, fsize = %lld)", offset, fsize);
+               err = EINVAL;
+               goto out;
+       }
+
+out:
+       kfree_safe(buf);
+       if (doclose) {
+               VNOP_CLOSE(vp, FREAD, ctx);
+       }
+       if (vp) {
+               vnode_put(vp);
+               vp = NULL;
+       }
+
+       return err;
+}
+
+static int
+construct_chunklist_path(const char *root_path, char **bufp)
+{
+       int err = 0;
+       char *path = NULL;
+       size_t len = 0;
+
+       path = kalloc(MAXPATHLEN);
+       if (path == NULL) {
+               AUTHPRNT("failed to allocate space for chunklist path");
+               err = ENOMEM;
+               goto out;
+       }
+
+       len = strnlen(root_path, MAXPATHLEN);
+       if (len < MAXPATHLEN && len > strlen(".dmg")) {
+               /* correctly terminated string with space for extension */
+       } else {
+               AUTHPRNT("malformed root path");
+               err = EINVAL;
+               goto out;
+       }
+
+       len = strlcpy(path, root_path, MAXPATHLEN);
+       if (len >= MAXPATHLEN) {
+               AUTHPRNT("root path is too long");
+               err = EINVAL;
+               goto out;
+       }
+
+       path[len - strlen(".dmg")] = '\0';
+       len = strlcat(path, ".chunklist", MAXPATHLEN);
+       if (len >= MAXPATHLEN) {
+               AUTHPRNT("chunklist path is too long");
+               err = EINVAL;
+               goto out;
+       }
+
+out:
+       if (err) {
+               kfree_safe(path);
+       } else {
+               *bufp = path;
+       }
+       return err;
+}
+
+static int
+authenticate_root(const char *root_path)
+{
+       char *chunklist_path = NULL;
+       void *chunklist_buf = NULL;
+       size_t chunklist_len = 32*1024*1024UL;
+       int err = 0;
+
+       err = construct_chunklist_path(root_path, &chunklist_path);
+       if (err) {
+               AUTHPRNT("failed creating chunklist path");
+               goto out;
+       }
+
+       AUTHDBG("validating root against chunklist %s", chunklist_path);
+
+       /*
+        * Read and authenticate the chunklist, then validate the root image against
+        * the chunklist.
+        */
+
+       AUTHDBG("reading chunklist");
+       err = read_file(chunklist_path, &chunklist_buf, &chunklist_len);
+       if (err) {
+               AUTHPRNT("failed to read chunklist");
+               goto out;
+       }
+
+       AUTHDBG("validating chunklist");
+       err = validate_chunklist(chunklist_buf, chunklist_len);
+       if (err < 0) {
+               AUTHDBG("missing or incorrect signature on chunklist");
+               goto out;
+       } else if (err) {
+               AUTHPRNT("failed to validate chunklist");
+               goto out;
+       } else {
+               AUTHDBG("successfully validated chunklist");
+       }
+
+       AUTHDBG("validating root image against chunklist");
+       err = validate_root_image(root_path, chunklist_buf);
+       if (err) {
+               AUTHPRNT("failed to validate root image against chunklist (%d)", err);
+               goto out;
+       }
+
+       /* everything checked out - go ahead and mount this */
+       AUTHDBG("root image authenticated");
+
+ out:
+       kfree_safe(chunklist_buf);
+       kfree_safe(chunklist_path);
+       return err;
+}
+
+static const uuid_t *
+getuuidfromheader_safe(const void *buf, size_t bufsz, size_t *uuidsz)
+{
+       const struct uuid_command *cmd = NULL;
+       const kernel_mach_header_t *mh = buf;
+
+       /* space for the header and at least one load command? */
+       if (bufsz < sizeof(kernel_mach_header_t) + sizeof(struct uuid_command)) {
+               AUTHPRNT("libkern image too small");
+               return NULL;
+       }
+
+       /* validate the mach header */
+       if (mh->magic != MH_MAGIC_64 || (mh->sizeofcmds > bufsz - sizeof(kernel_mach_header_t))) {
+               AUTHPRNT("invalid MachO header");
+               return NULL;
+       }
+
+       /* iterate the load commands */
+       size_t offset = sizeof(kernel_mach_header_t);
+       for (size_t i = 0; i < mh->ncmds; i++) {
+               cmd = buf + offset;
+
+               if (cmd->cmd == LC_UUID) {
+                       *uuidsz = sizeof(cmd->uuid);
+                       return &cmd->uuid;
+               }
+
+               if (os_add_overflow(cmd->cmdsize, offset, &offset) ||
+                               offset > bufsz - sizeof(struct uuid_command)) {
+                       return NULL;
+               }
+       }
+
+       return NULL;
+}
+
+static const char *libkern_path = "/System/Library/Extensions/System.kext/PlugIns/Libkern.kext/Libkern";
+static const char *libkern_bundle = "com.apple.kpi.libkern";
+
+/*
+ * Check that the UUID of the libkern currently loaded matches the one on disk.
+ */
+static int
+auth_version_check(void)
+{
+       int err = 0;
+       void *buf = NULL;
+       size_t bufsz = 4*1024*1024UL;
+
+       /* get the UUID of the libkern in /S/L/E */
+
+       err = read_file(libkern_path, &buf, &bufsz);
+       if (err) {
+               goto out;
+       }
+
+       unsigned long uuidsz = 0;
+       const uuid_t *img_uuid = getuuidfromheader_safe(buf, bufsz, &uuidsz);
+       if (img_uuid == NULL || uuidsz != sizeof(uuid_t)) {
+               AUTHPRNT("invalid UUID (sz = %lu)", uuidsz);
+               err = EINVAL;
+               goto out;
+       }
+
+       /* Get the UUID of the loaded libkern */
+       uuid_t live_uuid;
+       err = OSKextGetUUIDForName(libkern_bundle, live_uuid);
+       if (err) {
+               AUTHPRNT("could not find loaded libkern");
+               goto out;
+       }
+
+       /* ... and compare them */
+       if (bcmp(live_uuid, img_uuid, uuidsz) != 0) {
+               AUTHPRNT("UUID of running libkern does not match %s", libkern_path);
+
+               uuid_string_t img_uuid_str, live_uuid_str;
+               uuid_unparse(*img_uuid, img_uuid_str);
+               uuid_unparse(live_uuid, live_uuid_str);
+               AUTHPRNT("loaded libkern UUID =  %s", live_uuid_str);
+               AUTHPRNT("on-disk libkern UUID = %s", img_uuid_str);
+
+               err = EINVAL;
+               goto out;
+       }
+
+       /* UUID matches! */
+
+out:
+       kfree_safe(buf);
+       return err;
+}
+
+#if 0
+int
+auth_imgboot_test(proc_t __unused ap, struct auth_imgboot_test_args *uap, int32_t *retval)
+{
+       int ret = 0;
+       int err;
+       char path[MAXPATHLEN];
+       vm_size_t len;
+       *retval = 0;
+
+       err = copyinstr(uap->path, path, MAXPATHLEN, &len);
+       if (err) {
+               return err;
+       }
+       if (len >= MAXPATHLEN) {
+               return ENAMETOOLONG;
+       }
+
+       AUTHDBG("authenticating root image at %s", path);
+       err = authenticate_root(path);
+       if (err) {
+               AUTHPRNT("root authentication FAIL (%d)", err);
+               ret = err;
+       } else {
+               AUTHDBG("successfully authenticated %s", path);
+       }
+
+       AUTHDBG("checking root image version");
+       err = auth_version_check();
+       if (err) {
+               AUTHPRNT("root image version check FAIL (%d)", err);
+               err = err ?: ret;
+       } else {
+               AUTHPRNT("root version check success (%d)", err);
+       }
+
+       if (ret < 0) {
+               return EINVAL; /* negative return values have special meaning */
+       }
+       return ret;
+}
+#endif
+
+static boolean_t
 imageboot_setup_new()
 {
        int error;
        char *root_path = NULL;
        int height = 0;
        boolean_t done = FALSE;
+       boolean_t auth_root = FALSE;
 
        MALLOC_ZONE(root_path, caddr_t, MAXPATHLEN, M_NAMEI, M_WAITOK);
        assert(root_path != NULL);
 
-       if(PE_parse_boot_argn(IMAGEBOOT_CONTAINER_ARG, root_path, MAXPATHLEN) == TRUE) {
+       if (PE_parse_boot_argn(IMAGEBOOT_CONTAINER_ARG, root_path, MAXPATHLEN) == TRUE) {
                printf("%s: container image url is %s\n", __FUNCTION__, root_path);
                error = imageboot_mount_image(root_path, height);
                if (error != 0) {
@@ -223,21 +853,56 @@ imageboot_setup_new()
                height++;
        }
 
-       if (PE_parse_boot_argn(IMAGEBOOT_ROOT_ARG, root_path, MAXPATHLEN) == FALSE) {
+       if (PE_parse_boot_argn(IMAGEBOOT_AUTHROOT_ARG, root_path, MAXPATHLEN) == TRUE) {
+               auth_root = TRUE;
+       } else if (PE_parse_boot_argn(IMAGEBOOT_ROOT_ARG, root_path, MAXPATHLEN) == FALSE) {
                if (height > 0) {
                        panic("%s specified without %s?\n", IMAGEBOOT_CONTAINER_ARG, IMAGEBOOT_ROOT_ARG);
                }
                goto out;
+       }
 
+       printf("%s: root image url is %s\n", __func__, root_path);
+
+#if CONFIG_CSR
+       if (auth_root && (csr_check(CSR_ALLOW_ANY_RECOVERY_OS) == 0)) {
+               AUTHPRNT("CSR_ALLOW_ANY_RECOVERY_OS set, skipping root image authentication");
+               auth_root = false;
        }
+#endif
 
-       printf("%s: root image url is %s\n", __FUNCTION__, root_path);
+       if (auth_root) {
+               const char *path = root_path;
+               size_t len = strlen(kIBFilePrefix);
+               if (strncmp(kIBFilePrefix, path, len) == 0) {
+                       /* remove the file:// prefix */
+                       path += len;
+               }
+
+               AUTHDBG("authenticating root image at %s", path);
+               error = authenticate_root(path);
+               if (error) {
+                       panic("root image authentication failed (err = %d)\n", error);
+               }
+               AUTHDBG("successfully authenticated %s", path);
+       }
 
        error = imageboot_mount_image(root_path, height);
        if (error != 0) {
                panic("Failed to mount root image.");
        }
 
+       if (auth_root) {
+               /* check that the image version matches the running kernel */
+               AUTHDBG("checking root image version");
+               error = auth_version_check();
+               if (error) {
+                       panic("root image version check failed");
+               } else {
+                       AUTHDBG("root image version matches kernel");
+               }
+       }
+
        done = TRUE;
 
 out:
@@ -253,19 +918,20 @@ imageboot_setup()
 
        DBG_TRACE("%s: entry\n", __FUNCTION__);
 
-       if (rootvnode == NULL) {        
+       if (rootvnode == NULL) {
                panic("imageboot_setup: rootvnode is NULL.");
        }
 
        /*
         * New boot-arg scheme:
         *      root-dmg : the dmg that will be the root filesystem.
+        *      auth-root-dmg : same as root-dmg but with image authentication.
         *      container-dmg : an optional dmg that contains the root-dmg.
         */
        if (imageboot_setup_new()) {
                return;
        }
-       
+
        MALLOC_ZONE(root_path, caddr_t, MAXPATHLEN, M_NAMEI, M_WAITOK);
        assert(root_path != NULL);
 
index 6d7fc0902c1c92f3d35e81740ddb6ce252535593..d1a1b023b705f57511406aef83ba26c41b56cef0 100644 (file)
@@ -3171,8 +3171,7 @@ kdbg_control(int *name, u_int namelen, user_addr_t where, size_t *sizep)
        kbufinfo_t kd_bufinfo;
        proc_t p;
 
-       if (name[0] == KERN_KDGETENTROPY ||
-               name[0] == KERN_KDWRITETR ||
+       if (name[0] == KERN_KDWRITETR ||
                name[0] == KERN_KDWRITETR_V3 ||
                name[0] == KERN_KDWRITEMAP ||
                name[0] == KERN_KDWRITEMAP_V3 ||
@@ -3199,8 +3198,7 @@ kdbg_control(int *name, u_int namelen, user_addr_t where, size_t *sizep)
         */
        if (name[0] != KERN_KDGETBUF &&
            name[0] != KERN_KDGETREG &&
-           name[0] != KERN_KDREADCURTHRMAP &&
-           name[0] != KERN_KDGETENTROPY)
+           name[0] != KERN_KDREADCURTHRMAP)
        {
                if ((ret = ktrace_configure(KTRACE_KDEBUG))) {
                        goto out;
@@ -3257,15 +3255,6 @@ kdbg_control(int *name, u_int namelen, user_addr_t where, size_t *sizep)
                        }
                        break;
 
-               case KERN_KDGETENTROPY: {
-                       /* Obsolescent - just fake with a random buffer */
-                       char    *buffer = (char *) kalloc(size);
-                       read_frandom((void *) buffer, size);
-                       ret = copyout(buffer, where, size);
-                       kfree(buffer, size);
-                       break;
-               }
-
                case KERN_KDREADCURTHRMAP:
                        ret = kdbg_readcurthrmap(where, sizep);
                        break;
@@ -3711,7 +3700,7 @@ nextevent:
                                        RAW_file_offset += write_size;
        
                                if (RAW_file_written >= RAW_FLUSH_SIZE) {
-                                       cluster_push(vp, 0);
+                                       error = VNOP_FSYNC(vp, MNT_NOWAIT, ctx);
 
                                        RAW_file_written = 0;
                                }
index 1805b76e77d161137236f58a82f988e35b1ed8ad..bc5e03661989070ea88595c8bae843296948582e 100644 (file)
@@ -63,26 +63,23 @@ int
 csr_check(csr_config_t mask)
 {
        boot_args *args = (boot_args *)PE_state.bootArgs;
-       if ((mask & CSR_ALLOW_DEVICE_CONFIGURATION) && !(args->flags & kBootArgsFlagCSRConfigMode))
-               return EPERM;
-
-       if (csr_allow_all) {
-               return 0;
-       }
+       if (mask & CSR_ALLOW_DEVICE_CONFIGURATION)
+               return (args->flags & kBootArgsFlagCSRConfigMode) ? 0 : EPERM;
 
        csr_config_t config;
-       int error = csr_get_active_config(&config);
-       if (error) {
-               return error;
+       int ret = csr_get_active_config(&config);
+       if (ret) {
+               return ret;
        }
 
-       if (mask == 0) {
-               /* pass 0 to check if Rootless enforcement is active */
-               return -1;
+       ret = (config & mask) ? 0 : EPERM;
+       if (ret == EPERM) {
+               // Override the return value if booted from the BaseSystem and the mask does not contain any flag that should always be enforced.
+               if (csr_allow_all && (mask & CSR_ALWAYS_ENFORCED_FLAGS) == 0)
+                       ret = 0;
        }
 
-       error = (config & mask) ? 0 : EPERM;
-       return error;
+       return ret;
 }
 
 /*
index 7102392b5f1f84156b63c3b46ab0207547852536..8630c7cd4eb653aaeaccbc7f4ba09ab064b83803 100644 (file)
@@ -1282,8 +1282,79 @@ fcntl_nocancel(proc_t p, struct fcntl_nocancel_args *uap, int32_t *retval)
                                error = error2;
                }
                goto outdrop;
+       }
+       case F_PUNCHHOLE: {
+               fpunchhole_t args;
+
+               if (fp->f_type != DTYPE_VNODE) {
+                       error = EBADF;
+                       goto out;
+               }
+
+               vp = (struct vnode *)fp->f_data;
+               proc_fdunlock(p);
+
+               /* need write permissions */
+               if ((fp->f_flag & FWRITE) == 0) {
+                       error = EPERM;
+                       goto outdrop;
+               }
+
+               if ((error = copyin(argp, (caddr_t)&args, sizeof(args)))) {
+                       goto outdrop;
+               }
 
+               if ((error = vnode_getwithref(vp))) {
+                       goto outdrop;
+               }
+
+#if CONFIG_MACF
+               if ((error = mac_vnode_check_write(&context, fp->f_fglob->fg_cred, vp))) {
+                       (void)vnode_put(vp);
+                       goto outdrop;
                }
+#endif
+
+               error = VNOP_IOCTL(vp, F_PUNCHHOLE, (caddr_t)&args, 0, &context);
+               (void)vnode_put(vp);
+
+               goto outdrop;
+       }
+       case F_TRIM_ACTIVE_FILE: {
+               ftrimactivefile_t args;
+
+               if (priv_check_cred(kauth_cred_get(), PRIV_TRIM_ACTIVE_FILE, 0)) {
+                       error = EACCES;
+                       goto out;
+               }
+
+               if (fp->f_type != DTYPE_VNODE) {
+                       error = EBADF;
+                       goto out;
+               }
+
+               vp = (struct vnode *)fp->f_data;
+               proc_fdunlock(p);
+
+               /* need write permissions */
+               if ((fp->f_flag & FWRITE) == 0) {
+                       error = EPERM;
+                       goto outdrop;
+               }
+
+               if ((error = copyin(argp, (caddr_t)&args, sizeof(args)))) {
+                       goto outdrop;
+               }
+
+               if ((error = vnode_getwithref(vp))) {
+                       goto outdrop;
+               }
+
+               error = VNOP_IOCTL(vp, F_TRIM_ACTIVE_FILE, (caddr_t)&args, 0, &context);
+               (void)vnode_put(vp);
+
+               goto outdrop;
+       }
        case F_SETSIZE:
                if (fp->f_type != DTYPE_VNODE) {
                        error = EBADF;
@@ -1452,7 +1523,7 @@ fcntl_nocancel(proc_t p, struct fcntl_nocancel_args *uap, int32_t *retval)
                 proc_fdunlock(p);
 
                 if ( (error = vnode_getwithref(vp)) == 0 ) {
-                        error = cluster_push(vp, 0);
+                        error = VNOP_FSYNC(vp, MNT_NOWAIT, &context);
 
                         (void)vnode_put(vp);
                 }
index eb042349b23c941e546d1656d0157afdb78bb869..604da6996af5dd930a7dfe522eb13ca539fbbb42 100644 (file)
@@ -1634,6 +1634,11 @@ exec_handle_port_actions(struct image_params *imgp, boolean_t * portwatch_presen
 #if CONFIG_AUDIT
                case PSPA_AU_SESSION:
                        ret = audit_session_spawnjoin(p, task, port);
+                       if (ret) {
+                               /* audit_session_spawnjoin() has already dropped the reference in case of error. */
+                               goto done;
+                       }
+
                        break;
 #endif
                case PSPA_IMP_WATCHPORTS:
@@ -2914,11 +2919,20 @@ bad:
                inherit = ipc_importance_exec_switch_task(current_task(), get_threadtask(imgp->ip_new_thread));
        }
 
-       /* Apply the main thread qos */
        if (error == 0) {
+               /* Apply the main thread qos */         
                thread_t main_thread = imgp->ip_new_thread;
-
                task_set_main_thread_qos(get_threadtask(imgp->ip_new_thread), main_thread);
+
+#if CONFIG_MACF
+               /*
+                * Processes with the MAP_JIT entitlement are permitted to have
+                * a jumbo-size map.
+                */
+               if (mac_proc_check_map_anon(p, 0, 0, 0, MAP_JIT, NULL) == 0) {
+                       vm_map_set_jumbo(get_task_map(p->task));
+               }
+#endif /* CONFIG_MACF */
        }
 
        /*
@@ -3337,6 +3351,15 @@ __mac_execve(proc_t p, struct __mac_execve_args *uap, int32_t *retval)
        imgp->ip_mac_return = 0;
        imgp->ip_cs_error = OS_REASON_NULL;
 
+#if CONFIG_MACF
+       if (uap->mac_p != USER_ADDR_NULL) {
+               error = mac_execve_enter(uap->mac_p, imgp);
+               if (error) {
+                       kauth_cred_unref(&context.vc_ucred);
+                       goto exit_with_error;
+               }
+       }
+#endif
        uthread = get_bsdthread_info(current_thread());
        if (uthread->uu_flag & UT_VFORK) {
                imgp->ip_flags |= IMGPF_VFORK_EXEC;
@@ -3381,16 +3404,6 @@ __mac_execve(proc_t p, struct __mac_execve_args *uap, int32_t *retval)
                context.vc_thread = imgp->ip_new_thread;
        }
 
-#if CONFIG_MACF
-       if (uap->mac_p != USER_ADDR_NULL) {
-               error = mac_execve_enter(uap->mac_p, imgp);
-               if (error) {
-                       kauth_cred_unref(&context.vc_ucred);
-                       goto exit_with_error;
-               }
-       }
-#endif
-
        error = exec_activate_image(imgp);
        /* thread and task ref returned for vfexec case */
 
@@ -3464,6 +3477,16 @@ __mac_execve(proc_t p, struct __mac_execve_args *uap, int32_t *retval)
 
                task_set_main_thread_qos(new_task, main_thread);
 
+#if CONFIG_MACF
+               /*
+                * Processes with the MAP_JIT entitlement are permitted to have
+                * a jumbo-size map.
+                */
+               if (mac_proc_check_map_anon(p, 0, 0, 0, MAP_JIT, NULL) == 0) {
+                       vm_map_set_jumbo(get_task_map(new_task));
+               }
+#endif /* CONFIG_MACF */
+
                DTRACE_PROC(exec__success);
 
 #if CONFIG_DTRACE
index a03d9b87a7f01b87156d87541384fac2cf221aaa..4442c7ff49754cf161da65a2ab77806db92eb9af 100644 (file)
@@ -642,7 +642,8 @@ exit_with_reason(proc_t p, int rv, int *retval, boolean_t thread_can_terminate,
         */
 
         ut = get_bsdthread_info(self);
-        if (ut->uu_flag & UT_VFORK) {
+        if ((p == current_proc()) &&
+            (ut->uu_flag & UT_VFORK)) {
                os_reason_free(exit_reason);
                if (!thread_can_terminate) {
                        return EINVAL;
@@ -667,6 +668,10 @@ exit_with_reason(proc_t p, int rv, int *retval, boolean_t thread_can_terminate,
         * what the return value is.
         */
        AUDIT_ARG(exit, WEXITSTATUS(rv), 0);
+       /*
+        * TODO: what to audit here when jetsam calls exit and the uthread,
+        * 'ut' does not belong to the proc, 'p'.
+        */
        AUDIT_SYSCALL_EXIT(SYS_exit, p, ut, 0); /* Exit is always successfull */
 
        DTRACE_PROC1(exit, int, CLD_EXITED);
index c0689a3168afd1cf6eb1250ac80fae24513f5a85..a42891ae77b5b25ebc2ba5c73c674cab69770300 100644 (file)
@@ -780,12 +780,6 @@ fork_create_child(task_t parent_task, coalition_t *parent_coalitions, proc_t chi
        if (timerisset(&child_proc->p_rlim_cpu))
                task_vtimer_set(child_task, TASK_VTIMER_RLIM);
 
-       /* Set/clear 64 bit vm_map flag */
-       if (is64bit)
-               vm_map_set_64bit(get_task_map(child_task));
-       else
-               vm_map_set_32bit(get_task_map(child_task));
-
        /*
         * Set child process BSD visible scheduler priority if nice value
         * inherited from parent
index 4b6546ea9dd180fb9b0801f0b64a77214052a6da..9295b5de427188c17b694faf7ec97a0dd1bdf445 100644 (file)
@@ -364,8 +364,8 @@ void
 ktrace_set_invalid_owning_pid(void)
 {
        if (ktrace_keep_ownership_on_reset) {
-               ktrace_reset(ktrace_active_mask);
                ktrace_keep_ownership_on_reset = FALSE;
+               ktrace_reset(ktrace_active_mask);
        }
 }
 
index 0a3165cf21ccf253edcf9fec71fcc38d723cb651..f0bfa129f543586ff494903e9b4957d60c2cc024 100644 (file)
@@ -149,6 +149,7 @@ static void  lf_hold_assertion(task_t, struct lockf *);
 static void     lf_jump_to_queue_head(struct lockf *, struct lockf *);
 static void     lf_drop_assertion(struct lockf *);
 static void     lf_boost_blocking_proc(struct lockf *, struct lockf *);
+static void     lf_adjust_assertion(struct lockf *block);
 #endif /* IMPORTANCE_INHERITANCE */
 
 /*
@@ -665,6 +666,12 @@ lf_setlock(struct lockf *lock, struct timespec *timeout)
                         * in the spurious case, which would create a cycle)
                         */
                        TAILQ_REMOVE(&lock->lf_next->lf_blkhd, lock, lf_block);
+#if IMPORTANCE_INHERITANCE
+                       /*
+                        * Adjust the boost on lf_next.
+                        */
+                       lf_adjust_assertion(lock->lf_next);
+#endif /* IMPORTANCE_INHERITANCE */
                        lock->lf_next = NULL;
 
                        if (error == 0) {
@@ -1483,6 +1490,50 @@ lf_drop_assertion(struct lockf *block)
        block->lf_boosted = LF_NOT_BOOSTED;
 }
 
+/*
+ * lf_adjust_assertion
+ *
+ * Adjusts importance assertion of file lock. Goes through
+ * all the blocking locks and checks if the file lock needs
+ * to be boosted anymore.
+ *
+ * Parameters: block   lockf structure which needs to be adjusted.
+ *
+ * Returns:    <void>
+ */
+static void
+lf_adjust_assertion(struct lockf *block)
+{
+       boolean_t drop_boost = TRUE;
+       struct lockf *next;
+
+       /* Return if the lock is not boosted */
+       if (block->lf_boosted == LF_NOT_BOOSTED) {
+               return;
+       }
+
+       TAILQ_FOREACH(next, &block->lf_blkhd, lf_block) {
+               /* Check if block and next are same type of locks */
+               if (((block->lf_flags & next->lf_flags & F_POSIX) != 0) ||
+                   ((block->lf_flags & next->lf_flags & F_OFD_LOCK) &&
+                    (block->lf_owner != next->lf_owner) &&
+                    (NULL != block->lf_owner && NULL != next->lf_owner))) {
+
+                       /* Check if next would be boosting block */
+                       if (task_is_importance_donor(proc_task(next->lf_owner)) &&
+                           task_is_importance_receiver_type(proc_task(block->lf_owner))) {
+                               /* Found a lock boosting block */
+                               drop_boost = FALSE;
+                               break;
+                       }
+               }
+       }
+
+       if (drop_boost) {
+               lf_drop_assertion(block);
+       }
+}
+
 static void
 lf_boost_blocking_proc(struct lockf *lock, struct lockf *block)
 {
index bf2771a12210a79a2055a6f694b883fcbdf61ab5..b75284fbd792e99c2e91ab5dbf648392104b29d3 100644 (file)
@@ -589,13 +589,17 @@ __MALLOC(
                        /*
                         * We get here when the caller told us to block waiting for memory, but
                         * kalloc said there's no memory left to get.  Generally, this means there's a 
-                        * leak or the caller asked for an impossibly large amount of memory.  Since there's
-                        * nothing left to wait for and the caller isn't expecting a NULL return code, we
-                        * just panic.  This is less than ideal, but returning NULL doesn't help since the
-                        * majority of callers don't check the return value and will just dereference the pointer and
-                        * trap anyway.  We may as well get a more descriptive message out while we can.
+                        * leak or the caller asked for an impossibly large amount of memory. If the caller
+                        * is expecting a NULL return code then it should explicitly set the flag M_NULL. 
+                        * If the caller isn't expecting a NULL return code, we just panic. This is less 
+                        * than ideal, but returning NULL when the caller isn't expecting it doesn't help 
+                        * since the majority of callers don't check the return value and will just 
+                        * dereference the pointer and trap anyway.  We may as well get a more 
+                        * descriptive message out while we can.
                         */
-
+                       if (flags & M_NULL) {
+                               return NULL;
+                       }
                        panic("_MALLOC: kalloc returned NULL (potential leak), size %llu", (uint64_t) size);
                }
        }
@@ -643,8 +647,15 @@ __REALLOC(
         * would land. If it matches the bucket of the original allocation, 
         * simply return the address.
         */
-       if (kalloc_bucket_size(size) == alloc)
+       if (kalloc_bucket_size(size) == alloc) {
+               if (flags & M_ZERO) { 
+                       if (alloc < size)
+                               bzero((uintptr_t)addr + alloc, (size - alloc));
+                       else
+                               bzero((uintptr_t)addr + size, (alloc - size));
+               }
                return addr;
+       }
 
        /* Allocate a new, bigger (or smaller) block */
        if ((newaddr = __MALLOC(size, type, flags, site)) == NULL)
index 0745a00394eb09c2907dfa84dae6d380533e8167..0817ac1fa14b7c3e8c03d253e6694c77f2113173 100644 (file)
@@ -127,7 +127,6 @@ do {                                              \
 #define SET_ACTIVE_LIMITS_LOCKED(p, limit, is_fatal)                   \
 MACRO_BEGIN                                                            \
 (p)->p_memstat_memlimit_active = (limit);                              \
-   (p)->p_memstat_state &= ~P_MEMSTAT_MEMLIMIT_ACTIVE_EXC_TRIGGERED;   \
    if (is_fatal) {                                                     \
           (p)->p_memstat_state |= P_MEMSTAT_MEMLIMIT_ACTIVE_FATAL;     \
    } else {                                                            \
@@ -138,7 +137,6 @@ MACRO_END
 #define SET_INACTIVE_LIMITS_LOCKED(p, limit, is_fatal)                 \
 MACRO_BEGIN                                                            \
 (p)->p_memstat_memlimit_inactive = (limit);                            \
-   (p)->p_memstat_state &= ~P_MEMSTAT_MEMLIMIT_INACTIVE_EXC_TRIGGERED; \
    if (is_fatal) {                                                     \
           (p)->p_memstat_state |= P_MEMSTAT_MEMLIMIT_INACTIVE_FATAL;   \
    } else {                                                            \
@@ -146,33 +144,27 @@ MACRO_BEGIN                                                               \
    }                                                                   \
 MACRO_END
 
-#define CACHE_ACTIVE_LIMITS_LOCKED(p, trigger_exception)               \
+#define CACHE_ACTIVE_LIMITS_LOCKED(p, is_fatal)                                \
 MACRO_BEGIN                                                            \
 (p)->p_memstat_memlimit = (p)->p_memstat_memlimit_active;              \
    if ((p)->p_memstat_state & P_MEMSTAT_MEMLIMIT_ACTIVE_FATAL) {       \
           (p)->p_memstat_state |= P_MEMSTAT_FATAL_MEMLIMIT;            \
+          is_fatal = TRUE;                                             \
    } else {                                                            \
           (p)->p_memstat_state &= ~P_MEMSTAT_FATAL_MEMLIMIT;           \
-   }                                                                   \
-   if ((p)->p_memstat_state & P_MEMSTAT_MEMLIMIT_ACTIVE_EXC_TRIGGERED) { \
-          trigger_exception = FALSE;                                   \
-   } else {                                                            \
-          trigger_exception = TRUE;                                    \
+          is_fatal = FALSE;                                            \
    }                                                                   \
 MACRO_END
 
-#define CACHE_INACTIVE_LIMITS_LOCKED(p, trigger_exception)             \
+#define CACHE_INACTIVE_LIMITS_LOCKED(p, is_fatal)                      \
 MACRO_BEGIN                                                            \
 (p)->p_memstat_memlimit = (p)->p_memstat_memlimit_inactive;            \
    if ((p)->p_memstat_state & P_MEMSTAT_MEMLIMIT_INACTIVE_FATAL) {     \
           (p)->p_memstat_state |= P_MEMSTAT_FATAL_MEMLIMIT;            \
+          is_fatal = TRUE;                                             \
    } else {                                                            \
           (p)->p_memstat_state &= ~P_MEMSTAT_FATAL_MEMLIMIT;           \
-   }                                                                   \
-   if ((p)->p_memstat_state & P_MEMSTAT_MEMLIMIT_INACTIVE_EXC_TRIGGERED) { \
-          trigger_exception = FALSE;                                   \
-   } else {                                                            \
-          trigger_exception = TRUE;                                    \
+          is_fatal = FALSE;                                            \
    }                                                                   \
 MACRO_END
 
@@ -631,7 +623,7 @@ extern unsigned int vm_page_secluded_count;
 
 #if VM_PRESSURE_EVENTS
 
-boolean_t memorystatus_warn_process(pid_t pid, boolean_t exceeded);
+boolean_t memorystatus_warn_process(pid_t pid, __unused boolean_t is_active, __unused boolean_t is_fatal,  boolean_t exceeded);
 
 vm_pressure_level_t memorystatus_vm_pressure_level = kVMPressureNormal;
 
@@ -827,6 +819,8 @@ sysctl_memorystatus_highwater_enable SYSCTL_HANDLER_ARGS
        proc_t p;
        unsigned int b = 0;
        int error, enable = 0;
+       boolean_t use_active;   /* use the active limit and active limit attributes */
+       boolean_t is_fatal;
 
        error = SYSCTL_OUT(req, arg1, sizeof(int));
        if (error || !req->newptr) {
@@ -846,7 +840,7 @@ sysctl_memorystatus_highwater_enable SYSCTL_HANDLER_ARGS
 
        p = memorystatus_get_first_proc_locked(&b, TRUE);
        while (p) {
-               boolean_t trigger_exception;
+               use_active = proc_jetsam_state_is_active_locked(p);
 
                if (enable) {
                        /*
@@ -854,10 +848,10 @@ sysctl_memorystatus_highwater_enable SYSCTL_HANDLER_ARGS
                         * Background limits are described via the inactive limit slots.
                         */
 
-                       if (proc_jetsam_state_is_active_locked(p) == TRUE) {
-                               CACHE_ACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                       if (use_active == TRUE) {
+                               CACHE_ACTIVE_LIMITS_LOCKED(p, is_fatal);
                        } else {
-                               CACHE_INACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                               CACHE_INACTIVE_LIMITS_LOCKED(p, is_fatal);
                        }
 
                } else {
@@ -867,13 +861,13 @@ sysctl_memorystatus_highwater_enable SYSCTL_HANDLER_ARGS
                         */
                        p->p_memstat_memlimit = -1;
                        p->p_memstat_state |= P_MEMSTAT_FATAL_MEMLIMIT;
-                       trigger_exception = TRUE;
+                       is_fatal = TRUE;
                }
 
                /*
                 * Enforce the cached limit by writing to the ledger.
                 */
-               task_set_phys_footprint_limit_internal(p->task, (p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit: -1, NULL, trigger_exception);
+               task_set_phys_footprint_limit_internal(p->task, (p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit: -1, NULL, use_active, is_fatal);
 
                p = memorystatus_get_next_proc_locked(&b, p, TRUE);
        }
@@ -891,8 +885,10 @@ SYSCTL_PROC(_kern, OID_AUTO, memorystatus_highwater_enabled, CTLTYPE_INT|CTLFLAG
 #if VM_PRESSURE_EVENTS
 
 /*
- * This routine is used for targeted notifications
- * regardless of system memory pressure.
+ * This routine is used for targeted notifications regardless of system memory pressure
+ * and regardless of whether or not the process has already been notified.
+ * It bypasses and has no effect on the only-one-notification per soft-limit policy.
+ * 
  * "memnote" is the current user.
  */
 
@@ -1654,9 +1650,17 @@ memorystatus_update_inactive_jetsam_priority_band(pid_t pid, uint32_t op_flags,
 
                                if (effective_now) {
                                        if (p->p_memstat_effectivepriority < JETSAM_PRIORITY_ELEVATED_INACTIVE) {
-                                               boolean_t trigger_exception;
-                                               CACHE_ACTIVE_LIMITS_LOCKED(p, trigger_exception);
-                                               task_set_phys_footprint_limit_internal(p->task, (p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit : -1, NULL, trigger_exception);
+                                               if(memorystatus_highwater_enabled) {
+                                                       /*
+                                                        * Process is about to transition from
+                                                        * inactive --> active
+                                                        * assign active state
+                                                        */
+                                                       boolean_t is_fatal;
+                                                       boolean_t use_active = TRUE;
+                                                       CACHE_ACTIVE_LIMITS_LOCKED(p, is_fatal);
+                                                       task_set_phys_footprint_limit_internal(p->task, (p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit : -1, NULL, use_active, is_fatal);
+                                               }
                                                memorystatus_update_priority_locked(p, JETSAM_PRIORITY_ELEVATED_INACTIVE, FALSE, FALSE);
                                        }
                                } else {
@@ -2080,7 +2084,8 @@ memorystatus_update_priority_locked(proc_t p, int priority, boolean_t head_inser
        new_bucket->count++;
 
        if (memorystatus_highwater_enabled) {
-               boolean_t trigger_exception;
+               boolean_t is_fatal;
+               boolean_t use_active;
 
                /* 
                 * If cached limit data is updated, then the limits
@@ -2107,7 +2112,8 @@ memorystatus_update_priority_locked(proc_t p, int priority, boolean_t head_inser
                if (p->p_memstat_dirty & P_DIRTY_TRACK) {
 
                        if (skip_demotion_check == TRUE && priority == JETSAM_PRIORITY_IDLE) {
-                               CACHE_INACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                               CACHE_INACTIVE_LIMITS_LOCKED(p, is_fatal);
+                               use_active = FALSE;
                        } else {
                                ledger_update_needed = FALSE;
                        }
@@ -2118,7 +2124,8 @@ memorystatus_update_priority_locked(proc_t p, int priority, boolean_t head_inser
                         *      BG       -->     FG
                         *      assign active state
                         */
-                       CACHE_ACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                       CACHE_ACTIVE_LIMITS_LOCKED(p, is_fatal);
+                       use_active = TRUE;
 
                } else if ((priority < JETSAM_PRIORITY_FOREGROUND) && (p->p_memstat_effectivepriority >= JETSAM_PRIORITY_FOREGROUND)) {
                        /*
@@ -2126,7 +2133,8 @@ memorystatus_update_priority_locked(proc_t p, int priority, boolean_t head_inser
                         *      FG     -->       BG
                         *      assign inactive state
                         */
-                       CACHE_INACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                       CACHE_INACTIVE_LIMITS_LOCKED(p, is_fatal);
+                       use_active = FALSE;
                } else {
                        /*
                         * The transition between jetsam priority buckets apparently did
@@ -2141,7 +2149,7 @@ memorystatus_update_priority_locked(proc_t p, int priority, boolean_t head_inser
                 * Enforce the new limits by writing to the ledger
                 */
                if (ledger_update_needed) {
-                       task_set_phys_footprint_limit_internal(p->task, (p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit : -1, NULL, trigger_exception);
+                       task_set_phys_footprint_limit_internal(p->task, (p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit : -1, NULL, use_active, is_fatal);
 
                        MEMORYSTATUS_DEBUG(3, "memorystatus_update_priority_locked: new limit on pid %d (%dMB %s) priority old --> new (%d --> %d) dirty?=0x%x %s\n",
                                           p->p_pid, (p->p_memstat_memlimit > 0 ? p->p_memstat_memlimit : -1),
@@ -2279,7 +2287,8 @@ memorystatus_update(proc_t p, int priority, uint64_t user_data, boolean_t effect
        p->p_memstat_requestedpriority = priority;
 
        if (update_memlimit) {
-               boolean_t trigger_exception;
+               boolean_t is_fatal;
+               boolean_t use_active;
 
                /*
                 * Posix_spawn'd processes come through this path to instantiate ledger limits.
@@ -2358,9 +2367,11 @@ memorystatus_update(proc_t p, int priority, uint64_t user_data, boolean_t effect
                 */
 
                if (proc_jetsam_state_is_active_locked(p) == TRUE) {
-                       CACHE_ACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                       CACHE_ACTIVE_LIMITS_LOCKED(p, is_fatal);
+                       use_active = TRUE;
                } else {
-                       CACHE_INACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                       CACHE_INACTIVE_LIMITS_LOCKED(p, is_fatal);
+                       use_active = FALSE;
                }
 
                /*
@@ -2368,8 +2379,7 @@ memorystatus_update(proc_t p, int priority, uint64_t user_data, boolean_t effect
                 */
                if (memorystatus_highwater_enabled) {
                        /* apply now */
-                       assert(trigger_exception == TRUE);
-                       task_set_phys_footprint_limit_internal(p->task, ((p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit : -1), NULL, trigger_exception);
+                       task_set_phys_footprint_limit_internal(p->task, ((p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit : -1), NULL, use_active, is_fatal);
 
                        MEMORYSTATUS_DEBUG(3, "memorystatus_update: init: limit on pid %d (%dMB %s) targeting priority(%d) dirty?=0x%x %s\n",
                                           p->p_pid, (p->p_memstat_memlimit > 0 ? p->p_memstat_memlimit : -1),
@@ -2881,7 +2891,9 @@ memorystatus_dirty_set(proc_t p, boolean_t self, uint32_t pcontrol) {
                memorystatus_update_idle_priority_locked(p);
 
                if (memorystatus_highwater_enabled) {
-                       boolean_t trigger_exception = FALSE, ledger_update_needed = TRUE;
+                       boolean_t ledger_update_needed = TRUE;
+                       boolean_t use_active;
+                       boolean_t is_fatal;
                        /* 
                         * We are in this path because this process transitioned between 
                         * dirty <--> clean state.  Update the cached memory limits.
@@ -2891,7 +2903,8 @@ memorystatus_dirty_set(proc_t p, boolean_t self, uint32_t pcontrol) {
                                /*
                                 * process is dirty
                                 */
-                               CACHE_ACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                               CACHE_ACTIVE_LIMITS_LOCKED(p, is_fatal);
+                               use_active = TRUE;
                                ledger_update_needed = TRUE;
                        } else {
                                /*
@@ -2904,7 +2917,8 @@ memorystatus_dirty_set(proc_t p, boolean_t self, uint32_t pcontrol) {
                                if (p->p_memstat_dirty & P_DIRTY_ALLOW_IDLE_EXIT) {
                                        ledger_update_needed = FALSE;
                                } else {
-                                       CACHE_INACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                                       CACHE_INACTIVE_LIMITS_LOCKED(p, is_fatal);
+                                       use_active = FALSE;
                                        ledger_update_needed = TRUE;
                                }
                        }
@@ -2926,7 +2940,7 @@ memorystatus_dirty_set(proc_t p, boolean_t self, uint32_t pcontrol) {
                                        ledger_limit = -1;
                                }
                                proc_list_unlock();
-                               task_set_phys_footprint_limit_internal(p->task, ledger_limit, NULL, trigger_exception);
+                               task_set_phys_footprint_limit_internal(p->task, ledger_limit, NULL, use_active, is_fatal);
                                proc_list_lock();
                                proc_rele_locked(p);
 
@@ -3648,74 +3662,6 @@ boolean_t memorystatus_idle_exit_from_VM(void) {
 }
 #endif /* !CONFIG_JETSAM */
 
-/*
- * Returns TRUE:
- *     when exceeding ledger footprint is fatal.
- * Returns FALSE:
- *     when exceeding ledger footprint is non fatal.
- */
-boolean_t
-memorystatus_turnoff_exception_and_get_fatalness(boolean_t warning, const int max_footprint_mb)
-{
-       proc_t p = current_proc();
-       boolean_t is_fatal;
-
-       proc_list_lock();
-
-       is_fatal = (p->p_memstat_state & P_MEMSTAT_FATAL_MEMLIMIT);
-
-       if (warning == FALSE) {
-               boolean_t is_active;
-               boolean_t state_changed = FALSE;
-
-               /*
-                * We are here because a process has exceeded its ledger limit.
-                * That is, the process is no longer in the limit warning range.
-                *
-                * When a process exceeds its ledger limit, we want an EXC_RESOURCE
-                * to trigger, but only once per process per limit.  We enforce that
-                * here, by identifying the active/inactive limit type. We then turn
-                * off the exception state by marking the limit as exception triggered.
-                */
-
-               is_active = proc_jetsam_state_is_active_locked(p);
-
-               if (is_active == TRUE) {
-                       /*
-                        * turn off exceptions for active state
-                        */
-                       if (!(p->p_memstat_state & P_MEMSTAT_MEMLIMIT_ACTIVE_EXC_TRIGGERED)) {
-                               p->p_memstat_state |= P_MEMSTAT_MEMLIMIT_ACTIVE_EXC_TRIGGERED;
-                               state_changed = TRUE;
-                       }
-               } else {
-                       /*
-                        * turn off exceptions for inactive state
-                        */
-                       if (!(p->p_memstat_state & P_MEMSTAT_MEMLIMIT_INACTIVE_EXC_TRIGGERED)) {
-                               p->p_memstat_state |= P_MEMSTAT_MEMLIMIT_INACTIVE_EXC_TRIGGERED;
-                               state_changed = TRUE;
-                       }
-               }
-
-               /*
-                * The limit violation is logged here, but only once per process per limit.
-                * This avoids excessive logging when a process consistently exceeds a soft limit.
-                * Soft memory limit is a non-fatal high-water-mark
-                * Hard memory limit is a fatal custom-task-limit or system-wide per-task memory limit.
-                */
-               if(state_changed) {
-                       printf("process %d (%s) exceeded physical memory footprint, the %s%sMemoryLimit of %d MB\n",
-                              p->p_pid, (*p->p_name ? p->p_name : "unknown"), (is_active ? "Active" : "Inactive"),
-                              (is_fatal  ? "Hard" : "Soft"), max_footprint_mb);
-               }
-
-       }
-       proc_list_unlock();
-
-       return is_fatal;
-}
-
 /*
  * Callback invoked when allowable physical memory footprint exceeded
  * (dirty pages + IOKit mappings)
@@ -3724,7 +3670,7 @@ memorystatus_turnoff_exception_and_get_fatalness(boolean_t warning, const int ma
  * as well as the fatal task memory limits.
  */
 void
-memorystatus_on_ledger_footprint_exceeded(boolean_t warning, boolean_t is_fatal)
+memorystatus_on_ledger_footprint_exceeded(boolean_t warning, boolean_t memlimit_is_active, boolean_t memlimit_is_fatal)
 {
        os_reason_t jetsam_reason = OS_REASON_NULL;
 
@@ -3736,7 +3682,7 @@ memorystatus_on_ledger_footprint_exceeded(boolean_t warning, boolean_t is_fatal)
                 * This is a warning path which implies that the current process is close, but has
                 * not yet exceeded its per-process memory limit.
                 */
-               if (memorystatus_warn_process(p->p_pid, FALSE /* not exceeded */) != TRUE) {
+               if (memorystatus_warn_process(p->p_pid, memlimit_is_active, memlimit_is_fatal,  FALSE /* not exceeded */) != TRUE) {
                        /* Print warning, since it's possible that task has not registered for pressure notifications */
                        printf("task_exceeded_footprint: failed to warn the current task (%d exiting, or no handler registered?).\n", p->p_pid);
                }
@@ -3744,7 +3690,7 @@ memorystatus_on_ledger_footprint_exceeded(boolean_t warning, boolean_t is_fatal)
        }
 #endif /* VM_PRESSURE_EVENTS */
 
-       if (is_fatal) {
+       if (memlimit_is_fatal) {
                /*
                 * If this process has no high watermark or has a fatal task limit, then we have been invoked because the task
                 * has violated either the system-wide per-task memory limit OR its own task limit.
@@ -3773,12 +3719,31 @@ memorystatus_on_ledger_footprint_exceeded(boolean_t warning, boolean_t is_fatal)
                 * This path implies the current process has exceeded a non-fatal (soft) memory limit.
                 * Failure to send note is ignored here.
                 */
-               (void)memorystatus_warn_process(p->p_pid, TRUE /* exceeded */);
+               (void)memorystatus_warn_process(p->p_pid, memlimit_is_active, memlimit_is_fatal, TRUE /* exceeded */);
 
 #endif /* VM_PRESSURE_EVENTS */
        }
 }
 
+void
+memorystatus_log_exception(const int max_footprint_mb, boolean_t memlimit_is_active, boolean_t memlimit_is_fatal)
+{
+       proc_t p = current_proc();
+
+       /*
+        * The limit violation is logged here, but only once per process per limit.
+        * Soft memory limit is a non-fatal high-water-mark
+        * Hard memory limit is a fatal custom-task-limit or system-wide per-task memory limit.
+        */
+
+       printf("process %d (%s) exceeded physical memory footprint, the %s%sMemoryLimit of %d MB\n",
+              p->p_pid, (*p->p_name ? p->p_name : "unknown"), (memlimit_is_active ? "Active" : "Inactive"),
+              (memlimit_is_fatal  ? "Hard" : "Soft"), max_footprint_mb);
+
+       return;
+}
+
+
 /*
  * Description:
  *     Evaluates active vs. inactive process state.
@@ -5874,11 +5839,12 @@ memorystatus_send_note(int event_code, void *data, size_t data_length) {
 }
 
 boolean_t
-memorystatus_warn_process(pid_t pid, boolean_t limit_exceeded) {
+memorystatus_warn_process(pid_t pid, __unused boolean_t is_active, __unused boolean_t is_fatal, boolean_t limit_exceeded) {
 
        boolean_t ret = FALSE;
        boolean_t found_knote = FALSE;
        struct knote *kn = NULL;
+       int send_knote_count = 0;
 
        /*
         * See comment in sysctl_memorystatus_vm_pressure_send.
@@ -5906,27 +5872,103 @@ memorystatus_warn_process(pid_t pid, boolean_t limit_exceeded) {
                                 * Processes on desktop are not expecting to handle a system-wide
                                 * critical or system-wide warning notification from this path.
                                 * Intentionally set only the unambiguous limit warning here.
+                                *
+                                * If the limit is soft, however, limit this to one notification per
+                                * active/inactive limit (per each registered listener).
                                 */
 
                                if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_WARN) {
-                                       kn->kn_fflags = NOTE_MEMORYSTATUS_PROC_LIMIT_WARN;
-                                       found_knote = TRUE;
+                                       found_knote=TRUE;
+                                       if (!is_fatal) {
+                                               /*
+                                                * Restrict proc_limit_warn notifications when
+                                                * non-fatal (soft) limit is at play.
+                                                */
+                                               if (is_active) {
+                                                       if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_ACTIVE) {
+                                                                /*
+                                                                 * Mark this knote for delivery.
+                                                                 */
+                                                                kn->kn_fflags = NOTE_MEMORYSTATUS_PROC_LIMIT_WARN;
+                                                               /*
+                                                                * And suppress it from future notifications.
+                                                                 */
+                                                                kn->kn_sfflags &= ~NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_ACTIVE;
+                                                               send_knote_count++;
+                                                        }
+                                               } else {
+                                                       if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_INACTIVE) {
+                                                                /*
+                                                                 * Mark this knote for delivery.
+                                                                 */
+                                                                kn->kn_fflags = NOTE_MEMORYSTATUS_PROC_LIMIT_WARN;
+                                                               /*
+                                                                * And suppress it from future notifications.
+                                                                 */
+                                                                kn->kn_sfflags &= ~NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_INACTIVE;
+                                                               send_knote_count++;
+                                                        }
+                                               }
+                                       } else {
+                                               /*
+                                                * No restriction on proc_limit_warn notifications when
+                                                * fatal (hard) limit is at play.
+                                                */
+                                               kn->kn_fflags = NOTE_MEMORYSTATUS_PROC_LIMIT_WARN;
+                                               send_knote_count++;
+                                       }
                                }
-
                        } else {
                                /*
-                                * Send this notification when a process has exceeded a soft limit.
+                                * Send this notification when a process has exceeded a soft limit,
                                 */
+
                                if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL) {
-                                       kn->kn_fflags = NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL;
                                        found_knote = TRUE;
+                                       if (!is_fatal) {
+                                               /*
+                                                * Restrict critical notifications for soft limits.
+                                                */
+
+                                               if (is_active) {
+                                                       if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_ACTIVE) {
+                                                               /*
+                                                                * Suppress future proc_limit_critical notifications
+                                                                * for the active soft limit.
+                                                                */
+                                                               kn->kn_sfflags &= ~NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_ACTIVE;
+                                                               kn->kn_fflags = NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL;
+                                                               send_knote_count++;
+
+                                                       }
+                                               } else {
+                                                       if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_INACTIVE) {
+                                                               /*
+                                                                * Suppress future proc_limit_critical_notifications
+                                                                * for the inactive soft limit.
+                                                                */
+                                                               kn->kn_sfflags &= ~NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_INACTIVE;
+                                                               kn->kn_fflags = NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL;
+                                                               send_knote_count++;
+                                                       }
+                                               }
+                                       } else {
+                                               /*
+                                                * We should never be trying to send a critical notification for
+                                                * a hard limit... the process would be killed before it could be
+                                                * received.
+                                                */
+                                               panic("Caught sending pid %d a critical warning for a fatal limit.\n", pid);
+                                       }
                                }
                        }
                }
        }
 
        if (found_knote) {
-               KNOTE(&memorystatus_klist, 0);
+               if (send_knote_count > 0) {
+                       KNOTE(&memorystatus_klist, 0);
+               }
                ret = TRUE;
        }
 
@@ -7703,21 +7745,23 @@ memorystatus_set_memlimit_properties(pid_t pid, memorystatus_memlimit_properties
         */
 
        if (memorystatus_highwater_enabled) {
-               boolean_t trigger_exception;
+               boolean_t is_fatal;
+               boolean_t use_active;
                /*
                 * No need to consider P_MEMSTAT_MEMLIMIT_BACKGROUND anymore.
                 * Background limits are described via the inactive limit slots.
                 */
 
                if (proc_jetsam_state_is_active_locked(p) == TRUE) {
-                       CACHE_ACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                       CACHE_ACTIVE_LIMITS_LOCKED(p, is_fatal);
+                       use_active = TRUE;
                } else {
-                       CACHE_INACTIVE_LIMITS_LOCKED(p, trigger_exception);
+                       CACHE_INACTIVE_LIMITS_LOCKED(p, is_fatal);
+                       use_active = FALSE;
                }
 
                /* Enforce the limit by writing to the ledgers */
-               assert(trigger_exception == TRUE);
-               error = (task_set_phys_footprint_limit_internal(p->task, ((p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit : -1), NULL, trigger_exception) == 0) ? 0 : EINVAL;
+               error = (task_set_phys_footprint_limit_internal(p->task, ((p->p_memstat_memlimit > 0) ? p->p_memstat_memlimit : -1), NULL, use_active, is_fatal) == 0) ? 0 : EINVAL;
 
                MEMORYSTATUS_DEBUG(3, "memorystatus_set_memlimit_properties: new limit on pid %d (%dMB %s) current priority (%d) dirty_state?=0x%x %s\n",
                                   p->p_pid, (p->p_memstat_memlimit > 0 ? p->p_memstat_memlimit : -1),
@@ -7944,7 +7988,17 @@ filt_memorystatus(struct knote *kn __unused, long hint)
                        break;
                }
        }
-       
+
+#if 0
+       if (kn->kn_fflags != 0) {
+               proc_t knote_proc = knote_get_kq(kn)->kq_p;
+               pid_t knote_pid = knote_proc->p_pid;
+
+               printf("filt_memorystatus: sending kn 0x%lx (event 0x%x) for pid (%d)\n",
+                      (unsigned long)kn, kn->kn_fflags, knote_pid);
+       }
+#endif
+
        return (kn->kn_fflags != 0);
 }
 
@@ -7952,6 +8006,7 @@ static int
 filt_memorystatustouch(struct knote *kn, struct kevent_internal_s *kev)
 {
        int res;
+       int prev_kn_sfflags = 0;
 
        memorystatus_klist_lock();
 
@@ -7959,7 +8014,63 @@ filt_memorystatustouch(struct knote *kn, struct kevent_internal_s *kev)
         * copy in new kevent settings
         * (saving the "desired" data and fflags).
         */
-       kn->kn_sfflags = kev->fflags;
+
+       prev_kn_sfflags = kn->kn_sfflags;
+       kn->kn_sfflags = (kev->fflags & EVFILT_MEMORYSTATUS_ALL_MASK);
+
+       /*
+        * Only on desktop do we restrict notifications to
+        * one per active/inactive state (soft limits only).
+        */
+       if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_WARN) {
+               /*
+                * Is there previous state to preserve?
+                */
+               if (prev_kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_WARN) {
+                       /*
+                        * This knote was previously interested in proc_limit_warn,
+                        * so yes, preserve previous state.
+                        */
+                       if (prev_kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_ACTIVE) {
+                               kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_ACTIVE;
+                       }
+                       if (prev_kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_INACTIVE) {
+                               kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_INACTIVE;
+                       }
+               } else {
+                       /*
+                        * This knote was not previously interested in proc_limit_warn,
+                        * but it is now.  Set both states.
+                        */
+                       kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_ACTIVE;
+                       kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_INACTIVE;
+               }
+       }
+
+       if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL) {
+               /*
+                * Is there previous state to preserve?
+                */
+               if (prev_kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL) {
+                       /*
+                        * This knote was previously interested in proc_limit_critical,
+                        * so yes, preserve previous state.
+                        */
+                       if (prev_kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_ACTIVE) {
+                               kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_ACTIVE;
+                       }
+                       if (prev_kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_INACTIVE) {
+                               kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_INACTIVE;
+                       }
+               } else {
+                       /*
+                        * This knote was not previously interested in proc_limit_critical,
+                        * but it is now.  Set both states.
+                        */
+                       kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_ACTIVE;
+                       kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_INACTIVE;
+               }
+       }
 
        if ((kn->kn_status & KN_UDATA_SPECIFIC) == 0)
                kn->kn_udata = kev->udata;
@@ -8016,12 +8127,23 @@ memorystatus_kevent_init(lck_grp_t *grp, lck_attr_t *attr) {
 int
 memorystatus_knote_register(struct knote *kn) {
        int error = 0;
-       
+
        memorystatus_klist_lock();
-       
-       if (kn->kn_sfflags & (NOTE_MEMORYSTATUS_PRESSURE_NORMAL | NOTE_MEMORYSTATUS_PRESSURE_WARN |
-                             NOTE_MEMORYSTATUS_PRESSURE_CRITICAL | NOTE_MEMORYSTATUS_LOW_SWAP |
-                             NOTE_MEMORYSTATUS_PROC_LIMIT_WARN | NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL)) {
+
+       /*
+        * Support only userspace visible flags.
+        */
+       if ((kn->kn_sfflags & EVFILT_MEMORYSTATUS_ALL_MASK) == kn->kn_sfflags) {
+
+               if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_WARN) {
+                       kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_ACTIVE;
+                       kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_INACTIVE;
+               }
+
+               if (kn->kn_sfflags & NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL) {
+                       kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_ACTIVE;
+                       kn->kn_sfflags |= NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_INACTIVE;
+               }
 
                KNOTE_ATTACH(&memorystatus_klist, kn);
 
index 3621eeaff01855972c07bf2ec93132d2f1f82a59..8628e301fd982480966f2ebc6d694b441d558571 100644 (file)
@@ -389,21 +389,23 @@ proc_findthread(thread_t thread)
        return(p);
 }
 
-#if PROC_REF_DEBUG
 void
 uthread_reset_proc_refcount(void *uthread) {
        uthread_t uth;
 
+       uth = (uthread_t) uthread;
+       uth->uu_proc_refcount = 0;
+
+#if PROC_REF_DEBUG
        if (proc_ref_tracking_disabled) {
                return;
        }
 
-       uth = (uthread_t) uthread;
-
-       uth->uu_proc_refcount = 0;
        uth->uu_pindex = 0;
+#endif
 }
 
+#if PROC_REF_DEBUG
 int
 uthread_get_proc_refcount(void *uthread) {
        uthread_t uth;
@@ -416,18 +418,20 @@ uthread_get_proc_refcount(void *uthread) {
 
        return uth->uu_proc_refcount;
 }
+#endif
 
 static void
-record_procref(proc_t p, int count) {
+record_procref(proc_t p __unused, int count) {
        uthread_t uth;
 
+       uth = current_uthread();
+       uth->uu_proc_refcount += count;
+
+#if PROC_REF_DEBUG
        if (proc_ref_tracking_disabled) {
                return;
        }
 
-       uth = current_uthread();
-       uth->uu_proc_refcount += count;
-
        if (count == 1) {
                if (uth->uu_pindex < NUM_PROC_REFS_TO_TRACK) {
                        backtrace((uintptr_t *) &uth->uu_proc_pcs[uth->uu_pindex], PROC_REF_STACK_DEPTH);
@@ -436,8 +440,24 @@ record_procref(proc_t p, int count) {
                        uth->uu_pindex++;
                }
        }
-}
 #endif
+}
+
+static boolean_t
+uthread_needs_to_wait_in_proc_refwait(void) {
+       uthread_t uth = current_uthread();
+
+       /*
+        * Allow threads holding no proc refs to wait
+        * in proc_refwait, allowing threads holding
+        * proc refs to wait in proc_refwait causes
+        * deadlocks and makes proc_find non-reentrant.
+        */
+       if (uth->uu_proc_refcount == 0)
+               return TRUE;
+
+       return FALSE;
+}
 
 int 
 proc_rele(proc_t p)
@@ -477,21 +497,21 @@ retry:
         * Do not return process marked for termination
         * or proc_refdrain called without ref wait.
         * Wait for proc_refdrain_with_refwait to complete if
-        * process in refdrain and refwait flag is set.
+        * process in refdrain and refwait flag is set, unless
+        * the current thread is holding to a proc_ref
+        * for any proc.
         */
        if ((p->p_stat != SZOMB) &&
            ((p->p_listflag & P_LIST_EXITED) == 0) &&
            ((p->p_listflag & P_LIST_DEAD) == 0) &&
            (((p->p_listflag & (P_LIST_DRAIN | P_LIST_DRAINWAIT)) == 0) ||
             ((p->p_listflag & P_LIST_REFWAIT) != 0))) {
-               if ((p->p_listflag & P_LIST_REFWAIT) != 0) {
+               if ((p->p_listflag & P_LIST_REFWAIT) != 0 && uthread_needs_to_wait_in_proc_refwait()) {
                        msleep(&p->p_listflag, proc_list_mlock, 0, "proc_refwait", 0) ;
                        goto retry;
                }
                p->p_refcount++;
-#if PROC_REF_DEBUG
                record_procref(p, 1);
-#endif
        }
        else 
                p1 = PROC_NULL;
@@ -505,9 +525,7 @@ proc_rele_locked(proc_t p)
 
        if (p->p_refcount > 0) {
                p->p_refcount--;
-#if PROC_REF_DEBUG
                record_procref(p, -1);
-#endif
                if ((p->p_refcount == 0) && ((p->p_listflag & P_LIST_DRAINWAIT) == P_LIST_DRAINWAIT)) {
                        p->p_listflag &= ~P_LIST_DRAINWAIT;
                        wakeup(&p->p_refcount);
@@ -576,7 +594,9 @@ proc_refdrain_with_refwait(proc_t p, boolean_t get_ref_and_allow_wait)
        if (get_ref_and_allow_wait) {
                /*
                 * All the calls to proc_ref_locked will wait
-                * for the flag to get cleared before returning a ref.
+                * for the flag to get cleared before returning a ref,
+                * unless the current thread is holding to a proc ref
+                * for any proc.
                 */
                p->p_listflag |= P_LIST_REFWAIT;
                if (p == initproc) {
@@ -596,9 +616,7 @@ proc_refdrain_with_refwait(proc_t p, boolean_t get_ref_and_allow_wait)
        } else {
                /* Return a ref to the caller */
                p->p_refcount++;
-#if PROC_REF_DEBUG
                record_procref(p, 1);
-#endif
        }
 
        proc_list_unlock();
@@ -3147,6 +3165,12 @@ extern uint64_t  vm_compressor_pages_compressed(void);
 
 struct timeval last_no_space_action = {0, 0};
 
+#if DEVELOPMENT || DEBUG
+extern boolean_t kill_on_no_paging_space;
+#endif /* DEVELOPMENT || DEBUG */
+
+#define MB_SIZE        (1024 * 1024ULL)
+
 int
 no_paging_space_action()
 {
@@ -3199,7 +3223,7 @@ no_paging_space_action()
                                 */
                                last_no_space_action = now;
 
-                               printf("low swap: killing pid %d (%s)\n", p->p_pid, p->p_comm);
+                               printf("low swap: killing largest compressed process with pid %d (%s) and size %llu MB\n", p->p_pid, p->p_comm, (nps.pcs_max_size/MB_SIZE));
                                psignal(p, SIGKILL);
                        
                                proc_rele(p);
@@ -3222,6 +3246,22 @@ no_paging_space_action()
                                 */
                                last_no_space_action = now;
                
+#if DEVELOPMENT || DEBUG
+                               if (kill_on_no_paging_space == TRUE) {
+                                       /*
+                                        * We found the largest process that has a process policy i.e. one of
+                                        * PC_KILL, PC_SUSP, PC_THROTTLE.
+                                        * But we are in a mode where we will kill it regardless of its policy.
+                                        */
+                                       printf("low swap: killing largest process with pid %d (%s) and size %llu MB\n", p->p_pid, p->p_comm, (nps.pcs_max_size/MB_SIZE));
+                                       psignal(p, SIGKILL);
+
+                                       proc_rele(p);
+
+                                       return 1;
+                               }
+#endif /* DEVELOPMENT || DEBUG */
+
                                proc_dopcontrol(p);
                        
                                proc_rele(p);
index dedb8288c0cc525c92ffa5b8a7eb566dc032b7aa..216a32baf01a2dbfa8e88f83be717e61ee70bbb7 100644 (file)
@@ -139,6 +139,12 @@ kernel_hwm_panic_info(void)
        return;
 }
 
+int
+get_system_inshutdown()
+{
+       return (system_inshutdown);
+}
+
 int
 reboot_kernel(int howto, char *message)
 {
index edf864abfc76ca03ef71c4f08de126e5b4fb5611..a612b23fc41f9a756be03564769a00634305e5d7 100644 (file)
@@ -513,7 +513,7 @@ kern_open_file_for_direct_io(const char * name,
     }
 
 out:
-    printf("kern_open_file_for_direct_io(%d)\n", error);
+    printf("kern_open_file_for_direct_io(%p, %d)\n", ref, error);
 
     if (error && locked)
     {
@@ -570,7 +570,7 @@ kern_close_file_for_direct_io(struct kern_direct_file_io_ref_t * ref,
                              off_t discard_offset, off_t discard_end)
 {
     int error;
-    kprintf("kern_close_file_for_direct_io\n");
+    printf("kern_close_file_for_direct_io(%p)\n", ref);
 
     if (!ref) return;
 
index a99b1d43e52a121ca8a56f2d60d7bf25d2c00211..29b714684e5c527791febe2d90cd9dca73a7bad9 100644 (file)
@@ -1153,7 +1153,6 @@ sysctl_kdebug_ops SYSCTL_HANDLER_ARGS
        case KERN_KDTHRMAP:
        case KERN_KDPIDEX:
        case KERN_KDSETBUF:
-       case KERN_KDGETENTROPY:
        case KERN_KDREADCURTHRMAP:
        case KERN_KDSET_TYPEFILTER:
        case KERN_KDBUFWAIT:
index 560b79bf2fea37071f60f8721e2222d76e119e2a..2f1b1d96a8af12006babef4a89d17f69d654b35c 100644 (file)
@@ -74,6 +74,7 @@ sock_accept(socket_t sock, struct sockaddr *from, int fromlen, int flags,
                socket_unlock(sock, 1);
                return (ENOTSUP);
        }
+check_again:
        if (((flags & MSG_DONTWAIT) != 0 || (sock->so_state & SS_NBIO) != 0) &&
            sock->so_comp.tqh_first == NULL) {
                socket_unlock(sock, 1);
@@ -107,12 +108,19 @@ sock_accept(socket_t sock, struct sockaddr *from, int fromlen, int flags,
                return (error);
        }
 
+       so_acquire_accept_list(sock, NULL);
+       if (TAILQ_EMPTY(&sock->so_comp)) {
+               so_release_accept_list(sock);
+               goto check_again;
+       }
        new_so = TAILQ_FIRST(&sock->so_comp);
        TAILQ_REMOVE(&sock->so_comp, new_so, so_list);
        new_so->so_state &= ~SS_COMP;
        new_so->so_head = NULL;
        sock->so_qlen--;
 
+       so_release_accept_list(sock);
+
        /*
         * Pass the pre-accepted socket to any interested socket filter(s).
         * Upon failure, the socket would have been closed by the callee.
index 091f66b46f3fe2113abe7b46c3a56c320ce8d211..e8e4115f01b24d6e90ac5f2039fc3f48cab324c8 100644 (file)
@@ -995,70 +995,6 @@ sflt_connectout(struct socket *so, const struct sockaddr *nam)
        return (0);
 }
 
-__private_extern__ int
-sflt_connectxout(struct socket *so, struct sockaddr_list **dst_sl0)
-{
-       struct sockaddr_list *dst_sl;
-       struct sockaddr_entry *se, *tse;
-       int modified = 0;
-       int error = 0;
-
-       if (so->so_filt == NULL || sflt_permission_check(sotoinpcb(so)))
-               return (0);
-
-       /* make a copy as sflt_connectout() releases socket lock */
-       dst_sl = sockaddrlist_dup(*dst_sl0, M_WAITOK);
-       if (dst_sl == NULL)
-               return (ENOBUFS);
-
-       /*
-        * Hmm; we don't yet have a connectx socket filter callback,
-        * so the closest thing to do is to probably call sflt_connectout()
-        * as many times as there are addresses in the list, and bail
-        * as soon as we get an error.
-        */
-       TAILQ_FOREACH_SAFE(se, &dst_sl->sl_head, se_link, tse) {
-               char buf[SOCK_MAXADDRLEN];
-               struct sockaddr *sa;
-
-               VERIFY(se->se_addr != NULL);
-
-               /*
-               * Workaround for rdar://23362120
-               * Always pass a buffer that can hold an IPv6 socket address
-               */
-               bzero(buf, sizeof (buf));
-               bcopy(se->se_addr, buf, se->se_addr->sa_len);
-               sa = (struct sockaddr *)buf;
-
-               error = sflt_connectout_common(so, sa);
-               if (error != 0)
-                       break;
-
-               /*
-                * If the address was modified, copy it back
-                */
-               if (bcmp(se->se_addr, sa, se->se_addr->sa_len) != 0) {
-                       bcopy(sa, se->se_addr, se->se_addr->sa_len);
-                       modified = 1;
-               }
-       }
-
-       if (error != 0 || !modified) {
-               /* leave the original as is */
-               sockaddrlist_free(dst_sl);
-       } else {
-               /*
-                * At least one address was modified and there were no errors;
-                * ditch the original and return the modified list.
-                */
-               sockaddrlist_free(*dst_sl0);
-               *dst_sl0 = dst_sl;
-       }
-
-       return (error);
-}
-
 __private_extern__ int
 sflt_setsockopt(struct socket *so, struct sockopt *sopt)
 {
index b5ba3831a422bf2ad173d39d50a5c0142a3f6393..ca2fb4338d2a87badd8dd4a9ec80ab5018655637 100644 (file)
@@ -2023,8 +2023,7 @@ load_code_signature(
        if (blob != NULL) {
                /* we already have a blob for this vnode and cputype */
                if (blob->csb_cpu_type == cputype &&
-                   blob->csb_base_offset == macho_offset &&
-                   blob->csb_mem_size == lcp->datasize) {
+                   blob->csb_base_offset == macho_offset) {
                        /* it matches the blob we want here, lets verify the version */
                        if(0 != ubc_cs_generation_check(vp)) {
                                if (0 != ubc_cs_blob_revalidate(vp, blob, imgp, 0)) {
index d8bc4f07acc2f53f855dc0cb8d5c670fb6f0114b..184f568a4a53aac5a0540ee387b860a7c5a551d8 100644 (file)
@@ -369,8 +369,13 @@ retry_trace_me:;
                }
 
                if (uap->data != 0) {
+#if CONFIG_MACF
+                       error = mac_proc_check_signal(p, t, uap->data);
+                       if (0 != error)
+                               goto out;
+#endif
                        psignal(t, uap->data);
-                }
+               }
 
                if (uap->req == PT_STEP) {
                        /*
index 0cd3827fe48a1e3e874da51a3b5e8b9046cc733a..cbaf30ca4ea274d0966691180d8f300fa463588f 100644 (file)
@@ -118,7 +118,7 @@ common_hook(void)
        return rv;
 }
 
-#if (MAC_POLICY_OPS_VERSION != 46)
+#if (MAC_POLICY_OPS_VERSION != 47)
 # error "struct mac_policy_ops doesn't match definition in mac_policy.h"
 #endif
 /*
@@ -397,7 +397,7 @@ static struct mac_policy_ops policy_ops = {
        CHECK_SET_HOOK(sysvshm_label_recycle)
 
        .mpo_reserved8 = (mpo_reserved_hook_t *)common_hook,
-       .mpo_reserved9 = (mpo_reserved_hook_t *)common_hook,
+       CHECK_SET_HOOK(mount_check_snapshot_revert)
        CHECK_SET_HOOK(vnode_check_getattr)
        CHECK_SET_HOOK(mount_check_snapshot_create)
        CHECK_SET_HOOK(mount_check_snapshot_delete)
index 6f5333f47a1b6d5f8eac368a8e04ae1798e92306..e0707e35a4649c734b7b3f20d3c69ac2331c1d49 100644 (file)
@@ -1149,6 +1149,8 @@ proc_pidpathinfo(proc_t p, __unused uint64_t arg, user_addr_t buffer, uint32_t b
        if (buf == NULL) 
                return(ENOMEM);
 
+       bzero(buf, buffersize);
+
        error = proc_pidpathinfo_internal(p, arg, buf, buffersize, retval);
        if (error == 0) {
                error = copyout(buf, buffer, len);
index 393e1e1e14f640de44e0b2ce7edc853bd37b7874..bcf69d7c8f589015827f5b4e30b4f6f5398b7da8 100644 (file)
@@ -164,9 +164,11 @@ process_policy(__unused struct proc *p, struct process_policy_args * uap, __unus
                                case PROC_POLICY_RUSAGE_DISK:
                                case PROC_POLICY_RUSAGE_NETWORK:
                                case PROC_POLICY_RUSAGE_POWER:
-                                       return(ENOTSUP);
+                                       error = ENOTSUP;
+                                       goto out;
                                default:
-                                       return(EINVAL);
+                                       error = EINVAL;
+                                       goto out;
                                case PROC_POLICY_RUSAGE_CPU:
                                        break;
                        }
index 4d55f7ef79ea1ca08c1f4c66c32dcb7abfb0ec83..76e76c957db922102420339bca4c0e15d725f55f 100644 (file)
@@ -63,6 +63,10 @@ static_assert((sizeof(struct pthread_callbacks_s) - offsetof(struct pthread_call
 extern kern_return_t mach_port_deallocate(ipc_space_t, mach_port_name_t);
 extern kern_return_t semaphore_signal_internal_trap(mach_port_name_t);
 
+/* Used for stackshot introspection */
+extern void kdp_pthread_find_owner(thread_t thread, struct stackshot_thread_waitinfo *waitinfo);
+extern void* kdp_pthread_get_thread_kwq(thread_t thread);
+
 #define PTHREAD_STRUCT_ACCESSOR(get, set, rettype, structtype, member) \
        static rettype \
        get(structtype x) { \
@@ -504,6 +508,22 @@ pthread_priority_canonicalize(unsigned long priority, boolean_t propagation)
        }
 }
 
+void
+kdp_pthread_find_owner(thread_t thread, struct stackshot_thread_waitinfo *waitinfo)
+{
+       if (pthread_functions->pthread_find_owner)
+               pthread_functions->pthread_find_owner(thread, waitinfo);
+}
+
+void *
+kdp_pthread_get_thread_kwq(thread_t thread)
+{
+       if (pthread_functions->pthread_get_thread_kwq)
+               return pthread_functions->pthread_get_thread_kwq(thread);
+
+       return NULL;
+}
+
 /*
  * The callbacks structure (defined in pthread_shims.h) contains a collection
  * of kernel functions that were not deemed sensible to expose as a KPI to all
index c301e27976c9d5055450e984932acd659067dbdc..d0a78427b94b9ec7bc18d48315b1c78ffd8584e2 100644 (file)
@@ -71,6 +71,7 @@
 #include <sys/vnode.h>
 #include <stdbool.h>
 #include <firehose/tracepoint_private.h>
+#include <firehose/chunk_private.h>
 #include <firehose/ioctl_private.h>
 #include <os/firehose_buffer_private.h>
 
@@ -128,17 +129,17 @@ struct logsoftc {
 
 int    log_open;                       /* also used in log() */
 char smsg_bufc[CONFIG_MSG_BSIZE]; /* static buffer */
-char oslog_stream_bufc[FIREHOSE_BUFFER_CHUNK_SIZE]; /* static buffer */
-struct firehose_buffer_chunk_s __attribute__((aligned(8))) oslog_boot_buf = {
-       .fbc_pos = {
-               .fbc_next_entry_offs = offsetof(struct firehose_buffer_chunk_s, fbc_data),
-               .fbc_private_offs = FIREHOSE_BUFFER_CHUNK_SIZE,
-               .fbc_refcnt = 1, // indicate that there is a writer to this chunk
-               .fbc_stream = firehose_stream_persist,
-               .fbc_flag_io = 1, // for now, lets assume this is coming from the io bank
+char oslog_stream_bufc[FIREHOSE_CHUNK_SIZE]; /* static buffer */
+struct firehose_chunk_s oslog_boot_buf = {
+       .fc_pos = {
+               .fcp_next_entry_offs = offsetof(struct firehose_chunk_s, fc_data),
+               .fcp_private_offs = FIREHOSE_CHUNK_SIZE,
+               .fcp_refcnt = 1, // indicate that there is a writer to this chunk
+               .fcp_stream = firehose_stream_persist,
+               .fcp_flag_io = 1, // for now, lets assume this is coming from the io bank
        },
 }; /* static buffer */
-firehose_buffer_chunk_t firehose_boot_chunk = &oslog_boot_buf;
+firehose_chunk_t firehose_boot_chunk = &oslog_boot_buf;
 struct msgbuf msgbuf = {MSG_MAGIC,sizeof(smsg_bufc),0,0,smsg_bufc};
 struct msgbuf oslog_stream_buf = {MSG_MAGIC,0,0,0,NULL};
 struct msgbuf *msgbufp __attribute__((used)) = &msgbuf;
@@ -466,7 +467,7 @@ oslog_streamread(__unused dev_t dev, struct uio *uio, int flag)
 {
        int error = 0;
        int copy_size = 0;
-       static char logline[FIREHOSE_BUFFER_CHUNK_SIZE];
+       static char logline[FIREHOSE_CHUNK_SIZE];
 
        lck_spin_lock(&oslog_stream_lock);
 
@@ -765,7 +766,7 @@ int
 oslogioctl(__unused dev_t dev, u_long com, caddr_t data, __unused int flag, __unused struct proc *p)
 {
        int ret = 0;
-       mach_vm_size_t buffer_size = (FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT * FIREHOSE_BUFFER_CHUNK_SIZE);
+       mach_vm_size_t buffer_size = (FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT * FIREHOSE_CHUNK_SIZE);
        firehose_buffer_map_info_t map_info = {0, 0};
        firehose_buffer_t kernel_firehose_buffer = NULL;
        mach_vm_address_t user_addr = 0;
@@ -856,7 +857,7 @@ void
 oslog_init(void)
 {
        kern_return_t kr;
-       vm_size_t size = FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT * FIREHOSE_BUFFER_CHUNK_SIZE;
+       vm_size_t size = FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT * FIREHOSE_CHUNK_SIZE;
 
        oslog_lock_init();
 
index bd8fd7c2291d3fe0593e30e02c5b85bb0e5b9c0b..2d1431763c7c23d2bce4e28d18f4f9386c3641a3 100644 (file)
@@ -1789,6 +1789,14 @@ poll_nocancel(struct proc *p, struct poll_nocancel_args *uap, int32_t *retval)
        if (nfds && (rfds == nfds))
                goto done;
 
+       /*
+        * If any events have trouble registering, an event has fired and we
+        * shouldn't wait for events in kqueue_scan -- use the current time as
+        * the deadline.
+        */
+       if (rfds)
+               getmicrouptime(&atv);
+
        /* scan for, and possibly wait for, the kevents to trigger */
        cont->pca_fds = uap->fds;
        cont->pca_nfds = nfds;
@@ -3164,9 +3172,11 @@ ledger(struct proc *p, struct ledger_args *args, __unused int32_t *retval)
                error = copyin(args->arg3, (char *)&len, sizeof (len));
        else if (args->cmd == LEDGER_TEMPLATE_INFO)
                error = copyin(args->arg2, (char *)&len, sizeof (len));
-#ifdef LEDGER_DEBUG
        else if (args->cmd == LEDGER_LIMIT)
+#ifdef LEDGER_DEBUG
                error = copyin(args->arg2, (char *)&lla, sizeof (lla));
+#else
+               return (EINVAL);
 #endif
        else if ((args->cmd < 0) || (args->cmd > LEDGER_MAX_CMD))
                return (EINVAL);
index d245fcbccd283b8f5560585941337aa6a4b6439e..4da93446c4a781b3c2796cdf5d67cd4900645b6b 100644 (file)
@@ -54,6 +54,7 @@
 #include <kern/waitq.h>
 #include <kern/sched_prim.h>
 #include <kern/zalloc.h>
+#include <kern/debug.h>
 
 #include <pexpert/pexpert.h>
 
@@ -95,6 +96,9 @@ static lck_mtx_t ull_table_lock;
 #define ull_unlock(ull)         lck_mtx_unlock(&ull->ull_lock)
 #define ull_assert_owned(ull)  LCK_MTX_ASSERT(&ull->ull_lock, LCK_MTX_ASSERT_OWNED)
 
+#define ULOCK_TO_EVENT(ull)   ((event_t)ull)
+#define EVENT_TO_ULOCK(event) ((ull_t *)event)
+
 typedef struct __attribute__((packed)) {
        user_addr_t     ulk_addr;
        pid_t           ulk_pid;
@@ -127,6 +131,7 @@ typedef struct ull {
 static const bool ull_debug = false;
 
 extern void ulock_initialize(void);
+extern void kdp_ulock_find_owner(struct waitq * waitq, event64_t event, thread_waitinfo_t *waitinfo);
 
 #define ULL_MUST_EXIST 0x0001
 static ull_t *ull_get(ulk_t *, uint32_t);
@@ -535,10 +540,11 @@ ulock_wait(struct proc *p, struct ulock_wait_args *args, int32_t *retval)
 
        wait_result_t wr;
        uint32_t timeout = args->timeout;
+       thread_set_pending_block_hint(self, kThreadWaitUserLock);
        if (timeout) {
-               wr = assert_wait_timeout((event_t)ull, THREAD_ABORTSAFE, timeout, NSEC_PER_USEC);
+               wr = assert_wait_timeout(ULOCK_TO_EVENT(ull), THREAD_ABORTSAFE, timeout, NSEC_PER_USEC);
        } else {
-               wr = assert_wait((event_t)ull, THREAD_ABORTSAFE);
+               wr = assert_wait(ULOCK_TO_EVENT(ull), THREAD_ABORTSAFE);
        }
 
        ull_unlock(ull);
@@ -717,9 +723,9 @@ ulock_wake(struct proc *p, struct ulock_wake_args *args, __unused int32_t *retva
        }
 
        if (flags & ULF_WAKE_ALL) {
-               thread_wakeup((event_t)ull);
+               thread_wakeup(ULOCK_TO_EVENT(ull));
        } else if (flags & ULF_WAKE_THREAD) {
-               kern_return_t kr = thread_wakeup_thread((event_t)ull, wake_thread);
+               kern_return_t kr = thread_wakeup_thread(ULOCK_TO_EVENT(ull), wake_thread);
                if (kr != KERN_SUCCESS) {
                        assert(kr == KERN_NOT_WAITING);
                        ret = EALREADY;
@@ -732,7 +738,7 @@ ulock_wake(struct proc *p, struct ulock_wake_args *args, __unused int32_t *retva
                 * TODO: 'owner is not current_thread (or null)' likely means we can avoid this wakeup
                 * <rdar://problem/25487001>
                 */
-               thread_wakeup_one_with_pri((event_t)ull, WAITQ_SELECT_MAX_PRI);
+               thread_wakeup_one_with_pri(ULOCK_TO_EVENT(ull), WAITQ_SELECT_MAX_PRI);
        }
 
        /*
@@ -808,3 +814,20 @@ ull_promote_owner_locked(ull_t*    ull,
        return old_owner;
 }
 
+void
+kdp_ulock_find_owner(__unused struct waitq * waitq, event64_t event, thread_waitinfo_t * waitinfo)
+{
+       ull_t *ull = EVENT_TO_ULOCK(event);
+       assert(kdp_is_in_zone(ull, "ulocks"));
+
+       if (ull->ull_opcode == UL_UNFAIR_LOCK) {// owner is only set if it's an os_unfair_lock
+               waitinfo->owner = thread_tid(ull->ull_owner);
+               waitinfo->context = ull->ull_key.ulk_addr;
+       } else if (ull->ull_opcode == UL_COMPARE_AND_WAIT) { // otherwise, this is a spinlock
+               waitinfo->owner = 0;
+               waitinfo->context = ull->ull_key.ulk_addr;
+       } else {
+               panic("%s: Invalid ulock opcode %d addr %p", __FUNCTION__, ull->ull_opcode, (void*)ull);
+       }
+       return;
+}
index 7c2bd0f69d63b8aab254d15c95c9f75bf26e6c88..8b3b9b1692bad1923bb416ebe19a76ae992e1ead 100644 (file)
 #else
 492    AUE_NULL        ALL { int enosys(void); }
 #endif /* CONFIG_TELEMETRY */
+#if PGO
 493    AUE_NULL        ALL     { user_ssize_t grab_pgo_data (user_addr_t uuid, int flags, user_addr_t buffer, user_ssize_t size); }
+#else
+493    AUE_NULL        ALL { int enosys(void); }
+#endif
 #if CONFIG_PERSONAS
 494    AUE_PERSONA     ALL     { int persona(uint32_t operation, uint32_t flags, struct kpersona_info *info, uid_t *id, size_t *idlen) NO_SYSCALL_STUB; }
 #else
index 55459ab16d6d4db71346955cd75e60e06e07fe17..ecfafb55f87293181aff77a64b13a5eab8caba59 100644 (file)
@@ -428,7 +428,7 @@ grow_sem_pool(int new_pool_size)
        printf("growing sem_pool array from %d to %d\n", seminfo.semmns, new_pool_size);
 #endif
        MALLOC(new_sem_pool, struct sem *, sizeof (struct sem) * new_pool_size,
-              M_SYSVSEM, M_WAITOK | M_ZERO);
+              M_SYSVSEM, M_WAITOK | M_ZERO | M_NULL);
        if (NULL == new_sem_pool) {
 #ifdef SEM_DEBUG
                printf("allocation failed.  no changes made.\n");
index c397788c2f02684570d0e83982aab02d800a5d7a..4a47b7ac256428e8ce6e6c5015164e99eb4824a1 100644 (file)
@@ -411,7 +411,7 @@ shmat(struct proc *p, struct shmat_args *uap, user_addr_t *retval)
             goto shmat_out;
                }
 
-               MALLOC(shmmap_s, struct shmmap_state *, size, M_SHM, M_WAITOK);
+               MALLOC(shmmap_s, struct shmmap_state *, size, M_SHM, M_WAITOK | M_NULL);
                if (shmmap_s == NULL) {
                        shmat_ret = ENOMEM;
                        goto shmat_out;
index f2fc638701a90c59f25ccad39bd8d69422b53092..1b7187a01e5009515a552a97077159601520ca33 100644 (file)
 0x10c0170      MSC_mk_timer_destroy
 0x10c0174      MSC_mk_timer_arm
 0x10c0178      MSC_mk_timer_cancel
-0x10c017c      MSC_kern_invalid_#95
+0x10c017c      MSC_mk_timer_arm_leeway
 0x10c0180      MSC_kern_invalid_#96
 0x10c0184      MSC_kern_invalid_#97
 0x10c0188      MSC_kern_invalid_#98
index 300f91b0b2c3d302c7ff6d08579e5c82be86cf35..8e6f569298675ee9a768ebed4ae7fd23cf91d86f 100644 (file)
@@ -468,20 +468,26 @@ cs_validate_blob(const CS_GenericBlob *blob, size_t length)
  */
 
 static int
-cs_validate_csblob(const uint8_t *addr, size_t length,
-                  const CS_CodeDirectory **rcd,
-                  const CS_GenericBlob **rentitlements)
+cs_validate_csblob(
+       const uint8_t *addr,
+       size_t *blob_size_p,
+       const CS_CodeDirectory **rcd,
+       const CS_GenericBlob **rentitlements)
 {
-       const CS_GenericBlob *blob = (const CS_GenericBlob *)(const void *)addr;
+       const CS_GenericBlob *blob;
        int error;
+       size_t length, blob_size;
 
        *rcd = NULL;
        *rentitlements = NULL;
 
+       blob = (const CS_GenericBlob *)(const void *)addr;
+       blob_size = *blob_size_p;
+
+       length = blob_size;
        error = cs_validate_blob(blob, length);
        if (error)
                return error;
-
        length = ntohl(blob->length);
 
        if (ntohl(blob->magic) == CSMAGIC_EMBEDDED_SIGNATURE) {
@@ -561,6 +567,8 @@ cs_validate_csblob(const uint8_t *addr, size_t length,
        if (*rcd == NULL)
                return EBADEXEC;
 
+       *blob_size_p = blob_size;
+
        return 0;
 }
 
@@ -2878,6 +2886,7 @@ ubc_cs_convert_to_multilevel_hash(struct cs_blob *blob)
        vm_size_t       new_cdsize;
        kern_return_t   kr;
        int                             error;
+       size_t          length;
 
        uint32_t                hashes_per_new_hash_shift = (uint32_t)(PAGE_SHIFT - blob->csb_hash_pageshift);
 
@@ -2994,7 +3003,9 @@ ubc_cs_convert_to_multilevel_hash(struct cs_blob *blob)
                blob->csb_hashtype->cs_final(dst, &mdctx);
        }
 
-       error = cs_validate_csblob((const uint8_t *)new_blob_addr, new_blob_size, &cd, &entitlements);
+       length = new_blob_size;
+       error = cs_validate_csblob((const uint8_t *)new_blob_addr, &length, &cd, &entitlements);
+       assert(length == new_blob_size);
        if (error) {
 
                if (cs_debug > 1) {
@@ -3051,6 +3062,7 @@ ubc_cs_blob_add(
        off_t                   blob_start_offset, blob_end_offset;
        union cs_hash_union     mdctx;
        boolean_t               record_mtime;
+       size_t                  length;
 
        record_mtime = FALSE;
        if (ret_blob)
@@ -3080,20 +3092,66 @@ ubc_cs_blob_add(
        /*
         * Validate the blob's contents
         */
-
-       error = cs_validate_csblob((const uint8_t *)blob->csb_mem_kaddr, size, &cd, &entitlements);
+       length = (size_t) size;
+       error = cs_validate_csblob((const uint8_t *)blob->csb_mem_kaddr,
+                                  &length, &cd, &entitlements);
        if (error) {
 
-        if (cs_debug)
+               if (cs_debug)
                        printf("CODESIGNING: csblob invalid: %d\n", error);
-        /* The vnode checker can't make the rest of this function succeed if csblob validation failed, so bail */
-        goto out;
+               /*
+                * The vnode checker can't make the rest of this function
+                * succeed if csblob validation failed, so bail */
+               goto out;
 
        } else {
                const unsigned char *md_base;
                uint8_t hash[CS_HASH_MAX_SIZE];
                int md_size;
 
+               size = (vm_size_t) length;
+               assert(size <= blob->csb_mem_size);
+               if (size < blob->csb_mem_size) {
+                       vm_address_t new_blob_addr;
+                       const CS_CodeDirectory *new_cd;
+                       const CS_GenericBlob *new_entitlements;
+
+                       kr = ubc_cs_blob_allocate(&new_blob_addr, &size);
+                       if (kr != KERN_SUCCESS) {
+                               if (cs_debug > 1) {
+                                       printf("CODE SIGNING: failed to "
+                                              "re-allocate blob (size "
+                                              "0x%llx->0x%llx) error 0x%x\n",
+                                              (uint64_t)blob->csb_mem_size,
+                                              (uint64_t)size,
+                                              kr);
+                               }
+                       } else {
+                               memcpy(new_blob_addr, blob->csb_mem_kaddr, size);
+                               if (cd == NULL) {
+                                       new_cd = NULL;
+                               } else {
+                                       new_cd = ((uintptr_t)cd
+                                                 - (uintptr_t)blob->csb_mem_kaddr
+                                                 + (uintptr_t)new_blob_addr);
+                               }
+                               if (entitlements == NULL) {
+                                       new_entitlements = NULL;
+                               } else {
+                                       new_entitlements = ((uintptr_t)entitlements
+                                                           - (uintptr_t)blob->csb_mem_kaddr
+                                                           + (uintptr_t)new_blob_addr);
+                               }
+//                             printf("CODE SIGNING: %s:%d kaddr 0x%llx cd %p ents %p -> blob 0x%llx cd %p ents %p\n", __FUNCTION__, __LINE__, (uint64_t)blob->csb_mem_kaddr, cd, entitlements, (uint64_t)new_blob_addr, new_cd, new_entitlements);
+                               ubc_cs_blob_deallocate(blob->csb_mem_kaddr,
+                                                      blob->csb_mem_size);
+                               blob->csb_mem_kaddr = new_blob_addr;
+                               blob->csb_mem_size = size;
+                               cd = new_cd;
+                               entitlements = new_entitlements;
+                       }
+               }
+
                blob->csb_cd = cd;
                blob->csb_entitlements_blob = entitlements; /* may be NULL, not yet validated */
                blob->csb_hashtype = cs_find_md(cd->hashType);
@@ -3501,16 +3559,20 @@ ubc_cs_blob_revalidate(
        int error = 0;
        const CS_CodeDirectory *cd = NULL;
        const CS_GenericBlob *entitlements = NULL;
+       size_t size;
        assert(vp != NULL);
        assert(blob != NULL);
 
-       error = cs_validate_csblob((const uint8_t *)blob->csb_mem_kaddr, blob->csb_mem_size, &cd, &entitlements);
+       size = blob->csb_mem_size;
+       error = cs_validate_csblob((const uint8_t *)blob->csb_mem_kaddr,
+                                  &size, &cd, &entitlements);
        if (error) {
                if (cs_debug) {
                        printf("CODESIGNING: csblob invalid: %d\n", error);
                }
                goto out;
        }
+       assert(size == blob->csb_mem_size);
 
     unsigned int cs_flags = (ntohl(cd->flags) & CS_ALLOWED_MACHO) | CS_VALID;
     
index 3884b2c9409d29f40a5f3783e9b4647df70af4f2..cee3242d137690ac0a3862313db71ceac2f72788 100644 (file)
@@ -668,6 +668,9 @@ static char *mbuf_dump_buf;
 static unsigned int mb_watchdog = 0;
 static unsigned int mb_drain_maxint = 0;
 
+uintptr_t mb_obscure_extfree __attribute__((visibility("hidden")));
+uintptr_t mb_obscure_extref __attribute__((visibility("hidden")));
+
 /* Red zone */
 static u_int32_t mb_redzone_cookie;
 static void m_redzone_init(struct mbuf *);
@@ -785,13 +788,13 @@ static boolean_t mbuf_report_usage(mbuf_class_t);
 #define        EXTF_MASK       \
        (EXTF_COMPOSITE | EXTF_READONLY | EXTF_PAIRED)
 
-#define        MEXT_RFA(m)             ((m)->m_ext.ext_refflags)
-#define        MEXT_MINREF(m)          (MEXT_RFA(m)->minref)
-#define        MEXT_REF(m)             (MEXT_RFA(m)->refcnt)
-#define        MEXT_PREF(m)            (MEXT_RFA(m)->prefcnt)
-#define        MEXT_FLAGS(m)           (MEXT_RFA(m)->flags)
-#define        MEXT_PRIV(m)            (MEXT_RFA(m)->priv)
-#define        MEXT_PMBUF(m)           (MEXT_RFA(m)->paired)
+#define        MEXT_MINREF(m)          ((m_get_rfa(m))->minref)
+#define        MEXT_REF(m)             ((m_get_rfa(m))->refcnt)
+#define        MEXT_PREF(m)            ((m_get_rfa(m))->prefcnt)
+#define        MEXT_FLAGS(m)           ((m_get_rfa(m))->flags)
+#define        MEXT_PRIV(m)            ((m_get_rfa(m))->priv)
+#define        MEXT_PMBUF(m)           ((m_get_rfa(m))->paired)
+#define        MEXT_TOKEN(m)           ((m_get_rfa(m))->ext_token)
 #define        MBUF_IS_COMPOSITE(m)                                            \
        (MEXT_REF(m) == MEXT_MINREF(m) &&                               \
        (MEXT_FLAGS(m) & EXTF_MASK) == EXTF_COMPOSITE)
@@ -892,10 +895,8 @@ static boolean_t mbuf_report_usage(mbuf_class_t);
     priv, pm) {                                                                \
        (m)->m_data = (m)->m_ext.ext_buf = (buf);                       \
        (m)->m_flags |= M_EXT;                                          \
+       m_set_ext((m), (rfa), (free), (arg));                           \
        (m)->m_ext.ext_size = (size);                                   \
-       (m)->m_ext.ext_free = (free);                                   \
-       (m)->m_ext.ext_arg = (arg);                                     \
-       MEXT_RFA(m) = (rfa);                                            \
        MEXT_MINREF(m) = (min);                                         \
        MEXT_REF(m) = (ref);                                            \
        MEXT_PREF(m) = (pref);                                          \
@@ -1492,6 +1493,10 @@ mbinit(void)
        _CASSERT(sizeof (mb_redzone_cookie) ==
            sizeof (((struct pkthdr *)0)->redzone));
        read_random(&mb_redzone_cookie, sizeof (mb_redzone_cookie));
+       read_random(&mb_obscure_extref, sizeof (mb_obscure_extref));
+       read_random(&mb_obscure_extfree, sizeof (mb_obscure_extfree));
+       mb_obscure_extref |= 0x3;
+       mb_obscure_extfree |= 0x3;
 
        /* Make sure we don't save more than we should */
        _CASSERT(MCA_SAVED_MBUF_SIZE <= sizeof (struct mbuf));
@@ -2286,7 +2291,7 @@ cslab_alloc(mbuf_class_t class, mcache_obj_t ***plist, unsigned int num)
                cl = m->m_ext.ext_buf;
                clsp = slab_get(cl);
                VERIFY(m->m_flags == M_EXT && cl != NULL);
-               VERIFY(MEXT_RFA(m) != NULL && MBUF_IS_COMPOSITE(m));
+               VERIFY(m_get_rfa(m) != NULL && MBUF_IS_COMPOSITE(m));
 
                if (class == MC_MBUF_CL) {
                        VERIFY(clsp->sl_refcnt >= 1 &&
@@ -2375,7 +2380,7 @@ cslab_free(mbuf_class_t class, mcache_obj_t *list, int purged)
                }
                VERIFY(ms->m_type == MT_FREE);
                VERIFY(ms->m_flags == M_EXT);
-               VERIFY(MEXT_RFA(ms) != NULL && MBUF_IS_COMPOSITE(ms));
+               VERIFY(m_get_rfa(ms) != NULL && MBUF_IS_COMPOSITE(ms));
                if (cl_class == MC_CL) {
                        VERIFY(clsp->sl_refcnt >= 1 &&
                            clsp->sl_refcnt <= NCLPG);
@@ -2410,11 +2415,12 @@ cslab_free(mbuf_class_t class, mcache_obj_t *list, int purged)
                        MEXT_FLAGS(m) = 0;
                        MEXT_PRIV(m) = 0;
                        MEXT_PMBUF(m) = NULL;
+                       MEXT_TOKEN(m) = 0;
 
-                       rfa = (mcache_obj_t *)(void *)MEXT_RFA(m);
+                       rfa = (mcache_obj_t *)(void *)m_get_rfa(m);
+                       m_set_ext(m, NULL, NULL, NULL);
                        rfa->obj_next = ref_list;
                        ref_list = rfa;
-                       MEXT_RFA(m) = NULL;
 
                        m->m_type = MT_FREE;
                        m->m_flags = m->m_len = 0;
@@ -2625,7 +2631,7 @@ mbuf_cslab_alloc(void *arg, mcache_obj_t ***plist, unsigned int needed,
                        MBUF_CL_INIT(ms, cl, rfa, 0, EXTF_COMPOSITE);
                }
                VERIFY(ms->m_flags == M_EXT);
-               VERIFY(MEXT_RFA(ms) != NULL && MBUF_IS_COMPOSITE(ms));
+               VERIFY(m_get_rfa(ms) != NULL && MBUF_IS_COMPOSITE(ms));
 
                *list = (mcache_obj_t *)m;
                (*list)->obj_next = NULL;
@@ -2736,7 +2742,7 @@ mbuf_cslab_audit(void *arg, mcache_obj_t *list, boolean_t alloc)
                cl = ms->m_ext.ext_buf;
                clsp = slab_get(cl);
                VERIFY(ms->m_flags == M_EXT && cl != NULL);
-               VERIFY(MEXT_RFA(ms) != NULL && MBUF_IS_COMPOSITE(ms));
+               VERIFY(m_get_rfa(ms) != NULL && MBUF_IS_COMPOSITE(ms));
                if (class == MC_MBUF_CL)
                        VERIFY(clsp->sl_refcnt >= 1 &&
                            clsp->sl_refcnt <= NCLPG);
@@ -3485,8 +3491,8 @@ m_free_paired(struct mbuf *m)
                if (prefcnt > 1) {
                        return (1);
                } else if (prefcnt == 1) {
-                       (*(m->m_ext.ext_free))(m->m_ext.ext_buf,
-                           m->m_ext.ext_size, m->m_ext.ext_arg);
+                       (*(m_get_ext_free(m)))(m->m_ext.ext_buf,
+                           m->m_ext.ext_size, m_get_ext_arg(m));
                        return (1);
                } else if (prefcnt == 0) {
                        VERIFY(MBUF_IS_PAIRED(m));
@@ -3507,15 +3513,15 @@ m_free_paired(struct mbuf *m)
 
                        switch (m->m_ext.ext_size) {
                        case MCLBYTES:
-                               m->m_ext.ext_free = NULL;
+                               m_set_ext(m, m_get_rfa(m), NULL, NULL);
                                break;
 
                        case MBIGCLBYTES:
-                               m->m_ext.ext_free = m_bigfree;
+                               m_set_ext(m, m_get_rfa(m), m_bigfree, NULL);
                                break;
 
                        case M16KCLBYTES:
-                               m->m_ext.ext_free = m_16kfree;
+                               m_set_ext(m, m_get_rfa(m), m_16kfree, NULL);
                                break;
 
                        default:
@@ -3553,28 +3559,30 @@ m_free(struct mbuf *m)
        if (m->m_flags & M_EXT) {
                u_int16_t refcnt;
                u_int32_t composite;
+               m_ext_free_func_t m_free_func;
 
                if (MBUF_IS_PAIRED(m) && m_free_paired(m))
                        return (n);
 
                refcnt = m_decref(m);
                composite = (MEXT_FLAGS(m) & EXTF_COMPOSITE);
+               m_free_func = m_get_ext_free(m);
 
                if (refcnt == MEXT_MINREF(m) && !composite) {
-                       if (m->m_ext.ext_free == NULL) {
+                       if (m_free_func == NULL) {
                                mcache_free(m_cache(MC_CL), m->m_ext.ext_buf);
-                       } else if (m->m_ext.ext_free == m_bigfree) {
+                       } else if (m_free_func == m_bigfree) {
                                mcache_free(m_cache(MC_BIGCL),
                                    m->m_ext.ext_buf);
-                       } else if (m->m_ext.ext_free == m_16kfree) {
+                       } else if (m_free_func == m_16kfree) {
                                mcache_free(m_cache(MC_16KCL),
                                    m->m_ext.ext_buf);
                        } else {
-                               (*(m->m_ext.ext_free))(m->m_ext.ext_buf,
-                                   m->m_ext.ext_size, m->m_ext.ext_arg);
+                               (*m_free_func)(m->m_ext.ext_buf,
+                                   m->m_ext.ext_size, m_get_ext_arg(m));
                        }
-                       mcache_free(ref_cache, MEXT_RFA(m));
-                       MEXT_RFA(m) = NULL;
+                       mcache_free(ref_cache, m_get_rfa(m));
+                       m_set_ext(m, NULL, NULL, NULL);
                } else if (refcnt == MEXT_MINREF(m) && composite) {
                        VERIFY(!(MEXT_FLAGS(m) & EXTF_PAIRED));
                        VERIFY(m->m_type != MT_FREE);
@@ -3590,12 +3598,12 @@ m_free(struct mbuf *m)
                        MEXT_FLAGS(m) &= ~EXTF_READONLY;
 
                        /* "Free" into the intermediate cache */
-                       if (m->m_ext.ext_free == NULL) {
+                       if (m_free_func == NULL) {
                                mcache_free(m_cache(MC_MBUF_CL), m);
-                       } else if (m->m_ext.ext_free == m_bigfree) {
+                       } else if (m_free_func == m_bigfree) {
                                mcache_free(m_cache(MC_MBUF_BIGCL), m);
                        } else {
-                               VERIFY(m->m_ext.ext_free == m_16kfree);
+                               VERIFY(m_free_func == m_16kfree);
                                mcache_free(m_cache(MC_MBUF_16KCL), m);
                        }
                        return (n);
@@ -3635,25 +3643,27 @@ m_clattach(struct mbuf *m, int type, caddr_t extbuf,
        if (m->m_flags & M_EXT) {
                u_int16_t refcnt;
                u_int32_t composite;
+               m_ext_free_func_t m_free_func;
 
                refcnt = m_decref(m);
                composite = (MEXT_FLAGS(m) & EXTF_COMPOSITE);
                VERIFY(!(MEXT_FLAGS(m) & EXTF_PAIRED) && MEXT_PMBUF(m) == NULL);
+               m_free_func = m_get_ext_free(m);
                if (refcnt == MEXT_MINREF(m) && !composite) {
-                       if (m->m_ext.ext_free == NULL) {
+                       if (m_free_func == NULL) {
                                mcache_free(m_cache(MC_CL), m->m_ext.ext_buf);
-                       } else if (m->m_ext.ext_free == m_bigfree) {
+                       } else if (m_free_func == m_bigfree) {
                                mcache_free(m_cache(MC_BIGCL),
                                    m->m_ext.ext_buf);
-                       } else if (m->m_ext.ext_free == m_16kfree) {
+                       } else if (m_free_func == m_16kfree) {
                                mcache_free(m_cache(MC_16KCL),
                                    m->m_ext.ext_buf);
                        } else {
-                               (*(m->m_ext.ext_free))(m->m_ext.ext_buf,
-                                   m->m_ext.ext_size, m->m_ext.ext_arg);
+                               (*m_free_func)(m->m_ext.ext_buf,
+                                   m->m_ext.ext_size, m_get_ext_arg(m));
                        }
                        /* Re-use the reference structure */
-                       rfa = MEXT_RFA(m);
+                       rfa = m_get_rfa(m);
                } else if (refcnt == MEXT_MINREF(m) && composite) {
                        VERIFY(m->m_type != MT_FREE);
 
@@ -3668,12 +3678,12 @@ m_clattach(struct mbuf *m, int type, caddr_t extbuf,
                        MEXT_FLAGS(m) &= ~EXTF_READONLY;
 
                        /* "Free" into the intermediate cache */
-                       if (m->m_ext.ext_free == NULL) {
+                       if (m_free_func == NULL) {
                                mcache_free(m_cache(MC_MBUF_CL), m);
-                       } else if (m->m_ext.ext_free == m_bigfree) {
+                       } else if (m_free_func == m_bigfree) {
                                mcache_free(m_cache(MC_MBUF_BIGCL), m);
                        } else {
-                               VERIFY(m->m_ext.ext_free == m_16kfree);
+                               VERIFY(m_free_func == m_16kfree);
                                mcache_free(m_cache(MC_MBUF_16KCL), m);
                        }
                        /*
@@ -3725,10 +3735,10 @@ m_getcl(int wait, int type, int flags)
 
                VERIFY(m->m_type == MT_FREE && m->m_flags == M_EXT);
                cl = m->m_ext.ext_buf;
-               rfa = MEXT_RFA(m);
+               rfa = m_get_rfa(m);
 
                ASSERT(cl != NULL && rfa != NULL);
-               VERIFY(MBUF_IS_COMPOSITE(m) && m->m_ext.ext_free == NULL);
+               VERIFY(MBUF_IS_COMPOSITE(m) && m_get_ext_free(m) == NULL);
 
                flag = MEXT_FLAGS(m);
 
@@ -3795,7 +3805,7 @@ m_mclhasreference(struct mbuf *m)
        if (!(m->m_flags & M_EXT))
                return (0);
 
-       ASSERT(MEXT_RFA(m) != NULL);
+       ASSERT(m_get_rfa(m) != NULL);
 
        return ((MEXT_FLAGS(m) & EXTF_READONLY) ? 1 : 0);
 }
@@ -4035,7 +4045,7 @@ m_getpackets_internal(unsigned int *num_needed, int num_with_pkthdrs,
 
                VERIFY(m->m_type == MT_FREE && m->m_flags == M_EXT);
                cl = m->m_ext.ext_buf;
-               rfa = MEXT_RFA(m);
+               rfa = m_get_rfa(m);
 
                ASSERT(cl != NULL && rfa != NULL);
                VERIFY(MBUF_IS_COMPOSITE(m));
@@ -4340,6 +4350,7 @@ m_allocpacket_internal(unsigned int *numlist, size_t packetlen,
                struct ext_ref *rfa;
                void *cl;
                int pkthdr;
+               m_ext_free_func_t m_free_func;
 
                ++num;
                if (nsegs == 1 || (num % nsegs) != 0 || resid == 0) {
@@ -4349,14 +4360,14 @@ m_allocpacket_internal(unsigned int *numlist, size_t packetlen,
                        m = (struct mbuf *)rmp_list;
                        rmp_list = rmp_list->obj_next;
                }
+               m_free_func = m_get_ext_free(m);
                ASSERT(m != NULL);
                VERIFY(m->m_type == MT_FREE && m->m_flags == M_EXT);
-               VERIFY(m->m_ext.ext_free == NULL ||
-                   m->m_ext.ext_free == m_bigfree ||
-                   m->m_ext.ext_free == m_16kfree);
+               VERIFY(m_free_func == NULL || m_free_func == m_bigfree ||
+                   m_free_func == m_16kfree);
 
                cl = m->m_ext.ext_buf;
-               rfa = MEXT_RFA(m);
+               rfa = m_get_rfa(m);
 
                ASSERT(cl != NULL && rfa != NULL);
                VERIFY(MBUF_IS_COMPOSITE(m));
@@ -4367,9 +4378,9 @@ m_allocpacket_internal(unsigned int *numlist, size_t packetlen,
                if (pkthdr)
                        first = m;
                MBUF_INIT(m, pkthdr, MT_DATA);
-               if (m->m_ext.ext_free == m_16kfree) {
+               if (m_free_func == m_16kfree) {
                        MBUF_16KCL_INIT(m, cl, rfa, 1, flag);
-               } else if (m->m_ext.ext_free == m_bigfree) {
+               } else if (m_free_func == m_bigfree) {
                        MBUF_BIGCL_INIT(m, cl, rfa, 1, flag);
                } else {
                        MBUF_CL_INIT(m, cl, rfa, 1, flag);
@@ -4516,6 +4527,7 @@ m_freem_list(struct mbuf *m)
                        mcache_obj_t *o, *rfa;
                        u_int32_t composite;
                        u_int16_t refcnt;
+                       m_ext_free_func_t m_free_func;
 
                        if (m->m_type == MT_FREE)
                                panic("m_free: freeing an already freed mbuf");
@@ -4542,26 +4554,26 @@ m_freem_list(struct mbuf *m)
                        o = (mcache_obj_t *)(void *)m->m_ext.ext_buf;
                        refcnt = m_decref(m);
                        composite = (MEXT_FLAGS(m) & EXTF_COMPOSITE);
-
+                       m_free_func = m_get_ext_free(m);
                        if (refcnt == MEXT_MINREF(m) && !composite) {
-                               if (m->m_ext.ext_free == NULL) {
+                               if (m_free_func == NULL) {
                                        o->obj_next = mcl_list;
                                        mcl_list = o;
-                               } else if (m->m_ext.ext_free == m_bigfree) {
+                               } else if (m_free_func == m_bigfree) {
                                        o->obj_next = mbc_list;
                                        mbc_list = o;
-                               } else if (m->m_ext.ext_free == m_16kfree) {
+                               } else if (m_free_func == m_16kfree) {
                                        o->obj_next = m16k_list;
                                        m16k_list = o;
                                } else {
-                                       (*(m->m_ext.ext_free))((caddr_t)o,
+                                       (*(m_free_func))((caddr_t)o,
                                            m->m_ext.ext_size,
-                                           m->m_ext.ext_arg);
+                                           m_get_ext_arg(m));
                                }
-                               rfa = (mcache_obj_t *)(void *)MEXT_RFA(m);
+                               rfa = (mcache_obj_t *)(void *)m_get_rfa(m);
                                rfa->obj_next = ref_list;
                                ref_list = rfa;
-                               MEXT_RFA(m) = NULL;
+                               m_set_ext(m, NULL, NULL, NULL);
                        } else if (refcnt == MEXT_MINREF(m) && composite) {
                                VERIFY(!(MEXT_FLAGS(m) & EXTF_PAIRED));
                                VERIFY(m->m_type != MT_FREE);
@@ -4589,14 +4601,14 @@ m_freem_list(struct mbuf *m)
 
                                /* "Free" into the intermediate cache */
                                o = (mcache_obj_t *)m;
-                               if (m->m_ext.ext_free == NULL) {
+                               if (m_free_func == NULL) {
                                        o->obj_next = m_mcl_list;
                                        m_mcl_list = o;
-                               } else if (m->m_ext.ext_free == m_bigfree) {
+                               } else if (m_free_func == m_bigfree) {
                                        o->obj_next = m_mbc_list;
                                        m_mbc_list = o;
                                } else {
-                                       VERIFY(m->m_ext.ext_free == m_16kfree);
+                                       VERIFY(m_free_func == m_16kfree);
                                        o->obj_next = m_m16k_list;
                                        m_m16k_list = o;
                                }
@@ -6835,7 +6847,7 @@ mcl_audit_restore_mbuf(struct mbuf *m, mcache_audit_t *mca, boolean_t composite)
 
        if (composite) {
                struct mbuf *next = m->m_next;
-               VERIFY(ms->m_flags == M_EXT && MEXT_RFA(ms) != NULL &&
+               VERIFY(ms->m_flags == M_EXT && m_get_rfa(ms) != NULL &&
                    MBUF_IS_COMPOSITE(ms));
                VERIFY(mca->mca_contents_size == AUDIT_CONTENTS_SIZE);
                /*
@@ -7484,7 +7496,7 @@ m_ext_paired_activate(struct mbuf *m)
        struct ext_ref *rfa;
        int hdr, type;
        caddr_t extbuf;
-       void *extfree;
+       m_ext_free_func_t extfree;
        u_int extsize;
 
        VERIFY(MBUF_IS_PAIRED(m));
@@ -7494,9 +7506,9 @@ m_ext_paired_activate(struct mbuf *m)
        hdr = (m->m_flags & M_PKTHDR);
        type = m->m_type;
        extbuf = m->m_ext.ext_buf;
-       extfree = m->m_ext.ext_free;
+       extfree = m_get_ext_free(m);
        extsize = m->m_ext.ext_size;
-       rfa = MEXT_RFA(m);
+       rfa = m_get_rfa(m);
 
        VERIFY(extbuf != NULL && rfa != NULL);
 
@@ -7590,6 +7602,93 @@ m_redzone_verify(struct mbuf *m)
        }
 }
 
+__private_extern__ inline void
+m_set_ext(struct mbuf *m, struct ext_ref *rfa, m_ext_free_func_t ext_free,
+    caddr_t ext_arg)
+{
+       VERIFY(m->m_flags & M_EXT);
+       if (rfa != NULL) {
+               m->m_ext.ext_refflags =
+                   (struct ext_ref *)(((uintptr_t)rfa) ^ mb_obscure_extref);
+               if (ext_free != NULL) {
+                       rfa->ext_token = ((uintptr_t)&rfa->ext_token) ^
+                           mb_obscure_extfree;
+                       m->m_ext.ext_free = (m_ext_free_func_t)
+                           (((uintptr_t)ext_free) ^ rfa->ext_token);
+                       if (ext_arg != NULL) {
+                               m->m_ext.ext_arg = (((uintptr_t)ext_arg) ^
+                                   rfa->ext_token);
+                       } else {
+                               m->m_ext.ext_arg = NULL;
+                       }
+               } else {
+                       rfa->ext_token = 0;
+                       m->m_ext.ext_free = NULL;
+                       m->m_ext.ext_arg = NULL;
+               }
+       } else {
+               /*
+                * If we are going to loose the cookie in ext_token by
+                * resetting the rfa, we should use the global cookie
+                * to obscure the ext_free and ext_arg pointers.
+                */
+               if (ext_free != NULL) {
+                       m->m_ext.ext_free = ((uintptr_t)ext_free ^
+                           mb_obscure_extfree);
+                       if (ext_arg != NULL) {
+                               m->m_ext.ext_arg = ((uintptr_t)ext_arg ^
+                                   mb_obscure_extfree);
+                       } else {
+                               m->m_ext.ext_arg = NULL;
+                       }
+               } else {
+                       m->m_ext.ext_free = NULL;
+                       m->m_ext.ext_arg = NULL;
+               }
+               m->m_ext.ext_refflags = NULL;
+       }
+}
+
+__private_extern__ inline struct ext_ref *
+m_get_rfa(struct mbuf *m)
+{
+       if (m->m_ext.ext_refflags == NULL)
+               return (NULL);
+       else
+               return ((struct ext_ref *)(((uintptr_t)m->m_ext.ext_refflags) ^ mb_obscure_extref));
+}
+
+__private_extern__ inline m_ext_free_func_t
+m_get_ext_free(struct mbuf *m)
+{
+       struct ext_ref *rfa;
+       if (m->m_ext.ext_free == NULL)
+               return (NULL);
+
+       rfa = m_get_rfa(m);
+       if (rfa == NULL)
+               return ((uintptr_t)m->m_ext.ext_free ^ mb_obscure_extfree);
+       else
+               return ((m_ext_free_func_t)(((uintptr_t)m->m_ext.ext_free)
+                   ^ rfa->ext_token));
+}
+
+__private_extern__ inline caddr_t
+m_get_ext_arg(struct mbuf *m)
+{
+       struct ext_ref *rfa;
+       if (m->m_ext.ext_arg == NULL)
+               return (NULL);
+
+       rfa = m_get_rfa(m);
+       if (rfa == NULL) {
+               return ((uintptr_t)m->m_ext.ext_arg ^ mb_obscure_extfree);
+       } else {
+               return ((caddr_t)(((uintptr_t)m->m_ext.ext_arg) ^
+                   rfa->ext_token));
+       }
+}
+
 /*
  * Send a report of mbuf usage if the usage is at least 6% of max limit
  * or if there has been at least 3% increase since the last report.
index a56ffa99077d5132b03ce78cd37ff420e80fcf51..74ac53ba70f46fdc4b5f94e7cc0067666f538098 100644 (file)
@@ -294,7 +294,7 @@ m_pulldown(struct mbuf *m, int off, int len, int *offp)
        if ((n->m_flags & M_EXT) == 0)
                sharedcluster = 0;
        else {
-               if (n->m_ext.ext_free)
+               if (m_get_ext_free(n) != NULL)
                        sharedcluster = 1;
                else if (m_mclhasreference(n))
                        sharedcluster = 1;
index c552c417506e20ce08114831f06e7446b9054bd8..aa41e355a22ba151eda7ce48f9a53e7665d7f5dd 100644 (file)
@@ -321,18 +321,18 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, notsent_lowat, CTLFLAG_RW|CTLFLAG_LOCKED,
     &so_notsent_lowat_check, 0, "enable/disable notsnet lowat check");
 #endif /* DEBUG || DEVELOPMENT */
 
+int so_accept_list_waits = 0;
+#if (DEBUG || DEVELOPMENT)
+SYSCTL_INT(_kern_ipc, OID_AUTO, accept_list_waits, CTLFLAG_RW|CTLFLAG_LOCKED,
+    &so_accept_list_waits, 0, "number of waits for listener incomp list");
+#endif /* DEBUG || DEVELOPMENT */
+
 extern struct inpcbinfo tcbinfo;
 
 /* TODO: these should be in header file */
 extern int get_inpcb_str_size(void);
 extern int get_tcp_str_size(void);
 
-static unsigned int sl_zone_size;              /* size of sockaddr_list */
-static struct zone *sl_zone;                   /* zone for sockaddr_list */
-
-static unsigned int se_zone_size;              /* size of sockaddr_entry */
-static struct zone *se_zone;                   /* zone for sockaddr_entry */
-
 vm_size_t      so_cache_zone_element_size;
 
 static int sodelayed_copy(struct socket *, struct uio *, struct mbuf **,
@@ -436,24 +436,6 @@ socketinit(void)
        zone_change(so_cache_zone, Z_CALLERACCT, FALSE);
        zone_change(so_cache_zone, Z_NOENCRYPT, TRUE);
 
-       sl_zone_size = sizeof (struct sockaddr_list);
-       if ((sl_zone = zinit(sl_zone_size, 1024 * sl_zone_size, 1024,
-           "sockaddr_list")) == NULL) {
-               panic("%s: unable to allocate sockaddr_list zone\n", __func__);
-               /* NOTREACHED */
-       }
-       zone_change(sl_zone, Z_CALLERACCT, FALSE);
-       zone_change(sl_zone, Z_EXPAND, TRUE);
-
-       se_zone_size = sizeof (struct sockaddr_entry);
-       if ((se_zone = zinit(se_zone_size, 1024 * se_zone_size, 1024,
-           "sockaddr_entry")) == NULL) {
-               panic("%s: unable to allocate sockaddr_entry zone\n", __func__);
-               /* NOTREACHED */
-       }
-       zone_change(se_zone, Z_CALLERACCT, FALSE);
-       zone_change(se_zone, Z_EXPAND, TRUE);
-
        bzero(&soextbkidlestat, sizeof(struct soextbkidlestat));
        soextbkidlestat.so_xbkidle_maxperproc = SO_IDLE_BK_IDLE_MAX_PER_PROC;
        soextbkidlestat.so_xbkidle_time = SO_IDLE_BK_IDLE_TIME;
@@ -1053,6 +1035,75 @@ out:
        return (error);
 }
 
+/*
+ * The "accept list lock" protects the fields related to the listener queues
+ * because we can unlock a socket to respect the lock ordering between
+ * the listener socket and its clients sockets. The lock ordering is first to
+ * acquire the client socket before the listener socket.
+ *
+ * The accept list lock serializes access to the following fields:
+ * - of the listener socket:
+ *   - so_comp
+ *   - so_incomp
+ *   - so_qlen
+ *   - so_inqlen
+ * - of client sockets that are in so_comp or so_incomp:
+ *   - so_head
+ *   - so_list
+ *
+ * As one can see the accept list lock protects the consistent of the
+ * linkage of the client sockets.
+ *
+ * Note that those fields may be read without holding the accept list lock
+ * for a preflight provided the accept list lock is taken when committing
+ * to take an action based on the result of the preflight. The preflight
+ * saves the cost of doing the unlock/lock dance.
+ */
+void
+so_acquire_accept_list(struct socket *head, struct socket *so)
+{
+       lck_mtx_t *mutex_held;
+
+       if (head->so_proto->pr_getlock == NULL) {
+               return;
+       }
+       mutex_held = (*head->so_proto->pr_getlock)(head, 0);
+       lck_mtx_assert(mutex_held, LCK_MTX_ASSERT_OWNED);
+
+       if (!(head->so_flags1 & SOF1_ACCEPT_LIST_HELD)) {
+               head->so_flags1 |= SOF1_ACCEPT_LIST_HELD;
+               return;
+       }
+       if (so != NULL) {
+               socket_unlock(so, 0);
+       }
+       while (head->so_flags1 & SOF1_ACCEPT_LIST_HELD) {
+               so_accept_list_waits += 1;
+               msleep((caddr_t)&head->so_incomp, mutex_held,
+                   PSOCK | PCATCH, __func__, NULL);
+       }
+       head->so_flags1 |= SOF1_ACCEPT_LIST_HELD;
+       if (so != NULL) {
+               socket_unlock(head, 0);
+               socket_lock(so, 0);
+               socket_lock(head, 0);
+       }
+}
+
+void
+so_release_accept_list(struct socket *head)
+{
+       if (head->so_proto->pr_getlock != NULL) {
+               lck_mtx_t *mutex_held;
+
+               mutex_held = (*head->so_proto->pr_getlock)(head, 0);
+               lck_mtx_assert(mutex_held, LCK_MTX_ASSERT_OWNED);
+       
+               head->so_flags1 &= ~SOF1_ACCEPT_LIST_HELD;
+               wakeup((caddr_t)&head->so_incomp);
+       }
+}
+
 void
 sofreelastref(struct socket *so, int dealloc)
 {
@@ -1073,16 +1124,26 @@ sofreelastref(struct socket *so, int dealloc)
                 * Need to lock the listener when the protocol has
                 * per socket locks
                 */
-               if (head->so_proto->pr_getlock != NULL)
+               if (head->so_proto->pr_getlock != NULL) {
                        socket_lock(head, 1);
-
+                       so_acquire_accept_list(head, so);
+               }
                if (so->so_state & SS_INCOMP) {
                        so->so_state &= ~SS_INCOMP;
                        TAILQ_REMOVE(&head->so_incomp, so, so_list);
                        head->so_incqlen--;
                        head->so_qlen--;
                        so->so_head = NULL;
+
+                       if (head->so_proto->pr_getlock != NULL) {
+                               so_release_accept_list(head);
+                               socket_unlock(head, 1);
+                       }
                } else if (so->so_state & SS_COMP) {
+                       if (head->so_proto->pr_getlock != NULL) {
+                               so_release_accept_list(head);
+                               socket_unlock(head, 1);
+                       }
                        /*
                         * We must not decommission a socket that's
                         * on the accept(2) queue.  If we do, then
@@ -1094,14 +1155,14 @@ sofreelastref(struct socket *so, int dealloc)
                        so->so_rcv.sb_flags &= ~(SB_SEL|SB_UPCALL);
                        so->so_snd.sb_flags &= ~(SB_SEL|SB_UPCALL);
                        so->so_event = sonullevent;
-                       if (head->so_proto->pr_getlock != NULL)
-                               socket_unlock(head, 1);
                        return;
                } else {
-                       panic("sofree: not queued");
+                       if (head->so_proto->pr_getlock != NULL) {
+                               so_release_accept_list(head);
+                               socket_unlock(head, 1);
+                       }
+                       printf("sofree: not queued\n");
                }
-               if (head->so_proto->pr_getlock != NULL)
-                       socket_unlock(head, 1);
        }
        sowflush(so);
        sorflush(so);
@@ -1156,7 +1217,6 @@ int
 soclose_locked(struct socket *so)
 {
        int error = 0;
-       lck_mtx_t *mutex_held;
        struct timespec ts;
 
        if (so->so_usecount == 0) {
@@ -1186,7 +1246,9 @@ soclose_locked(struct socket *so)
        }
 
        if ((so->so_options & SO_ACCEPTCONN)) {
-               struct socket *sp;
+               struct socket *sp, *sonext;
+               int persocklock = 0;
+               int incomp_overflow_only;
 
                /*
                 * We do not want new connection to be added
@@ -1194,9 +1256,19 @@ soclose_locked(struct socket *so)
                 */
                so->so_options &= ~SO_ACCEPTCONN;
 
-               while ((sp = TAILQ_FIRST(&so->so_incomp)) != NULL) {
-                       int socklock = 0;
+               /*
+                * We can drop the lock on the listener once
+                * we've acquired the incoming list
+                */
+               if (so->so_proto->pr_getlock != NULL) {
+                       persocklock = 1;
+                       so_acquire_accept_list(so, NULL);
+                       socket_unlock(so, 0);
+               }
+again:
+               incomp_overflow_only = 1;
 
+               TAILQ_FOREACH_SAFE(sp, &so->so_incomp, so_list, sonext) {
                        /*
                         * Radar 5350314
                         * skip sockets thrown away by tcpdropdropblreq
@@ -1207,17 +1279,8 @@ soclose_locked(struct socket *so)
                        if (sp->so_flags & SOF_OVERFLOW)
                                continue;
 
-                       if (so->so_proto->pr_getlock != NULL) {
-                               /*
-                                * Lock ordering for consistency with the
-                                * rest of the stack, we lock the socket
-                                * first and then grab the head.
-                                */
-                               socket_unlock(so, 0);
+                       if (persocklock != 0)
                                socket_lock(sp, 1);
-                               socket_lock(so, 0);
-                               socklock = 1;
-                       }
 
                        /*
                         * Radar 27945981
@@ -1233,27 +1296,19 @@ soclose_locked(struct socket *so)
                                so->so_qlen--;
 
                                (void) soabort(sp);
+                       } else {
+                               panic("%s sp %p in so_incomp but !SS_INCOMP",
+                                   __func__, sp);
                        }
 
-                       if (socklock != 0)
+                       if (persocklock != 0)
                                socket_unlock(sp, 1);
                }
 
-               while ((sp = TAILQ_FIRST(&so->so_comp)) != NULL) {
-                       int socklock = 0;
-                       
+               TAILQ_FOREACH_SAFE(sp, &so->so_comp, so_list, sonext) {
                        /* Dequeue from so_comp since sofree() won't do it */
-                       if (so->so_proto->pr_getlock != NULL) {
-                               /*
-                                * Lock ordering for consistency with the
-                                * rest of the stack, we lock the socket
-                                * first and then grab the head.
-                                */
-                               socket_unlock(so, 0);
+                       if (persocklock != 0)
                                socket_lock(sp, 1);
-                               socket_lock(so, 0);
-                               socklock = 1;
-                       }
 
                        if (sp->so_state & SS_COMP) {
                                sp->so_state &= ~SS_COMP;
@@ -1262,12 +1317,36 @@ soclose_locked(struct socket *so)
                                so->so_qlen--;
 
                                (void) soabort(sp);
+                       } else {
+                               panic("%s sp %p in so_comp but !SS_COMP",
+                                   __func__, sp);
                        }
 
-                       if (socklock)
+                       if (persocklock)
                                socket_unlock(sp, 1);
                        }
+
+               if (incomp_overflow_only == 0 && !TAILQ_EMPTY(&so->so_incomp)) {
+#if (DEBUG|DEVELOPMENT)
+                       panic("%s head %p so_comp not empty\n", __func__, so);
+#endif /* (DEVELOPMENT || DEBUG) */
+
+                       goto again;
                }
+
+               if (!TAILQ_EMPTY(&so->so_comp)) {
+#if (DEBUG|DEVELOPMENT)
+                       panic("%s head %p so_comp not empty\n", __func__, so);
+#endif /* (DEVELOPMENT || DEBUG) */
+
+                       goto again;
+               }
+
+               if (persocklock) {
+                       socket_lock(so, 0);
+                       so_release_accept_list(so);
+               }
+       }
        if (so->so_pcb == NULL) {
                /* 3915887: mark the socket as ready for dealloc */
                so->so_flags |= SOF_PCBCLEARING;
@@ -1280,6 +1359,8 @@ soclose_locked(struct socket *so)
                                goto drop;
                }
                if (so->so_options & SO_LINGER) {
+                       lck_mtx_t *mutex_held;
+
                        if ((so->so_state & SS_ISDISCONNECTING) &&
                            (so->so_state & SS_NBIO))
                                goto drop;
@@ -1594,8 +1675,8 @@ soconnect2(struct socket *so1, struct socket *so2)
 }
 
 int
-soconnectxlocked(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
+soconnectxlocked(struct socket *so, struct sockaddr *src,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope,
     sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
     uint32_t arglen, uio_t auio, user_ssize_t *bytes_written)
 {
@@ -1639,7 +1720,7 @@ soconnectxlocked(struct socket *so, struct sockaddr_list **src_sl,
                 * Run connect filter before calling protocol:
                 *  - non-blocking connect returns before completion;
                 */
-               error = sflt_connectxout(so, dst_sl);
+               error = sflt_connectout(so, dst);
                if (error != 0) {
                        /* Disable PRECONNECT_DATA, as we don't need to send a SYN anymore. */
                        so->so_flags1 &= ~SOF1_PRECONNECT_DATA;
@@ -1647,7 +1728,7 @@ soconnectxlocked(struct socket *so, struct sockaddr_list **src_sl,
                                error = 0;
                } else {
                        error = (*so->so_proto->pr_usrreqs->pru_connectx)
-                           (so, src_sl, dst_sl, p, ifscope, aid, pcid,
+                           (so, src, dst, p, ifscope, aid, pcid,
                            flags, arg, arglen, auio, bytes_written);
                }
        }
@@ -7142,125 +7223,6 @@ so_get_restrictions(struct socket *so)
            SO_RESTRICT_DENY_CELLULAR | SO_RESTRICT_DENY_EXPENSIVE));
 }
 
-struct sockaddr_entry *
-sockaddrentry_alloc(int how)
-{
-       struct sockaddr_entry *se;
-
-       se = (how == M_WAITOK) ? zalloc(se_zone) : zalloc_noblock(se_zone);
-       if (se != NULL)
-               bzero(se, se_zone_size);
-
-       return (se);
-}
-
-void
-sockaddrentry_free(struct sockaddr_entry *se)
-{
-       if (se->se_addr != NULL) {
-               FREE(se->se_addr, M_SONAME);
-               se->se_addr = NULL;
-       }
-       zfree(se_zone, se);
-}
-
-struct sockaddr_entry *
-sockaddrentry_dup(const struct sockaddr_entry *src_se, int how)
-{
-       struct sockaddr_entry *dst_se;
-
-       dst_se = sockaddrentry_alloc(how);
-       if (dst_se != NULL) {
-               int len = src_se->se_addr->sa_len;
-
-               MALLOC(dst_se->se_addr, struct sockaddr *,
-                   len, M_SONAME, how | M_ZERO);
-               if (dst_se->se_addr != NULL) {
-                       bcopy(src_se->se_addr, dst_se->se_addr, len);
-               } else {
-                       sockaddrentry_free(dst_se);
-                       dst_se = NULL;
-               }
-       }
-
-       return (dst_se);
-}
-
-struct sockaddr_list *
-sockaddrlist_alloc(int how)
-{
-       struct sockaddr_list *sl;
-
-       sl = (how == M_WAITOK) ? zalloc(sl_zone) : zalloc_noblock(sl_zone);
-       if (sl != NULL) {
-               bzero(sl, sl_zone_size);
-               TAILQ_INIT(&sl->sl_head);
-       }
-       return (sl);
-}
-
-void
-sockaddrlist_free(struct sockaddr_list *sl)
-{
-       struct sockaddr_entry *se, *tse;
-
-       TAILQ_FOREACH_SAFE(se, &sl->sl_head, se_link, tse) {
-               sockaddrlist_remove(sl, se);
-               sockaddrentry_free(se);
-       }
-       VERIFY(sl->sl_cnt == 0 && TAILQ_EMPTY(&sl->sl_head));
-       zfree(sl_zone, sl);
-}
-
-void
-sockaddrlist_insert(struct sockaddr_list *sl, struct sockaddr_entry *se)
-{
-       VERIFY(!(se->se_flags & SEF_ATTACHED));
-       se->se_flags |= SEF_ATTACHED;
-       TAILQ_INSERT_TAIL(&sl->sl_head, se, se_link);
-       sl->sl_cnt++;
-       VERIFY(sl->sl_cnt != 0);
-}
-
-void
-sockaddrlist_remove(struct sockaddr_list *sl, struct sockaddr_entry *se)
-{
-       VERIFY(se->se_flags & SEF_ATTACHED);
-       se->se_flags &= ~SEF_ATTACHED;
-       VERIFY(sl->sl_cnt != 0);
-       sl->sl_cnt--;
-       TAILQ_REMOVE(&sl->sl_head, se, se_link);
-}
-
-struct sockaddr_list *
-sockaddrlist_dup(const struct sockaddr_list *src_sl, int how)
-{
-       struct sockaddr_entry *src_se, *tse;
-       struct sockaddr_list *dst_sl;
-
-       dst_sl = sockaddrlist_alloc(how);
-       if (dst_sl == NULL)
-               return (NULL);
-
-       TAILQ_FOREACH_SAFE(src_se, &src_sl->sl_head, se_link, tse) {
-               struct sockaddr_entry *dst_se;
-
-               if (src_se->se_addr == NULL)
-                       continue;
-
-               dst_se = sockaddrentry_dup(src_se, how);
-               if (dst_se == NULL) {
-                       sockaddrlist_free(dst_sl);
-                       return (NULL);
-               }
-
-               sockaddrlist_insert(dst_sl, dst_se);
-       }
-       VERIFY(src_sl->sl_cnt == dst_sl->sl_cnt);
-
-       return (dst_sl);
-}
-
 int
 so_set_effective_pid(struct socket *so, int epid, struct proc *p)
 {
index 0817894dfd351358286da9e5dcadb77307f6ad89..45c15184826def5e3193e479ae7e5bcebd0af570 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2015 Apple Inc. All rights reserved.
+ * Copyright (c) 1998-2017 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -183,7 +183,6 @@ u_int32_t net_io_policy_uuid = 1;   /* enable UUID socket policy */
 void
 soisconnecting(struct socket *so)
 {
-
        so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING);
        so->so_state |= SS_ISCONNECTING;
 
@@ -193,7 +192,6 @@ soisconnecting(struct socket *so)
 void
 soisconnected(struct socket *so)
 {
-
        so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
        so->so_state |= SS_ISCONNECTED;
 
@@ -204,35 +202,42 @@ soisconnected(struct socket *so)
        if (so->so_head != NULL && (so->so_state & SS_INCOMP)) {
                struct socket *head = so->so_head;
                int locked = 0;
-               
+
                /*
                 * Enforce lock order when the protocol has per socket locks
                 */
                if (head->so_proto->pr_getlock != NULL) {
-                       socket_unlock(so, 0);
                        socket_lock(head, 1);
-                       socket_lock(so, 0);
+                       so_acquire_accept_list(head, so);
                        locked = 1;
                }
                if (so->so_head == head && (so->so_state & SS_INCOMP)) {
                        so->so_state &= ~SS_INCOMP;
                        so->so_state |= SS_COMP;
-               TAILQ_REMOVE(&head->so_incomp, so, so_list);
+                       TAILQ_REMOVE(&head->so_incomp, so, so_list);
                        TAILQ_INSERT_TAIL(&head->so_comp, so, so_list);
-               head->so_incqlen--;
-               
-                       if (locked != 0)
+                       head->so_incqlen--;
+
+                       /*
+                        * We have to release the accept list in
+                        * case a socket callback calls sock_accept()
+                        */
+                       if (locked != 0) {
+                               so_release_accept_list(head);
                                socket_unlock(so, 0);
-               
+                       }
                        postevent(head, 0, EV_RCONN);
-               sorwakeup(head);
-               wakeup_one((caddr_t)&head->so_timeo);
+                       sorwakeup(head);
+                       wakeup_one((caddr_t)&head->so_timeo);
 
-                       if (locked != 0)
-                       socket_lock(so, 0);
+                       if (locked != 0) {
+                               socket_unlock(head, 1);
+                               socket_lock(so, 0);
                }
-               if (locked != 0)
+               } else if (locked != 0) {
+                       so_release_accept_list(head);
                        socket_unlock(head, 1);
+               }
        } else {
                postevent(so, 0, EV_WCONN);
                wakeup((caddr_t)&so->so_timeo);
@@ -433,6 +438,8 @@ sonewconn_internal(struct socket *head, int connstatus)
        atomic_add_32(&so->so_proto->pr_domain->dom_refs, 1);
 
        /* Insert in head appropriate lists */
+       so_acquire_accept_list(head, NULL);
+
        so->so_head = head;
 
        /*
@@ -454,6 +461,8 @@ sonewconn_internal(struct socket *head, int connstatus)
        }
        head->so_qlen++;
 
+       so_release_accept_list(head);
+
        /* Attach socket filters for this protocol */
        sflt_initsock(so);
 
@@ -2083,12 +2092,12 @@ pru_connect2_notsupp(struct socket *so1, struct socket *so2)
 }
 
 int
-pru_connectx_notsupp(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
+pru_connectx_notsupp(struct socket *so, struct sockaddr *src,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope,
     sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
     uint32_t arglen, struct uio *uio, user_ssize_t *bytes_written)
 {
-#pragma unused(so, src_sl, dst_sl, p, ifscope, aid, pcid, flags, arg, arglen, uio, bytes_written)
+#pragma unused(so, src, dst, p, ifscope, aid, pcid, flags, arg, arglen, uio, bytes_written)
        return (EOPNOTSUPP);
 }
 
index 603f8b34d6e370ef5219c5fef63feff93e0d3344..0aaba750a1c777473cd41da8a4fdc5a31fc170d2 100644 (file)
@@ -148,15 +148,13 @@ static int getsockaddr(struct socket *, struct sockaddr **, user_addr_t,
     size_t, boolean_t);
 static int getsockaddr_s(struct socket *, struct sockaddr_storage *,
     user_addr_t, size_t, boolean_t);
-static int getsockaddrlist(struct socket *, struct sockaddr_list **,
-    user_addr_t, socklen_t, boolean_t);
 #if SENDFILE
 static void alloc_sendpkt(int, size_t, unsigned int *, struct mbuf **,
     boolean_t);
 #endif /* SENDFILE */
 static int connectx_nocancel(struct proc *, struct connectx_args *, int *);
-static int connectitx(struct socket *, struct sockaddr_list **,
-    struct sockaddr_list **, struct proc *, uint32_t, sae_associd_t,
+static int connectitx(struct socket *, struct sockaddr *,
+    struct sockaddr *, struct proc *, uint32_t, sae_associd_t,
     sae_connid_t *, uio_t, unsigned int, user_ssize_t *);
 static int peeloff_nocancel(struct proc *, struct peeloff_args *, int *);
 static int disconnectx_nocancel(struct proc *, struct disconnectx_args *,
@@ -458,6 +456,7 @@ accept_nocancel(struct proc *p, struct accept_nocancel_args *uap,
                socket_unlock(head, 1);
                goto out;
        }
+check_again:
        if ((head->so_state & SS_NBIO) && head->so_comp.tqh_first == NULL) {
                socket_unlock(head, 1);
                error = EWOULDBLOCK;
@@ -499,11 +498,20 @@ accept_nocancel(struct proc *p, struct accept_nocancel_args *uap,
         * instead.
         */
        lck_mtx_assert(mutex_held, LCK_MTX_ASSERT_OWNED);
+
+       so_acquire_accept_list(head, NULL);
+       if (TAILQ_EMPTY(&head->so_comp)) {
+               so_release_accept_list(head);
+               goto check_again;
+       }
+
        so = TAILQ_FIRST(&head->so_comp);
        TAILQ_REMOVE(&head->so_comp, so, so_list);
        so->so_head = NULL;
        so->so_state &= ~SS_COMP;
        head->so_qlen--;
+       so_release_accept_list(head);
+
        /* unlock head to avoid deadlock with select, keep a ref on head */
        socket_unlock(head, 0);
 
@@ -725,7 +733,8 @@ static int
 connectx_nocancel(struct proc *p, struct connectx_args *uap, int *retval)
 {
 #pragma unused(p, retval)
-       struct sockaddr_list *src_sl = NULL, *dst_sl = NULL;
+       struct sockaddr_storage ss, sd;
+       struct sockaddr *src = NULL, *dst = NULL;
        struct socket *so;
        int error, error1, fd = uap->socket;
        boolean_t dgram;
@@ -779,28 +788,38 @@ connectx_nocancel(struct proc *p, struct connectx_args *uap, int *retval)
         */
        dgram = (so->so_type == SOCK_DGRAM);
 
-       /*
-        * Get socket address(es) now before we obtain socket lock; use
-        * sockaddr_list for src address for convenience, if present,
-        * even though it won't hold more than one.
-        */
-       if (ep.sae_srcaddr != USER_ADDR_NULL && (error = getsockaddrlist(so,
-           &src_sl, (user_addr_t)(caddr_t)ep.sae_srcaddr, ep.sae_srcaddrlen,
-           dgram)) != 0)
-               goto out;
+       /* Get socket address now before we obtain socket lock */
+       if (ep.sae_srcaddr != USER_ADDR_NULL) {
+               if (ep.sae_srcaddrlen > sizeof (ss)) {
+                       error = getsockaddr(so, &src, ep.sae_srcaddr, ep.sae_srcaddrlen, dgram);
+               } else {
+                       error = getsockaddr_s(so, &ss, ep.sae_srcaddr, ep.sae_srcaddrlen, dgram);
+                       if (error == 0)
+                               src = (struct sockaddr *)&ss;
+               }
+
+               if (error)
+                       goto out;
+       }
 
        if (ep.sae_dstaddr == USER_ADDR_NULL) {
                error = EINVAL;
                goto out;
        }
 
-       error = getsockaddrlist(so, &dst_sl, (user_addr_t)(caddr_t)ep.sae_dstaddr,
-           ep.sae_dstaddrlen, dgram);
-       if (error != 0)
+       /* Get socket address now before we obtain socket lock */
+       if (ep.sae_dstaddrlen > sizeof (sd)) {
+               error = getsockaddr(so, &dst, ep.sae_dstaddr, ep.sae_dstaddrlen, dgram);
+       } else {
+               error = getsockaddr_s(so, &sd, ep.sae_dstaddr, ep.sae_dstaddrlen, dgram);
+               if (error == 0)
+                       dst = (struct sockaddr *)&sd;
+       }
+
+       if (error)
                goto out;
 
-       VERIFY(dst_sl != NULL &&
-           !TAILQ_EMPTY(&dst_sl->sl_head) && dst_sl->sl_cnt > 0);
+       VERIFY(dst != NULL);
 
        if (uap->iov != USER_ADDR_NULL) {
                /* Verify range before calling uio_create() */
@@ -842,7 +861,7 @@ connectx_nocancel(struct proc *p, struct connectx_args *uap, int *retval)
                }
        }
 
-       error = connectitx(so, &src_sl, &dst_sl, p, ep.sae_srcif, uap->associd,
+       error = connectitx(so, src, dst, p, ep.sae_srcif, uap->associd,
            &cid, auio, uap->flags, &bytes_written);
        if (error == ERESTART)
                error = EINTR;
@@ -865,10 +884,10 @@ out:
        if (auio != NULL) {
                uio_free(auio);
        }
-       if (src_sl != NULL)
-               sockaddrlist_free(src_sl);
-       if (dst_sl != NULL)
-               sockaddrlist_free(dst_sl);
+       if (src != NULL && src != SA(&ss))
+               FREE(src, M_SONAME);
+       if (dst != NULL && dst != SA(&sd))
+               FREE(dst, M_SONAME);
        return (error);
 }
 
@@ -933,27 +952,21 @@ out:
 }
 
 static int
-connectitx(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
+connectitx(struct socket *so, struct sockaddr *src,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope,
     sae_associd_t aid, sae_connid_t *pcid, uio_t auio, unsigned int flags,
     user_ssize_t *bytes_written)
 {
-       struct sockaddr_entry *se;
        int error;
 #pragma unused (flags)
 
-       VERIFY(dst_sl != NULL && *dst_sl != NULL);
+       VERIFY(dst != NULL);
 
-       TAILQ_FOREACH(se, &(*dst_sl)->sl_head, se_link) {
-               VERIFY(se->se_addr != NULL);
-               AUDIT_ARG(sockaddr, vfs_context_cwd(vfs_context_current()),
-                   se->se_addr);
+       AUDIT_ARG(sockaddr, vfs_context_cwd(vfs_context_current()), dst);
 #if CONFIG_MACF_SOCKET_SUBSET
-               if ((error = mac_socket_check_connect(kauth_cred_get(),
-                   so, se->se_addr)) != 0)
-                       return (error);
+       if ((error = mac_socket_check_connect(kauth_cred_get(), so, dst)) != 0)
+               return (error);
 #endif /* MAC_SOCKET_SUBSET */
-       }
 
        socket_lock(so, 1);
        if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
@@ -962,9 +975,13 @@ connectitx(struct socket *so, struct sockaddr_list **src_sl,
        }
 
        if ((so->so_proto->pr_flags & PR_DATA_IDEMPOTENT) &&
-           (flags & CONNECT_DATA_IDEMPOTENT))
+           (flags & CONNECT_DATA_IDEMPOTENT)) {
                so->so_flags1 |= SOF1_DATA_IDEMPOTENT;
 
+               if (flags & CONNECT_DATA_AUTHENTICATED)
+                       so->so_flags |= SOF1_DATA_AUTHENTICATED;
+       }
+
        /*
         * Case 1: CONNECT_RESUME_ON_READ_WRITE set, no data.
         * Case 2: CONNECT_RESUME_ON_READ_WRITE set, with data (user error)
@@ -988,7 +1005,7 @@ connectitx(struct socket *so, struct sockaddr_list **src_sl,
                so->so_flags1 &= ~SOF1_DATA_IDEMPOTENT;
        }
 
-       error = soconnectxlocked(so, src_sl, dst_sl, p, ifscope,
+       error = soconnectxlocked(so, src, dst, p, ifscope,
            aid, pcid, 0, NULL, 0, auio, bytes_written);
        if (error != 0) {
                so->so_state &= ~SS_ISCONNECTING;
@@ -2820,88 +2837,6 @@ getsockaddr_s(struct socket *so, struct sockaddr_storage *ss,
        return (error);
 }
 
-/*
- * Hard limit on the number of source and/or destination addresses
- * that can be specified by an application.
- */
-#define        SOCKADDRLIST_MAX_ENTRIES        64
-
-static int
-getsockaddrlist(struct socket *so, struct sockaddr_list **slp,
-    user_addr_t uaddr, socklen_t uaddrlen, boolean_t xlate_unspec)
-{
-       struct sockaddr_list *sl;
-       int error = 0;
-
-       *slp = NULL;
-
-       if (uaddr == USER_ADDR_NULL || uaddrlen == 0 ||
-           uaddrlen > (sizeof(struct sockaddr_in6) * SOCKADDRLIST_MAX_ENTRIES))
-               return (EINVAL);
-
-       sl = sockaddrlist_alloc(M_WAITOK);
-       if (sl == NULL)
-               return (ENOMEM);
-
-       VERIFY(sl->sl_cnt == 0);
-       while (uaddrlen > 0 && sl->sl_cnt < SOCKADDRLIST_MAX_ENTRIES) {
-               struct sockaddr_storage ss;
-               struct sockaddr_entry *se;
-               struct sockaddr *sa;
-
-               if (uaddrlen < sizeof (struct sockaddr)) {
-                       error = EINVAL;
-                       break;
-               }
-
-               bzero(&ss, sizeof (ss));
-               error = copyin(uaddr, (caddr_t)&ss, sizeof (struct sockaddr));
-               if (error != 0)
-                       break;
-
-               /* getsockaddr does the same but we need them now */
-               if (uaddrlen < ss.ss_len ||
-                   ss.ss_len < offsetof(struct sockaddr, sa_data[0])) {
-                       error = EINVAL;
-                       break;
-               } else if (ss.ss_len > sizeof (ss)) {
-                       /*
-                        * sockaddr_storage size is less than SOCK_MAXADDRLEN,
-                        * so the check here is inclusive.  We could use the
-                        * latter instead, but seems like an overkill for now.
-                        */
-                       error = ENAMETOOLONG;
-                       break;
-               }
-
-               se = sockaddrentry_alloc(M_WAITOK);
-               if (se == NULL) {
-                       error = ENOBUFS;
-                       break;
-               }
-
-               sockaddrlist_insert(sl, se);
-
-               error = getsockaddr(so, &sa, uaddr, ss.ss_len, xlate_unspec);
-               if (error != 0)
-                       break;
-
-               VERIFY(sa != NULL && sa->sa_len == ss.ss_len);
-               se->se_addr = sa;
-
-               uaddr += ss.ss_len;
-               VERIFY(((signed)uaddrlen - ss.ss_len) >= 0);
-               uaddrlen -= ss.ss_len;
-       }
-
-       if (error != 0)
-               sockaddrlist_free(sl);
-       else
-               *slp = sl;
-
-       return (error);
-}
-
 int
 internalize_user_msghdr_array(const void *src, int spacetype, int direction,
     u_int count, struct user_msghdr_x *dst, struct uio **uiop)
index 09558f405d9afeda136dcd8d8b5e539aab023bbe..c9fd137e6fafc79a0c80ab615a839377c4d4a557 100644 (file)
@@ -53,10 +53,16 @@ with the exceptions listed below
 .Bl -enum
 .
 .It
-ownership information and timestamps are set as they would be if
+ownership information is set as it would be if
 .Fa dst
 was created by
 .Xr openat 2
+or
+.Xr mkdirat 2
+or
+.Xr symlinkat 2
+if the current user does not have privileges to change ownership.
+
 .
 .It
 setuid and setgid bits are turned off in the mode bits for regular files.
@@ -261,6 +267,7 @@ nor a file descriptor associated with a directory.
 .Sh SEE ALSO
 .
 .Xr copyfile 3
+.Xr chown 2
 .
 .Sh HISTORY
 The 
index 828c3e1912a18dd23ebc5534e6dfdcb25f9b9b77..dc3a2080556b739b7553802cfc2c1b7aae76332d 100644 (file)
@@ -155,6 +155,12 @@ or greater.
 Preallocate file storage space. Note: upon success, 
 the space that is allocated can be the same size or 
 larger than the space requested.
+.It Dv F_PUNCHHOLE
+Deallocate a region and replace it with a hole. Subsequent reads of the
+affected region will return bytes of zeros that are usually not backed by
+physical blocks. This will not change the actual file size. Holes must be
+aligned to file system block boundaries. This will fail on
+file systems that do not support this interface.
 .It Dv F_SETSIZE
 Truncate a file without zeroing space.
 The calling process must have root privileges.
@@ -491,6 +497,19 @@ Allocate from the volume offset.
 .El
 .Pp
 The
+.Dv F_PUNCHHOLE
+command operates on the following structure:
+.ne 7v
+.Bd -literal
+        typedef struct fpunchhole {
+            u_int32_t fp_flags;     /* unused */
+            u_int32_t reserved;     /* (to maintain 8-byte alignment) */
+            off_t     fp_offset;    /* IN: start of the region */
+            off_t     fp_length;    /* IN: size of the region */
+        } fpunchhole_t;
+.Ed
+.Pp
+The
 .Dv F_RDADVISE
 command operates on the following structure
 which holds information passed from the
@@ -711,6 +730,21 @@ is a negative or zero value.
 .Pp
 The argument
 .Fa cmd
+is
+.Dv F_PUNCHHOLE
+and
+either
+.Fa fp_offset
+or
+.Fa fp_length
+are negative, or both
+.Fa fp_offset
+and
+.Fa fp_length
+are not multiples of the file system block size.
+.Pp
+The argument
+.Fa cmd
 is either
 .Dv F_READBOOTSTRAP
 or
index 9f24d9c304e938e9040fe16d825f02ab3dbaec4c..d0c23207c4827c02027f4a094caa5aad1787c13b 100644 (file)
@@ -182,6 +182,8 @@ A bit set that specifies the fork attributes that you require.
 Fork attributes relate to the actual data in the file,
 which can be held in multiple named contiguous ranges, or forks.
 See below for a description of these attributes.
+If the FSOPT_ATTR_CMN_EXTENDED option is given, this bit set is reinterpreted
+as extended common attributes attributes, also described below.
 .
 .El
 .Pp
@@ -240,8 +242,8 @@ If this is bit is set, then
 .Dv ATTR_CMN_GEN_COUNT
 and
 .Dv ATTR_CMN_DOCUMENT_ID
-can be requested. When this option is used, callers must not reference
-forkattrs anywhere.
+can be requested. When this option is used, forkattrs are reinterpreted as a
+set of extended common attributes.
 .
 .El
 .
@@ -903,6 +905,16 @@ A
 containing the file system UUID.  Typically this will be a
 version 5 UUID.
 .
+.It ATTR_VOL_QUOTA_SIZE
+An
+.Vt off_t
+containing the maximum size of the volume in bytes.
+.
+.It ATTR_VOL_RESERVED_SIZE
+An
+.Vt off_t
+containing the minimum size of the volume in bytes.
+.
 .It ATTR_VOL_ATTRIBUTES
 A
 .Vt vol_attributes_attr_t
@@ -940,6 +952,21 @@ Currently the only flag defined is
 .Dv DIR_MNTSTATUS_MNTPOINT,
 which indicates that there is a file system mounted on this directory.
 .
+.It ATTR_DIR_ALLOCSIZE
+An
+.Vt off_t
+containing the number of bytes on disk used by the directory
+(the physical size).
+.
+.It ATTR_DIR_IOBLOCKSIZE
+A
+.Vt u_int32_t
+containing the optimal block size when reading or writing data.
+.
+.It ATTR_DIR_DATALENGTH
+An
+.Vt off_t
+containing the length of the directory in bytes (the logical size).
 .El
 .
 .Pp
@@ -1083,6 +1110,7 @@ are directories.
 .
 Fork attributes relate to the actual data in the file,
 which can be held in multiple named contiguous ranges, or forks.
+These cannot be used if the FSOPT_ATTR_CMN_EXTENDED is given.
 The following fork attributes are defined.
 .
 .Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP
@@ -1112,6 +1140,36 @@ volume format implementation.
 We strongly recommend that client programs do not request fork attributes.
 If you are implementing a volume format, you should not support these attributes.
 .
+.Sh COMMON EXTENDED ATTRIBUTES
+.
+Common extended attributes are like common attributes except that they are set
+in the forkattr field and can only be used if the FSOPT_ATTR_CMN_EXTENDED
+option is given. Use of these attributes is mutually exclusive with the above
+fork attributes.
+.
+.Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP
+.
+.It ATTR_CMNEXT_RELPATH
+An
+.Vt attrreference
+structure containing the mount-relative path of
+the file system object as
+a UTF-8 encoded, null terminated C string.
+The attribute data length will not be greater than
+.Dv PATH_MAX.
+Inconsistent behavior may be observed when this attribute is requested on
+hard-linked items, particularly when the file system does not support
+ATTR_CMN_PARENTID natively. Callers should be aware of this when requesting the
+relative path of a hard-linked item.
+.
+.It ATTR_CMNEXT_PRIVATESIZE
+An
+.Vt off_t
+containing the number of bytes that are \fBnot\fP trapped inside a clone
+or snapshot, and which would be freed immediately if the file were deleted.
+.
+.El
+.
 .Sh VOLUME CAPABILITIES
 .
 .\" vol_capabilities_attr_t
@@ -1345,6 +1403,15 @@ obtaining object IDs from this volume. The values returned by ATTR_CMN_OBJID,
 ATTR_CMN_OBJPERMANENTID, and ATTR_CMN_PAROBJID can be interpreted as 64-bit
 object IDs instead of fsobj_id_t.
 .
+.It VOL_CAP_FMT_NO_IMMUTABLE_FILES
+If this bit is set, the volume format does not support setting the UF_IMMUTABLE
+flag.
+See ATTR_CMN_FLAGS for more details.
+.It VOL_CAP_FMT_NO_PERMISSIONS
+If this bit is set, the volume format does not support setting file
+permissions.
+See ATTR_CMN_USERACCESS for more details.
+.
 .El
 .Pp
 .
@@ -1455,6 +1522,12 @@ If this bit is set, the volume format implementation supports
 native extended attributes (see
 .Xr setxattr 2 Ns ).
 .
+.It VOL_CAP_INT_CLONE
+If this bit is set, the file system supports cloning files and directories.
+See 
+.Xr clonefileat 2 
+for more details.
+.
 .It VOL_CAP_INT_NAMEDSTREAMS
 If this bit is set, the volume format implementation supports
 native named streams.
index ee1b5a769fae1c02ed89baddcbd471b49b123a98..4c7b0ede81c0edeb8cdb1b4faea674d501489acc 100644 (file)
@@ -84,7 +84,12 @@ Volume attributes  cannot be requested but all other supported getattrlist attri
 .Dv ATTR_CMN_NAME
 and
 .Dv ATRR_CMN_RETURNED_ATTRS
-are required and the absence of these attributes in the attrList parameter results in an error.
+are required and the absence of these attributes in the attrList parameter results in an error. Note that 
+not all attributes supported by 
+.Fn getattrlist
+may be vended back by this call, which is why the aforementioned flag must be supplied. In particular
+.Dv ATTR_CMN_FULLPATH
+may not be valid on all directory entries whose information is requested by this call. 
 .Pp
 .
 .\" attrBuf and attrBufSize parameters
index 6d29d53b02f4dda4c2b67f39b3d59f14a045ab27..d5bea0b6220e716127a36a38bd51ed87b68fc0da 100644 (file)
@@ -91,6 +91,23 @@ the offset is set to the size of the
 file plus
 .Fa offset
 bytes.
+.It
+If
+.Fa whence
+is
+.Dv SEEK_HOLE ,
+the offset is set to the start of the next hole greater than or equal
+to the supplied
+.Fa offset .
+The definition of a hole is provided below.
+.It
+If
+.Fa whence
+is
+.Dv SEEK_DATA ,
+the offset is set to the start of the next non-hole file region greater
+than or equal to the supplied
+.Fa offset .
 .El
 .Pp
 The
@@ -102,6 +119,39 @@ bytes of zeros (until data is actually written into the gap).
 .Pp
 Some devices are incapable of seeking.  The value of the pointer
 associated with such a device is undefined.
+.Pp
+A
+.Qq hole
+is defined as a contiguous range of bytes in a file, all having the value of
+zero, but not all zeros in a file are guaranteed to be represented as holes
+returned with
+.Dv SEEK_HOLE .
+File systems are allowed to expose ranges of zeros with
+.Dv SEEK_HOLE ,
+but not required to.
+Applications can use
+.Dv SEEK_HOLE
+to optimise their behavior for ranges of zeros, but must not depend on it to
+find all such ranges in a file.
+Each file is presented as having a zero-size virtual hole at the very
+end of the file.
+The existence of a hole at the end of every data region allows for easy
+programming and also provides compatibility to the original implementation
+in Solaris.
+It also causes the current file size (i.e., end-of-file offset) to be returned
+to indicate that there are no more holes past the supplied
+.Fa offset .
+Applications should use
+.Fn fpathconf _PC_MIN_HOLE_SIZE
+or
+.Fn pathconf _PC_MIN_HOLE_SIZE
+to determine if a file system supports
+.Dv SEEK_HOLE .
+See
+.Xr pathconf 2 .
+.Pp
+For file systems that do not supply information about holes, the file will be
+represented as one entire data region.
 .Sh RETURN VALUES
 Upon successful completion,
 .Fn lseek
@@ -132,6 +182,15 @@ and
 .Fa whence )
 is negative.
 .\" ==========
+.It Bq Er ENXIO
+For
+.Dv SEEK_DATA ,
+there are no more data regions past the supplied offset.
+Due to existence of the hole at the end of the file, for
+.Dv SEEK_HOLE
+this error is only returned when the
+.Fa offset
+already points to the end-of-file position.
 .It Bq Er EOVERFLOW
 The seek location is too large to be stored
 in an object of type off_t.
index 630d79172570494057b0cf67516cd3164d921a6b..711970e303bf879b80b835f23010c21f18ac6b5d 100644 (file)
@@ -113,6 +113,17 @@ that the maximum attribute size can be anywhere from
 fork can have much larger size, and some file system 
 specific extended attributes can have smaller and preset 
 size; for example, Finder Info is always 32 bytes.
+.It Li _PC_MIN_HOLE_SIZE
+If a file system supports the reporting of holes (see
+.Xr lseek 2 ) ,
+.Fn pathconf
+and
+.Fn fpathconf
+return a positive number that represents the minimum hole size returned in
+bytes.
+The offsets of holes returned will be aligned to this same value.
+A special value of 1 is returned if the file system does not specify the minimum
+hole size but still reports holes.
 .El
 .Sh RETURN VALUES
 If the call to
index 7282de5a91b76f2c131cf970d42c87cab042ff70..e6ed48bf0b2dc1e19d4b945adb14a372b53f064e 100644 (file)
@@ -105,11 +105,13 @@ returns information about the link,
 while
 .Fn stat
 returns information about the file the link references.
-The attributes cannot be relied on in case of symbolic links.
-In this case, the only attributes returned from an
-.Fn lstat
-that refer to the symbolic link itself are the file type (S_IFLNK),
-size, blocks, and link count (always 1).
+For symbolic links, the st_mode member contains meaningful information
+when used with the file type macros, and the st_size member contains
+the length of the pathname contained in the symbolic link. File mode
+bits and the contents of the remaining members of the stat structure
+are unspecified. The value returned in the st_size member is the
+length of the contents of the symbolic link, and does not count any
+trailing null.
 .Pp
 The
 .Fn fstat
index d7233d4e1e1758ca4b179b45d21b8eabcba24917..8d6e6c9a6f3de785d829166044c600c4b44c2823 100644 (file)
@@ -96,7 +96,7 @@ struct statfs { /* when _DARWIN_FEATURE_64_BIT_INODE is NOT defined */
     uid_t   f_owner;   /* user that mounted the file system */
     short   f_reserved1;       /* reserved for future use */
     short   f_type;    /* type of file system (reserved) */
-    long    f_flags;   /* copy of mount flags (reserved) */
+    long    f_flags;   /* copy of mount flags */
     long    f_reserved2[2];    /* reserved for future use */
     char    f_fstypename[MFSNAMELEN]; /* fs type name */
     char    f_mntonname[MNAMELEN];    /* directory on which mounted */
index cf03373914bd3d949dd689957a5bcddc67a897f3..c5cc79b90199f56c2311498fa7f63fd0f9fe084b 100644 (file)
@@ -129,10 +129,29 @@ that contains a cmsghdr structure followed by the
 address. 
 The cmsghdr fields have the following values:
 .Bd -literal
-cmsg_len = sizeof(struct in_addr)
+cmsg_len = CMSG_LEN(sizeof(struct in_addr))
 cmsg_level = IPPROTO_IP
 cmsg_type = IP_RECVDSTADDR
 .Ed
+.Pp
+If the 
+.Dv IP_RECVTOS 
+option is enabled on a 
+.Dv SOCK_DGRAM 
+or 
+.Dv SOCK_RAW 
+socket,
+the
+.Xr recvmsg
+call will return the TOS (type of service) field of the IP header.
+The msg_control field in the msghdr structure points to a buffer 
+that contains a cmsghdr structure followed by the TOS.
+The cmsghdr fields have the following values:
+.Bd -literal
+cmsg_len = CMSG_LEN(sizeof(u_char))
+cmsg_level = IPPROTO_IP
+cmsg_type = IP_RECVTOS
+.Ed
 .Ss "Multicast Options"
 .Pp
 .Tn IP 
index 473ed190e951ea5bb34d7ad41afb79cf87caa0e7..21411666a689b946f5fa72f3052146d9c9e3bdd5 100644 (file)
@@ -310,6 +310,15 @@ The
 routine and family of routines may be used to manipulate this data.
 .Pp
 This option requires superuser privileges.
+.It Dv IPV6_TCLASS Fa "int *"
+Get or set the value of the traffic class field used for outgoing
+datagrams on this socket. The value must be between -1 and 255.
+A value of -1 resets to the default value.
+.It Dv IPV6_RECVTCLASS Fa "int *"
+Get or set the status of whether the traffic class header field
+will be provided as ancillary data along with the payload in subsequent
+.Xr recvmsg 2
+calls. The header field is stored as a single value of type int.
 .It Dv IPV6_RTHDR Fa "int *"
 Get or set whether the routing header from subsequent packets will be
 provided as ancillary data along with the payload in subsequent
@@ -387,18 +396,6 @@ For wildcard sockets, this can restrict connections to IPv6 only.
 Get or set whether the minimal IPv6 maximum transmission unit (MTU) size
 will be used to avoid fragmentation from occurring for subsequent
 outgoing datagrams.
-.It Dv IPV6_AUTH_LEVEL Fa "int *"
-Get or set the
-.Xr ipsec 4
-authentication level.
-.It Dv IPV6_ESP_TRANS_LEVEL Fa "int *"
-Get or set the ESP transport level.
-.It Dv IPV6_ESP_NETWORK_LEVEL Fa "int *"
-Get or set the ESP encapsulation level.
-.It Dv IPV6_IPCOMP_LEVEL Fa "int *"
-Get or set the
-.Xr ipcomp 4
-level.
 .El
 .Pp
 The
index 4eb349adb14dabeb333b9ce9f4d197fe53a8149b..66e0c3b549cc5b03d0a3fcded261f6a69ef0c719 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -1514,7 +1514,14 @@ bpfioctl(dev_t dev, u_long cmd, caddr_t addr, __unused int flags,
 
                        bcopy(addr, &size, sizeof (size));
 
-                       if (size > bpf_maxbufsize)
+                       /*
+                        * Allow larger buffer in head drop mode with the
+                        * assumption the capture is in standby mode to
+                        * keep a cache of recent traffic
+                        */
+                       if (d->bd_headdrop != 0 && size > 2 * bpf_maxbufsize)
+                               size = 2 * bpf_maxbufsize;
+                       else if (size > bpf_maxbufsize)
                                size = bpf_maxbufsize;
                        else if (size < BPF_MINBUFSIZE)
                                size = BPF_MINBUFSIZE;
@@ -1970,20 +1977,16 @@ bpf_setif(struct bpf_d *d, ifnet_t theywant, u_int32_t dlt)
                        continue;
                /*
                 * We found the requested interface.
-                * Allocate the packet buffers if we need to.
-                * If we're already attached to requested interface,
-                * just flush the buffer.
+                * Allocate the packet buffers.
+                */
+               error = bpf_allocbufs(d);
+               if (error != 0)
+                       return (error);
+               /*
+                * Detach if attached to something else.
                 */
-               if (d->bd_sbuf == 0) {
-                       error = bpf_allocbufs(d);
-                       if (error != 0)
-                               return (error);
-               }
                if (bp != d->bd_bif) {
-                               /*
-                                * Detach if attached to something else.
-                                */
-                       if (d->bd_bif) {
+                       if (d->bd_bif != NULL) {
                                if (bpf_detachd(d, 0) != 0)
                                        return (ENXIO);
                        }
@@ -2550,7 +2553,15 @@ catchpacket(struct bpf_d *d, u_char *pkt, struct mbuf *m, u_int pktlen,
                 * This packet will overflow the storage buffer.
                 * Rotate the buffers if we can, then wakeup any
                 * pending reads.
+                *
+                * We cannot rotate buffers if a read is in progress
+                * so drop the packet
                 */
+               if (d->bd_hbuf_read) {
+                       ++d->bd_dcount;
+                       return;
+               }
+               
                if (d->bd_fbuf == NULL) {
                        if (d->bd_headdrop == 0) {
                                /*
@@ -2658,13 +2669,27 @@ catchpacket(struct bpf_d *d, u_char *pkt, struct mbuf *m, u_int pktlen,
 static int
 bpf_allocbufs(struct bpf_d *d)
 {
+       if (d->bd_sbuf != NULL) {
+               FREE(d->bd_sbuf, M_DEVBUF);
+               d->bd_sbuf = NULL;
+       }
+       if (d->bd_hbuf != NULL) {
+               FREE(d->bd_hbuf, M_DEVBUF);
+               d->bd_hbuf = NULL;
+       }
+       if (d->bd_fbuf != NULL) {
+               FREE(d->bd_fbuf, M_DEVBUF);
+               d->bd_fbuf = NULL;
+       }
+
        d->bd_fbuf = (caddr_t) _MALLOC(d->bd_bufsize, M_DEVBUF, M_WAIT);
-       if (d->bd_fbuf == 0)
+       if (d->bd_fbuf == NULL)
                return (ENOBUFS);
 
        d->bd_sbuf = (caddr_t) _MALLOC(d->bd_bufsize, M_DEVBUF, M_WAIT);
-       if (d->bd_sbuf == 0) {
+       if (d->bd_sbuf == NULL) {
                FREE(d->bd_fbuf, M_DEVBUF);
+               d->bd_fbuf = NULL;
                return (ENOBUFS);
        }
        d->bd_slen = 0;
index a36d7137ca227f457f6ba026a67305d570d9cee0..68cdae1e83077a67f7b4994d19bfd6095d8dc3d7 100644 (file)
@@ -1910,11 +1910,12 @@ cfil_sock_attach(struct socket *so)
 
        socket_lock_assert_owned(so);
 
-       /* Limit ourselves to TCP */
+       /* Limit ourselves to TCP that are not MPTCP subflows */
        if ((so->so_proto->pr_domain->dom_family != PF_INET &&
                so->so_proto->pr_domain->dom_family != PF_INET6) ||
                so->so_proto->pr_type != SOCK_STREAM ||
-               so->so_proto->pr_protocol != IPPROTO_TCP)
+               so->so_proto->pr_protocol != IPPROTO_TCP ||
+               (so->so_flags & SOF_MP_SUBFLOW) != 0)
                goto done;
 
        filter_control_unit = necp_socket_get_content_filter_control_unit(so);
index 053db0860b6b1a57bb6f0e945b296f290bc8290c..1bb5a6e1f00f1e3420b87edb5208eea169807f2c 100644 (file)
@@ -380,7 +380,7 @@ if_detach_ifa_common(struct ifnet *ifp, struct ifaddr *ifa, int link)
                panic("%s: unexpected (missing) refcnt ifa=%p", __func__, ifa);
                /* NOTREACHED */
        }
-       ifa->ifa_debug &= ~IFD_ATTACHED;
+       ifa->ifa_debug &= ~(IFD_ATTACHED | IFD_DETACHING);
 
        if (ifa->ifa_detached != NULL)
                (*ifa->ifa_detached)(ifa);
@@ -2049,7 +2049,7 @@ ifnet_reset_order(u_int32_t *ordered_indices, u_int32_t count)
        for (u_int32_t order_index = 0; order_index < count; order_index++) {
                u_int32_t interface_index = ordered_indices[order_index];
                if (interface_index == IFSCOPE_NONE ||
-                   (int)interface_index > if_index) {
+                       interface_index > (uint32_t)if_index) {
                        break;
                }
                ifp = ifindex2ifnet[interface_index];
@@ -2112,7 +2112,7 @@ ifioctl_iforder(u_long cmd, caddr_t data)
        case SIOCSIFORDER: {            /* struct if_order */
                struct if_order *ifo = (struct if_order *)(void *)data;
 
-               if ((int)ifo->ifo_count > if_index) {
+               if (ifo->ifo_count > (u_int32_t)if_index) {
                        error = EINVAL;
                        break;
                }
@@ -2163,7 +2163,7 @@ ifioctl_iforder(u_long cmd, caddr_t data)
 
                        ifnet_head_lock_shared();
                        TAILQ_FOREACH(ifp, &ifnet_ordered_head, if_ordered_link) {
-                               if (cursor > count_to_copy) {
+                               if (cursor >= count_to_copy) {
                                        break;
                                }
                                ordered_indices[cursor] = ifp->if_index;
index ff5f8d428dbc2c0db333aae34400776397ffdc4e..f608157abc8fc827a5f0ec6a81d4b3d691fb5a03 100644 (file)
@@ -1129,7 +1129,7 @@ struct ifaddr {
 #define        IFD_DEBUG       0x4             /* has debugging info */
 #define        IFD_LINK        0x8             /* link address */
 #define        IFD_TRASHED     0x10            /* in trash list */
-#define        IFD_SKIP        0x20            /* skip this entry */
+#define        IFD_DETACHING   0x20            /* detach is in progress */
 #define        IFD_NOTREADY    0x40            /* embryonic; not yet ready */
 
 #define        IFA_LOCK_ASSERT_HELD(_ifa)                                      \
index e9c9a6a6aecd144ff488c817ab13aa835426d1df..1055044b3f65e998f28fa80c561638dcd1b88686 100644 (file)
@@ -66,8 +66,6 @@ extern int    sflt_getpeername(struct socket *so, struct sockaddr **remote);
 extern int     sflt_connectin(struct socket *head,
                    const struct sockaddr *remote);
 extern int     sflt_connectout(struct socket *so, const struct sockaddr *nam);
-extern int     sflt_connectxout(struct socket *so,
-                   struct sockaddr_list **nam_sl);
 extern int     sflt_setsockopt(struct socket *so, struct sockopt *sopt);
 extern int     sflt_getsockopt(struct socket *so, struct sockopt *sopt);
 extern int     sflt_data_out(struct socket *so, const struct sockaddr  *to,
index 86cfe97ebe18972f4276fffcf734ef6644972780..cf7e64dbaf1b5c8ae4f7a5ab796d5aeab2f75781 100644 (file)
@@ -888,6 +888,10 @@ necp_buffer_find_tlv(u_int8_t *buffer, u_int32_t buffer_length, int offset, u_in
                        curr_type = NECP_TLV_NIL;
                }
                curr_length = necp_buffer_get_tlv_length(buffer, cursor);
+               if (curr_length > buffer_length - ((u_int32_t)cursor + sizeof(curr_type) + sizeof(curr_length))) {
+                       return (-1);
+               }
+
                next_cursor = (cursor + sizeof(curr_type) + sizeof(curr_length) + curr_length);
                if (curr_type == type) {
                        // check if entire TLV fits inside buffer
@@ -1305,6 +1309,12 @@ necp_policy_condition_is_application(u_int8_t *buffer, u_int32_t length)
        return (necp_policy_condition_get_type_from_buffer(buffer, length) == NECP_POLICY_CONDITION_APPLICATION);
 }
 
+static inline bool
+necp_policy_condition_is_real_application(u_int8_t *buffer, u_int32_t length)
+{
+       return (necp_policy_condition_get_type_from_buffer(buffer, length) == NECP_POLICY_CONDITION_REAL_APPLICATION);
+}
+
 static inline bool
 necp_policy_condition_requires_application(u_int8_t *buffer, u_int32_t length)
 {
@@ -1312,6 +1322,13 @@ necp_policy_condition_requires_application(u_int8_t *buffer, u_int32_t length)
        return (type == NECP_POLICY_CONDITION_REAL_APPLICATION);
 }
 
+static inline bool
+necp_policy_condition_requires_real_application(u_int8_t *buffer, u_int32_t length)
+{
+       u_int8_t type = necp_policy_condition_get_type_from_buffer(buffer, length);
+       return (type == NECP_POLICY_CONDITION_ENTITLEMENT);
+}
+
 static bool
 necp_policy_condition_is_valid(u_int8_t *buffer, u_int32_t length, u_int8_t policy_result_type)
 {
@@ -1612,7 +1629,9 @@ necp_handle_policy_add(struct necp_session *session, u_int32_t message_id, mbuf_
        bool has_default_condition = FALSE;
        bool has_non_default_condition = FALSE;
        bool has_application_condition = FALSE;
+       bool has_real_application_condition = FALSE;
        bool requires_application_condition = FALSE;
+       bool requires_real_application_condition = FALSE;
        u_int8_t *conditions_array = NULL;
        u_int32_t conditions_array_size = 0;
        int conditions_array_cursor;
@@ -1806,10 +1825,18 @@ necp_handle_policy_add(struct necp_session *session, u_int32_t message_id, mbuf_
                                has_application_condition = TRUE;
                        }
 
+                       if (necp_policy_condition_is_real_application((conditions_array + conditions_array_cursor), condition_size)) {
+                               has_real_application_condition = TRUE;
+                       }
+
                        if (necp_policy_condition_requires_application((conditions_array + conditions_array_cursor), condition_size)) {
                                requires_application_condition = TRUE;
                        }
 
+                       if (necp_policy_condition_requires_real_application((conditions_array + conditions_array_cursor), condition_size)) {
+                               requires_real_application_condition = TRUE;
+                       }
+
                        conditions_array_cursor += condition_size;
                }
        }
@@ -1820,6 +1847,12 @@ necp_handle_policy_add(struct necp_session *session, u_int32_t message_id, mbuf_
                goto fail;
        }
 
+       if (requires_real_application_condition && !has_real_application_condition) {
+               NECPLOG0(LOG_ERR, "Failed to validate conditions; did not contain real application condition");
+               response_error = NECP_ERROR_POLICY_CONDITIONS_INVALID;
+               goto fail;
+       }
+
        if ((policy = necp_policy_create(session, order, conditions_array, conditions_array_size, route_rules_array, route_rules_array_size, policy_result, policy_result_size)) == NULL) {
                response_error = NECP_ERROR_INTERNAL;
                goto fail;
@@ -3302,6 +3335,7 @@ necp_kernel_socket_policy_add(necp_policy_id parent_policy_id, necp_policy_order
        }
        if (new_kernel_policy->condition_mask & NECP_KERNEL_CONDITION_CUSTOM_ENTITLEMENT) {
                new_kernel_policy->cond_custom_entitlement = cond_custom_entitlement;
+               new_kernel_policy->cond_custom_entitlement_matched = necp_boolean_state_unknown;
        }
        if (new_kernel_policy->condition_mask & NECP_KERNEL_CONDITION_ACCOUNT_ID) {
                new_kernel_policy->cond_account_id = cond_account_id;
@@ -5291,7 +5325,13 @@ necp_application_find_policy_match_internal(proc_t proc,
                u_int8_t type = necp_buffer_get_tlv_type(parameters, offset);
                u_int32_t length = necp_buffer_get_tlv_length(parameters, offset);
 
-               if (length > 0 && (offset + sizeof(u_int8_t) + sizeof(u_int32_t) + length) <= parameters_size) {
+               if (length > (parameters_size - (offset + sizeof(u_int8_t) + sizeof(u_int32_t)))) {
+                       // If the length is larger than what can fit in the remaining parameters size, bail
+                       NECPLOG(LOG_ERR, "Invalid TLV length (%u)", length);
+                       break;
+               }
+
+               if (length > 0) {
                        u_int8_t *value = necp_buffer_get_tlv_value(parameters, offset, NULL);
                        if (value != NULL) {
                                switch (type) {
@@ -5735,16 +5775,24 @@ necp_socket_check_policy(struct necp_kernel_socket_policy *kernel_policy, necp_a
        }
 
        if (kernel_policy->condition_mask & NECP_KERNEL_CONDITION_CUSTOM_ENTITLEMENT) {
-               if (kernel_policy->cond_custom_entitlement != NULL) {
-                       if (proc == NULL) {
-                               // No process found, cannot check entitlement
-                               return (FALSE);
-                       }
-                       task_t task = proc_task(proc);
-                       if (task == NULL ||
-                               !IOTaskHasEntitlement(task, kernel_policy->cond_custom_entitlement)) {
-                               // Process is missing custom entitlement
-                               return (FALSE);
+               if (kernel_policy->cond_custom_entitlement_matched == necp_boolean_state_false) {
+                       // Process is missing entitlement based on previous check
+                       return (FALSE);
+               } else if (kernel_policy->cond_custom_entitlement_matched == necp_boolean_state_unknown) {
+                       if (kernel_policy->cond_custom_entitlement != NULL) {
+                               if (proc == NULL) {
+                                       // No process found, cannot check entitlement
+                                       return (FALSE);
+                               }
+                               task_t task = proc_task(proc);
+                               if (task == NULL ||
+                                       !IOTaskHasEntitlement(task, kernel_policy->cond_custom_entitlement)) {
+                                       // Process is missing custom entitlement
+                                       kernel_policy->cond_custom_entitlement_matched = necp_boolean_state_false;
+                                       return (FALSE);
+                               } else {
+                                       kernel_policy->cond_custom_entitlement_matched = necp_boolean_state_true;
+                               }
                        }
                }
        }
index 14609d65d189a3db4fcc86eeb0328f519a02b0be..ec33fb120683e09a80783fedbc11426c2dee8571 100644 (file)
@@ -354,6 +354,7 @@ typedef struct necp_all_stats {
 #define        NECP_CLIENT_ACTION_COPY_AGENT                                   8 // Copy agent content. Input: agent UUID; Output: struct netagent
 #define        NECP_CLIENT_ACTION_COPY_INTERFACE                               9 // Copy interface details. Input: ifindex cast to UUID; Output: struct necp_interface_details
 #define        NECP_CLIENT_ACTION_SET_STATISTICS                               10 // Start/update/complete per-flow statistics. Input: client_id, statistics area
+#define        NECP_CLIENT_ACTION_AGENT_USE                                    12 // Return the use count and increment the use count. Input/Output: struct necp_agent_use_parameters
 
 #define        NECP_CLIENT_PARAMETER_APPLICATION                               NECP_POLICY_CONDITION_APPLICATION               // Requires entitlement
 #define        NECP_CLIENT_PARAMETER_REAL_APPLICATION                  NECP_POLICY_CONDITION_REAL_APPLICATION  // Requires entitlement
@@ -464,6 +465,11 @@ struct kev_necp_policies_changed_data {
        u_int32_t               changed_count;  // Defaults to 0.
 };
 
+struct necp_agent_use_parameters {
+       uuid_t agent_uuid;
+       uint64_t out_use_count;
+};
+
 #ifdef BSD_KERNEL_PRIVATE
 #include <stdbool.h>
 #include <sys/socketvar.h>
@@ -562,6 +568,12 @@ union necp_sockaddr_union {
        struct sockaddr_in6             sin6;
 };
 
+enum necp_boolean_state {
+       necp_boolean_state_unknown = 0,
+       necp_boolean_state_false = 1,
+       necp_boolean_state_true = 2,
+};
+
 struct necp_kernel_socket_policy {
        LIST_ENTRY(necp_kernel_socket_policy)   chain;
        necp_policy_id                          parent_policy_id;
@@ -576,6 +588,7 @@ struct necp_kernel_socket_policy {
        u_int32_t                                       cond_app_id;                                    // Locally assigned ID value stored
        u_int32_t                                       cond_real_app_id;                               // Locally assigned ID value stored
        char                                            *cond_custom_entitlement;               // String
+       u_int8_t                                        cond_custom_entitlement_matched;// Boolean if entitlement matched app
        u_int32_t                                       cond_account_id;                                // Locally assigned ID value stored
        char                                            *cond_domain;                                   // String
        u_int8_t                                        cond_domain_dot_count;                  // Number of dots in cond_domain
index 999fab3eeec1f8b1920d5bda36174f0bdbbb7462..33adf5a22d9f92618540f0c6382b8dbccc23ca6a 100644 (file)
@@ -656,7 +656,13 @@ necp_client_parse_parameters(u_int8_t *parameters,
                u_int8_t type = necp_buffer_get_tlv_type(parameters, offset);
                u_int32_t length = necp_buffer_get_tlv_length(parameters, offset);
 
-               if (length > 0 && (offset + sizeof(u_int8_t) + sizeof(u_int32_t) + length) <= parameters_size) {
+               if (length > (parameters_size - (offset + sizeof(u_int8_t) + sizeof(u_int32_t)))) {
+                       // If the length is larger than what can fit in the remaining parameters size, bail
+                       NECPLOG(LOG_ERR, "Invalid TLV length (%u)", length);
+                       break;
+               }
+
+               if (length > 0) {
                        u_int8_t *value = necp_buffer_get_tlv_value(parameters, offset, NULL);
                        if (value != NULL) {
                                switch (type) {
@@ -975,10 +981,10 @@ necp_update_client_result(proc_t proc,
        ifnet_t delegate_interface = NULL;
        ifnet_t original_scoped_interface = NULL;
 
-       if (result.routed_interface_index != IFSCOPE_NONE && (int)result.routed_interface_index <= if_index) {
+       if (result.routed_interface_index != IFSCOPE_NONE && result.routed_interface_index <= (u_int32_t)if_index) {
                direct_interface = ifindex2ifnet[result.routed_interface_index];
        } else if (parsed_parameters.required_interface_index != IFSCOPE_NONE &&
-                          (int)parsed_parameters.required_interface_index <= if_index) {
+                          parsed_parameters.required_interface_index <= (u_int32_t)if_index) {
                // If the request was scoped, but the route didn't match, still grab the agents
                direct_interface = ifindex2ifnet[parsed_parameters.required_interface_index];
        } else if (result.routed_interface_index == IFSCOPE_NONE &&
@@ -992,7 +998,7 @@ necp_update_client_result(proc_t proc,
        if (result.routing_result == NECP_KERNEL_POLICY_RESULT_IP_TUNNEL &&
                parsed_parameters.required_interface_index != IFSCOPE_NONE &&
                parsed_parameters.required_interface_index != result.routing_result_parameter.tunnel_interface_index &&
-               (int)parsed_parameters.required_interface_index <= if_index) {
+               parsed_parameters.required_interface_index <= (u_int32_t)if_index) {
                original_scoped_interface = ifindex2ifnet[parsed_parameters.required_interface_index];
        }
        // Add interfaces
@@ -1576,7 +1582,13 @@ necp_find_netstat_data(struct necp_client *client, union necp_sockaddr_union *lo
                u_int8_t type = necp_buffer_get_tlv_type(parameters, offset);
                u_int32_t length = necp_buffer_get_tlv_length(parameters, offset);
 
-               if (length > 0 && (offset + sizeof(u_int8_t) + sizeof(u_int32_t) + length) <= parameters_size) {
+               if (length > (parameters_size - (offset + sizeof(u_int8_t) + sizeof(u_int32_t)))) {
+                       // If the length is larger than what can fit in the remaining parameters size, bail
+                       NECPLOG(LOG_ERR, "Invalid TLV length (%u)", length);
+                       break;
+               }
+
+               if (length > 0) {
                        u_int8_t *value = necp_buffer_get_tlv_value(parameters, offset, NULL);
                        if (value != NULL) {
                                switch (type) {
@@ -1790,7 +1802,6 @@ necp_open(struct proc *p, struct necp_open_args *uap, int *retval)
        *fdflags(p, fd) |= (UF_EXCLOSE | UF_FORKCLOSE);
        procfdtbl_releasefd(p, fd, NULL);
        fp_drop(p, fd, fp, 1);
-       proc_fdunlock(p);
 
        *retval = fd;
 
@@ -1798,6 +1809,8 @@ necp_open(struct proc *p, struct necp_open_args *uap, int *retval)
        LIST_INSERT_HEAD(&necp_fd_list, fd_data, chain);
        lck_rw_done(&necp_fd_lock);
 
+       proc_fdunlock(p);
+
 done:
        if (error != 0) {
                if (fp != NULL) {
@@ -2264,7 +2277,13 @@ necp_client_agent_action(struct necp_fd_data *fd_data, struct necp_client_action
                        u_int8_t type = necp_buffer_get_tlv_type(parameters, offset);
                        u_int32_t length = necp_buffer_get_tlv_length(parameters, offset);
 
-                       if (length > 0 && (offset + sizeof(u_int8_t) + sizeof(u_int32_t) + length) <= parameters_size) {
+                       if (length > (parameters_size - (offset + sizeof(u_int8_t) + sizeof(u_int32_t)))) {
+                               // If the length is larger than what can fit in the remaining parameters size, bail
+                               NECPLOG(LOG_ERR, "Invalid TLV length (%u)", length);
+                               break;
+                       }
+
+                       if (length > 0) {
                                u_int8_t *value = necp_buffer_get_tlv_value(parameters, offset, NULL);
                                if (length >= sizeof(uuid_t) &&
                                        value != NULL &&
@@ -2355,6 +2374,63 @@ done:
        return (error);
 }
 
+static int
+necp_client_agent_use(struct necp_fd_data *fd_data, struct necp_client_action_args *uap, int *retval)
+{
+       int error = 0;
+       struct necp_client *matched_client = NULL;
+       struct necp_client *client = NULL;
+       uuid_t client_id;
+       struct necp_agent_use_parameters parameters;
+
+       if (uap->client_id == 0 || uap->client_id_len != sizeof(uuid_t) ||
+               uap->buffer_size != sizeof(parameters) || uap->buffer == 0) {
+               error = EINVAL;
+               goto done;
+       }
+
+       error = copyin(uap->client_id, client_id, sizeof(uuid_t));
+       if (error) {
+               NECPLOG(LOG_ERR, "Copyin client_id error (%d)", error);
+               goto done;
+       }
+
+       error = copyin(uap->buffer, &parameters, uap->buffer_size);
+       if (error) {
+               NECPLOG(LOG_ERR, "Parameters copyin error (%d)", error);
+               goto done;
+       }
+
+       lck_mtx_lock(&fd_data->fd_lock);
+       LIST_FOREACH(client, &fd_data->clients, chain) {
+               if (uuid_compare(client->client_id, client_id) == 0) {
+                       matched_client = client;
+                       break;
+               }
+       }
+
+       if (matched_client) {
+               error = netagent_use(parameters.agent_uuid, &parameters.out_use_count);
+       } else {
+               error = ENOENT;
+       }
+
+       lck_mtx_unlock(&fd_data->fd_lock);
+
+       if (error == 0) {
+               error = copyout(&parameters, uap->buffer, uap->buffer_size);
+               if (error) {
+                       NECPLOG(LOG_ERR, "Parameters copyout error (%d)", error);
+                       goto done;
+               }
+       }
+
+done:
+       *retval = error;
+
+       return (error);
+}
+
 static int
 necp_client_copy_interface(__unused struct necp_fd_data *fd_data, struct necp_client_action_args *uap, int *retval)
 {
@@ -2385,7 +2461,7 @@ necp_client_copy_interface(__unused struct necp_fd_data *fd_data, struct necp_cl
 
        ifnet_head_lock_shared();
        ifnet_t interface = NULL;
-       if (interface_index != IFSCOPE_NONE && (int)interface_index <= if_index) {
+       if (interface_index != IFSCOPE_NONE && interface_index <= (u_int32_t)if_index) {
                interface = ifindex2ifnet[interface_index];
        }
 
@@ -2605,6 +2681,10 @@ necp_client_action(struct proc *p, struct necp_client_action_args *uap, int *ret
                        return_value = necp_client_copy_agent(fd_data, uap, retval);
                        break;
                }
+               case NECP_CLIENT_ACTION_AGENT_USE: {
+                       return_value = necp_client_agent_use(fd_data, uap, retval);
+                       break;
+               }
                case NECP_CLIENT_ACTION_COPY_INTERFACE: {
                        return_value = necp_client_copy_interface(fd_data, uap, retval);
                        break;
index f05d08cecce3240740263e5f8742ea4cc8cbee1e..14c14c66ebf38a1c7970a01a7df9e7037400def1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2014, 2016 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -81,6 +81,7 @@ struct netagent_wrapper {
        LIST_ENTRY(netagent_wrapper) master_chain;
        u_int32_t control_unit;
        u_int32_t generation;
+       u_int64_t use_count;
        struct netagent_client_list_s pending_triggers_list;
        struct netagent netagent;
 };
@@ -149,6 +150,10 @@ static void netagent_handle_assign_nexus_message(struct netagent_session *sessio
 static errno_t netagent_handle_assign_nexus_setopt(struct netagent_session *session, u_int8_t *payload,
                                                                                                   u_int32_t payload_length);
 
+// Set/get assert count
+static errno_t netagent_handle_use_count_setopt(struct netagent_session *session, u_int8_t *payload, size_t payload_length);
+static errno_t netagent_handle_use_count_getopt(struct netagent_session *session, u_int8_t *buffer, size_t *buffer_length);
+
 static void netagent_handle_get(struct netagent_session *session, u_int32_t message_id,
                                                                u_int32_t payload_length, mbuf_t packet, int offset);
 
@@ -509,8 +514,30 @@ static errno_t
 netagent_ctl_getopt(kern_ctl_ref kctlref, u_int32_t unit, void *unitinfo, int opt,
                                        void *data, size_t *len)
 {
-#pragma unused(kctlref, unit, unitinfo, opt, data, len)
-       return (0);
+#pragma unused(kctlref, unit)
+       struct netagent_session *session = (struct netagent_session *)unitinfo;
+       errno_t error;
+
+       if (session == NULL) {
+               NETAGENTLOG0(LOG_ERR, "Received a NULL session");
+               error = EINVAL;
+               goto done;
+       }
+
+       switch (opt) {
+               case NETAGENT_OPTION_TYPE_USE_COUNT: {
+                       NETAGENTLOG0(LOG_DEBUG, "Request to get use count");
+                       error = netagent_handle_use_count_getopt(session, data, len);
+               }
+               break;
+               default:
+                       NETAGENTLOG0(LOG_ERR, "Received unknown option");
+                       error = ENOPROTOOPT;
+               break;
+       }
+
+done:
+       return (error);
 }
 
 static errno_t
@@ -548,6 +575,11 @@ netagent_ctl_setopt(kern_ctl_ref kctlref, u_int32_t unit, void *unitinfo, int op
                        error = netagent_handle_assign_nexus_setopt(session, data, len);
                }
                break;
+               case NETAGENT_OPTION_TYPE_USE_COUNT: {
+                       NETAGENTLOG0(LOG_DEBUG, "Request to set use count");
+                       error = netagent_handle_use_count_setopt(session, data, len);
+               }
+               break;
                default:
                        NETAGENTLOG0(LOG_ERR, "Received unknown option");
                        error = ENOPROTOOPT;
@@ -926,6 +958,7 @@ netagent_handle_update_inner(struct netagent_session *session, struct netagent_w
        }
 
        new_wrapper->generation = g_next_generation++;
+       new_wrapper->use_count = session->wrapper->use_count;
 
        if ((new_wrapper->netagent.netagent_flags & NETAGENT_FLAG_ACTIVE) &&
                !(session->wrapper->netagent.netagent_flags & NETAGENT_FLAG_ACTIVE)) {
@@ -1271,6 +1304,92 @@ fail:
        netagent_send_error_response(session, NETAGENT_MESSAGE_TYPE_ASSIGN_NEXUS, message_id, response_error);
 }
 
+errno_t
+netagent_handle_use_count_setopt(struct netagent_session *session, u_int8_t *payload, size_t payload_length)
+{
+       errno_t response_error = 0;
+       uint64_t use_count = 0;
+
+       if (session == NULL) {
+               NETAGENTLOG0(LOG_ERR, "Failed to find session");
+               response_error = ENOENT;
+               goto done;
+       }
+
+       if (payload == NULL) {
+               NETAGENTLOG0(LOG_ERR, "No payload received");
+               response_error = EINVAL;
+               goto done;
+       }
+
+       if (payload_length != sizeof(use_count)) {
+               NETAGENTLOG(LOG_ERR, "Payload length is invalid (%u)", payload_length);
+               response_error = EINVAL;
+               goto done;
+       }
+
+       memcpy(&use_count, payload, sizeof(use_count));
+
+       lck_rw_lock_shared(&netagent_lock);
+
+       if (session->wrapper == NULL) {
+               NETAGENTLOG0(LOG_ERR, "Session has no agent registered");
+               response_error = ENOENT;
+               lck_rw_done(&netagent_lock);
+               goto done;
+       }
+
+       session->wrapper->use_count = use_count;
+
+       lck_rw_done(&netagent_lock);
+
+done:
+       return response_error;
+}
+
+errno_t
+netagent_handle_use_count_getopt(struct netagent_session *session, u_int8_t *buffer, size_t *buffer_length)
+{
+       errno_t response_error = 0;
+       uint64_t use_count = 0;
+
+       if (session == NULL) {
+               NETAGENTLOG0(LOG_ERR, "Failed to find session");
+               response_error = ENOENT;
+               goto done;
+       }
+
+       if (buffer == NULL) {
+               NETAGENTLOG0(LOG_ERR, "No payload received");
+               response_error = EINVAL;
+               goto done;
+       }
+
+       if (*buffer_length != sizeof(use_count)) {
+               NETAGENTLOG(LOG_ERR, "Buffer length is invalid (%u)", buffer_length);
+               response_error = EINVAL;
+               goto done;
+       }
+
+       lck_rw_lock_shared(&netagent_lock);
+
+       if (session->wrapper == NULL) {
+               NETAGENTLOG0(LOG_ERR, "Session has no agent registered");
+               response_error = ENOENT;
+               lck_rw_done(&netagent_lock);
+               goto done;
+       }
+
+       use_count = session->wrapper->use_count;
+       lck_rw_done(&netagent_lock);
+
+       memcpy(buffer, &use_count, sizeof(use_count));
+       *buffer_length = sizeof(use_count);
+
+done:
+       return response_error;
+}
+
 static struct netagent_wrapper *
 netagent_find_agent_with_uuid(uuid_t uuid)
 {
@@ -1632,6 +1751,31 @@ done:
        return (error);
 }
 
+int
+netagent_use(uuid_t agent_uuid, uint64_t *out_use_count)
+{
+       int error = 0;
+
+       lck_rw_lock_exclusive(&netagent_lock);
+       struct netagent_wrapper *wrapper = netagent_find_agent_with_uuid(agent_uuid);
+       if (wrapper == NULL) {
+               NETAGENTLOG0(LOG_ERR, "netagent_assert: Requested netagent UUID is not registered");
+               error = ENOENT;
+               goto done;
+       }
+
+       uint64_t current_count = wrapper->use_count;
+       wrapper->use_count++;
+
+       if (out_use_count != NULL) {
+               *out_use_count = current_count;
+       }
+
+done:
+       lck_rw_done(&netagent_lock);
+       return (error);
+}
+
 int
 netagent_copyout(uuid_t agent_uuid, user_addr_t user_addr, u_int32_t user_size)
 {
index ce4bdf0012fb7fff0c12f321fdca1ca7cc87a5f8..f459e2f6d0163ac3fd254d362e421bdc135c9be8 100644 (file)
@@ -88,6 +88,7 @@ struct netagent_assign_nexus_message {
 #define        NETAGENT_OPTION_TYPE_UNREGISTER                 NETAGENT_MESSAGE_TYPE_UNREGISTER        // No value, no return value
 #define        NETAGENT_OPTION_TYPE_UPDATE                             NETAGENT_MESSAGE_TYPE_UPDATE            // Pass netagent to update, no return value
 #define NETAGENT_OPTION_TYPE_ASSIGN_NEXUS              NETAGENT_MESSAGE_TYPE_ASSIGN_NEXUS      // Pass struct netagent_assign_nexus_message
+#define        NETAGENT_OPTION_TYPE_USE_COUNT                  16                                                                      // Pass use count to set, get current use count
 
 #define        NETAGENT_MESSAGE_FLAGS_RESPONSE                 0x01    // Used for acks, errors, and query responses
 
@@ -209,6 +210,8 @@ extern int netagent_kernel_trigger(uuid_t uuid);
 extern int netagent_client_message(uuid_t agent_uuid, uuid_t necp_client_uuid, u_int8_t message_type);
 
 extern int netagent_copyout(uuid_t uuid, user_addr_t user_addr, u_int32_t user_size);
+
+extern int netagent_use(uuid_t agent_uuid, uint64_t *out_use_count);
 #endif /* BSD_KERNEL_PRIVATE */
 
 #ifndef KERNEL
index 94750b9e887608731e184017d5efe1e9485f5ef7..96633f83378c4b03623a9a65257cac16f236f50c 100644 (file)
@@ -699,7 +699,7 @@ sa_trim(struct sockaddr *sa, int skip)
  */
 struct sockaddr *
 rtm_scrub(int type, int idx, struct sockaddr *hint, struct sockaddr *sa,
-    void *buf, uint32_t buflen, kauth_cred_t *credp)
+    void *buf, uint32_t buflen, kauth_cred_t *credp, uint32_t rtm_hint_flags)
 {
        struct sockaddr_storage *ss = (struct sockaddr_storage *)buf;
        struct sockaddr *ret = sa;
@@ -782,7 +782,8 @@ rtm_scrub(int type, int idx, struct sockaddr *hint, struct sockaddr *sa,
                /* fallthrough */
        }
        case RTAX_IFP: {
-               if (sa->sa_family == AF_LINK && credp) {
+               if (sa->sa_family == AF_LINK && credp &&
+                   (rtm_hint_flags & RTMF_HIDE_LLADDR)) {
                        struct sockaddr_dl *sdl = SDL(buf);
                        const void *bytes;
                        size_t size;
index 4ceed51bfa612419516223039695cb574b27c218..e02d052d9be98422f0ef545ce3e656791e3f7ef4 100644 (file)
@@ -384,6 +384,10 @@ struct rt_msghdr_ext {
 #define        RTM_GET_EXT     0x15
 #endif /* PRIVATE */
 
+#ifdef BSD_KERNEL_PRIVATE
+/* RTM flags */
+#define RTMF_HIDE_LLADDR               0x00000001
+#endif /* BSD_KERNEL_PRIVATE */
 /*
  * Bitmask values for rtm_inits and rmx_locks.
  */
@@ -577,7 +581,7 @@ extern unsigned int sin6_get_ifscope(struct sockaddr *);
 extern void rt_lock(struct rtentry *, boolean_t);
 extern void rt_unlock(struct rtentry *);
 extern struct sockaddr *rtm_scrub(int, int, struct sockaddr *,
-    struct sockaddr *, void *, uint32_t, kauth_cred_t *);
+    struct sockaddr *, void *, uint32_t, kauth_cred_t *, uint32_t);
 extern boolean_t rt_validate(struct rtentry *);
 extern void rt_set_proxy(struct rtentry *, boolean_t);
 extern void rt_set_gwroute(struct rtentry *, struct sockaddr *,
index 3af0a71d2c09863dddc3bd0900744b39b3e39ab4..c729343d2b92197c65f3d69eead084a9ba213515 100644 (file)
@@ -131,7 +131,7 @@ static void rt_setif(struct rtentry *, struct sockaddr *, struct sockaddr *,
 static int rt_xaddrs(caddr_t, caddr_t, struct rt_addrinfo *);
 static struct mbuf *rt_msg1(int, struct rt_addrinfo *);
 static int rt_msg2(int, struct rt_addrinfo *, caddr_t, struct walkarg *,
-    kauth_cred_t *);
+    kauth_cred_t *, uint32_t);
 static int sysctl_dumpentry(struct radix_node *rn, void *vw);
 static int sysctl_dumpentry_ext(struct radix_node *rn, void *vw);
 static int sysctl_iflist(int af, struct walkarg *w);
@@ -307,7 +307,7 @@ route_output(struct mbuf *m, struct socket *so)
        int sendonlytoself = 0;
        unsigned int ifscope = IFSCOPE_NONE;
        struct rawcb *rp = NULL;
-
+       uint32_t rtm_hint_flags = 0;
 #define        senderr(e) { error = (e); goto flush; }
        if (m == NULL || ((m->m_len < sizeof (intptr_t)) &&
            (m = m_pullup(m, sizeof (intptr_t))) == NULL))
@@ -519,6 +519,9 @@ route_output(struct mbuf *m, struct socket *so)
                        senderr(ESRCH);
                RT_LOCK(rt);
 
+               if (rt->rt_ifp == lo_ifp)
+                       rtm_hint_flags |= RTMF_HIDE_LLADDR;
+
                /*
                 * Holding rnh_lock here prevents the possibility of
                 * ifa from changing (e.g. in_ifinit), so it is safe
@@ -526,8 +529,10 @@ route_output(struct mbuf *m, struct socket *so)
                 */
                switch (rtm->rtm_type) {
                case RTM_GET: {
+                       kauth_cred_t cred;
                        struct ifaddr *ifa2;
 report:
+                       cred = kauth_cred_proc_ref(current_proc());
                        ifa2 = NULL;
                        RT_LOCK_ASSERT_HELD(rt);
                        info.rti_info[RTAX_DST] = rt_key(rt);
@@ -556,7 +561,9 @@ report:
                        }
                        if (ifa2 != NULL)
                                IFA_LOCK(ifa2);
-                       len = rt_msg2(rtm->rtm_type, &info, NULL, NULL, NULL);
+
+                       len = rt_msg2(rtm->rtm_type, &info, NULL, NULL, &cred, rtm_hint_flags);
+
                        if (ifa2 != NULL)
                                IFA_UNLOCK(ifa2);
                        if (len > rtm->rtm_msglen) {
@@ -573,8 +580,10 @@ report:
                        }
                        if (ifa2 != NULL)
                                IFA_LOCK(ifa2);
+
                        (void) rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm,
-                           NULL, NULL);
+                           NULL, &cred, rtm_hint_flags);
+
                        if (ifa2 != NULL)
                                IFA_UNLOCK(ifa2);
                        rtm->rtm_flags = rt->rt_flags;
@@ -1057,7 +1066,7 @@ rt_msg1(int type, struct rt_addrinfo *rtinfo)
 
                        /* Scrub away any trace of embedded interface scope */
                        sa = rtm_scrub(type, i, hint, sa, &ssbuf,
-                           sizeof (ssbuf), NULL);
+                           sizeof (ssbuf), NULL, 0);
                        break;
 
                default:
@@ -1082,7 +1091,7 @@ rt_msg1(int type, struct rt_addrinfo *rtinfo)
 
 static int
 rt_msg2(int type, struct rt_addrinfo *rtinfo, caddr_t cp, struct walkarg *w,
-       kauth_cred_t* credp)
+       kauth_cred_t* credp, uint32_t rtm_hint_flags)
 {
        int i;
        int len, dlen, rlen, second_time = 0;
@@ -1148,12 +1157,12 @@ again:
 
                        /* Scrub away any trace of embedded interface scope */
                        sa = rtm_scrub(type, i, hint, sa, &ssbuf,
-                           sizeof (ssbuf), NULL);
+                           sizeof (ssbuf), NULL, rtm_hint_flags);
                        break;
                case RTAX_GATEWAY:
                case RTAX_IFP:
                        sa = rtm_scrub(type, i, NULL, sa, &ssbuf,
-                           sizeof (ssbuf), credp);
+                           sizeof (ssbuf), credp, rtm_hint_flags);
                        break;
 
                default:
@@ -1468,6 +1477,7 @@ sysctl_dumpentry(struct radix_node *rn, void *vw)
        int error = 0, size;
        struct rt_addrinfo info;
        kauth_cred_t cred;
+       uint32_t rtm_hint_flags = 0;
 
        cred = kauth_cred_proc_ref(current_proc());
 
@@ -1480,8 +1490,11 @@ sysctl_dumpentry(struct radix_node *rn, void *vw)
        info.rti_info[RTAX_NETMASK] = rt_mask(rt);
        info.rti_info[RTAX_GENMASK] = rt->rt_genmask;
 
+       if (rt->rt_ifp == lo_ifp)
+               rtm_hint_flags |= RTMF_HIDE_LLADDR;
+
        if (w->w_op != NET_RT_DUMP2) {
-               size = rt_msg2(RTM_GET, &info, NULL, w, &cred);
+               size = rt_msg2(RTM_GET, &info, NULL, w, &cred, rtm_hint_flags);
                if (w->w_req != NULL && w->w_tmem != NULL) {
                        struct rt_msghdr *rtm =
                            (struct rt_msghdr *)(void *)w->w_tmem;
@@ -1497,7 +1510,7 @@ sysctl_dumpentry(struct radix_node *rn, void *vw)
                        error = SYSCTL_OUT(w->w_req, (caddr_t)rtm, size);
                }
        } else {
-               size = rt_msg2(RTM_GET2, &info, NULL, w, &cred);
+               size = rt_msg2(RTM_GET2, &info, NULL, w, &cred, rtm_hint_flags);
                if (w->w_req != NULL && w->w_tmem != NULL) {
                        struct rt_msghdr2 *rtm =
                            (struct rt_msghdr2 *)(void *)w->w_tmem;
@@ -1534,6 +1547,7 @@ sysctl_dumpentry_ext(struct radix_node *rn, void *vw)
        int error = 0, size;
        struct rt_addrinfo info;
        kauth_cred_t cred;
+       uint32_t rtm_hint_flags = 0;
 
        cred = kauth_cred_proc_ref(current_proc());
 
@@ -1546,7 +1560,10 @@ sysctl_dumpentry_ext(struct radix_node *rn, void *vw)
        info.rti_info[RTAX_NETMASK] = rt_mask(rt);
        info.rti_info[RTAX_GENMASK] = rt->rt_genmask;
 
-       size = rt_msg2(RTM_GET_EXT, &info, NULL, w, &cred);
+       if (rt->rt_ifp == lo_ifp)
+               rtm_hint_flags |= RTMF_HIDE_LLADDR;
+
+       size = rt_msg2(RTM_GET_EXT, &info, NULL, w, &cred, rtm_hint_flags);
        if (w->w_req != NULL && w->w_tmem != NULL) {
                struct rt_msghdr_ext *ertm =
                    (struct rt_msghdr_ext *)(void *)w->w_tmem;
@@ -1622,7 +1639,7 @@ sysctl_iflist(int af, struct walkarg *w)
                         */
                        ifa = ifp->if_lladdr;
                        info.rti_info[RTAX_IFP] = ifa->ifa_addr;
-                       len = rt_msg2(RTM_IFINFO, &info, NULL, NULL, &cred);
+                       len = rt_msg2(RTM_IFINFO, &info, NULL, NULL, &cred, RTMF_HIDE_LLADDR);
                        if (pass == 0) {
                                total_len += len;
                        } else {
@@ -1635,7 +1652,7 @@ sysctl_iflist(int af, struct walkarg *w)
                                }
                                info.rti_info[RTAX_IFP] = ifa->ifa_addr;
                                len = rt_msg2(RTM_IFINFO, &info,
-                                   (caddr_t)cp, NULL, &cred);
+                                   (caddr_t)cp, NULL, &cred, RTMF_HIDE_LLADDR);
                                info.rti_info[RTAX_IFP] = NULL;
 
                                ifm = (struct if_msghdr *)(void *)cp;
@@ -1659,7 +1676,7 @@ sysctl_iflist(int af, struct walkarg *w)
                                info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
                                info.rti_info[RTAX_BRD] = ifa->ifa_dstaddr;
                                len = rt_msg2(RTM_NEWADDR, &info, NULL, NULL,
-                                   &cred);
+                                   &cred, RTMF_HIDE_LLADDR);
                                if (pass == 0) {
                                        total_len += len;
                                } else {
@@ -1671,7 +1688,7 @@ sysctl_iflist(int af, struct walkarg *w)
                                                break;
                                        }
                                        len = rt_msg2(RTM_NEWADDR, &info,
-                                           (caddr_t)cp, NULL, &cred);
+                                           (caddr_t)cp, NULL, &cred, RTMF_HIDE_LLADDR);
 
                                        ifam = (struct ifa_msghdr *)(void *)cp;
                                        ifam->ifam_index =
@@ -1766,7 +1783,7 @@ sysctl_iflist2(int af, struct walkarg *w)
                         */
                        ifa = ifp->if_lladdr;
                        info.rti_info[RTAX_IFP] = ifa->ifa_addr;
-                       len = rt_msg2(RTM_IFINFO2, &info, NULL, NULL, &cred);
+                       len = rt_msg2(RTM_IFINFO2, &info, NULL, NULL, &cred, RTMF_HIDE_LLADDR);
                        if (pass == 0) {
                                total_len += len;
                        } else {
@@ -1779,7 +1796,7 @@ sysctl_iflist2(int af, struct walkarg *w)
                                }
                                info.rti_info[RTAX_IFP] = ifa->ifa_addr;
                                len = rt_msg2(RTM_IFINFO2, &info,
-                                   (caddr_t)cp, NULL, &cred);
+                                   (caddr_t)cp, NULL, &cred, RTMF_HIDE_LLADDR);
                                info.rti_info[RTAX_IFP] = NULL;
 
                                ifm = (struct if_msghdr2 *)(void *)cp;
@@ -1808,7 +1825,7 @@ sysctl_iflist2(int af, struct walkarg *w)
                                info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
                                info.rti_info[RTAX_BRD] = ifa->ifa_dstaddr;
                                len = rt_msg2(RTM_NEWADDR, &info, NULL, NULL,
-                                   &cred);
+                                   &cred, RTMF_HIDE_LLADDR);
                                if (pass == 0) {
                                        total_len += len;
                                } else {
@@ -1820,7 +1837,7 @@ sysctl_iflist2(int af, struct walkarg *w)
                                                break;
                                        }
                                        len = rt_msg2(RTM_NEWADDR, &info,
-                                           (caddr_t)cp, NULL, &cred);
+                                           (caddr_t)cp, NULL, &cred, RTMF_HIDE_LLADDR);
 
                                        ifam = (struct ifa_msghdr *)(void *)cp;
                                        ifam->ifam_index =
@@ -1864,7 +1881,7 @@ sysctl_iflist2(int af, struct walkarg *w)
                                        info.rti_info[RTAX_GATEWAY] =
                                            ifma->ifma_ll->ifma_addr;
                                len = rt_msg2(RTM_NEWMADDR2, &info, NULL, NULL,
-                                   &cred);
+                                   &cred, RTMF_HIDE_LLADDR);
                                if (pass == 0) {
                                        total_len += len;
                                } else {
@@ -1876,7 +1893,7 @@ sysctl_iflist2(int af, struct walkarg *w)
                                                break;
                                        }
                                        len = rt_msg2(RTM_NEWMADDR2, &info,
-                                           (caddr_t)cp, NULL, &cred);
+                                           (caddr_t)cp, NULL, &cred, RTMF_HIDE_LLADDR);
 
                                        ifmam =
                                            (struct ifma_msghdr2 *)(void *)cp;
index a918039f2e1a8414db8aa5a79b0ac3e8f6736e7a..b531933cc506f0b5e7072c74d15da991cba29164 100644 (file)
@@ -2823,13 +2823,9 @@ done:
 }
 
 static int
-flow_divert_connectx_out_common(struct socket *so, int af,
-    struct sockaddr_list **src_sl, struct sockaddr_list **dst_sl,
-    struct proc *p, uint32_t ifscope __unused, sae_associd_t aid __unused,
-    sae_connid_t *pcid, uint32_t flags __unused, void *arg __unused,
-    uint32_t arglen __unused, struct uio *auio, user_ssize_t *bytes_written)
+flow_divert_connectx_out_common(struct socket *so, struct sockaddr *dst,
+    struct proc *p, sae_connid_t *pcid, struct uio *auio, user_ssize_t *bytes_written)
 {
-       struct sockaddr_entry *src_se = NULL, *dst_se = NULL;
        struct inpcb *inp = sotoinpcb(so);
        int error;
 
@@ -2837,20 +2833,9 @@ flow_divert_connectx_out_common(struct socket *so, int af,
                return (EINVAL);
        }
 
-       VERIFY(dst_sl != NULL);
+       VERIFY(dst != NULL);
 
-       /* select source (if specified) and destination addresses */
-       error = in_selectaddrs(af, src_sl, &src_se, dst_sl, &dst_se);
-       if (error != 0) {
-               return (error);
-       }
-
-       VERIFY(*dst_sl != NULL && dst_se != NULL);
-       VERIFY(src_se == NULL || *src_sl != NULL);
-       VERIFY(dst_se->se_addr->sa_family == af);
-       VERIFY(src_se == NULL || src_se->se_addr->sa_family == af);
-
-       error = flow_divert_connect_out(so, dst_se->se_addr, p);
+       error = flow_divert_connect_out(so, dst, p);
 
        if (error != 0) {
                return error;
@@ -2893,26 +2878,22 @@ flow_divert_connectx_out_common(struct socket *so, int af,
 }
 
 static int
-flow_divert_connectx_out(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
-    sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
-    uint32_t arglen, struct uio *uio, user_ssize_t *bytes_written)
+flow_divert_connectx_out(struct socket *so, struct sockaddr *src __unused,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope __unused,
+    sae_associd_t aid __unused, sae_connid_t *pcid, uint32_t flags __unused, void *arg __unused,
+    uint32_t arglen __unused, struct uio *uio, user_ssize_t *bytes_written)
 {
-#pragma unused(uio, bytes_written)
-       return (flow_divert_connectx_out_common(so, AF_INET, src_sl, dst_sl,
-           p, ifscope, aid, pcid, flags, arg, arglen, uio, bytes_written));
+       return (flow_divert_connectx_out_common(so, dst, p, pcid, uio, bytes_written));
 }
 
 #if INET6
 static int
-flow_divert_connectx6_out(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
-    sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
-    uint32_t arglen, struct uio *uio, user_ssize_t *bytes_written)
-{
-#pragma unused(uio, bytes_written)
-       return (flow_divert_connectx_out_common(so, AF_INET6, src_sl, dst_sl,
-           p, ifscope, aid, pcid, flags, arg, arglen, uio, bytes_written));
+flow_divert_connectx6_out(struct socket *so, struct sockaddr *src __unused,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope __unused,
+    sae_associd_t aid __unused, sae_connid_t *pcid, uint32_t flags __unused, void *arg __unused,
+    uint32_t arglen __unused, struct uio *uio, user_ssize_t *bytes_written)
+{
+       return (flow_divert_connectx_out_common(so, dst, p, pcid, uio, bytes_written));
 }
 #endif /* INET6 */
 
index 267490025eab4cb4f088f47aa39714f79713e503..0645f96701e57673e5a0248d1d4ede934c0eb279 100644 (file)
@@ -741,8 +741,13 @@ inctl_ifaddr(struct ifnet *ifp, struct in_ifaddr *ia, u_long cmd,
                error = ifnet_ioctl(ifp, PF_INET, SIOCDIFADDR, ia);
                if (error == EOPNOTSUPP)
                        error = 0;
-               if (error != 0)
+               if (error != 0) {
+                       /* Reset the detaching flag */
+                       IFA_LOCK(&ia->ia_ifa);
+                       ia->ia_ifa.ifa_debug &= ~IFD_DETACHING;
+                       IFA_UNLOCK(&ia->ia_ifa);
                        break;
+               }
 
                /* Fill out the kernel event information */
                ev_msg.vendor_code      = KEV_VENDOR_APPLE;
@@ -1291,15 +1296,28 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp,
                        if (iap->ia_ifp == ifp &&
                            iap->ia_addr.sin_addr.s_addr ==
                            sa->sin_addr.s_addr) {
+                               /*
+                                * Avoid the race condition seen when two
+                                * threads process SIOCDIFADDR command
+                                * at the same time (radar 28942007)
+                                */
+                               if (cmd == SIOCDIFADDR) {
+                                       if (iap->ia_ifa.ifa_debug &
+                                           IFD_DETACHING) {
+                                               IFA_UNLOCK(&iap->ia_ifa);
+                                               continue;
+                                       } else {
+                                               iap->ia_ifa.ifa_debug |=
+                                                   IFD_DETACHING;
+                                       }
+                               }
                                ia = iap;
+                               IFA_ADDREF_LOCKED(&iap->ia_ifa);
                                IFA_UNLOCK(&iap->ia_ifa);
                                break;
                        }
                        IFA_UNLOCK(&iap->ia_ifa);
                }
-               /* take a reference on ia before releasing lock */
-               if (ia != NULL)
-                       IFA_ADDREF(&ia->ia_ifa);
                lck_rw_done(in_ifaddr_rwlock);
 
                if (ia == NULL) {
@@ -1911,120 +1929,6 @@ in_purgeaddrs(struct ifnet *ifp)
        }
 }
 
-/*
- * Select endpoint address(es).  For now just take the first matching
- * address and discard the rest, if present.
- */
-int
-in_selectaddrs(int af, struct sockaddr_list **src_sl,
-    struct sockaddr_entry **src_se, struct sockaddr_list **dst_sl,
-    struct sockaddr_entry **dst_se)
-{
-       struct sockaddr_entry *se = NULL;
-       struct sockaddr_entry *tse = NULL;
-       int error = 0;
-
-       VERIFY(src_sl != NULL && dst_sl != NULL && *dst_sl != NULL);
-       VERIFY(src_se != NULL && dst_se != NULL);
-
-       *src_se = *dst_se = NULL;
-
-       /* pick a source address, if available */
-       if (*src_sl != NULL) {
-               TAILQ_FOREACH(se, &(*src_sl)->sl_head, se_link) {
-                       VERIFY(se->se_addr != NULL);
-                       /*
-                        * Take the first source address, or the first
-                        * one with matching address family.
-                        */
-                       if (af == AF_UNSPEC || se->se_addr->sa_family == af) {
-                               sockaddrlist_remove(*src_sl, se);
-                               *src_se = se;
-                               break;
-                       }
-               }
-               /* get rid of the rest */
-               TAILQ_FOREACH_SAFE(se, &(*src_sl)->sl_head, se_link, tse) {
-                       sockaddrlist_remove(*src_sl, se);
-                       sockaddrentry_free(se);
-               }
-               if (*src_se != NULL) {
-                       /* insert the first src address back in */
-                       sockaddrlist_insert(*src_sl, *src_se);
-                       VERIFY((*src_sl)->sl_cnt == 1);
-                       /* destination address must be of this family */
-                       af = (*src_se)->se_addr->sa_family;
-               } else {
-                       /* no usable source address with matching family */
-                       VERIFY(af != AF_UNSPEC);
-                       error = EAFNOSUPPORT;
-                       goto out;
-               }
-       }
-       /* pick a (matching) destination address */
-       TAILQ_FOREACH(se, &(*dst_sl)->sl_head, se_link) {
-               VERIFY(se->se_addr != NULL);
-               /*
-                * Take the first destination address; if source is specified,
-                * find one which uses the same address family.
-                */
-               if (af == AF_UNSPEC || se->se_addr->sa_family == af) {
-                       sockaddrlist_remove(*dst_sl, se);
-                       *dst_se = se;
-                       break;
-               }
-       }
-       /* get rid of the rest */
-       TAILQ_FOREACH_SAFE(se, &(*dst_sl)->sl_head, se_link, tse) {
-               sockaddrlist_remove(*dst_sl, se);
-               sockaddrentry_free(se);
-       }
-       if (*dst_se != NULL) {
-               /* insert the first dst address back in */
-               sockaddrlist_insert(*dst_sl, *dst_se);
-               VERIFY((*dst_sl)->sl_cnt == 1);
-       } else {
-               /* source and destination address families don't match */
-               error = EAFNOSUPPORT;
-               goto out;
-       }
-
-       af = (*dst_se)->se_addr->sa_family;
-       VERIFY(*src_se == NULL || (*src_se)->se_addr->sa_family == af);
-
-       /* verify address length */
-       switch (af) {
-       case AF_INET:
-               if ((*dst_se)->se_addr->sa_len !=
-                   sizeof (struct sockaddr_in)) {
-                       error = EAFNOSUPPORT;
-                       goto out;
-               }
-               break;
-#if INET6
-       case AF_INET6:
-               if ((*dst_se)->se_addr->sa_len !=
-                   sizeof (struct sockaddr_in6)) {
-                       error = EAFNOSUPPORT;
-                       goto out;
-               }
-               break;
-#endif /* INET6 */
-       default:
-               error = EAFNOSUPPORT;
-               goto out;
-       }
-
-       /* if source address is specified, length must match destination */
-       if (*src_se != NULL && (*src_se)->se_addr->sa_len !=
-           (*dst_se)->se_addr->sa_len) {
-               error = EAFNOSUPPORT;
-               goto out;
-       }
-out:
-       return (error);
-}
-
 /*
  * Called as part of ip_init
  */
index f57b76805cd9cb761d4b548acda60e41bf4ff977..74918ba34611c88e26b926b9baea07ea658bbe0f 100644 (file)
@@ -461,7 +461,7 @@ struct ip_opts {
 #define        IP_BOUND_IF             25   /* int; set/get bound interface */
 #define        IP_PKTINFO              26   /* get pktinfo on recv socket, set src on sent dgram  */
 #define        IP_RECVPKTINFO          IP_PKTINFO      /* receive pktinfo w/dgram */
-
+#define        IP_RECVTOS              27   /* bool; receive IP TOS w/dgram */
 
 #define        IP_FW_ADD               40   /* add a firewall rule to chain */
 #define        IP_FW_DEL               41   /* delete a firewall rule from chain */
index 05fd56a3519a25dd76bdab4a9baa43f7ced15aea..11ad54fe27c56fd0784d80e1588dccd80b916c44 100644 (file)
@@ -663,6 +663,7 @@ struct inpcbinfo {
 #define        IN6P_RTHDR              0x00100000 /* receive routing header */
 #define        IN6P_RTHDRDSTOPTS       0x00200000 /* receive dstoptions before rthdr */
 #define        IN6P_TCLASS             0x00400000 /* receive traffic class value */
+#define        INP_RECVTOS             IN6P_TCLASS     /* receive incoming IP TOS */
 #define        IN6P_AUTOFLOWLABEL      0x00800000 /* attach flowlabel automatically */
 #endif /* BSD_KERNEL_PRIVATE */
 
index ed563523b729e20923fb885aa8ec59ce82b167f8..7368ed28d00cce5dd38e413d375f3fa55d1e96a5 100644 (file)
@@ -497,9 +497,6 @@ extern int in_ifadown(struct ifaddr *ifa, int);
 extern void in_ifscrub(struct ifnet *, struct in_ifaddr *, int);
 extern u_int32_t inaddr_hashval(u_int32_t);
 extern void in_purgeaddrs(struct ifnet *);
-extern int in_selectaddrs(int af, struct sockaddr_list **,
-    struct sockaddr_entry **, struct sockaddr_list **,
-    struct sockaddr_entry **);
 extern void gre_input(struct mbuf *, int);
 extern void imf_leave(struct in_mfilter *);
 extern void imf_purge(struct in_mfilter *);
index a4c4ea92ef2db078b4df85e44a3b252f4a53aa57..8088cb4cb954c34ae015e7f4f6e7bbb84892216f 100644 (file)
@@ -127,10 +127,12 @@ struct ip6_hdr {
 #if BYTE_ORDER == BIG_ENDIAN
 #define IPV6_FLOWINFO_MASK     0x0fffffff      /* flow info (28 bits) */
 #define IPV6_FLOWLABEL_MASK    0x000fffff      /* flow label (20 bits) */
+#define IPV6_FLOW_ECN_MASK     0x00300000      /* the 2 ECN bits */
 #else
 #if BYTE_ORDER == LITTLE_ENDIAN
 #define IPV6_FLOWINFO_MASK     0xffffff0f      /* flow info (28 bits) */
 #define IPV6_FLOWLABEL_MASK    0xffff0f00      /* flow label (20 bits) */
+#define IPV6_FLOW_ECN_MASK     0x00000300      /* the 2 ECN bits */
 #endif /* LITTLE_ENDIAN */
 #endif
 #if 1
@@ -139,6 +141,8 @@ struct ip6_hdr {
 #define IP6TOS_ECT             0x02    /* ECN-capable transport */
 #endif
 
+#define        IP6FLOW_ECN_MASK        0x00300000
+
 /*
  * To access the 6 bits of the DSCP value in the 32 bits ip6_flow field
  */
index 35d7a9f2076ec7e7525ec19f9a0944046de5a441..3b32f0ddef4e3ed73759a3a5794a8ad8ee0bcecc 100644 (file)
@@ -4231,6 +4231,13 @@ makedummy:
                        goto no_mbufs;
                }
        }
+       if (inp->inp_flags & INP_RECVTOS) {
+               mp = sbcreatecontrol_mbuf((caddr_t)&ip->ip_tos,
+                   sizeof(u_char), IP_RECVTOS, IPPROTO_IP, mp);
+               if (*mp == NULL) {
+                       goto no_mbufs;
+               }
+       }
        return (0);
 
 no_mbufs:
index 741bde155b2cde9bc3b9e251326927b39c09105b..9069bb8ba9f259e42b3e5ab38f0d080138916d02 100644 (file)
@@ -2464,6 +2464,7 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
                case IP_RECVIF:
                case IP_RECVTTL:
                case IP_RECVPKTINFO:
+               case IP_RECVTOS:
                        error = sooptcopyin(sopt, &optval, sizeof (optval),
                            sizeof (optval));
                        if (error)
@@ -2506,9 +2507,13 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
                        case IP_RECVPKTINFO:
                                OPTSET(INP_PKTINFO);
                                break;
+
+                       case IP_RECVTOS:
+                               OPTSET(INP_RECVTOS);
+                               break;
+ #undef OPTSET
                        }
                        break;
-#undef OPTSET
                /*
                 * Multicast socket options are processed by the in_mcast
                 * module.
@@ -2697,8 +2702,8 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
                case IP_RECVTTL:
                case IP_PORTRANGE:
                case IP_RECVPKTINFO:
+               case IP_RECVTOS:
                        switch (sopt->sopt_name) {
-
                        case IP_TOS:
                                optval = inp->inp_ip_tos;
                                break;
@@ -2741,6 +2746,10 @@ ip_ctloutput(struct socket *so, struct sockopt *sopt)
                        case IP_RECVPKTINFO:
                                optval = OPTBIT(INP_PKTINFO);
                                break;
+
+                       case IP_RECVTOS:
+                               optval = OPTBIT(INP_RECVTOS);
+                               break;
                        }
                        error = sooptcopyout(sopt, &optval, sizeof (optval));
                        break;
index 2e737e0cb009b44a1612a57bdf61b1ad9a181f3b..90ff36152480747ed75f0ffe0a422f7a5581b09a 100644 (file)
@@ -671,13 +671,13 @@ mptcp_subflow_free(struct mptsub *mpts)
        VERIFY(mpts->mpts_mpte == NULL);
        VERIFY(mpts->mpts_socket == NULL);
 
-       if (mpts->mpts_src_sl != NULL) {
-               sockaddrlist_free(mpts->mpts_src_sl);
-               mpts->mpts_src_sl = NULL;
+       if (mpts->mpts_src != NULL) {
+               FREE(mpts->mpts_src, M_SONAME);
+               mpts->mpts_src = NULL;
        }
-       if (mpts->mpts_dst_sl != NULL) {
-               sockaddrlist_free(mpts->mpts_dst_sl);
-               mpts->mpts_dst_sl = NULL;
+       if (mpts->mpts_dst != NULL) {
+               FREE(mpts->mpts_dst, M_SONAME);
+               mpts->mpts_dst = NULL;
        }
        MPTS_UNLOCK(mpts);
        lck_mtx_destroy(&mpts->mpts_lock, mtcbinfo.mppi_lock_grp);
@@ -896,21 +896,20 @@ mptcp_subflow_soconnectx(struct mptses *mpte, struct mptsub *mpts)
        af = mpts->mpts_family;
 
        if (af == AF_INET || af == AF_INET6) {
-               struct sockaddr_entry *dst_se;
+               struct sockaddr *dst;
                char dbuf[MAX_IPv6_STR_LEN];
 
-               dst_se = TAILQ_FIRST(&mpts->mpts_dst_sl->sl_head);
-               VERIFY(dst_se != NULL);
+               dst = mpts->mpts_dst;
 
                mptcplog((LOG_DEBUG, "MPTCP Socket: connectx mp_so 0x%llx "
                    "dst %s[%d] cid %d [pended %s]\n",
                    (u_int64_t)VM_KERNEL_ADDRPERM(mpte->mpte_mppcb->mpp_socket),
                    inet_ntop(af, ((af == AF_INET) ?
-                   (void *)&SIN(dst_se->se_addr)->sin_addr.s_addr :
-                   (void *)&SIN6(dst_se->se_addr)->sin6_addr),
+                   (void *)&SIN(dst)->sin_addr.s_addr :
+                   (void *)&SIN6(dst)->sin6_addr),
                    dbuf, sizeof (dbuf)), ((af == AF_INET) ?
-                   ntohs(SIN(dst_se->se_addr)->sin_port) :
-                   ntohs(SIN6(dst_se->se_addr)->sin6_port)),
+                   ntohs(SIN(dst)->sin_port) :
+                   ntohs(SIN6(dst)->sin6_port)),
                    mpts->mpts_connid,
                    ((mpts->mpts_flags & MPTSF_CONNECT_PENDING) ?
                    "YES" : "NO")),
@@ -923,7 +922,7 @@ mptcp_subflow_soconnectx(struct mptses *mpte, struct mptsub *mpts)
        mptcp_attach_to_subf(so, mpte->mpte_mptcb, mpte->mpte_addrid_last);
 
        /* connect the subflow socket */
-       error = soconnectxlocked(so, &mpts->mpts_src_sl, &mpts->mpts_dst_sl,
+       error = soconnectxlocked(so, mpts->mpts_src, mpts->mpts_dst,
            mpts->mpts_mpcr.mpcr_proc, mpts->mpts_mpcr.mpcr_ifscope,
            mpte->mpte_associd, NULL, CONNREQF_MPTCP,
            &mpts->mpts_mpcr, sizeof (mpts->mpts_mpcr), NULL, NULL);
@@ -1220,7 +1219,6 @@ int
 mptcp_subflow_add(struct mptses *mpte, struct mptsub *mpts,
     struct proc *p, uint32_t ifscope)
 {
-       struct sockaddr_entry *se, *src_se = NULL, *dst_se = NULL;
        struct socket *mp_so, *so = NULL;
        struct mptsub_connreq mpcr;
        struct mptcb *mp_tp;
@@ -1243,19 +1241,10 @@ mptcp_subflow_add(struct mptses *mpte, struct mptsub *mpts,
        VERIFY(!(mpts->mpts_flags & (MPTSF_CONNECTING|MPTSF_CONNECTED)));
        VERIFY(mpts->mpts_mpte == NULL);
        VERIFY(mpts->mpts_socket == NULL);
-       VERIFY(mpts->mpts_dst_sl != NULL);
+       VERIFY(mpts->mpts_dst != NULL);
        VERIFY(mpts->mpts_connid == SAE_CONNID_ANY);
 
-       /* select source (if specified) and destination addresses */
-       if ((error = in_selectaddrs(AF_UNSPEC, &mpts->mpts_src_sl, &src_se,
-           &mpts->mpts_dst_sl, &dst_se)) != 0)
-               goto out;
-
-       VERIFY(mpts->mpts_dst_sl != NULL && dst_se != NULL);
-       VERIFY(src_se == NULL || mpts->mpts_src_sl != NULL);
-       af = mpts->mpts_family = dst_se->se_addr->sa_family;
-       VERIFY(src_se == NULL || src_se->se_addr->sa_family == af);
-       VERIFY(af == AF_INET || af == AF_INET6);
+       af = mpts->mpts_family = mpts->mpts_dst->sa_family;
 
        /*
         * If the source address is not specified, allocate a storage for
@@ -1263,19 +1252,18 @@ mptcp_subflow_add(struct mptses *mpte, struct mptsub *mpts,
         * IP address chosen by the underlying layer for the subflow after
         * it is connected.
         */
-       if (mpts->mpts_src_sl == NULL) {
-               mpts->mpts_src_sl =
-                   sockaddrlist_dup(mpts->mpts_dst_sl, M_WAITOK);
-               if (mpts->mpts_src_sl == NULL) {
+       if (mpts->mpts_src == NULL) {
+               int len = mpts->mpts_dst->sa_len;
+
+               MALLOC(mpts->mpts_src, struct sockaddr *, len, M_SONAME,
+                   M_WAITOK | M_ZERO);
+               if (mpts->mpts_src == NULL) {
                        error = ENOBUFS;
                        goto out;
                }
-               se = TAILQ_FIRST(&mpts->mpts_src_sl->sl_head);
-               VERIFY(se != NULL && se->se_addr != NULL &&
-                   se->se_addr->sa_len == dst_se->se_addr->sa_len);
-               bzero(se->se_addr, se->se_addr->sa_len);
-               se->se_addr->sa_len = dst_se->se_addr->sa_len;
-               se->se_addr->sa_family = dst_se->se_addr->sa_family;
+               bzero(mpts->mpts_src, len);
+               mpts->mpts_src->sa_len = len;
+               mpts->mpts_src->sa_family = mpts->mpts_dst->sa_family;
        }
 
        /* create the subflow socket */
@@ -1331,8 +1319,8 @@ mptcp_subflow_add(struct mptses *mpte, struct mptsub *mpts,
        }
 
        /* if source address and/or port is specified, bind to it */
-       if (src_se != NULL) {
-               struct sockaddr *sa = src_se->se_addr;
+       if (mpts->mpts_src != NULL) {
+               struct sockaddr *sa = mpts->mpts_src;
                uint32_t mpts_flags = 0;
                in_port_t lport;
 
@@ -1475,11 +1463,11 @@ mptcp_subflow_add(struct mptses *mpte, struct mptsub *mpts,
                    "[pending %s]\n", __func__,
                    (u_int64_t)VM_KERNEL_ADDRPERM(mp_so),
                    inet_ntop(af, ((af == AF_INET) ?
-                   (void *)&SIN(dst_se->se_addr)->sin_addr.s_addr :
-                   (void *)&SIN6(dst_se->se_addr)->sin6_addr),
+                   (void *)&SIN(mpts->mpts_dst)->sin_addr.s_addr :
+                   (void *)&SIN6(mpts->mpts_dst)->sin6_addr),
                    dbuf, sizeof (dbuf)), ((af == AF_INET) ?
-                   ntohs(SIN(dst_se->se_addr)->sin_port) :
-                   ntohs(SIN6(dst_se->se_addr)->sin6_port)),
+                   ntohs(SIN(mpts->mpts_dst)->sin_port) :
+                   ntohs(SIN6(mpts->mpts_dst)->sin6_port)),
                    mpts->mpts_connid,
                    ((mpts->mpts_flags & MPTSF_CONNECT_PENDING) ?
                    "YES" : "NO")),
@@ -2701,7 +2689,6 @@ mptcp_subflow_connected_ev(struct mptses *mpte, struct mptsub *mpts,
        uint64_t *p_mpsofilt_hint)
 {
        char buf0[MAX_IPv6_STR_LEN], buf1[MAX_IPv6_STR_LEN];
-       struct sockaddr_entry *src_se, *dst_se;
        struct sockaddr_storage src;
        struct socket *mp_so, *so;
        struct mptcb *mp_tp;
@@ -2786,22 +2773,16 @@ mptcp_subflow_connected_ev(struct mptses *mpte, struct mptsub *mpts,
 
        tp->t_mpflags &= ~TMPF_TFO_REQUEST;
 
-       VERIFY(mpts->mpts_dst_sl != NULL);
-       dst_se = TAILQ_FIRST(&mpts->mpts_dst_sl->sl_head);
-       VERIFY(dst_se != NULL && dst_se->se_addr != NULL &&
-           dst_se->se_addr->sa_family == af);
+       VERIFY(mpts->mpts_dst != NULL);
 
-       VERIFY(mpts->mpts_src_sl != NULL);
-       src_se = TAILQ_FIRST(&mpts->mpts_src_sl->sl_head);
-       VERIFY(src_se != NULL && src_se->se_addr != NULL &&
-           src_se->se_addr->sa_family == af);
+       VERIFY(mpts->mpts_src != NULL);
 
        /* get/check source IP address */
        switch (af) {
        case AF_INET: {
                error = in_getsockaddr_s(so, &src);
                if (error == 0) {
-                       struct sockaddr_in *ms = SIN(src_se->se_addr);
+                       struct sockaddr_in *ms = SIN(mpts->mpts_src);
                        struct sockaddr_in *s = SIN(&src);
 
                        VERIFY(s->sin_len == ms->sin_len);
@@ -2828,7 +2809,7 @@ mptcp_subflow_connected_ev(struct mptses *mpte, struct mptsub *mpts,
        case AF_INET6: {
                error = in6_getsockaddr_s(so, &src);
                if (error == 0) {
-                       struct sockaddr_in6 *ms = SIN6(src_se->se_addr);
+                       struct sockaddr_in6 *ms = SIN6(mpts->mpts_src);
                        struct sockaddr_in6 *s = SIN6(&src);
 
                        VERIFY(s->sin6_len == ms->sin6_len);
@@ -2909,15 +2890,15 @@ mptcp_subflow_connected_ev(struct mptses *mpte, struct mptsub *mpts,
            "%s: cid %d outif %s %s[%d] -> %s[%d] "
            "is %s\n", __func__, mpts->mpts_connid, ((outifp != NULL) ?
            outifp->if_xname : "NULL"), inet_ntop(af, (af == AF_INET) ?
-           (void *)&SIN(src_se->se_addr)->sin_addr.s_addr :
-           (void *)&SIN6(src_se->se_addr)->sin6_addr, buf0, sizeof (buf0)),
-           ((af == AF_INET) ? ntohs(SIN(src_se->se_addr)->sin_port) :
-           ntohs(SIN6(src_se->se_addr)->sin6_port)),
+           (void *)&SIN(mpts->mpts_src)->sin_addr.s_addr :
+           (void *)&SIN6(mpts->mpts_src)->sin6_addr, buf0, sizeof (buf0)),
+           ((af == AF_INET) ? ntohs(SIN(mpts->mpts_src)->sin_port) :
+           ntohs(SIN6(mpts->mpts_src)->sin6_port)),
            inet_ntop(af, ((af == AF_INET) ?
-           (void *)&SIN(dst_se->se_addr)->sin_addr.s_addr :
-           (void *)&SIN6(dst_se->se_addr)->sin6_addr), buf1, sizeof (buf1)),
-           ((af == AF_INET) ? ntohs(SIN(dst_se->se_addr)->sin_port) :
-           ntohs(SIN6(dst_se->se_addr)->sin6_port)),
+           (void *)&SIN(mpts->mpts_dst)->sin_addr.s_addr :
+           (void *)&SIN6(mpts->mpts_dst)->sin6_addr), buf1, sizeof (buf1)),
+           ((af == AF_INET) ? ntohs(SIN(mpts->mpts_dst)->sin_port) :
+           ntohs(SIN6(mpts->mpts_dst)->sin6_port)),
            ((mpts->mpts_flags & MPTSF_MP_CAPABLE) ?
            "MPTCP capable" : "a regular TCP")),
            (MPTCP_SOCKET_DBG | MPTCP_EVENTS_DBG), MPTCP_LOGLVL_LOG);
@@ -2952,6 +2933,7 @@ mptcp_subflow_connected_ev(struct mptses *mpte, struct mptsub *mpts,
                        } else {
                                mpts->mpts_flags |= MPTSF_PREFERRED;
                        }
+                       mpts->mpts_flags |= MPTSF_ACTIVE;
                        soisconnected(mp_so);
                }
                MPTS_LOCK(mpts);
index a3118841a5a0dadfd084c00ed7922488e37aa576..cc84cb40ef257dace056d3e6f41d4e6e2a10bf87 100644 (file)
@@ -55,11 +55,11 @@ static int mptcp_usr_attach(struct socket *, int, struct proc *);
 static int mptcp_usr_detach(struct socket *);
 static int mptcp_attach(struct socket *, struct proc *);
 static int mptcp_detach(struct socket *, struct mppcb *);
-static int mptcp_connectx(struct mptses *, struct sockaddr_list **,
-    struct sockaddr_list **, struct proc *, uint32_t, sae_associd_t,
+static int mptcp_connectx(struct mptses *, struct sockaddr *,
+    struct sockaddr *, struct proc *, uint32_t, sae_associd_t,
     sae_connid_t *, uint32_t, void *, uint32_t);
-static int mptcp_usr_connectx(struct socket *, struct sockaddr_list **,
-    struct sockaddr_list **, struct proc *, uint32_t, sae_associd_t,
+static int mptcp_usr_connectx(struct socket *, struct sockaddr *,
+    struct sockaddr *, struct proc *, uint32_t, sae_associd_t,
     sae_connid_t *, uint32_t, void *, uint32_t, struct uio *, user_ssize_t *);
 static int mptcp_getassocids(struct mptses *, uint32_t *, user_addr_t);
 static int mptcp_getconnids(struct mptses *, sae_associd_t, uint32_t *,
@@ -245,8 +245,8 @@ mptcp_detach(struct socket *mp_so, struct mppcb *mpp)
  * or to join an existing one.  Returns a connection handle upon success.
  */
 static int
-mptcp_connectx(struct mptses *mpte, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
+mptcp_connectx(struct mptses *mpte, struct sockaddr *src,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope,
     sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
     uint32_t arglen)
 {
@@ -258,7 +258,7 @@ mptcp_connectx(struct mptses *mpte, struct sockaddr_list **src_sl,
        MPTE_LOCK_ASSERT_HELD(mpte);    /* same as MP socket lock */
        mp_so = mpte->mpte_mppcb->mpp_socket;
 
-       VERIFY(dst_sl != NULL && *dst_sl != NULL);
+       VERIFY(dst != NULL);
        VERIFY(pcid != NULL);
 
        mptcplog((LOG_DEBUG, "MPTCP Socket: "
@@ -276,12 +276,25 @@ mptcp_connectx(struct mptses *mpte, struct sockaddr_list **src_sl,
        }
        MPTS_ADDREF(mpts);              /* for this routine */
 
-       if (src_sl != NULL) {
-               mpts->mpts_src_sl = *src_sl;
-               *src_sl = NULL;
+       if (src != NULL) {
+               int len = src->sa_len;
+
+               MALLOC(mpts->mpts_src, struct sockaddr *, len, M_SONAME,
+                   M_WAITOK | M_ZERO);
+               if (mpts->mpts_src == NULL) {
+                       error = ENOBUFS;
+                       goto out;
+               }
+               bcopy(src, mpts->mpts_src, len);
+       }
+
+       MALLOC(mpts->mpts_dst, struct sockaddr *, dst->sa_len, M_SONAME,
+           M_WAITOK | M_ZERO);
+       if (mpts->mpts_dst == NULL) {
+               error = ENOBUFS;
+               goto out;
        }
-       mpts->mpts_dst_sl = *dst_sl;
-       *dst_sl = NULL;
+       bcopy(dst, mpts->mpts_dst, dst->sa_len);
 
        error = mptcp_subflow_add(mpte, mpts, p, ifscope);
        if (error == 0 && pcid != NULL)
@@ -309,8 +322,8 @@ out:
  * User-protocol pru_connectx callback.
  */
 static int
-mptcp_usr_connectx(struct socket *mp_so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
+mptcp_usr_connectx(struct socket *mp_so, struct sockaddr *src,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope,
     sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
     uint32_t arglen, struct uio *auio, user_ssize_t *bytes_written)
 {
@@ -336,7 +349,7 @@ mptcp_usr_connectx(struct socket *mp_so, struct sockaddr_list **src_sl,
                goto out;
        }
 
-       error = mptcp_connectx(mpte, src_sl, dst_sl, p, ifscope,
+       error = mptcp_connectx(mpte, src, dst, p, ifscope,
            aid, pcid, flags, arg, arglen);
 
        /* If there is data, copy it */
@@ -431,7 +444,6 @@ mptcp_getconninfo(struct mptses *mpte, sae_connid_t *cid, uint32_t *flags,
     user_addr_t aux_data, uint32_t *aux_len)
 {
 #pragma unused(aux_data)
-       struct sockaddr_entry *se;
        struct ifnet *ifp = NULL;
        struct mptsub *mpts;
        int error = 0;
@@ -479,22 +491,18 @@ mptcp_getconninfo(struct mptses *mpte, sae_connid_t *cid, uint32_t *flags,
        if (mpts->mpts_flags & MPTSF_ACTIVE)
                *flags |= CIF_MP_ACTIVE;
 
-       VERIFY(mpts->mpts_src_sl != NULL);
-       se = TAILQ_FIRST(&mpts->mpts_src_sl->sl_head);
-       VERIFY(se != NULL && se->se_addr != NULL);
-       *src_len = se->se_addr->sa_len;
+       VERIFY(mpts->mpts_src != NULL);
+       *src_len = mpts->mpts_src->sa_len;
        if (src != USER_ADDR_NULL) {
-               error = copyout(se->se_addr, src, se->se_addr->sa_len);
+               error = copyout(mpts->mpts_src, src, mpts->mpts_src->sa_len);
                if (error != 0)
                        goto out;
        }
 
-       VERIFY(mpts->mpts_dst_sl != NULL);
-       se = TAILQ_FIRST(&mpts->mpts_dst_sl->sl_head);
-       VERIFY(se != NULL && se->se_addr != NULL);
-       *dst_len = se->se_addr->sa_len;
+       VERIFY(mpts->mpts_dst != NULL);
+       *dst_len = mpts->mpts_dst->sa_len;
        if (dst != USER_ADDR_NULL) {
-               error = copyout(se->se_addr, dst, se->se_addr->sa_len);
+               error = copyout(mpts->mpts_dst, dst, mpts->mpts_dst->sa_len);
                if (error != 0)
                        goto out;
        }
@@ -503,10 +511,10 @@ mptcp_getconninfo(struct mptses *mpte, sae_connid_t *cid, uint32_t *flags,
        *aux_len = 0;
        if (mpts->mpts_socket != NULL) {
                struct conninfo_tcp tcp_ci;
-               
+
                *aux_type = CIAUX_TCP;
                *aux_len = sizeof (tcp_ci);
-               
+
                if (aux_data != USER_ADDR_NULL) {
                        struct socket *so = mpts->mpts_socket;
 
index 09dcac342fcef3c106c37cb340147a34ff75665b..46e47dc963b7d88740df1eca49cda9244ed75004 100644 (file)
@@ -145,8 +145,8 @@ struct mptsub {
        int32_t                 mpts_soerror;   /* most recent subflow error */
        struct mptses           *mpts_mpte;     /* back ptr to MPTCP session */
        struct socket           *mpts_socket;   /* subflow socket */
-       struct sockaddr_list    *mpts_src_sl;   /* source list */
-       struct sockaddr_list    *mpts_dst_sl;   /* destination list */
+       struct sockaddr         *mpts_src;      /* source address */
+       struct sockaddr         *mpts_dst;      /* destination address */
        struct ifnet            *mpts_outif;    /* outbound interface */
        u_int64_t               mpts_sndnxt;    /* next byte to send in mp so */
        u_int32_t               mpts_rel_seq;   /* running count of subflow # */
index 312f8c25239f71a920308c534c00bc41b9b7b218..35d85c160cc653ea8c9400afc775f0a8267e3607 100644 (file)
@@ -401,6 +401,8 @@ struct tcp_info {
        u_int32_t       tcpi_dsack_sent;        /* Sent DSACK notification */
        u_int32_t       tcpi_dsack_recvd;       /* Received a valid DSACK option */
        u_int32_t       tcpi_flowhash;          /* Unique id for the connection */
+
+       u_int64_t       tcpi_txretransmitpackets __attribute__((aligned(8)));
 };
 
 struct tcp_measure_bw_burst {
@@ -493,6 +495,7 @@ struct tcp_connection_info {
         u_int64_t      tcpi_rxpackets __attribute__((aligned(8)));
         u_int64_t      tcpi_rxbytes __attribute__((aligned(8)));
         u_int64_t      tcpi_rxoutoforderbytes __attribute__((aligned(8)));
+        u_int64_t      tcpi_txretransmitpackets __attribute__((aligned(8)));
 };
 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
 
index 2a48e2046de5b902cb097558959cc1073a91916d..7767910b8ed9f91ca1c2d0a72e541ee814a9c8f7 100644 (file)
@@ -397,7 +397,6 @@ void
 reset_acc_iaj(struct tcpcb *tp)
 {
        tp->acc_iaj = 0;
-       tp->iaj_rwintop = 0;
        CLEAR_IAJ_STATE(tp);
 }
 
@@ -3392,7 +3391,8 @@ findpcb:
 #endif /* MPTCP */
                                isconnected = TRUE;
 
-                       if (tp->t_tfo_flags & (TFO_F_COOKIE_REQ | TFO_F_COOKIE_SENT)) {
+                       if ((tp->t_tfo_flags & (TFO_F_COOKIE_REQ | TFO_F_COOKIE_SENT)) ||
+                           (tp->t_tfo_stats & TFO_S_SYN_DATA_SENT)) {
                                tcp_tfo_synack(tp, &to);
 
                                if ((tp->t_tfo_stats & TFO_S_SYN_DATA_SENT) &&
@@ -5943,6 +5943,9 @@ tcp_dropdropablreq(struct socket *head)
        if (TAILQ_EMPTY(&head->so_incomp))
                return (0);
 
+       so_acquire_accept_list(head, NULL);
+       socket_unlock(head, NULL);
+
        /*
         * Check if there is any socket in the incomp queue
         * that is closed because of a reset from the peer and is
@@ -6033,6 +6036,8 @@ tcp_dropdropablreq(struct socket *head)
                so = sonext;
        }
        if (so == NULL) {
+               socket_lock(head, 0);
+               so_release_accept_list(head);
                return (0);
        }
 
@@ -6040,6 +6045,8 @@ tcp_dropdropablreq(struct socket *head)
 
        if (in_pcb_checkstate(inp, WNT_RELEASE, 1) == WNT_STOPUSING) {
                tcp_unlock(so, 1, 0);
+               socket_lock(head, 0);
+               so_release_accept_list(head);
                return (0);
        }
 
@@ -6047,15 +6054,19 @@ found_victim:
        if (so->so_usecount != 2 || !(so->so_state & SS_INCOMP)) {
                /* do not discard: that socket is being accepted */
                tcp_unlock(so, 1, 0);
+               socket_lock(head, 0);
+               so_release_accept_list(head);
                return (0);
        }
 
+       socket_lock(head, 0);
        TAILQ_REMOVE(&head->so_incomp, so, so_list);
        head->so_incqlen--;
        head->so_qlen--;
        so->so_state &= ~SS_INCOMP;
        so->so_flags |= SOF_OVERFLOW;
        so->so_head = NULL;
+       so_release_accept_list(head);
        tcp_unlock(head, 0, 0);
 
        lck_mtx_assert(&inp->inpcb_mtx, LCK_MTX_ASSERT_OWNED);
index 75bd670292e53fed0279343ef8a6c63d66d39ffa..f37afed3a1d5b114b1409a79352c1dc555139c7d 100644 (file)
@@ -307,10 +307,9 @@ extern int fw_bypass;              /* firewall check: disable packet chaining if there is ru
 
 extern u_int32_t dlil_filter_disable_tso_count;
 extern u_int32_t kipf_count;
-extern int tcp_recv_bg;
 
-static int tcp_ip_output(struct socket *, struct tcpcb *, struct mbuf *, int,
-    struct mbuf *, int, int, int32_t, boolean_t);
+static int tcp_ip_output(struct socket *, struct tcpcb *, struct mbuf *,
+    int, struct mbuf *, int, int, boolean_t);
 static struct mbuf* tcp_send_lroacks(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th);
 static int tcp_recv_throttle(struct tcpcb *tp);
 
@@ -323,6 +322,9 @@ static int32_t tcp_tfo_check(struct tcpcb *tp, int32_t len)
        if (tp->t_flags & TF_NOOPT)
                goto fallback;
 
+       if (so->so_flags & SOF1_DATA_AUTHENTICATED)
+               return (len);
+
        if (!tcp_heuristic_do_tfo(tp)) {
                tp->t_tfo_stats |= TFO_S_HEURISTICS_DISABLE;
                tcpstat.tcps_tfo_heuristics_disable++;
@@ -401,14 +403,25 @@ tcp_tfo_write_cookie_rep(struct tcpcb *tp, unsigned optlen, u_char *opt)
 }
 
 static unsigned
-tcp_tfo_write_cookie(struct tcpcb *tp, unsigned optlen, int32_t *len,
+tcp_tfo_write_cookie(struct tcpcb *tp, unsigned optlen, int32_t len,
                     u_char *opt)
 {
        u_int8_t tfo_len = MAX_TCPOPTLEN - optlen - TCPOLEN_FASTOPEN_REQ;
+       struct socket *so = tp->t_inpcb->inp_socket;
        unsigned ret = 0;
        int res;
        u_char *bp;
 
+       if (so->so_flags & SOF1_DATA_AUTHENTICATED) {
+               /* If there is some data, let's track it */
+               if (len > 0) {
+                       tp->t_tfo_stats |= TFO_S_SYN_DATA_SENT;
+                       tcpstat.tcps_tfo_syn_data_sent++;
+               }
+
+               return (0);
+       }
+
        bp = opt + optlen;
 
        /*
@@ -435,7 +448,7 @@ tcp_tfo_write_cookie(struct tcpcb *tp, unsigned optlen, int32_t *len,
                tp->t_tfo_flags |= TFO_F_COOKIE_SENT;
 
                /* If there is some data, let's track it */
-               if (*len) {
+               if (len > 0) {
                        tp->t_tfo_stats |= TFO_S_SYN_DATA_SENT;
                        tcpstat.tcps_tfo_syn_data_sent++;
                }
@@ -1006,7 +1019,7 @@ after_sack_rexmit:
                                error = tcp_ip_output(so, tp, packetlist,
                                    packchain_listadd, tp_inp_options,
                                    (so_options & SO_DONTROUTE),
-                                   (sack_rxmit | (sack_bytes_rxmt != 0)), 0,
+                                   (sack_rxmit | (sack_bytes_rxmt != 0)),
                                    isipv6);
                        }
 
@@ -1240,24 +1253,16 @@ after_sack_rexmit:
        if (recwin < (int32_t)(so->so_rcv.sb_hiwat / 4) &&
            recwin < (int)tp->t_maxseg)
                recwin = 0;
-       if (tp->t_flags & TF_SLOWLINK && slowlink_wsize > 0) {
-               if (recwin > (int32_t)slowlink_wsize)
-                       recwin = slowlink_wsize;
-       }
 
 #if TRAFFIC_MGT
-       if (tcp_recv_bg == 1  || IS_TCP_RECV_BG(so)) {
+       if (tcp_recv_bg == 1 || IS_TCP_RECV_BG(so)) {
                if (recwin > 0 && tcp_recv_throttle(tp)) {
                        uint32_t min_iaj_win = tcp_min_iaj_win * tp->t_maxseg;
-                       if (tp->iaj_rwintop == 0 ||
-                           SEQ_LT(tp->iaj_rwintop, tp->rcv_adv))
-                               tp->iaj_rwintop = tp->rcv_adv;
-                       if (SEQ_LT(tp->iaj_rwintop,
-                           tp->rcv_nxt + min_iaj_win))
-                               tp->iaj_rwintop =  tp->rcv_nxt +
-                                   min_iaj_win;
-                       recwin = imin((int32_t)(tp->iaj_rwintop -
-                           tp->rcv_nxt), recwin);
+                       uint32_t bg_rwintop = tp->rcv_adv;
+                       if (SEQ_LT(bg_rwintop, tp->rcv_nxt + min_iaj_win))
+                               bg_rwintop =  tp->rcv_nxt + min_iaj_win;
+                       recwin = imin((int32_t)(bg_rwintop - tp->rcv_nxt),
+                           recwin);
                        if (recwin < 0)
                                recwin = 0;
                }
@@ -1436,8 +1441,7 @@ just_return:
                error = tcp_ip_output(so, tp, packetlist,
                    packchain_listadd,
                    tp_inp_options, (so_options & SO_DONTROUTE),
-                   (sack_rxmit | (sack_bytes_rxmt != 0)), recwin,
-                   isipv6);
+                   (sack_rxmit | (sack_bytes_rxmt != 0)), isipv6);
        }
        /* tcp was closed while we were in ip; resume close */
        if (inp->inp_sndinprog_cnt == 0 &&
@@ -1575,7 +1579,7 @@ send:
 
        if (tfo_enabled(tp) && !(tp->t_flags & TF_NOOPT) &&
            (flags & (TH_SYN | TH_ACK)) == TH_SYN)
-               optlen += tcp_tfo_write_cookie(tp, optlen, &len, opt);
+               optlen += tcp_tfo_write_cookie(tp, optlen, len, opt);
 
        if (tfo_enabled(tp) &&
            (flags & (TH_SYN | TH_ACK)) == (TH_SYN | TH_ACK) &&
@@ -2156,6 +2160,8 @@ send:
        }
        th->th_flags = flags;
        th->th_win = htons((u_short) (recwin>>tp->rcv_scale));
+       if (recwin > 0 && SEQ_LT(tp->rcv_adv, tp->rcv_nxt + recwin))
+               tp->rcv_adv = tp->rcv_nxt + recwin;
 
        /*
         * Adjust the RXWIN0SENT flag - indicate that we have advertised
@@ -2562,8 +2568,7 @@ timer:
                        error = tcp_ip_output(so, tp, packetlist,
                            packchain_listadd, tp_inp_options,
                            (so_options & SO_DONTROUTE),
-                           (sack_rxmit | (sack_bytes_rxmt != 0)), recwin,
-                           isipv6);
+                           (sack_rxmit | (sack_bytes_rxmt != 0)), isipv6);
                        if (error) {
                                /*
                                 * Take into account the rest of unsent
@@ -2632,7 +2637,8 @@ out:
                if (error == ENOBUFS) {
                        if (!tp->t_timer[TCPT_REXMT] &&
                            !tp->t_timer[TCPT_PERSIST] &&
-                           SEQ_GT(tp->snd_max, tp->snd_una))
+                           (SEQ_GT(tp->snd_max, tp->snd_una) ||
+                           so->so_snd.sb_cc > 0))
                                tp->t_timer[TCPT_REXMT] =
                                        OFFSET_FROM_START(tp, tp->t_rxtcur);
                        tp->snd_cwnd = tp->t_maxseg;
@@ -2692,8 +2698,7 @@ out:
 
 static int
 tcp_ip_output(struct socket *so, struct tcpcb *tp, struct mbuf *pkt,
-    int cnt, struct mbuf *opt, int flags, int sack_in_progress, int recwin,
-    boolean_t isipv6)
+    int cnt, struct mbuf *opt, int flags, int sack_in_progress, boolean_t isipv6)
 {
        int error = 0;
        boolean_t chain;
@@ -2793,14 +2798,9 @@ tcp_ip_output(struct socket *so, struct tcpcb *tp, struct mbuf *pkt,
                inp_route_copyout(inp, &ro);
 
        /*
-        * Data sent (as far as we can tell).
-        * If this advertises a larger window than any other segment,
-        * then remember the size of the advertised window.
         * Make sure ACK/DELACK conditions are cleared before
         * we unlock the socket.
         */
-       if (recwin > 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv))
-               tp->rcv_adv = tp->rcv_nxt + recwin;
        tp->last_ack_sent = tp->rcv_nxt;
        tp->t_flags &= ~(TF_ACKNOW | TF_DELACK);
        tp->t_timer[TCPT_DELACK] = 0;
index b8c06d6b096f84f80ab6bdb36363c86ae8102aa6..b2e18eb0580b8632b03669ccd2736db044d30d92 100644 (file)
@@ -2966,6 +2966,8 @@ tcp_sbrcv_grow_rwin(struct tcpcb *tp, struct sockbuf *sb)
        u_int32_t rcvbuf = sb->sb_hiwat;
        struct socket *so = tp->t_inpcb->inp_socket;
 
+       if (tcp_recv_bg == 1 || IS_TCP_RECV_BG(so))
+               return;
        /*
         * If message delivery is enabled, do not count
         * unordered bytes in receive buffer towards hiwat
@@ -3448,7 +3450,7 @@ tcp_make_keepalive_frame(struct tcpcb *tp, struct ifnet *ifp,
                ip->ip_id = ip_randomid();
                ip->ip_len = htons(sizeof(struct ip) + sizeof(struct tcphdr));
                ip->ip_ttl = inp->inp_ip_ttl;
-               ip->ip_tos = inp->inp_ip_tos;
+               ip->ip_tos |= (inp->inp_ip_tos & ~IPTOS_ECN_MASK);
                ip->ip_sum = in_cksum_hdr(ip);
        } else {
                struct ip6_hdr *ip6;
@@ -3457,6 +3459,7 @@ tcp_make_keepalive_frame(struct tcpcb *tp, struct ifnet *ifp,
 
                ip6->ip6_plen = htons(sizeof(struct tcphdr));
                ip6->ip6_hlim = in6_selecthlim(inp, ifp);
+               ip6->ip6_flow = ip6->ip6_flow & ~IPV6_FLOW_ECN_MASK;
 
                if (IN6_IS_SCOPE_EMBED(&ip6->ip6_src))
                        ip6->ip6_src.s6_addr16[1] = 0;
index e6ed974d2264c747df4f823d8e9e2894805ff2c7..5c87a2d1871bb68297b015016978072008ef5b11 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2017 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  *
@@ -949,7 +949,7 @@ tcp_timers(struct tcpcb *tp, int timer)
                        tp->t_stat.synrxtshift = tp->t_rxtshift;
 
                        /* When retransmitting, disable TFO */
-                       if (tfo_enabled(tp)) {
+                       if (tfo_enabled(tp) && !(so->so_flags & SOF1_DATA_AUTHENTICATED)) {
                                tp->t_flagsext &= ~TF_FASTOPEN;
                                tp->t_tfo_flags |= TFO_F_SYN_LOSS;
                        }
@@ -1866,19 +1866,20 @@ tcp_sched_timers(struct tcpcb *tp)
                        list_locked = TRUE;
                }
 
-               LIST_INSERT_HEAD(&listp->lhead, te, le);
-               tp->t_flags |= TF_TIMER_ONLIST;
+               if (!TIMER_IS_ON_LIST(tp)) {
+                       LIST_INSERT_HEAD(&listp->lhead, te, le);
+                       tp->t_flags |= TF_TIMER_ONLIST;
 
-               listp->entries++;
-               if (listp->entries > listp->maxentries)
-                       listp->maxentries = listp->entries;
+                       listp->entries++;
+                       if (listp->entries > listp->maxentries)
+                               listp->maxentries = listp->entries;
 
-               /* if the list is not scheduled, just schedule it */
-               if (!listp->scheduled)
-                       goto schedule;
+                       /* if the list is not scheduled, just schedule it */
+                       if (!listp->scheduled)
+                               goto schedule;
+               }
        }
 
-
        /*
         * Timer entry is currently on the list, check if the list needs
         * to be rescheduled.
index f50103ea04447d01573738b11aff33858056a226..a4ae7aaf43ca2355c4bcf1f7b4b0528128e9bb70 100644 (file)
@@ -490,7 +490,7 @@ tcp_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
 
 static int
 tcp_usr_connectx_common(struct socket *so, int af,
-    struct sockaddr_list **src_sl, struct sockaddr_list **dst_sl,
+    struct sockaddr *src, struct sockaddr *dst,
     struct proc *p, uint32_t ifscope, sae_associd_t aid, sae_connid_t *pcid,
     uint32_t flags, void *arg, uint32_t arglen, struct uio *auio,
     user_ssize_t *bytes_written)
@@ -499,7 +499,6 @@ tcp_usr_connectx_common(struct socket *so, int af,
 #if !MPTCP
 #pragma unused(flags, arg, arglen)
 #endif /* !MPTCP */
-       struct sockaddr_entry *src_se = NULL, *dst_se = NULL;
        struct inpcb *inp = sotoinpcb(so);
        int error;
        user_ssize_t datalen = 0;
@@ -507,20 +506,10 @@ tcp_usr_connectx_common(struct socket *so, int af,
        if (inp == NULL)
                return (EINVAL);
 
-       VERIFY(dst_sl != NULL);
-
-       /* select source (if specified) and destination addresses */
-       error = in_selectaddrs(af, src_sl, &src_se, dst_sl, &dst_se);
-       if (error != 0)
-               return (error);
-
-       VERIFY(*dst_sl != NULL && dst_se != NULL);
-       VERIFY(src_se == NULL || *src_sl != NULL);
-       VERIFY(dst_se->se_addr->sa_family == af);
-       VERIFY(src_se == NULL || src_se->se_addr->sa_family == af);
+       VERIFY(dst != NULL);
 
 #if NECP
-       inp_update_necp_policy(inp, src_se ? src_se->se_addr : NULL, dst_se ? dst_se->se_addr : NULL, ifscope);
+       inp_update_necp_policy(inp, src, dst, ifscope);
 #endif /* NECP */
 
        if ((so->so_flags1 & SOF1_DATA_IDEMPOTENT) &&
@@ -564,9 +553,8 @@ tcp_usr_connectx_common(struct socket *so, int af,
                        return (error);
 
                /* if source address and/or port is specified, bind to it */
-               if (src_se != NULL) {
-                       struct sockaddr *sa = src_se->se_addr;
-                       error = sobindlock(so, sa, 0);  /* already locked */
+               if (src != NULL) {
+                       error = sobindlock(so, src, 0); /* already locked */
                        if (error != 0)
                                return (error);
                }
@@ -574,11 +562,11 @@ tcp_usr_connectx_common(struct socket *so, int af,
 
        switch (af) {
        case AF_INET:
-               error = tcp_usr_connect(so, dst_se->se_addr, p);
+               error = tcp_usr_connect(so, dst, p);
                break;
 #if INET6
        case AF_INET6:
-               error = tcp6_usr_connect(so, dst_se->se_addr, p);
+               error = tcp6_usr_connect(so, dst, p);
                break;
 #endif /* INET6 */
        default:
@@ -622,14 +610,13 @@ tcp_usr_connectx_common(struct socket *so, int af,
 }
 
 static int
-tcp_usr_connectx(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
+tcp_usr_connectx(struct socket *so, struct sockaddr *src,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope,
     sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
     uint32_t arglen, struct uio *uio, user_ssize_t *bytes_written)
 {
-       return (tcp_usr_connectx_common(so, AF_INET, src_sl, dst_sl,
-           p, ifscope, aid, pcid, flags, arg, arglen, uio,
-           bytes_written));
+       return (tcp_usr_connectx_common(so, AF_INET, src, dst, p, ifscope, aid,
+           pcid, flags, arg, arglen, uio, bytes_written));
 }
 
 #if INET6
@@ -720,14 +707,13 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
 }
 
 static int
-tcp6_usr_connectx(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
+tcp6_usr_connectx(struct socket *so, struct sockaddr*src,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope,
     sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
     uint32_t arglen, struct uio *uio, user_ssize_t *bytes_written)
 {
-       return (tcp_usr_connectx_common(so, AF_INET6, src_sl, dst_sl,
-           p, ifscope, aid, pcid, flags, arg, arglen, uio,
-           bytes_written));
+       return (tcp_usr_connectx_common(so, AF_INET6, src, dst, p, ifscope, aid,
+           pcid, flags, arg, arglen, uio, bytes_written));
 }
 #endif /* INET6 */
 
@@ -1567,7 +1553,7 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti)
                        tp->t_bwmeas != NULL) {
                        ti->tcpi_snd_bw = (tp->t_bwmeas->bw_sndbw * 8000);
                }
-               
+
                ti->tcpi_last_outif = (tp->t_inpcb->inp_last_outifp == NULL) ? 0 :
                    tp->t_inpcb->inp_last_outifp->if_index;
 
@@ -1575,8 +1561,9 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti)
                ti->tcpi_txpackets = inp->inp_stat->txpackets;
                ti->tcpi_txbytes = inp->inp_stat->txbytes;
                ti->tcpi_txretransmitbytes = tp->t_stat.txretransmitbytes;
+               ti->tcpi_txretransmitpackets = tp->t_stat.rxmitpkts;
                ti->tcpi_txunacked = tp->snd_max - tp->snd_una;
-               
+
                //atomic_get_64(ti->tcpi_rxbytes, &inp->inp_stat->rxbytes);
                ti->tcpi_rxpackets = inp->inp_stat->rxpackets;
                ti->tcpi_rxbytes = inp->inp_stat->rxbytes;
@@ -1743,6 +1730,7 @@ tcp_connection_fill_info(struct tcpcb *tp, struct tcp_connection_info *tci)
                tci->tcpi_txpackets = inp->inp_stat->txpackets;
                tci->tcpi_txbytes = inp->inp_stat->txbytes;
                tci->tcpi_txretransmitbytes = tp->t_stat.txretransmitbytes;
+               tci->tcpi_txretransmitpackets = tp->t_stat.rxmitpkts;
                tci->tcpi_rxpackets = inp->inp_stat->rxpackets;
                tci->tcpi_rxbytes = inp->inp_stat->rxbytes;
                tci->tcpi_rxoutoforderbytes = tp->t_stat.rxoutoforderbytes;
index 42118d4136b6552e6a93e96ab923b1a07e434ef1..aeb7f3b567746ab83a05a7842b0f98203b51ffbe 100644 (file)
@@ -487,7 +487,6 @@ struct tcpcb {
        uint8_t         t_pipeack_ind;          /* index for next pipeack sample */
        uint16_t        iaj_pktcnt;             /* packet count, to avoid throttling initially */
        uint16_t        acc_iaj;                /* Accumulated iaj */
-       tcp_seq         iaj_rwintop;            /* recent max advertised window */
        uint32_t        avg_iaj;                /* Mean */
        uint32_t        std_dev_iaj;            /* Standard deviation */
 #endif /* TRAFFIC_MGT */
@@ -1450,6 +1449,7 @@ extern int tcp_ecn_inbound;
 extern u_int32_t tcp_autorcvbuf_max;
 extern u_int32_t tcp_autorcvbuf_max_ca;
 extern u_int32_t tcp_autorcvbuf_inc_shift;
+extern int tcp_recv_bg;
 
 struct protosw;
 struct domain;
index b1caebcdf0f18bf397d3d2ca69f14efb86de58a9..698aea8b6d4ff4fe4a615f7510d970abd695e023 100644 (file)
@@ -205,8 +205,8 @@ static int udp_abort(struct socket *);
 static int udp_attach(struct socket *, int, struct proc *);
 static int udp_bind(struct socket *, struct sockaddr *, struct proc *);
 static int udp_connect(struct socket *, struct sockaddr *, struct proc *);
-static int udp_connectx(struct socket *, struct sockaddr_list **,
-    struct sockaddr_list **, struct proc *, uint32_t, sae_associd_t,
+static int udp_connectx(struct socket *, struct sockaddr *,
+    struct sockaddr *, struct proc *, uint32_t, sae_associd_t,
     sae_connid_t *, uint32_t, void *, uint32_t, struct uio *, user_ssize_t *);
 static int udp_detach(struct socket *);
 static int udp_disconnect(struct socket *);
@@ -2002,14 +2002,12 @@ udp_connect(struct socket *so, struct sockaddr *nam, struct proc *p)
 }
 
 int
-udp_connectx_common(struct socket *so, int af,
-    struct sockaddr_list **src_sl, struct sockaddr_list **dst_sl,
+udp_connectx_common(struct socket *so, int af, struct sockaddr *src, struct sockaddr *dst,
     struct proc *p, uint32_t ifscope, sae_associd_t aid, sae_connid_t *pcid,
     uint32_t flags, void *arg, uint32_t arglen,
     struct uio *uio, user_ssize_t *bytes_written)
 {
 #pragma unused(aid, flags, arg, arglen)
-       struct sockaddr_entry *src_se = NULL, *dst_se = NULL;
        struct inpcb *inp = sotoinpcb(so);
        int error;
        user_ssize_t datalen = 0;
@@ -2017,21 +2015,10 @@ udp_connectx_common(struct socket *so, int af,
        if (inp == NULL)
                return (EINVAL);
 
-       VERIFY(dst_sl != NULL);
-
-       /* select source (if specified) and destination addresses */
-       error = in_selectaddrs(af, src_sl, &src_se, dst_sl, &dst_se);
-       if (error != 0)
-               return (error);
-
-       VERIFY(*dst_sl != NULL && dst_se != NULL);
-       VERIFY(src_se == NULL || *src_sl != NULL);
-       VERIFY(dst_se->se_addr->sa_family == af);
-       VERIFY(src_se == NULL || src_se->se_addr->sa_family == af);
+       VERIFY(dst != NULL);
 
 #if NECP
-       inp_update_necp_policy(inp, src_se ? src_se->se_addr : NULL,
-           dst_se ? dst_se->se_addr : NULL, ifscope);
+       inp_update_necp_policy(inp, src, dst, ifscope);
 #endif /* NECP */
 
        /* bind socket to the specified interface, if requested */
@@ -2040,20 +2027,19 @@ udp_connectx_common(struct socket *so, int af,
                return (error);
 
        /* if source address and/or port is specified, bind to it */
-       if (src_se != NULL) {
-               struct sockaddr *sa = src_se->se_addr;
-               error = sobindlock(so, sa, 0);  /* already locked */
+       if (src != NULL) {
+               error = sobindlock(so, src, 0); /* already locked */
                if (error != 0)
                        return (error);
        }
 
        switch (af) {
        case AF_INET:
-               error = udp_connect(so, dst_se->se_addr, p);
+               error = udp_connect(so, dst, p);
                break;
 #if INET6
        case AF_INET6:
-               error = udp6_connect(so, dst_se->se_addr, p);
+               error = udp6_connect(so, dst, p);
                break;
 #endif /* INET6 */
        default:
@@ -2099,12 +2085,12 @@ udp_connectx_common(struct socket *so, int af,
 }
 
 static int
-udp_connectx(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
+udp_connectx(struct socket *so, struct sockaddr *src,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope,
     sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
     uint32_t arglen, struct uio *uio, user_ssize_t *bytes_written)
 {
-       return (udp_connectx_common(so, AF_INET, src_sl, dst_sl,
+       return (udp_connectx_common(so, AF_INET, src, dst,
            p, ifscope, aid, pcid, flags, arg, arglen, uio, bytes_written));
 }
 
@@ -2609,7 +2595,7 @@ udp_fill_keepalive_offload_frames(ifnet_t ifp,
                        ip->ip_len = htons(sizeof(struct udpiphdr) +
                            (u_short)inp->inp_keepalive_datalen);
                        ip->ip_ttl = inp->inp_ip_ttl;
-                       ip->ip_tos = inp->inp_ip_tos;
+                       ip->ip_tos |= (inp->inp_ip_tos & ~IPTOS_ECN_MASK);
                        ip->ip_src = inp->inp_laddr;
                        ip->ip_dst = inp->inp_faddr;
                        ip->ip_sum = in_cksum_hdr_opt(ip);
@@ -2671,6 +2657,7 @@ udp_fill_keepalive_offload_frames(ifnet_t ifp,
                        }
                        m->m_pkthdr.len = m->m_len;
                        ip6->ip6_flow = inp->inp_flow & IPV6_FLOWINFO_MASK;
+                       ip6->ip6_flow = ip6->ip6_flow & ~IPV6_FLOW_ECN_MASK;
                        ip6->ip6_vfc &= ~IPV6_VERSION_MASK;
                        ip6->ip6_vfc |= IPV6_VERSION;
                        ip6->ip6_nxt = IPPROTO_UDP;
index e95dd8aebc98761c2c9e33ea23cfe0c5b1cebf5f..2eb1e0806139e02b65f252d28d4787caf09a487d 100644 (file)
@@ -167,8 +167,8 @@ extern void udp_ctlinput(int, struct sockaddr *, void *);
 extern int udp_ctloutput(struct socket *, struct sockopt *);
 extern void udp_init(struct protosw *, struct domain *);
 extern void udp_input(struct mbuf *, int);
-extern int udp_connectx_common(struct socket *, int, struct sockaddr_list **,
-    struct sockaddr_list **, struct proc *, uint32_t, sae_associd_t,
+extern int udp_connectx_common(struct socket *, int, struct sockaddr *,
+    struct sockaddr *, struct proc *, uint32_t, sae_associd_t,
     sae_connid_t *, uint32_t, void *, uint32_t, struct uio*, user_ssize_t *);
 extern void udp_notify(struct inpcb *inp, int errno);
 extern int udp_shutdown(struct socket *so);
index 4454449b05b0c1d2b369ed3237f724f421d66162..dd27747f73bfd91af84f0fdbe0dce675b93fcf02 100644 (file)
@@ -3211,10 +3211,6 @@ in6_multi_attach(struct in6_multi *in6m)
                panic("%s: Attempt to attach an already attached in6m=%p",
                    __func__, in6m);
                /* NOTREACHED */
-       } else if (in6m->in6m_debug & IFD_TRASHED) {
-               panic("%s: Attempt to reattach a detached in6m=%p",
-                   __func__, in6m);
-               /* NOTREACHED */
        }
 
        in6m->in6m_reqcnt++;
index 19f926ec4753cc10efc8e0687cf41be958a14f68..61302bab6ab8ce4c5ad82d7075d80edf1bf982fe 100644 (file)
@@ -2623,7 +2623,8 @@ ipsec6_update_routecache_and_output(
 
        adv = &ip6oa.ip6oa_flowadv;
        (void) ip6_output(state->m, NULL, &ro6_new, IPV6_OUTARGS, NULL, NULL, &ip6oa);
-
+       state->m = NULL;
+       
        if (adv->code == FADV_FLOW_CONTROLLED || adv->code == FADV_SUSPENDED) {
                error = ENOBUFS;
                ifnet_disable_output(sav->sah->ipsec_if);
@@ -4410,7 +4411,7 @@ ipsec_copypkt(struct mbuf *m)
                         * XXX: is this approach effective?
                         */
                        if (
-                               n->m_ext.ext_free ||
+                               m_get_ext_free(n) != NULL ||
                                m_mclhasreference(n)
                            )
                        {
index aa1964dfc223650f3564fbdfb6e45dbfedeac218..b939c58bb574ab24b25981ce1d7800bf2e7ad653 100644 (file)
@@ -153,8 +153,8 @@ extern int esp_udp_encap_port;
 static int udp6_abort(struct socket *);
 static int udp6_attach(struct socket *, int, struct proc *);
 static int udp6_bind(struct socket *, struct sockaddr *, struct proc *);
-static int udp6_connectx(struct socket *, struct sockaddr_list **,
-    struct sockaddr_list **, struct proc *, uint32_t, sae_associd_t,
+static int udp6_connectx(struct socket *, struct sockaddr *,
+    struct sockaddr *, struct proc *, uint32_t, sae_associd_t,
     sae_connid_t *, uint32_t, void *, uint32_t, struct uio *, user_ssize_t *);
 static int udp6_detach(struct socket *);
 static int udp6_disconnect(struct socket *);
@@ -839,12 +839,12 @@ do_flow_divert:
 }
 
 static int
-udp6_connectx(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *p, uint32_t ifscope,
+udp6_connectx(struct socket *so, struct sockaddr *src,
+    struct sockaddr *dst, struct proc *p, uint32_t ifscope,
     sae_associd_t aid, sae_connid_t *pcid, uint32_t flags, void *arg,
     uint32_t arglen, struct uio *uio, user_ssize_t *bytes_written)
 {
-       return (udp_connectx_common(so, AF_INET6, src_sl, dst_sl,
+       return (udp_connectx_common(so, AF_INET6, src, dst,
            p, ifscope, aid, pcid, flags, arg, arglen, uio, bytes_written));
 }
 
index 23a5fff24339810ae840ba1c94a615e62e43d083..f1be1810444ff21bea28c378935b04ec33f9b6e2 100644 (file)
@@ -690,9 +690,9 @@ kdebug_mbufhdr(m)
                printf("  m_ext{ ext_buf:0x%llx ext_free:0x%llx "
                       "ext_size:%u ext_ref:0x%llx }\n",
                        (uint64_t)VM_KERNEL_ADDRPERM(m->m_ext.ext_buf),
-                       (uint64_t)VM_KERNEL_ADDRPERM(m->m_ext.ext_free),
+                       (uint64_t)VM_KERNEL_ADDRPERM(m_get_ext_free(m)),
                        m->m_ext.ext_size,
-                       (uint64_t)VM_KERNEL_ADDRPERM(m->m_ext.ext_refs));
+                       (uint64_t)VM_KERNEL_ADDRPERM(m_get_rfa(m));
        }
 
        return;
index bb8cf8433ac7871257044588bef53cd0c956669d..0232e77a123dc8ed962ab96745168db1243f5783 100644 (file)
@@ -587,7 +587,7 @@ struct nfs_export_stat_counters {
        struct nfsstatcount64 ops;              /* Count of NFS Requests received for this export  */
        struct nfsstatcount64 bytes_read;       /* Count of bytes read from this export */
        struct nfsstatcount64 bytes_written;    /* Count of bytes written to his export */
-}__attribute__((__packed__));
+};
 
 /* Macro for updating nfs export stat counters */
 #define NFSStatAdd64(PTR, VAL) \
index a018cdaa77dc760fcf23cd33f75b33dbae2732ff..13e4ad3ff22af859dd07b9324f1acc4e9b7c533d 100644 (file)
@@ -157,7 +157,16 @@ nfs4_access_rpc(nfsnode_t np, u_int32_t *access, int rpcflags, vfs_context_t ctx
        nfsm_chain_loadattr(error, &nmrep, np, nfsvers, &xid);
        nfsmout_if(error);
 
-       uid = kauth_cred_getuid(vfs_context_ucred(ctx));
+       if (nfs_mount_gone(nmp)) {
+               error = ENXIO;
+       }
+       nfsmout_if(error);
+
+       if (auth_is_kerberized(np->n_auth) || auth_is_kerberized(nmp->nm_auth)) {
+               uid = nfs_cred_getasid2uid(vfs_context_ucred(ctx));
+       } else {
+               uid = kauth_cred_getuid(vfs_context_ucred(ctx));
+       }
        slot = nfs_node_access_slot(np, uid, 1);
        np->n_accessuid[slot] = uid;
        microuptime(&now);
index 7431b656234ec9e60e49bd7c9dd0ace20d607038..7a24596c83aecae09ef071b8cfeba570b98d3376 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2014 Apple Inc.  All rights reserved.
+ * Copyright (c) 2000-2016 Apple Inc.  All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -2078,6 +2078,7 @@ nfsrv_create(
                        ni.ni_cnd.cn_context = ctx;
                        ni.ni_startdir = dvp;
                        ni.ni_usedvp   = dvp;
+                       ni.ni_rootdir = rootvnode;
                        cnflags = ni.ni_cnd.cn_flags; /* store in case we have to restore */
                        while ((error = lookup(&ni)) == ERECYCLE) {
                                ni.ni_cnd.cn_flags = cnflags;
@@ -2352,6 +2353,7 @@ nfsrv_mknod(
                ni.ni_cnd.cn_context = vfs_context_current();
                ni.ni_startdir = dvp;
                ni.ni_usedvp   = dvp;
+               ni.ni_rootdir = rootvnode;
                cnflags = ni.ni_cnd.cn_flags; /* store in case we have to restore */
                while ((error = lookup(&ni)) == ERECYCLE) {
                        ni.ni_cnd.cn_flags = cnflags;
@@ -3502,6 +3504,7 @@ nfsrv_symlink(
                        ni.ni_cnd.cn_context = ctx;
                        ni.ni_startdir = dvp;
                        ni.ni_usedvp   = dvp;
+                       ni.ni_rootdir = rootvnode;
                        cnflags = ni.ni_cnd.cn_flags; /* store in case we have to restore */
                        while ((error = lookup(&ni)) == ERECYCLE) {
                                ni.ni_cnd.cn_flags = cnflags;
index 8496093a9fac2230ec36d2b81f5772ba6ac027ea..d9d6e016b6e6a3aacf08b210cb080df172433b42 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -2188,6 +2188,7 @@ nfsrv_namei(
        cnp->cn_flags |= NOCROSSMOUNT;
        cnp->cn_nameptr = cnp->cn_pnbuf;
        nip->ni_usedvp = nip->ni_startdir = dp;
+       nip->ni_rootdir = rootvnode;
 
        /*
         * And call lookup() to do the real work
@@ -3109,6 +3110,7 @@ nfsrv_export(struct user_nfs_export_args *unxa, vfs_context_t ctx)
                                        xnd.ni_cnd.cn_nameptr = xnd.ni_cnd.cn_pnbuf = path;
                                        xnd.ni_startdir = mvp;
                                        xnd.ni_usedvp   = mvp;
+                                       xnd.ni_rootdir = rootvnode;
                                        xnd.ni_cnd.cn_context = ctx;
                                        while ((error = lookup(&xnd)) == ERECYCLE) {
                                                xnd.ni_cnd.cn_flags = LOCKLEAF;
index dcff07169f10fb009f2965fca1de38c500fdd98c..f6524f3bb8746613c0fd4a1772dd35006b272cc5 100644 (file)
@@ -627,6 +627,10 @@ nfs_vfs_getattr(mount_t mp, struct vfs_attr *fsap, vfs_context_t ctx)
 //                     caps |= VOL_CAP_FMT_OPENDENYMODES;
 //                     valid |= VOL_CAP_FMT_OPENDENYMODES;
                }
+               // no version of nfs supports immutable files
+               caps |= VOL_CAP_FMT_NO_IMMUTABLE_FILES;
+               valid |= VOL_CAP_FMT_NO_IMMUTABLE_FILES;
+
                fsap->f_capabilities.capabilities[VOL_CAPABILITIES_FORMAT] =
                        // VOL_CAP_FMT_PERSISTENTOBJECTIDS |
                        // VOL_CAP_FMT_SYMBOLICLINKS |
index 860338b3c0d4f0a3bf1bd9c05ccfac095c812f92..38653ed5a583265443bffbdf204287effaaf5e04 100644 (file)
@@ -479,6 +479,7 @@ nfs3_access_rpc(nfsnode_t np, u_int32_t *access, int rpcflags, vfs_context_t ctx
        uint32_t access_result = 0;
        u_int64_t xid;
        struct nfsm_chain nmreq, nmrep;
+       struct nfsmount *nmp;
        struct timeval now;
        uid_t uid;
 
@@ -501,7 +502,18 @@ nfs3_access_rpc(nfsnode_t np, u_int32_t *access, int rpcflags, vfs_context_t ctx
        nfsm_chain_get_32(error, &nmrep, access_result);
        nfsmout_if(error);
 
-       uid = kauth_cred_getuid(vfs_context_ucred(ctx));
+       /* XXXab do we really need mount here, also why are we doing access cache management here? */
+       nmp = NFSTONMP(np);
+       if (nfs_mount_gone(nmp)) {
+               error = ENXIO;
+       }
+       nfsmout_if(error);
+
+       if (auth_is_kerberized(np->n_auth) || auth_is_kerberized(nmp->nm_auth)) {
+               uid = nfs_cred_getasid2uid(vfs_context_ucred(ctx));
+       } else {
+               uid = kauth_cred_getuid(vfs_context_ucred(ctx));
+       }
        slot = nfs_node_access_slot(np, uid, 1);
        np->n_accessuid[slot] = uid;
        microuptime(&now);
@@ -1785,6 +1797,7 @@ nfs_vnop_setattr(
        u_quad_t origsize, vapsize;
        struct nfs_dulookup dul;
        nfsnode_t dnp = NULL;
+       int dul_in_progress = 0;
        vnode_t dvp = NULL;
        const char *vname = NULL;
        struct nfs_open_owner *noop = NULL;
@@ -1993,15 +2006,19 @@ restart:
                        vname = vnode_getname(vp);
                        dnp = (dvp && vname) ? VTONFS(dvp) : NULL;
                        if (dnp) {
-                               error = nfs_node_set_busy(dnp, vfs_context_thread(ctx));
-                               if (error) {
-                                       dnp = NULL;
-                                       error = 0;
+                               if (nfs_node_set_busy(dnp, vfs_context_thread(ctx))) {
+                                       vnode_put(dvp);
+                                       vnode_putname(vname);
+                               } else {
+                                       nfs_dulookup_init(&dul, dnp, vname, strlen(vname), ctx);
+                                       nfs_dulookup_start(&dul, dnp, ctx);
+                                       dul_in_progress = 1;
                                }
-                       }
-                       if (dnp) {
-                               nfs_dulookup_init(&dul, dnp, vname, strlen(vname), ctx);
-                               nfs_dulookup_start(&dul, dnp, ctx);
+                       } else {
+                               if (dvp)
+                                       vnode_put(dvp);
+                               if (vname)
+                                       vnode_putname(vname);
                        }
                }
        }
@@ -2009,18 +2026,11 @@ restart:
        if (!error)
                error = nmp->nm_funcs->nf_setattr_rpc(np, vap, ctx);
 
-       if (VATTR_IS_ACTIVE(vap, va_mode) || VATTR_IS_ACTIVE(vap, va_uid) || VATTR_IS_ACTIVE(vap, va_gid) ||
-           VATTR_IS_ACTIVE(vap, va_acl) || VATTR_IS_ACTIVE(vap, va_uuuid) || VATTR_IS_ACTIVE(vap, va_guuid)) {
-               if (!namedattrs) {
-                       if (dnp) {
-                               nfs_dulookup_finish(&dul, dnp, ctx);
-                               nfs_node_clear_busy(dnp);
-                       }
-                       if (dvp != NULLVP)
-                               vnode_put(dvp);
-                       if (vname != NULL)
-                               vnode_putname(vname);
-               }
+       if (dul_in_progress) {
+               nfs_dulookup_finish(&dul, dnp, ctx);
+               nfs_node_clear_busy(dnp);
+               vnode_put(dvp);
+               vnode_putname(vname);
        }
 
        FSDBG_BOT(512, np->n_size, vap->va_data_size, np->n_vattr.nva_size, error);
index c90fd77617c1ac593acc32222a50d244e5f54f40..f519a269029223eea9d6acf7265d8a507cc6fb82 100644 (file)
 #include <libkern/OSKextLib.h>
 
 
-/*
- * This tells compiler_rt not to include userspace-specific stuff writing
- * profile data to a file.
- */
-int __llvm_profile_runtime = 0;
-
-
 #ifdef PROFILE
 
 /* These __llvm functions are defined in InstrProfiling.h in compiler_rt.  That
@@ -207,6 +200,9 @@ int grab_pgo_data(struct proc *p,
                     }
 
                     err = OSKextGrabPgoData(uuid, &size64, NULL, 0, 0, !!(uap->flags & PGO_METADATA));
+                    if (size64 == 0 && err == 0) {
+                        err = EIO;
+                    }
                     if (err) {
                         goto out;
                     }
@@ -230,22 +226,38 @@ int grab_pgo_data(struct proc *p,
 
                 } else {
 
-                    MALLOC(buffer, char *, uap->size, M_TEMP, M_WAITOK);
+                    uint64_t size64 = 0 ;
+
+                    err = OSKextGrabPgoData(uuid, &size64, NULL, 0,
+                                            false,
+                                            !!(uap->flags & PGO_METADATA));
+
+                    if (size64 == 0 && err == 0) {
+                        err = EIO;
+                    }
+                    if (err) {
+                        goto out;
+                    }
+
+                    if (uap->size < 0 || (uint64_t)uap->size < size64) {
+                        err = EINVAL;
+                        goto out;
+                    }
+
+                    MALLOC(buffer, char *, size64, M_TEMP, M_WAITOK);
                     if (!buffer) {
                         err = ENOMEM;
                         goto out;
                     }
 
-                    uint64_t size64;
-
-                    err = OSKextGrabPgoData(uuid, &size64, buffer, uap->size,
+                    err = OSKextGrabPgoData(uuid, &size64, buffer, size64,
                                             !!(uap->flags & PGO_WAIT_FOR_UNLOAD),
                                             !!(uap->flags & PGO_METADATA));
                     if (err) {
                         goto out;
                     }
 
-                    ssize_t size = size64;
+                    ssize_t size = size64;                    
                     if ( ((uint64_t) size) != size64  ||
                          size < 0 )
                     {
diff --git a/bsd/pgo/profile_runtime_data.c b/bsd/pgo/profile_runtime_data.c
new file mode 100644 (file)
index 0000000..3bfc33d
--- /dev/null
@@ -0,0 +1,5 @@
+/*
+ * This tells compiler_rt not to include userspace-specific stuff writing
+ * profile data to a file.
+ */
+int __llvm_profile_runtime = 0;
index 00f65b3e0ba7b803d4f456f655ab6bb5128fd965..71f3e0716a5e1d27cb6bb9f8a9532ca1c2f221fb 100644 (file)
@@ -354,7 +354,6 @@ void
 audit_arg_sockaddr(struct kaudit_record *ar, struct vnode *cwd_vp,
     struct sockaddr *sa)
 {
-       int slen;
        struct sockaddr_un *sun;
        char path[SOCK_MAXADDRLEN - offsetof(struct sockaddr_un, sun_path) + 1];
 
@@ -363,7 +362,11 @@ audit_arg_sockaddr(struct kaudit_record *ar, struct vnode *cwd_vp,
        if (cwd_vp == NULL || sa == NULL)
                return;
 
-       bcopy(sa, &ar->k_ar.ar_arg_sockaddr, sa->sa_len);
+       if (sa->sa_len > sizeof(ar->k_ar.ar_arg_sockaddr))
+               bcopy(sa, &ar->k_ar.ar_arg_sockaddr, sizeof(ar->k_ar.ar_arg_sockaddr));
+       else
+               bcopy(sa, &ar->k_ar.ar_arg_sockaddr, sa->sa_len);
+
        switch (sa->sa_family) {
        case AF_INET:
                ARG_SET_VALID(ar, ARG_SADDRINET);
@@ -375,20 +378,12 @@ audit_arg_sockaddr(struct kaudit_record *ar, struct vnode *cwd_vp,
 
        case AF_UNIX:
                sun = (struct sockaddr_un *)sa;
-               slen = sun->sun_len - offsetof(struct sockaddr_un, sun_path);
-
-               if (slen >= 0) {
+               if (sun->sun_len > offsetof(struct sockaddr_un, sun_path)) {
                        /*
                         * Make sure the path is NULL-terminated
                         */
-                       if (sun->sun_path[slen] != 0) {
-                               bcopy(sun->sun_path, path, slen);
-                               path[slen] = 0;
-                               audit_arg_upath(ar, cwd_vp, path, ARG_UPATH1);
-                       } else {
-                               audit_arg_upath(ar, cwd_vp, sun->sun_path, 
-                                       ARG_UPATH1);
-                       }
+                       strlcpy(path, sun->sun_path, sizeof(path));
+                       audit_arg_upath(ar, cwd_vp, path, ARG_UPATH1);
                }
                ARG_SET_VALID(ar, ARG_SADDRUNIX);
                break;
index e62a0b9e3326789c4eb708e7b5c185aedddb9f62..15c03f66b69a9228c7c0e774449ce2b71255aae0 100644 (file)
@@ -220,6 +220,12 @@ static const bsm_fcntl_cmd_t bsm_fcntl_cmdtab[] = {
 #ifdef F_BARRIERFSYNC
        { BSM_F_BARRIERFSYNC,   F_BARRIERFSYNC },
 #endif
+#ifdef F_PUNCHHOLE
+       { BSM_F_PUNCHHOLE,      F_PUNCHHOLE },
+#endif
+#ifdef F_TRIM_ACTIVE_FILE
+       { BSM_F_TRIM_ACTIVE_FILE,       F_TRIM_ACTIVE_FILE },
+#endif
 
 #ifdef FCNTL_FS_SPECIFIC_BASE
        { BSM_F_FS_SPECIFIC_0,  FCNTL_FS_SPECIFIC_BASE},
index f2efbbe089accb9c75ce9d767f7e2bd478a485c7..7d7501a557f649d822174ce19a16576972e546c1 100644 (file)
@@ -694,7 +694,7 @@ audit_pipe_open(dev_t dev, __unused int flags,  __unused int devtype,
        int u;
 
        u = minor(dev);
-       if (u < 0 || u > MAX_AUDIT_PIPES)
+       if (u < 0 || u >= MAX_AUDIT_PIPES)
                return (ENXIO);
 
        AUDIT_PIPE_LIST_WLOCK();
index 7b6236eda695193280230a9eb169edbf474aa139..f7e3ac51ca49c8c5f4c98e118f37dcbc0d03ecd8 100644 (file)
@@ -1701,7 +1701,7 @@ audit_sdev_open(dev_t dev, __unused int flags,  __unused int devtype, proc_t p)
        int u;
 
        u = minor(dev);
-       if (u < 0 || u > MAX_AUDIT_SDEVS)
+       if (u < 0 || u >= MAX_AUDIT_SDEVS)
                return (ENXIO);
 
        (void) audit_sdev_get_aia(p, &aia);
index a95c6e4c8bd2e65a1c2d83b698f2946c30638d24..e6302b3869684d9a5f091f3ab75416eaebf37ec9 100644 (file)
 #define        SEEK_CUR        1       /* set file offset to current plus offset */
 #define        SEEK_END        2       /* set file offset to EOF plus offset */
 #endif /* !SEEK_SET */
+
+#ifndef SEEK_HOLE
+#define        SEEK_HOLE       3       /* set file offset to the start of the next hole greater than or equal to the supplied offset */
+#endif
+
+#ifndef SEEK_DATA
+#define        SEEK_DATA       4       /* set file offset to the start of the next non-hole file region greater than or equal to the supplied offset */
+#endif
index d3bf9580a7069983239e5d0b198acab6ee01cc0a..7f20dd8f73ddad871ff7e73983d5f0f0082e06a2 100644 (file)
@@ -229,6 +229,12 @@ typedef struct vol_capabilities_attr {
  *
  * VOL_CAP_FMT_WRITE_GENERATION_COUNT: When set, the volume supports write
  * generation counts (a count of how many times an object has been modified)
+ *
+ * VOL_CAP_FMT_NO_IMMUTABLE_FILES: When set, the volume does not support
+ * setting the UF_IMMUTABLE flag.
+ *
+ * VOL_CAP_FMT_NO_PERMISSIONS: When set, the volume does not support setting
+ * permissions.
  */
 #define VOL_CAP_FMT_PERSISTENTOBJECTIDS                0x00000001
 #define VOL_CAP_FMT_SYMBOLICLINKS              0x00000002
@@ -251,6 +257,8 @@ typedef struct vol_capabilities_attr {
 #define VOL_CAP_FMT_DIR_HARDLINKS              0x00040000
 #define VOL_CAP_FMT_DOCUMENT_ID                        0x00080000
 #define VOL_CAP_FMT_WRITE_GENERATION_COUNT     0x00100000
+#define VOL_CAP_FMT_NO_IMMUTABLE_FILES         0x00200000
+#define VOL_CAP_FMT_NO_PERMISSIONS             0x00400000
 
 
 /*
@@ -421,8 +429,10 @@ typedef struct vol_attributes_attr {
  * ATTR_CMN_UUID
  * 
  * ATTR_CMN_GRPUUID
+ * 
+ * ATTR_CMN_DATA_PROTECT_FLAGS
  */
-#define ATTR_CMN_SETMASK                       0x01C7FF00
+#define ATTR_CMN_SETMASK                       0x41C7FF00
 #define ATTR_CMN_VOLSETMASK                    0x00006700
 
 #define ATTR_VOL_FSTYPE                                0x00000001
@@ -444,10 +454,12 @@ typedef struct vol_attributes_attr {
 #define ATTR_VOL_ENCODINGSUSED                 0x00010000
 #define ATTR_VOL_CAPABILITIES                  0x00020000
 #define ATTR_VOL_UUID                          0x00040000
+#define ATTR_VOL_QUOTA_SIZE                    0x10000000
+#define ATTR_VOL_RESERVED_SIZE         0x20000000
 #define ATTR_VOL_ATTRIBUTES                    0x40000000
 #define ATTR_VOL_INFO                          0x80000000
 
-#define ATTR_VOL_VALIDMASK                     0xC007FFFF
+#define ATTR_VOL_VALIDMASK                     0xF007FFFF
 
 /*
  * The list of settable ATTR_VOL_* attributes include the following:
@@ -461,11 +473,15 @@ typedef struct vol_attributes_attr {
 #define ATTR_DIR_LINKCOUNT                     0x00000001
 #define ATTR_DIR_ENTRYCOUNT                    0x00000002
 #define ATTR_DIR_MOUNTSTATUS                   0x00000004
+#define ATTR_DIR_ALLOCSIZE                     0x00000008
+#define ATTR_DIR_IOBLOCKSIZE                   0x00000010
+#define ATTR_DIR_DATALENGTH                    0x00000020
+
 /* ATTR_DIR_MOUNTSTATUS Flags: */
 #define          DIR_MNTSTATUS_MNTPOINT                0x00000001
 #define          DIR_MNTSTATUS_TRIGGER                 0x00000002
 
-#define ATTR_DIR_VALIDMASK                     0x00000007
+#define ATTR_DIR_VALIDMASK                     0x0000003f
 #define ATTR_DIR_SETMASK                       0x00000000
 
 #define ATTR_FILE_LINKCOUNT                    0x00000001
@@ -487,8 +503,17 @@ typedef struct vol_attributes_attr {
  */
 #define ATTR_FILE_SETMASK                      0x00000020
 
+/* CMNEXT attributes extend the common attributes, but in the forkattr field */
+#define ATTR_CMNEXT_RELPATH     0x00000004
+#define ATTR_CMNEXT_PRIVATESIZE 0x00000008
+
+#define ATTR_CMNEXT_VALIDMASK  0x0000000c
+#define ATTR_CMNEXT_SETMASK            0x00000000
+
+/* Deprecated fork attributes */
 #define ATTR_FORK_TOTALSIZE                    0x00000001
 #define ATTR_FORK_ALLOCSIZE                    0x00000002
+#define ATTR_FORK_RESERVED                     0xffffffff
 
 #define ATTR_FORK_VALIDMASK                    0x00000003
 #define ATTR_FORK_SETMASK                      0x00000000
index 97cb5a7c11339f7bb7a5e7e1d5fe43e38b79f23d..f2d613213b4400f5da4fc4dd9a81d08f64603914 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef _SYS_CPROTECT_H_
 #define        _SYS_CPROTECT_H_
 
-#if KERNEL_PRIVATE
+#ifdef KERNEL_PRIVATE
 
 #include <sys/cdefs.h>
 #include <sys/param.h>
@@ -37,6 +37,7 @@
 #include <sys/kdebug.h>
 #include <crypto/aes.h>
 #include <stdbool.h>
+#include <uuid/uuid.h>
 
 __BEGIN_DECLS
 
@@ -96,7 +97,6 @@ typedef uint16_t cp_key_revision_t;
 typedef uint64_t cp_crypto_id_t;
 
 typedef struct cprotect *cprotect_t;
-typedef struct cp_wrap_func *cp_wrap_func_t;
 typedef struct cpx *cpx_t;
 
 typedef struct cp_key {
@@ -161,6 +161,8 @@ void cpx_free(cpx_t);
 __attribute__((const)) size_t cpx_size(size_t key_size);
 __attribute__((pure)) bool cpx_is_sep_wrapped_key(const struct cpx *);
 void cpx_set_is_sep_wrapped_key(struct cpx *, bool);
+__attribute__((pure)) bool cpx_is_composite_key(const struct cpx *);
+void cpx_set_is_composite_key(struct cpx *, bool);
 __attribute__((pure)) bool cpx_use_offset_for_iv(const struct cpx *);
 void cpx_set_use_offset_for_iv(struct cpx *, bool);
 __attribute__((pure)) bool cpx_synthetic_offset_for_iv(const struct cpx *);
@@ -177,26 +179,8 @@ bool cpx_has_key(const struct cpx *cpx);
 size_t cpx_sizex(const struct cpx *cpx);
 void cpx_set_aes_iv_key(struct cpx *cpx, void *iv_key);
 
-/* Structure to store pointers for AKS functions */
-struct cp_wrap_func {
-       new_key_t       *new_key;
-       unwrapper_t     *unwrapper;
-       rewrapper_t     *rewrapper;
-       invalidater_t   *invalidater;
-       backup_key_t    *backup_key;
-};
-
 int cp_key_store_action(cp_key_store_action_t);
-int cp_register_wraps(cp_wrap_func_t);
-int cp_rewrap_key(cp_cred_t access, cp_key_class_t dp_class,
-                                 const cp_wrapped_key_t wrapped_key_in,
-                                 cp_wrapped_key_t wrapped_key_out);
-int cp_new_key(cp_cred_t access, cp_key_class_t dp_class, cp_raw_key_t key_out,
-                          cp_wrapped_key_t wrapped_key_out);
-int cp_unwrap_key(cp_cred_t access, const cp_wrapped_key_t wrapped_key_in,
-                                 cp_raw_key_t key_out);
-int cp_get_backup_key(cp_cred_t access, const cp_wrapped_key_t wrapped_key_in,
-                                         cp_wrapped_key_t wrapped_key_out);
+int cp_key_store_action_for_volume(uuid_t volume_uuid, cp_key_store_action_t action);
 cp_key_os_version_t cp_os_version(void);
 // Should be cp_key_class_t but HFS has a conflicting definition
 int cp_is_valid_class (int isdir, int32_t protectionclass);
index 1349ec9485ec9533302ddf62bd0e7372822025c2..602b6061b7953959090e677c3402417d2b185a52 100644 (file)
@@ -60,6 +60,7 @@ typedef uint32_t csr_op_t;
                          CSR_ALLOW_DEVICE_CONFIGURATION | \
                          CSR_ALLOW_ANY_RECOVERY_OS)
 
+#define CSR_ALWAYS_ENFORCED_FLAGS (CSR_ALLOW_DEVICE_CONFIGURATION | CSR_ALLOW_ANY_RECOVERY_OS)
 
 /* CSR capabilities that a booter can give to the system */
 #define CSR_CAPABILITY_UNLIMITED                               (1 << 0)
index 58ad8fed51ef9b90e6770cfa5b5c0fe95332612d..3638f9fa0952fea858109751c0df9369ae1ab282 100644 (file)
@@ -73,9 +73,9 @@ typedef struct {
     user_ssize_t size;
 } decmpfs_vector;
 
-#if KERNEL
+#ifdef KERNEL
 
-#if XNU_KERNEL_PRIVATE
+#ifdef XNU_KERNEL_PRIVATE
 
 #include <kern/locks.h>
 
index 8e43692bd59825f7e9adda685d9eb640fc0cabd6..14b23450b5f9836ddeba802a907b48395febe475 100644 (file)
@@ -416,6 +416,23 @@ enum {
 #define NOTE_MEMORYSTATUS_PROC_LIMIT_WARN      0x00000010      /* process memory limit has hit a warning state */
 #define NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL  0x00000020      /* process memory limit has hit a critical state - soft limit */
 
+#ifdef KERNEL_PRIVATE
+/*
+ * data/hint fflags for EVFILT_MEMORYSTATUS, but not shared with userspace.
+ */
+#define NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_ACTIVE        0x00000040      /* Used to restrict sending a warn event only once, per active limit, soft limits only */
+#define NOTE_MEMORYSTATUS_PROC_LIMIT_WARN_INACTIVE      0x00000080      /* Used to restrict sending a warn event only once, per inactive limit, soft limit only */
+#define NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_ACTIVE    0x00000100      /* Used to restrict sending a critical event only once per active limit, soft limit only */
+#define NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL_INACTIVE  0x00000200      /* Used to restrict sending a critical event only once per inactive limit, soft limit only */
+
+/*
+ * Use this mask to protect the kernel private flags.
+ */
+#define EVFILT_MEMORYSTATUS_ALL_MASK \
+       (NOTE_MEMORYSTATUS_PRESSURE_NORMAL | NOTE_MEMORYSTATUS_PRESSURE_WARN | NOTE_MEMORYSTATUS_PRESSURE_CRITICAL | NOTE_MEMORYSTATUS_LOW_SWAP | NOTE_MEMORYSTATUS_PROC_LIMIT_WARN | NOTE_MEMORYSTATUS_PROC_LIMIT_CRITICAL)
+
+#endif /* KERNEL_PRIVATE */
+
 typedef enum vm_pressure_level {
         kVMPressureNormal   = 0,
         kVMPressureWarning  = 1,
@@ -423,7 +440,7 @@ typedef enum vm_pressure_level {
         kVMPressureCritical = 3,
 } vm_pressure_level_t;
 
-#endif
+#endif /* PRIVATE */
 
 /*
  * data/hint fflags for EVFILT_TIMER, shared with userspace.
@@ -560,10 +577,7 @@ typedef uint16_t kn_status_t;
 #define KN_DISPATCH2           (KN_DISPATCH | KN_UDATA_SPECIFIC)
                                        /* combination defines deferred-delete mode enabled */
 
-struct __attribute__((__packed__)) knote {
-       uint16_t                 kn_inuse;          /* inuse count */
-       kn_status_t              kn_status;         /* status bits */
-       int                      kn_hookid;
+struct knote {
        TAILQ_ENTRY(knote)       kn_tqe;            /* linkage for tail queue */
        SLIST_ENTRY(knote)       kn_link;           /* linkage for search list */
        SLIST_ENTRY(knote)       kn_selnext;        /* klist element chain */
@@ -579,13 +593,16 @@ struct __attribute__((__packed__)) knote {
                                                         kn_filtid:8,                                   /* filter id to index filter ops */
                                                         kn_kq_packed:KNOTE_KQ_BITSIZE; /* packed pointer for kq */
 
-       int                      kn_sfflags;        /* saved filter flags */
        union {
                void                 *kn_hook;
-               uint64_t            kn_hook_data;
+               uint64_t             kn_hook_data;
        };
        int64_t                  kn_sdata;          /* saved data field */
        struct kevent_internal_s kn_kevent;
+       int                      kn_sfflags;        /* saved filter flags */
+       int                      kn_hookid;
+       uint16_t                 kn_inuse;          /* inuse count */
+       kn_status_t              kn_status;         /* status bits */
 
 #define kn_id          kn_kevent.ident
 #define kn_filter      kn_kevent.filter
index 2de689085a19c2e05c4f7879f824b05a6c5d221b..0e24d78ce7bca0e3ab985ebaf7bbf4ff242baf43 100644 (file)
 #define F_ADDFILESIGS_RETURN   97      /* Add signature from same file, return end offset in structure on sucess */
 #define F_CHECK_LV             98      /* Check if Library Validation allows this Mach-O file to be mapped into the calling process */
 
+#define F_PUNCHHOLE    99              /* Deallocate a range of the file */
+
+#define F_TRIM_ACTIVE_FILE     100 /* Trim an active file */
 
 // FS-specific fcntl()'s numbers begin at 0x00010000 and go up
 #define FCNTL_FS_SPECIFIC_BASE  0x00010000
@@ -591,7 +594,7 @@ typedef struct user_fchecklv {
 #define        LOCK_NB         0x04            /* don't block when locking */
 #define        LOCK_UN         0x08            /* unlock file */
 
-/*  fstore_t type used by F_DEALLOCATE and F_PREALLOCATE commands */
+/* fstore_t type used by F_PREALLOCATE command */
 
 typedef struct fstore {
        unsigned int fst_flags; /* IN: flags word */
@@ -601,6 +604,20 @@ typedef struct fstore {
        off_t   fst_bytesalloc; /* OUT: number of bytes allocated */
 } fstore_t;
 
+/* fpunchhole_t used by F_PUNCHHOLE */
+typedef struct fpunchhole {
+       unsigned int fp_flags; /* unused */
+       unsigned int reserved; /* (to maintain 8-byte alignment) */
+       off_t fp_offset; /* IN: start of the region */
+       off_t fp_length; /* IN: size of the region */
+} fpunchhole_t;
+
+/* factive_file_trim_t used by F_TRIM_ACTIVE_FILE */
+typedef struct ftrimactivefile {
+       off_t fta_offset;  /* IN: start of the region */
+       off_t fta_length; /* IN: size of the region */
+} ftrimactivefile_t;
+
 /* fbootstraptransfer_t used by F_READBOOTSTRAP and F_WRITEBOOTSTRAP commands */
 
 typedef struct fbootstraptransfer {
index 8f15b24ae2c6434919ac6ace1b972b0e5a10caf4..5d87fbf7f91d9152f3024ba0133b4411602d9e28 100644 (file)
@@ -293,6 +293,12 @@ typedef struct package_ext_info {
 #define FSIOC_ROUTEFS_SETROUTEID                         _IO('A', 15)
 #define        FSCTL_ROUTEFS_SETROUTEID                          IOCBASECMD(FSIOC_ROUTEFS_SETROUTEID)
 
+/* ioctls to support SEEK_HOLE SEEK_DATA */
+#define FSIOC_FIOSEEKHOLE                                        _IOWR('A', 16, off_t)
+#define        FSCTL_FIOSEEKHOLE                                         IOCBASECMD(FSIOC_FIOSEEKHOLE)
+#define FSIOC_FIOSEEKDATA                                        _IOWR('A', 17, off_t)
+#define        FSCTL_FIOSEEKDATA                                         IOCBASECMD(FSIOC_FIOSEEKDATA)
+
 //
 // IO commands 16 and 17 are currently unused
 //
index 13ec75cfd61356d4453eca4fe09977105d95aec8..a9c922557aa4758f4dbcf058aab0d70d9907dbf4 100644 (file)
@@ -43,8 +43,9 @@
 #define FSE_XATTR_REMOVED       10
 #define FSE_DOCID_CREATED       11
 #define FSE_DOCID_CHANGED       12
+#define FSE_UNMOUNT_PENDING     13 // iOS-only: client must respond via FSEVENTS_UNMOUNT_PENDING_ACK
 
-#define FSE_MAX_EVENTS          13
+#define FSE_MAX_EVENTS          14
 #define FSE_ALL_EVENTS         998
 
 #define FSE_EVENTS_DROPPED     999
@@ -122,12 +123,13 @@ typedef struct fsevent_dev_filter_args {
 #define        FSEVENTS_WANT_COMPACT_EVENTS    _IO('s', 101)
 #define        FSEVENTS_WANT_EXTENDED_INFO     _IO('s', 102)
 #define        FSEVENTS_GET_CURRENT_ID         _IOR('s', 103, uint64_t)
+#define        FSEVENTS_UNMOUNT_PENDING_ACK    _IOW('s', 104, dev_t)
 
 
 #ifdef BSD_KERNEL_PRIVATE
 
 void fsevents_init(void);
-void fsevent_unmount(struct mount *mp);
+void fsevent_unmount(struct mount *mp, vfs_context_t ctx);
 struct vnode_attr;
 void create_fsevent_from_kevent(vnode_t vp, uint32_t kevents, struct vnode_attr *vap);
 
index a77c9cca837a75a305c4ae5cb4acf8b21edeaf34..dd526f54268c83791e9a7e16f04b90138af7e339 100644 (file)
@@ -35,5 +35,6 @@ int   imageboot_mount_image(const char *root_path, int height);
 
 #define IMAGEBOOT_CONTAINER_ARG                "container-dmg"
 #define IMAGEBOOT_ROOT_ARG             "root-dmg"
+#define IMAGEBOOT_AUTHROOT_ARG         "auth-root-dmg"
 
 #endif
index 38aea03bdcf70998de9dc8bce28751a697164bb3..8c990e4356835c87e4bb8d63c72ad703a1ef4db6 100644 (file)
@@ -107,6 +107,6 @@ __END_DECLS
  * Source level -> #define USE_OLD_TTY
  * Kernel level -> always on
  */
-#if defined(USE_OLD_TTY) || BSD_KERNEL_PRIVATE
+#if defined(USE_OLD_TTY) || defined(BSD_KERNEL_PRIVATE)
 #include <sys/ioctl_compat.h>
 #endif /* !_SYS_IOCTL_H_ */
index de639b6f67551e582892c192b842bcba1360d998..b5850a7b93fea66c3280df7fe38a7dcdda3c07c4 100644 (file)
@@ -354,10 +354,8 @@ typedef struct memorystatus_memlimit_properties {
 #define P_MEMSTAT_INTERNAL             0x00001000
 #define P_MEMSTAT_FATAL_MEMLIMIT                  0x00002000   /* current fatal state of the process's memlimit */
 #define P_MEMSTAT_MEMLIMIT_ACTIVE_FATAL           0x00004000   /* if set, exceeding limit is fatal when the process is active   */
-#define P_MEMSTAT_MEMLIMIT_ACTIVE_EXC_TRIGGERED   0x00008000   /* if set, supresses high-water-mark EXC_RESOURCE, allows one hit per active limit */
-#define P_MEMSTAT_MEMLIMIT_INACTIVE_FATAL         0x00010000   /* if set, exceeding limit is fatal when the process is inactive */
-#define P_MEMSTAT_MEMLIMIT_INACTIVE_EXC_TRIGGERED 0x00020000   /* if set, supresses high-water-mark EXC_RESOURCE, allows one hit per inactive limit */
-#define P_MEMSTAT_USE_ELEVATED_INACTIVE_BAND     0x00040000   /* if set, the process will go into this band & stay there when in the background instead
+#define P_MEMSTAT_MEMLIMIT_INACTIVE_FATAL         0x00008000   /* if set, exceeding limit is fatal when the process is inactive */
+#define P_MEMSTAT_USE_ELEVATED_INACTIVE_BAND     0x00010000   /* if set, the process will go into this band & stay there when in the background instead
                                                                  of the aging bands and/or the IDLE band. */
 
 extern void memorystatus_init(void) __attribute__((section("__TEXT, initcode")));
@@ -395,8 +393,8 @@ int memorystatus_knote_register(struct knote *kn);
 void memorystatus_knote_unregister(struct knote *kn);
 
 #if CONFIG_MEMORYSTATUS
-boolean_t memorystatus_turnoff_exception_and_get_fatalness(boolean_t warning, const int max_footprint_mb);
-void memorystatus_on_ledger_footprint_exceeded(int warning, boolean_t is_fatal);
+void memorystatus_log_exception(const int max_footprint_mb, boolean_t memlimit_is_active, boolean_t memlimit_is_fatal);
+void memorystatus_on_ledger_footprint_exceeded(int warning, boolean_t memlimit_is_active, boolean_t memlimit_is_fatal);
 void proc_memstat_terminated(proc_t p, boolean_t set);
 boolean_t memorystatus_proc_is_dirty_unsafe(void *v);
 #endif /* CONFIG_MEMORYSTATUS */
index 5615bfa7211c5dcfdc932dfdf19214251bc0a273..f73ff157067bae88d409ff08a7921bc45e71e7d7 100644 (file)
@@ -112,7 +112,7 @@ typedef struct user_iovec * user_iovec_t;
 typedef struct vfs_context * vfs_context_t;
 typedef struct vfstable * vfstable_t;
 
-#if KERNEL_PRIVATE
+#ifdef KERNEL_PRIVATE
 typedef struct kern_iovec * kern_iovec_t;
 typedef        struct ifnet*           ifnet_t;
 typedef        struct mbuf*            mbuf_t;
@@ -147,4 +147,9 @@ struct kauth_filesec;
 typedef struct kauth_filesec * kauth_filesec_t;
 #endif
 
+#ifndef _KAUTH_ACTION_T
+#define _KAUTH_ACTION_T
+typedef int kauth_action_t;
+#endif
+
 #endif /* !_KERN_SYS_KERNELTYPES_H_ */
index 6dac799208feffc9946f917c1bc06da584a4898b..27a8c2d046b4144f88c53609d3f1c2c2c6a5dadc 100644 (file)
@@ -81,7 +81,7 @@
 #define        M_WAITOK        0x0000
 #define        M_NOWAIT        0x0001
 #define M_ZERO          0x0004          /* bzero the allocation */
-
+#define M_NULL         0x0008          /* return NULL if space is unavailable*/
 
 #ifdef BSD_KERNEL_PRIVATE
 
@@ -259,7 +259,7 @@ extern struct kmemstats kmemstats[];
  * The malloc/free primatives used
  * by the BSD kernel code.
  */
-#if XNU_KERNEL_PRIVATE
+#ifdef XNU_KERNEL_PRIVATE
 
 #include <mach/vm_types.h>
 
index 2c703373bc7fb589f12ab7f863b7b3db44cd96c9..6b585f2b93bf0935d45ed215ee1e4221d8c0f0a0 100644 (file)
@@ -493,10 +493,10 @@ struct pkthdr {
 /*
  * Description of external storage mapped into mbuf, valid only if M_EXT set.
  */
+typedef void (*m_ext_free_func_t)(caddr_t, u_int, caddr_t);
 struct m_ext {
        caddr_t ext_buf;                /* start of buffer */
-       void    (*ext_free)             /* free routine if not the usual */
-                   (caddr_t, u_int, caddr_t);
+       m_ext_free_func_t ext_free;     /* free routine if not the usual */
        u_int   ext_size;               /* size of buffer, for ext_free */
        caddr_t ext_arg;                /* additional ext_free argument */
        struct ext_ref {
@@ -506,6 +506,7 @@ struct m_ext {
                u_int16_t prefcnt;
                u_int16_t flags;
                u_int32_t priv;
+               uintptr_t ext_token;
        } *ext_refflags;
 };
 
@@ -1456,6 +1457,11 @@ __private_extern__ u_int16_t m_adj_sum16(struct mbuf *, u_int32_t,
     u_int32_t, u_int32_t);
 __private_extern__ u_int16_t m_sum16(struct mbuf *, u_int32_t, u_int32_t);
 
+__private_extern__ void m_set_ext(struct mbuf *, struct ext_ref *, m_ext_free_func_t, caddr_t);
+__private_extern__ struct ext_ref *m_get_rfa(struct mbuf *);
+__private_extern__ m_ext_free_func_t m_get_ext_free(struct mbuf *);
+__private_extern__ caddr_t m_get_ext_arg(struct mbuf *);
+
 extern void m_do_tx_compl_callback(struct mbuf *, struct ifnet *);
 
 __END_DECLS
index 3993b3fd3301e5bbbfac175c3eff88707cb122a9..906363384dd925a8fe35c323bf2e1189573adbc0 100644 (file)
@@ -266,7 +266,7 @@ typedef struct mcache_cpu {
        int             cc_objs;        /* number of objects in filled bkt */
        int             cc_pobjs;       /* number of objects in previous bkt */
        int             cc_bktsize;     /* number of elements in a full bkt */
-} __attribute__((aligned(MAX_CPU_CACHE_LINE_SIZE), packed)) mcache_cpu_t;
+} __attribute__((aligned(MAX_CPU_CACHE_LINE_SIZE))) mcache_cpu_t;
 
 typedef unsigned int (*mcache_allocfn_t)(void *, mcache_obj_t ***,
     unsigned int, int);
index 242f50480c074d955c87b0856e31fe6c7973cff2..70db71af63f9021e20e1fb382c3c2bd9bbfddbb7 100644 (file)
@@ -223,6 +223,9 @@ struct vfsstatfs {
 #define VFSATTR_f_signature            (1LL<< 22)
 #define VFSATTR_f_carbon_fsid          (1LL<< 23)
 #define VFSATTR_f_uuid                 (1LL<< 24)
+#define VFSATTR_f_quota                (1LL<< 25)
+#define VFSATTR_f_reserved             (1LL<< 26)
+
 
 /*
  * Argument structure.
@@ -269,6 +272,8 @@ struct vfs_attr {
        uint16_t        f_signature;    /* used for ATTR_VOL_SIGNATURE, Carbon's FSVolumeInfo.signature */
        uint16_t        f_carbon_fsid;  /* same as Carbon's FSVolumeInfo.filesystemID */
        uuid_t          f_uuid;         /* file system UUID (version 3 or 5), available in 10.6 and later */
+       uint64_t        f_quota;        /* total quota data blocks in file system */
+       uint64_t        f_reserved;     /* total reserved data blocks in file system */
 };
 
 #pragma pack()
@@ -481,8 +486,8 @@ struct netfs_status {
 #define VQ_SYNCEVENT   0x0400  /* a sync just happened (not set by kernel starting Mac OS X 10.9) */
 #define VQ_SERVEREVENT  0x0800  /* server issued notification/warning */
 #define VQ_QUOTA       0x1000  /* a user quota has been hit */
-#define VQ_FLAG2000    0x2000  /* placeholder */
-#define VQ_FLAG4000    0x4000  /* placeholder */
+#define VQ_NEARLOWDISK         0x2000  /* Above lowdisk and below desired disk space */
+#define VQ_DESIRED_DISK        0x4000  /* the desired disk space */
 #define VQ_FLAG8000    0x8000  /* placeholder */
 
 
@@ -763,6 +768,12 @@ struct fs_snapshot_revert_args {
 #define VFSIOC_REVERT_SNAPSHOT  _IOW('V', 2, struct fs_snapshot_revert_args)
 #define VFSCTL_REVERT_SNAPSHOT  IOCBASECMD(VFSIOC_REVERT_SNAPSHOT)
 
+struct fs_snapshot_root_args {
+    struct componentname *sr_cnp;
+};  
+#define VFSIOC_ROOT_SNAPSHOT  _IOW('V', 3, struct fs_snapshot_root_args)
+#define VFSCTL_ROOT_SNAPSHOT  IOCBASECMD(VFSIOC_ROOT_SNAPSHOT)
+
 #endif /* KERNEL */
 
 /*
@@ -1000,6 +1011,20 @@ void     vfs_setextendedsecurity(mount_t mp);
   */
 void   vfs_clearextendedsecurity(mount_t mp);
 
+/*!
+  @function vfs_setnoswap
+  @abstract Mark a filesystem as unable to use swap files.
+  @param mp Mount to mark.
+  */
+void   vfs_setnoswap(mount_t mp);
+
+/*!
+  @function vfs_clearnoswap
+  @abstract Mark a filesystem as capable of using swap files.
+  @param mp Mount to mark.
+  */
+void   vfs_clearnoswap(mount_t mp);
+
 /*!
   @function vfs_setlocklocal
   @abstract Mark a filesystem as using VFS-level advisory locking support.
index 107467f08297e9799c7088c3c0db778930d2db90..6393fd71205adf9d1d3b367ddf0b1535eaa28577 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2014 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -195,6 +195,8 @@ struct mount {
        char            fstypename_override[MFSTYPENAMELEN];
 
        uint32_t        mnt_iobufinuse;
+
+       lck_mtx_t       mnt_iter_lock;          /* mutex that protects iteration of vnodes */
 };
 
 /*
@@ -232,6 +234,7 @@ extern struct mount * dead_mountp;
  *             because the bits here were broken out from the high bits
  *             of the mount flags.
  */
+#define MNTK_NOSWAP            0x00000080  /* swap files cannot be used on this mount */
 #define MNTK_SWAP_MOUNT                0x00000100      /* we are swapping to this mount */
 #define MNTK_DENY_READDIREXT 0x00000200 /* Deny Extended-style readdir's for this volume */
 #define MNTK_PERMIT_UNMOUNT    0x00000400      /* Allow (non-forced) unmounts by UIDs other than the one that mounted the volume */
@@ -270,7 +273,7 @@ extern struct mount * dead_mountp;
 #define MNT_LITER              0x00000010      /* mount in iteration */
 #define MNT_LNEWVN             0x00000020      /* mount has new vnodes created */
 #define MNT_LWAIT              0x00000040      /* wait for unmount op */
-#define MNT_LITERWAIT          0x00000080      /* mount in iteration */
+#define MNT_LUNUSED            0x00000080      /* available flag bit, used to be MNT_LITERWAIT */
 #define MNT_LDEAD              0x00000100      /* mount already unmounted*/
 #define MNT_LNOSUB             0x00000200      /* submount - no recursion */
 
@@ -421,6 +424,8 @@ void mount_lock_destroy(mount_t);
 void mount_lock(mount_t);
 void mount_lock_spin(mount_t);
 void mount_unlock(mount_t);
+void mount_iterate_lock(mount_t);
+void mount_iterate_unlock(mount_t);
 void mount_lock_renames(mount_t);
 void mount_unlock_renames(mount_t);
 void mount_ref(mount_t, int);
index 1e17a1fdf133f974c0123ceb1997f8a4c1b5db58..af9cd806cc48708f1c721f8c3872f4bb2770d713 100644 (file)
@@ -91,6 +91,7 @@
 #define PRIV_KTRACE_BACKGROUND         1011    /* Operate ktrace in the background */
 #define PRIV_SETPRIORITY_DARWIN_ROLE   1012    /* Allow setpriority(PRIO_DARWIN_ROLE) */
 #define PRIV_PACKAGE_EXTENSIONS                1013    /* Push package extension list used by vn_path_package_check() */
+#define PRIV_TRIM_ACTIVE_FILE          1014    /* Allow freeing space out from under an active file  */
 
 /*
  * Virtual memory privileges.
  */
 #define PRIV_VFS_OPEN_BY_ID            14000   /* Allow calling openbyid_np() */
 #define PRIV_VFS_MOVE_DATA_EXTENTS     14001   /* Allow F_MOVEDATAEXTENTS fcntl */
-#define PRIV_VFS_SNAPSHOT              14002   /* Allow calling fs_snapshot_*() */
+#define PRIV_VFS_SNAPSHOT              14002   /* Allow create/rename/delete of snapshots */
+#define PRIV_VFS_SNAPSHOT_REVERT       14003   /* Allow reverting filesystem to a previous snapshot */
 
 #ifdef KERNEL
 /*
index fa41fc60c940c565f6127b4d7ad39974d6e1f9d5..ca9a37a0b0c44699cd5389386e2fdba140b4f016 100644 (file)
@@ -60,7 +60,7 @@ __BEGIN_DECLS
 /* To be removed, replaced by PROC_UUID_NECP_APP_POLICY */
 #define        PROC_UUID_FLOW_DIVERT                           0x00000002
 
-#if BSD_KERNEL_PRIVATE
+#ifdef BSD_KERNEL_PRIVATE
 /*
  * Look up a policy indexed by UUID.
  *
index ac2b4f8c578f5cd2ae42ef72dd2fca7138159505..c636c19e60ea0196ecefeda9425e733cf38bd1c6 100644 (file)
@@ -452,8 +452,8 @@ struct pr_usrreqs {
        int     (*pru_connect)(struct socket *, struct sockaddr *,
                    struct proc *);
        int     (*pru_connect2)(struct socket *, struct socket *);
-       int     (*pru_connectx)(struct socket *, struct sockaddr_list **,
-                   struct sockaddr_list **, struct proc *, uint32_t,
+       int     (*pru_connectx)(struct socket *, struct sockaddr *,
+                   struct sockaddr *, struct proc *, uint32_t,
                    sae_associd_t, sae_connid_t *, uint32_t, void *, uint32_t,
                    struct uio *, user_ssize_t *);
        int     (*pru_control)(struct socket *, u_long, caddr_t,
@@ -505,8 +505,8 @@ extern int pru_connect_notsupp(struct socket *so, struct sockaddr *nam,
     struct proc *p);
 extern int pru_connect2_notsupp(struct socket *so1, struct socket *so2);
 #ifdef XNU_KERNEL_PRIVATE
-extern int pru_connectx_notsupp(struct socket *, struct sockaddr_list **,
-    struct sockaddr_list **, struct proc *, uint32_t, sae_associd_t,
+extern int pru_connectx_notsupp(struct socket *, struct sockaddr *,
+    struct sockaddr *, struct proc *, uint32_t, sae_associd_t,
     sae_connid_t *, uint32_t, void *, uint32_t, struct uio *, user_ssize_t *);
 extern int pru_disconnectx_notsupp(struct socket *, sae_associd_t,
     sae_connid_t);
index c1f1eb19c30161f2522e2be822b5b46b9b10346b..bd3322d4249aeef9944e3bef16e86638a55a5d00 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <kern/clock.h>
 #include <kern/kern_types.h>
+#include <kern/kcdata.h>
 #include <kern/locks.h>
 #include <sys/_types.h>
 #include <sys/_types/_sigset_t.h>
@@ -117,8 +118,11 @@ typedef const struct pthread_functions_s {
        unsigned long (*pthread_priority_canonicalize)(unsigned long pthread_priority);
        unsigned long (*pthread_priority_canonicalize2)(unsigned long pthread_priority, boolean_t propagation);
 
+       void (*pthread_find_owner)(thread_t thread, struct stackshot_thread_waitinfo *waitinfo);
+       void *(*pthread_get_thread_kwq)(thread_t thread);
+
        /* padding for future */
-       void * _pad[92];
+       void * _pad[90];
 } * pthread_functions_t;
 
 typedef const struct pthread_callbacks_s {
index 85864189302b698cdbf26fac17e476ce9d373f84..5ba451a5f5526182595b8a06607fd7f870b6d1f9 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef KERNEL
 __BEGIN_DECLS
-
+__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
 int getentropy(void* buffer, size_t size);
 __END_DECLS
 
index cd48788121ad4c63702788dd35d019c647086915..98db0e3d7873211a41e334b144f00b28f0d0c52b 100644 (file)
@@ -146,4 +146,10 @@ __END_DECLS
 
 #endif /* BSD_KERNEL_PRIVATE */
 
+#if KERNEL_PRIVATE
+__BEGIN_DECLS
+int get_system_inshutdown(void);
+__END_DECLS
+#endif /* KERNEL_PRIVATE */
+
 #endif /* _SYS_REBOOT_H_ */
index c18cd85106eea3d17b25ed73dd342c6c4fe1ef1a..76f1157274fa73b5054a2658049347790b869012 100644 (file)
@@ -52,6 +52,8 @@ int fs_snapshot_mount(int, const char *, const char *, uint32_t) __OSX_AVAILABLE
 
 int fs_snapshot_revert(int, const char *, uint32_t) __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0);
 
+int fs_snapshot_root(int, const char *, uint32_t) __OSX_AVAILABLE(10.12.4) __IOS_AVAILABLE(10.3) __TVOS_AVAILABLE(10.3) __WATCHOS_AVAILABLE(3.3);
+
 __END_DECLS
 
 #endif /* !KERNEL */
@@ -63,6 +65,7 @@ __END_DECLS
 #define SNAPSHOT_OP_RENAME 0x03
 #define SNAPSHOT_OP_MOUNT  0x04
 #define SNAPSHOT_OP_REVERT 0x05
+#define SNAPSHOT_OP_ROOT   0x06
 
 #endif
 
index e290f0a5599d34c38763f330b026d29e35929cb9..edb1dfdd137ebefebacbbb945cede40540cd48ed 100644 (file)
@@ -469,6 +469,7 @@ typedef __uint32_t sae_connid_t;
 /* connectx() flag parameters */
 #define        CONNECT_RESUME_ON_READ_WRITE    0x1 /* resume connect() on read/write */
 #define        CONNECT_DATA_IDEMPOTENT         0x2 /* data is idempotent */
+#define        CONNECT_DATA_AUTHENTICATED      0x4 /* data includes security that replaces the TFO-cookie */
 
 /* sockaddr endpoints */
 typedef struct sa_endpoints {
@@ -628,24 +629,6 @@ struct sockaddr_storage {
        char                    __ss_pad2[_SS_PAD2SIZE];
 };
 
-#ifdef BSD_KERNEL_PRIVATE
-#include <sys/queue.h>
-
-struct sockaddr_entry {
-       TAILQ_ENTRY(sockaddr_entry)     se_link;
-       struct sockaddr                 *se_addr;
-       uint32_t                        se_flags;
-};
-
-#define        SEF_ATTACHED            1       /* attached to sockaddr_list */
-
-struct sockaddr_list {
-       TAILQ_HEAD(, sockaddr_entry)    sl_head;
-       uint32_t                        sl_cnt;
-
-};
-#endif /* BSD_KERNEL_PRIVATE */
-
 /*
  * Protocol families, same as address families for now.
  */
index c2c47cab2f66b21b6a700fe33b91a00a892fc90e..adff7ecd7bae900ee5d0a1f627007ae5a2d88973 100644 (file)
@@ -342,6 +342,8 @@ struct socket {
 #define        SOF1_TRAFFIC_MGT_SO_BACKGROUND  0x00002000 /* background socket */
 #define        SOF1_TRAFFIC_MGT_TCP_RECVBG     0x00004000 /* Only TCP sockets, receiver throttling */
 #define        SOF1_QOSMARKING_POLICY_OVERRIDE 0x00008000 /* Opt-out of QoS marking NECP policy */
+#define        SOF1_DATA_AUTHENTICATED         0x00010000 /* idempotent data is authenticated */
+#define        SOF1_ACCEPT_LIST_HELD           0x00020000 /* Another thread is accessing one of the accept lists */
        u_int64_t       so_extended_bk_start;
 };
 
@@ -789,6 +791,8 @@ extern int sockargs(struct mbuf **mp, user_addr_t data, int buflen, int type);
 extern void get_sockev_state(struct socket *, u_int32_t *);
 extern void so_update_last_owner_locked(struct socket *, struct proc *);
 extern void so_update_policy(struct socket *);
+extern void so_acquire_accept_list(struct socket *, struct socket *);
+extern void so_release_accept_list(struct socket *);
 
 extern int sbappend(struct sockbuf *sb, struct mbuf *m);
 extern int sbappendstream(struct sockbuf *sb, struct mbuf *m);
@@ -844,8 +848,8 @@ extern void soclose_wait_locked(struct socket *so);
 extern int soconnect(struct socket *so, struct sockaddr *nam);
 extern int soconnectlock(struct socket *so, struct sockaddr *nam, int dolock);
 extern int soconnect2(struct socket *so1, struct socket *so2);
-extern int soconnectxlocked(struct socket *so, struct sockaddr_list **src_sl,
-    struct sockaddr_list **dst_sl, struct proc *, uint32_t, sae_associd_t,
+extern int soconnectxlocked(struct socket *so, struct sockaddr *src,
+    struct sockaddr *dst, struct proc *, uint32_t, sae_associd_t,
     sae_connid_t *, uint32_t, void *, u_int32_t, uio_t, user_ssize_t *);
 extern int sodisconnectx(struct socket *so, sae_associd_t, sae_connid_t);
 extern int sodisconnectxlocked(struct socket *so, sae_associd_t, sae_connid_t);
@@ -908,19 +912,6 @@ extern int soo_stat(struct socket *, void *, int);
 extern int soo_select(struct fileproc *, int, void *, vfs_context_t);
 extern int soo_kqfilter(struct fileproc *, struct knote *, vfs_context_t);
 
-extern struct sockaddr_entry *sockaddrentry_alloc(int);
-extern void sockaddrentry_free(struct sockaddr_entry *);
-extern struct sockaddr_entry *sockaddrentry_dup(const struct sockaddr_entry *,
-    int);
-extern struct sockaddr_list *sockaddrlist_alloc(int);
-extern void sockaddrlist_free(struct sockaddr_list *);
-extern void sockaddrlist_insert(struct sockaddr_list *,
-    struct sockaddr_entry *);
-extern void sockaddrlist_remove(struct sockaddr_list *,
-    struct sockaddr_entry *);
-extern struct sockaddr_list *sockaddrlist_dup(const struct sockaddr_list *,
-    int);
-
 /* Service class flags used for setting service class on a packet */
 #define        PKT_SCF_IPV6            0x00000001      /* IPv6 packet */
 #define        PKT_SCF_TCP_ACK         0x00000002      /* Pure TCP ACK */
index fad05f10143798a484230b6966da5718bf27764f..278c8488932a8a30a44c575f0d8e696b3d567416 100644 (file)
@@ -114,6 +114,7 @@ int cluster_pagein_ext(vnode_t, upl_t, upl_offset_t, off_t, int, off_t, int, int
 
 int    cluster_push(vnode_t, int);
 int    cluster_push_ext(vnode_t, int, int (*)(buf_t, void *), void *);
+int    cluster_push_err(vnode_t, int, int (*)(buf_t, void *), void *, int *);
 
 int    cluster_bp(buf_t);
 int    cluster_bp_ext(buf_t, int (*)(buf_t, void *), void *);
index 5868b8ae05785d839235d883a60e8b49750fcf75..b27ab38f89c9a04d4021972bf60ecd29ed745994 100644 (file)
@@ -169,6 +169,7 @@ struct accessx_descriptor {
 #define        _PC_SYMLINK_MAX         24      /* Max # of bytes in symlink name */
 #define        _PC_SYNC_IO             25      /* Sync I/O [SIO] supported? */
 #define _PC_XATTR_SIZE_BITS    26      /* # of bits to represent maximum xattr size */
+#define _PC_MIN_HOLE_SIZE      27      /* Recommended minimum hole size for sparse files */
 
 /* configurable system strings */
 #define        _CS_PATH                 1
index 9f612c7805b412648970dbce31b54db288db9c43..588a5e6420f36001ad21b78b47f3f7d4e9357458 100644 (file)
@@ -225,11 +225,10 @@ struct uthread {
         void   *       uu_vps[32];
         void    *       uu_pcs[32][10];
 #endif
-
+       int             uu_proc_refcount;
 #if PROC_REF_DEBUG
 #define NUM_PROC_REFS_TO_TRACK 32
 #define PROC_REF_STACK_DEPTH 10
-       int             uu_proc_refcount;
        int             uu_pindex;
        void    *       uu_proc_ps[NUM_PROC_REFS_TO_TRACK];
        uintptr_t       uu_proc_pcs[NUM_PROC_REFS_TO_TRACK][PROC_REF_STACK_DEPTH];
index ee310f32098b1a9004dbbad970ff5da7d196a928..0baabcbd71015c476c9055f2e371787634d404f6 100644 (file)
@@ -548,6 +548,7 @@ struct vnode_trigger_param {
 #define VNODE_ATTR_va_rsrc_alloc       (1LL<<40)       /* 10000000000 */
 #define VNODE_ATTR_va_fsid64           (1LL<<41)       /* 20000000000 */
 #define VNODE_ATTR_va_write_gencount    (1LL<<42)      /* 40000000000 */
+#define VNODE_ATTR_va_private_size     (1LL<<43)       /* 80000000000 */
 
 #define VNODE_ATTR_BIT(n)      (VNODE_ATTR_ ## n)
 /*
@@ -578,7 +579,8 @@ struct vnode_trigger_param {
                                VNODE_ATTR_BIT(va_rsrc_length) |        \
                                VNODE_ATTR_BIT(va_rsrc_alloc) |         \
                                VNODE_ATTR_BIT(va_fsid64) |             \
-                               VNODE_ATTR_BIT(va_write_gencount))
+                               VNODE_ATTR_BIT(va_write_gencount) |             \
+                               VNODE_ATTR_BIT(va_private_size))
 /*
  * Attributes that can be applied to a new file object.
  */
@@ -646,7 +648,7 @@ struct vnode_attr {
        /* misc parameters */
        uint32_t        va_encoding;    /* filename encoding script */
 
-       enum vtype      va_type;        /* file type (create only) */
+       enum vtype      va_type;        /* file type */
        char *          va_name;        /* Name for ATTR_CMN_NAME; MAXPATHLEN bytes */
        guid_t          va_uuuid;       /* file owner UUID */
        guid_t          va_guuid;       /* file group UUID */
@@ -681,6 +683,8 @@ struct vnode_attr {
 
        uint32_t va_write_gencount;     /* counter that increments each time the file changes */
 
+       uint64_t va_private_size; /* If the file were deleted, how many bytes would be freed immediately */
+
        /* add new fields here only */
 };
 
@@ -749,6 +753,10 @@ extern int         vttoif_tab[];
 #define VNODE_READDIR_SEEKOFF32   0x0004   /* seek offset values should fit in 32 bits */
 #define VNODE_READDIR_NAMEMAX     0x0008   /* For extended readdir, try to limit names to NAME_MAX bytes */
 
+/* VNOP_CLONEFILE flags: */
+#define VNODE_CLONEFILE_DEFAULT   0x0000
+
+
 #define        NULLVP  ((struct vnode *)NULL)
 
 #ifndef BSD_KERNEL_PRIVATE
@@ -787,11 +795,6 @@ struct vnop_generic_args {
        /* other random data follows, presumably */
 };
 
-#ifndef _KAUTH_ACTION_T
-typedef int kauth_action_t;
-# define _KAUTH_ACTION_T
-#endif
-
 #include <sys/vnode_if.h>
 
 __BEGIN_DECLS
@@ -808,7 +811,7 @@ __BEGIN_DECLS
  */
 errno_t        vnode_create(uint32_t flavor, uint32_t size, void  *data, vnode_t *vpp);
 
-#if KERNEL_PRIVATE
+#ifdef KERNEL_PRIVATE
 /*!
  @function vnode_create_empty
  @abstract Create an empty, uninitialized vnode.
@@ -1630,6 +1633,35 @@ int      vn_bwrite(struct vnop_bwrite_args *ap);
  */
 int    vnode_authorize(vnode_t vp, vnode_t dvp, kauth_action_t action, vfs_context_t ctx);
 
+#ifdef KERNEL_PRIVATE
+/*!
+ @function vnode_attr_authorize_init
+ @abstract Initialize attributes for authorization of a kauth-style action on a file system object based on its attributes.
+ @discussion This function tells the caller what attributes may be required for a authorizing
+ a kauth style action.
+ @param vap attributes of file system object on which to authorize action.
+ @param dvap attributes of parent of file system object, can be NULL.
+ @param action Action to authorize, e.g. KAUTH_VNODE_READ_DATA.  See bsd/sys/kauth.h.
+ @param ctx Context for which to authorize actions.
+ @return EINVAL if a required parameters are not passed (for eg. not passing dvap when the action is KAUTH_ACTION_DELETE), 0 otherwise.
+ */
+#define VNODE_ATTR_AUTHORIZE_AVAILABLE         0x01
+int    vnode_attr_authorize_init(struct vnode_attr *vap, struct vnode_attr *dvap, kauth_action_t action, vfs_context_t ctx);
+
+/*!
+ @function vnode_attr_authorize
+ @abstract Authorize a kauth-style action on a file system object based on its attributes.
+ @discussion This function should be preceded by a call to vnode_attr_authorize_init to get what attributes are required.
+ @param vap attributes of file system object on which to authorize action.
+ @param dvap attributes of parent of file system object, can be NULL.
+ @param mp  mountpoint to which file system object belongs, can be NULL.
+ @param action Action to authorize, e.g. KAUTH_VNODE_READ_DATA.  See bsd/sys/kauth.h.
+ @param ctx Context for which to authorize actions.
+ @return EACCESS if permission is denied.  0 if operation allowed.  Various errors from lower layers.
+ */
+int    vnode_attr_authorize(struct vnode_attr *vap, struct vnode_attr *dvap, mount_t mp, kauth_action_t action, vfs_context_t ctx);
+#endif /* KERNEL_PRIVATE */
+
 /*!
  @function vnode_authattr
  @abstract Given a vnode_attr structure, determine what kauth-style actions must be authorized in order to set those attributes.
@@ -2085,6 +2117,7 @@ void vnode_putname_printable(const char *name);
  @function vfs_setup_vattr_from_attrlist
  @abstract Setup a vnode_attr structure given an attrlist structure.
  @Used by a VNOP_GETATTRLISTBULK implementation to setup a vnode_attr structure from a attribute list. It also returns the fixed size of the attribute buffer required.
+ @warning this forces new fork attr behavior, i.e. reinterpret forkattr bits as ATTR_CMNEXT
  @param alp Pointer to attribute list structure.
  @param vap Pointer to vnode_attr structure.
  @param obj_vtype Type of object - If VNON is passed, then the type is ignored and common, file and dir attrs are used to initialise the vattrs. If set to VDIR, only common and directory attributes are used. For all other types, only common and file attrbutes are used.
index 2123aa04e6091bacbf94c86b7fff4d9d2e0c317b..44dd9095701d7ab36a2764d5523884fca1bc6828 100644 (file)
@@ -154,6 +154,32 @@ extern struct vnodeop_desc vnop_removenamedstream_desc;
 
 #endif
 
+#ifdef KERNEL_PRIVATE
+/*
+ * This pair of functions register and unregister callout with
+ * buffer_cache_gc() code path. This callout enables underlying
+ * fs to kick off any memory reclamation that would be otherwise
+ * satisfied by buffer_cache_gc(). callout() will be called in the
+ * vm_pageout code path, so precautions should be taken to not
+ * allocate memory or take any locks which might have memory
+ * allocation behind them. callout() can be called with first parameter
+ * set to false, in which case memory reclamation should be
+ * limited in scope. In case of the first parameter set to true, fs
+ * MUST free some memory if possible. Second parameter to the
+ * register function will be passed as a second parameter to the
+ * callout() as is.
+ * fs_buffer_cache_gc_unregister() second parameter will be used
+ * to distinguish between same callout() and this parameter should
+ * match the one passed during registration. It will unregister all
+ * instances of the matching callout() and argument from the callout
+ * list.
+ */
+
+
+extern int fs_buffer_cache_gc_register(void (* callout)(int, void *), void *);
+extern int fs_buffer_cache_gc_unregister(void (* callout)(int, void *), void *);
+#endif
+
 __BEGIN_DECLS
 
 struct vnop_lookup_args {
@@ -1326,6 +1352,12 @@ struct vnop_copyfile_args {
 extern errno_t VNOP_COPYFILE(vnode_t, vnode_t, vnode_t, struct componentname *, int, int, vfs_context_t);
 #endif /* XNU_KERNEL_PRIVATE */
 
+typedef enum dir_clone_authorizer_op {
+       OP_AUTHORIZE = 0,           /* request authorization of action */
+       OP_VATTR_SETUP = 1,         /* query for attributes that are required for OP_AUTHORIZE */
+       OP_VATTR_CLEANUP = 2        /* request to cleanup any state or free any memory allocated in OP_AUTHORIZE */
+} dir_clone_authorizer_op_t;
+
 struct vnop_clonefile_args {
        struct vnodeop_desc *a_desc;
        vnode_t a_fvp;
@@ -1335,7 +1367,16 @@ struct vnop_clonefile_args {
        struct vnode_attr *a_vap;
        uint32_t a_flags;
        vfs_context_t a_context;
-       /* XXX Add recursive directory cloning authorizer */
+       int (*a_dir_clone_authorizer)(  /* Authorization callback */
+                       struct vnode_attr *vap, /* attribute to be authorized */
+                       kauth_action_t action, /* action for which attribute is to be authorized */
+                       struct vnode_attr *dvap, /* target directory attributes */
+                       vnode_t sdvp, /* source directory vnode pointer (optional) */
+                       mount_t mp, /* mount point of filesystem */
+                       dir_clone_authorizer_op_t vattr_op, /* specific operation requested : setup, authorization or cleanup  */
+                       vfs_context_t ctx,              /* As passed to VNOP */
+                       void *reserved);                /* Always NULL */
+       void *a_reserved;               /* Currently unused */
 };
 
 /*!
index 22750b6b945605075c4827ae8fd069442faac401..bcc58053ba1b47940314683d80b7b8d80e1c2a8b 100644 (file)
@@ -318,12 +318,14 @@ extern    struct vnode *imgsrc_rootvnodes[];
  */
 #define VDESC_MAX_VPS          16
 /* Low order 16 flag bits are reserved for willrele flags for vp arguments. */
-#define VDESC_VP0_WILLRELE     0x0001
-#define VDESC_VP1_WILLRELE     0x0002
-#define VDESC_VP2_WILLRELE     0x0004
-#define VDESC_VP3_WILLRELE     0x0008
-#define VDESC_NOMAP_VPP                0x0100
-#define VDESC_VPP_WILLRELE     0x0200
+#define VDESC_VP0_WILLRELE     0x00001
+#define VDESC_VP1_WILLRELE     0x00002
+#define VDESC_VP2_WILLRELE     0x00004
+#define VDESC_VP3_WILLRELE     0x00008
+#define VDESC_NOMAP_VPP                0x00100
+#define VDESC_VPP_WILLRELE     0x00200
+
+#define VDESC_DISABLED         0x10000 /* descriptor defined but op is unused, has no op slot */
 
 /*
  * VDESC_NO_OFFSET is used to identify the end of the offset list
@@ -447,6 +449,9 @@ int vn_authorize_rmdir(vnode_t dvp, vnode_t vp, struct componentname *cnp, vfs_c
 typedef int (*vn_create_authorizer_t)(vnode_t, struct componentname *, struct vnode_attr *, vfs_context_t, void*);
 int vn_authorize_mkdir(vnode_t, struct componentname *, struct vnode_attr *, vfs_context_t, void*);
 int vn_authorize_null(vnode_t, struct componentname *, struct vnode_attr *, vfs_context_t, void*);
+int vnode_attr_authorize_dir_clone(struct vnode_attr *vap, kauth_action_t action,
+    struct vnode_attr *dvap, vnode_t sdvp, mount_t mp, dir_clone_authorizer_op_t vattr_op,
+    vfs_context_t ctx, void *reserved);
 /* End of authorization subroutines */
 
 #define VN_CREATE_NOAUTH               (1<<0)
index abe9556f7a7b7f95193d51e89781c93483024377..8e9e760149fbffc382fa3ea07f3edbc2505aa7a8 100644 (file)
@@ -626,6 +626,22 @@ vfs_clearextendedsecurity(mount_t mp)
        mount_unlock(mp);
 }
 
+void
+vfs_setnoswap(mount_t mp)
+{
+       mount_lock(mp);
+       mp->mnt_kern_flag |= MNTK_NOSWAP;
+       mount_unlock(mp);
+}
+
+void
+vfs_clearnoswap(mount_t mp)
+{
+       mount_lock(mp);
+       mp->mnt_kern_flag &= ~MNTK_NOSWAP;
+       mount_unlock(mp);
+}
+
 int
 vfs_extendedsecurity(mount_t mp)
 {
@@ -920,6 +936,13 @@ vfs_fsadd(struct vfs_fsentry *vfe, vfstable_t *handle)
        for (j = 0; vfe->vfe_opvdescs[i]->opv_desc_ops[j].opve_op; j++) {
                opve_descp = &(vfe->vfe_opvdescs[i]->opv_desc_ops[j]);
 
+               /* Silently skip known-disabled operations */
+               if (opve_descp->opve_op->vdesc_flags & VDESC_DISABLED) {
+                       printf("vfs_fsadd: Ignoring reference in %p to disabled operation %s.\n",
+                               vfe->vfe_opvdescs[i], opve_descp->opve_op->vdesc_name);
+                       continue;
+               }
+
                /*
                 * Sanity check:  is this operation listed
                 * in the list of operations?  We check this
@@ -938,7 +961,7 @@ vfs_fsadd(struct vfs_fsentry *vfe, vfstable_t *handle)
                 * list of supported operations.
                 */
                if (opve_descp->opve_op->vdesc_offset == 0 &&
-                   opve_descp->opve_op->vdesc_offset != VOFFSET(vnop_default)) {
+                   opve_descp->opve_op != VDESC(vnop_default)) {
                        printf("vfs_fsadd: operation %s not listed in %s.\n",
                               opve_descp->opve_op->vdesc_name,
                               "vfs_op_descs");
@@ -2542,6 +2565,7 @@ vnode_setattr(vnode_t vp, struct vnode_attr *vap, vfs_context_t ctx)
                error = EROFS;
                goto out;
        }
+
 #if NAMEDSTREAMS
        /* For streams, va_data_size is the only setable attribute. */
        if ((vp->v_flag & VISNAMEDSTREAM) && (vap->va_active != VNODE_ATTR_va_data_size)) {
@@ -2549,6 +2573,25 @@ vnode_setattr(vnode_t vp, struct vnode_attr *vap, vfs_context_t ctx)
                goto out;
        }
 #endif
+       /* Check for truncation */
+       if(VATTR_IS_ACTIVE(vap,  va_data_size)) {
+               switch(vp->v_type) {
+               case VREG:
+                       /* For regular files it's ok */
+                       break;
+               case VDIR:
+                       /* Not allowed to truncate directories */
+                       error = EISDIR;
+                       goto out;
+               default:
+                       /* For everything else we will clear the bit and let underlying FS decide on the rest */
+                       VATTR_CLEAR_ACTIVE(vap, va_data_size);
+                       if (vap->va_active)
+                               break;
+                       /* If it was the only bit set, return success, to handle cases like redirect to /dev/null */
+                       return (0);
+               }
+       }
        
        /*
         * If ownership is being ignored on this volume, we silently discard
@@ -5315,11 +5358,21 @@ struct vnop_clonefile_args {
        struct vnodeop_desc *a_desc;
        vnode_t a_fvp;
        vnode_t a_dvp;
-       vnode_t a_vpp;
+       vnode_t *a_vpp;
        struct componentname *a_cnp;
        struct vnode_attr *a_vap;
        uint32_t a_flags;
        vfs_context_t a_context;
+       int (*a_dir_clone_authorizer)(  /* Authorization callback */
+                       struct vnode_attr *vap, /* attribute to be authorized */
+                       kauth_action_t action, /* action for which attribute is to be authorized */
+                       struct vnode_attr *dvap, /* target directory attributes */
+                       vnode_t sdvp, /* source directory vnode pointer (optional) */
+                       mount_t mp, /* mount point of filesystem */
+                       dir_clone_authorizer_op_t vattr_op, /* specific operation requested : setup, authorization or cleanup  */
+                       vfs_context_t ctx,              /* As passed to VNOP */
+                       void *reserved);                /* Always NULL */
+       void *a_reserved;               /* Currently unused */
 };
 #endif /* 0 */
 
@@ -5339,6 +5392,11 @@ VNOP_CLONEFILE(vnode_t fvp, vnode_t dvp, vnode_t *vpp,
        a.a_flags = flags;
        a.a_context = ctx;
 
+       if (vnode_vtype(fvp) == VDIR)
+               a.a_dir_clone_authorizer = vnode_attr_authorize_dir_clone;
+       else
+               a.a_dir_clone_authorizer = NULL;
+
        _err = (*dvp->v_op[vnop_clonefile_desc.vdesc_offset])(&a);
 
        if (_err == 0 && *vpp)
index 65f1560c7a6bddf2a512ba3f4e790645fe7df087..38df5a58daa33e69a9b51adddc7b4671a605c6e4 100644 (file)
@@ -356,6 +356,8 @@ static struct getvolattrlist_attrtab getvolattrlist_vol_tab[] = {
        {ATTR_VOL_ENCODINGSUSED,        0,                                              sizeof(uint64_t)},
        {ATTR_VOL_CAPABILITIES,         VFSATTR_BIT(f_capabilities),                    sizeof(vol_capabilities_attr_t)},
        {ATTR_VOL_UUID,                 VFSATTR_BIT(f_uuid),                            sizeof(uuid_t)},
+       {ATTR_VOL_QUOTA_SIZE,           VFSATTR_BIT(f_quota),                           sizeof(off_t)},
+       {ATTR_VOL_RESERVED_SIZE,        VFSATTR_BIT(f_reserved),                        sizeof(off_t)},
        {ATTR_VOL_ATTRIBUTES,           VFSATTR_BIT(f_attributes),                      sizeof(vol_attributes_attr_t)},
        {ATTR_VOL_INFO, 0, 0},
        {0, 0, 0}
@@ -363,7 +365,7 @@ static struct getvolattrlist_attrtab getvolattrlist_vol_tab[] = {
 
 static int
 getvolattrlist_parsetab(struct getvolattrlist_attrtab *tab, attrgroup_t attrs, struct vfs_attr *vsp,
-    ssize_t *sizep, int is_64bit)
+               ssize_t *sizep, int is_64bit, unsigned int maxiter)
 {
        attrgroup_t     recognised;
 
@@ -383,7 +385,7 @@ getvolattrlist_parsetab(struct getvolattrlist_attrtab *tab, attrgroup_t attrs, s
                                *sizep += tab->size;
                        }
                }
-       } while ((++tab)->attr != 0);
+       } while (((++tab)->attr != 0) && (--maxiter > 0));
        
        /* check to make sure that we recognised all of the passed-in attributes */
        if (attrs & ~recognised)
@@ -399,6 +401,8 @@ static int
 getvolattrlist_setupvfsattr(struct attrlist *alp, struct vfs_attr *vsp, ssize_t *sizep, int is_64bit)
 {
        int     error;
+       if (!alp)
+               return EINVAL;
 
        /*
         * Parse the above tables.
@@ -410,13 +414,14 @@ getvolattrlist_setupvfsattr(struct attrlist *alp, struct vfs_attr *vsp, ssize_t
                        return (EINVAL);
                }
                if ((error = getvolattrlist_parsetab(getvolattrlist_common_tab,
-                                                   alp->commonattr, vsp, sizep,
-                                                   is_64bit)) != 0) {
+                               alp->commonattr, vsp, sizep,
+                               is_64bit,
+                               sizeof(getvolattrlist_common_tab)/sizeof(getvolattrlist_common_tab[0]))) != 0) {
                        return(error);
                }
        }
        if (alp->volattr &&
-           (error = getvolattrlist_parsetab(getvolattrlist_vol_tab, alp->volattr, vsp, sizep, is_64bit)) != 0)
+           (error = getvolattrlist_parsetab(getvolattrlist_vol_tab, alp->volattr, vsp, sizep, is_64bit, sizeof(getvolattrlist_vol_tab)/sizeof(getvolattrlist_vol_tab[0]))) != 0)
                return(error);
 
        return(0);
@@ -509,6 +514,9 @@ static struct getattrlist_attrtab getattrlist_dir_tab[] = {
        {ATTR_DIR_LINKCOUNT,    VATTR_BIT(va_dirlinkcount),     sizeof(uint32_t),               KAUTH_VNODE_READ_ATTRIBUTES},
        {ATTR_DIR_ENTRYCOUNT,   VATTR_BIT(va_nchildren),        sizeof(uint32_t),               KAUTH_VNODE_READ_ATTRIBUTES},
        {ATTR_DIR_MOUNTSTATUS,  0,                              sizeof(uint32_t),               KAUTH_VNODE_READ_ATTRIBUTES},
+       {ATTR_DIR_ALLOCSIZE,    VATTR_BIT(va_total_alloc) | VATTR_BIT(va_total_size), sizeof(off_t), KAUTH_VNODE_READ_ATTRIBUTES},
+       {ATTR_DIR_IOBLOCKSIZE,  VATTR_BIT(va_iosize),           sizeof(uint32_t),               KAUTH_VNODE_READ_ATTRIBUTES},
+       {ATTR_DIR_DATALENGTH,   VATTR_BIT(va_total_size) | VATTR_BIT(va_data_size), sizeof(off_t), KAUTH_VNODE_READ_ATTRIBUTES},
        {0, 0, 0, 0}
 };
 static struct getattrlist_attrtab getattrlist_file_tab[] = {
@@ -522,7 +530,14 @@ static struct getattrlist_attrtab getattrlist_file_tab[] = {
        {ATTR_FILE_RSRCLENGTH,  0,                              sizeof(off_t),                  KAUTH_VNODE_READ_ATTRIBUTES},
        {ATTR_FILE_RSRCALLOCSIZE, 0,                            sizeof(off_t),                  KAUTH_VNODE_READ_ATTRIBUTES},
        {0, 0, 0, 0}
-};     
+};
+
+//for forkattr bits repurposed as new common attributes
+static struct getattrlist_attrtab getattrlist_common_extended_tab[] = {
+       {ATTR_CMNEXT_RELPATH,           0,                                                      sizeof(struct attrreference),   KAUTH_VNODE_READ_ATTRIBUTES},
+       {ATTR_CMNEXT_PRIVATESIZE,       VATTR_BIT(va_private_size),     sizeof(off_t),                                  KAUTH_VNODE_READ_ATTRIBUTES},
+       {0, 0, 0, 0}
+};
 
 /*
  * This table is for attributes which are only set from the getattrlistbulk(2)
@@ -549,13 +564,19 @@ static struct getattrlist_attrtab getattrlistbulk_file_tab[] = {
        {0, 0, 0, 0}
 };
 
+static struct getattrlist_attrtab getattrlistbulk_common_extended_tab[] = {
+       /* getattrlist_parsetab() expects > 1 entries */
+       {0, 0, 0, 0},
+       {0, 0, 0, 0}
+};
+
 /*
  * The following are attributes that VFS can derive.
  *
  * A majority of them are the same attributes that are required for stat(2) and statfs(2).
  */
 #define VFS_DFLT_ATTR_VOL      (ATTR_VOL_FSTYPE | ATTR_VOL_SIGNATURE |  \
-                                ATTR_VOL_SIZE | ATTR_VOL_SPACEFREE |  \
+                                ATTR_VOL_SIZE | ATTR_VOL_SPACEFREE |  ATTR_VOL_QUOTA_SIZE | ATTR_VOL_RESERVED_SIZE | \
                                 ATTR_VOL_SPACEAVAIL | ATTR_VOL_MINALLOCATION |  \
                                 ATTR_VOL_ALLOCATIONCLUMP |  ATTR_VOL_IOBLOCKSIZE |  \
                                 ATTR_VOL_MOUNTPOINT | ATTR_VOL_MOUNTFLAGS |  \
@@ -575,8 +596,7 @@ static struct getattrlist_attrtab getattrlistbulk_file_tab[] = {
                                 ATTR_CMN_DOCUMENT_ID | ATTR_CMN_GEN_COUNT | \
                                 ATTR_CMN_DATA_PROTECT_FLAGS)
 
-#define VFS_DFLT_ATT_CMN_EXT   (ATTR_CMN_EXT_GEN_COUNT | ATTR_CMN_EXT_DOCUMENT_ID |\
-                                ATTR_CMN_EXT_DATA_PROTECT_FLAGS)
+#define VFS_DFLT_ATT_CMN_EXT   (ATTR_CMNEXT_PRIVATESIZE)
 
 #define VFS_DFLT_ATTR_DIR      (ATTR_DIR_LINKCOUNT | ATTR_DIR_MOUNTSTATUS)
 
@@ -589,11 +609,13 @@ static struct getattrlist_attrtab getattrlistbulk_file_tab[] = {
 static int
 getattrlist_parsetab(struct getattrlist_attrtab *tab, attrgroup_t attrs,
     struct vnode_attr *vap, ssize_t *sizep, kauth_action_t *actionp,
-    int is_64bit)
+    int is_64bit, unsigned int maxiter)
 {
        attrgroup_t     recognised;
-
        recognised = 0;
+       if (!tab)
+               return EINVAL;
+
        do {
                /* is this attribute set? */
                if (tab->attr & attrs) {
@@ -618,7 +640,7 @@ getattrlist_parsetab(struct getattrlist_attrtab *tab, attrgroup_t attrs,
                        if (attrs == recognised)
                                break;  /* all done, get out */
                }
-       } while ((++tab)->attr != 0);
+       } while (((++tab)->attr != 0) && (--maxiter > 0));
        
        /* check to make sure that we recognised all of the passed-in attributes */
        if (attrs & ~recognised)
@@ -631,7 +653,7 @@ getattrlist_parsetab(struct getattrlist_attrtab *tab, attrgroup_t attrs,
  * the data from a filesystem.
  */
 static int
-getattrlist_setupvattr(struct attrlist *alp, struct vnode_attr *vap, ssize_t *sizep, kauth_action_t *actionp, int is_64bit, int isdir)
+getattrlist_setupvattr(struct attrlist *alp, struct vnode_attr *vap, ssize_t *sizep, kauth_action_t *actionp, int is_64bit, int isdir, int use_fork)
 {
        int     error;
 
@@ -641,13 +663,16 @@ getattrlist_setupvattr(struct attrlist *alp, struct vnode_attr *vap, ssize_t *si
        *sizep = sizeof(uint32_t);      /* length count */
        *actionp = 0;
        if (alp->commonattr &&
-           (error = getattrlist_parsetab(getattrlist_common_tab, alp->commonattr, vap, sizep, actionp, is_64bit)) != 0)
+           (error = getattrlist_parsetab(getattrlist_common_tab, alp->commonattr, vap, sizep, actionp, is_64bit, sizeof(getattrlist_common_tab)/sizeof(getattrlist_common_tab[0]))) != 0)
                return(error);
        if (isdir && alp->dirattr &&
-           (error = getattrlist_parsetab(getattrlist_dir_tab, alp->dirattr, vap, sizep, actionp, is_64bit)) != 0)
+           (error = getattrlist_parsetab(getattrlist_dir_tab, alp->dirattr, vap, sizep, actionp, is_64bit, sizeof(getattrlist_dir_tab)/sizeof(getattrlist_dir_tab[0]))) != 0)
                return(error);
        if (!isdir && alp->fileattr &&
-           (error = getattrlist_parsetab(getattrlist_file_tab, alp->fileattr, vap, sizep, actionp, is_64bit)) != 0)
+           (error = getattrlist_parsetab(getattrlist_file_tab, alp->fileattr, vap, sizep, actionp, is_64bit, sizeof(getattrlist_file_tab)/sizeof(getattrlist_file_tab[0]))) != 0)
+               return(error);
+       if (use_fork && alp->forkattr &&
+           (error = getattrlist_parsetab(getattrlist_common_extended_tab, alp->forkattr, vap, sizep, actionp, is_64bit, sizeof(getattrlist_common_extended_tab)/sizeof(getattrlist_common_extended_tab[0]))) != 0)
                return(error);
 
        return(0);
@@ -659,7 +684,7 @@ getattrlist_setupvattr(struct attrlist *alp, struct vnode_attr *vap, ssize_t *si
  */
 static int
 getattrlist_setupvattr_all(struct attrlist *alp, struct vnode_attr *vap,
-    enum vtype obj_type, ssize_t *fixedsize, int is_64bit)
+    enum vtype obj_type, ssize_t *fixedsize, int is_64bit, int use_fork)
 {
        int     error = 0;
 
@@ -671,12 +696,14 @@ getattrlist_setupvattr_all(struct attrlist *alp, struct vnode_attr *vap,
        }
        if (alp->commonattr) {
                error = getattrlist_parsetab(getattrlist_common_tab,
-                   alp->commonattr, vap, fixedsize, NULL, is_64bit);
+                       alp->commonattr, vap, fixedsize, NULL, is_64bit,
+                       sizeof(getattrlist_common_tab)/sizeof(getattrlist_common_tab[0]));
 
                if (!error) {
                        /* Ignore any errrors from the bulk table */
                        (void)getattrlist_parsetab(getattrlistbulk_common_tab,
-                           alp->commonattr, vap, fixedsize, NULL, is_64bit);
+                               alp->commonattr, vap, fixedsize, NULL, is_64bit,
+                               sizeof(getattrlistbulk_common_tab)/sizeof(getattrlistbulk_common_tab[0]));
                        /*
                         * turn off va_fsid since we will be using only
                         * va_fsid64 for ATTR_CMN_FSID.
@@ -687,17 +714,33 @@ getattrlist_setupvattr_all(struct attrlist *alp, struct vnode_attr *vap,
 
        if (!error && (obj_type == VNON || obj_type == VDIR) && alp->dirattr) {
                error = getattrlist_parsetab(getattrlist_dir_tab, alp->dirattr,
-                   vap, fixedsize, NULL, is_64bit);
+                               vap, fixedsize, NULL, is_64bit,
+                               sizeof(getattrlist_dir_tab)/sizeof(getattrlist_dir_tab[0]));
        }
 
        if (!error && (obj_type != VDIR) && alp->fileattr) {
                error = getattrlist_parsetab(getattrlist_file_tab,
-                   alp->fileattr, vap, fixedsize, NULL, is_64bit);
+                       alp->fileattr, vap, fixedsize, NULL, is_64bit,
+                       sizeof(getattrlist_file_tab)/sizeof(getattrlist_file_tab[0]));
 
                if (!error) {
                        /*Ignore any errors from the bulk table */
                        (void)getattrlist_parsetab(getattrlistbulk_file_tab,
-                           alp->fileattr, vap, fixedsize, NULL, is_64bit);
+                               alp->fileattr, vap, fixedsize, NULL, is_64bit,
+                               sizeof(getattrlistbulk_file_tab)/sizeof(getattrlistbulk_file_tab[0]));
+               }
+       }
+
+       /* fork attributes are like extended common attributes if enabled*/
+       if (!error && use_fork && alp->forkattr) {
+               error = getattrlist_parsetab(getattrlist_common_extended_tab,
+                       alp->forkattr, vap, fixedsize, NULL, is_64bit,
+                       sizeof(getattrlist_common_extended_tab)/sizeof(getattrlist_common_extended_tab[0]));
+
+               if (!error) {
+                       (void)getattrlist_parsetab(getattrlistbulk_common_extended_tab,
+                               alp->forkattr, vap, fixedsize, NULL, is_64bit,
+                               sizeof(getattrlistbulk_common_extended_tab)/sizeof(getattrlistbulk_common_extended_tab[0]));
                }
        }
 
@@ -708,8 +751,10 @@ int
 vfs_setup_vattr_from_attrlist(struct attrlist *alp, struct vnode_attr *vap,
     enum vtype obj_vtype, ssize_t *attrs_fixed_sizep, vfs_context_t ctx)
 {
+       // the caller passes us no options, we assume the caller wants the new fork
+       // attr behavior, hence the hardcoded 1
        return (getattrlist_setupvattr_all(alp, vap, obj_vtype,
-           attrs_fixed_sizep, IS_64BIT_PROCESS(vfs_context_proc(ctx))));
+           attrs_fixed_sizep, IS_64BIT_PROCESS(vfs_context_proc(ctx)), 1));
 }
 
 
@@ -721,7 +766,7 @@ vfs_setup_vattr_from_attrlist(struct attrlist *alp, struct vnode_attr *vap,
  * missing attributes from the file system
  */
 static void
-getattrlist_fixupattrs(attribute_set_t *asp, struct vnode_attr *vap)
+getattrlist_fixupattrs(attribute_set_t *asp, struct vnode_attr *vap, int use_fork)
 {
        struct getattrlist_attrtab *tab;
 
@@ -775,6 +820,16 @@ getattrlist_fixupattrs(attribute_set_t *asp, struct vnode_attr *vap)
                        }
                } while ((++tab)->attr != 0);
        }
+       if (use_fork && asp->forkattr) {
+               tab = getattrlist_common_extended_tab;
+               do {
+                       if ((tab->attr & asp->forkattr) &&
+                           (tab->bits & vap->va_active) &&
+                           (vap->va_supported & tab->bits) == 0) {
+                               asp->forkattr &= ~tab->attr;
+                       }
+               } while ((++tab)->attr != 0);
+       }
 }
 
 static int
@@ -1345,6 +1400,14 @@ getvolattrlist(vfs_context_t ctx, vnode_t vp, struct attrlist *alp,
                ATTR_PACK(&ab, vs.f_uuid);
                ab.actual.volattr |= ATTR_VOL_UUID;
        }
+       if (alp->volattr & ATTR_VOL_QUOTA_SIZE) {
+               ATTR_PACK_CAST(&ab, off_t, vs.f_bsize * vs.f_quota);
+               ab.actual.volattr |= ATTR_VOL_QUOTA_SIZE;
+       }
+       if (alp->volattr & ATTR_VOL_RESERVED_SIZE) {
+               ATTR_PACK_CAST(&ab, off_t, vs.f_bsize * vs.f_reserved);
+               ab.actual.volattr |= ATTR_VOL_RESERVED_SIZE;
+       }
        if (alp->volattr & ATTR_VOL_ATTRIBUTES) {
                /* fix up volume attribute information */
 
@@ -1797,7 +1860,7 @@ out:
 
 static errno_t
 attr_pack_dir(struct vnode *vp, struct attrlist *alp, struct _attrlist_buf *abp,
-    struct vnode_attr *vap)
+    struct vnode_attr *vap, int return_valid, int pack_invalid)
 {
        if (alp->dirattr & ATTR_DIR_LINKCOUNT) {  /* full count of entries */
                ATTR_PACK4((*abp), (uint32_t)vap->va_dirlinkcount);
@@ -1839,6 +1902,43 @@ attr_pack_dir(struct vnode *vp, struct attrlist *alp, struct _attrlist_buf *abp,
                ATTR_PACK4((*abp), mntstat);
                abp->actual.dirattr |= ATTR_DIR_MOUNTSTATUS;
        }
+       if (alp->dirattr & ATTR_DIR_ALLOCSIZE) {
+               if (VATTR_IS_SUPPORTED(vap, va_data_alloc)) {
+                       ATTR_PACK8((*abp), vap->va_data_alloc);
+                       abp->actual.dirattr |= ATTR_DIR_ALLOCSIZE;
+               } else if (VATTR_IS_SUPPORTED(vap, va_total_alloc)) {
+                       ATTR_PACK8((*abp), vap->va_total_alloc);
+                       abp->actual.dirattr |= ATTR_DIR_ALLOCSIZE;
+               } else if (!return_valid || pack_invalid) {
+                       uint64_t zero_val = 0;
+                       ATTR_PACK8((*abp), zero_val);
+               }
+       }
+       if (alp->dirattr & ATTR_DIR_IOBLOCKSIZE) {
+               if (VATTR_IS_SUPPORTED(vap, va_iosize)) {
+                       ATTR_PACK4((*abp), vap->va_iosize);
+                       abp->actual.dirattr |= ATTR_DIR_IOBLOCKSIZE;
+               } else if (!return_valid || pack_invalid) {
+                       ATTR_PACK4((*abp), 0);
+               }
+       }
+       /*
+        * If the filesystem does not support datalength
+        * or dataallocsize, then we infer that totalsize and
+        * totalalloc are substitutes.
+        */
+       if (alp->dirattr & ATTR_DIR_DATALENGTH) {
+               if (VATTR_IS_SUPPORTED(vap, va_data_size)) {
+                       ATTR_PACK8((*abp), vap->va_data_size);
+                       abp->actual.dirattr |= ATTR_DIR_DATALENGTH;
+               } else if (VATTR_IS_SUPPORTED(vap, va_total_size)) {
+                       ATTR_PACK8((*abp), vap->va_total_size);
+                       abp->actual.dirattr |= ATTR_DIR_DATALENGTH;
+               } else if (!return_valid || pack_invalid) {
+                       uint64_t zero_val = 0;
+                       ATTR_PACK8((*abp), zero_val);
+               }
+       }
 
        return 0;
 }
@@ -1919,7 +2019,7 @@ attr_pack_file(vfs_context_t ctx, struct vnode *vp,  struct attrlist *alp,
 
                        if (VATTR_IS_SUPPORTED(vap, va_data_size)) {
                                totalsize += vap->va_data_size;
-                       } else {
+                       } else if (VATTR_IS_SUPPORTED(vap, va_total_size)) {
                                totalsize += vap->va_total_size;
                        }
 
@@ -1944,7 +2044,7 @@ attr_pack_file(vfs_context_t ctx, struct vnode *vp,  struct attrlist *alp,
                         */
                        if (VATTR_IS_SUPPORTED(vap, va_data_alloc)) {
                                totalalloc += vap->va_data_alloc;
-                       } else {
+                       } else if (VATTR_IS_SUPPORTED(vap, va_total_alloc)) {
                                totalalloc += vap->va_total_alloc;
                        }
 
@@ -1960,8 +2060,12 @@ attr_pack_file(vfs_context_t ctx, struct vnode *vp,  struct attrlist *alp,
                }
        }
        if (alp->fileattr & ATTR_FILE_IOBLOCKSIZE) {
-               ATTR_PACK4((*abp), vap->va_iosize);
-               abp->actual.fileattr |= ATTR_FILE_IOBLOCKSIZE;
+               if (VATTR_IS_SUPPORTED(vap, va_iosize)) {
+                       ATTR_PACK4((*abp), vap->va_iosize);
+                       abp->actual.fileattr |= ATTR_FILE_IOBLOCKSIZE;
+               } else if (!return_valid || pack_invalid) {
+                       ATTR_PACK4((*abp), 0);
+               }
        }
        if (alp->fileattr & ATTR_FILE_CLUMPSIZE) {
                if (!return_valid || pack_invalid) {
@@ -2000,18 +2104,26 @@ attr_pack_file(vfs_context_t ctx, struct vnode *vp,  struct attrlist *alp,
        if (alp->fileattr & ATTR_FILE_DATALENGTH) {
                if (VATTR_IS_SUPPORTED(vap, va_data_size)) {
                        ATTR_PACK8((*abp), vap->va_data_size);
-               } else {
+                       abp->actual.fileattr |= ATTR_FILE_DATALENGTH;
+               } else if (VATTR_IS_SUPPORTED(vap, va_total_size)){
                        ATTR_PACK8((*abp), vap->va_total_size);
+                       abp->actual.fileattr |= ATTR_FILE_DATALENGTH;
+               } else if (!return_valid || pack_invalid) {
+                       uint64_t zero_val = 0;
+                       ATTR_PACK8((*abp), zero_val);
                }
-               abp->actual.fileattr |= ATTR_FILE_DATALENGTH;
        }
        if (alp->fileattr & ATTR_FILE_DATAALLOCSIZE) {
                if (VATTR_IS_SUPPORTED(vap, va_data_alloc)) {
                        ATTR_PACK8((*abp), vap->va_data_alloc);
-               } else {
+                       abp->actual.fileattr |= ATTR_FILE_DATAALLOCSIZE;
+               } else if (VATTR_IS_SUPPORTED(vap, va_total_alloc)){
                        ATTR_PACK8((*abp), vap->va_total_alloc);
+                       abp->actual.fileattr |= ATTR_FILE_DATAALLOCSIZE;
+               } else if (!return_valid || pack_invalid) {
+                       uint64_t zero_val = 0;
+                       ATTR_PACK8((*abp), zero_val);
                }
-               abp->actual.fileattr |= ATTR_FILE_DATAALLOCSIZE;
        }
        /* already got the resource fork size/allocation above */
        if (alp->fileattr & ATTR_FILE_RSRCLENGTH) {
@@ -2044,6 +2156,36 @@ out:
        return (error);
 }
 
+/*
+ * Pack FORKATTR attributes into a user buffer.
+ * alp is a pointer to the bitmap of attributes required.
+ * abp is the state of the attribute filling operation.
+ * The attribute data (along with some other fields that are required
+ * are in ad.
+ */
+static errno_t
+attr_pack_common_extended(struct vnode *vp, struct attrlist *alp,
+               struct _attrlist_buf *abp, const char *relpathptr, ssize_t relpathlen,
+               struct vnode_attr *vap, int return_valid, int pack_invalid)
+{
+       if (vp && (alp->forkattr & ATTR_CMNEXT_RELPATH)) {
+               attrlist_pack_string(abp, relpathptr, relpathlen);
+               abp->actual.forkattr |= ATTR_CMNEXT_RELPATH;
+       }
+
+       if (alp->forkattr & ATTR_CMNEXT_PRIVATESIZE) {
+               if (VATTR_IS_SUPPORTED(vap, va_private_size)) {
+                       ATTR_PACK8((*abp), vap->va_private_size);
+                       abp->actual.forkattr |= ATTR_CMNEXT_PRIVATESIZE;
+               } else if (!return_valid || pack_invalid) {
+                       uint64_t zero_val = 0;
+                       ATTR_PACK8((*abp), zero_val);
+               }
+       }
+
+       return 0;
+}
+
 static void
 vattr_get_alt_data(vnode_t vp, struct attrlist *alp, struct vnode_attr *vap,
     int return_valid, int is_bulk, vfs_context_t ctx)
@@ -2121,7 +2263,8 @@ vattr_get_alt_data(vnode_t vp, struct attrlist *alp, struct vnode_attr *vap,
 static errno_t
 calc_varsize(vnode_t vp, struct attrlist *alp, struct vnode_attr *vap,
    ssize_t *varsizep, char *fullpathptr, ssize_t *fullpathlenp,
-   const char **vnamep, const char **cnpp, ssize_t *cnlp)  
+   char *relpathptr, ssize_t *relpathlenp, const char **vnamep,
+   const char **cnpp, ssize_t *cnlp)
 {
        int error = 0;
 
@@ -2188,6 +2331,25 @@ calc_varsize(vnode_t vp, struct attrlist *alp, struct vnode_attr *vap,
                *varsizep += roundup(((*fullpathlenp) + 1), 4);
        }
 
+       /*
+        * Compute this vnode's volume relative path.
+        */
+       if (vp && (alp->forkattr & ATTR_CMNEXT_RELPATH)) {
+               int len;
+               int err;
+
+               /* call build_path making sure NOT to use the cache-only behavior */
+               err = build_path(vp, relpathptr, MAXPATHLEN, &len, BUILDPATH_VOLUME_RELATIVE, vfs_context_current());
+               if (err) {
+                       error = err;
+                       goto out;
+               }
+
+               //`len' includes trailing null
+               *relpathlenp = len - 1;
+               *varsizep += roundup(len, 4);
+       }
+
        /*
         * We have a kauth_acl_t but we will be returning a kauth_filesec_t.
         *
@@ -2228,11 +2390,14 @@ vfs_attr_pack_internal(vnode_t vp, uio_t auio, struct attrlist *alp,
        ssize_t cnl;
        char *fullpathptr;
        ssize_t fullpathlen;
+       char *relpathptr;
+       ssize_t relpathlen;
        int error;
        int proc_is64;
        int return_valid;
        int pack_invalid;
        int alloc_local_buf;
+       const int use_fork = options & FSOPT_ATTR_CMN_EXTENDED;
 
        proc_is64 = proc_is64bit(vfs_context_proc(ctx));
        ab.base = NULL;
@@ -2240,6 +2405,8 @@ vfs_attr_pack_internal(vnode_t vp, uio_t auio, struct attrlist *alp,
        cnl = 0;
        fullpathptr = NULL;
        fullpathlen = 0;
+       relpathptr = NULL;
+       relpathlen = 0;
        error = 0;
        alloc_local_buf = 0;
 
@@ -2266,14 +2433,14 @@ vfs_attr_pack_internal(vnode_t vp, uio_t auio, struct attrlist *alp,
                if (!VATTR_ALL_SUPPORTED(vap)) {
                        if (return_valid && pack_invalid) {
                                /* Fix up valid mask for post processing */
-                               getattrlist_fixupattrs(&ab.valid, vap);
+                               getattrlist_fixupattrs(&ab.valid, vap, use_fork);
                                        
                                /* Force packing of everything asked for */
                                vap->va_supported = vap->va_active;
                        } else if (return_valid) {
                                /* Adjust the requested attributes */
                                getattrlist_fixupattrs(
-                                   (attribute_set_t *)&(alp->commonattr), vap);
+                                   (attribute_set_t *)&(alp->commonattr), vap, use_fork);
                        } else {
                                error = EINVAL;
                        }
@@ -2283,6 +2450,7 @@ vfs_attr_pack_internal(vnode_t vp, uio_t auio, struct attrlist *alp,
                        goto out;
        }
 
+       //if a path is requested, allocate a temporary buffer to build it
        if (vp && (alp->commonattr & (ATTR_CMN_FULLPATH))) {
                fullpathptr = (char*) kalloc(MAXPATHLEN);
                if (fullpathptr == NULL) {
@@ -2293,11 +2461,22 @@ vfs_attr_pack_internal(vnode_t vp, uio_t auio, struct attrlist *alp,
                bzero(fullpathptr, MAXPATHLEN);
        }
 
+       // only interpret fork attributes if they're used as new common attributes
+       if (vp && use_fork && (alp->forkattr & (ATTR_CMNEXT_RELPATH))) {
+               relpathptr = (char*) kalloc(MAXPATHLEN);
+               if (relpathptr == NULL) {
+                       error = ENOMEM;
+                       VFS_DEBUG(ctx,vp, "ATTRLIST - ERROR: cannot allocate relpath buffer");
+                       goto out;
+               }
+               bzero(relpathptr, MAXPATHLEN);
+       }
+
        /*
         * Compute variable-space requirements.
         */
        error = calc_varsize(vp, alp, vap, &varsize, fullpathptr, &fullpathlen,
-           &vname, &cnp, &cnl);
+                       relpathptr, &relpathlen, &vname, &cnp, &cnl);
        if (error)
                goto out;
 
@@ -2415,11 +2594,11 @@ vfs_attr_pack_internal(vnode_t vp, uio_t auio, struct attrlist *alp,
 
        /* common attributes ************************************************/
        error = attr_pack_common(ctx, vp, alp, &ab, vap, proc_is64, cnp, cnl,
-           fullpathptr, fullpathlen, return_valid, pack_invalid, vtype, is_bulk); 
+           fullpathptr, fullpathlen, return_valid, pack_invalid, vtype, is_bulk);
 
        /* directory attributes *********************************************/
        if (!error && alp->dirattr && (vtype == VDIR)) {
-               error = attr_pack_dir(vp, alp, &ab, vap);
+               error = attr_pack_dir(vp, alp, &ab, vap, return_valid, pack_invalid);
        }
 
        /* file attributes **************************************************/
@@ -2428,6 +2607,12 @@ vfs_attr_pack_internal(vnode_t vp, uio_t auio, struct attrlist *alp,
                    pack_invalid, is_bulk);
        }
 
+       /* common extended attributes *****************************************/
+       if (!error && use_fork) {
+               error = attr_pack_common_extended(vp, alp, &ab, relpathptr, relpathlen,
+                   vap, return_valid, pack_invalid);
+       }
+
        if (error)
                goto out;
        
@@ -2487,6 +2672,8 @@ out:
                vnode_putname(vname);
        if (fullpathptr)
                kfree(fullpathptr, MAXPATHLEN);
+       if (relpathptr)
+               kfree(relpathptr, MAXPATHLEN);
        if (ab.base != NULL && alloc_local_buf)
                FREE(ab.base, M_TEMP);
        return (error);
@@ -2512,7 +2699,7 @@ vfs_attr_pack(vnode_t vp, uio_t uio, struct attrlist *alp, uint64_t options,
        vap->va_active = 0;
 
        error = getattrlist_setupvattr_all(alp, vap, v_type, &fixedsize,
-           proc_is64bit(vfs_context_proc(ctx)));
+           proc_is64bit(vfs_context_proc(ctx)), options & FSOPT_ATTR_CMN_EXTENDED);
 
        if (error) {
                VFS_DEBUG(ctx, vp,
@@ -2556,6 +2743,8 @@ getattrlist_internal(vfs_context_t ctx, vnode_t vp, struct attrlist  *alp,
        int             vtype = 0;
        uio_t           auio;
        char uio_buf[ UIO_SIZEOF(1)];
+       // must be true for fork attributes to be used as new common attributes
+       const int use_fork = (options & FSOPT_ATTR_CMN_EXTENDED) != 0;
 
        proc_is64 = proc_is64bit(vfs_context_proc(ctx));
 
@@ -2588,13 +2777,15 @@ getattrlist_internal(vfs_context_t ctx, vnode_t vp, struct attrlist  *alp,
 #endif /* MAC */
 
        /*
-        * It is legal to request volume or file attributes,
-        * but not both.
+        * It is legal to request volume or file attributes, but not both.
+        *
+        * 26903449 fork attributes can also be requested, but only if they're
+        * interpreted as new, common attributes
         */
        if (alp->volattr) {
-               if (alp->fileattr || alp->dirattr || alp->forkattr) {
+               if (alp->fileattr || alp->dirattr || (alp->forkattr && !use_fork)) {
                        error = EINVAL;
-                       VFS_DEBUG(ctx, vp, "ATTRLIST - ERROR: mixed volume/file/directory/fork attributes");
+                       VFS_DEBUG(ctx, vp, "ATTRLIST - ERROR: mixed volume/file/directory attributes");
                        goto out;
                }
                /* handle volume attribute request */
@@ -2614,12 +2805,24 @@ getattrlist_internal(vfs_context_t ctx, vnode_t vp, struct attrlist  *alp,
                goto out;
        }
 
+       /* common extended attributes require FSOPT_ATTR_CMN_EXTENDED option */
+       if (!(use_fork) && (alp->forkattr & ATTR_CMNEXT_VALIDMASK)) {
+               error = EINVAL;
+               goto out;
+       }
+
+       /* FSOPT_ATTR_CMN_EXTENDED requires forkattrs are not referenced */
+       if ((options & FSOPT_ATTR_CMN_EXTENDED) && (alp->forkattr & (ATTR_FORK_VALIDMASK))) {
+               error = EINVAL;
+               goto out;
+       }
+
        /* Check for special packing semantics */
        return_valid = (alp->commonattr & ATTR_CMN_RETURNED_ATTRS) ? 1 : 0;
        pack_invalid = (options & FSOPT_PACK_INVAL_ATTRS) ? 1 : 0;
        if (pack_invalid) {
                /* FSOPT_PACK_INVAL_ATTRS requires ATTR_CMN_RETURNED_ATTRS */
-               if (!return_valid || alp->forkattr) {
+               if (!return_valid || (alp->forkattr && !use_fork)) {
                        error = EINVAL;
                        goto out;
                }
@@ -2635,7 +2838,7 @@ getattrlist_internal(vfs_context_t ctx, vnode_t vp, struct attrlist  *alp,
        /*
         * Set up the vnode_attr structure and authorise.
         */
-       if ((error = getattrlist_setupvattr(alp, &va, &fixedsize, &action, proc_is64, (vtype == VDIR))) != 0) {
+       if ((error = getattrlist_setupvattr(alp, &va, &fixedsize, &action, proc_is64, (vtype == VDIR), use_fork)) != 0) {
                VFS_DEBUG(ctx, vp, "ATTRLIST - ERROR: setup for request failed");
                goto out;
        }
@@ -3114,7 +3317,7 @@ get_error_attributes(vnode_t vp, struct attrlist *alp, uint64_t options,
        fsiz = 0;
        (void)getattrlist_setupvattr(&al, NULL, (ssize_t *)&fsiz,
            &action, proc_is64bit(vfs_context_proc(ctx)),
-           (vnode_vtype(vp) == VDIR));
+           (vnode_vtype(vp) == VDIR), (options & FSOPT_ATTR_CMN_EXTENDED));
 
        namelen = strlen(namebuf);
        vsiz = namelen + 1;
@@ -3595,7 +3798,7 @@ getattrlistbulk(proc_t p, struct getattrlistbulk_args *uap, int32_t *retval)
                        va.va_name = va_name;
 
                        (void)getattrlist_setupvattr_all(&al, &va, VNON, NULL,
-                           IS_64BIT_PROCESS(p));
+                           IS_64BIT_PROCESS(p), (uap->options & FSOPT_ATTR_CMN_EXTENDED));
 
                        error = VNOP_GETATTRLISTBULK(dvp, &al, &va, auio, NULL,
                            options, &eofflag, &count, ctx);
@@ -3895,6 +4098,11 @@ setattrlist_internal(vnode_t vp, struct setattrlist_args *uap, proc_t p, vfs_con
                ATTR_UNPACK(va.va_guuid);
                VATTR_SET_ACTIVE(&va, va_guuid);
        }
+       /* Support setattrlist of data protection class */
+       if (al.commonattr & ATTR_CMN_DATA_PROTECT_FLAGS) {
+               ATTR_UNPACK(va.va_dataprotect_class);
+               VATTR_SET_ACTIVE(&va, va_dataprotect_class);
+       }
 
        /* volume */
        if (al.volattr & ATTR_VOL_INFO) {
index f54c98779039b84b26e3665fa6badbdff467c2f4..cdccdc82889c6e061f71774766b615291faa3027 100644 (file)
@@ -171,9 +171,18 @@ static lck_attr_t  *buf_mtx_attr;
 static lck_grp_attr_t   *buf_mtx_grp_attr;
 static lck_mtx_t       *iobuffer_mtxp;
 static lck_mtx_t       *buf_mtxp;
+static lck_mtx_t       *buf_gc_callout;
 
 static int buf_busycount;
 
+#define FS_BUFFER_CACHE_GC_CALLOUTS_MAX_SIZE 16
+typedef struct {
+       void (* callout)(int, void *);
+       void *context;
+} fs_buffer_cache_gc_callout_t;
+
+fs_buffer_cache_gc_callout_t fs_callouts[FS_BUFFER_CACHE_GC_CALLOUTS_MAX_SIZE] = { {NULL, NULL} };
+
 static __inline__ int
 buf_timestamp(void)
 {
@@ -1329,7 +1338,8 @@ buf_strategy(vnode_t devvp, void *ap)
                        /* 
                         * Attach the file offset to this buffer.  The
                         * bufattr attributes will be passed down the stack
-                        * until they reach IOFlashStorage.  IOFlashStorage
+                        * until they reach the storage driver (whether 
+                        * IOFlashStorage, ASP, or IONVMe). The driver
                         * will retain the offset in a local variable when it
                         * issues its I/Os to the NAND controller.       
                         * 
@@ -1338,6 +1348,11 @@ buf_strategy(vnode_t devvp, void *ap)
                         * case, LwVM will update this field when it dispatches
                         * each I/O to IOFlashStorage.  But from our perspective
                         * we have only issued a single I/O.
+                        *
+                        * In the case of APFS we do not bounce through another 
+                        * intermediate layer (such as CoreStorage). APFS will
+                        * issue the I/Os directly to the block device / IOMedia
+                        * via buf_strategy on the specfs node.          
                         */
                        buf_setcpoff(bp, f_offset);
                        CP_DEBUG((CPDBG_OFFSET_IO | DBG_FUNC_NONE), (uint32_t) f_offset, (uint32_t) bp->b_lblkno, (uint32_t) bp->b_blkno, (uint32_t) bp->b_bcount, 0);
@@ -1991,6 +2006,7 @@ bufinit(void)
         */
        buf_mtxp        = lck_mtx_alloc_init(buf_mtx_grp, buf_mtx_attr);
        iobuffer_mtxp   = lck_mtx_alloc_init(buf_mtx_grp, buf_mtx_attr);
+       buf_gc_callout  = lck_mtx_alloc_init(buf_mtx_grp, buf_mtx_attr);
 
        if (iobuffer_mtxp == NULL)
                panic("couldn't create iobuffer mutex");
@@ -1998,6 +2014,9 @@ bufinit(void)
        if (buf_mtxp == NULL)
                panic("couldn't create buf mutex");
 
+       if (buf_gc_callout == NULL)
+               panic("couldn't create buf_gc_callout mutex");
+
        /*
         * allocate and initialize cluster specific global locks...
         */
@@ -2024,7 +2043,7 @@ bufinit(void)
  */
 
 #define MINMETA 512
-#define MAXMETA 8192
+#define MAXMETA 16384
 
 struct meta_zone_entry {
        zone_t mz_zone;
@@ -2039,6 +2058,7 @@ struct meta_zone_entry meta_zones[] = {
        {NULL, (MINMETA * 4),  16 * (MINMETA * 4), "buf.2048" },
        {NULL, (MINMETA * 8), 512 * (MINMETA * 8), "buf.4096" },
        {NULL, (MINMETA * 16), 512 * (MINMETA * 16), "buf.8192" },
+       {NULL, (MINMETA * 32), 512 * (MINMETA * 32), "buf.16384" },
        {NULL, 0, 0, "" } /* End */
 };
 
@@ -4496,6 +4516,50 @@ dump_buffer:
        return(0);
 }
 
+int
+fs_buffer_cache_gc_register(void (* callout)(int, void *), void *context)
+{
+       lck_mtx_lock(buf_gc_callout);
+       for (int i = 0; i < FS_BUFFER_CACHE_GC_CALLOUTS_MAX_SIZE; i++) {
+               if (fs_callouts[i].callout == NULL) {
+                       fs_callouts[i].callout = callout;
+                       fs_callouts[i].context = context;
+                       lck_mtx_unlock(buf_gc_callout);
+                       return 0;
+               }
+       }
+
+       lck_mtx_unlock(buf_gc_callout);
+       return ENOMEM;
+}
+
+int
+fs_buffer_cache_gc_unregister(void (* callout)(int, void *), void *context)
+{
+       lck_mtx_lock(buf_gc_callout);
+       for (int i = 0; i < FS_BUFFER_CACHE_GC_CALLOUTS_MAX_SIZE; i++) {
+               if (fs_callouts[i].callout == callout &&
+                   fs_callouts[i].context == context) {
+                       fs_callouts[i].callout = NULL;
+                       fs_callouts[i].context = NULL;
+               }
+       }
+       lck_mtx_unlock(buf_gc_callout);
+       return 0;
+}
+
+static void
+fs_buffer_cache_gc_dispatch_callouts(int all)
+{
+       lck_mtx_lock(buf_gc_callout);
+       for(int i = 0; i < FS_BUFFER_CACHE_GC_CALLOUTS_MAX_SIZE; i++) {
+               if (fs_callouts[i].callout != NULL) {
+                       fs_callouts[i].callout(all, fs_callouts[i].context);
+               }
+       }
+       lck_mtx_unlock(buf_gc_callout);
+}
+
 boolean_t 
 buffer_cache_gc(int all)
 {
@@ -4625,6 +4689,8 @@ buffer_cache_gc(int all)
 
        lck_mtx_unlock(buf_mtxp);
 
+       fs_buffer_cache_gc_dispatch_callouts(all);
+
        return did_large_zfree;
 }
 
index b7876475d49f6bdd804fea31a7440d173cd9eaa5..47cf243bad4f94234003d820ea10e65b4099c212 100644 (file)
@@ -916,6 +916,7 @@ vnode_update_identity(vnode_t vp, vnode_t dvp, const char *name, int name_len, u
                        tcred = vp->v_cred;
                        vp->v_cred = NOCRED;
                        vp->v_authorized_actions = 0;
+                       vp->v_cred_timestamp = 0;
                }
                if ( (flags & VNODE_UPDATE_NAME) ) {
                        vname = vp->v_name;
@@ -1376,8 +1377,11 @@ skiprsrcfork:
                        }
                }
 #endif /* MAC */
-               if (ttl_enabled && ((tv.tv_sec - dp->v_cred_timestamp) > dp->v_mount->mnt_authcache_ttl))
+               if (ttl_enabled &&
+                   (dp->v_mount->mnt_authcache_ttl == 0 ||
+                   ((tv.tv_sec - dp->v_cred_timestamp) > dp->v_mount->mnt_authcache_ttl))) {
                        break;
+               }
 
                /*
                 * NAME_CACHE_LOCK holds these fields stable
@@ -1386,11 +1390,17 @@ skiprsrcfork:
                 * so we make an ugly check for root here. root is always
                 * allowed and breaking out of here only to find out that is
                 * authorized by virtue of being root is very very expensive.
+                * However, the check for not root is valid only for filesystems
+                * which use local authorization.
+                *
+                * XXX: Remove the check for root when we can reliably set
+                * KAUTH_VNODE_SEARCHBYANYONE as root.
                 */
                if ((dp->v_cred != ucred || !(dp->v_authorized_actions & KAUTH_VNODE_SEARCH)) &&
                    !(dp->v_authorized_actions & KAUTH_VNODE_SEARCHBYANYONE) &&
-                   !vfs_context_issuser(ctx))
+                   (ttl_enabled || !vfs_context_issuser(ctx)))  {
                        break;
+               }
 
                /*
                 * indicate that we're allowed to traverse this directory...
index ee241e7aedd3da292e07e12f3bf26a89cadc9e01..d6b22ff84909a39c05b048607d93c4e4bc3468e6 100644 (file)
@@ -212,10 +212,10 @@ static void       cluster_read_ahead(vnode_t vp, struct cl_extent *extent, off_t files
 
 static int     cluster_push_now(vnode_t vp, struct cl_extent *, off_t EOF, int flags, int (*)(buf_t, void *), void *callback_arg);
 
-static int     cluster_try_push(struct cl_writebehind *, vnode_t vp, off_t EOF, int push_flag, int flags, int (*)(buf_t, void *), void *callback_arg);
+static int     cluster_try_push(struct cl_writebehind *, vnode_t vp, off_t EOF, int push_flag, int flags, int (*)(buf_t, void *), void *callback_arg, int *err);
 
 static void    sparse_cluster_switch(struct cl_writebehind *, vnode_t vp, off_t EOF, int (*)(buf_t, void *), void *callback_arg);
-static void    sparse_cluster_push(void **cmapp, vnode_t vp, off_t EOF, int push_flag, int io_flags, int (*)(buf_t, void *), void *callback_arg);
+static int     sparse_cluster_push(void **cmapp, vnode_t vp, off_t EOF, int push_flag, int io_flags, int (*)(buf_t, void *), void *callback_arg);
 static void    sparse_cluster_add(void **cmapp, vnode_t vp, struct cl_extent *, off_t EOF, int (*)(buf_t, void *), void *callback_arg);
 
 static kern_return_t vfs_drt_mark_pages(void **cmapp, off_t offset, u_int length, u_int *setcountp);
@@ -479,7 +479,7 @@ cluster_syncup(vnode_t vp, off_t newEOF, int (*callback)(buf_t, void *), void *c
                if (wbp->cl_number) {
                        lck_mtx_lock(&wbp->cl_lockw);
 
-                       cluster_try_push(wbp, vp, newEOF, PUSH_ALL | flags, 0, callback, callback_arg);
+                       cluster_try_push(wbp, vp, newEOF, PUSH_ALL | flags, 0, callback, callback_arg, NULL);
 
                        lck_mtx_unlock(&wbp->cl_lockw);
                }
@@ -3519,7 +3519,7 @@ check_cluster:
                                                n = WRITE_BEHIND;
                                }
                                while (n--)
-                                       cluster_try_push(wbp, vp, newEOF, 0, 0, callback, callback_arg);
+                                       cluster_try_push(wbp, vp, newEOF, 0, 0, callback, callback_arg, NULL);
                        }
                        if (wbp->cl_number < MAX_CLUSTERS) {
                                /*
@@ -3546,7 +3546,7 @@ check_cluster:
                         */
                        if (!((unsigned int)vfs_flags(vp->v_mount) & MNT_DEFWRITE)) {
                                
-                               ret_cluster_try_push = cluster_try_push(wbp, vp, newEOF, (flags & IO_NOCACHE) ? 0 : PUSH_DELAY, 0, callback, callback_arg);
+                               ret_cluster_try_push = cluster_try_push(wbp, vp, newEOF, (flags & IO_NOCACHE) ? 0 : PUSH_DELAY, 0, callback, callback_arg, NULL);
                        }
 
                        /*
@@ -5315,11 +5315,21 @@ cluster_push(vnode_t vp, int flags)
 
 int
 cluster_push_ext(vnode_t vp, int flags, int (*callback)(buf_t, void *), void *callback_arg)
+{
+       return cluster_push_err(vp, flags, callback, callback_arg, NULL);
+}
+
+/* write errors via err, but return the number of clusters written */
+int
+cluster_push_err(vnode_t vp, int flags, int (*callback)(buf_t, void *), void *callback_arg, int *err)
 {
         int    retval;
        int     my_sparse_wait = 0;
        struct  cl_writebehind *wbp;
 
+       if (err)
+               *err = 0;
+
        if ( !UBCINFOEXISTS(vp)) {
                KERNEL_DEBUG((FSDBG_CODE(DBG_FSRW, 53)) | DBG_FUNC_NONE, kdebug_vnode(vp), flags, 0, -1, 0);
                return (0);
@@ -5385,7 +5395,7 @@ cluster_push_ext(vnode_t vp, int flags, int (*callback)(buf_t, void *), void *ca
 
                        lck_mtx_unlock(&wbp->cl_lockw);
 
-                       sparse_cluster_push(&scmap, vp, ubc_getsize(vp), PUSH_ALL, flags, callback, callback_arg);
+                       retval = sparse_cluster_push(&scmap, vp, ubc_getsize(vp), PUSH_ALL, flags, callback, callback_arg);
 
                        lck_mtx_lock(&wbp->cl_lockw);
 
@@ -5394,11 +5404,13 @@ cluster_push_ext(vnode_t vp, int flags, int (*callback)(buf_t, void *), void *ca
                        if (wbp->cl_sparse_wait && wbp->cl_sparse_pushes == 0)
                                wakeup((caddr_t)&wbp->cl_sparse_pushes);
                } else {
-                       sparse_cluster_push(&(wbp->cl_scmap), vp, ubc_getsize(vp), PUSH_ALL, flags, callback, callback_arg);
+                       retval = sparse_cluster_push(&(wbp->cl_scmap), vp, ubc_getsize(vp), PUSH_ALL, flags, callback, callback_arg);
                }
+               if (err)
+                       *err = retval;
                retval = 1;
-       } else  {
-               retval = cluster_try_push(wbp, vp, ubc_getsize(vp), PUSH_ALL, flags, callback, callback_arg);
+       } else {
+               retval = cluster_try_push(wbp, vp, ubc_getsize(vp), PUSH_ALL, flags, callback, callback_arg, err);
        }
        lck_mtx_unlock(&wbp->cl_lockw);
 
@@ -5459,7 +5471,7 @@ cluster_release(struct ubc_info *ubc)
 
 
 static int
-cluster_try_push(struct cl_writebehind *wbp, vnode_t vp, off_t EOF, int push_flag, int io_flags, int (*callback)(buf_t, void *), void *callback_arg)
+cluster_try_push(struct cl_writebehind *wbp, vnode_t vp, off_t EOF, int push_flag, int io_flags, int (*callback)(buf_t, void *), void *callback_arg, int *err)
 {
         int cl_index;
        int cl_index1;
@@ -5468,7 +5480,7 @@ cluster_try_push(struct cl_writebehind *wbp, vnode_t vp, off_t EOF, int push_fla
        int cl_pushed = 0;
        struct cl_wextent l_clusters[MAX_CLUSTERS];
        u_int  max_cluster_pgcount;
-
+       int error = 0;
 
        max_cluster_pgcount = MAX_CLUSTER_SIZE(vp) / PAGE_SIZE;
        /*
@@ -5543,6 +5555,7 @@ cluster_try_push(struct cl_writebehind *wbp, vnode_t vp, off_t EOF, int push_fla
        for (cl_index = 0; cl_index < cl_len; cl_index++) {
                int     flags;
                struct  cl_extent cl;
+               int retval;
 
                flags = io_flags & (IO_PASSIVE|IO_CLOSE);
 
@@ -5561,7 +5574,10 @@ cluster_try_push(struct cl_writebehind *wbp, vnode_t vp, off_t EOF, int push_fla
                cl.b_addr = l_clusters[cl_index].b_addr;
                cl.e_addr = l_clusters[cl_index].e_addr;
 
-               cluster_push_now(vp, &cl, EOF, flags, callback, callback_arg);
+               retval = cluster_push_now(vp, &cl, EOF, flags, callback, callback_arg);
+
+               if (error == 0 && retval)
+                       error = retval;
 
                l_clusters[cl_index].b_addr = 0;
                l_clusters[cl_index].e_addr = 0;
@@ -5571,6 +5587,9 @@ cluster_try_push(struct cl_writebehind *wbp, vnode_t vp, off_t EOF, int push_fla
                if ( !(push_flag & PUSH_ALL) )
                        break;
        }
+       if (err)
+               *err = error;
+
 dont_try:
        if (cl_len > cl_pushed) {
               /*
@@ -5845,12 +5864,13 @@ sparse_cluster_switch(struct cl_writebehind *wbp, vnode_t vp, off_t EOF, int (*c
  * still associated with the write-behind context... however, if the scmap has been disassociated
  * from the write-behind context (the cluster_push case), the wb lock is not held
  */
-static void
+static int
 sparse_cluster_push(void **scmap, vnode_t vp, off_t EOF, int push_flag, int io_flags, int (*callback)(buf_t, void *), void *callback_arg)
 {
         struct cl_extent cl;
         off_t          offset;
        u_int           length;
+       int error = 0;
 
        KERNEL_DEBUG((FSDBG_CODE(DBG_FSRW, 79)) | DBG_FUNC_START, kdebug_vnode(vp), (*scmap), 0, push_flag, 0);
 
@@ -5858,18 +5878,23 @@ sparse_cluster_push(void **scmap, vnode_t vp, off_t EOF, int push_flag, int io_f
                vfs_drt_control(scmap, 1);
 
        for (;;) {
+               int retval;
                if (vfs_drt_get_cluster(scmap, &offset, &length) != KERN_SUCCESS)
                        break;
 
                cl.b_addr = (daddr64_t)(offset / PAGE_SIZE_64);
                cl.e_addr = (daddr64_t)((offset + length) / PAGE_SIZE_64);
 
-               cluster_push_now(vp, &cl, EOF, io_flags & (IO_PASSIVE|IO_CLOSE), callback, callback_arg);
+               retval = cluster_push_now(vp, &cl, EOF, io_flags & (IO_PASSIVE|IO_CLOSE), callback, callback_arg);
+               if (error == 0 && retval)
+                       error = retval;
 
                if ( !(push_flag & PUSH_ALL) )
                        break;
        }
        KERNEL_DEBUG((FSDBG_CODE(DBG_FSRW, 79)) | DBG_FUNC_END, kdebug_vnode(vp), (*scmap), 0, 0, 0);
+
+       return error;
 }
 
 
index 5cb03ba4380149b850df801a346f69f766e74049..d286796231f7ac75ab77e44c92c9fcb2a7ed7504 100644 (file)
@@ -53,19 +53,20 @@ enum {
 
        // Using AES IV context generated from key
        CPX_IV_AES_CTX_VFS                      = 0x08,
-       CPX_SYNTHETIC_OFFSET_FOR_IV     = 0x10,
+       CPX_SYNTHETIC_OFFSET_FOR_IV = 0x10,
+    CPX_COMPOSITEKEY            = 0x20
 };
 
 struct cpx {
 #if DEBUG
        uint32_t                cpx_magic1;
 #endif
+       aes_encrypt_ctx cpx_iv_aes_ctx;         // Context used for generating the IV
        cpx_flags_t             cpx_flags;
        uint16_t                cpx_max_key_len;
        uint16_t                cpx_key_len;
-       aes_encrypt_ctx cpx_iv_aes_ctx;         // Context used for generating the IV
        uint8_t                 cpx_cached_key[];
-} __attribute__((packed));
+};
 
 // -- cpx_t accessors --
 
@@ -135,6 +136,19 @@ void cpx_set_is_sep_wrapped_key(struct cpx *cpx, bool v)
        CLR(cpx->cpx_flags, CPX_SEP_WRAPPEDKEY);
 }
 
+bool cpx_is_composite_key(const struct cpx *cpx)
+{
+    return ISSET(cpx->cpx_flags, CPX_COMPOSITEKEY);
+}
+
+void cpx_set_is_composite_key(struct cpx *cpx, bool v)
+{
+    if (v)
+        SET(cpx->cpx_flags, CPX_COMPOSITEKEY);
+    else
+        CLR(cpx->cpx_flags, CPX_COMPOSITEKEY);
+}
+
 bool cpx_use_offset_for_iv(const struct cpx *cpx)
 {
        return ISSET(cpx->cpx_flags, CPX_USE_OFFSET_FOR_IV);
@@ -253,75 +267,68 @@ void cpx_copy(const struct cpx *src, cpx_t dst)
        dst->cpx_iv_aes_ctx = src->cpx_iv_aes_ctx;
 }
 
-static struct cp_wrap_func g_cp_wrap_func = {};
+typedef struct {
+       cp_lock_state_t state;
+       int             valid_uuid;
+       uuid_t          volume_uuid;
+} cp_lock_vfs_callback_arg;
 
 static int
 cp_lock_vfs_callback(mount_t mp, void *arg)
 {
-       VFS_IOCTL(mp, FIODEVICELOCKED, arg, 0, vfs_context_kernel());
+       cp_lock_vfs_callback_arg *callback_arg = (cp_lock_vfs_callback_arg *)arg;
+
+       if (callback_arg->valid_uuid)  {
+               struct vfs_attr va;
+               VFSATTR_INIT(&va);
+               VFSATTR_WANTED(&va, f_uuid);
+
+               if (vfs_getattr(mp, &va, vfs_context_current()))
+                       return 0;
+
+               if (!VFSATTR_IS_SUPPORTED(&va, f_uuid))
+                       return 0;
 
+               if(memcmp(va.f_uuid, callback_arg->volume_uuid, sizeof(uuid_t)))
+                       return 0;
+       }
+
+       VFS_IOCTL(mp, FIODEVICELOCKED, (void *)(uintptr_t)callback_arg->state, 0, vfs_context_kernel());
        return 0;
 }
 
 int
 cp_key_store_action(cp_key_store_action_t action)
 {
+       cp_lock_vfs_callback_arg callback_arg;
+
        switch (action) {
                case CP_ACTION_LOCKED:
-               case CP_ACTION_UNLOCKED:;
-                       cp_lock_state_t state = (action == CP_ACTION_LOCKED
-                                                                        ? CP_LOCKED_STATE : CP_UNLOCKED_STATE);
-                       return vfs_iterate(0, cp_lock_vfs_callback, (void *)(uintptr_t)state);
+               case CP_ACTION_UNLOCKED:
+                       callback_arg.state = (action == CP_ACTION_LOCKED ? CP_LOCKED_STATE : CP_UNLOCKED_STATE);
+                       memset(callback_arg.volume_uuid, 0, sizeof(uuid_t));
+                       callback_arg.valid_uuid = 0;
+                       return vfs_iterate(0, cp_lock_vfs_callback, (void *)&callback_arg);
                default:
                        return -1;
        }
 }
 
 int
-cp_register_wraps(cp_wrap_func_t key_store_func)
+cp_key_store_action_for_volume(uuid_t volume_uuid, cp_key_store_action_t action)
 {
-  g_cp_wrap_func.new_key = key_store_func->new_key;
-  g_cp_wrap_func.unwrapper = key_store_func->unwrapper;
-  g_cp_wrap_func.rewrapper = key_store_func->rewrapper;
-  /* do not use invalidater until rdar://12170050 goes in ! */
-  g_cp_wrap_func.invalidater = key_store_func->invalidater;
-  g_cp_wrap_func.backup_key = key_store_func->backup_key;
-
-  return 0;
-}
+       cp_lock_vfs_callback_arg callback_arg;
 
-int cp_rewrap_key(cp_cred_t access, uint32_t dp_class,
-                                 const cp_wrapped_key_t wrapped_key_in,
-                                 cp_wrapped_key_t wrapped_key_out)
-{
-       if (!g_cp_wrap_func.rewrapper)
-               return ENXIO;
-       return g_cp_wrap_func.rewrapper(access, dp_class, wrapped_key_in,
-                                                                       wrapped_key_out);
-}
-
-int cp_new_key(cp_cred_t access, uint32_t dp_class, cp_raw_key_t key_out,
-               cp_wrapped_key_t wrapped_key_out)
-{
-       if (!g_cp_wrap_func.new_key)
-               return ENXIO;
-       return g_cp_wrap_func.new_key(access, dp_class, key_out, wrapped_key_out);
-}
-
-int cp_unwrap_key(cp_cred_t access, const cp_wrapped_key_t wrapped_key_in,
-                  cp_raw_key_t key_out)
-{
-       if (!g_cp_wrap_func.unwrapper)
-               return ENXIO;
-       return g_cp_wrap_func.unwrapper(access, wrapped_key_in, key_out);
-}
-
-int cp_get_backup_key(cp_cred_t access, const cp_wrapped_key_t wrapped_key_in,
-                      cp_wrapped_key_t wrapped_key_out)
-{
-       if (!g_cp_wrap_func.backup_key)
-               return ENXIO;
-       return g_cp_wrap_func.backup_key(access, wrapped_key_in, wrapped_key_out);
+       switch (action) {
+               case CP_ACTION_LOCKED:
+               case CP_ACTION_UNLOCKED:
+                       callback_arg.state = (action == CP_ACTION_LOCKED ? CP_LOCKED_STATE : CP_UNLOCKED_STATE);
+                       memcpy(callback_arg.volume_uuid, volume_uuid, sizeof(uuid_t));
+                       callback_arg.valid_uuid = 1;
+                       return vfs_iterate(0, cp_lock_vfs_callback, (void *)&callback_arg);
+               default:
+                       return -1;
+       }
 }
 
 int
index c348df21b8ba1d6a6e15bae185af5947c9ed4650..143f3cc11004f84fb6c499d1eca8b3a7cc2fb914 100644 (file)
@@ -121,7 +121,7 @@ typedef struct fs_event_watcher {
 #define WATCHER_CLOSING                0x0002
 #define WATCHER_WANTS_COMPACT_EVENTS   0x0004
 #define WATCHER_WANTS_EXTENDED_INFO    0x0008
-#define WATCHER_APPLE_SYSTEM_SERVICE   0x0010   // fseventsd, coreservicesd, mds
+#define WATCHER_APPLE_SYSTEM_SERVICE   0x0010   // fseventsd, coreservicesd, mds, revisiond
 
 #define MAX_WATCHERS  8
 static fs_event_watcher *watcher_table[MAX_WATCHERS];
@@ -140,6 +140,11 @@ static int        fs_event_init = 0;
 //
 static int16_t     fs_event_type_watchers[FSE_MAX_EVENTS];
 
+// the device currently being unmounted:
+static dev_t fsevent_unmount_dev = 0;
+// how many ACKs are still outstanding:
+static int fsevent_unmount_ack_count = 0;
+
 static int  watcher_add_event(fs_event_watcher *watcher, kfs_event *kfse);
 static void fsevents_wakeup(fs_event_watcher *watcher);
 
@@ -619,6 +624,19 @@ add_fsevent(int type, vfs_context_t ctx, ...)
            goto done_with_args;
     }
 
+    if (type == FSE_UNMOUNT_PENDING) {
+
+           // Just a dev_t
+           arg_type = va_arg(ap, int32_t);
+           if (arg_type == FSE_ARG_DEV) {
+                   cur->dev = (dev_t)(va_arg(ap, dev_t));
+           } else {
+                   cur->dev = (dev_t)0xbadc0de1;
+           }
+
+           goto done_with_args;
+    }
+
     for(arg_type=va_arg(ap, int32_t); arg_type != FSE_ARG_DONE; arg_type=va_arg(ap, int32_t))
 
        switch(arg_type) {
@@ -857,8 +875,8 @@ release_event_ref(kfs_event *kfse)
     // holding the fs_event_buf lock
     //
     copy = *kfse;
-    if (kfse->dest && OSAddAtomic(-1, &kfse->dest->refcount) == 1) {
-       dest_copy = *kfse->dest;
+    if (kfse->type != FSE_DOCID_CREATED && kfse->type != FSE_DOCID_CHANGED && kfse->dest && OSAddAtomic(-1, &kfse->dest->refcount) == 1) {
+           dest_copy = *kfse->dest;
     } else {
        dest_copy.str  = NULL;
        dest_copy.len  = 0;
@@ -906,7 +924,7 @@ release_event_ref(kfs_event *kfse)
     unlock_fs_event_list();
     
     // if we have a pointer in the union
-    if (copy.str && copy.type != FSE_DOCID_CHANGED) {
+    if (copy.str && copy.type != FSE_DOCID_CREATED && copy.type != FSE_DOCID_CHANGED) {
        if (copy.len == 0) {    // and it's not a string
            panic("%s:%d: no more fref.vp!\n", __FILE__, __LINE__);
            // vnode_rele_ext(copy.fref.vp, O_EVTONLY, 0);
@@ -965,6 +983,7 @@ add_watcher(int8_t *event_list, int32_t num_events, int32_t eventq_size, fs_even
 
     if (!strncmp(watcher->proc_name, "fseventsd", sizeof(watcher->proc_name)) ||
        !strncmp(watcher->proc_name, "coreservicesd", sizeof(watcher->proc_name)) ||
+       !strncmp(watcher->proc_name, "revisiond", sizeof(watcher->proc_name)) ||
        !strncmp(watcher->proc_name, "mds", sizeof(watcher->proc_name))) {
        watcher->flags |= WATCHER_APPLE_SYSTEM_SERVICE;
     } else {
@@ -1323,7 +1342,7 @@ copy_out_kfse(fs_event_watcher *watcher, kfs_event *kfse, struct uio *uio)
 
     if (kfse->type == FSE_DOCID_CHANGED || kfse->type == FSE_DOCID_CREATED) {
        dev_t    dev  = cur->dev;
-       ino_t    ino  = cur->ino;
+       ino64_t    ino  = cur->ino;
        uint64_t ival;
 
        error = fill_buff(FSE_ARG_DEV, sizeof(dev_t), &dev, evbuff, &evbuff_idx, sizeof(evbuff), uio);
@@ -1331,13 +1350,13 @@ copy_out_kfse(fs_event_watcher *watcher, kfs_event *kfse, struct uio *uio)
            goto get_out;
        }
 
-       error = fill_buff(FSE_ARG_INO, sizeof(ino_t), &ino, evbuff, &evbuff_idx, sizeof(evbuff), uio);
+       error = fill_buff(FSE_ARG_INO, sizeof(ino64_t), &ino, evbuff, &evbuff_idx, sizeof(evbuff), uio);
        if (error != 0) {
            goto get_out;
        }
 
-       memcpy(&ino, &cur->str, sizeof(ino_t));
-       error = fill_buff(FSE_ARG_INO, sizeof(ino_t), &ino, evbuff, &evbuff_idx, sizeof(evbuff), uio);
+       memcpy(&ino, &cur->str, sizeof(ino64_t));
+       error = fill_buff(FSE_ARG_INO, sizeof(ino64_t), &ino, evbuff, &evbuff_idx, sizeof(evbuff), uio);
        if (error != 0) {
            goto get_out;
        }
@@ -1351,6 +1370,17 @@ copy_out_kfse(fs_event_watcher *watcher, kfs_event *kfse, struct uio *uio)
        goto done;
     }
 
+    if (kfse->type == FSE_UNMOUNT_PENDING) {
+       dev_t    dev  = cur->dev;
+
+       error = fill_buff(FSE_ARG_DEV, sizeof(dev_t), &dev, evbuff, &evbuff_idx, sizeof(evbuff), uio);
+       if (error != 0) {
+           goto get_out;
+       }
+
+       goto done;
+    }
+
     if (cur->str == NULL || cur->str[0] == '\0') {
        printf("copy_out_kfse:2: empty/short path (%s)\n", cur->str);
        error = fill_buff(FSE_ARG_STRING, 2, "/", evbuff, &evbuff_idx, sizeof(evbuff), uio);
@@ -1379,15 +1409,12 @@ copy_out_kfse(fs_event_watcher *watcher, kfs_event *kfse, struct uio *uio)
            goto get_out;
        }
     } else {
-       ino_t ino;
-       
        error = fill_buff(FSE_ARG_DEV, sizeof(dev_t), &cur->dev, evbuff, &evbuff_idx, sizeof(evbuff), uio);
        if (error != 0) {
            goto get_out;
        }
 
-       ino = (ino_t)cur->ino;
-       error = fill_buff(FSE_ARG_INO, sizeof(ino_t), &ino, evbuff, &evbuff_idx, sizeof(evbuff), uio);
+       error = fill_buff(FSE_ARG_INO, sizeof(ino64_t), &cur->ino, evbuff, &evbuff_idx, sizeof(evbuff), uio);
        if (error != 0) {
            goto get_out;
        }
@@ -1541,7 +1568,7 @@ fmod_watch(fs_event_watcher *watcher, struct uio *uio)
 
        if (watcher->event_list[kfse->type] == FSE_REPORT && watcher_cares_about_dev(watcher, kfse->dev)) {
 
-         if (!(watcher->flags & WATCHER_APPLE_SYSTEM_SERVICE) && kfse->type != FSE_DOCID_CHANGED && is_ignored_directory(kfse->str)) {
+         if (!(watcher->flags & WATCHER_APPLE_SYSTEM_SERVICE) && kfse->type != FSE_DOCID_CREATED && kfse->type != FSE_DOCID_CHANGED && is_ignored_directory(kfse->str)) {
            // If this is not an Apple System Service, skip specified directories
            // radar://12034844
            error = 0;
@@ -1591,18 +1618,13 @@ fmod_watch(fs_event_watcher *watcher, struct uio *uio)
 }
 
 
-// release any references we might have on vnodes which are 
-// the mount point passed to us (so that it can be cleanly
-// unmounted).
 //
-// since we don't want to lose the events we'll convert the
-// vnode refs to full paths.
+// Shoo watchers away from a volume that's about to be unmounted
+// (so that it can be cleanly unmounted).
 //
 void
-fsevent_unmount(__unused struct mount *mp)
+fsevent_unmount(__unused struct mount *mp, __unused vfs_context_t ctx)
 {
-    // we no longer maintain pointers to vnodes so
-    // there is nothing to do... 
 }
 
 
@@ -1722,13 +1744,13 @@ fseventsf_ioctl(struct fileproc *fp, u_long cmd, caddr_t data, vfs_context_t ctx
            
            new_num_devices = devfilt_args->num_devices;
            if (new_num_devices == 0) {
-               tmp = fseh->watcher->devices_not_to_watch;
-
                lock_watch_table();
+
+               tmp = fseh->watcher->devices_not_to_watch;
                fseh->watcher->devices_not_to_watch = NULL;
                fseh->watcher->num_devices = new_num_devices;
-               unlock_watch_table();
 
+               unlock_watch_table();
                if (tmp) {
                    FREE(tmp, M_TEMP);
                }
@@ -1764,6 +1786,22 @@ fseventsf_ioctl(struct fileproc *fp, u_long cmd, caddr_t data, vfs_context_t ctx
            break;
        }           
 
+       case FSEVENTS_UNMOUNT_PENDING_ACK: {
+           lock_watch_table();
+           dev_t dev = *(dev_t *)data;
+           if (fsevent_unmount_dev == dev) {
+               if (--fsevent_unmount_ack_count <= 0) {
+                       fsevent_unmount_dev = 0;
+                       wakeup((caddr_t)&fsevent_unmount_dev);
+               }
+           } else {
+               printf("unexpected unmount pending ack %d (%d)\n", dev, fsevent_unmount_dev);
+               ret = EINVAL;
+           }
+           unlock_watch_table();
+           break;
+       }
+
        default:
            ret = EINVAL;
            break;
index 7a5c95a61ebf8bffe9c86622bd1e4ba00a7fbc51..bd44f363149e1fc0d406a7b161b67897504a58f3 100644 (file)
@@ -173,6 +173,13 @@ vfs_opv_init(void)
                for (j=0; vfs_opv_descs[i]->opv_desc_ops[j].opve_op; j++) {
                        opve_descp = &(vfs_opv_descs[i]->opv_desc_ops[j]);
 
+                       /* Silently skip known-disabled operations */
+                       if (opve_descp->opve_op->vdesc_flags & VDESC_DISABLED) {
+                               printf("vfs_fsadd: Ignoring reference in %p to disabled operation %s.\n",
+                                       vfs_opv_descs[i], opve_descp->opve_op->vdesc_name);
+                               continue;
+                       }
+
                        /*
                         * Sanity check:  is this operation listed
                         * in the list of operations?  We check this
@@ -191,8 +198,8 @@ vfs_opv_init(void)
                         * list of supported operations.
                         */
                        if (opve_descp->opve_op->vdesc_offset == 0 &&
-                                   opve_descp->opve_op->vdesc_offset !=
-                                       VOFFSET(vnop_default)) {
+                                   opve_descp->opve_op !=
+                                       VDESC(vnop_default)) {
                                printf("operation %s not listed in %s.\n",
                                    opve_descp->opve_op->vdesc_name,
                                    "vfs_op_descs");
@@ -244,6 +251,10 @@ vfs_op_init(void)
         * and assign each its offset.
         */
        for (vfs_opv_numops = 0, i = 0; vfs_op_descs[i]; i++) {
+               /* Silently skip known-disabled operations */
+               if (vfs_op_descs[i]->vdesc_flags & VDESC_DISABLED) {
+                       continue;
+               }
                vfs_op_descs[i]->vdesc_offset = vfs_opv_numops;
                vfs_opv_numops++;
        }
@@ -529,6 +540,7 @@ void
 mount_lock_init(mount_t mp)
 {
        lck_mtx_init(&mp->mnt_mlock, mnt_lck_grp, mnt_lck_attr);
+       lck_mtx_init(&mp->mnt_iter_lock, mnt_lck_grp, mnt_lck_attr);
        lck_mtx_init(&mp->mnt_renamelock, mnt_lck_grp, mnt_lck_attr);
        lck_rw_init(&mp->mnt_rwlock, mnt_lck_grp, mnt_lck_attr);
 }
@@ -537,6 +549,7 @@ void
 mount_lock_destroy(mount_t mp)
 {
        lck_mtx_destroy(&mp->mnt_mlock, mnt_lck_grp);
+       lck_mtx_destroy(&mp->mnt_iter_lock, mnt_lck_grp);
        lck_mtx_destroy(&mp->mnt_renamelock, mnt_lck_grp);
        lck_rw_destroy(&mp->mnt_rwlock, mnt_lck_grp);
 }
index 2317401e69ef1e37560e72e25477fbf9c3d62998..6b16ca6cb33c3280303293fb5b0df997a4d4c8d1 100644 (file)
@@ -507,13 +507,7 @@ vnode_hascleanblks(vnode_t vp)
 void
 vnode_iterate_setup(mount_t mp)
 {
-       while (mp->mnt_lflag & MNT_LITER) {
-               mp->mnt_lflag |= MNT_LITERWAIT;
-               msleep((caddr_t)mp, &mp->mnt_mlock, PVFS, "vnode_iterate_setup", NULL); 
-       }
-
        mp->mnt_lflag |= MNT_LITER;
-
 }
 
 int
@@ -622,10 +616,6 @@ void
 vnode_iterate_clear(mount_t mp)
 {
        mp->mnt_lflag &= ~MNT_LITER;
-       if (mp->mnt_lflag & MNT_LITERWAIT) {
-               mp->mnt_lflag &= ~MNT_LITERWAIT;
-               wakeup(mp);
-       }
 }
 
 
@@ -670,16 +660,28 @@ vnode_iterate(mount_t mp, int flags, int (*callout)(struct vnode *, void *),
        int vid, retval;
        int ret = 0;
 
+       /*
+        * The mount iterate mutex is held for the duration of the iteration.
+        * This can be done by a state flag on the mount structure but we can
+        * run into priority inversion issues sometimes.
+        * Using a mutex allows us to benefit from the priority donation
+        * mechanisms in the kernel for locks. This mutex should never be
+        * acquired in spin mode and it should be acquired before attempting to
+        * acquire the mount lock.
+        */
+       mount_iterate_lock(mp);
+
        mount_lock(mp);
 
        vnode_iterate_setup(mp);
 
-       /* it is returns 0 then there is nothing to do */
+       /* If it returns 0 then there is nothing to do */
        retval = vnode_iterate_prepare(mp);
 
        if (retval == 0)  {
                vnode_iterate_clear(mp);
                mount_unlock(mp);
+               mount_iterate_unlock(mp);
                return(ret);
        }
 
@@ -745,6 +747,7 @@ out:
        (void)vnode_iterate_reloadq(mp);
        vnode_iterate_clear(mp);
        mount_unlock(mp);
+       mount_iterate_unlock(mp);
        return (ret);
 }
 
@@ -760,6 +763,18 @@ mount_unlock_renames(mount_t mp)
        lck_mtx_unlock(&mp->mnt_renamelock);
 }
 
+void
+mount_iterate_lock(mount_t mp)
+{
+       lck_mtx_lock(&mp->mnt_iter_lock);
+}
+
+void
+mount_iterate_unlock(mount_t mp)
+{
+       lck_mtx_unlock(&mp->mnt_iter_lock);
+}
+
 void
 mount_lock(mount_t mp)
 {
@@ -1999,6 +2014,11 @@ vflush(struct mount *mp, struct vnode *skipvp, int flags)
        int retval;
        unsigned int vid;
 
+       /*
+        * See comments in vnode_iterate() for the rationale for this lock
+        */
+       mount_iterate_lock(mp);
+
        mount_lock(mp);
        vnode_iterate_setup(mp);
        /*
@@ -2012,16 +2032,18 @@ vflush(struct mount *mp, struct vnode *skipvp, int flags)
                if (vnode_umount_preflight(mp, skipvp, flags)) {
                        vnode_iterate_clear(mp);
                        mount_unlock(mp);
+                       mount_iterate_unlock(mp);
                        return(EBUSY);
                }
        }
 loop:
-       /* it is returns 0 then there is nothing to do */
+       /* If it returns 0 then there is nothing to do */
        retval = vnode_iterate_prepare(mp);
 
        if (retval == 0)  {
                vnode_iterate_clear(mp);
                mount_unlock(mp);
+               mount_iterate_unlock(mp);
                return(retval);
        }
 
@@ -2162,6 +2184,7 @@ loop:
        }
        vnode_iterate_clear(mp);
        mount_unlock(mp);
+       mount_iterate_unlock(mp);
 
        if (busy && ((flags & FORCECLOSE)==0))
                return (EBUSY);
@@ -5806,8 +5829,8 @@ out:
 static kauth_scope_t   vnode_scope;
 static int     vnode_authorize_callback(kauth_cred_t credential, void *idata, kauth_action_t action,
     uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3);
-static int     vnode_authorize_callback_int(__unused kauth_cred_t credential, __unused void *idata, kauth_action_t action,
-    uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3);
+static int vnode_authorize_callback_int(kauth_action_t action, vfs_context_t ctx,
+    vnode_t vp, vnode_t dvp, int *errorp);
 
 typedef struct _vnode_authorize_context {
        vnode_t         vp;
@@ -5821,6 +5844,7 @@ typedef struct _vnode_authorize_context {
 #define _VAC_IN_GROUP          (1<<1)
 #define _VAC_IS_DIR_OWNER      (1<<2)
 #define _VAC_IN_DIR_GROUP      (1<<3)
+#define _VAC_NO_VNODE_POINTERS (1<<4)
 } *vauth_ctx;
 
 void
@@ -6337,6 +6361,111 @@ vn_authorize_rmdir(vnode_t dvp, vnode_t vp, struct componentname *cnp, vfs_conte
        return vnode_authorize(vp, dvp, KAUTH_VNODE_DELETE, ctx);
 }
 
+/*
+ * Authorizer for directory cloning. This does not use vnodes but instead
+ * uses prefilled vnode attributes from the filesystem.
+ *
+ * The same function is called to set up the attributes required, perform the
+ * authorization and cleanup (if required)
+ */
+int
+vnode_attr_authorize_dir_clone(struct vnode_attr *vap, kauth_action_t action,
+    struct vnode_attr *dvap, __unused vnode_t sdvp, mount_t mp,
+    dir_clone_authorizer_op_t vattr_op, vfs_context_t ctx,
+    __unused void *reserved)
+{
+       int error;
+       int is_suser = vfs_context_issuser(ctx);
+
+       if (vattr_op == OP_VATTR_SETUP) {
+               VATTR_INIT(vap);
+
+               /*
+                * When ACL inheritence is implemented, both vap->va_acl and
+                * dvap->va_acl will be required (even as superuser).
+                */
+               VATTR_WANTED(vap, va_type);
+               VATTR_WANTED(vap, va_mode);
+               VATTR_WANTED(vap, va_flags);
+               VATTR_WANTED(vap, va_uid);
+               VATTR_WANTED(vap, va_gid);
+               if (dvap) {
+                       VATTR_INIT(dvap);
+                       VATTR_WANTED(dvap, va_flags);
+               }
+
+               if (!is_suser) {
+                       /*
+                        * If not superuser, we have to evaluate ACLs and
+                        * need the target directory gid to set the initial
+                        * gid of the new object.
+                        */
+                       VATTR_WANTED(vap, va_acl);
+                       if (dvap)
+                               VATTR_WANTED(dvap, va_gid);
+               }
+
+               return (0);
+       } else if (vattr_op == OP_VATTR_CLEANUP) {
+               return (0); /* Nothing to do for now */
+       }
+
+       /* dvap isn't used for authorization */
+       error = vnode_attr_authorize(vap, NULL, mp, action, ctx);
+
+       if (error)
+               return (error);
+
+       /*
+        * vn_attribute_prepare should be able to accept attributes as well as
+        * vnodes but for now we do this inline.
+        */
+       if (!is_suser) {
+               /*
+                * If the filesystem is mounted IGNORE_OWNERSHIP and an explicit
+                * owner is set, that owner takes ownership of all new files.
+                */
+               if ((mp->mnt_flag & MNT_IGNORE_OWNERSHIP) &&
+                   (mp->mnt_fsowner != KAUTH_UID_NONE)) {
+                       VATTR_SET(vap, va_uid, mp->mnt_fsowner);
+               } else {
+                       /* default owner is current user */
+                       VATTR_SET(vap, va_uid,
+                           kauth_cred_getuid(vfs_context_ucred(ctx)));
+               }
+
+               if ((mp->mnt_flag & MNT_IGNORE_OWNERSHIP) &&
+                   (mp->mnt_fsgroup != KAUTH_GID_NONE)) {
+                       VATTR_SET(vap, va_gid, mp->mnt_fsgroup);
+               } else {
+                       /*
+                        * default group comes from parent object,
+                        * fallback to current user
+                        */
+                       if (VATTR_IS_SUPPORTED(dvap, va_gid)) {
+                               VATTR_SET(vap, va_gid, dvap->va_gid);
+                       } else {
+                               VATTR_SET(vap, va_gid,
+                                   kauth_cred_getgid(vfs_context_ucred(ctx)));
+                       }
+               }
+       }
+
+       /* Inherit SF_RESTRICTED bit from destination directory only */
+       if (VATTR_IS_ACTIVE(vap, va_flags)) {
+               VATTR_SET(vap, va_flags,
+                   ((vap->va_flags & ~SF_RESTRICTED))); /* Turn off from source */
+                if (VATTR_IS_ACTIVE(dvap, va_flags))
+                       VATTR_SET(vap, va_flags,
+                           vap->va_flags | (dvap->va_flags & SF_RESTRICTED));
+       } else if (VATTR_IS_ACTIVE(dvap, va_flags)) {
+               VATTR_SET(vap, va_flags, (dvap->va_flags & SF_RESTRICTED));
+       }
+
+       return (0);
+}
+
+
 /*
  * Authorize an operation on a vnode.
  *
@@ -7164,9 +7293,8 @@ vnode_authorize_simple(vauth_ctx vcp, kauth_ace_rights_t acl_rights, kauth_ace_r
  * Check for file immutability.
  */
 static int
-vnode_authorize_checkimmutable(vnode_t vp, struct vnode_attr *vap, int rights, int ignore)
+vnode_authorize_checkimmutable(mount_t mp, struct vnode_attr *vap, int rights, int ignore)
 {
-       mount_t mp;
        int error;
        int append;
 
@@ -7175,7 +7303,7 @@ vnode_authorize_checkimmutable(vnode_t vp, struct vnode_attr *vap, int rights, i
         *
         * Sockets, fifos and devices require special handling.
         */
-       switch(vp->v_type) {
+       switch(vap->va_type) {
        case VSOCK:
        case VFIFO:
        case VBLK:
@@ -7194,7 +7322,6 @@ vnode_authorize_checkimmutable(vnode_t vp, struct vnode_attr *vap, int rights, i
        if (rights & KAUTH_VNODE_WRITE_RIGHTS) {
                
                /* check per-filesystem options if possible */
-               mp = vp->v_mount;
                if (mp != NULL) {
        
                        /* check for no-EA filesystems */
@@ -7211,7 +7338,7 @@ vnode_authorize_checkimmutable(vnode_t vp, struct vnode_attr *vap, int rights, i
                 * allowable for a UF_APPEND file.
                 */
                append = 0;
-               if (vp->v_type == VDIR) {
+               if (vap->va_type == VDIR) {
                        if ((rights & (KAUTH_VNODE_ADD_FILE | KAUTH_VNODE_ADD_SUBDIRECTORY | KAUTH_VNODE_WRITE_EXTATTRIBUTES)) == rights)
                                append = 1;
                } else {
@@ -7322,8 +7449,9 @@ vnode_authorize_opaque(vnode_t vp, int *resultp, kauth_action_t action, vfs_cont
 
 
 static int
-vnode_authorize_callback(kauth_cred_t cred, void *idata, kauth_action_t action,
-                        uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3)
+vnode_authorize_callback(__unused kauth_cred_t cred, __unused void *idata,
+    kauth_action_t action, uintptr_t arg0, uintptr_t arg1, uintptr_t arg2,
+    uintptr_t arg3)
 {
        vfs_context_t   ctx;
        vnode_t         cvp = NULLVP;
@@ -7399,7 +7527,7 @@ vnode_authorize_callback(kauth_cred_t cred, void *idata, kauth_action_t action,
                goto out;
        }
 defer:
-        result = vnode_authorize_callback_int(cred, idata, action, arg0, arg1, arg2, arg3);
+        result = vnode_authorize_callback_int(action, ctx, vp, dvp, (int *)arg3);
 
        if (result == KAUTH_RESULT_ALLOW && cvp != NULLVP) {
                KAUTH_DEBUG("%p - caching action = %x", cvp, action);
@@ -7414,20 +7542,87 @@ out:
        return result;
 }
 
+static int
+vnode_attr_authorize_internal(vauth_ctx vcp, mount_t mp,
+    kauth_ace_rights_t rights, int is_suser, boolean_t *found_deny,
+    int noimmutable, int parent_authorized_for_delete_child)
+{
+       int result;
+
+       /*
+        * Check for immutability.
+        *
+        * In the deletion case, parent directory immutability vetoes specific
+        * file rights.
+        */
+       if ((result = vnode_authorize_checkimmutable(mp, vcp->vap, rights,
+           noimmutable)) != 0)
+               goto out;
+
+       if ((rights & KAUTH_VNODE_DELETE) &&
+           !parent_authorized_for_delete_child) {
+               result = vnode_authorize_checkimmutable(mp, vcp->dvap,
+                   KAUTH_VNODE_DELETE_CHILD, 0);
+               if (result)
+                       goto out;
+       }
+
+       /*
+        * Clear rights that have been authorized by reaching this point, bail if nothing left to
+        * check.
+        */
+       rights &= ~(KAUTH_VNODE_LINKTARGET | KAUTH_VNODE_CHECKIMMUTABLE);
+       if (rights == 0)
+               goto out;
+
+       /*
+        * If we're not the superuser, authorize based on file properties;
+        * note that even if parent_authorized_for_delete_child is TRUE, we
+        * need to check on the node itself.
+        */
+       if (!is_suser) {
+               /* process delete rights */
+               if ((rights & KAUTH_VNODE_DELETE) &&
+                   ((result = vnode_authorize_delete(vcp, parent_authorized_for_delete_child)) != 0))
+                   goto out;
+
+               /* process remaining rights */
+               if ((rights & ~KAUTH_VNODE_DELETE) &&
+                   (result = vnode_authorize_simple(vcp, rights, rights & KAUTH_VNODE_DELETE, found_deny)) != 0)
+                       goto out;
+       } else {
+               /*
+                * Execute is only granted to root if one of the x bits is set.  This check only
+                * makes sense if the posix mode bits are actually supported.
+                */
+               if ((rights & KAUTH_VNODE_EXECUTE) &&
+                   (vcp->vap->va_type == VREG) &&
+                   VATTR_IS_SUPPORTED(vcp->vap, va_mode) &&
+                   !(vcp->vap->va_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
+                       result = EPERM;
+                       KAUTH_DEBUG("%p    DENIED - root execute requires at least one x bit in 0x%x", vp, va.va_mode);
+                       goto out;
+               }
+
+               /* Assume that there were DENYs so we don't wrongly cache KAUTH_VNODE_SEARCHBYANYONE */
+               *found_deny = TRUE;
+
+               KAUTH_DEBUG("%p    ALLOWED - caller is superuser", vp);
+       }
+out:
+       return (result);
+}
 
 static int
-vnode_authorize_callback_int(__unused kauth_cred_t unused_cred, __unused void *idata, kauth_action_t action,
-    uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3)
+vnode_authorize_callback_int(kauth_action_t action, vfs_context_t ctx,
+    vnode_t vp, vnode_t dvp, int *errorp)
 {
        struct _vnode_authorize_context auth_context;
        vauth_ctx               vcp;
-       vfs_context_t           ctx;
-       vnode_t                 vp, dvp;
        kauth_cred_t            cred;
        kauth_ace_rights_t      rights;
        struct vnode_attr       va, dva;
        int                     result;
-       int                     *errorp;
        int                     noimmutable;
        boolean_t               parent_authorized_for_delete_child = FALSE;
        boolean_t               found_deny = FALSE;
@@ -7435,10 +7630,9 @@ vnode_authorize_callback_int(__unused kauth_cred_t unused_cred, __unused void *i
        boolean_t               is_suser = FALSE;
 
        vcp = &auth_context;
-       ctx = vcp->ctx = (vfs_context_t)arg0;
-       vp = vcp->vp = (vnode_t)arg1;
-       dvp = vcp->dvp = (vnode_t)arg2;
-       errorp = (int *)arg3;
+       vcp->ctx = ctx;
+       vcp->vp = vp;
+       vcp->dvp = dvp;
        /*
         * Note that we authorize against the context, not the passed cred
         * (the same thing anyway)
@@ -7498,7 +7692,8 @@ vnode_authorize_callback_int(__unused kauth_cred_t unused_cred, __unused void *i
                if (vnode_cache_is_authorized(dvp, ctx, KAUTH_VNODE_DELETE_CHILD) == TRUE)
                        parent_authorized_for_delete_child = TRUE;
        } else {
-               dvp = NULL;
+               vcp->dvp = NULLVP;
+               vcp->dvap = NULL;
        }
        
        /*
@@ -7583,7 +7778,10 @@ vnode_authorize_callback_int(__unused kauth_cred_t unused_cred, __unused void *i
                KAUTH_DEBUG("%p    ERROR - failed to get vnode attributes - %d", vp, result);
                goto out;
        }
-       if (dvp) {
+       VATTR_WANTED(&va, va_type);
+       VATTR_RETURN(&va, va_type, vnode_vtype(vp));
+
+       if (vcp->dvp) {
                VATTR_WANTED(&dva, va_mode);
                VATTR_WANTED(&dva, va_flags);
                if (!is_suser) {
@@ -7591,68 +7789,16 @@ vnode_authorize_callback_int(__unused kauth_cred_t unused_cred, __unused void *i
                        VATTR_WANTED(&dva, va_gid);
                        VATTR_WANTED(&dva, va_acl);
                }
-               if ((result = vnode_getattr(dvp, &dva, ctx)) != 0) {
+               if ((result = vnode_getattr(vcp->dvp, &dva, ctx)) != 0) {
                        KAUTH_DEBUG("%p    ERROR - failed to get directory vnode attributes - %d", vp, result);
                        goto out;
                }
+               VATTR_WANTED(&dva, va_type);
+               VATTR_RETURN(&dva, va_type, vnode_vtype(vcp->dvp));
        }
 
-       /*
-        * Check for immutability.
-        *
-        * In the deletion case, parent directory immutability vetoes specific
-        * file rights.
-        */
-       if ((result = vnode_authorize_checkimmutable(vp, &va, rights, noimmutable)) != 0)
-               goto out;
-       if ((rights & KAUTH_VNODE_DELETE) &&
-           parent_authorized_for_delete_child == FALSE &&
-           ((result = vnode_authorize_checkimmutable(dvp, &dva, KAUTH_VNODE_DELETE_CHILD, 0)) != 0))
-               goto out;
-
-       /*
-        * Clear rights that have been authorized by reaching this point, bail if nothing left to
-        * check.
-        */
-       rights &= ~(KAUTH_VNODE_LINKTARGET | KAUTH_VNODE_CHECKIMMUTABLE);
-       if (rights == 0)
-               goto out;
-
-       /*
-        * If we're not the superuser, authorize based on file properties;
-        * note that even if parent_authorized_for_delete_child is TRUE, we
-        * need to check on the node itself.
-        */
-       if (!is_suser) {
-               /* process delete rights */
-               if ((rights & KAUTH_VNODE_DELETE) &&
-                   ((result = vnode_authorize_delete(vcp, parent_authorized_for_delete_child)) != 0))
-                   goto out;
-
-               /* process remaining rights */
-               if ((rights & ~KAUTH_VNODE_DELETE) &&
-                   (result = vnode_authorize_simple(vcp, rights, rights & KAUTH_VNODE_DELETE, &found_deny)) != 0)
-                       goto out;
-       } else {
-
-               /*
-                * Execute is only granted to root if one of the x bits is set.  This check only
-                * makes sense if the posix mode bits are actually supported.
-                */
-               if ((rights & KAUTH_VNODE_EXECUTE) &&
-                   (vp->v_type == VREG) &&
-                   VATTR_IS_SUPPORTED(&va, va_mode) &&
-                   !(va.va_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
-                       result = EPERM;
-                       KAUTH_DEBUG("%p    DENIED - root execute requires at least one x bit in 0x%x", vp, va.va_mode);
-                       goto out;
-               }
-               
-               /* Assume that there were DENYs so we don't wrongly cache KAUTH_VNODE_SEARCHBYANYONE */
-               found_deny = TRUE;
-               
-               KAUTH_DEBUG("%p    ALLOWED - caller is superuser", vp);
-       }
+       result = vnode_attr_authorize_internal(vcp, vp->v_mount, rights, is_suser,
+           &found_deny, noimmutable, parent_authorized_for_delete_child);
 out:
        if (VATTR_IS_SUPPORTED(&va, va_acl) && (va.va_acl != NULL))
                kauth_acl_free(va.va_acl);
@@ -7696,6 +7842,109 @@ success:
        return(KAUTH_RESULT_ALLOW);
 }
 
+int
+vnode_attr_authorize_init(struct vnode_attr *vap, struct vnode_attr *dvap,
+    kauth_action_t action, vfs_context_t ctx)
+{
+       VATTR_INIT(vap);
+       VATTR_WANTED(vap, va_type);
+       VATTR_WANTED(vap, va_mode);
+       VATTR_WANTED(vap, va_flags);
+       if (dvap) {
+               VATTR_INIT(dvap);
+               if (action & KAUTH_VNODE_DELETE) {
+                       VATTR_WANTED(dvap, va_type);
+                       VATTR_WANTED(dvap, va_mode);
+                       VATTR_WANTED(dvap, va_flags);
+               }
+       } else if (action & KAUTH_VNODE_DELETE) {
+               return (EINVAL);
+       }
+
+       if (!vfs_context_issuser(ctx)) {
+               VATTR_WANTED(vap, va_uid);
+               VATTR_WANTED(vap, va_gid);
+               VATTR_WANTED(vap, va_acl);
+               if (dvap && (action & KAUTH_VNODE_DELETE)) {
+                       VATTR_WANTED(dvap, va_uid);
+                       VATTR_WANTED(dvap, va_gid);
+                       VATTR_WANTED(dvap, va_acl);
+               }
+       }
+
+       return (0);
+}
+
+int
+vnode_attr_authorize(struct vnode_attr *vap, struct vnode_attr *dvap, mount_t mp,
+    kauth_action_t action, vfs_context_t ctx)
+{
+       struct _vnode_authorize_context auth_context;
+       vauth_ctx vcp;
+       kauth_ace_rights_t rights;
+       int noimmutable;
+       boolean_t found_deny;
+       boolean_t is_suser = FALSE;
+       int result = 0;
+
+       vcp = &auth_context;
+       vcp->ctx = ctx;
+       vcp->vp = NULLVP;
+       vcp->vap = vap;
+       vcp->dvp = NULLVP;
+       vcp->dvap = dvap;
+       vcp->flags = vcp->flags_valid = 0;
+
+       noimmutable = (action & KAUTH_VNODE_NOIMMUTABLE) ? 1 : 0;
+       rights = action & ~(KAUTH_VNODE_ACCESS | KAUTH_VNODE_NOIMMUTABLE);
+
+       /*
+        * Check for read-only filesystems.
+        */
+       if ((rights & KAUTH_VNODE_WRITE_RIGHTS) &&
+           mp && (mp->mnt_flag & MNT_RDONLY) &&
+           ((vap->va_type == VREG) || (vap->va_type == VDIR) ||
+           (vap->va_type == VLNK) || (rights & KAUTH_VNODE_DELETE) ||
+           (rights & KAUTH_VNODE_DELETE_CHILD))) {
+               result = EROFS;
+               goto out;
+       }
+
+       /*
+        * Check for noexec filesystems.
+        */
+       if ((rights & KAUTH_VNODE_EXECUTE) &&
+           (vap->va_type == VREG) && mp && (mp->mnt_flag & MNT_NOEXEC)) {
+               result = EACCES;
+               goto out;
+       }
+
+       if (vfs_context_issuser(ctx)) {
+               /*
+                * if we're not asking for execute permissions or modifications,
+                * then we're done, this action is authorized.
+                */
+               if (!(rights & (KAUTH_VNODE_EXECUTE | KAUTH_VNODE_WRITE_RIGHTS)))
+                       goto out;
+               is_suser = TRUE;
+       } else {
+               if (!VATTR_IS_SUPPORTED(vap, va_uid) ||
+                   !VATTR_IS_SUPPORTED(vap, va_gid) ||
+                   (mp && vfs_extendedsecurity(mp) && !VATTR_IS_SUPPORTED(vap, va_acl))) {
+                       panic("vnode attrs not complete for vnode_attr_authorize\n");
+               }
+       }
+
+       result = vnode_attr_authorize_internal(vcp, mp, rights, is_suser,
+           &found_deny, noimmutable, FALSE);
+
+       if (result == EPERM)
+               result = EACCES;
+out:
+       return (result);
+}
+
+
 int 
 vnode_authattr_new(vnode_t dvp, struct vnode_attr *vap, int noauth, vfs_context_t ctx)
 {
index 04b382fb9b163931cadd252a3d2fdc849c6d12f9..70f798e860bb3effc1b16050ffef63e3159e89de 100644 (file)
@@ -709,6 +709,18 @@ update:
                          MNT_UNKNOWNPERMISSIONS | MNT_DONTBROWSE |
                          MNT_AUTOMOUNTED | MNT_DEFWRITE | MNT_NOATIME |
                          MNT_QUARANTINE | MNT_CPROTECT);
+
+#if SECURE_KERNEL
+#if !CONFIG_MNT_SUID
+       /*
+        * On release builds of iOS based platforms, always enforce NOSUID and NODEV on
+        * all mounts. We do this here because we can catch update mounts as well as
+        * non-update mounts in this case.
+        */
+       mp->mnt_flag |= (MNT_NOSUID);
+#endif
+#endif
+
        mp->mnt_flag |= flags & (MNT_NOSUID | MNT_NOEXEC | MNT_NODEV |
                                 MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC |
                                 MNT_UNKNOWNPERMISSIONS | MNT_DONTBROWSE |
@@ -1866,6 +1878,12 @@ dounmount(struct mount *mp, int flags, int withref, vfs_context_t ctx)
        int pflags_save = 0;
 #endif /* CONFIG_TRIGGERS */
 
+#if CONFIG_FSE
+       if (!(flags & MNT_FORCE)) {
+               fsevent_unmount(mp, ctx);  /* has to come first! */
+       }
+#endif
+
        mount_lock(mp);
 
        /*
@@ -1926,9 +1944,6 @@ dounmount(struct mount *mp, int flags, int withref, vfs_context_t ctx)
        lck_rw_lock_exclusive(&mp->mnt_rwlock);
        if (withref != 0)
                mount_drop(mp, 0);
-#if CONFIG_FSE
-       fsevent_unmount(mp);  /* has to come first! */
-#endif
        error = 0;
        if (forcedunmount == 0) {
                ubc_umount(mp); /* release cached vnodes */
@@ -4593,7 +4608,7 @@ retry:
        nd.ni_flag |= NAMEI_COMPOUNDREMOVE;
        cnp = &nd.ni_cnd;
 
-lookup_continue:
+continue_lookup:
        error = nameiat(&nd, fd);
        if (error)
                return (error);
@@ -4693,7 +4708,7 @@ lookup_continue:
                                error = EISDIR;
                                goto out;
                        }
-                       goto lookup_continue;
+                       goto continue_lookup;
                } else if (error == ENOENT && batched) {
                        assert(retry_count < MAX_AUTHORIZE_ENOENT_RETRIES);
                        if (retry_count < MAX_AUTHORIZE_ENOENT_RETRIES) {
@@ -4875,6 +4890,12 @@ lseek(proc_t p, struct lseek_args *uap, off_t *retval)
                break;
        case L_SET:
                break;
+       case SEEK_HOLE:
+        error = VNOP_IOCTL(vp, FSCTL_FIOSEEKHOLE, (caddr_t)&offset, 0, ctx);
+               break;
+       case SEEK_DATA:
+        error = VNOP_IOCTL(vp, FSCTL_FIOSEEKDATA, (caddr_t)&offset, 0, ctx);
+               break;
        default:
                error = EINVAL;
        }
@@ -5753,6 +5774,8 @@ readlinkat(proc_t p, struct readlinkat_args *uap, int32_t *retval)
 
 /*
  * Change file flags.
+ *
+ * NOTE: this will vnode_put() `vp'
  */
 static int
 chflags1(vnode_t vp, int flags, vfs_context_t ctx)
@@ -5816,6 +5839,7 @@ chflags(__unused proc_t p, struct chflags_args *uap, __unused int32_t *retval)
        vp = nd.ni_vp;
        nameidone(&nd);
 
+       /* we don't vnode_put() here because chflags1 does internally */
        error = chflags1(vp, uap->flags, ctx);
 
        return(error);
@@ -5843,6 +5867,7 @@ fchflags(__unused proc_t p, struct fchflags_args *uap, __unused int32_t *retval)
 
        AUDIT_ARG(vnpath, vp, ARG_VNODE1);
 
+       /* we don't vnode_put() here because chflags1 does internally */
        error = chflags1(vp, uap->flags, vfs_context_current());
 
        file_drop(uap->fd);
@@ -6804,13 +6829,14 @@ clonefile_internal(vnode_t fvp, boolean_t data_read_authorised, int dst_dirfd,
        struct nameidata tond;
        int error;
        int follow;
-       boolean_t free_acl;
+       boolean_t free_src_acl;
        boolean_t attr_cleanup;
        enum vtype v_type;
        kauth_action_t action;
        struct componentname *cnp;
        uint32_t defaulted;
        struct vnode_attr va;
+       struct vnode_attr nva;
 
        v_type = vnode_vtype(fvp);
        switch (v_type) {
@@ -6842,7 +6868,7 @@ clonefile_internal(vnode_t fvp, boolean_t data_read_authorised, int dst_dirfd,
        tdvp = tond.ni_dvp;
        tvp = tond.ni_vp;
 
-       free_acl = FALSE;
+       free_src_acl = FALSE;
        attr_cleanup = FALSE;
 
        if (tvp != NULL) {
@@ -6873,7 +6899,8 @@ clonefile_internal(vnode_t fvp, boolean_t data_read_authorised, int dst_dirfd,
         * those here.
         */
        VATTR_INIT(&va);
-       VATTR_WANTED(&va, va_type);
+       VATTR_WANTED(&va, va_uid);
+       VATTR_WANTED(&va, va_gid);
        VATTR_WANTED(&va, va_mode);
        VATTR_WANTED(&va, va_flags);
        VATTR_WANTED(&va, va_acl);
@@ -6881,44 +6908,46 @@ clonefile_internal(vnode_t fvp, boolean_t data_read_authorised, int dst_dirfd,
        if ((error = vnode_getattr(fvp, &va, ctx)) != 0)
                goto out;
 
-       if (!VATTR_IS_SUPPORTED(&va, va_acl))
-               VATTR_CLEAR_ACTIVE(&va, va_acl);
-       else if (va.va_acl != NULL)
-               free_acl = TRUE;
-
-       if (!VATTR_IS_SUPPORTED(&va, va_mode)) {
-               VATTR_CLEAR_ACTIVE(&va, va_mode);
-       } else {
-               proc_t p = vfs_context_proc(ctx);
-
-               VATTR_SET(&va, va_mode,
-                   (va.va_mode & ACCESSPERMS) & ~p->p_fd->fd_cmask);
-       }
-
-       if (!VATTR_IS_SUPPORTED(&va, va_flags)) {
-               VATTR_CLEAR_ACTIVE(&va, va_flags);
-       } else if (va.va_flags & SF_RESTRICTED) {
-               /*
-                * Turn off SF_RESTRICTED from source, if the destination needs
-                * it, it will be handled in vnode_authattr_new.
-                */
-               VATTR_SET(&va, va_flags, (va.va_flags & ~SF_RESTRICTED));
+       VATTR_INIT(&nva);
+       VATTR_SET(&nva, va_type, v_type);
+       if (VATTR_IS_SUPPORTED(&va, va_acl) && va.va_acl != NULL) {
+               VATTR_SET(&nva, va_acl, va.va_acl);
+               free_src_acl = TRUE;
        }
 
        /* Handle ACL inheritance, initialize vap. */
        if (v_type == VLNK) {
-               error = vnode_authattr_new(tdvp, &va, 0, ctx);
+               error = vnode_authattr_new(tdvp, &nva, 0, ctx);
        } else {
-               error = vn_attribute_prepare(tdvp, &va, &defaulted, ctx);
+               error = vn_attribute_prepare(tdvp, &nva, &defaulted, ctx);
+               if (error)
+                       goto out;
                attr_cleanup = TRUE;
        }
 
-       if (error) {
-               attr_cleanup = FALSE;
-               goto out;
+       /*
+        * We've got initial values for all security parameters,
+        * If we are superuser, then we can change owners to be the
+        * same as the source. Both superuser and the owner have default
+        * WRITE_SECURITY privileges so all other fields can be taken
+        * from source as well.
+        */
+       if (vfs_context_issuser(ctx)) {
+               if (VATTR_IS_SUPPORTED(&va, va_uid))
+                       VATTR_SET(&nva, va_uid, va.va_uid);
+               if (VATTR_IS_SUPPORTED(&va, va_gid))
+                       VATTR_SET(&nva, va_gid, va.va_gid);
+       }
+       if (VATTR_IS_SUPPORTED(&va, va_mode))
+               VATTR_SET(&nva, va_mode, va.va_mode);
+       if (VATTR_IS_SUPPORTED(&va, va_flags)) {
+               VATTR_SET(&nva, va_flags,
+                   ((va.va_flags & ~SF_RESTRICTED) | /* Turn off from source */
+                   (nva.va_flags & SF_RESTRICTED)));
        }
 
-       error = VNOP_CLONEFILE(fvp, tdvp, &tvp, cnp, &va, flags, ctx);
+       error = VNOP_CLONEFILE(fvp, tdvp, &tvp, cnp, &nva,
+           VNODE_CLONEFILE_DEFAULT, ctx);
 
        if (!error && tvp) {
                int     update_flags = 0;
@@ -6935,7 +6964,7 @@ clonefile_internal(vnode_t fvp, boolean_t data_read_authorised, int dst_dirfd,
                 * VNOP, use our fallback code.
                 */
                if (!VATTR_ALL_SUPPORTED(&va))
-                       (void)vnode_setattr_fallback(tvp, &va, ctx);
+                       (void)vnode_setattr_fallback(tvp, &nva, ctx);
 
                // Make sure the name & parent pointers are hooked up
                if (tvp->v_name == NULL)
@@ -6968,31 +6997,11 @@ clonefile_internal(vnode_t fvp, boolean_t data_read_authorised, int dst_dirfd,
                }
 #endif /* CONFIG_FSE */
        }
-#if CLONE_SNAPSHOT_FALLBACKS_ENABLED
-          else if (error == ENOTSUP) {
-               struct vfs_attr vfa;
-
-               /*
-                * Fallback to VNOP_COPYFILE but check first that the
-                * filesystem supports cloning.
-                */
-               VFSATTR_INIT(&vfa);
-               VFSATTR_WANTED(&vfa, f_capabilities);
-               if ((vfs_getattr(vnode_mount(tdvp), &vfa, ctx) == 0) &&
-                   VFSATTR_IS_SUPPORTED(&vfa, f_capabilities) &&
-                   (vfa.f_capabilities.capabilities[VOL_CAPABILITIES_INTERFACES] & VOL_CAP_INT_CLONE) &&
-                   (vfa.f_capabilities.valid[VOL_CAPABILITIES_INTERFACES] & VOL_CAP_INT_CLONE)) {
-
-                       error = VNOP_COPYFILE(fvp, tdvp, tvp, cnp, 0,
-                           0, ctx);
-               }
-       }
-#endif /* CLONE_SNAPSHOT_FALLBACKS_ENABLED */
 
 out:
        if (attr_cleanup)
-               vn_attribute_cleanup(&va, defaulted);
-       if (free_acl && va.va_acl)
+               vn_attribute_cleanup(&nva, defaulted);
+       if (free_src_acl && va.va_acl)
                kauth_acl_free(va.va_acl);
        nameidone(&tond);
        if (tvp)
@@ -8246,8 +8255,10 @@ unionread:
                        error = union_dircheckp(&vp, fp, &context);
                        if (error == -1)
                                goto unionread;
-                       if (error)
+                       if (error) {
+                               (void)vnode_put(vp);
                                goto out;
+                       }
                }
 
                if ((vp->v_mount->mnt_flag & MNT_UNION)) {
@@ -8941,8 +8952,10 @@ searchfs(proc_t p, struct searchfs_args *uap, __unused int32_t *retval)
                        error = ENOENT;
                        goto freeandexit;
                }
-               vnode_getwithref(vp);
+               error = vnode_getwithref(vp);
                vnode_put(tvp);
+               if (error)
+                       goto freeandexit;
        }
 
 #if CONFIG_MACF
@@ -10743,6 +10756,8 @@ static int fsgetpath_internal(
        vnode_t vp;
        int length;
        int bpflags;
+       /* maximum number of times to retry build_path */
+       unsigned int retries = 0x10;
 
        if (bufsize > PAGE_SIZE) {
                return (EINVAL);
@@ -10752,6 +10767,7 @@ static int fsgetpath_internal(
                return (ENOMEM);
        }
 
+retry:
        if ((mp = mount_lookupby_volfsid(volfs_id, 1)) == NULL) {
                error = ENOTSUP;  /* unexpected failure */
                return ENOTSUP;
@@ -10798,6 +10814,14 @@ unionget:
        vnode_put(vp);
 
        if (error) {
+               /* there was a race building the path, try a few more times */
+               if (error == EAGAIN) {
+                       --retries;
+                       if (retries > 0)
+                               goto retry;
+
+                       error = ENOENT;
+               }
                goto out;
        }
 
@@ -11197,32 +11221,7 @@ vfs_purge(__unused struct proc *p, __unused struct vfs_purge_args *uap, __unused
 int
 vnode_get_snapdir(vnode_t rvp, vnode_t *sdvpp, vfs_context_t ctx)
 {
-       int error;
-
-       error = VFS_VGET_SNAPDIR(vnode_mount(rvp), sdvpp, ctx);
-
-#if CLONE_SNAPSHOT_FALLBACKS_ENABLED
-       if (error == ENOTSUP) {
-               struct nameidata snapnd;
-
-               /*
-                * Temporary fallback to <mountpoint>/.snaps lookup
-                * XXX: To be removed.
-                */
-               NDINIT(&snapnd, LOOKUP, OP_LOOKUP,  USEDVP,
-                   UIO_SYSSPACE, CAST_USER_ADDR_T(".snaps"), ctx);
-               snapnd.ni_dvp = rvp;
-
-               if ((error = namei(&snapnd))) {
-                       error = ENOTSUP;
-                       *sdvpp = NULLVP;
-               } else {
-                       *sdvpp = snapnd.ni_vp;
-                       nameidone(&snapnd);
-               }
-       }
-#endif /* CLONE_SNAPSHOT_FALLBACKS_ENABLED */
-       return (error);
+       return (VFS_VGET_SNAPDIR(vnode_mount(rvp), sdvpp, ctx));
 }
 
 /*
@@ -11376,12 +11375,6 @@ snapshot_create(int dirfd, user_addr_t name, __unused uint32_t flags,
                    VN_CREATE_NOAUTH  | VN_CREATE_NOINHERIT, 0, NULL, ctx);
                if (!error && vp)
                        vnode_put(vp);
-#if CLONE_SNAPSHOT_FALLBACKS_ENABLED
-               else if (error) {
-                       error = VNOP_COPYFILE(rvp, rvp, NULLVP, &namend.ni_cnd,
-                           0, 0, ctx);
-               }
-#endif /* CLONE_SNAPSHOT_FALLBACKS_ENABLED */
        }
 
        nameidone(&namend);
@@ -11443,6 +11436,23 @@ snapshot_revert(int dirfd, user_addr_t name, __unused uint32_t flags,
     }
     mp = vnode_mount(rvp);
 
+    MALLOC(name_buf, caddr_t, MAXPATHLEN, M_TEMP, M_WAITOK);
+    error = copyinstr(name, name_buf, MAXPATHLEN, &name_len);
+    if (error) {
+        FREE(name_buf, M_TEMP);
+        vnode_put(rvp);
+        return (error);
+    }
+
+#if CONFIG_MACF
+    error = mac_mount_check_snapshot_revert(ctx, mp, name_buf);
+    if (error) {
+        FREE(name_buf, M_TEMP);
+        vnode_put(rvp);
+        return (error);
+    }
+#endif
+
     /*
      * Grab mount_iterref so that we can release the vnode,
      * since VFSIOC_REVERT_SNAPSHOT could conceivably cause a sync.
@@ -11450,13 +11460,6 @@ snapshot_revert(int dirfd, user_addr_t name, __unused uint32_t flags,
     error = mount_iterref (mp, 0);
     vnode_put(rvp);
     if (error) {
-        return (error);
-    }
-
-    MALLOC(name_buf, caddr_t, MAXPATHLEN, M_TEMP, M_WAITOK);
-    error = copyinstr(name, name_buf, MAXPATHLEN, &name_len);
-    if (error) {
-        mount_iterdrop(mp);
         FREE(name_buf, M_TEMP);
         return (error);
     }
@@ -11613,7 +11616,7 @@ out:
  */
 static int
 snapshot_mount(int dirfd, user_addr_t name, user_addr_t directory,
-    user_addr_t mnt_data, __unused uint32_t flags, vfs_context_t ctx)
+    __unused user_addr_t mnt_data, __unused uint32_t flags, vfs_context_t ctx)
 {
        vnode_t rvp, snapdvp, snapvp, vp, pvp;
        int error;
@@ -11661,12 +11664,6 @@ snapshot_mount(int dirfd, user_addr_t name, user_addr_t directory,
                error = mount_common(mp->mnt_vfsstat.f_fstypename, pvp, vp,
                   &dirndp->ni_cnd, CAST_USER_ADDR_T(&smnt_data), 0,
                   KERNEL_MOUNT_SNAPSHOT, NULL, FALSE, ctx);
-               if (error) {
-                       /* Retry with user passed args */
-                       error = mount_common(mp->mnt_vfsstat.f_fstypename, pvp,
-                          vp, &dirndp->ni_cnd, CAST_USER_ADDR_T(mnt_data), 0,
-                          0, NULL, FALSE, ctx);
-               }
        }
 
        vnode_put(vp);
@@ -11682,6 +11679,67 @@ out:
        return (error);
 }
 
+/*
+ * Root from a snapshot of the filesystem
+ *
+ * Marks the filesystem to root from the given snapshot on next boot.
+ */
+static int
+snapshot_root(int dirfd, user_addr_t name, __unused uint32_t flags,
+                vfs_context_t ctx)
+{
+    int error;
+    vnode_t rvp;
+    mount_t mp;
+    struct fs_snapshot_root_args root_data;
+    struct componentname cnp;
+    caddr_t name_buf;
+    size_t name_len;
+    
+    error = vnode_getfromfd(ctx, dirfd, &rvp);
+    if (error) {
+        return (error);
+    }
+    mp = vnode_mount(rvp);
+    
+    MALLOC(name_buf, caddr_t, MAXPATHLEN, M_TEMP, M_WAITOK);
+    error = copyinstr(name, name_buf, MAXPATHLEN, &name_len);
+    if (error) {
+        FREE(name_buf, M_TEMP);
+        vnode_put(rvp);
+        return (error);
+    }
+   
+    // XXX MAC checks ?
+    
+    /*
+     * Grab mount_iterref so that we can release the vnode,
+     * since VFSIOC_ROOT_SNAPSHOT could conceivably cause a sync.
+     */
+    error = mount_iterref (mp, 0);
+    vnode_put(rvp);
+    if (error) {
+        FREE(name_buf, M_TEMP);
+        return (error);
+    }
+    
+    memset(&cnp, 0, sizeof(cnp));
+    cnp.cn_pnbuf = (char *)name_buf;
+    cnp.cn_nameiop = LOOKUP;
+    cnp.cn_flags = ISLASTCN | HASBUF;
+    cnp.cn_pnlen = MAXPATHLEN;
+    cnp.cn_nameptr = cnp.cn_pnbuf;
+    cnp.cn_namelen = (int)name_len;
+    root_data.sr_cnp = &cnp;
+    
+    error = VFS_IOCTL(mp, VFSIOC_ROOT_SNAPSHOT, (caddr_t)&root_data, 0, ctx);
+    
+    mount_iterdrop(mp);
+    FREE(name_buf, M_TEMP);
+    
+    return (error);
+}
+
 /*
  * FS snapshot operations dispatcher
  */
@@ -11692,6 +11750,9 @@ fs_snapshot(__unused proc_t p, struct fs_snapshot_args *uap,
        int error;
        vfs_context_t ctx = vfs_context_current();
 
+       AUDIT_ARG(fd, uap->dirfd);
+       AUDIT_ARG(value32, uap->op);
+
        error = priv_check_cred(vfs_context_ucred(ctx), PRIV_VFS_SNAPSHOT, 0);
        if (error)
                return (error);
@@ -11714,6 +11775,9 @@ fs_snapshot(__unused proc_t p, struct fs_snapshot_args *uap,
     case SNAPSHOT_OP_REVERT:
         error = snapshot_revert(uap->dirfd, uap->name1, uap->flags, ctx);
         break;
+       case SNAPSHOT_OP_ROOT:
+               error = snapshot_root(uap->dirfd, uap->name1, uap->flags, ctx);
+               break;
        default:
                error = ENOSYS;
        }
index cfa0c70e30b20a43fcd7931ea3d3269ade10cef9..f0c1fa80d3f4d60711dc5f37ec4b5c337b1f6a93 100644 (file)
@@ -1097,10 +1097,53 @@ struct vnodeop_desc vnop_removenamedstream_desc = {
        NULL
 };
 #else
-/* These symbols are in the exports list so they need to always be defined. */
-int vnop_getnamedstream_desc;
-int vnop_makenamedstream_desc;
-int vnop_removenamedstream_desc;
+int vnop_getnamedstream_vp_offsets[] = {
+       VDESC_NO_OFFSET
+};
+struct vnodeop_desc vnop_getnamedstream_desc = {
+       0,
+       "vnop_getnamedstream",
+       VDESC_DISABLED, /* flags */
+       vnop_getnamedstream_vp_offsets,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       NULL
+};
+
+int vnop_makenamedstream_vp_offsets[] = {
+       VDESC_NO_OFFSET
+};
+struct vnodeop_desc vnop_makenamedstream_desc = {
+       0,
+       "vnop_makenamedstream",
+       VDESC_DISABLED, /* flags */
+       vnop_makenamedstream_vp_offsets,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       NULL
+};
+
+int vnop_removenamedstream_vp_offsets[] = {
+       VDESC_NO_OFFSET
+};
+struct vnodeop_desc vnop_removenamedstream_desc = {
+       0,
+       "vnop_removenamedstream",
+       VDESC_DISABLED, /* flags */
+       vnop_removenamedstream_vp_offsets,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       VDESC_NO_OFFSET,
+       NULL
+};
 #endif
 
 /* Special cases: */
@@ -1199,11 +1242,18 @@ struct vnodeop_desc *vfs_op_descs[] = {
        &vnop_offtoblk_desc,
        &vnop_blockmap_desc,
        &vnop_monitor_desc,
-#if NAMEDSTREAMS
+#if !defined(NAMEDSTREAMS)
+       /*
+        * We define the named streams ops descriptors as we _always_ have to
+        * have symbols with their names, and as such we really really need
+        * those symbols to be valid operations descriptors. However if
+        * named streams support is not enabled, we flag these descriptors
+        * as ignored.
+        */
+#endif
        &vnop_getnamedstream_desc,
        &vnop_makenamedstream_desc,
        &vnop_removenamedstream_desc,
-#endif
        NULL
 };
 
index 5ac063e604416add0e1bc9435bd813a344597a18..c0014b606d06c86a21ca21ba67c19376a7638142 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000-2013 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2016 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -61,6 +61,18 @@ vm_swapfile_open(const char *path, vnode_t *vp)
                return;
        }       
 
+       /*
+        * If MNT_IOFLAGS_NOSWAP is set, opening the swap file should fail.
+        * To avoid a race on the mount we only make this check after creating the
+        * vnode.
+        */
+       if ((*vp)->v_mount->mnt_kern_flag & MNTK_NOSWAP) {
+               vnode_put(*vp);
+               vm_swapfile_close((uint64_t)path, *vp);
+               *vp = NULL;
+               return;
+       }
+
        vnode_put(*vp);
 }
 
index 612b81b20d8682954054604b5fbf97db502101ad..69aeca4ab2a4fefc29221fede8d76de617d06c5e 100644 (file)
@@ -564,7 +564,7 @@ pid_for_task(
        AUDIT_MACH_SYSCALL_ENTER(AUE_PIDFORTASK);
        AUDIT_ARG(mach_port1, t);
 
-       t1 = port_name_to_task(t);
+       t1 = port_name_to_task_inspect(t);
 
        if (t1 == TASK_NULL) {
                err = KERN_FAILURE;
index 82e56171ea0c8073edfb17703e6f1aa946a91f35..f595bb171eb97ab9fe316420efc82071a31fdfea 100644 (file)
@@ -111,6 +111,7 @@ _cluster_pageout
 _cluster_pageout_ext
 _cluster_push
 _cluster_push_ext
+_cluster_push_err
 _cluster_read
 _cluster_read_ext
 _cluster_write
@@ -634,6 +635,7 @@ _vfs_clearauthcache_ttl
 _vfs_clearauthopaque
 _vfs_clearauthopaqueaccess
 _vfs_clearextendedsecurity
+_vfs_clearnoswap
 _vfs_clearflags
 _vfs_context_create
 _vfs_context_is64bit
@@ -673,6 +675,7 @@ _vfs_setauthcache_ttl
 _vfs_setauthopaque
 _vfs_setauthopaqueaccess
 _vfs_setextendedsecurity
+_vfs_setnoswap
 _vfs_setflags
 _vfs_setfsprivate
 _vfs_setioattr
index 16a1f7853e3ad5e5a34629eeb69efc4ef966a8c5..cdacdd750d1a4827a36c9bf8432409145b76d7e9 100644 (file)
@@ -147,6 +147,7 @@ options             CONFIG_IMGSRC_ACCESS # source of imageboot dmg  # <config_imgsrc_access>
 options                CONFIG_TRIGGERS # trigger vnodes                # <config_triggers>
 options                CONFIG_EXT_RESOLVER # e.g. memberd              # <config_ext_resolver>
 options                CONFIG_SEARCHFS # searchfs syscall support      # <config_searchfs>
+options                CONFIG_MNT_SUID # allow suid binaries  # <config_mnt_suid>
 
 #
 # NFS support
@@ -606,6 +607,8 @@ options             CONFIG_DTRACE           #                   # <config_dtrace>
 options     KPERF                  # <kperf>
 options     KPC                    # <kpc>
 
+options     PGO                    # <pgo>
+
 # MACH_COUNTERS enables code that handles various counters in the system.
 # 
 options                MACH_COUNTERS   #                           # <debug>
index 94cbf4233069f1a6d369cd041f608c8050e6aaaf..441be7312dbf29dec7b0422592ad42ac83d110d1 100644 (file)
@@ -19,9 +19,9 @@
 #  KERNEL_BASE =    [ intel medium config_requires_u32_munging ]
 #  KERNEL_RELEASE = [ KERNEL_BASE ]
 #  KERNEL_DEV =     [ KERNEL_BASE development mach_assert config_xnupost proc_ref_debug os_reason_debug ]
-#  KERNEL_DEBUG =   [ KERNEL_BASE debug mach_assert config_ltable_stats config_ltable_debug config_waitq_stats config_waitq_debug ]
-#  BSD =            [ mach_bsd sysv_sem sysv_msg sysv_shm config_imageboot config_workqueue psynch config_proc_uuid_policy config_coredump ]
-#  FILESYS_BASE =   [ devfs fdesc config_dev_kmem config_fse quota namedstreams fifo config_volfs fs_compression config_imgsrc_access config_triggers config_ext_resolver config_searchfs config_appledouble nullfs ]
+#  KERNEL_DEBUG =   [ KERNEL_BASE debug mach_assert config_xnupost config_ltable_stats config_ltable_debug config_waitq_stats config_waitq_debug ]
+#  BSD =            [ mach_bsd sysv_sem sysv_msg sysv_shm config_imageboot config_workqueue psynch config_proc_uuid_policy config_coredump pgo ]
+#  FILESYS_BASE =   [ devfs fdesc config_dev_kmem config_fse quota namedstreams config_protect fifo config_volfs fs_compression config_imgsrc_access config_triggers config_ext_resolver config_searchfs config_appledouble nullfs config_mnt_suid ]
 #  FILESYS_RELEASE= [ FILESYS_BASE ]
 #  FILESYS_DEV =    [ FILESYS_BASE ]
 #  FILESYS_DEBUG =  [ FILESYS_BASE ]
index dec53ed767cc3cff32331d1895f9884c97cd42ce..cdb274063f9458d9f57c55e7158dc0248e498444 100644 (file)
@@ -1,4 +1,4 @@
-16.4.0
+16.5.0
 
 # The first line of this file contains the master version number for the kernel.
 # All other instances of the kernel version in xnu are derived from this file.
index 7f9615ea7fbee677f601a0be6c1ac0a9e65b25ee..7d563fe0cba81b5f801953b829ae1e7a011f9133 100644 (file)
@@ -56,14 +56,9 @@ _cons_cinput
 _convert_port_to_task_suspension_token
 _convert_task_suspension_token_to_port
 _convert_task_to_port
-_cp_get_backup_key
 _cp_is_valid_class
 _cp_key_store_action
-_cp_new_key
 _cp_os_version
-_cp_register_wraps
-_cp_rewrap_key
-_cp_unwrap_key
 _cpu_to_processor
 _cpx_alloc
 _cpx_can_copy
@@ -73,12 +68,14 @@ _cpx_free
 _cpx_has_key
 _cpx_init
 _cpx_is_sep_wrapped_key
+_cpx_is_composite_key
 _cpx_iv_aes_ctx
 _cpx_key
 _cpx_key_len
 _cpx_max_key_len
 _cpx_set_aes_iv_key
 _cpx_set_is_sep_wrapped_key
+_cpx_set_is_composite_key
 _cpx_set_key_len
 _cpx_set_use_offset_for_iv
 _cpx_set_synthetic_offset_for_iv
@@ -127,6 +124,7 @@ _ctl_name_by_id
 _escape_str
 _fd_rdwr
 _get_aiotask
+_get_system_inshutdown
 _gpu_accumulate_time
 _gpu_describe
 _gpu_fceiling_cb_register
@@ -277,6 +275,11 @@ _mbuf_set_flowid
 _mbuf_pkt_new_flow
 _mbuf_last_pkt
 _mcl_to_paddr
+_ml_io_read
+_ml_io_read16
+_ml_io_read32
+_ml_io_read64
+_ml_io_read8
 _mnl_instantiate
 _mnl_register
 _mnl_msg_alloc
@@ -380,6 +383,7 @@ _thread_clear_eager_preempt
 _thread_dispatchqaddr
 _thread_set_eager_preempt
 _thread_set_mach_voucher
+_thread_set_pending_block_hint
 _throttle_info_create
 _throttle_info_io_will_be_throttled
 _throttle_info_mount_ref
@@ -536,6 +540,8 @@ _mount_set_noreaddirext
 _cluster_max_io_size
 _vfs_context_cwd
 _resolve_nspace_item
+_vnode_attr_authorize
+_vnode_attr_authorize_init
 _vnode_usecount
 _vnode_iocount
 _vfs_context_iskernel
@@ -560,3 +566,10 @@ _qf_get
 _qf_put
 _dqfileinit
 _dqreclaim
+_zalloc
+_zfree
+_zinit
+_zone_change
+_fs_buffer_cache_gc_register
+_fs_buffer_cache_gc_unregister
+_cp_key_store_action_for_volume
index 778b6aa0827a66866697fc3b189d563fb743dbef..5fc9cf13ed438d1f24da9143c007a9b2203b1d7b 100644 (file)
@@ -309,6 +309,7 @@ IOReturn IOHibernateIOKitSleep(void);
 IOReturn IOHibernateSystemHasSlept(void);
 IOReturn IOHibernateSystemWake(void);
 IOReturn IOHibernateSystemPostWake(void);
+void     IOHibernateSystemPostWakeTrim(void * p1, void * p2);
 uint32_t IOHibernateWasScreenLocked(void);
 void     IOHibernateSetScreenLocked(uint32_t lockState);
 void     IOHibernateSetWakeCapabilities(uint32_t capability);
index ae767744e97ed5ded1d4e38fe49df7b079d082e7..2308daf1b5bf0a67a0699f9c35c0d0dd00fe2b2f 100644 (file)
@@ -189,7 +189,7 @@ IOReturn IOCommandGate::runAction(Action inAction,
            if (workLoop)
            {
                *sleepersP |= kSleepersWaitEnabled;
-               sleepResult = wl->sleepGate(&enabled, THREAD_ABORTSAFE);
+               sleepResult = wl->sleepGate(&enabled, THREAD_INTERRUPTIBLE);
                *sleepersP &= ~kSleepersWaitEnabled;
            }
            bool wakeupTearDown = (!workLoop || (0 != (*sleepersP & kSleepersRemoved)));
index 2ae11096b7a9253709d2f3b41790a9830f2e72f7..8a867abce75717e6f4813331a3ae28776a8322b9 100644 (file)
@@ -214,6 +214,7 @@ static IOLock             *     gDebugImageLock;
 
 static IOLock *                           gFSLock;
 static uint32_t                           gFSState;
+static thread_call_t                      gIOHibernateTrimCalloutEntry;
 static IOPolledFileIOVars                gFileVars;
 static IOHibernateVars                   gIOHibernateVars;
 static IOPolledFileCryptVars             gIOHibernateCryptWakeContext;
@@ -224,10 +225,11 @@ static hibernate_statistics_t *             gIOHibernateStats = &_hibernateStats;
 
 enum 
 {
-    kFSIdle     = 0,
-    kFSOpening  = 2,
-    kFSOpened   = 3,
-    kFSTimedOut = 4,
+    kFSIdle      = 0,
+    kFSOpening   = 2,
+    kFSOpened    = 3,
+    kFSTimedOut  = 4,
+    kFSTrimDelay = 5
 };
 
 static IOReturn IOHibernateDone(IOHibernateVars * vars);
@@ -428,6 +430,11 @@ IOHibernateSystemSleep(void)
     bzero(vars, sizeof(*vars));
 
     IOLockLock(gFSLock);
+    if (!gIOHibernateTrimCalloutEntry)
+    {
+        gIOHibernateTrimCalloutEntry = thread_call_allocate(&IOHibernateSystemPostWakeTrim, &gFSLock);
+    }
+    IOHibernateSystemPostWakeTrim(NULL, NULL);
     if (kFSIdle != gFSState)
     {
        HIBLOG("hibernate file busy\n");
@@ -518,7 +525,6 @@ IOHibernateSystemSleep(void)
     if (gDebugImageLock) {
         IOLockLock(gDebugImageLock);
         if (gDebugImageFileVars != 0) {
-            kprintf("IOHIBSystemSleep: Closing debugdata file\n");
             IOSetBootImageNVRAM(0);
             IOPolledFileClose(&gDebugImageFileVars, 0, 0, 0, 0, 0);
         }
@@ -859,7 +865,6 @@ IOOpenDebugDataFile(const char *fname, uint64_t size)
         // write extents for debug data usage in EFI
         IOWriteExtentsToFile(gDebugImageFileVars, kIOHibernateHeaderOpenSignature);
         IOSetBootImageNVRAM(imagePath);
-        kprintf("IOOpenDebugDataFile: opened debugdata file\n");
     }
 
 exit:
@@ -877,7 +882,6 @@ IOCloseDebugDataFile()
     if (gDebugImageLock) {
         IOLockLock(gDebugImageLock);
         if (gDebugImageFileVars != 0) {
-            kprintf("IOHibernateSystemPostWake: Closing debugdata file\n");
             IOPolledFileClose(&gDebugImageFileVars, 0, 0, 0, 0, 0);
         }
         IOLockUnlock(gDebugImageLock);
@@ -1268,27 +1272,42 @@ IOHibernateDone(IOHibernateVars * vars)
     return (kIOReturnSuccess);
 }
 
-IOReturn
-IOHibernateSystemPostWake(void)
+void
+IOHibernateSystemPostWakeTrim(void * p1, void * p2)
 {
-    gIOHibernateCurrentHeader->signature = kIOHibernateHeaderInvalidSignature;
-    IOLockLock(gFSLock);
-    if (kFSOpened == gFSState)
+    // invalidate & close the image file
+    if (p1) IOLockLock(gFSLock);
+    if (kFSTrimDelay == gFSState)
     {
-       // invalidate & close the image file
-       IOSleep(TRIM_DELAY);
        IOPolledFileIOVars * vars = &gFileVars;
        IOPolledFileClose(&vars,
 #if DISABLE_TRIM
-                                      0, NULL, 0, 0, 0);
+                         0, NULL, 0, 0, 0);
 #else
-                                      0, (caddr_t)gIOHibernateCurrentHeader, sizeof(IOHibernateImageHeader),
-                                      sizeof(IOHibernateImageHeader), gIOHibernateCurrentHeader->imageSize);
+                         0, (caddr_t)gIOHibernateCurrentHeader, sizeof(IOHibernateImageHeader),
+                         sizeof(IOHibernateImageHeader), gIOHibernateCurrentHeader->imageSize);
 #endif
+        gFSState = kFSIdle;
     }
-    gFSState = kFSIdle;
+    if (p1) IOLockUnlock(gFSLock);
+}
 
-       IOLockUnlock(gFSLock);
+IOReturn
+IOHibernateSystemPostWake(void)
+{
+    gIOHibernateCurrentHeader->signature = kIOHibernateHeaderInvalidSignature;
+    IOLockLock(gFSLock);
+    if (kFSTrimDelay == gFSState) IOHibernateSystemPostWakeTrim(NULL, NULL);
+    else if (kFSOpened != gFSState) gFSState = kFSIdle;
+    else
+    {
+       AbsoluteTime deadline;
+
+        gFSState = kFSTrimDelay;
+       clock_interval_to_deadline(TRIM_DELAY, kMillisecondScale, &deadline );
+       thread_call_enter1_delayed(gIOHibernateTrimCalloutEntry, NULL, deadline);
+    }
+    IOLockUnlock(gFSLock);
 
     // IOCloseDebugDataFile() calls IOSetBootImageNVRAM() unconditionally
     IOCloseDebugDataFile( );
index f2015f3868faf2a60cfed296ca262be3a16b004c..90ece1e80343ebfe4b1e2103b4f9889efcfffa35 100644 (file)
@@ -713,6 +713,10 @@ void IOPMrootDomain::swdDebugSetup( )
     DLOG("swdDebugSetup state:%d\n", swd_DebugImageSetup);
     if (swd_DebugImageSetup == FALSE) {
         swd_DebugImageSetup = TRUE;
+        if (CAP_GAIN(kIOPMSystemCapabilityGraphics) ||
+                (CAP_LOSS(kIOPMSystemCapabilityGraphics))) {
+            IOHibernateSystemPostWakeTrim((void*)1, NULL);
+        }
         IOOpenDebugDataFile(kSleepWakeStackBinFilename, SWD_BUF_SIZE);
     }
 #endif
@@ -4327,7 +4331,9 @@ void IOPMrootDomain::evaluateSystemSleepPolicyFinal( void )
     wakeNow = false;
     if (evaluateSystemSleepPolicy(&params, kIOPMSleepPhase2, &hibernateMode))
     {
-        if ((kIOPMSleepTypeStandby == params.sleepType) && gIOHibernateStandbyDisabled)
+        if ((kIOPMSleepTypeStandby == params.sleepType)
+         && gIOHibernateStandbyDisabled
+         && (!(kIOPMSleepFactorStandbyForced & gSleepPolicyVars->sleepFactors)))
         {
             standbyNixed = true;
             wakeNow = true;
@@ -5005,6 +5011,8 @@ void IOPMrootDomain::handleOurPowerChangeStart(
                 clock_get_uptime(&ts_sleepStart);
                 DLOG("sleepDelaysReport f->9 start at 0x%llx\n", ts_sleepStart);
             }
+
+            wranglerTickled = false;
         }
     }
 
@@ -5149,7 +5157,6 @@ void IOPMrootDomain::handleOurPowerChangeDone(
                 {
                     // Going dark, reset full wake state
                     // userIsActive will be cleared by wrangler powering down
-                    wranglerTickled = false;
                     fullWakeReason = kFullWakeReasonNone;
 
                     if (ts_sleepStart) {
@@ -5241,6 +5248,9 @@ void IOPMrootDomain::handleOurPowerChangeDone(
             darkWakePostTickle = false;
             reportUserInput();
         }
+        else if (wranglerTickled) {
+            requestFullWake( kFullWakeReasonLocalUser );
+        }
 
         // Reset tracepoint at completion of capability change,
         // completion of wake transition, and aborted sleep transition.
@@ -10093,7 +10103,7 @@ IOMemoryMap *IOPMrootDomain::sleepWakeDebugRetrieve( )
    IOMemoryDescriptor * desc = NULL;
    IOMemoryMap *        logBufMap = NULL;
 
-   uint32_t          len;
+   uint32_t          len = INT_MAX;
    addr64_t          data[3];
    uint64_t          bufSize = 0;
    uint64_t          crc = 0;
index 5b8a54e874c515560a1b9eb5f40ed626f008a2b7..0a7b9457588882c683914b98a0b687b151d338a7 100644 (file)
@@ -90,20 +90,25 @@ KCDBasicTypeDescription () {
        return self;
 }
 
+#define read_unaligned(type, data) ({ \
+    type x; \
+    memcpy((void*)&x, (void*)(data), sizeof(type)); \
+    x; })
+
 - (NSObject *)objectForType:(kctype_subtype_t)elem_type withData:(uint8_t *)data
 {
        NSObject * obj;
 
        switch (elem_type) {
        case KC_ST_CHAR: obj = [NSString stringWithFormat:@"%c", *(char *)data]; break;
-       case KC_ST_INT8: obj = [NSNumber numberWithInt:*(int8_t *)data]; break;
-       case KC_ST_UINT8: obj = [NSNumber numberWithInt:*(uint8_t *)data]; break;
-       case KC_ST_INT16: obj = [NSNumber numberWithShort:*(int16_t *)data]; break;
-       case KC_ST_UINT16: obj = [NSNumber numberWithUnsignedShort:*(uint16_t *)data]; break;
-       case KC_ST_INT32: obj = [NSNumber numberWithInt:*(int32_t *)data]; break;
-       case KC_ST_UINT32: obj = [NSNumber numberWithUnsignedInt:*(uint32_t *)data]; break;
-       case KC_ST_INT64: obj = [NSNumber numberWithLongLong:*(int64_t *)data]; break;
-       case KC_ST_UINT64: obj = [NSNumber numberWithUnsignedLongLong:*(uint64_t *)data]; break;
+       case KC_ST_INT8: obj =   [NSNumber numberWithInt:read_unaligned(int8_t, data)]; break;
+       case KC_ST_UINT8: obj =  [NSNumber numberWithInt:read_unaligned(uint8_t, data)]; break;
+       case KC_ST_INT16: obj =  [NSNumber numberWithShort:read_unaligned(int16_t, data)]; break;
+       case KC_ST_UINT16: obj = [NSNumber numberWithUnsignedShort:read_unaligned(uint16_t, data)]; break;
+       case KC_ST_INT32: obj =  [NSNumber numberWithInt:read_unaligned(int32_t, data)]; break;
+       case KC_ST_UINT32: obj = [NSNumber numberWithUnsignedInt:read_unaligned(uint32_t, data)]; break;
+       case KC_ST_INT64: obj =  [NSNumber numberWithLongLong:read_unaligned(int64_t, data)]; break;
+       case KC_ST_UINT64: obj = [NSNumber numberWithUnsignedLongLong:read_unaligned(uint64_t, data)]; break;
 
        default: obj = @"<Unknown error occurred>"; break;
        }
index fed1f52e4f24ff8d7c328a2f35abfac47909d161..6b1ac415e2f448ef14f4f312de50ad93077bbec3 100644 (file)
@@ -553,6 +553,16 @@ kcdata_get_typedescription(unsigned type_id, uint8_t * buffer, uint32_t buffer_s
                break;
        }
 
+       case STACKSHOT_KCTYPE_THREAD_WAITINFO: {
+               i = 0;
+               _SUBTYPE(KC_ST_UINT64, struct stackshot_thread_waitinfo, owner);
+               _SUBTYPE(KC_ST_UINT64, struct stackshot_thread_waitinfo, waiter);
+               _SUBTYPE(KC_ST_UINT64, struct stackshot_thread_waitinfo, context);
+               _SUBTYPE(KC_ST_UINT8, struct stackshot_thread_waitinfo, wait_type);
+               setup_type_definition(retval, type_id, i, "thread_waitinfo");
+               break;
+       }
+
        case TASK_CRASHINFO_PROC_STARTTIME: {
                i = 0;
                _SUBTYPE(KC_ST_INT64, struct timeval64, tv_sec);
index cb0b189d6ad462c7abce0ef27a72419cf7b8d6da..7e55392bf488ccfc97e3f77e401d61d3435d9cf9 100644 (file)
@@ -7,6 +7,8 @@
        objects = {
 
 /* Begin PBXBuildFile section */
+               045F7F121D2ADE7C00B4808B /* stackshot-with-waitinfo in Resources */ = {isa = PBXBuildFile; fileRef = 04C64AC91D25C43400C6C781 /* stackshot-with-waitinfo */; };
+               045F7F131D2ADE8000B4808B /* stackshot-with-waitinfo.plist.gz in Resources */ = {isa = PBXBuildFile; fileRef = 04C64ACA1D25C43400C6C781 /* stackshot-with-waitinfo.plist.gz */; };
                081725D51C3F476500371A54 /* stackshot-sample-duration in Resources */ = {isa = PBXBuildFile; fileRef = 081725D31C3F475200371A54 /* stackshot-sample-duration */; };
                081725D61C3F476500371A54 /* stackshot-sample-duration.plist.gz in Resources */ = {isa = PBXBuildFile; fileRef = 081725D41C3F475200371A54 /* stackshot-sample-duration.plist.gz */; };
                081EDD381C23855700A1C138 /* stackshot-sample-cputime in Resources */ = {isa = PBXBuildFile; fileRef = 081EDD361C23854500A1C138 /* stackshot-sample-cputime */; };
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
+               04C64AC91D25C43400C6C781 /* stackshot-with-waitinfo */ = {isa = PBXFileReference; lastKnownFileType = file; name = "stackshot-with-waitinfo"; path = "tests/stackshot-with-waitinfo"; sourceTree = SOURCE_ROOT; };
+               04C64ACA1D25C43400C6C781 /* stackshot-with-waitinfo.plist.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; name = "stackshot-with-waitinfo.plist.gz"; path = "tests/stackshot-with-waitinfo.plist.gz"; sourceTree = SOURCE_ROOT; };
                081725D31C3F475200371A54 /* stackshot-sample-duration */ = {isa = PBXFileReference; lastKnownFileType = file; name = "stackshot-sample-duration"; path = "tests/stackshot-sample-duration"; sourceTree = SOURCE_ROOT; };
                081725D41C3F475200371A54 /* stackshot-sample-duration.plist.gz */ = {isa = PBXFileReference; lastKnownFileType = archive.gzip; name = "stackshot-sample-duration.plist.gz"; path = "tests/stackshot-sample-duration.plist.gz"; sourceTree = SOURCE_ROOT; };
                081EDD361C23854500A1C138 /* stackshot-sample-cputime */ = {isa = PBXFileReference; lastKnownFileType = file; name = "stackshot-sample-cputime"; path = "tests/stackshot-sample-cputime"; sourceTree = SOURCE_ROOT; };
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
-               08603F351BF69EDE007D3784 /* Tests */ = {
+               08603F351BF69EDE007D3784 /* tests */ = {
                        isa = PBXGroup;
                        children = (
                                C9D7B53D1D1B41D700F1019D /* xnupost_testconfig-sample.plist.gz */,
                                C9D7B53E1D1B41D700F1019D /* xnupost_testconfig-sample */,
+                               04C64AC91D25C43400C6C781 /* stackshot-with-waitinfo */,
+                               04C64ACA1D25C43400C6C781 /* stackshot-with-waitinfo.plist.gz */,
                                13A79CA81CF8C5D200FFC181 /* stackshot-with-kcid */,
                                13A79CA91CF8C5D200FFC181 /* stackshot-with-kcid.plist.gz */,
                                13CC08421CB97F8A00EA6069 /* stackshot-fault-stats */,
                                08F1501D1BFEA7AC00F2C89C /* libz.dylib */,
                                0834719D1BF7D05400D67253 /* kcdata.h */,
                                08B480871BF92DFB00B4AAE0 /* kcdata.py */,
-                               08603F351BF69EDE007D3784 /* Tests */,
+                               08603F351BF69EDE007D3784 /* tests */,
                                C91C93C81ACB58B700119B60 /* Products */,
                        );
                        sourceTree = "<group>";
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               045F7F131D2ADE8000B4808B /* stackshot-with-waitinfo.plist.gz in Resources */,
+                               045F7F121D2ADE7C00B4808B /* stackshot-with-waitinfo in Resources */,
                                08A4C94F1C470F1C00D5F010 /* nested-sample in Resources */,
                                08A4C9501C470F1C00D5F010 /* nested-sample.plist in Resources */,
                                13D6C5D21C4DDDBE005E617C /* test-twr-sample in Resources */,
index ec88ed21f97bd1b656c45988ee8b533a54039eea..e2225f35aa94d4221fda47666b7ac4e8b4211b0a 100644 (file)
@@ -1331,6 +1331,10 @@ class Tests: XCTestCase {
         self.testSampleStackshot("xnupost_testconfig-sample")
     }
 
+    func testStackshotWithWaitinfo() {
+        self.testSampleStackshot("stackshot-with-waitinfo")
+    }
+
     func testTrivial() {
     }
 }
diff --git a/libkdd/tests/stackshot-with-waitinfo b/libkdd/tests/stackshot-with-waitinfo
new file mode 100644 (file)
index 0000000..18fb16c
Binary files /dev/null and b/libkdd/tests/stackshot-with-waitinfo differ
diff --git a/libkdd/tests/stackshot-with-waitinfo.plist.gz b/libkdd/tests/stackshot-with-waitinfo.plist.gz
new file mode 100644 (file)
index 0000000..eab7b95
Binary files /dev/null and b/libkdd/tests/stackshot-with-waitinfo.plist.gz differ
index b7fcbf77c350d6a4ca77325175df2e3b5af9ffd7..d30dbe5b4b2a4fd4d6f9a34d51563fa94bc88708 100644 (file)
@@ -32,6 +32,7 @@ extern "C" {
 #include <kern/host.h>
 #include <kern/kext_alloc.h>
 #include <firehose/tracepoint_private.h>
+#include <firehose/chunk_private.h>
 #include <os/firehose_buffer_private.h>
 #include <vm/vm_kern.h>
 #include <kextd/kextd_mach.h>
@@ -3305,6 +3306,52 @@ finish:
     return foundKext;
 }
 
+OSData *
+OSKext::copyKextUUIDForAddress(OSNumber *address)
+{
+       OSData *uuid = NULL;
+
+       if (!address) {
+               return NULL;
+       }
+
+       uintptr_t addr = (uintptr_t)address->unsigned64BitValue() + vm_kernel_slide;
+
+#if CONFIG_MACF
+       /* Is the calling process allowed to query kext info? */
+       if (current_task() != kernel_task) {
+               int macCheckResult = 0;
+               kauth_cred_t cred = NULL;
+
+               cred = kauth_cred_get_with_ref();
+               macCheckResult = mac_kext_check_query(cred);
+               kauth_cred_unref(&cred);
+
+               if (macCheckResult != 0) {
+                       OSKextLog(/* kext */ NULL,
+                                       kOSKextLogErrorLevel | kOSKextLogLoadFlag,
+                                       "Failed to query kext UUID (MAC policy error 0x%x).",
+                                       macCheckResult);
+                       return NULL;
+               }
+       }
+#endif
+
+       if (((vm_offset_t)addr >= vm_kernel_stext) && ((vm_offset_t)addr < vm_kernel_etext)) {
+               /* address in xnu proper */
+               unsigned long uuid_len = 0;
+               uuid = OSData::withBytes(getuuidfromheader(&_mh_execute_header, &uuid_len), uuid_len);
+       } else {
+               IOLockLock(sKextSummariesLock);
+               OSKextLoadedKextSummary *summary = OSKext::summaryForAddress(addr);
+               if (summary) {
+                       uuid = OSData::withBytes(summary->uuid, sizeof(uuid_t));
+               }
+               IOLockUnlock(sKextSummariesLock);
+       }
+
+       return uuid;
+}
 
 /*********************************************************************
 *********************************************************************/
@@ -7891,10 +7938,6 @@ OSKext::handleRequest(
          if (responseObject) {
              result = kOSReturnSuccess;
          } else {
-             OSKextLog(/* kext */ NULL,
-                       kOSKextLogErrorLevel |
-                       kOSKextLogIPCFlag,
-                       "Get UUID by Address failed.");
              goto finish;
          }
 
@@ -8490,54 +8533,6 @@ finish:
     return result;
 }
 
-/*********************************************************************
-*********************************************************************/
-/* static */
-OSData *
-OSKext::copyKextUUIDForAddress(OSNumber *address)
-{
-    OSKext *kext = NULL;
-    OSData *uuid = NULL;
-    vm_address_t vm_addr = 0;
-
-    if (!address)
-        goto finish;
-
-#if CONFIG_MACF
-    /* Is the calling process allowed to query kext info? */
-    if (current_task() != kernel_task) {
-        int                 macCheckResult      = 0;
-        kauth_cred_t        cred                = NULL;
-
-        cred = kauth_cred_get_with_ref();
-        macCheckResult = mac_kext_check_query(cred);
-        kauth_cred_unref(&cred);
-
-        if (macCheckResult != 0) {
-            OSKextLog(/* kext */ NULL,
-                      kOSKextLogErrorLevel | kOSKextLogLoadFlag,
-                      "Failed to query kext UUID (MAC policy error 0x%x).",
-                      macCheckResult);
-            goto finish;
-        }
-    }
-#endif
-
-    vm_addr = (vm_address_t)(address->unsigned64BitValue() + vm_kernel_slide);
-
-    kext = OSKext::lookupKextWithAddress(vm_addr);
-    if (kext) {
-        uuid = kext->copyUUID();
-    }
-
-finish:
-    if (kext) {
-        kext->release();
-    }
-    return uuid;
-}
-
-
 /*********************************************************************
 *********************************************************************/
 /* static */
@@ -10826,72 +10821,67 @@ OSKext::summaryIsInBacktrace(
     return FALSE;
 }
 
-/* static */
-void *
-OSKext::kextForAddress(
-    const void           * addr)
+/*
+ * Get the kext summary object for the kext where 'addr' lies. Must be called with
+ * sKextSummariesLock held.
+ */
+OSKextLoadedKextSummary *
+OSKext::summaryForAddress(const uintptr_t addr)
 {
-   void *image = NULL;
-   u_int   i;
-
-#if !VM_MAPPED_KEXTS
-   kernel_mach_header_t     *mh  = NULL;
-   kernel_segment_command_t *seg = NULL;
-#endif
-
-   if (((vm_offset_t)(uintptr_t)addr >= vm_kernel_stext) &&
-          ((vm_offset_t)(uintptr_t)addr < vm_kernel_etext)) {
-          return (void *)&_mh_execute_header;
-   }
-
-   if (!sKextSummariesLock) return image;
-   IOLockLock(sKextSummariesLock);
-
-   if (!gLoadedKextSummaries) {
-      goto finish;
-   }
+       for (unsigned i = 0; i < gLoadedKextSummaries->numSummaries; ++i) {
 
-   for (i = 0; i < gLoadedKextSummaries->numSummaries; ++i) {
-       OSKextLoadedKextSummary * summary;
+               OSKextLoadedKextSummary *summary = &gLoadedKextSummaries->summaries[i];
+               if (!summary->address) {
+                       continue;
+               }
 
-       summary = gLoadedKextSummaries->summaries + i;
-       if (!summary->address) {
-        continue;
-       }
+#if VM_MAPPED_KEXTS
+               /* On our platforms that use VM_MAPPED_KEXTS, we currently do not
+                * support split kexts, but we also may unmap the kexts, which can
+                * race with the above codepath (see OSKext::unload).  As such,
+                * use a simple range lookup if we are using VM_MAPPED_KEXTS.
+                */
+               if ((addr >= summary->address) && (addr < (summary->address + summary->size))) {
+                       return summary;
+               }
+#else
+               kernel_mach_header_t *mh = (kernel_mach_header_t *)summary->address;
+               kernel_segment_command_t *seg;
+
+               for (seg = firstsegfromheader(mh); seg != NULL; seg = nextsegfromheader(mh, seg)) {
+                       if ((addr >= seg->vmaddr) && (addr < (seg->vmaddr + seg->vmsize))) {
+                               return summary;
+                       }
+               }
+#endif
+       }
 
-#if !VM_MAPPED_KEXTS
-       mh = (kernel_mach_header_t *)summary->address;
+       /* addr did not map to any kext */
+       return NULL;
+}
 
-       for (seg = firstsegfromheader(mh); seg != NULL; seg = nextsegfromheader(mh, seg)) {
-           if (((uint64_t)addr >= seg->vmaddr) &&
-               ((uint64_t)addr < (seg->vmaddr + seg->vmsize))) {
-                   image = (void *)summary->address;
-                   break;
-           }
-       }
+/* static */
+void *
+OSKext::kextForAddress(const void *addr)
+{
+       void *image = NULL;
 
-       if (image) {
-           break;
-       }
-#else
-      /* On our platforms that use VM_MAPPED_KEXTS, we currently do not
-       * support split kexts, but we also may unmap the kexts, which can
-       * race with the above codepath (see OSKext::unload).  As such,
-       * use a simple range lookup if we are using VM_MAPPED_KEXTS.
-       */
-       if (((uint64_t)(uintptr_t)addr >= summary->address) &&
-          ((uint64_t)(uintptr_t)addr < (summary->address + summary->size)))
-       {
-        image = (void *)(uintptr_t)summary->address;
-        break;
-       }
-#endif
-    }
+       if (((vm_offset_t)(uintptr_t)addr >= vm_kernel_stext) &&
+                       ((vm_offset_t)(uintptr_t)addr < vm_kernel_etext)) {
+               return (void *)&_mh_execute_header;
+       }
 
-finish:
-    IOLockUnlock(sKextSummariesLock);
+       if (!sKextSummariesLock) {
+               return NULL;
+       }
+       IOLockLock(sKextSummariesLock);
+       OSKextLoadedKextSummary *summary = OSKext::summaryForAddress((uintptr_t)addr);
+       if (summary) {
+               image = (void *)summary->address;
+       }
+       IOLockUnlock(sKextSummariesLock);
 
-    return image;
+       return image;
 }
 
 /*********************************************************************
@@ -11730,3 +11720,22 @@ GetAppleTEXTHashForKext(OSKext * theKext, OSDictionary *theInfoDict)
     
 #endif // CONFIG_KEC_FIPS
 
+#if CONFIG_IMAGEBOOT
+int OSKextGetUUIDForName(const char *name, uuid_t uuid)
+{
+       OSKext *kext = OSKext::lookupKextWithIdentifier(name);
+       if (!kext) {
+               return 1;
+       }
+
+       OSData *uuid_data = kext->copyUUID();
+       if (uuid_data) {
+               memcpy(uuid, uuid_data->getBytesNoCopy(), sizeof(uuid_t));
+               OSSafeReleaseNULL(uuid_data);
+               return 0;
+       }
+
+       return 1;
+}
+#endif
+
index 36a760d569c92d09878d779cb4f36d41033d2848..d6f2503f92a05e7cc52c1e3bc47661fa4d20d7df 100644 (file)
@@ -17,7 +17,8 @@ PRIVATE_KERNELFILES =
 EXPORTFILES = \
        firehose_types_private.h \
        ioctl_private.h \
-       tracepoint_private.h
+       tracepoint_private.h \
+       chunk_private.h
 
 PRIVATE_DATAFILES = ${EXPORTFILES} \
        private.h
diff --git a/libkern/firehose/chunk_private.h b/libkern/firehose/chunk_private.h
new file mode 100644 (file)
index 0000000..ca5fe06
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2016 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 __FIREHOSE_CHUNK_PRIVATE__
+#define __FIREHOSE_CHUNK_PRIVATE__
+
+#if KERNEL
+#include <machine/atomic.h>
+#endif
+#include <stdatomic.h>
+#include <sys/param.h>
+#include <os/base.h>
+#include "firehose_types_private.h"
+#include "tracepoint_private.h"
+
+__BEGIN_DECLS
+
+#define FIREHOSE_CHUNK_SIZE                     4096ul
+
+#define FIREHOSE_CHUNK_POS_ENTRY_OFFS_INC       (1ULL <<  0)
+#define FIREHOSE_CHUNK_POS_PRIVATE_OFFS_INC     (1ULL << 16)
+#define FIREHOSE_CHUNK_POS_REFCNT_INC           (1ULL << 32)
+#define FIREHOSE_CHUNK_POS_FULL_BIT             (1ULL << 56)
+#define FIREHOSE_CHUNK_POS_USABLE_FOR_STREAM(pos, stream) \
+               ((((pos).fcp_pos >> 48) & 0x1ff) == (uint16_t)stream)
+
+typedef union {
+       _Atomic(uint64_t) fcp_atomic_pos;
+       uint64_t fcp_pos;
+       struct {
+               uint16_t fcp_next_entry_offs;
+               uint16_t fcp_private_offs;
+               uint8_t  fcp_refcnt;
+               uint8_t  fcp_qos;
+               uint8_t  fcp_stream;
+               uint8_t  fcp_flag_full : 1;
+               uint8_t  fcp_flag_io : 1;
+               uint8_t  _fcp_flag_unused : 6;
+       };
+} firehose_chunk_pos_u;
+
+typedef struct firehose_chunk_s {
+       uint8_t  fc_start[0];
+       firehose_chunk_pos_u fc_pos;
+       uint64_t fc_timestamp;
+       uint8_t  fc_data[FIREHOSE_CHUNK_SIZE - 8 - 8];
+} *firehose_chunk_t;
+
+typedef struct firehose_chunk_range_s {
+       uint16_t fcr_offset; // offset from the start of the chunk
+       uint16_t fcr_length;
+} *firehose_chunk_range_t;
+
+#if defined(KERNEL) || defined(OS_FIREHOSE_SPI)
+
+OS_ALWAYS_INLINE
+static inline bool
+firehose_chunk_pos_fits(firehose_chunk_pos_u pos, uint16_t size)
+{
+       return pos.fcp_next_entry_offs + size <= pos.fcp_private_offs;
+}
+
+#define FIREHOSE_CHUNK_TRY_RESERVE_FAIL_ENQUEUE  (-1)
+#define FIREHOSE_CHUNK_TRY_RESERVE_FAIL          ( 0)
+
+OS_ALWAYS_INLINE
+static inline long
+firehose_chunk_tracepoint_try_reserve(firehose_chunk_t fc, uint64_t stamp,
+               firehose_stream_t stream, uint8_t qos, uint16_t pubsize,
+               uint16_t privsize, uint8_t **privptr)
+{
+       const uint16_t ft_size = offsetof(struct firehose_tracepoint_s, ft_data);
+       firehose_chunk_pos_u orig, pos;
+       bool reservation_failed, stamp_delta_fits;
+
+       stamp_delta_fits = ((stamp - fc->fc_timestamp) >> 48) == 0;
+
+       // no acquire barrier because the returned space is written to only
+       os_atomic_rmw_loop(&fc->fc_pos.fcp_atomic_pos,
+                       orig.fcp_pos, pos.fcp_pos, relaxed, {
+               if (orig.fcp_pos == 0) {
+                       // we acquired a really really old reference, and we probably
+                       // just faulted in a new page
+                       os_atomic_rmw_loop_give_up(return FIREHOSE_CHUNK_TRY_RESERVE_FAIL);
+               }
+               if (!FIREHOSE_CHUNK_POS_USABLE_FOR_STREAM(orig, stream)) {
+                       // nothing to do if the chunk is full, or the stream doesn't match,
+                       // in which case the thread probably:
+                       // - loaded the chunk ref
+                       // - been suspended a long while
+                       // - read the chunk to find a very old thing
+                       os_atomic_rmw_loop_give_up(return FIREHOSE_CHUNK_TRY_RESERVE_FAIL);
+               }
+               pos = orig;
+               if (!firehose_chunk_pos_fits(orig,
+                               ft_size + pubsize + privsize) || !stamp_delta_fits) {
+                       pos.fcp_flag_full = true;
+                       reservation_failed = true;
+               } else {
+                       if (qos > pos.fcp_qos) pos.fcp_qos = qos;
+                       // using these *_INC macros is so that the compiler generates better
+                       // assembly: using the struct individual fields forces the compiler
+                       // to handle carry propagations, and we know it won't happen
+                       pos.fcp_pos += roundup(ft_size + pubsize, 8) *
+                                       FIREHOSE_CHUNK_POS_ENTRY_OFFS_INC;
+                       pos.fcp_pos -= privsize * FIREHOSE_CHUNK_POS_PRIVATE_OFFS_INC;
+                       pos.fcp_pos += FIREHOSE_CHUNK_POS_REFCNT_INC;
+                       const uint16_t minimum_payload_size = 16;
+                       if (!firehose_chunk_pos_fits(pos,
+                                       roundup(ft_size + minimum_payload_size , 8))) {
+                               // if we can't even have minimum_payload_size bytes of payload
+                               // for the next tracepoint, just flush right away
+                               pos.fcp_flag_full = true;
+                       }
+                       reservation_failed = false;
+               }
+       });
+
+       if (reservation_failed) {
+               if (pos.fcp_refcnt) {
+                       // nothing to do, there is a thread writing that will pick up
+                       // the "FULL" flag on flush and push as a consequence
+                       return FIREHOSE_CHUNK_TRY_RESERVE_FAIL;
+               }
+               // caller must enqueue chunk
+               return FIREHOSE_CHUNK_TRY_RESERVE_FAIL_ENQUEUE;
+       }
+       if (privptr) {
+               *privptr = fc->fc_start + pos.fcp_private_offs;
+       }
+       return orig.fcp_next_entry_offs;
+}
+
+OS_ALWAYS_INLINE
+static inline firehose_tracepoint_t
+firehose_chunk_tracepoint_begin(firehose_chunk_t fc, uint64_t stamp,
+               uint16_t pubsize, uint64_t thread_id, long offset)
+{
+       firehose_tracepoint_t ft = (firehose_tracepoint_t)
+                       __builtin_assume_aligned(fc->fc_start + offset, 8);
+       stamp -= fc->fc_timestamp;
+       stamp |= (uint64_t)pubsize << 48;
+       // The compiler barrier is needed for userland process death handling, see
+       // (tracepoint-begin) in libdispatch's firehose_buffer_stream_chunk_install.
+       atomic_store_explicit(&ft->ft_atomic_stamp_and_length, stamp,
+                       memory_order_relaxed);
+       __asm__ __volatile__("" ::: "memory");
+       ft->ft_thread = thread_id;
+       return ft;
+}
+
+OS_ALWAYS_INLINE
+static inline bool
+firehose_chunk_tracepoint_end(firehose_chunk_t fc,
+               firehose_tracepoint_t ft, firehose_tracepoint_id_u ftid)
+{
+       firehose_chunk_pos_u pos;
+
+       atomic_store_explicit(&ft->ft_id.ftid_atomic_value,
+                       ftid.ftid_value, memory_order_release);
+       pos.fcp_pos = atomic_fetch_sub_explicit(&fc->fc_pos.fcp_atomic_pos,
+                       FIREHOSE_CHUNK_POS_REFCNT_INC, memory_order_relaxed);
+       return pos.fcp_refcnt == 1 && pos.fcp_flag_full;
+}
+
+#endif // defined(KERNEL) || defined(OS_FIREHOSE_SPI)
+
+__END_DECLS
+
+#endif // __FIREHOSE_CHUNK_PRIVATE__
index 209046e2785300d02052da4fdb023d9561c6703b..785ac177debbf46a50ff1ed3d0f4358b4e4f4b14 100644 (file)
@@ -120,10 +120,23 @@ typedef uint8_t firehose_tracepoint_type_t;
  */
 OS_ENUM(firehose_tracepoint_flags, uint16_t,
        _firehose_tracepoint_flags_base_has_current_aid         = 0x0001,
-       _firehose_tracepoint_flags_base_main_executable         = 0x0002,
-       _firehose_tracepoint_flags_base_shared_cache            = 0x0004,
-       _firehose_tracepoint_flags_base_caller_pc                       = 0x0008,
+#define _firehose_tracepoint_flags_pc_style_mask                (0x0007 << 1)
+       _firehose_tracepoint_flags_pc_style_none                        = 0x0000 << 1,
+       _firehose_tracepoint_flags_pc_style_main_exe            = 0x0001 << 1,
+       _firehose_tracepoint_flags_pc_style_shared_cache        = 0x0002 << 1,
+       _firehose_tracepoint_flags_pc_style_main_plugin         = 0x0003 << 1,
+       _firehose_tracepoint_flags_pc_style_absolute            = 0x0004 << 1,
+       _firehose_tracepoint_flags_pc_style_uuid_relative       = 0x0005 << 1,
+       _firehose_tracepoint_flags_pc_style__unused6            = 0x0006 << 1,
+       _firehose_tracepoint_flags_pc_style__unused7            = 0x0007 << 1,
        _firehose_tracepoint_flags_base_has_unique_pid          = 0x0010,
+
+       _firehose_tracepoint_flags_base_main_executable __deprecated =
+                       _firehose_tracepoint_flags_pc_style_main_exe,
+       _firehose_tracepoint_flags_base_shared_cache __deprecated =
+                       _firehose_tracepoint_flags_pc_style_shared_cache,
+       _firehose_tracepoint_flags_base_caller_pc __deprecated =
+                       _firehose_tracepoint_flags_pc_style_absolute,
 );
 
 /*!
@@ -229,4 +242,4 @@ __END_DECLS
 
 OS_ASSUME_NONNULL_END
 
-#endif // __FIREHOSE_TYPES__
+#endif // __FIREHOSE_TYPES_PRIVATE__
index 943fceb35429069077a67e1077893a220a3006a5..d4c4e104087fe5e0645bb451de86a2e52964c123 100644 (file)
 #ifndef __FIREHOSE_FIREHOSE_PRIVATE__
 #define __FIREHOSE_FIREHOSE_PRIVATE__
 
-#define FIREHOSE_SPI_VERSION 20160602
+#define FIREHOSE_SPI_VERSION 20170907
 
 #include "firehose_types_private.h"
 #include "tracepoint_private.h"
 #include "ioctl_private.h"
+#include "chunk_private.h"
 
 #endif // __FIREHOSE_FIREHOSE_PRIVATE__
index e0ccc4f7ec7a7ff449e1e029f9f7d8e9c615161d..a0c7122124aab2aaa668b3a8a599b062861fbf82 100644 (file)
@@ -45,6 +45,7 @@ typedef union {
                uint32_t _code;
        } ftid;
        firehose_tracepoint_id_t ftid_value;
+       _Atomic(firehose_tracepoint_id_t) ftid_atomic_value;
 } firehose_tracepoint_id_u;
 
 #define FIREHOSE_STAMP_SLOP (1ULL << 36) // ~1minute
@@ -75,6 +76,7 @@ typedef struct firehose_tracepoint_s {
                        uint64_t ft_length : 16;
                };
                uint64_t ft_stamp_and_length;
+               _Atomic(uint64_t) ft_atomic_stamp_and_length;
        };
        uint8_t ft_data[];
 } *firehose_tracepoint_t;
@@ -93,6 +95,15 @@ typedef struct firehose_tracepoint_s {
 #define FIREHOSE_TRACE_ID_SET_TYPE(tid, ns, type) \
        ((tid).ftid._type = _firehose_tracepoint_type_##ns##_##type)
 
+#define FIREHOSE_TRACE_ID_PC_STYLE(tid) \
+               ((tid).ftid._flags & _firehose_tracepoint_flags_pc_style_mask)
+
+#define FIREHOSE_TRACE_ID_SET_PC_STYLE(tid, flag) ({ \
+               firehose_tracepoint_id_u _tmp_tid = (tid); \
+               _tmp_tid.ftid._flags &= ~_firehose_tracepoint_flags_pc_style_mask; \
+               _tmp_tid.ftid._flags |= _firehose_tracepoint_flags_pc_style_##flag; \
+})
+
 #define FIREHOSE_TRACE_ID_HAS_FLAG(tid, ns, flag) \
        ((tid).ftid._flags & _firehose_tracepoint_flags_##ns##_##flag)
 #define FIREHOSE_TRACE_ID_SET_FLAG(tid, ns, flag) \
index 896cf09fc0c7b1c03c0ec53e55a8bbc778107f6a..f8fc526bc7c3df83af245328f4ec094bd6523eaa 100644 (file)
@@ -353,8 +353,9 @@ kxld_object_set_link_info(KXLDObject *object, splitKextLinkInfo *link_info)
     object->split_info.vmaddr_TEXT_EXEC = link_info->vmaddr_TEXT_EXEC;
     object->split_info.vmaddr_DATA = link_info->vmaddr_DATA;
     object->split_info.vmaddr_DATA_CONST = link_info->vmaddr_DATA_CONST;
+    object->split_info.vmaddr_LLVM_COV = link_info->vmaddr_LLVM_COV;
     object->split_info.vmaddr_LINKEDIT = link_info->vmaddr_LINKEDIT;
-    
+
     return;
 }
 
@@ -2484,6 +2485,9 @@ process_relocs_from_tables(KXLDObject *object)
                 else if (kxld_seg_is_data_const_seg(seg)) {
                     my_link_addr = object->split_info.vmaddr_DATA_CONST;
                 }
+                else if (kxld_seg_is_llvm_cov_seg(seg)) {
+                    my_link_addr = object->split_info.vmaddr_LLVM_COV;
+                }
                 else if (kxld_seg_is_linkedit_seg(seg)) {
                     my_link_addr = object->split_info.vmaddr_LINKEDIT;
                 }
@@ -2519,6 +2523,9 @@ process_relocs_from_tables(KXLDObject *object)
                 else if (kxld_seg_is_data_const_seg(seg)) {
                     my_link_addr = object->split_info.vmaddr_DATA_CONST;
                 }
+                else if (kxld_seg_is_llvm_cov_seg(seg)) {
+                    my_link_addr = object->split_info.vmaddr_LLVM_COV;
+                }
                 else if (kxld_seg_is_linkedit_seg(seg)) {
                     my_link_addr = object->split_info.vmaddr_LINKEDIT;
                 }
index f512c2b909b3554d9c12198fe84db271fa275dbf..b10193b3fc3c3ca7ee69fcd8faab152ccb0a68e4 100644 (file)
@@ -907,6 +907,14 @@ kxld_seg_relocate(KXLDSeg *seg, kxld_addr_t link_addr)
                 // the address of the kext (macho header in __TEXT)
                 my_link_addr -= seg->base_addr;
             }
+            else if (kxld_seg_is_llvm_cov_seg(seg)) {
+                my_link_addr = link_info->vmaddr_LLVM_COV;
+                seg->link_addr = my_link_addr;
+                // vmaddr_LLVM_COV is the actual vmaddr for this segment so we need
+                // to adjust for kxld_sect_relocate assuming the link addr is
+                // the address of the kext (macho header in __TEXT)
+                my_link_addr -= seg->base_addr;
+            }
             else if (kxld_seg_is_linkedit_seg(seg)) {
                 my_link_addr = link_info->vmaddr_LINKEDIT;
                 seg->link_addr = my_link_addr;
@@ -995,7 +1003,8 @@ kxld_seg_is_split_seg(const KXLDSeg *seg)
     check(seg);
     if (isSplitKext) {
         if (kxld_seg_is_data_seg(seg) || kxld_seg_is_linkedit_seg(seg) ||
-            kxld_seg_is_text_exec_seg(seg) || kxld_seg_is_data_const_seg(seg)) {
+            kxld_seg_is_text_exec_seg(seg) || kxld_seg_is_data_const_seg(seg) ||
+            kxld_seg_is_llvm_cov_seg(seg)) {
             result = TRUE;
         }
     }
@@ -1058,3 +1067,13 @@ kxld_seg_is_linkedit_seg(const KXLDSeg *seg)
     return result;
 }
 
+boolean_t
+kxld_seg_is_llvm_cov_seg(const KXLDSeg *seg)
+{
+    boolean_t       result = FALSE;
+
+    check(seg);
+    result = !strncmp(seg->segname, "__LLVM_COV", sizeof(seg->segname));
+
+    return result;
+}
index 5eb9f98fc82b550f866dda822dad37bf6f1e652e..8f8551b13b5c962cde72e24f5b4feff384ae788f 100644 (file)
@@ -169,6 +169,8 @@ __attribute__((pure, nonnull, visibility("hidden")));
 boolean_t kxld_seg_is_linkedit_seg(const KXLDSeg *seg)
 __attribute__((pure, nonnull, visibility("hidden")));
 
+boolean_t kxld_seg_is_llvm_cov_seg(const KXLDSeg *seg)
+__attribute__((pure, nonnull, visibility("hidden")));
 
 #endif /* _KXLD_SEG_H_ */
 
index e6d56c2ff695b147108d0bd65050eee32d56bc3b..dcf39a26b3c8d8b4dde4854ab96226aa679b3cd7 100644 (file)
@@ -869,7 +869,8 @@ void kxld_show_split_info(splitKextLinkInfo *info)
              "kextExecutable %p to %p kextSize %lu \n"
              "linkedKext %p to %p linkedKextSize %lu \n"
              "vmaddr_TEXT %p vmaddr_TEXT_EXEC %p "
-             "vmaddr_DATA %p vmaddr_DATA_CONST %p vmaddr_LINKEDIT %p",
+             "vmaddr_DATA %p vmaddr_DATA_CONST %p "
+             "vmaddr_LLVM_COV %p vmaddr_LINKEDIT %p",
              (void *) info->kextExecutable,
              (void *) (info->kextExecutable + info->kextSize),
              info->kextSize,
@@ -880,6 +881,7 @@ void kxld_show_split_info(splitKextLinkInfo *info)
              (void *) info->vmaddr_TEXT_EXEC,
              (void *) info->vmaddr_DATA,
              (void *) info->vmaddr_DATA_CONST,
+             (void *) info->vmaddr_LLVM_COV,
              (void *) info->vmaddr_LINKEDIT);
 }
 
index 929e0b2986e89f17fca2b5c68d401c137a4e0a6a..2557007ea707c404132096c619ae944e24c2e1e5 100644 (file)
@@ -930,6 +930,10 @@ extern uint32_t                     OSKextGetKmodIDForSite(vm_allocation_site_t
                                                            char * name, vm_size_t namelen);
 extern void                         OSKextFreeSite(vm_allocation_site_t * site);
 
+#if CONFIG_IMAGEBOOT
+extern int OSKextGetUUIDForName(const char *, uuid_t);
+#endif
+
 #endif /* XNU_KERNEL_PRIVATE */
 
 __END_DECLS
index 2a265d2bdc3109e8547db77c270d255dc887d8fd..4d4cea4ec4923a86455fc9996b3c1cdb0a62392f 100644 (file)
@@ -534,8 +534,8 @@ private:
         int          (* printf_func)(const char *fmt, ...),
         bool            lockFlag,
         bool            doUnslide);
-    static void * kextForAddress(
-        const void               * addr);
+    static OSKextLoadedKextSummary *summaryForAddress(const uintptr_t addr);
+    static void *kextForAddress(const void *addr);
     static boolean_t summaryIsInBacktrace(
         OSKextLoadedKextSummary * summary,
         vm_offset_t             * addr,
index cad04f811a7b4feec463155d5690e099831641d5..417aaf54e7388aeaabf6f21c0f71390c4177a7d5 100644 (file)
@@ -127,6 +127,7 @@ typedef struct splitKextLinkInfo {
     uint64_t        vmaddr_DATA;        // vmaddr of kext __DATA segment
     uint64_t        vmaddr_DATA_CONST;  // vmaddr of kext __DATA_CONST segment
     uint64_t        vmaddr_LINKEDIT;    // vmaddr of kext __LINKEDIT segment
+    uint64_t        vmaddr_LLVM_COV;    // vmaddr of kext __LLVM_COV segment
     uint32_t        kaslr_offsets_count; // offsets into the kext to slide
     uint32_t *      kaslr_offsets;      // offsets into the kext to slide
 } splitKextLinkInfo;
index da6d6637d49c71bcb11598f30c9c861b517a7971..a2638fee590e25e517ce57709682a31359897d7d 100644 (file)
@@ -25,6 +25,7 @@
 #include <kern/assert.h>
 
 #include <firehose/tracepoint_private.h>
+#include <firehose/chunk_private.h>
 #include <os/firehose_buffer_private.h>
 #include <os/firehose.h>
 
@@ -40,7 +41,7 @@ struct os_log_s {
 struct os_log_s _os_log_default;
 struct os_log_s _os_log_replay;
 extern vm_offset_t kernel_firehose_addr;
-extern firehose_buffer_chunk_t firehose_boot_chunk;
+extern firehose_chunk_t firehose_boot_chunk;
 
 extern void bsd_log_lock(void);
 extern void bsd_log_unlock(void);
@@ -298,49 +299,45 @@ _os_log_to_log_internal(os_log_t oslog, os_log_type_t type,
     va_end(args_copy);
 }
 
-size_t
-_os_trace_location_for_address(void *dso, const void *address,
-               os_trace_location_t location, firehose_tracepoint_flags_t *flags);
-
-size_t
-_os_trace_location_for_address(void *dso, const void *address,
-               os_trace_location_t location, firehose_tracepoint_flags_t *flags)
+static inline size_t
+_os_trace_write_location_for_address(uint8_t buf[static sizeof(uint64_t)],
+               void *dso, const void *address, firehose_tracepoint_flags_t *flags)
 {
        kernel_mach_header_t *mh = dso;
 
        if (mh->filetype == MH_EXECUTE) {
-               location->flags = _firehose_tracepoint_flags_base_main_executable;
-               location->offset = (uint32_t) ((uintptr_t)address - (uintptr_t)dso);
-               (*flags) |= location->flags;
-               return sizeof(location->offset); // offset based
+               *flags = _firehose_tracepoint_flags_pc_style_main_exe;
+               memcpy(buf, (uint32_t[]){ (uintptr_t)address - (uintptr_t)dso },
+                               sizeof(uint32_t));
+               return sizeof(uint32_t);
        } else {
-               location->flags = _firehose_tracepoint_flags_base_caller_pc;
-               (*flags) |= location->flags;
-               location->pc = (uintptr_t)VM_KERNEL_UNSLIDE(address);
-               return sizeof(location->encode_value);
+               *flags = _firehose_tracepoint_flags_pc_style_absolute;
+               memcpy(buf, (uintptr_t[]){ VM_KERNEL_UNSLIDE(address) }, sizeof(uintptr_t));
+#if __LP64__
+               return 6; // 48 bits are enough
+#else
+               return sizeof(uintptr_t);
+#endif
        }
 }
 
 
 OS_ALWAYS_INLINE
-inline bool
-_os_log_buffer_pack(uint8_t *buffdata, unsigned int *buffdata_sz, os_log_buffer_context_t ctx)
+static inline size_t
+_os_log_buffer_pack(uint8_t *buffdata, size_t buffdata_sz,
+               os_log_buffer_context_t ctx)
 {
-    os_log_buffer_t buffer = ctx->buffer;
-    uint16_t buffer_sz = (uint16_t) (sizeof(*ctx->buffer) + ctx->content_sz);
-    uint16_t total_sz = buffer_sz + ctx->pubdata_sz;
-
-    // [buffer] [pubdata]
-    if (total_sz >= (*buffdata_sz)) {
-        return false;
-    }
-
-    memcpy(buffdata, buffer, buffer_sz);
-    memcpy(&buffdata[buffer_sz], ctx->pubdata, ctx->pubdata_sz);
+       os_log_buffer_t buffer = ctx->buffer;
+       size_t buffer_sz = sizeof(*ctx->buffer) + ctx->content_sz;
+       size_t total_sz  = buffer_sz + ctx->pubdata_sz;
 
-    (*buffdata_sz) = total_sz;
+       if (total_sz > buffdata_sz) {
+               return 0;
+       }
 
-    return true;
+       memcpy(buffdata, buffer, buffer_sz);
+       memcpy(&buffdata[buffer_sz], ctx->pubdata, ctx->pubdata_sz);
+       return total_sz;
 }
 
 static void
@@ -350,48 +347,37 @@ _os_log_actual(os_log_t oslog __unused, os_log_type_t type, const char *format,
        firehose_stream_t stream;
        firehose_tracepoint_flags_t flags = 0;
        firehose_tracepoint_id_u trace_id;
-       os_trace_location_u addr_loc;
        uint8_t buffdata[OS_LOG_BUFFER_MAX_SIZE];
-       unsigned int buffdata_sz = (unsigned int) sizeof(buffdata);
-       size_t buffdata_idx = 0;
-       size_t addr_loc_sz;
+       size_t addr_len = 0, buffdata_sz;
        uint64_t timestamp;
        uint64_t thread_id;
 
-       memset(&addr_loc, 0, sizeof(addr_loc));
-
        // dso == the start of the binary that was loaded
-       // codes are the offset into the binary from start
-       addr_loc_sz = _os_trace_location_for_address(dso, addr, &addr_loc, &flags);
+       addr_len = _os_trace_write_location_for_address(buffdata, dso, addr, &flags);
+       buffdata_sz = _os_log_buffer_pack(buffdata + addr_len,
+                       sizeof(buffdata) - addr_len, context);
+       if (buffdata_sz == 0) {
+               return;
+       }
+       buffdata_sz += addr_len;
 
        timestamp = firehose_tracepoint_time(firehose_activity_flags_default);
        thread_id = thread_tid(current_thread());
 
-       // insert the location
-       memcpy(&buffdata[buffdata_idx], &addr_loc, addr_loc_sz);
-       buffdata_idx += addr_loc_sz;
-
        // create trace_id after we've set additional flags
        trace_id.ftid_value = FIREHOSE_TRACE_ID_MAKE(firehose_tracepoint_namespace_log,
                        type, flags, _os_trace_offset(dso, format, flags));
 
-       // pack the buffer data after the header data
-       buffdata_sz -= buffdata_idx; // subtract the existing content from the size
-       _os_log_buffer_pack(&buffdata[buffdata_idx], &buffdata_sz, context);
-       buffdata_sz += buffdata_idx; // add the header amount too
-
        if (FALSE) {
                firehose_debug_trace(stream, trace_id.ftid_value, timestamp,
                                        format, buffdata, buffdata_sz);
        }
-
        if (type == OS_LOG_TYPE_INFO || type == OS_LOG_TYPE_DEBUG) {
                stream = firehose_stream_memory;
        }
        else {
                stream = firehose_stream_persist;
        }
-
        _firehose_trace(stream, trace_id, timestamp, buffdata, buffdata_sz);
 }
 
@@ -401,7 +387,7 @@ _firehose_trace(firehose_stream_t stream, firehose_tracepoint_id_u ftid,
 {
        const uint16_t ft_size = offsetof(struct firehose_tracepoint_s, ft_data);
        const size_t _firehose_chunk_payload_size =
-                       sizeof(((struct firehose_buffer_chunk_s *)0)->fbc_data);
+                       sizeof(((struct firehose_chunk_s *)0)->fc_data);
 
        firehose_tracepoint_t ft;
 
@@ -439,20 +425,23 @@ out:
                        }
                        return 0;
                }
-               firehose_buffer_chunk_t fbc = firehose_boot_chunk;
+               firehose_chunk_t fbc = firehose_boot_chunk;
+               long offset;
 
                //only stream available during boot is persist
-               ft = __firehose_buffer_tracepoint_reserve_with_chunk(fbc, stamp, firehose_stream_persist, publen, 0, NULL);
-               if (!fastpath(ft)) {
+               offset = firehose_chunk_tracepoint_try_reserve(fbc, stamp,
+                               firehose_stream_persist, 0, publen, 0, NULL);
+               if (offset <= 0) {
                        (void)hw_atomic_add(&oslog_p_boot_dropped_msgcount, 1);
                        return 0;
                }
-               else {
-                       memcpy(ft->ft_data, pubdata, publen);
-                       __firehose_buffer_tracepoint_flush_chunk(fbc, ft, ftid);
-                       (void)hw_atomic_add(&oslog_p_saved_msgcount, 1);
-                       return ftid.ftid_value;
-               }
+
+               ft = firehose_chunk_tracepoint_begin(fbc, stamp, publen,
+                               thread_tid(current_thread()), offset);
+               memcpy(ft->ft_data, pubdata, publen);
+               firehose_chunk_tracepoint_end(fbc, ft, ftid);
+               (void)hw_atomic_add(&oslog_p_saved_msgcount, 1);
+               return ftid.ftid_value;
        }
        if (!oslog_boot_done) {
                oslog_boot_done = true;
@@ -574,8 +563,9 @@ __firehose_buffer_push_to_logd(firehose_buffer_t fb __unused, bool for_io __unus
 }
 
 void
-__firehose_allocate(vm_offset_t *addr, vm_size_t size __unused) {
-        firehose_buffer_chunk_t kernel_buffer = (firehose_buffer_chunk_t)kernel_firehose_addr;
+__firehose_allocate(vm_offset_t *addr, vm_size_t size __unused)
+{
+        firehose_chunk_t kernel_buffer = (firehose_chunk_t)kernel_firehose_addr;
 
         if (kernel_firehose_addr) {
                 *addr = kernel_firehose_addr;
@@ -586,8 +576,8 @@ __firehose_allocate(vm_offset_t *addr, vm_size_t size __unused) {
         }
         // Now that we are done adding logs to this chunk, set the number of writers to 0
         // Without this, logd won't flush when the page is full
-        firehose_boot_chunk->fbc_pos.fbc_refcnt = 0;
-        memcpy(&kernel_buffer[FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT - 1], (const void *)firehose_boot_chunk, FIREHOSE_BUFFER_CHUNK_SIZE);
+        firehose_boot_chunk->fc_pos.fcp_refcnt = 0;
+        memcpy(&kernel_buffer[FIREHOSE_BUFFER_KERNEL_CHUNK_COUNT - 1], (const void *)firehose_boot_chunk, FIREHOSE_CHUNK_SIZE);
         return;
 }
 // There isnt a lock held in this case.
index 3c5b311167cb60ac410378fcdc647765c34dd8ec..1ee1c984e5877cbc09f21762d5b33835350520ad 100644 (file)
 
 __BEGIN_DECLS
 
-typedef union {
-    struct {
-#if __LP64__
-        uintptr_t pc : 48;
-#else
-        uintptr_t pc;
-#endif
-        // not encoded
-        firehose_tracepoint_flags_t flags;
-        uintptr_t dso;
-        uuid_t uuid;
-    };
-
-    uint32_t offset;
-    uint64_t vlocation : 48; // we never use the full 64-bits
-
-#if defined(__LP64__)
-    uint8_t encode_value[6]; // 48-bits
-#else
-    uint8_t encode_value[sizeof(uintptr_t)];
-#endif
-} os_trace_location_u;
-
-typedef os_trace_location_u *os_trace_location_t;
-
 OS_ALWAYS_INLINE
 inline uint32_t
 _os_trace_offset(const void *dso, const void *addr, _firehose_tracepoint_flags_activity_t flags __unused)
index 4c56869b8cdaa95d6e99464d792d3f5f1b0a91f9..1e60c8ccfd1f0d41cd7f13bc7a1f54535fd5ecc2 100644 (file)
@@ -114,7 +114,7 @@ static const char * sKernelComponentNames[] = {
 
 static int __whereIsAddr(vm_offset_t theAddr, unsigned long * segSizes, vm_offset_t *segAddrs, int segCount );
 
-#define PLK_SEGMENTS 11
+#define PLK_SEGMENTS 12
 
 static const char * plk_segNames[] = {
     "__TEXT",
@@ -126,6 +126,7 @@ static const char * plk_segNames[] = {
     "__PLK_TEXT_EXEC",
     "__PRELINK_DATA",
     "__PLK_DATA_CONST",
+    "__PLK_LLVM_COV",
     "__PLK_LINKEDIT",
     "__PRELINK_INFO",
     NULL
index 7fbeae05ff02369095997d5634a3bbe68ee6a117..00bf511a20b9bb33532ec798cfafd13a3ddf3dff 100644 (file)
@@ -73,15 +73,15 @@ mach_vm_deallocate(
 {
        kern_return_t rv;
 
+       if (__syscall_logger) {
+               __syscall_logger(stack_logging_type_vm_deallocate, (uintptr_t)target, (uintptr_t)address, (uintptr_t)size, 0, 0);
+       }
+
        rv = _kernelrpc_mach_vm_deallocate_trap(target, address, size);
 
        if (rv == MACH_SEND_INVALID_DEST)
                rv = _kernelrpc_mach_vm_deallocate(target, address, size);
 
-       if (__syscall_logger) {
-               __syscall_logger(stack_logging_type_vm_deallocate, (uintptr_t)target, (uintptr_t)address, (uintptr_t)size, 0, 0);
-       }
-
        return (rv);
 }
 
index bf63951123bd93e77e718447644f397d8b13cd17..ba535082493160fc34cfb0b82abfca8110ec1f04 100644 (file)
@@ -50,6 +50,7 @@ fcntl(int fd, int cmd, ...)
        case F_OFD_SETLKW:
        case F_OFD_SETLKWTIMEOUT:
         case F_PREALLOCATE:
+        case F_PUNCHHOLE:
         case F_SETSIZE:
         case F_RDADVISE:
         case F_LOG2PHYS:
@@ -66,6 +67,7 @@ fcntl(int fd, int cmd, ...)
         case F_ADDFILESIGS_RETURN:
         case F_FINDSIGS:
         case F_TRANSCODEKEY:
+        case F_TRIM_ACTIVE_FILE:
         case F_CHECK_LV:
                arg = va_arg(ap, void *);
                break;
index 10aed0453ea55651a9ddafc344551eb756badf9c..944aaf5136cbf1a6bf332c818bb863752336be7c 100644 (file)
@@ -68,54 +68,16 @@ fs_snapshot_revert(int dirfd, const char *name, uint32_t flags)
     return __fs_snapshot(SNAPSHOT_OP_REVERT, dirfd, name, NULL, NULL, flags);
 }
 
-/*
- * XXX Temporary hack to do what mount_apfs(8) does. This will be removed and
- * replaced with a VFS_IOCTL based implementation in the kernel.
- */
-#include <sys/stat.h>
-#include "strings.h"
-
-#ifndef SNAPSHOT_OP_MOUNT
-#define SNAPSHOT_OP_MOUNT 0x4
-#endif
-
-#define        FS_MOUNT_SNAPSHOT 2
-#define MAX_SNAPSHOT_NAMELEN   256
-
-struct fs_mount_options {
-       uint32_t fs_flags;
-       uint8_t _padding_[2];
-};
-
-struct fs_mount_args {
-       char *specdev;
-       struct fs_mount_options options;
-       uint16_t mode;
-       uint16_t _padding_[3];
-       union {
-               struct {                        // FS_MOUNT_SNAPSHOT
-                       dev_t snap_fsys;
-                       char snap_name[MAX_SNAPSHOT_NAMELEN];
-               };
-               struct {                        // APFS_MOUNT_FOR_CONVERSION
-               };
-       };
-};
+int
+fs_snapshot_root(int dirfd, const char *name, uint32_t flags)
+{
+    return __fs_snapshot(SNAPSHOT_OP_ROOT, dirfd, name, NULL, NULL, flags);
+}
 
 int
 fs_snapshot_mount(int dirfd, const char *dir, const char *snapshot,
     uint32_t flags)
 {
-       struct stat st;
-       struct fs_mount_args mnt_args;
-
-       mnt_args.specdev = NULL;
-       mnt_args.mode = FS_MOUNT_SNAPSHOT;
-       if (fstat(dirfd, &st) == -1)
-               return (-1);
-
-       mnt_args.snap_fsys = st.st_dev;
-       strlcpy(mnt_args.snap_name, snapshot, sizeof(mnt_args.snap_name));
        return (__fs_snapshot(SNAPSHOT_OP_MOUNT, dirfd, snapshot, dir,
-           (void *)&mnt_args, flags));
+           NULL, flags));
 }
index 3a69297ebe6d0ec416b5c127ad867d61e28f7ecc..fb9e726a749c1872bf764686c19436c8cab7e55d 100644 (file)
@@ -62,12 +62,12 @@ munmap(void *addr, size_t len)
        addr = (void *) (((uintptr_t) addr) & ~PAGE_MASK);
        len += offset;
 
-       int result = __munmap(addr, len);
-
        if (__syscall_logger) {
                __syscall_logger(stack_logging_type_vm_deallocate, (uintptr_t)mach_task_self(), (uintptr_t)addr, len, 0, 0);
        }
 
+       int result = __munmap(addr, len);
+
        return result;
 }
 #endif /* NO_SYSCALL_LEGACY */
index b2d1079a8cf36a3af17333bec19825abaf42da81..8dd5d9b570705615a5ef3a885cc7eddd1d765f54 100644 (file)
@@ -39,12 +39,12 @@ extern int __munmap(void *, size_t);
 int
 munmap(void *addr, size_t len)
 {
-    int result = __munmap(addr, len);
-    
     if (__syscall_logger) {
         __syscall_logger(stack_logging_type_vm_deallocate, (uintptr_t)mach_task_self(), (uintptr_t)addr, len, 0, 0);
     }
     
+    int result = __munmap(addr, len);
+
     return result;
 }
 
index 174fa8c3ccb1375390a583fb0319afce485d6056..7457fa1955a7b0b0410c71f176599c765c1d8ff9 100755 (executable)
@@ -52,6 +52,12 @@ then
            MACHINE_ARCH=`echo $ARCHS | cut -d' ' -f 3`
     fi
 fi
+if [[ ( "$MACHINE_ARCH" = "arm64" ) ]]
+then
+    # MACHINE_ARCH *really* needs to be a 32-bit arch to generate vm_map_internal.h correctly, even if there are no 32-bit targets.
+    MACHINE_ARCH="armv7"
+fi
+
 SRC="$SRCROOT/mach"
 MIG_INTERNAL_HEADER_DST="$BUILT_PRODUCTS_DIR/internal_hdr/include/mach"
 MIG_PRIVATE_DEFS_INCFLAGS="-I${SDKROOT}/System/Library/Frameworks/System.framework/PrivateHeaders"
index b05ec67cab0fb4d1f6a031d618ceea34e0902ce3..9edf2627a777bd8a6574f4eba5c119b67dbebf4b 100644 (file)
@@ -311,6 +311,7 @@ LDFLAGS_KERNEL_GEN = \
     -Wl,-sectcreate,"__PLK_TEXT_EXEC",__text,/dev/null \
     -Wl,-sectcreate,__PRELINK_DATA,__data,/dev/null \
     -Wl,-sectcreate,"__PLK_DATA_CONST",__data,/dev/null \
+    -Wl,-sectcreate,"__PLK_LLVM_COV",__llvm_covmap,/dev/null \
     -Wl,-sectcreate,"__PLK_LINKEDIT",__data,/dev/null \
        -Wl,-sectcreate,__PRELINK_INFO,__info,/dev/null \
        -Wl,-new_linker \
@@ -497,6 +498,8 @@ endif
 #
 export VPATH = .:$(SOURCE)
 
+
+
 #
 # Macros that control installation of kernel and its header files
 #
index 061040291fef78f114cc11e2bea1670926f8d291..c19e8e59fa842441d0134674b2ed419e23027b25 100644 (file)
@@ -518,11 +518,39 @@ installsrc:
 #
 .PHONY: clean
 
+CLEAN_RM_DIRS= $(OBJROOT) $(SYMROOT) $(DSTROOT) \
+               $(SRCROOT)/tools/test/BUILD \
+               $(SRCROOT)/tools/tests/darwintests/build \
+               $(SRCROOT)/tools/tests/testkext/build \
+               $(SRCROOT)/libkdd/build \
+               $(SRCROOT)/tools/tests/unit_tests/BUILD \
+               $(SRCROOT)/tools/tests/execperf/BUILD \
+               $(SRCROOT)/tools/tests/packetdrill/BUILD \
+               $(SRCROOT)/tools/tests/perf_index/BUILD
+
+CLEAN_ACTION_DIRS= $(SRCROOT)/tools/tests/MPMMTest \
+               $(SRCROOT)/tools/tests/TLBcoherency \
+               $(SRCROOT)/tools/tests/kqueue_tests \
+               $(SRCROOT)/tools/tests/libMicro \
+               $(SRCROOT)/tools/tests/mktimer \
+               $(SRCROOT)/tools/tests/zero-to-n \
+               $(SRCROOT)/tools/tests/personas
+
 clean:
        @:
-       @rm -f cscope.* 2> /dev/null
-       @rm -f $(OBJROOT)/cscope.genhdrs/* 2> /dev/null  || true
-       @rm -f TAGS 2> /dev/null
+       $(_v)rm -f cscope.* 2> /dev/null
+       $(_v)rm -f TAGS 2> /dev/null
+       $(_v)for cdir in $(CLEAN_RM_DIRS); do \
+               if [ -d $${cdir} ] ; then \
+                       echo "Removing $${cdir}"; \
+                       rm -fr $${cdir} 2> /dev/null  || true ; \
+               fi ; \
+       done
+
+       $(_v)for mcdir in $(CLEAN_ACTION_DIRS); do \
+               make -C $${mcdir} clean; \
+       done
+
 
 #
 # Build source file list for cscope database and tags
index c1cd32b3a9f15007ebb94bbf817b3da3631e7898..358fbb8eddef8ea0fbf7f4c8fe7cccc2c248258a 100644 (file)
@@ -44,6 +44,7 @@
 #include <kern/kalloc.h>
 #include <kern/thread.h>
 #include <kern/cpu_data.h>
+#include <libkern/section_keywords.h>
 
 
 
@@ -109,7 +110,7 @@ extern void serial_putc(char);
 
 static void _serial_putc(int, int, int);
 
-struct console_ops cons_ops[] = {
+SECURITY_READ_ONLY_EARLY(struct console_ops) cons_ops[] = {
     {
         .putc = _serial_putc, .getc = _serial_getc,
     },
@@ -118,7 +119,7 @@ struct console_ops cons_ops[] = {
     },
 };
 
-uint32_t nconsops = (sizeof cons_ops / sizeof cons_ops[0]);
+SECURITY_READ_ONLY_EARLY(uint32_t) nconsops = (sizeof cons_ops / sizeof cons_ops[0]);
 
 uint32_t cons_ops_index = VC_CONS_OPS;
 
@@ -587,10 +588,3 @@ vcgetc(__unused int l, __unused int u, __unused boolean_t wait, __unused boolean
                return 0;
 }
 
-/* So we can re-write the serial device functions at boot-time */
-void
-console_set_serial_ops(struct console_ops * newops)
-{
-       cons_ops[SERIAL_CONS_OPS] = *newops;
-}
-
index 28d5737cd2d16ed1e84caf78ac4aa8b773f69ad1..c6d43f858c4ec88260cc774c7431871694e1111d 100644 (file)
 #include <types.h>
 #include <kern/thread.h>
 #include <console/serial_protos.h>
+#include <libkern/section_keywords.h>
 
 extern void cons_cinput(char ch);              /* The BSD routine that gets characters */
 
-unsigned int serialmode;                               /* Serial mode keyboard and console control */
+SECURITY_READ_ONLY_LATE(unsigned int) serialmode;                              /* Serial mode keyboard and console control */
 
 /*
  *  This routine will start a thread that polls the serial port, listening for
index 99da75451623019482e40d8195ad237f7aeffa05..cf372f624560bb985d56860f93d2c43bcf36870e 100644 (file)
@@ -41,7 +41,7 @@ void serial_keyboard_poll(void);
 
 extern uint32_t serialmode;
 extern uint32_t cons_ops_index;
-extern uint32_t nconsops;
+extern const uint32_t nconsops;
 extern unsigned int disable_serial_output;
 
 int _serial_getc(int unit, int line, boolean_t wait, boolean_t raw);
@@ -55,7 +55,6 @@ boolean_t console_is_serial(void);
 int switch_to_serial_console(void);
 int switch_to_video_console(void);
 void switch_to_old_console(int old_console);
-void console_set_serial_ops( struct console_ops *newops );
 
 #define SERIAL_CONS_OPS 0
 #define VC_CONS_OPS 1
index 8c7f28e421a12a2c2c3028203a2080d2c8dd89e4..87914b4598a3e718e74cd738a03b52b4f37c45a4 100644 (file)
@@ -475,7 +475,7 @@ task_generate_corpse_internal(
 
        /* Create and copy threads from task, returns a ref to thread */
        kr = task_duplicate_map_and_threads(task, p, new_task, &thread,
-                               is64bit, &udata_buffer, &size, &num_udata);
+                               &udata_buffer, &size, &num_udata);
        if (kr != KERN_SUCCESS) {
                goto error_task_generate_corpse;
        }
index 7e784e759b142feb1e715545b6b57b820ba536b1..fea95b8e9011db0bfdd3cadc305090fa3c463a20 100644 (file)
@@ -91,7 +91,6 @@ extern kern_return_t task_duplicate_map_and_threads(
                        void *p,
                        task_t new_task,
                        thread_t *thread,
-                       int is64bit,
                        uint64_t **udata_buffer,
                        int *size,
                        int*num_udata);
index 27dd4ccc6548207673c90de4a110100895666fe4..ebb29b76b8f7c921d881579a8847b2dd3c50b0ef 100644 (file)
 #include <libkern/OSKextLibPrivate.h>
 
 #include <mach/branch_predicates.h>
+#include <libkern/section_keywords.h>
 
 #if    DEBUG
 #define DPRINTF(x...)  kprintf(x)
@@ -169,7 +170,7 @@ typedef struct _cframe_t {
 static unsigned panic_io_port;
 static unsigned        commit_paniclog_to_nvram;
 
-unsigned int debug_boot_arg;
+SECURITY_READ_ONLY_LATE(unsigned int) debug_boot_arg;
 
 /*
  * Backtrace a single frame.
@@ -869,16 +870,6 @@ machine_halt_cpu(void) {
        pmCPUHalt(PM_HALT_DEBUG);
 }
 
-static int pid_from_task(task_t task)
-{
-        int pid = -1;
-
-        if (task->bsd_info)
-                pid = proc_pid(task->bsd_info);
-
-        return pid;
-}
-
 void
 DebuggerWithContext(
        __unused unsigned int   reason,
index 22ca1fd5077ad49ac2f690f1955fb184eaf590aa..ef4652d5cd5244da0f64c4f3bd7fef09df678298 100644 (file)
@@ -61,6 +61,20 @@ atomic_compare_exchange(uintptr_t *target, uintptr_t oldval, uintptr_t newval,
 
 #endif // ATOMIC_PRIVATE
 
+#define os_atomic_rmw_loop(p, ov, nv, m, ...)  ({ \
+               bool _result = false; \
+               typeof(p) _p = (p); \
+               ov = atomic_load_explicit(_p, memory_order_relaxed); \
+               do { \
+                       __VA_ARGS__; \
+                       typeof(ov) _r = (ov); \
+                       _result = atomic_compare_exchange_weak_explicit(_p, &_r, nv, \
+                                       memory_order_##m, memory_order_relaxed); \
+                       (ov) = _r; \
+               } while (__builtin_expect(!_result, 0)); \
+               _result; \
+       })
 
-#endif // _I386_ATOMIC_H_
+#define os_atomic_rmw_loop_give_up(expr) ({ expr; __builtin_trap(); })
 
+#endif // _I386_ATOMIC_H_
index 4e1cf5634c4c13c038a8e4a692559774dd403204..9b7094974e3ca591bb3e0fa832bcce736094a451 100644 (file)
@@ -417,11 +417,8 @@ mach_call_munger(x86_saved_state_t *state)
        struct mach_call_args args = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        x86_saved_state32_t     *regs;
 
-#if PROC_REF_DEBUG
        struct uthread *ut = get_bsdthread_info(current_thread());
-
        uthread_reset_proc_refcount(ut);
-#endif
 
        assert(is_saved_state32(state));
        regs = saved_state32(state);
@@ -505,11 +502,8 @@ mach_call_munger64(x86_saved_state_t *state)
        struct mach_call_args args = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        x86_saved_state64_t     *regs;
 
-#if PROC_REF_DEBUG
        struct uthread *ut = get_bsdthread_info(current_thread());
-
        uthread_reset_proc_refcount(ut);
-#endif
 
        assert(is_saved_state64(state));
        regs = saved_state64(state);
index d4d22ae57ed6f129f6df8cf449548cde734f5c33..2d8abbdb6f4e7de5a76a63c896fe213f10618fb2 100644 (file)
@@ -117,7 +117,12 @@ extern const char  version[];
 extern const char      version_variant[];
 extern int             nx_enabled;
 
-uint64_t               physmap_base, physmap_max;
+/*
+ * Set initial values so that ml_phys_* routines can use the booter's ID mapping
+ * to touch physical space before the kernel's physical aperture exists.
+ */
+uint64_t               physmap_base = 0;
+uint64_t               physmap_max = 4*GB;
 
 pd_entry_t             *KPTphys;
 pd_entry_t             *IdlePTD;
index 47a808c3fdd4262ef85ab3f1162c334d4060bf9a..053de15779873d7857b744802721d40657756525 100644 (file)
@@ -143,7 +143,8 @@ typedef struct _lck_mtx_ext_ {
 #define        LCK_MTX_ATTR_STAT       0x2
 #define        LCK_MTX_ATTR_STATb      1
 
-#define LCK_MTX_EVENT(lck) ((event_t)(((unsigned int*)lck)+(sizeof(lck_mtx_t)-1)/sizeof(unsigned int)))
+#define LCK_MTX_EVENT(lck)        ((event_t)(((unsigned int*)(lck))+(sizeof(lck_mtx_t)-1)/sizeof(unsigned int)))
+#define LCK_EVENT_TO_MUTEX(event) ((lck_mtx_t *)(uintptr_t)(((unsigned int *)(event)) - ((sizeof(lck_mtx_t)-1)/sizeof(unsigned int))))
 
 #else /* MACH_KERNEL_PRIVATE */
 #ifdef XNU_KERNEL_PRIVATE
@@ -206,6 +207,11 @@ typedef struct _lck_rw_t_internal_ {
 
 #define        LCK_RW_TAG_DESTROYED            0x00002007      /* lock marked as Destroyed */
 
+#define RW_LOCK_READER_EVENT(x)   ((event_t) (((unsigned char*) (x)) + (offsetof(lck_rw_t, lck_rw_tag))))
+#define RW_LOCK_WRITER_EVENT(x)   ((event_t) (((unsigned char*) (x)) + (offsetof(lck_rw_t, lck_rw_pad8))))
+#define READ_EVENT_TO_RWLOCK(x)   ((lck_rw_t *)(((unsigned char*)(x) - (offsetof(lck_rw_t, lck_rw_tag)))))
+#define WRITE_EVENT_TO_RWLOCK(x)  ((lck_rw_t *)(((unsigned char*)(x) - (offsetof(lck_rw_t, lck_rw_pad8)))))
+
 #if LOCK_PRIVATE
 
 #define disable_preemption_for_thread(t) ((cpu_data_t GS_RELATIVE *)0UL)->cpu_preemption_level++
index addf910e4c9f4b2f533925d96a4dac1633574aec..9b4639c24da971cdb307344ed94604be70f4dba9 100644 (file)
@@ -126,6 +126,15 @@ decl_simple_lock_data(extern , panic_lock)
 #endif /* USLOCK_DEBUG */
 
 extern unsigned int not_in_kdp;
+extern void kdp_lck_mtx_find_owner(
+       struct waitq *          waitq,
+       event64_t               event,
+       thread_waitinfo_t *     waitinfo);
+
+extern void kdp_rwlck_find_owner(
+       struct waitq *          waitq,
+       event64_t               event,
+       thread_waitinfo_t *     waitinfo);
 
 /*
  *     We often want to know the addresses of the callers
@@ -848,12 +857,6 @@ lck_rw_destroy(
 
 #define DECREMENTER_TIMEOUT 1000000
 
-#define RW_LOCK_READER_EVENT(x)                \
-               ((event_t) (((unsigned char*) (x)) + (offsetof(lck_rw_t, lck_rw_tag))))
-
-#define RW_LOCK_WRITER_EVENT(x)                \
-               ((event_t) (((unsigned char*) (x)) + (offsetof(lck_rw_t, lck_rw_pad8))))
-
 /*
  * We disable interrupts while holding the RW interlock to prevent an
  * interrupt from exacerbating hold time.
@@ -991,6 +994,7 @@ lck_rw_lock_exclusive_gen(
 
                                lck->lck_w_waiting = TRUE;
 
+                               thread_set_pending_block_hint(current_thread(), kThreadWaitKernelRWLockWrite);
                                res = assert_wait(RW_LOCK_WRITER_EVENT(lck), THREAD_UNINT);
                                lck_interlock_unlock(lck, istate);
 
@@ -1069,6 +1073,7 @@ lck_rw_lock_exclusive_gen(
 
                                lck->lck_w_waiting = TRUE;
 
+                               thread_set_pending_block_hint(current_thread(), kThreadWaitKernelRWLockWrite);
                                res = assert_wait(RW_LOCK_WRITER_EVENT(lck), THREAD_UNINT);
                                lck_interlock_unlock(lck, istate);
 
@@ -1330,6 +1335,7 @@ lck_rw_lock_shared_gen(
 
                                lck->lck_r_waiting = TRUE;
 
+                               thread_set_pending_block_hint(current_thread(), kThreadWaitKernelRWLockRead);
                                res = assert_wait(RW_LOCK_READER_EVENT(lck), THREAD_UNINT);
                                lck_interlock_unlock(lck, istate);
 
@@ -1489,6 +1495,7 @@ lck_rw_lock_shared_to_exclusive_success(
 
                                lck->lck_w_waiting = TRUE;
 
+                               thread_set_pending_block_hint(current_thread(), kThreadWaitKernelRWLockUpgrade);
                                res = assert_wait(RW_LOCK_WRITER_EVENT(lck), THREAD_UNINT);
                                lck_interlock_unlock(lck, istate);
 
@@ -2149,6 +2156,7 @@ lck_mtx_lock_wait_x86 (
                thread_unlock(holder);
                splx(s);
        }
+       thread_set_pending_block_hint(self, kThreadWaitKernelMutex);
        assert_wait(LCK_MTX_EVENT(mutex), THREAD_UNINT);
 
        lck_mtx_ilk_unlock(mutex);
@@ -2194,3 +2202,31 @@ kdp_lck_mtx_lock_spin_is_acquired(lck_mtx_t      *lck)
        return FALSE;
 }
 
+void
+kdp_lck_mtx_find_owner(__unused struct waitq * waitq, event64_t event, thread_waitinfo_t * waitinfo)
+{
+       lck_mtx_t * mutex = LCK_EVENT_TO_MUTEX(event);
+       waitinfo->context = VM_KERNEL_UNSLIDE_OR_PERM(mutex);
+       thread_t holder   = (thread_t)mutex->lck_mtx_owner;
+       waitinfo->owner   = thread_tid(holder);
+}
+
+void
+kdp_rwlck_find_owner(__unused struct waitq * waitq, event64_t event, thread_waitinfo_t * waitinfo)
+{
+       lck_rw_t *rwlck = NULL;
+       switch(waitinfo->wait_type) {
+               case kThreadWaitKernelRWLockRead:
+                       rwlck = READ_EVENT_TO_RWLOCK(event);
+                       break;
+               case kThreadWaitKernelRWLockWrite:
+               case kThreadWaitKernelRWLockUpgrade:
+                       rwlck = WRITE_EVENT_TO_RWLOCK(event);
+                       break;
+               default:
+                       panic("%s was called with an invalid blocking type", __FUNCTION__);
+                       break;
+       }
+       waitinfo->context = VM_KERNEL_UNSLIDE_OR_PERM(rwlck);
+       waitinfo->owner = 0;
+}
index 334b6ff0df5749a6dd4e95accac77a18e51ec4dd..76652946c7e98a76dce65f850c51356d66228ddb 100644 (file)
@@ -655,6 +655,9 @@ ml_init_lock_timeout(void)
                TLBTimeOut = LockTimeOut;
        }
 
+#if DEVELOPMENT || DEBUG
+       reportphyreaddelayabs = LockTimeOut;
+#endif
        if (PE_parse_boot_argn("phyreadmaxus", &slto, sizeof (slto))) {
                default_timeout_ns = slto * NSEC_PER_USEC;
                nanoseconds_to_absolutetime(default_timeout_ns, &abstime);
@@ -702,6 +705,7 @@ MACRO_END
                VIRTUAL_TIMEOUT_INFLATE64(LockTimeOutTSC);
                VIRTUAL_TIMEOUT_INFLATE64(TLBTimeOut);
                VIRTUAL_TIMEOUT_INFLATE64(MutexSpin);
+               VIRTUAL_TIMEOUT_INFLATE64(reportphyreaddelayabs);
        }
 
        interrupt_latency_tracker_setup();
index a1e9c39f83eea036b8f7d642123a0277757a9ec1..5e1a44656a8de6e7020010aea62b2889e59adba8 100644 (file)
@@ -219,6 +219,12 @@ unsigned long long ml_phys_read_double(
 unsigned long long ml_phys_read_double_64(
        addr64_t paddr);
 
+unsigned long long ml_io_read(uintptr_t iovaddr, int iovsz);
+unsigned int ml_io_read8(uintptr_t iovaddr);
+unsigned int ml_io_read16(uintptr_t iovaddr);
+unsigned int ml_io_read32(uintptr_t iovaddr);
+unsigned long long ml_io_read64(uintptr_t iovaddr);
+
 /* Write physical address byte */
 void ml_phys_write_byte(
        vm_offset_t paddr, unsigned int data);
@@ -314,7 +320,12 @@ void bzero_phys(
 vm_offset_t ml_stack_remaining(void);
 
 __END_DECLS
-
+#if defined(MACH_KERNEL_PRIVATE)
+__private_extern__ uint64_t
+ml_phys_read_data(uint64_t paddr, int psz);
+__private_extern__ void
+pmap_verify_noncacheable(uintptr_t vaddr);
+#endif /* MACH_KERNEL_PRIVATE */
 #ifdef XNU_KERNEL_PRIVATE
 
 boolean_t ml_fpu_avx_enabled(void);
@@ -336,6 +347,7 @@ boolean_t ml_recent_wake(void);
 
 extern uint64_t reportphyreaddelayabs;
 extern uint32_t reportphyreadosbt;
+extern uint32_t phyreadpanic;
 
 #endif /* XNU_KERNEL_PRIVATE */
 #endif /* _I386_MACHINE_ROUTINES_H_ */
index c0a70f34934cd7839409891baf8c77f3e25e73cd..269ca1914a015441718c15e9e06d8f18f8405773 100644 (file)
@@ -1679,8 +1679,7 @@ static void
 mp_kdp_wait(boolean_t flush, boolean_t isNMI)
 {
        DBG("mp_kdp_wait()\n");
-       /* If an I/O port has been specified as a debugging aid, issue a read */
-       panic_io_port_read();
+
        current_cpu_datap()->debugger_ipi_time = mach_absolute_time();
 #if CONFIG_MCA
        /* If we've trapped due to a machine-check, save MCA registers */
index c85da50bc444bc97c52da4631796a473278f8ca0..38af0db4cc330f9c33ccc9b328e148f4c23282dd 100644 (file)
@@ -502,6 +502,8 @@ ipc_mqueue_send(
                        clock_interval_to_deadline(send_timeout, 1000*NSEC_PER_USEC, &deadline);
                else
                        deadline = 0;
+
+               thread_set_pending_block_hint(cur_thread, kThreadWaitPortSend);
                wresult = waitq_assert_wait64_locked(
                                                &mqueue->imq_wait_queue,
                                                IPC_MQUEUE_FULL,
@@ -587,10 +589,6 @@ extern void ipc_mqueue_override_send(
                    port->ip_receiver != ipc_space_kernel) {
                        dst_pid = task_pid(port->ip_receiver->is_task);
                }
-               printf("%s[%d] could not override mqueue (dst:%d) with 0x%x: "
-                      "queue slots are full, but there are no messages!\n",
-                      proc_name_address(current_task()->bsd_info),
-                      task_pid(current_task()), dst_pid, override);
        }
 #endif
 }
@@ -1084,6 +1082,7 @@ ipc_mqueue_receive_on_thread(
        else
                deadline = 0;
 
+       thread_set_pending_block_hint(thread, kThreadWaitPortReceive);
        wresult = waitq_assert_wait64_locked(&mqueue->imq_wait_queue,
                                             IPC_MQUEUE_RECEIVE,
                                             interruptible,
index 2a83023e83289d83b659c64877007b960d7afae7..af0a534a4027ded7a31a38a21154c694f5e54d4f 100644 (file)
@@ -93,10 +93,10 @@ typedef struct ipc_mqueue {
 #if MACH_FLIPC
                        struct flipc_port       *fport; // Null for local port, or ptr to flipc port
 #endif
-               } __attribute__((__packed__)) port;
+               } port;
                struct {
                        struct waitq_set        setq;
-               } __attribute__((__packed__)) pset;
+               } pset;
        } data;
        struct klist imq_klist;
 } *ipc_mqueue_t;
@@ -132,6 +132,23 @@ typedef struct ipc_mqueue {
 #define imq_held(mq)           waitq_held(&(mq)->imq_wait_queue)
 #define imq_valid(mq)          waitq_valid(&(mq)->imq_wait_queue)
 
+/*
+ * Get an ipc_mqueue pointer from a waitq pointer. These are traditionally the
+ * same pointer, but this conversion makes no assumptions on union structure
+ * member positions - it should allow the waitq to move around in either the
+ * port-set mqueue or the port mqueue independently.
+ */
+#define        imq_from_waitq(waitq)   (waitq_is_set(waitq) ? \
+                                       ((struct ipc_mqueue *)((void *)( \
+                                               (uintptr_t)(waitq) - \
+                                               __offsetof(struct ipc_mqueue, imq_wait_queue)) \
+                                       )) : \
+                                       ((struct ipc_mqueue *)((void *)( \
+                                               (uintptr_t)(waitq) - \
+                                               __offsetof(struct ipc_mqueue, imq_set_queue)) \
+                                       )) \
+                                )
+
 extern void imq_reserve_and_lock(ipc_mqueue_t mq,
                                 uint64_t *reserved_prepost);
 
index 63f533dfa077c02768982935cf4cf5c7829dcc37..aaddd33c2b65f2553a80d1cd490acc3088480e24 100644 (file)
@@ -102,7 +102,7 @@ struct ipc_object {
        ipc_object_bits_t io_bits;
        ipc_object_refs_t io_references;
        lck_spin_t      io_lock_data;
-} __attribute__((__packed__));
+};
 
 /*
  * If another object type needs to participate in io_kotype()-based
@@ -173,6 +173,8 @@ extern void io_free(
        lck_spin_lock(&(io)->io_lock_data)
 #define        io_lock_try(io) \
        lck_spin_try_lock(&(io)->io_lock_data)
+#define io_lock_held_kdp(io) \
+       kdp_lck_spin_is_acquired(&(io)->io_lock_data)
 #define        io_unlock(io) \
        lck_spin_unlock(&(io)->io_lock_data)
 
index 25010f1fc07ec3a2d89d778dab6c51381f943bec..b2f6d8641085d2ff2ac034a72b106c4a50466b0a 100644 (file)
@@ -79,6 +79,8 @@
 #include <kern/misc_protos.h>
 #include <kern/waitq.h>
 #include <kern/policy_internal.h>
+#include <kern/debug.h>
+#include <kern/kcdata.h>
 #include <ipc/ipc_entry.h>
 #include <ipc/ipc_space.h>
 #include <ipc/ipc_object.h>
@@ -110,6 +112,9 @@ void        ipc_port_callstack_init_debug(
        
 #endif /* MACH_ASSERT */
 
+void kdp_mqueue_send_find_owner(struct waitq * waitq, event64_t event, thread_waitinfo_t *waitinfo);
+void kdp_mqueue_recv_find_owner(struct waitq * waitq, event64_t event, thread_waitinfo_t *waitinfo);
+
 void
 ipc_port_release(ipc_port_t port)
 {
@@ -1830,6 +1835,120 @@ ipc_port_finalize(
 #endif /* MACH_ASSERT */
 }
 
+/*
+ *     Routine:        kdp_mqueue_send_find_owner
+ *     Purpose:
+ *             Discover the owner of the ipc_mqueue that contains the input
+ *             waitq object. The thread blocked on the waitq should be
+ *             waiting for an IPC_MQUEUE_FULL event.
+ *     Conditions:
+ *             The 'waitinfo->wait_type' value should already be set to
+ *             kThreadWaitPortSend.
+ *     Note:
+ *             If we find out that the containing port is actually in
+ *             transit, we reset the wait_type field to reflect this.
+ */
+void
+kdp_mqueue_send_find_owner(struct waitq * waitq, __assert_only event64_t event, thread_waitinfo_t * waitinfo)
+{
+       assert(waitinfo->wait_type == kThreadWaitPortSend);
+       assert(event == IPC_MQUEUE_FULL);
+
+       ipc_mqueue_t mqueue = imq_from_waitq(waitq);
+       ipc_port_t port     = ip_from_mq(mqueue); /* we are blocking on send */
+       assert(kdp_is_in_zone(port, "ipc ports"));
+
+       waitinfo->owner = 0;
+       waitinfo->context  = VM_KERNEL_UNSLIDE_OR_PERM(port);
+       if (ip_lock_held_kdp(port)) {
+               /*
+                * someone has the port locked: it may be in an
+                * inconsistent state: bail
+                */
+               waitinfo->owner = STACKSHOT_WAITOWNER_PORT_LOCKED;
+               return;
+       }
+
+       if (ip_active(port)) {
+               if (port->ip_tempowner) {
+                       if (port->ip_imp_task != IIT_NULL) {
+                               /* port is held by a tempowner */
+                               waitinfo->owner = pid_from_task(port->ip_imp_task->iit_task);
+                       } else {
+                               waitinfo->owner = STACKSHOT_WAITOWNER_INTRANSIT;
+                       }
+               } else if (port->ip_receiver_name) {
+                       /* port in a space */
+                       if (port->ip_receiver == ipc_space_kernel) {
+                               /*
+                                * The kernel pid is 0, make this
+                                * distinguishable from no-owner and
+                                * inconsistent port state.
+                                */
+                               waitinfo->owner = STACKSHOT_WAITOWNER_KERNEL;
+                       } else {
+                               waitinfo->owner = pid_from_task(port->ip_receiver->is_task);
+                       }
+               } else if (port->ip_destination != IP_NULL) {
+                       /* port in transit */
+                       waitinfo->wait_type = kThreadWaitPortSendInTransit;
+                       waitinfo->owner     = VM_KERNEL_UNSLIDE_OR_PERM(port->ip_destination);
+               }
+       }
+}
+
+/*
+ *     Routine:        kdp_mqueue_recv_find_owner
+ *     Purpose:
+ *             Discover the "owner" of the ipc_mqueue that contains the input
+ *             waitq object. The thread blocked on the waitq is trying to
+ *             receive on the mqueue.
+ *     Conditions:
+ *             The 'waitinfo->wait_type' value should already be set to
+ *             kThreadWaitPortReceive.
+ *     Note:
+ *             If we find that we are actualy waiting on a port set, we reset
+ *             the wait_type field to reflect this.
+ */
+void
+kdp_mqueue_recv_find_owner(struct waitq * waitq, __assert_only event64_t event, thread_waitinfo_t * waitinfo)
+{
+       assert(waitinfo->wait_type == kThreadWaitPortReceive);
+       assert(event == IPC_MQUEUE_RECEIVE);
+
+       ipc_mqueue_t mqueue = imq_from_waitq(waitq);
+       waitinfo->owner     = 0;
+       if (imq_is_set(mqueue)) { /* we are waiting on a port set */
+               ipc_pset_t set = ips_from_mq(mqueue);
+               assert(kdp_is_in_zone(set, "ipc port sets"));
+
+               /* Reset wait type to specify waiting on port set receive */
+               waitinfo->wait_type = kThreadWaitPortSetReceive;
+               waitinfo->context   = VM_KERNEL_UNSLIDE_OR_PERM(set);
+               if (ips_lock_held_kdp(set)) {
+                       waitinfo->owner = STACKSHOT_WAITOWNER_PSET_LOCKED;
+               }
+               /* There is no specific owner "at the other end" of a port set, so leave unset. */
+       } else {
+               ipc_port_t port   = ip_from_mq(mqueue);
+               assert(kdp_is_in_zone(port, "ipc ports"));
+
+               waitinfo->context = VM_KERNEL_UNSLIDE_OR_PERM(port);
+               if (ip_lock_held_kdp(port)) {
+                       waitinfo->owner = STACKSHOT_WAITOWNER_PORT_LOCKED;
+                       return;
+               }
+
+               if (ip_active(port)) {
+                       if (port->ip_receiver_name != MACH_PORT_NULL) {
+                               waitinfo->owner = port->ip_receiver_name;
+                       } else {
+                               waitinfo->owner = STACKSHOT_WAITOWNER_INTRANSIT;
+                       }
+               }
+       }
+}
+
 #if    MACH_ASSERT
 #include <kern/machine.h>
 
index cde159cd00f6b6f29f7b6aff0902713f2abdf90c..966fcc4487e078651d9ff8e7f434e799ebe317b3 100644 (file)
@@ -161,7 +161,7 @@ struct ipc_port {
        uintptr_t       ip_callstack[IP_CALLSTACK_MAX]; /* stack trace */
        unsigned long   ip_spares[IP_NSPARES]; /* for debugging */
 #endif /* MACH_ASSERT */
-} __attribute__((__packed__));
+};
 
 
 #define ip_references          ip_object.io_references
@@ -186,6 +186,7 @@ struct ipc_port {
 #define        ip_lock_init(port)      io_lock_init(&(port)->ip_object)
 #define        ip_lock(port)           io_lock(&(port)->ip_object)
 #define        ip_lock_try(port)       io_lock_try(&(port)->ip_object)
+#define ip_lock_held_kdp(port) io_lock_held_kdp(&(port)->ip_object)
 #define        ip_unlock(port)         io_unlock(&(port)->ip_object)
 
 #define        ip_reference(port)      io_reference(&(port)->ip_object)
index 863faedcf9de61cb6cac093134f2ce14f6371ed5..a18b9adcdfcade98441e3089db69022715d75216 100644 (file)
@@ -88,10 +88,17 @@ struct ipc_pset {
 #define        ips_active(pset)        io_active(&(pset)->ips_object)
 #define        ips_lock(pset)          io_lock(&(pset)->ips_object)
 #define        ips_lock_try(pset)      io_lock_try(&(pset)->ips_object)
+#define ips_lock_held_kdp(pset)        io_lock_held_kdp(&(pset)->ips_object)
 #define        ips_unlock(pset)        io_unlock(&(pset)->ips_object)
 #define        ips_reference(pset)     io_reference(&(pset)->ips_object)
 #define        ips_release(pset)       io_release(&(pset)->ips_object)
 
+/* get an ipc_pset pointer from an ipc_mqueue pointer */
+#define        ips_from_mq(mq)         ((struct ipc_pset *)((void *)( \
+                                       (char *)(mq) - \
+                                       __offsetof(struct ipc_pset, ips_messages)) \
+                               ))
+
 /* Allocate a port set */
 extern kern_return_t ipc_pset_alloc(
        ipc_space_t             space,
index c5f5cec0cdcef58745c03031938e6b93aecfe65b..e444f392b3ab77f2cc16792e2f418442331e9b0e 100644 (file)
@@ -1310,6 +1310,7 @@ ipc_right_delta(
                mach_port_urefs_t urefs;
                ipc_port_t request = IP_NULL;
                ipc_port_t nsrequest = IP_NULL;
+               ipc_port_t port_to_release = IP_NULL;
                mach_port_mscount_t mscount = 0;
 
                if ((bits & MACH_PORT_TYPE_SEND) == 0)
@@ -1384,7 +1385,7 @@ ipc_right_delta(
                                                name, entry);
 
                                ip_unlock(port);
-                               ip_release(port);
+                               port_to_release = port;
 
                                entry->ie_object = IO_NULL;
                                ipc_entry_dealloc(space, name, entry);
@@ -1399,6 +1400,9 @@ ipc_right_delta(
 
                is_write_unlock(space);
 
+               if (port_to_release != IP_NULL)
+                       ip_release(port_to_release);
+
                if (nsrequest != IP_NULL)
                        ipc_notify_no_senders(nsrequest, mscount);
 
index 136d9181a1c6eee8a89e845f39c23038564a14cd..60662c8ee015a12371e37cfee91cbba33f5b89ca 100644 (file)
@@ -124,6 +124,7 @@ struct ipc_space {
 };
 
 #define        IS_NULL                 ((ipc_space_t) 0)
+#define        IS_INSPECT_NULL         ((ipc_space_inspect_t) 0)
 
 #define is_active(is)          (((is)->is_bits & IS_INACTIVE) != IS_INACTIVE)
 
index 3875ba4e6baf5d282bd9dc5c5240a30f5598ca6b..ee2e9f8d80e52a7e975897f3664f639f82cfca93 100644 (file)
@@ -1146,8 +1146,7 @@ kdp_dumpinfo(
         }
 
         /* gather some stats for reply */
-        kdp_get_dump_info(&rp->type, rp->name, rp->destip, rp->routerip, 
-                          &rp->port);
+        kdp_get_dump_info(rp);
 
        *reply_port = kdp.reply_port;
        *len = rp->hdr.len;
index 6db5cba8ae3239ac9b94865fff3a7566f7254962..8c6135cccb4a8d89ba2d05fde855159a73acac1e 100644 (file)
@@ -36,6 +36,8 @@
 #ifndef __KDP_CORE_H
 #define __KDP_CORE_H
 
+#include <kdp/kdp_protocol.h>
+
 /*
  * Packet types.
  */
@@ -121,8 +123,7 @@ void kdp_panic_dump (void);
 void abort_panic_transfer (void);
 void kdp_set_dump_info(const uint32_t flags, const char *file, const char *destip,
                        const char *routerip, const uint32_t port);
-void kdp_get_dump_info(uint32_t *flags, char *file, char *destip, char *routerip, 
-                       uint32_t *port);
+void kdp_get_dump_info(kdp_dumpinfo_reply_t *rp);
 
 enum kern_dump_type {
        KERN_DUMP_DISK, /* local, on device core dump */
index 336dbfb6b83efcdb69703f3c06b787fd74f4f232..2487c6071fc000ce0a2d98610859a8312ee55b02 100644 (file)
@@ -1112,9 +1112,11 @@ kdp_handler(
                        unsigned short manual_port_unused = 0;
                        if (!manual_hdr->is_reply) {
                                /* process */
+                               int packet_length = manual_pkt.len;
                                kdp_packet((unsigned char *)&manual_pkt.data,
-                                               (int *)&manual_pkt.len,
+                                               &packet_length,
                                                &manual_port_unused);
+                               manual_pkt.len = packet_length;
                        }
                        manual_pkt.input = 0;
                }
@@ -1831,49 +1833,45 @@ kdp_set_dump_info(const uint32_t flags, const char *filename,
 }
 
 void
-kdp_get_dump_info(uint32_t *flags, char *filename, char *destipstr, 
-                  char *routeripstr, uint32_t *port)
+kdp_get_dump_info(kdp_dumpinfo_reply_t *rp)
 {
-       if (destipstr) {
+       if (rp->destip) {
                if (panicd_specified)
-                       strlcpy(destipstr, panicd_ip_str, 
+                       strlcpy(rp->destip, panicd_ip_str,
                                 sizeof(panicd_ip_str));
                else 
-                       destipstr[0] = '\0';
+                       rp->destip[0] = '\0';
        }
 
-       if (routeripstr) {
+       if (rp->routerip) {
                if (router_specified)
-                       strlcpy(routeripstr, router_ip_str,
+                       strlcpy(rp->routerip, router_ip_str,
                                 sizeof(router_ip_str));
                else
-                       routeripstr[0] = '\0';
+                       rp->routerip[0] = '\0';
        }
 
-       if (filename) {
+       if (rp->name) {
                if (corename_specified)
-                       strlcpy(filename, corename_str, 
+                       strlcpy(rp->name, corename_str,
                                 sizeof(corename_str));
                else 
-                       filename[0] = '\0';
+                       rp->name[0] = '\0';
 
        }
 
-       if (port) 
-               *port = panicd_port;
-
-       if (flags) {
-               *flags = 0;
-                if (!panicd_specified) 
-                       *flags |= KDP_DUMPINFO_DISABLE;
-                else if (kdp_flag & PANIC_LOG_DUMP)
-                       *flags |= KDP_DUMPINFO_PANICLOG;
-               else
-                       *flags |= KDP_DUMPINFO_CORE;
+       rp->port = panicd_port;
 
-               if (noresume_on_disconnect)
-                       *flags |= KDP_DUMPINFO_NORESUME;
-       }
+       rp->type = 0;
+       if (!panicd_specified)
+               rp->type |= KDP_DUMPINFO_DISABLE;
+       else if (kdp_flag & PANIC_LOG_DUMP)
+               rp->type |= KDP_DUMPINFO_PANICLOG;
+       else
+               rp->type |= KDP_DUMPINFO_CORE;
+
+       if (noresume_on_disconnect)
+               rp->type |= KDP_DUMPINFO_NORESUME;
 }
 
 
index 70c638b1fddf787035c08ef7759795147549cab4..304d7cff9b48a9d915a15d2bca3294e110a125ce 100644 (file)
@@ -13,7 +13,8 @@ DATAFILES = \
 
 PRIVATE_DATAFILES = \
        debug.h \
-       ecc.h
+       ecc.h \
+       block_hint.h
 
 EXPORT_FILES = \
        affinity.h \
index e0ffbaf9a5a7f7d492c24900d87af79a36c7d70e..f884220e92ba15f27a83f23ed15a01b369ae5a90 100644 (file)
@@ -93,17 +93,17 @@ __END_DECLS
 #if    MACH_ASSERT
 
 #define assert(ex)  \
-       (__builtin_expect(!!((long)(ex)), 1L) ? (void)0 : Assert(__FILE__, __LINE__, # ex))
+       (__builtin_expect(!!((ex)), 1L) ? (void)0 : Assert(__FILE__, __LINE__, # ex))
 #define assertf(ex, fmt, args...) \
-       (__builtin_expect(!!((long)(ex)), 1L) ? (void)0 : __Panic("%s:%d Assertion failed: %s : " fmt, __FILE__, __LINE__, # ex, ##args))
+       (__builtin_expect(!!((ex)), 1L) ? (void)0 : __Panic("%s:%d Assertion failed: %s : " fmt, __FILE__, __LINE__, # ex, ##args))
 #define __assert_only
 
 #elif APPLE_KEXT_ASSERTIONS && !XNU_KERNEL_PRIVATE     /* MACH_ASSERT */
 
 #define assert(ex)  \
-       (__builtin_expect(!!((long)((!kext_assertions_enable) || (ex))), 1L) ? (void)0 : Assert(__FILE__, __LINE__, # ex))
+       (__builtin_expect(!!(((!kext_assertions_enable) || (ex))), 1L) ? (void)0 : Assert(__FILE__, __LINE__, # ex))
 #define assertf(ex, fmt, args...) \
-       (__builtin_expect(!!((long)((!kext_assertions_enable) || (ex))), 1L) ? (void)0 : __Panic("%s:%d Assertion failed: %s : " fmt, __FILE__, __LINE__, # ex, ##args))
+       (__builtin_expect(!!(((!kext_assertions_enable) || (ex))), 1L) ? (void)0 : __Panic("%s:%d Assertion failed: %s : " fmt, __FILE__, __LINE__, # ex, ##args))
 #define __assert_only
 
 #else                          /* APPLE_KEXT_ASSERTIONS && !XNU_KERNEL_PRIVATE */
diff --git a/osfmk/kern/block_hint.h b/osfmk/kern/block_hint.h
new file mode 100644 (file)
index 0000000..c72ec7f
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2000-2016 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        _KERN_BLOCK_HINT_H_
+#define _KERN_BLOCK_HINT_H_
+
+/* This must fit inside a short  */
+typedef enum thread_snapshot_wait_flags {
+       kThreadWaitNone                 = 0x00,
+       kThreadWaitKernelMutex          = 0x01,
+       kThreadWaitPortReceive          = 0x02,
+       kThreadWaitPortSetReceive       = 0x03,
+       kThreadWaitPortSend             = 0x04,
+       kThreadWaitPortSendInTransit    = 0x05,
+       kThreadWaitSemaphore            = 0x06,
+       kThreadWaitKernelRWLockRead     = 0x07,
+       kThreadWaitKernelRWLockWrite    = 0x08,
+       kThreadWaitKernelRWLockUpgrade  = 0x09,
+       kThreadWaitUserLock             = 0x0a,
+       kThreadWaitPThreadMutex         = 0x0b,
+       kThreadWaitPThreadRWLockRead    = 0x0c,
+       kThreadWaitPThreadRWLockWrite   = 0x0d,
+       kThreadWaitPThreadCondVar       = 0x0e,
+       kThreadWaitParkedWorkQueue      = 0x0f,
+} __attribute__((packed)) block_hint_t;
+
+#endif /* !_KERN_BLOCK_HINT_H_ */
index ac79a2345df76e61352f1c47b1d5b3f5badfd3ab..e9e601433aa796ddadef5dcd832a838968f5c0f8 100644 (file)
@@ -49,7 +49,6 @@
 
 /* BSD KERN COMPONENT INTERFACE */
 
-task_t bsd_init_task = TASK_NULL;
 extern unsigned int not_in_kdp; /* Skip acquiring locks if we're in kdp */
  
 thread_t get_firstthread(task_t);
index fc25d65ab0c0053b19ecc5ec252ab14f5b3e2bd0..b05e7a90a3d278aaf5d42f4b1f2fc1d0cd3f64f8 100644 (file)
@@ -236,6 +236,8 @@ enum {
        STACKSHOT_ENABLE_UUID_FAULTING             = 0x200000,
        STACKSHOT_FROM_PANIC                       = 0x400000,
        STACKSHOT_NO_IO_STATS                      = 0x800000,
+       /* Report owners of and pointers to kernel objects that threads are blocked on */
+       STACKSHOT_THREAD_WAITINFO                  = 0x1000000,
 };
 
 #define STACKSHOT_THREAD_SNAPSHOT_MAGIC        0xfeedface
@@ -522,6 +524,9 @@ zone_leaks(const char * zoneName, uint32_t nameLen, leak_site_proc proc, void *
 extern void
 zone_leaks_scan(uintptr_t * instances, uint32_t count, uint32_t zoneSize, uint32_t * found);
 
+extern boolean_t
+kdp_is_in_zone(void *addr, const char *zone_name);
+
 #endif  /* DEBUG || DEVELOPMENT */
 #endif  /* XNU_KERNEL_PRIVATE */
 
index 45da8cbafeb95a2bb253cda7978d214676ae9b59..3cfb2718b012205bb0904e13a5360224b85a35b4 100644 (file)
 
 /* forward declarations */
 task_t convert_port_to_locked_task(ipc_port_t port);
+task_inspect_t convert_port_to_locked_task_inspect(ipc_port_t port);
 
 
 /*
@@ -1232,6 +1233,11 @@ convert_port_to_locked_task(ipc_port_t port)
                task = (task_t) port->ip_kobject;
                assert(task != TASK_NULL);
 
+               if (task == kernel_task && current_task() != kernel_task) {
+                       ip_unlock(port);
+                       return TASK_NULL;
+               }
+
                /*
                 * Normal lock ordering puts task_lock() before ip_lock().
                 * Attempt out-of-order locking here.
@@ -1248,6 +1254,47 @@ convert_port_to_locked_task(ipc_port_t port)
        return TASK_NULL;
 }
 
+/*
+ *     Routine: convert_port_to_locked_task_inspect
+ *     Purpose:
+ *             Internal helper routine to convert from a port to a locked
+ *             task inspect right. Used by internal routines that try to convert from a
+ *             task inspect port to a reference on some task related object.
+ *     Conditions:
+ *             Nothing locked, blocking OK.
+ */
+task_inspect_t
+convert_port_to_locked_task_inspect(ipc_port_t port)
+{
+        int try_failed_count = 0;
+
+       while (IP_VALID(port)) {
+               task_inspect_t task;
+
+               ip_lock(port);
+               if (!ip_active(port) || (ip_kotype(port) != IKOT_TASK)) {
+                       ip_unlock(port);
+                       return TASK_INSPECT_NULL;
+               }
+               task = (task_inspect_t)port->ip_kobject;
+               assert(task != TASK_INSPECT_NULL);
+               /*
+                * Normal lock ordering puts task_lock() before ip_lock().
+                * Attempt out-of-order locking here.
+                */
+               if (task_lock_try((task_t)task)) {
+                       ip_unlock(port);
+                       return task;
+               }
+               try_failed_count++;
+
+               ip_unlock(port);
+               mutex_pause(try_failed_count);
+       }
+       return TASK_INSPECT_NULL;
+}
+
+
 /*
  *     Routine:        convert_port_to_task
  *     Purpose:
@@ -1289,6 +1336,11 @@ convert_port_to_task_with_exec_token(
                        task = (task_t)port->ip_kobject;
                        assert(task != TASK_NULL);
 
+                       if (task == kernel_task && current_task() != kernel_task) {
+                               ip_unlock(port);
+                               return TASK_NULL;
+                       }
+
                        if (exec_token) {
                                *exec_token = task->exec_token;
                        }
@@ -1334,6 +1386,38 @@ convert_port_to_task_name(
        return (task);
 }
 
+/*
+ *     Routine:        convert_port_to_task_inspect
+ *     Purpose:
+ *             Convert from a port to a task inspection right
+ *             Doesn't consume the port ref; produces a task ref,
+ *             which may be null.
+ *     Conditions:
+ *             Nothing locked.
+ */
+task_inspect_t
+convert_port_to_task_inspect(
+       ipc_port_t              port)
+{
+       task_inspect_t task = TASK_INSPECT_NULL;
+
+       if (IP_VALID(port)) {
+               ip_lock(port);
+
+               if (ip_active(port)     &&
+                   ip_kotype(port) == IKOT_TASK) {
+                       task = (task_inspect_t)port->ip_kobject;
+                       assert(task != TASK_INSPECT_NULL);
+
+                       task_reference_internal(task);
+               }
+
+               ip_unlock(port);
+       }
+
+       return (task);
+}
+
 /*
  *     Routine:        convert_port_to_task_suspension_token
  *     Purpose:
@@ -1398,6 +1482,38 @@ convert_port_to_space(
        return (space);
 }
 
+/*
+ *     Routine:        convert_port_to_space_inspect
+ *     Purpose:
+ *             Convert from a port to a space inspect right.
+ *             Doesn't consume the port ref; produces a space inspect ref,
+ *             which may be null.
+ *     Conditions:
+ *             Nothing locked.
+ */
+ipc_space_inspect_t
+convert_port_to_space_inspect(
+       ipc_port_t      port)
+{
+       ipc_space_inspect_t space;
+       task_inspect_t task;
+
+       task = convert_port_to_locked_task_inspect(port);
+
+       if (task == TASK_INSPECT_NULL)
+               return IPC_SPACE_INSPECT_NULL;
+
+       if (!task->active) {
+               task_unlock(task);
+               return IPC_SPACE_INSPECT_NULL;
+       }
+
+       space = (ipc_space_inspect_t)task->itk_space;
+       is_reference((ipc_space_t)space);
+       task_unlock((task_t)task);
+       return space;
+}
+
 /*
  *     Routine:        convert_port_to_map
  *     Purpose:
@@ -1455,6 +1571,11 @@ convert_port_to_thread(
                                ip_kotype(port) == IKOT_THREAD          ) {
                        thread = (thread_t)port->ip_kobject;
                        assert(thread != THREAD_NULL);
+                       if (thread->task && thread->task == kernel_task &&
+                           current_task() != kernel_task) {
+                               ip_unlock(port);
+                               return THREAD_NULL;
+                       }
 
                        thread_reference_internal(thread);
                }
@@ -1465,6 +1586,55 @@ convert_port_to_thread(
        return (thread);
 }
 
+/*
+ *     Routine:        convert_port_to_thread_inspect
+ *     Purpose:
+ *             Convert from a port to a thread inspection right
+ *             Doesn't consume the port ref; produces a thread ref,
+ *             which may be null.
+ *     Conditions:
+ *             Nothing locked.
+ */
+thread_inspect_t
+convert_port_to_thread_inspect(
+       ipc_port_t              port)
+{
+       thread_inspect_t thread = THREAD_INSPECT_NULL;
+
+       if (IP_VALID(port)) {
+               ip_lock(port);
+
+               if (ip_active(port) &&
+                   ip_kotype(port) == IKOT_THREAD) {
+                       thread = (thread_inspect_t)port->ip_kobject;
+                       assert(thread != THREAD_INSPECT_NULL);
+                       thread_reference_internal((thread_t)thread);
+               }
+               ip_unlock(port);
+       }
+
+       return thread;
+}
+
+/*
+ *     Routine:        convert_thread_inspect_to_port
+ *     Purpose:
+ *             Convert from a thread inspect reference to a port.
+ *             Consumes a thread ref;
+ *             As we never export thread inspect ports, always
+ *             creates a NULL port.
+ *     Conditions:
+ *             Nothing locked.
+ */
+
+ipc_port_t
+convert_thread_inspect_to_port(thread_inspect_t thread)
+{
+       thread_deallocate(thread);
+       return IP_NULL;
+}
+
+
 /*
  *     Routine:        port_name_to_thread
  *     Purpose:
@@ -1521,6 +1691,29 @@ port_name_to_task(
        return task;
 }
 
+task_inspect_t
+port_name_to_task_inspect(
+       mach_port_name_t name)
+{
+       ipc_port_t kern_port;
+       kern_return_t kr;
+       task_inspect_t ti = TASK_INSPECT_NULL;
+
+       if (MACH_PORT_VALID(name)) {
+               kr = ipc_object_copyin(current_space(), name,
+                                      MACH_MSG_TYPE_COPY_SEND,
+                                      (ipc_object_t *)&kern_port);
+               if (kr != KERN_SUCCESS)
+                       return TASK_NULL;
+
+               ti = convert_port_to_task_inspect(kern_port);
+
+               if (IP_VALID(kern_port))
+                       ipc_port_release_send(kern_port);
+       }
+       return ti;
+}
+
 /*
  *     Routine:        port_name_to_host
  *     Purpose:
@@ -1565,16 +1758,37 @@ convert_task_to_port(
        ipc_port_t port;
 
        itk_lock(task);
+
        if (task->itk_self != IP_NULL)
                port = ipc_port_make_send(task->itk_self);
        else
                port = IP_NULL;
+
        itk_unlock(task);
 
        task_deallocate(task);
        return port;
 }
 
+/*
+ *     Routine:        convert_task_inspect_to_port
+ *     Purpose:
+ *             Convert from a task inspect reference to a port.
+ *             Consumes a task ref;
+ *             As we never export task inspect ports, always
+ *             creates a NULL port.
+ *     Conditions:
+ *             Nothing locked.
+ */
+ipc_port_t
+convert_task_inspect_to_port(
+       task_inspect_t          task)
+{
+       task_deallocate(task);
+
+       return IP_NULL;
+}
+
 /*
  *     Routine:        convert_task_suspend_token_to_port
  *     Purpose:
@@ -1692,6 +1906,22 @@ space_deallocate(
                is_release(space);
 }
 
+/*
+ *     Routine:        space_inspect_deallocate
+ *     Purpose:
+ *             Deallocate a space inspect ref produced by convert_port_to_space_inspect.
+ *     Conditions:
+ *             Nothing locked.
+ */
+
+void
+space_inspect_deallocate(
+       ipc_space_inspect_t     space)
+{
+       if (space != IS_INSPECT_NULL)
+               is_release((ipc_space_t)space);
+}
+
 /*
  *     Routine:        thread/task_set_exception_ports [kernel call]
  *     Purpose:
index 895eb25445d69dd4631d1b4f7a8efa70232c1da8..c59fdf40a904fb32aa9f457e166faaf6dfd83830 100644 (file)
@@ -127,6 +127,10 @@ extern ipc_port_t retrieve_thread_self_fast(
 extern task_name_t convert_port_to_task_name(
        ipc_port_t      port);
 
+/* Convert from a port to a task inspect */
+extern task_inspect_t convert_port_to_task_inspect(
+       ipc_port_t      port);
+
 /* Convert from a port to a task */
 extern task_t convert_port_to_task(
        ipc_port_t      port);
@@ -139,6 +143,9 @@ convert_port_to_task_with_exec_token(
 extern task_t port_name_to_task(
        mach_port_name_t name);
 
+extern task_t port_name_to_task_inspect(
+       mach_port_name_t name);
+
 extern host_t port_name_to_host(
        mach_port_name_t name);
 
@@ -149,6 +156,10 @@ extern boolean_t ref_task_port_locked(
 extern ipc_space_t convert_port_to_space(
        ipc_port_t      port);
 
+/* Convert from a port to a space inspection right */
+extern ipc_space_inspect_t convert_port_to_space_inspect(
+       ipc_port_t      port);
+
 extern boolean_t ref_space_port_locked(
        ipc_port_t port, ipc_space_t *pspace);
 
@@ -160,6 +171,10 @@ extern vm_map_t convert_port_to_map(
 extern thread_t        convert_port_to_thread(
        ipc_port_t              port);
 
+/* Convert from a port to a thread inspect */
+extern thread_inspect_t        convert_port_to_thread_inspect(
+       ipc_port_t              port);
+
 extern thread_t        port_name_to_thread(
        mach_port_name_t        port_name);
 
@@ -167,4 +182,7 @@ extern thread_t     port_name_to_thread(
 extern void space_deallocate(
        ipc_space_t             space);
 
+extern void space_inspect_deallocate(
+       ipc_space_inspect_t     space);
+
 #endif /* _KERN_IPC_TT_H_ */
index 3e1c76d31dc4513b6aa7c39378195e401fc52747..9ed131e8c43359efe92ff5df65142e26e7edf338 100644 (file)
@@ -468,6 +468,7 @@ struct kcdata_type_definition {
 #define STACKSHOT_KCTYPE_STACKSHOT_DURATION 0x91au    /* struct stackshot_duration */
 #define STACKSHOT_KCTYPE_STACKSHOT_FAULT_STATS 0x91bu /* struct stackshot_fault_stats */
 #define STACKSHOT_KCTYPE_KERNELCACHE_LOADINFO  0x91cu /* kernelcache UUID -- same as KCDATA_TYPE_LIBRARY_LOADINFO64 */
+#define STACKSHOT_KCTYPE_THREAD_WAITINFO 0x91du       /* struct stackshot_thread_waitinfo */
 
 struct stack_snapshot_frame32 {
        uint32_t lr;
@@ -709,6 +710,20 @@ struct stackshot_fault_stats {
        uint8_t  sfs_stopped_faulting;      /* we stopped decompressing because we hit the limit */
 } __attribute__((packed));
 
+typedef struct stackshot_thread_waitinfo {
+       uint64_t owner;         /* The thread that owns the object */
+       uint64_t waiter;        /* The thread that's waiting on the object */
+       uint64_t context;       /* A context uniquely identifying the object */
+       uint8_t wait_type;      /* The type of object that the thread is waiting on */
+} __attribute__((packed)) thread_waitinfo_t;
+
+#define STACKSHOT_WAITOWNER_KERNEL         (UINT64_MAX - 1)
+#define STACKSHOT_WAITOWNER_PORT_LOCKED    (UINT64_MAX - 2)
+#define STACKSHOT_WAITOWNER_PSET_LOCKED    (UINT64_MAX - 3)
+#define STACKSHOT_WAITOWNER_INTRANSIT      (UINT64_MAX - 4)
+#define STACKSHOT_WAITOWNER_MTXSPIN        (UINT64_MAX - 5)
+
+
 /**************** definitions for crashinfo *********************/
 
 /*
index dde91f10019857f294db62b0e9fb524bcd232e92..b877ebf814cd87245317244365505a32b1b37ae5 100644 (file)
@@ -37,6 +37,7 @@
 #endif
 #include <sys/appleapiopts.h>
 #include <kern/debug.h>
+#include <kern/block_hint.h>
 #include <uuid/uuid.h>
 
 #include <kdp/kdp_dyld.h>
@@ -67,6 +68,9 @@
 extern unsigned int not_in_kdp;
 
 
+/* indicate to the compiler that some accesses are unaligned */
+typedef uint64_t unaligned_u64 __attribute__((aligned(1)));
+
 extern addr64_t kdp_vtophys(pmap_t pmap, addr64_t va);
 extern void * proc_get_uthread_uu_threadlist(void * uthread_v);
 
@@ -85,7 +89,7 @@ static boolean_t panic_stackshot;
 static boolean_t stack_enable_faulting = FALSE;
 static struct stackshot_fault_stats fault_stats;
 
-static uint64_t * stackshot_duration_outer;
+static unaligned_u64 * stackshot_duration_outer;
 static uint64_t stackshot_microsecs;
 
 void * kernel_stackshot_buf   = NULL; /* Pointer to buffer for stackshots triggered from the kernel and retrieved later */
@@ -107,11 +111,12 @@ boolean_t               stackshot_thread_is_idle_worker_unsafe(thread_t thread);
 static int             kdp_stackshot_kcdata_format(int pid, uint32_t trace_flags, uint32_t *pBytesTraced);
 kern_return_t  kdp_stack_snapshot_geterror(void);
 uint32_t               kdp_stack_snapshot_bytes_traced(void);
-static int             pid_from_task(task_t task);
 static void            kdp_mem_and_io_snapshot(struct mem_and_io_snapshot *memio_snap);
 static boolean_t       kdp_copyin(vm_map_t map, uint64_t uaddr, void *dest, size_t size, boolean_t try_fault, uint32_t *kdp_fault_result);
 static boolean_t       kdp_copyin_word(task_t task, uint64_t addr, uint64_t *result, boolean_t try_fault, uint32_t *kdp_fault_results);
 static uint64_t                proc_was_throttled_from_task(task_t task);
+static void            stackshot_thread_wait_owner_info(thread_t thread, thread_waitinfo_t * waitinfo);
+static int             stackshot_thread_has_valid_waitinfo(thread_t thread);
 
 extern uint32_t workqueue_get_pwq_state_kdp(void *proc);
 
@@ -135,6 +140,15 @@ extern kern_return_t stack_microstackshot(user_addr_t tracebuf, uint32_t tracebu
 
 extern kern_return_t kern_stack_snapshot_with_reason(char* reason);
 extern kern_return_t kern_stack_snapshot_internal(int stackshot_config_version, void *stackshot_config, size_t stackshot_config_size, boolean_t stackshot_from_user);
+/* Used for stackshot_thread_waitinfo_unsafe */
+extern void kdp_lck_mtx_find_owner(struct waitq * waitq, event64_t event, thread_waitinfo_t *waitinfo);
+extern void kdp_sema_find_owner(struct waitq * waitq, event64_t event, thread_waitinfo_t *waitinfo);
+extern void kdp_mqueue_send_find_owner(struct waitq * waitq, event64_t event, thread_waitinfo_t *waitinfo);
+extern void kdp_mqueue_recv_find_owner(struct waitq * waitq, event64_t event, thread_waitinfo_t *waitinfo);
+extern void kdp_ulock_find_owner(struct waitq * waitq, event64_t event, thread_waitinfo_t *waitinfo);
+extern void kdp_rwlck_find_owner(struct waitq * waitq, event64_t event, thread_waitinfo_t *waitinfo);
+extern void kdp_pthread_find_owner(thread_t thread, thread_waitinfo_t *waitinfo);
+extern void *kdp_pthread_get_thread_kwq(thread_t thread);
 
 /*
  * Validates that the given address is both a valid page and has
@@ -779,7 +793,7 @@ kcdata_get_task_ss_flags(task_t task)
 }
 
 static kern_return_t
-kcdata_record_shared_cache_info(kcdata_descriptor_t kcd, task_t task, struct dyld_uuid_info_64_v2 *sys_shared_cache_loadinfo, uint32_t trace_flags, uint64_t *task_snap_ss_flags)
+kcdata_record_shared_cache_info(kcdata_descriptor_t kcd, task_t task, struct dyld_uuid_info_64_v2 *sys_shared_cache_loadinfo, uint32_t trace_flags, unaligned_u64 *task_snap_ss_flags)
 {
        kern_return_t error = KERN_SUCCESS;
        mach_vm_address_t out_addr = 0;
@@ -857,7 +871,7 @@ error_exit:
 }
 
 static kern_return_t
-kcdata_record_uuid_info(kcdata_descriptor_t kcd, task_t task, uint32_t trace_flags, boolean_t have_pmap, uint64_t *task_snap_ss_flags)
+kcdata_record_uuid_info(kcdata_descriptor_t kcd, task_t task, uint32_t trace_flags, boolean_t have_pmap, unaligned_u64 *task_snap_ss_flags)
 {
        boolean_t save_loadinfo_p         = ((trace_flags & STACKSHOT_SAVE_LOADINFO) != 0);
        boolean_t save_kextloadinfo_p     = ((trace_flags & STACKSHOT_SAVE_KEXT_LOADINFO) != 0);
@@ -1024,7 +1038,7 @@ error_exit:
 }
 
 static kern_return_t
-kcdata_record_task_snapshot(kcdata_descriptor_t kcd, task_t task, uint32_t trace_flags, boolean_t have_pmap, uint64_t **task_snap_ss_flags)
+kcdata_record_task_snapshot(kcdata_descriptor_t kcd, task_t task, uint32_t trace_flags, boolean_t have_pmap, unaligned_u64 **task_snap_ss_flags)
 {
        boolean_t collect_delta_stackshot = ((trace_flags & STACKSHOT_COLLECT_DELTA_SNAPSHOT) != 0);
        boolean_t collect_iostats         = !collect_delta_stackshot && !(trace_flags & STACKSHOT_TAILSPIN) && !(trace_flags & STACKSHOT_NO_IO_STATS);
@@ -1037,6 +1051,7 @@ kcdata_record_task_snapshot(kcdata_descriptor_t kcd, task_t task, uint32_t trace
 
        int task_pid           = pid_from_task(task);
        uint64_t task_uniqueid = get_task_uniqueid(task);
+       uint64_t proc_starttime_secs = 0;
 
        kcd_exit_on_error(kcdata_get_memory_addr(kcd, STACKSHOT_KCTYPE_TASK_SNAPSHOT, sizeof(struct task_snapshot_v2), &out_addr));
 
@@ -1044,12 +1059,12 @@ kcdata_record_task_snapshot(kcdata_descriptor_t kcd, task_t task, uint32_t trace
 
        cur_tsnap->ts_unique_pid = task_uniqueid;
        cur_tsnap->ts_ss_flags = kcdata_get_task_ss_flags(task);
-       *task_snap_ss_flags = &cur_tsnap->ts_ss_flags;
+       *task_snap_ss_flags = (unaligned_u64 *)&cur_tsnap->ts_ss_flags;
        cur_tsnap->ts_user_time_in_terminated_threads = task->total_user_time;
        cur_tsnap->ts_system_time_in_terminated_threads = task->total_system_time;
 
-       cur_tsnap->ts_p_start_sec = 0;
-       proc_starttime_kdp(task->bsd_info, &cur_tsnap->ts_p_start_sec, NULL, NULL);
+       proc_starttime_kdp(task->bsd_info, &proc_starttime_secs, NULL, NULL);
+       cur_tsnap->ts_p_start_sec = proc_starttime_secs;
 
        cur_tsnap->ts_task_size = have_pmap ? (pmap_resident_count(task->map->pmap) * PAGE_SIZE) : 0;
        cur_tsnap->ts_max_resident_size = get_task_resident_max(task);
@@ -1085,7 +1100,7 @@ error_exit:
 }
 
 static kern_return_t
-kcdata_record_task_delta_snapshot(kcdata_descriptor_t kcd, task_t task, boolean_t have_pmap, uint64_t **task_snap_ss_flags)
+kcdata_record_task_delta_snapshot(kcdata_descriptor_t kcd, task_t task, boolean_t have_pmap, unaligned_u64 **task_snap_ss_flags)
 {
        kern_return_t error                       = KERN_SUCCESS;
        struct task_delta_snapshot_v2 * cur_tsnap = NULL;
@@ -1100,7 +1115,7 @@ kcdata_record_task_delta_snapshot(kcdata_descriptor_t kcd, task_t task, boolean_
 
        cur_tsnap->tds_unique_pid = task_uniqueid;
        cur_tsnap->tds_ss_flags = kcdata_get_task_ss_flags(task);
-       *task_snap_ss_flags = &cur_tsnap->tds_ss_flags;
+       *task_snap_ss_flags = (unaligned_u64 *)&cur_tsnap->tds_ss_flags;
 
        cur_tsnap->tds_user_time_in_terminated_threads = task->total_user_time;
        cur_tsnap->tds_system_time_in_terminated_threads = task->total_system_time;
@@ -1465,12 +1480,17 @@ kdp_stackshot_kcdata_format(int pid, uint32_t trace_flags, uint32_t * pBytesTrac
 
        abs_time = mach_absolute_time();
 
+#if !(DEVELOPMENT || DEBUG)
+       trace_flags &= ~STACKSHOT_THREAD_WAITINFO;
+#endif
+
        /* process the flags */
        boolean_t active_kthreads_only_p  = ((trace_flags & STACKSHOT_ACTIVE_KERNEL_THREADS_ONLY) != 0);
        boolean_t save_donating_pids_p    = ((trace_flags & STACKSHOT_SAVE_IMP_DONATION_PIDS) != 0);
        boolean_t collect_delta_stackshot = ((trace_flags & STACKSHOT_COLLECT_DELTA_SNAPSHOT) != 0);
        boolean_t minimize_nonrunnables   = ((trace_flags & STACKSHOT_TAILSPIN) != 0);
        boolean_t use_fault_path          = ((trace_flags & (STACKSHOT_ENABLE_UUID_FAULTING | STACKSHOT_ENABLE_BT_FAULTING)) != 0);
+       boolean_t save_owner_info         = ((trace_flags & STACKSHOT_THREAD_WAITINFO) != 0);
 
        stack_enable_faulting = (trace_flags & (STACKSHOT_ENABLE_BT_FAULTING));
 
@@ -1556,11 +1576,12 @@ kdp_stackshot_kcdata_format(int pid, uint32_t trace_flags, uint32_t * pBytesTrac
                uint64_t task_uniqueid         = 0;
                int num_delta_thread_snapshots = 0;
                int num_nonrunnable_threads    = 0;
+               int num_waitinfo_threads       = 0;
                uint64_t task_start_abstime    = 0;
                boolean_t task_delta_stackshot = FALSE;
                boolean_t task64 = FALSE, have_map = FALSE, have_pmap = FALSE;
                boolean_t some_thread_ran = FALSE;
-               uint64_t *task_snap_ss_flags = NULL;
+               unaligned_u64 *task_snap_ss_flags = NULL;
 
                if ((task == NULL) || !ml_validate_nofault((vm_offset_t)task, sizeof(struct task))) {
                        error = KERN_FAILURE;
@@ -1657,6 +1678,12 @@ kdp_stackshot_kcdata_format(int pid, uint32_t trace_flags, uint32_t * pBytesTrac
                                        num_nonrunnable_threads++;
                                        break;
                                }
+
+                               /* We want to report owner information regardless of whether a thread
+                                * has changed since the last delta, whether it's a normal stackshot,
+                                * or whether it's nonrunnable */
+                               if (save_owner_info && stackshot_thread_has_valid_waitinfo(thread))
+                                       num_waitinfo_threads++;
                        }
 
                        if (task_delta_stackshot && minimize_nonrunnables) {
@@ -1696,12 +1723,28 @@ kdp_stackshot_kcdata_format(int pid, uint32_t trace_flags, uint32_t * pBytesTrac
                                nonrunnable_tids = (uint64_t *)out_addr;
                        }
 
-                       if (num_delta_thread_snapshots > 0 || num_nonrunnable_threads > 0) {
+                       thread_waitinfo_t *thread_waitinfo = NULL;
+                       int current_waitinfo_index         = 0;
+
+                       if (num_waitinfo_threads > 0) {
+                               kcd_exit_on_error(kcdata_get_memory_addr_for_array(stackshot_kcdata_p, STACKSHOT_KCTYPE_THREAD_WAITINFO,
+                                                                          sizeof(thread_waitinfo_t), num_waitinfo_threads, &out_addr));
+                               thread_waitinfo = (thread_waitinfo_t *)out_addr;
+                       }
+
+                       if (num_delta_thread_snapshots > 0 || num_nonrunnable_threads > 0 || num_waitinfo_threads > 0) {
                                queue_iterate(&task->threads, thread, thread_t, task_threads)
                                {
                                        if (active_kthreads_only_p && thread->kernel_stack == 0)
                                                continue;
 
+                                       /* If we want owner info, we should capture it regardless of its classification */
+                                       if (save_owner_info && stackshot_thread_has_valid_waitinfo(thread)) {
+                                               stackshot_thread_wait_owner_info(
+                                                               thread,
+                                                               &thread_waitinfo[current_waitinfo_index++]);
+                                       }
+
                                        boolean_t thread_on_core;
                                        enum thread_classification thread_classification = classify_thread(thread, &thread_on_core, trace_flags);
 
@@ -1727,9 +1770,13 @@ kdp_stackshot_kcdata_format(int pid, uint32_t trace_flags, uint32_t * pBytesTrac
                                              num_delta_thread_snapshots, current_delta_snapshot_index);
                                }
                                if (current_nonrunnable_index != num_nonrunnable_threads) {
-                                       panic("delta thread snapshot count mismatch while capturing snapshots for task %p. expected %d, found %d", task,
+                                       panic("nonrunnable thread count mismatch while capturing snapshots for task %p. expected %d, found %d", task,
                                              num_nonrunnable_threads, current_nonrunnable_index);
                                }
+                               if (current_waitinfo_index != num_waitinfo_threads) {
+                                       panic("thread wait info count mismatch while capturing snapshots for task %p. expected %d, found %d", task,
+                                             num_waitinfo_threads, current_waitinfo_index);
+                               }
 #endif
                        }
 
@@ -1783,7 +1830,7 @@ kdp_stackshot_kcdata_format(int pid, uint32_t trace_flags, uint32_t * pBytesTrac
        struct stackshot_duration * stackshot_duration = (struct stackshot_duration *)out_addr;
        stackshot_duration->stackshot_duration         = (abs_time_end - abs_time);
        stackshot_duration->stackshot_duration_outer   = 0;
-       stackshot_duration_outer                       = &stackshot_duration->stackshot_duration_outer;
+       stackshot_duration_outer                       = (unaligned_u64 *)&stackshot_duration->stackshot_duration_outer;
 #endif
        stackshot_memcpy((void *)abs_time_addr, &abs_time_end, sizeof(uint64_t));
 
@@ -1800,19 +1847,6 @@ error_exit:
        return error;
 }
 
-static int pid_from_task(task_t task)
-{
-       int pid = -1;
-
-       if (task->bsd_info) {
-               pid = proc_pid(task->bsd_info);
-       } else {
-               pid = task_pid(task);
-       }
-
-       return pid;
-}
-
 static uint64_t
 proc_was_throttled_from_task(task_t task)
 {
@@ -2121,15 +2155,74 @@ machine_trace_thread_clear_validation_cache(void)
 boolean_t
 stackshot_thread_is_idle_worker_unsafe(thread_t thread)
 {
-       /* When the pthread kext puts a worker thread to sleep, it will call
-        * assert_wait on the thread's own threadlist.  see parkit() in
-        * kern_support.c.
+       /* When the pthread kext puts a worker thread to sleep, it will
+        * set kThreadWaitParkedWorkQueue in the block_hint of the thread
+        * struct. See parkit() in kern/kern_support.c in libpthread.
         */
-       struct uthread * uthread = get_bsdthread_info(thread);
-       event64_t threadlist = (event64_t)proc_get_uthread_uu_threadlist(uthread);
-       event64_t wait_event = thread->wait_event;
-       return uthread &&
-               (thread->state & TH_WAIT) &&
-               wait_event &&
-               threadlist == wait_event;
+       return (thread->state & TH_WAIT) &&
+               (thread->block_hint == kThreadWaitParkedWorkQueue);
+}
+
+/* Determine if a thread has waitinfo that stackshot can provide */
+static int
+stackshot_thread_has_valid_waitinfo(thread_t thread)
+{
+       if (!(thread->state & TH_WAIT))
+               return 0;
+
+       switch (thread->block_hint) {
+               // If set to None or is a parked work queue, ignore it
+               case kThreadWaitParkedWorkQueue:
+               case kThreadWaitNone:
+                       return 0;
+               // There is a short window where the pthread kext removes a thread
+               // from its ksyn wait queue before waking the thread up
+               case kThreadWaitPThreadMutex:
+               case kThreadWaitPThreadRWLockRead:
+               case kThreadWaitPThreadRWLockWrite:
+               case kThreadWaitPThreadCondVar:
+                       return (kdp_pthread_get_thread_kwq(thread) != NULL);
+               // All other cases are valid block hints if in a wait state
+               default:
+                       return 1;
+       }
+}
+
+static void
+stackshot_thread_wait_owner_info(thread_t thread, thread_waitinfo_t *waitinfo)
+{
+       waitinfo->waiter    = thread_tid(thread);
+       waitinfo->wait_type = thread->block_hint;
+       switch (waitinfo->wait_type) {
+               case kThreadWaitKernelMutex:
+                       kdp_lck_mtx_find_owner(thread->waitq, thread->wait_event, waitinfo);
+                       break;
+               case kThreadWaitPortReceive:
+                       kdp_mqueue_recv_find_owner(thread->waitq, thread->wait_event, waitinfo);
+                       break;
+               case kThreadWaitPortSend:
+                       kdp_mqueue_send_find_owner(thread->waitq, thread->wait_event, waitinfo);
+                       break;
+               case kThreadWaitSemaphore:
+                       kdp_sema_find_owner(thread->waitq, thread->wait_event, waitinfo);
+                       break;
+               case kThreadWaitUserLock:
+                       kdp_ulock_find_owner(thread->waitq, thread->wait_event, waitinfo);
+                       break;
+               case kThreadWaitKernelRWLockRead:
+               case kThreadWaitKernelRWLockWrite:
+               case kThreadWaitKernelRWLockUpgrade:
+                       kdp_rwlck_find_owner(thread->waitq, thread->wait_event, waitinfo);
+                       break;
+               case kThreadWaitPThreadMutex:
+               case kThreadWaitPThreadRWLockRead:
+               case kThreadWaitPThreadRWLockWrite:
+               case kThreadWaitPThreadCondVar:
+                       kdp_pthread_find_owner(thread, waitinfo);
+                       break;
+               default:
+                       waitinfo->owner = 0;
+                       waitinfo->context = 0;
+                       break;
+       }
 }
index a7e9f41737994c6d819e1816349f78845cd0fe38..6b2434e0d4de799394ff95131630fc37f6d619b0 100644 (file)
@@ -44,6 +44,7 @@
 
 #include <libkern/OSAtomic.h>
 #include <mach/mach_types.h>
+#include <os/overflow.h>
 
 /*
  * Ledger entry flags. Bits in second nibble (masked by 0xF0) are used for
@@ -269,18 +270,24 @@ ledger_entry_add(ledger_template_t template, const char *key,
        /* If the table is full, attempt to double its size */
        if (template->lt_cnt == template->lt_table_size) {
                struct entry_template *new_entries, *old_entries;
-               int old_cnt, old_sz;
+               int old_cnt, old_sz, new_sz = 0;
                spl_t s;
 
                old_cnt = template->lt_table_size;
-               old_sz = (int)(old_cnt * sizeof (struct entry_template));
-               new_entries = kalloc(old_sz * 2);
+               old_sz = old_cnt * (int)(sizeof(struct entry_template));
+               /* double old_sz allocation, but check for overflow */
+               if (os_mul_overflow(old_sz, 2, &new_sz)) {
+                       template_unlock(template);
+                       return -1;
+               }
+               new_entries = kalloc(new_sz);
                if (new_entries == NULL) {
                        template_unlock(template);
-                       return (-1);
+                       return -1;
                }
                memcpy(new_entries, template->lt_entries, old_sz);
                memset(((char *)new_entries) + old_sz, 0, old_sz);
+               /* assume: if the sz didn't overflow, neither will the count */
                template->lt_table_size = old_cnt * 2;
 
                old_entries = template->lt_entries;
@@ -604,10 +611,11 @@ ledger_refill(uint64_t now, ledger_t ledger, int entry)
 
        balance = le->le_credit - le->le_debit;
        due = periods * le->le_limit;
+
        if (balance - due < 0)
                due = balance;
 
-       assert(due >= 0);
+       assertf(due >= 0,"now=%llu, ledger=%p, entry=%d, balance=%lld, due=%lld", now, ledger, entry, balance, due);
 
        OSAddAtomic64(due, &le->le_debit);
 
@@ -864,6 +872,7 @@ kern_return_t
 ledger_zero_balance(ledger_t ledger, int entry)
 {
        struct ledger_entry *le;
+       ledger_amount_t debit, credit;
 
        if (!ENTRY_VALID(ledger, entry))
                return (KERN_INVALID_VALUE);
@@ -871,18 +880,21 @@ ledger_zero_balance(ledger_t ledger, int entry)
        le = &ledger->l_entries[entry];
 
 top:
+       debit = le->le_debit;
+       credit = le->le_credit;
+
        if (le->le_flags & LF_TRACK_CREDIT_ONLY) {
                assert(le->le_debit == 0);
-               if (!OSCompareAndSwap64(le->le_credit, 0, &le->le_credit)) {
+               if (!OSCompareAndSwap64(credit, 0, &le->le_credit)) {
                        goto top;
                }
                lprintf(("%p zeroed %lld->%lld\n", current_thread(), le->le_credit, 0));
-       } else if (le->le_credit > le->le_debit) {
-               if (!OSCompareAndSwap64(le->le_debit, le->le_credit, &le->le_debit))
+       } else if (credit > debit) {
+               if (!OSCompareAndSwap64(debit, credit, &le->le_debit))
                        goto top;
                lprintf(("%p zeroed %lld->%lld\n", current_thread(), le->le_debit, le->le_credit));
-       } else if (le->le_credit < le->le_debit) {
-               if (!OSCompareAndSwap64(le->le_credit, le->le_debit, &le->le_credit))
+       } else if (credit < debit) {
+               if (!OSCompareAndSwap64(credit, debit, &le->le_credit))
                        goto top;
                lprintf(("%p zeroed %lld->%lld\n", current_thread(), le->le_credit, le->le_debit));
        }
index 5141535e3eeb9138e404b396c336ce57faa8c541..1fbb88e0f21439321cba7f6ccdf5d0433be0099e 100644 (file)
@@ -930,6 +930,7 @@ lck_mtx_lock_wait (
                mutex->lck_mtx_waiters++;
        }
 
+       thread_set_pending_block_hint(self, kThreadWaitKernelMutex);
        assert_wait(LCK_MTX_EVENT(mutex), THREAD_UNINT);
        lck_mtx_ilk_unlock(mutex);
 
index 31ab349324800d4d254bc44644a7d5e0d0205c12..30d2135394bb15c89bb2b9e2dc97fb1c60a83942 100644 (file)
@@ -382,3 +382,80 @@ host_get_boot_info(
 
        return (KERN_SUCCESS);
 }
+
+#if CONFIG_DTRACE
+#include <mach/sdt.h>
+#endif
+
+unsigned long long ml_io_read(uintptr_t vaddr, int size) {
+       unsigned long long result = 0;
+       unsigned char s1;
+       unsigned short s2;
+
+#if defined(__x86_64__)
+       uint64_t sabs, eabs;
+       boolean_t istate, timeread = FALSE;
+#if DEVELOPMENT || DEBUG
+       pmap_verify_noncacheable(vaddr);
+#endif /* x86_64 DEVELOPMENT || DEBUG */
+       if (__improbable(reportphyreaddelayabs != 0)) {
+               istate = ml_set_interrupts_enabled(FALSE);
+               sabs = mach_absolute_time();
+               timeread = TRUE;
+       }
+#endif /* x86_64 */
+
+       switch (size) {
+        case 1:
+               s1 = *(volatile unsigned char *)vaddr;
+               result = s1;
+               break;
+        case 2:
+               s2 = *(volatile unsigned short *)vaddr;
+               result = s2;
+               break;
+        case 4:
+               result = *(volatile unsigned int *)vaddr;
+               break;
+       case 8:
+               result = *(volatile unsigned long long *)vaddr;
+               break;
+       default:
+               panic("Invalid size %d for ml_io_read(%p)\n", size, (void *)vaddr);
+               break;
+        }
+
+#if defined(__x86_64__)
+       if (__improbable(timeread == TRUE)) {
+               eabs = mach_absolute_time();
+               (void)ml_set_interrupts_enabled(istate);
+
+               if (__improbable((eabs - sabs) > reportphyreaddelayabs)) {
+                       if (phyreadpanic) {
+                               panic("Read from IO virtual addr 0x%lx took %llu ns, result: 0x%llx (start: %llu, end: %llu), ceiling: %llu", vaddr, (eabs - sabs), result, sabs, eabs, reportphyreaddelayabs);
+                       }
+#if CONFIG_DTRACE
+                       DTRACE_PHYSLAT3(physread, uint64_t, (eabs - sabs),
+                           uint64_t, vaddr, uint32_t, size);
+#endif /* CONFIG_DTRACE */
+               }
+       }
+#endif /* x86_64 */
+       return result;
+}
+
+unsigned int ml_io_read8(uintptr_t vaddr) {
+       return (unsigned) ml_io_read(vaddr, 1);
+}
+
+unsigned int ml_io_read16(uintptr_t vaddr) {
+       return (unsigned) ml_io_read(vaddr, 2);
+}
+
+unsigned int ml_io_read32(uintptr_t vaddr) {
+       return (unsigned) ml_io_read(vaddr, 4);
+}
+
+unsigned long long ml_io_read64(uintptr_t vaddr) {
+       return ml_io_read(vaddr, 8);
+}
index b833398777c8deb73a3af25e531ae4051ebf2e89..7ca764dac6a03e950a4bdc7fdc78b553e628bc96 100644 (file)
@@ -242,12 +242,9 @@ mk_timer_destroy_trap(
  *                !0                      Not success           
  *
  */
-kern_return_t
-mk_timer_arm_trap(
-       struct mk_timer_arm_trap_args *args)
-{
-       mach_port_name_t                name = args->name;
-       uint64_t                        expire_time = args->expire_time;
+
+static kern_return_t
+mk_timer_arm_trap_internal(mach_port_name_t name, uint64_t expire_time, uint64_t mk_leeway, uint64_t mk_timer_flags) {
        mk_timer_t                      timer;
        ipc_space_t                     myspace = current_space();
        ipc_port_t                      port;
@@ -269,26 +266,46 @@ mk_timer_arm_trap(
                        timer->is_armed = TRUE;
 
                        if (expire_time > mach_absolute_time()) {
-                               if (!thread_call_enter_delayed_with_leeway(&timer->call_entry, NULL,
-                                                                          expire_time, 0, THREAD_CALL_DELAY_USER_NORMAL))
+                               uint32_t tcflags = THREAD_CALL_DELAY_USER_NORMAL;
+
+                               if (mk_timer_flags & MK_TIMER_CRITICAL) {
+                                       tcflags = THREAD_CALL_DELAY_USER_CRITICAL;
+                               }
+
+                               if (mk_leeway != 0) {
+                                       tcflags |= THREAD_CALL_DELAY_LEEWAY;
+                               }
+
+                               if (!thread_call_enter_delayed_with_leeway(
+                                       &timer->call_entry, NULL,
+                                       expire_time, mk_leeway, tcflags)) {
+
                                        timer->active++;
-                       }
-                       else {
+                               }
+                       else {
                                if (!thread_call_enter1(&timer->call_entry, NULL))
                                        timer->active++;
                        }
                }
 
                simple_unlock(&timer->lock);
-       }
-       else {
+       } else {
                ip_unlock(port);
                result = KERN_INVALID_ARGUMENT;
        }
-
        return (result);
 }
 
+kern_return_t
+mk_timer_arm_trap(struct mk_timer_arm_trap_args *args) {
+       return mk_timer_arm_trap_internal(args->name, args->expire_time, 0, MK_TIMER_NORMAL);
+}
+
+kern_return_t
+mk_timer_arm_leeway_trap(struct mk_timer_arm_leeway_trap_args *args) {
+       return mk_timer_arm_trap_internal(args->name, args->expire_time, args->mk_leeway, args->mk_timer_flags);
+}
+
 /*
  * mk_timer_cancel_trap: Cancel a timer
  *
index 42cf146c22308ff8ab38792f0ceb897b07302955..5daa832d724d620acffb866b30fa954915b7501f 100644 (file)
@@ -339,7 +339,6 @@ extern boolean_t task_is_marked_importance_denap_receiver(task_t task);
 #define TASK_RUSECPU_FLAGS_DEADLINE                     0x04
 #define TASK_RUSECPU_FLAGS_FATAL_CPUMON                 0x08    /* CPU usage monitor violations are fatal */
 #define TASK_RUSECPU_FLAGS_FATAL_WAKEUPSMON             0x10    /* wakeups monitor violations are fatal */
-#define TASK_RUSECPU_FLAGS_PHYS_FOOTPRINT_EXCEPTION     0x20    /* exceeding physical footprint generates EXC_RESOURCE */
 
 extern void proc_init_cpumon_params(void);
 extern void thread_policy_init(void);
index d633e7ef9e1bc5a62b79b287aa8331d128f3e45b..f2052bb3f21ac508f52d08682a99869b603afba1 100644 (file)
@@ -677,6 +677,7 @@ thread_unblock(
        thread->quantum_remaining = 0;
        thread->computation_metered = 0;
        thread->reason = AST_NONE;
+       thread->block_hint = kThreadWaitNone;
 
        /* Obtain power-relevant interrupt and "platform-idle exit" statistics.
         * We also account for "double hop" thread signaling via
@@ -813,11 +814,19 @@ thread_mark_wait_locked(
 
                thread->state |= (interruptible) ? TH_WAIT : (TH_WAIT | TH_UNINT);
                thread->at_safe_point = at_safe_point;
+
+               /* TODO: pass this through assert_wait instead, have
+                * assert_wait just take a struct as an argument */
+               assert(!thread->block_hint);
+               thread->block_hint = thread->pending_block_hint;
+               thread->pending_block_hint = kThreadWaitNone;
+
                return (thread->wait_result = THREAD_WAITING);
        }
        else
        if (thread->sched_flags & TH_SFLAG_ABORTSAFELY)
                thread->sched_flags &= ~TH_SFLAG_ABORTED_MASK;
+       thread->pending_block_hint = kThreadWaitNone;
 
        return (thread->wait_result = THREAD_INTERRUPTED);
 }
@@ -2696,6 +2705,7 @@ thread_dispatch(
                machine_thread_going_on_core(self, THREAD_URGENCY_NONE, 0, processor->last_dispatch);
        }
 
+       assert(self->block_hint == kThreadWaitNone);
        self->computation_epoch = processor->last_dispatch;
        self->reason = AST_NONE;
        processor->starting_pri = self->sched_pri;
@@ -4874,3 +4884,7 @@ void thread_set_options(uint32_t thopt) {
        thread_unlock(t);
        splx(x);
 }
+
+void thread_set_pending_block_hint(thread_t thread, block_hint_t block_hint) {
+       thread->pending_block_hint = block_hint;
+}
index a42ecb7b0541b01ffbf87c687e529bd698646800..ca3227ec100577b54bc1e3f85670793610ca227e 100644 (file)
@@ -73,6 +73,7 @@
 #include <kern/kern_types.h>
 #include <kern/thread.h>
 #include <sys/cdefs.h>
+#include <kern/block_hint.h>
 
 #ifdef MACH_KERNEL_PRIVATE
 
@@ -411,6 +412,13 @@ extern thread_t thread_wakeup_identify(event_t event, int priority);
 
 #endif /* XNU_KERNEL_PRIVATE */
 
+#ifdef KERNEL_PRIVATE
+/* Set pending block hint for a particular object before we go into a wait state */
+extern void            thread_set_pending_block_hint(
+                                                       thread_t                        thread,
+                                                       block_hint_t                    block_hint);
+#endif /* KERNEL_PRIVATE */
+
 /* Context switch */
 extern wait_result_t   thread_block(
                                                        thread_continue_t       continuation);
index fc09bb646998899a523dd129c31f0b85802d4779..7f0fca49394dc3234c440afd9ae3c2b7828c0328 100644 (file)
@@ -119,6 +119,12 @@ semaphore_wait_internal(
                        int                             option,
                        void (*caller_cont)(kern_return_t));
 
+void
+kdp_sema_find_owner(
+                       struct waitq *          waitq,
+                       event64_t               event,
+                       thread_waitinfo_t *     waitinfo);
+
 static __inline__ uint64_t
 semaphore_deadline(
        unsigned int            sec,
@@ -687,6 +693,8 @@ semaphore_wait_internal(
                thread_t        self = current_thread();
 
                wait_semaphore->count = -1;  /* we don't keep an actual count */
+
+               thread_set_pending_block_hint(self, kThreadWaitSemaphore);
                (void)waitq_assert_wait64_locked(
                                        &wait_semaphore->waitq,
                                        SEMAPHORE_EVENT,
@@ -1171,4 +1179,15 @@ semaphore_dereference(
        zfree(semaphore_zone, semaphore);
 }
 
+#define WAITQ_TO_SEMA(wq) ((semaphore_t) ((uintptr_t)(wq) - offsetof(struct semaphore, waitq)))
+void
+kdp_sema_find_owner(struct waitq * waitq, __assert_only event64_t event, thread_waitinfo_t * waitinfo)
+{
+       semaphore_t sem = WAITQ_TO_SEMA(waitq);
+       assert(event == SEMAPHORE_EVENT);
+       assert(kdp_is_in_zone(sem, "semaphores"));
 
+       waitinfo->context = VM_KERNEL_UNSLIDE_OR_PERM(sem->port);
+       if (sem->owner)
+               waitinfo->owner = pid_from_task(sem->owner);
+}
index e413d30c213acc3dbe312fced82b98281fd0b25f..a0c1d38e32911ceea1f56c7b665bcb56cb1c20c3 100644 (file)
 #include <mach/mach_host_server.h>
 #include <mach/mach_syscalls.h>
 #include <sys/kdebug.h>
+#include <kern/ast.h>
 
 #ifdef MACH_BSD
 extern void workqueue_thread_yielded(void);
 extern sched_call_t workqueue_get_sched_callback(void);
 #endif /* MACH_BSD */
 
+extern wait_result_t thread_handoff_reason(thread_t thread, ast_t reason);
 
 /* Called from commpage to take a delayed preemption when exiting
  * the "Preemption Free Zone" (PFZ).
index f5d963b11347b877400e085cd6446a39f67561ce..e9529cfb13a2288027aa04fe16d89507b912fbbc 100644 (file)
@@ -197,8 +197,8 @@ const mach_trap_t   mach_trap_table[MACH_TRAP_TABLE_COUNT] = {
 /* 91 */       MACH_TRAP(mk_timer_create_trap, 0, 0, NULL),
 /* 92 */       MACH_TRAP(mk_timer_destroy_trap, 1, 1, munge_w),
 /* 93 */       MACH_TRAP(mk_timer_arm_trap, 2, 3, munge_wl),
-/* 94 */       MACH_TRAP(mk_timer_cancel_trap, 2, 2, munge_ww),                
-/* 95 */       MACH_TRAP(kern_invalid, 0, 0, NULL),            
+/* 94 */       MACH_TRAP(mk_timer_cancel_trap, 2, 2, munge_ww),
+/* 95 */       MACH_TRAP(mk_timer_arm_leeway_trap, 4, 6, munge_wlll),
 /* traps 64 - 95 reserved (debo) */
 /* 96 */       MACH_TRAP(kern_invalid, 0, 0, NULL),
 /* 97 */       MACH_TRAP(kern_invalid, 0, 0, NULL),
index 25ea7354cfc43815a23fa7d24889d816aac39c32..e39cdf7294e2763eb83e545928a7f8d48836364a 100644 (file)
@@ -278,8 +278,8 @@ extern uint64_t get_dispatchqueue_offset_from_proc(void *);
 
 #if CONFIG_MEMORYSTATUS
 extern void    proc_memstat_terminated(struct proc* p, boolean_t set);
-extern boolean_t memorystatus_turnoff_exception_and_get_fatalness(boolean_t warning, const int max_footprint_mb);
-extern void    memorystatus_on_ledger_footprint_exceeded(int warning, boolean_t is_fatal);
+extern void    memorystatus_on_ledger_footprint_exceeded(int warning, boolean_t memlimit_is_active, boolean_t memlimit_is_fatal);
+extern void    memorystatus_log_exception(const int max_footprint_mb, boolean_t memlimit_is_active, boolean_t memlimit_is_fatal);
 #endif /* CONFIG_MEMORYSTATUS */
 
 #endif /* MACH_BSD */
@@ -895,6 +895,7 @@ init_task_ledgers(void)
        }
 
        ledger_track_credit_only(t, task_ledgers.phys_footprint);
+       ledger_track_credit_only(t, task_ledgers.page_table);
        ledger_track_credit_only(t, task_ledgers.internal);
        ledger_track_credit_only(t, task_ledgers.internal_compressed);
        ledger_track_credit_only(t, task_ledgers.iokit_mapped);
@@ -938,7 +939,7 @@ task_create_internal(
        task_t          parent_task,
        coalition_t     *parent_coalitions __unused,
        boolean_t       inherit_memory,
-       boolean_t       is_64bit,
+       __unused boolean_t      is_64bit,
        uint32_t        t_flags,
        uint32_t        t_procflags,
        task_t          *child_task)            /* OUT */
@@ -1052,6 +1053,8 @@ task_create_internal(
 
        new_task->affinity_space = NULL;
 
+       new_task->t_chud = 0;
+
        new_task->pidsuspended = FALSE;
        new_task->frozen = FALSE;
        new_task->changing_freeze_state = FALSE;
@@ -1194,6 +1197,10 @@ task_create_internal(
                new_task->purged_memory_warn = 0;
                new_task->purged_memory_critical = 0;
                new_task->low_mem_privileged_listener = 0;
+               new_task->memlimit_is_active = 0;
+               new_task->memlimit_is_fatal = 0;
+               new_task->memlimit_active_exc_resource = 0;
+               new_task->memlimit_inactive_exc_resource = 0;
                new_task->task_timer_wakeups_bin_1 = 0;
                new_task->task_timer_wakeups_bin_2 = 0;
                new_task->task_gpu_ns = 0;
@@ -1495,6 +1502,18 @@ task_name_deallocate(
        return(task_deallocate((task_t)task_name));
 }
 
+/*
+ *     task_inspect_deallocate:
+ *
+ *     Drop a task inspection reference.
+ */
+void
+task_inspect_deallocate(
+       task_inspect_t          task_inspect)
+{
+       return(task_deallocate((task_t)task_inspect));
+}
+
 /*
  *     task_suspension_token_deallocate:
  *
@@ -1836,7 +1855,6 @@ task_duplicate_map_and_threads(
                void *p,
                task_t new_task,
                thread_t *thread_ret,
-               int is64bit,
                uint64_t **udata_buffer,
                int *size,
                int *num_udata)
@@ -1885,12 +1903,6 @@ task_duplicate_map_and_threads(
                                     VM_MAP_FORK_PRESERVE_PURGEABLE));
        vm_map_deallocate(oldmap);
 
-       if (is64bit) {
-               vm_map_set_64bit(get_task_map(new_task));
-       } else {
-               vm_map_set_32bit(get_task_map(new_task));
-       }
-
        /* Get all the udata pointers from kqueue */
        est_knotes = proc_list_uptrs(p, NULL, 0);
        if (est_knotes > 0) {
@@ -4625,6 +4637,76 @@ task_get_state(
 }
 
 #if CONFIG_MEMORYSTATUS
+
+boolean_t
+task_get_memlimit_is_active(task_t task)
+{
+       assert (task != NULL);
+
+       return (task->memlimit_is_active ? TRUE : FALSE);
+}
+
+void
+task_set_memlimit_is_active(task_t task, boolean_t memlimit_is_active)
+{
+       assert (task != NULL);
+
+       memlimit_is_active ? (task->memlimit_is_active = 1) : (task->memlimit_is_active = 0);
+}
+
+boolean_t
+task_get_memlimit_is_fatal(task_t task)
+{      
+       assert(task != NULL);
+
+       return (task->memlimit_is_fatal ? TRUE : FALSE);
+}
+
+void
+task_set_memlimit_is_fatal(task_t task, boolean_t memlimit_is_fatal)
+{
+       assert (task != NULL);
+
+       memlimit_is_fatal ? (task->memlimit_is_fatal = 1) : (task->memlimit_is_fatal = 0);
+}
+
+boolean_t
+task_has_triggered_exc_resource(task_t task, boolean_t memlimit_is_active)
+{
+       boolean_t triggered = FALSE;
+
+       assert(task == current_task());
+
+       /* 
+        * Returns true, if task has already triggered an exc_resource exception.
+        */
+
+       if (memlimit_is_active) {
+               triggered = (task->memlimit_active_exc_resource ? TRUE : FALSE);
+       } else {
+               triggered = (task->memlimit_inactive_exc_resource ? TRUE : FALSE);
+       }
+
+       return(triggered);
+}
+
+void
+task_mark_has_triggered_exc_resource(task_t task, boolean_t memlimit_is_active)
+{
+       assert(task == current_task());
+
+       /*
+        * We allow one exc_resource per process per active/inactive limit.
+        * The limit's fatal attribute does not come into play.
+        */
+
+       if (memlimit_is_active) {
+               task->memlimit_active_exc_resource = 1;
+       } else {
+               task->memlimit_inactive_exc_resource = 1;
+       }
+}
+
 #define HWM_USERCORE_MINSPACE 250 // free space (in MB) required *after* core file creation
 
 void __attribute__((noinline))
@@ -4731,38 +4813,50 @@ task_footprint_exceeded(int warning, __unused const void *param0, __unused const
 {
        ledger_amount_t max_footprint, max_footprint_mb;
        task_t task;
-       boolean_t is_fatal;
-       boolean_t trigger_exception;
+        boolean_t is_warning;
+       boolean_t memlimit_is_active;
+       boolean_t memlimit_is_fatal;
 
        if (warning == LEDGER_WARNING_DIPPED_BELOW) {
                /*
                 * Task memory limits only provide a warning on the way up.
                 */
                return;
-       }
+        } else if (warning == LEDGER_WARNING_ROSE_ABOVE) {
+                /*
+                 * This task is in danger of violating a memory limit,
+                 * It has exceeded a percentage level of the limit.
+                 */
+                is_warning = TRUE;
+        } else {
+                /*
+                 * The task has exceeded the physical footprint limit.
+                 * This is not a warning but a true limit violation.
+                 */
+                is_warning = FALSE;
+        }
 
        task = current_task();
 
        ledger_get_limit(task->ledger, task_ledgers.phys_footprint, &max_footprint);
        max_footprint_mb = max_footprint >> 20;
 
-       /*
-        * Capture the trigger exception flag before turning off the exception.
-        */
-       trigger_exception = task->rusage_cpu_flags & TASK_RUSECPU_FLAGS_PHYS_FOOTPRINT_EXCEPTION ? TRUE : FALSE;
-
-       is_fatal = memorystatus_turnoff_exception_and_get_fatalness((warning == LEDGER_WARNING_ROSE_ABOVE) ? TRUE : FALSE, (int)max_footprint_mb);
+       memlimit_is_active = task_get_memlimit_is_active(task);
+       memlimit_is_fatal = task_get_memlimit_is_fatal(task);
 
        /*
-        * If this an actual violation (not a warning),
-        * generate a non-fatal high watermark EXC_RESOURCE.
+        * If this is an actual violation (not a warning), then generate EXC_RESOURCE exception.
+        * We only generate the exception once per process per memlimit (active/inactive limit).
+        * To enforce this, we monitor state based on the  memlimit's active/inactive attribute
+        * and we disable it by marking that memlimit as exception triggered.
         */
-       if ((warning == 0) && trigger_exception) {
-               PROC_CROSSED_HIGH_WATERMARK__SEND_EXC_RESOURCE_AND_SUSPEND((int)max_footprint_mb, is_fatal);
+       if ((is_warning == FALSE) && (!task_has_triggered_exc_resource(task, memlimit_is_active))) {
+               PROC_CROSSED_HIGH_WATERMARK__SEND_EXC_RESOURCE_AND_SUSPEND((int)max_footprint_mb, memlimit_is_fatal);
+               memorystatus_log_exception((int)max_footprint_mb, memlimit_is_active, memlimit_is_fatal);
+               task_mark_has_triggered_exc_resource(task, memlimit_is_active);
        }
 
-       memorystatus_on_ledger_footprint_exceeded((warning == LEDGER_WARNING_ROSE_ABOVE) ? TRUE : FALSE,
-               is_fatal);
+       memorystatus_on_ledger_footprint_exceeded(is_warning, memlimit_is_active, memlimit_is_fatal);
 }
 
 extern int proc_check_footprint_priv(void);
@@ -4775,11 +4869,21 @@ task_set_phys_footprint_limit(
 {
        kern_return_t error;
 
+       boolean_t memlimit_is_active;
+       boolean_t memlimit_is_fatal;
+
        if ((error = proc_check_footprint_priv())) {
                return (KERN_NO_ACCESS);
        }
 
-       return task_set_phys_footprint_limit_internal(task, new_limit_mb, old_limit_mb, FALSE);
+       /*
+        * This call should probably be obsoleted.
+        * But for now, we default to current state.
+        */
+       memlimit_is_active = task_get_memlimit_is_active(task);
+       memlimit_is_fatal = task_get_memlimit_is_fatal(task);
+
+       return task_set_phys_footprint_limit_internal(task, new_limit_mb, old_limit_mb, memlimit_is_active, memlimit_is_fatal);
 }
 
 kern_return_t
@@ -4809,7 +4913,8 @@ task_set_phys_footprint_limit_internal(
        task_t task,
        int new_limit_mb,
        int *old_limit_mb,
-       boolean_t trigger_exception)
+       boolean_t memlimit_is_active,
+       boolean_t memlimit_is_fatal)
 {
        ledger_amount_t old;
 
@@ -4832,6 +4937,10 @@ task_set_phys_footprint_limit_internal(
                ledger_set_limit(task->ledger, task_ledgers.phys_footprint,
                                 max_task_footprint ? max_task_footprint : LEDGER_LIMIT_INFINITY,
                                 max_task_footprint ? max_task_footprint_warning_level : 0);
+
+               task_set_memlimit_is_active(task, memlimit_is_active);
+               task_set_memlimit_is_fatal(task, memlimit_is_fatal);
+
                return (KERN_SUCCESS);
        }
 
@@ -4841,11 +4950,8 @@ task_set_phys_footprint_limit_internal(
 
        task_lock(task);
 
-       if (trigger_exception) {
-               task->rusage_cpu_flags |= TASK_RUSECPU_FLAGS_PHYS_FOOTPRINT_EXCEPTION;
-       } else {
-               task->rusage_cpu_flags &= ~TASK_RUSECPU_FLAGS_PHYS_FOOTPRINT_EXCEPTION;
-       }
+       task_set_memlimit_is_active(task, memlimit_is_active);
+       task_set_memlimit_is_fatal(task, memlimit_is_fatal);
 
        ledger_set_limit(task->ledger, task_ledgers.phys_footprint,
                (ledger_amount_t)new_limit_mb << 20, PHYS_FOOTPRINT_WARNING_LEVEL);
@@ -4982,6 +5088,18 @@ task_findtid(task_t task, uint64_t tid)
        return (found_thread);
 }
 
+int pid_from_task(task_t task)
+{
+       int pid = -1;
+
+       if (task->bsd_info) {
+               pid = proc_pid(task->bsd_info);
+       } else {
+               pid = task_pid(task);
+       }
+
+       return pid;
+}
 
 /*
  * Control the CPU usage monitor for a task.
index 67eeac795cbda902831af9c58c90c4e8d6b8c20c..f1f8212617e492d5f0385d6b98e72cc87c1029a1 100644 (file)
@@ -346,6 +346,12 @@ struct task {
                        low_mem_privileged_listener     :1,     /* if set, task would like to know about pressure changes before other tasks on the system */
                        mem_notify_reserved             :27;    /* reserved for future use */
 
+       uint32_t memlimit_is_active                 :1, /* if set, use active attributes, otherwise use inactive attributes */
+                memlimit_is_fatal                   :1, /* if set, exceeding current memlimit will prove fatal to the task */
+               memlimit_active_exc_resource        :1, /* if set, suppress exc_resource exception when task exceeds active memory limit */
+               memlimit_inactive_exc_resource      :1, /* if set, suppress exc_resource exception when task exceeds inactive memory limit */
+               memlimit_attrs_reserved             :28; /* reserved for future use */
+
        io_stat_info_t          task_io_stats;
        uint64_t                task_immediate_writes __attribute__((aligned(8)));
        uint64_t                task_deferred_writes __attribute__((aligned(8)));
@@ -630,9 +636,17 @@ extern uint64_t get_task_memory_region_count(task_t);
 extern uint64_t get_task_page_table(task_t);
 
 extern kern_return_t task_convert_phys_footprint_limit(int, int *);
-extern kern_return_t task_set_phys_footprint_limit_internal(task_t, int, int *, boolean_t);
+extern kern_return_t task_set_phys_footprint_limit_internal(task_t, int, int *, boolean_t, boolean_t);
 extern kern_return_t task_get_phys_footprint_limit(task_t task, int *limit_mb);
 
+/* Jetsam memlimit attributes */
+extern boolean_t task_get_memlimit_is_active(task_t task);
+extern boolean_t task_get_memlimit_is_fatal(task_t task);
+extern void task_set_memlimit_is_active(task_t task, boolean_t memlimit_is_active);
+extern void task_set_memlimit_is_fatal(task_t task, boolean_t memlimit_is_fatal);
+extern boolean_t task_has_triggered_exc_resource(task_t task, boolean_t memlimit_is_active);
+extern void task_mark_has_triggered_exc_resource(task_t task, boolean_t memlimit_is_active);
+
 extern boolean_t       is_kerneltask(task_t task);
 extern boolean_t       is_corpsetask(task_t task);
 
@@ -685,6 +699,7 @@ extern struct _task_ledger_indices task_ledgers;
 
 /* requires task to be unlocked, returns a referenced thread */
 thread_t task_findtid(task_t task, uint64_t tid);
+int pid_from_task(task_t task);
 
 extern kern_return_t task_wakeups_monitor_ctl(task_t task, uint32_t *rate_hz, int32_t *flags);
 extern kern_return_t task_cpu_usage_monitor_ctl(task_t task, uint32_t *flags);
@@ -728,6 +743,7 @@ extern boolean_t get_task_frozen(task_t);
 /* Convert from a task to a port */
 extern ipc_port_t convert_task_to_port(task_t);
 extern ipc_port_t convert_task_name_to_port(task_name_t);
+extern ipc_port_t convert_task_inspect_to_port(task_inspect_t);
 extern ipc_port_t convert_task_suspension_token_to_port(task_suspension_token_t task);
 
 /* Convert from a port (in this case, an SO right to a task's resume port) to a task. */
@@ -770,6 +786,9 @@ extern void         task_deallocate(
 extern void            task_name_deallocate(
                                        task_name_t             task_name);
 
+extern void            task_inspect_deallocate(
+                                       task_inspect_t          task_inspect);
+
 extern void            task_suspension_token_deallocate(
                                        task_suspension_token_t token);
 __END_DECLS
index a89ca7458a3912eaa14e6738bda1d63e090d29de..2ac70855de489bdb310afc05301cc2a2087b4f80 100644 (file)
@@ -1849,7 +1849,7 @@ proc_inherit_task_role(task_t new_task,
        proc_set_task_policy(new_task, TASK_POLICY_ATTRIBUTE, TASK_POLICY_ROLE, role);
 }
 
-extern task_t bsd_init_task;
+extern void *initproc;
 
 /*
  * Compute the default main thread qos for a task
@@ -1878,7 +1878,7 @@ task_compute_main_thread_qos(task_t task)
                        break;
        }
 
-       if (task == bsd_init_task) {
+       if (task->bsd_info == initproc) {
                /* PID 1 gets a special case */
                primordial_qos = MAX(primordial_qos, THREAD_QOS_USER_INITIATED);
        }
index bf0749afccb675cd91e50f88d83575068c70bd90..8e32c589c7a119ce7dddd367523ab0b98b6a8f97 100644 (file)
@@ -687,6 +687,18 @@ thread_deallocate(
        zfree(thread_zone, thread);
 }
 
+/*
+ *     thread_inspect_deallocate:
+ *
+ *     Drop a thread inspection reference.
+ */
+void
+thread_inspect_deallocate(
+       thread_inspect_t                thread_inspect)
+{
+       return(thread_deallocate((thread_t)thread_inspect));
+}
+
 /*
  *     thread_exception_daemon:
  *
index 36823804258e3250b1ae896169c6fedf71fe80d6..69e0ee2e9067950e21226c2716ef919d0b7b5980 100644 (file)
 #include <kern/task.h>
 #include <kern/exception.h>
 #include <kern/affinity.h>
+#include <kern/debug.h>
+#include <kern/block_hint.h>
 
 #include <kern/waitq.h>
 
@@ -504,6 +506,9 @@ struct thread {
        uint32_t        user_promotions;
        uint16_t        user_promotion_basepri;
 
+       block_hint_t    pending_block_hint;
+       block_hint_t    block_hint;      /* What type of primitive last caused us to block. */
+
        int     iotier_override; /* atomic operations to set, cleared on ret to user */
        io_stat_info_t                  thread_io_stats; /* per-thread I/O statistics */
 
@@ -584,6 +589,9 @@ extern void                 thread_deallocate(
 extern void                    thread_deallocate_safe(
                                                thread_t                thread);
 
+extern void                    thread_inspect_deallocate(
+                                               thread_inspect_t        thread);
+
 extern void                    thread_terminate_self(void);
 
 extern kern_return_t   thread_terminate_internal(
@@ -986,9 +994,9 @@ extern void         uthread_cleanup(task_t, void *, void *);
 extern void            uthread_zone_free(void *); 
 extern void            uthread_cred_free(void *);
 
+extern void            uthread_reset_proc_refcount(void *);
 #if PROC_REF_DEBUG
 extern int             uthread_get_proc_refcount(void *);
-extern void            uthread_reset_proc_refcount(void *);
 extern int             proc_ref_tracking_disabled;
 #endif
 
@@ -1106,6 +1114,7 @@ extern kern_return_t      kernel_thread_start(
 void thread_set_eager_preempt(thread_t thread);
 void thread_clear_eager_preempt(thread_t thread);
 extern ipc_port_t convert_thread_to_port(thread_t);
+extern ipc_port_t convert_thread_inspect_to_port(thread_inspect_t);
 extern boolean_t is_vm_privileged(void);
 extern boolean_t set_vm_privilege(boolean_t);
 #endif /* KERNEL_PRIVATE */
index f844237161fd814ba8441a2a2d4e5dfd52d5ba6f..53f406b1d7dc81080d4a9ed12a96fea8d28a2389 100644 (file)
@@ -191,7 +191,7 @@ thread_call_group_should_add_thread(thread_call_group_t group)
 
        if (group->pending_count > 0) {
                if (group->idle_count > 0) {
-                       panic("Pending work, but threads are idle?");
+                       return FALSE;
                }
 
                thread_count = group->active_count;
index af9bb9eedd8be922efb55b15217d6d52ab02a534..c15f6e90834b8feb24d51f9c045dcf4551bcfa87 100644 (file)
@@ -88,16 +88,7 @@ jenkins_hash(char *key, size_t length)
        #error Unknown size requirement
 #endif
 
-#ifndef MACH_KERNEL_PRIVATE
-
-/*
- * The opaque waitq structure is here mostly for AIO and selinfo,
- * but could potentially be used by other BSD subsystems.
- */
-struct waitq { char opaque[WQ_OPAQUE_SIZE]; } __attribute__((aligned(WQ_OPAQUE_ALIGN)));
-struct waitq_set { char opaque[WQS_OPAQUE_SIZE]; } __attribute__((aligned(WQS_OPAQUE_ALIGN)));
-
-#else /* MACH_KERNEL_PRIVATE */
+#ifdef MACH_KERNEL_PRIVATE
 
 #include <kern/spl.h>
 #include <kern/simple_lock.h>
@@ -344,6 +335,15 @@ extern uint64_t waitq_prepost_reserve(struct waitq *waitq, int extra,
 
 extern void waitq_prepost_release_reserve(uint64_t id);
 
+#else /* !MACH_KERNEL_PRIVATE */
+
+/*
+ * The opaque waitq structure is here mostly for AIO and selinfo,
+ * but could potentially be used by other BSD subsystems.
+ */
+struct waitq { char opaque[WQ_OPAQUE_SIZE]; } __attribute__((aligned(WQ_OPAQUE_ALIGN)));
+struct waitq_set { char opaque[WQS_OPAQUE_SIZE]; } __attribute__((aligned(WQS_OPAQUE_ALIGN)));
+
 #endif /* MACH_KERNEL_PRIVATE */
 
 
index 78ace5f990688529f05fa225e87285a5793e211f..f9649749f7d545854c8ebbfeeeb5fd9f4ca434ba 100644 (file)
@@ -3407,4 +3407,11 @@ kern_wired_diagnose(void)
            top_wired, total_wired, total_zone, osfmk_wired);
 }
 
+boolean_t
+kdp_is_in_zone(void *addr, const char *zone_name)
+{
+       zone_t z;
+       return (zone_element_size(addr, &z) && !strcmp(z->zone_name, zone_name));
+}
+
 #endif /* DEBUG || DEVELOPMENT */
index 5b04f6e8368d79891dc3b1a23b68839e063e54f0..787bfc815b7aa6c27360be1e8edbec02591226a4 100644 (file)
@@ -206,27 +206,24 @@ extern struct zone             zone_array[];
 
 __BEGIN_DECLS
 
-#ifdef XNU_KERNEL_PRIVATE
 
-extern vm_offset_t     zone_map_min_address;
-extern vm_offset_t     zone_map_max_address;
+/* Item definitions for zalloc/zinit/zone_change */
+#define Z_EXHAUST      1       /* Make zone exhaustible        */
+#define Z_COLLECT      2       /* Make zone collectable        */
+#define Z_EXPAND       3       /* Make zone expandable         */
+#define        Z_FOREIGN       4       /* Allow collectable zone to contain foreign elements */
+#define Z_CALLERACCT   5       /* Account alloc/free against the caller */
+#define Z_NOENCRYPT    6       /* Don't encrypt zone during hibernation */
+#define Z_NOCALLOUT    7       /* Don't asynchronously replenish the zone via callouts */
+#define Z_ALIGNMENT_REQUIRED 8
+#define Z_GZALLOC_EXEMPT 9     /* Not tracked in guard allocation mode */
 
 
-/* Allocate from zone */
-extern void *  zalloc(
-                                       zone_t          zone);
 
-/* Free zone element */
-extern void            zfree(
-                                       zone_t          zone,
-                                       void            *elem);
+#ifdef XNU_KERNEL_PRIVATE
 
-/* Create zone */
-extern zone_t  zinit(
-                                       vm_size_t       size,           /* the size of an element */
-                                       vm_size_t       maxmem,         /* maximum memory to use */
-                                       vm_size_t       alloc,          /* allocation size */
-                                       const char      *name);         /* a name for the zone */
+extern vm_offset_t     zone_map_min_address;
+extern vm_offset_t     zone_map_max_address;
 
 
 /* Non-waiting for memory version of zalloc */
@@ -257,24 +254,9 @@ extern int         zfill(
                                        zone_t          zone,
                                        int                     nelem);
 
-/* Change zone parameters */
-extern void            zone_change(
-                                       zone_t                  zone,
-                                       unsigned int    item,
-                                       boolean_t               value);
 extern void            zone_prio_refill_configure(zone_t, vm_size_t);
-/* Item definitions */
-#define Z_EXHAUST      1       /* Make zone exhaustible        */
-#define Z_COLLECT      2       /* Make zone collectable        */
-#define Z_EXPAND       3       /* Make zone expandable         */
-#define        Z_FOREIGN       4       /* Allow collectable zone to contain foreign elements */
-#define Z_CALLERACCT   5       /* Account alloc/free against the caller */
-#define Z_NOENCRYPT    6       /* Don't encrypt zone during hibernation */
-#define Z_NOCALLOUT    7       /* Don't asynchronously replenish the zone via
-                                * callouts
-                                */
-#define Z_ALIGNMENT_REQUIRED 8
-#define Z_GZALLOC_EXEMPT 9     /* Not tracked in guard allocation mode */
+
+/* See above/top of file. Z_* definitions moved so they would be usable by kexts */
 
 /* Preallocate space for zone from zone map */
 extern void            zprealloc(
@@ -357,6 +339,29 @@ void zlog_btlog_unlock(__unused void *);
 
 #endif /* XNU_KERNEL_PRIVATE */
 
+/* Allocate from zone */
+extern void *  zalloc(
+                                       zone_t          zone);
+
+/* Free zone element */
+extern void            zfree(
+                                       zone_t          zone,
+                                       void            *elem);
+
+/* Create zone */
+extern zone_t  zinit(
+                                       vm_size_t       size,           /* the size of an element */
+                                       vm_size_t       maxmem,         /* maximum memory to use */
+                                       vm_size_t       alloc,          /* allocation size */
+                                       const char      *name);         /* a name for the zone */
+
+/* Change zone parameters */
+extern void            zone_change(
+                                       zone_t                  zone,
+                                       unsigned int    item,
+                                       boolean_t               value);
+
+
 __END_DECLS
 
 #endif /* _KERN_ZALLOC_H_ */
index ae49da4b420f3706a5db52431ead499d6b03b73c..f976518d4ec50eb7cfc401366f5ab9f4cfec9947 100644 (file)
@@ -33,8 +33,6 @@
 
 #include <kern/task.h>
 
-extern boolean_t workqueue_get_pwq_exceeded(void *v, boolean_t *exceeded_total,
-                                            boolean_t *exceeded_constrained);
 extern boolean_t memorystatus_proc_is_dirty_unsafe(void *v);
 
 void
@@ -43,8 +41,6 @@ kperf_task_snapshot_sample(struct kperf_task_snapshot *tksn,
 {
        thread_t thread;
        task_t task;
-       boolean_t wq_state_available = FALSE;
-       boolean_t exceeded_total, exceeded_constrained;
 
        BUF_INFO(PERF_TK_SNAP_SAMPLE | DBG_FUNC_START);
 
@@ -70,22 +66,6 @@ kperf_task_snapshot_sample(struct kperf_task_snapshot *tksn,
        }
 #endif
 
-       if (task->bsd_info) {
-               wq_state_available =
-                       workqueue_get_pwq_exceeded(task->bsd_info, &exceeded_total,
-                                                  &exceeded_constrained);
-       }
-       if (wq_state_available) {
-               tksn->kptksn_flags |= KPERF_TASK_FLAG_WQ_FLAGS_VALID;
-
-               if (exceeded_total) {
-                       tksn->kptksn_flags |= KPERF_TASK_FLAG_WQ_EXCEEDED_TOTAL;
-               }
-               if (exceeded_constrained) {
-                       tksn->kptksn_flags |= KPERF_TASK_FLAG_WQ_EXCEEDED_CONSTRAINED;
-               }
-       }
-
        tksn->kptksn_suspend_count = task->suspend_count;
        tksn->kptksn_pageins = task->pageins;
        tksn->kptksn_user_time_in_terminated_threads = task->total_user_time;
index c948506ae55ea9c3df3648c93897f36d4df9e169..079e45c41f090709539590ddf9a42a34bcd48b3d 100644 (file)
@@ -173,6 +173,7 @@ PRIVATE_DATAFILES = \
        mach_traps.h \
        memory_object_types.h \
        mig.h \
+       mk_timer.h \
        processor_info.h \
        resource_notify.defs \
        resource_monitors.h \
index 202b08bce7104b166c6fc394ebc5c440296967c8..dcb43c76e3d47fffc9d9a41dfd1a4d1c4f0ac948 100644 (file)
@@ -248,7 +248,7 @@ routine mach_port_set_mscount(
  */
 
 routine mach_port_get_set_status(
-               task            : ipc_space_t;
+               task            : ipc_space_inspect_t;
                name            : mach_port_name_t;
        out     members         : mach_port_name_array_t);
 
@@ -354,7 +354,7 @@ routine mach_port_set_seqno(
  */
 
 routine mach_port_get_attributes(
-               task            : ipc_space_t;
+               task            : ipc_space_inspect_t;
                name            : mach_port_name_t;
                flavor          : mach_port_flavor_t;
        out     port_info_out   : mach_port_info_t, CountInOut);
@@ -425,7 +425,7 @@ routine     mach_port_get_srights(
  *      Otherwise, KERN_FAILURE is returned.
  */
 routine mach_port_space_info(
-               task            : ipc_space_t;
+               task            : ipc_space_inspect_t;
        out     space_info      : ipc_info_space_t;
        out     table_info      : ipc_info_name_array_t;
        out     tree_info       : ipc_info_tree_name_array_t);
@@ -452,7 +452,7 @@ routine mach_port_dnrequest_info(
  *     mach_port_kernel_object64() call (see below).
  */
 routine        mach_port_kernel_object(
-               task            : ipc_space_t;
+               task            : ipc_space_inspect_t;
                name            : mach_port_name_t;
        out     object_type     : unsigned;
        out     object_addr     : unsigned);
@@ -503,7 +503,7 @@ routine mach_port_extract_member(
  */
 
 routine mach_port_get_context(
-               task            : ipc_space_t;
+               task            : ipc_space_inspect_t;
                name            : mach_port_name_t;
 #ifdef LIBSYSCALL_INTERFACE
        out context             : mach_port_context_t
@@ -534,7 +534,7 @@ routine mach_port_set_context(
  *      Otherwise, KERN_FAILURE is returned.
  */
 routine        mach_port_kobject(
-               task            : ipc_space_t;
+               task            : ipc_space_inspect_t;
                name            : mach_port_name_t;
        out     object_type     : natural_t;
        out     object_addr     : mach_vm_address_t);
@@ -608,7 +608,7 @@ routine mach_port_unguard(
  *      Otherwise, KERN_FAILURE is returned.
  */
 routine mach_port_space_basic_info(
-               task            : ipc_space_t;
+               task            : ipc_space_inspect_t;
        out     basic_info      : ipc_info_space_basic_t);
 
 /* vim: set ft=c : */
index e28dba07e1b568c4be1879f6b8aad3f29d2fec8e..66b5d4c8e0d4c67df4264f4e1319cd0c84197520 100644 (file)
@@ -587,6 +587,15 @@ struct mk_timer_arm_trap_args {
 extern kern_return_t mk_timer_arm_trap(
                                struct mk_timer_arm_trap_args *args);
 
+struct mk_timer_arm_leeway_trap_args {
+       PAD_ARG_(mach_port_name_t, name);
+       PAD_ARG_(uint64_t, mk_timer_flags);
+       PAD_ARG_(uint64_t, expire_time);
+       PAD_ARG_(uint64_t, mk_leeway);
+};
+extern kern_return_t mk_timer_arm_leeway_trap(
+                               struct mk_timer_arm_leeway_trap_args *args);
+
 struct mk_timer_cancel_trap_args {
     PAD_ARG_(mach_port_name_t, name);
     PAD_ARG_(user_addr_t, result_time);
index 4c4f7287b7ca0b3fd236593f2fb659af9399a152..465fe8f0e5ead38c1fff87781024194d531b310b 100644 (file)
@@ -135,6 +135,14 @@ type task_name_t = mach_port_t
 #endif /* KERNEL_SERVER */
                ;
 
+type task_inspect_t = mach_port_t
+#if    KERNEL_SERVER
+               intran: task_inspect_t convert_port_to_task_inspect(mach_port_t)
+               outtran: mach_port_t convert_task_inspect_to_port(task_inspect_t)
+               destructor: task_inspect_deallocate(task_inspect_t)
+#endif /* KERNEL_SERVER */
+               ;
+
 type thread_t = mach_port_t
 #if    KERNEL_SERVER
                intran: thread_t convert_port_to_thread(mach_port_t)
@@ -143,6 +151,14 @@ type thread_t = mach_port_t
 #endif /* KERNEL_SERVER */
                ;
 
+type thread_inspect_t = mach_port_t
+#if    KERNEL_SERVER
+               intran: thread_inspect_t convert_port_to_thread_inspect(mach_port_t)
+               outtran: mach_port_t convert_thread_inspect_to_port(thread_inspect_t)
+               destructor: thread_inspect_deallocate(thread_inspect_t)
+#endif /* KERNEL_SERVER */
+               ;
+
 type thread_act_t = mach_port_t
 #if    KERNEL_SERVER
                intran: thread_act_t convert_port_to_thread(mach_port_t)
@@ -195,6 +211,13 @@ type ipc_space_t = mach_port_t
 #endif /* KERNEL_SERVER */
                ;
 
+type ipc_space_inspect_t = mach_port_t
+#if    KERNEL_SERVER
+               intran: ipc_space_inspect_t convert_port_to_space_inspect(mach_port_t)
+               destructor: space_inspect_deallocate(ipc_space_inspect_t)
+#endif /* KERNEL_SERVER */
+               ;
+
 type vm_prot_t = int;
 type vm_inherit_t = int;
 type vm_purgable_t = int;
index ac870a2b57ed7615d9660633deca98959cacf2e5..d7b745d279d72e11ace00ee29d1694ab1d6beca4 100644 (file)
  * If we are in the kernel, then pick up the kernel definitions for
  * the basic mach types.
  */
-typedef struct task                    *task_t, *task_name_t, *task_suspension_token_t;
-typedef struct thread          *thread_t, *thread_act_t;
-typedef struct ipc_space               *ipc_space_t;
+typedef struct task                    *task_t, *task_name_t, *task_inspect_t, *task_suspension_token_t;
+typedef struct thread          *thread_t, *thread_act_t, *thread_inspect_t;
+typedef struct ipc_space               *ipc_space_t, *ipc_space_inspect_t;
 typedef struct coalition               *coalition_t;
 typedef struct host                    *host_t;
 typedef struct host                    *host_priv_t;
@@ -166,10 +166,13 @@ __END_DECLS
  */
 typedef mach_port_t            task_t;
 typedef mach_port_t            task_name_t;
+typedef mach_port_t            task_inspect_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            ipc_space_t;
+typedef mach_port_t            ipc_space_inspect_t;
 typedef mach_port_t            coalition_t;
 typedef mach_port_t            host_t;
 typedef mach_port_t            host_priv_t;
@@ -254,10 +257,13 @@ typedef exception_handler_array_t exception_port_arrary_t;
 
 #define TASK_NULL              ((task_t) 0)
 #define TASK_NAME_NULL         ((task_name_t) 0)
+#define TASK_INSPECT_NULL              ((task_inspect_t) 0)
 #define THREAD_NULL            ((thread_t) 0)
+#define THREAD_INSPECT_NULL    ((thread_inspect_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_INSPECT_NULL ((ipc_space_inspect_t) 0)
 #define COALITION_NULL         ((coalition_t) 0)
 #define HOST_NULL              ((host_t) 0)
 #define HOST_PRIV_NULL         ((host_priv_t)0)
index 396c1a1639164ec3aef6600a0cfe3d712c279c6c..17dddfcca416d7a32429db86d382efdeedb24f6c 100644 (file)
@@ -54,6 +54,13 @@ kern_return_t        mk_timer_arm(
 kern_return_t  mk_timer_cancel(
                                        mach_port_name_t        name,
                                        uint64_t                        *result_time);
+#define MK_TIMER_NORMAL (0)
+#define MK_TIMER_CRITICAL (1)
+kern_return_t  mk_timer_arm_leeway(
+                                       mach_port_name_t        name,
+                                       uint64_t                mk_timer_flags,
+                                       uint64_t                mk_timer_expire_time,
+                                       uint64_t                mk_timer_leeway);
 
 __END_DECLS
 
index 8ed6e7a68262511f708f14e8db00c2600cd8b336..97edad81c6b06bf555343cf1ae27110cad1fc48d 100644 (file)
@@ -169,7 +169,11 @@ kernel_trap(mk_timer_arm,-93,3)
 #endif /* __LP64__ */
 
 kernel_trap(mk_timer_cancel,-94,2)
-
+#if            defined(__LP64__)
+kernel_trap(mk_timer_arm_leeway,-95,4)
+#else
+kernel_trap(mk_timer_arm_leeway,-95,7)
+#endif
 /*
  * N.B: Trap #-100 is in use by IOTrap.s in the IOKit Framework
  * (iokit_user_client_trap)
index df4e65ab54522448f8aa9cd5661bc8214cd0f010..a60622e5bea6fe454a64a30c20d571da81d1dd83 100644 (file)
@@ -95,7 +95,7 @@ routine task_terminate(
  *     Returns the set of threads belonging to the target task.
  */
 routine task_threads(
-               target_task     : task_t;
+               target_task     : task_inspect_t;
        out     act_list        : thread_act_array_t);
 
 /*
@@ -154,7 +154,7 @@ routine     task_resume(
  *     associated with the target task.
  */
 routine task_get_special_port(
-               task            : task_t;
+               task            : task_inspect_t;
                which_port      : int;
        out     special_port    : mach_port_t);
 
@@ -217,7 +217,7 @@ routine     task_set_exception_ports(
  * Lookup some of the old exception handlers for a task
  */
 routine        task_get_exception_ports(
-               task            : task_t;
+               task            : task_inspect_t;
                exception_mask  : exception_mask_t;
          out   masks           : exception_mask_array_t;
          out   old_handlers    : exception_handler_array_t, SameCount;
@@ -469,7 +469,7 @@ routine task_unregister_dyld_image_infos(
         dyld_images     :dyld_kernel_image_info_array_t);
 
 routine task_get_dyld_image_infos(
-        task            :task_t;
+        task            :task_inspect_t;
     out dyld_images     :dyld_kernel_image_info_array_t);
 
 routine task_register_dyld_shared_cache_image_info(
index 872f1b1aa5ef9a48936de2113b6f4d3f8ad32cad..1197cb716ea9400258ef543895d805295836e4ac 100644 (file)
@@ -217,7 +217,7 @@ routine thread_set_special_port(
  *      Returns information about the target thread.
  */
 routine thread_info(
-                target_act      : thread_act_t;
+                target_act      : thread_inspect_t;
                 flavor          : thread_flavor_t;
         out     thread_info_out : thread_info_t, CountInOut);
 
@@ -235,7 +235,7 @@ routine             thread_set_exception_ports(
  * Lookup some of the old exception handlers for a thread
  */
 routine                thread_get_exception_ports(
-                       thread          : thread_act_t;
+                       thread          : thread_inspect_t;
                        exception_mask  : exception_mask_t;
                  out   masks           : exception_mask_array_t;
                  out   old_handlers    : exception_handler_array_t, SameCount;
@@ -278,7 +278,7 @@ routine PREFIX(thread_policy_set)(
        policy_info             : thread_policy_t);
 
 routine thread_policy_get(
-       thread                  : thread_act_t;
+       thread                  : thread_inspect_t;
        flavor                  : thread_policy_flavor_t;
 out    policy_info             : thread_policy_t, CountInOut;
 inout  get_default             : boolean_t);
index 5aa93d0103515217fe55405c6760bfc104b5cac0..db0417c2e5146e7f8d9bd0fab5e10794d8ea8ff8 100644 (file)
 #ifndef _MACHINE_ATOMIC_H
 #define _MACHINE_ATOMIC_H
 
-/* This should be in stdatomic.h once supported by compiler */
-enum memory_order {
-    memory_order_relaxed,
-    memory_order_consume,
-    memory_order_acquire,
-    memory_order_release,
-    memory_order_acq_rel,
-    memory_order_seq_cst
-};
+#include <stdatomic.h>
 
 #if defined (__x86_64__)
 #include "i386/atomic.h"
index ac885bbd90879609eba3d6daeea03b3d82fe394c..b62fd6840515a425516d7d170e179cf98aeb8393 100644 (file)
@@ -329,6 +329,11 @@ vm_wants_task_throttled(task_t task)
 }
 
 
+#if DEVELOPMENT || DEBUG
+boolean_t kill_on_no_paging_space = FALSE; /* On compressor/swap exhaustion, kill the largest process regardless of
+                                           * its chosen process policy. Controlled by a boot-arg of the same name. */
+#endif /* DEVELOPMENT || DEBUG */
+
 
 static uint32_t        no_paging_space_action_in_progress = 0;
 extern void memorystatus_send_low_swap_note(void);
@@ -341,6 +346,17 @@ vm_compressor_take_paging_space_action(void)
                if (OSCompareAndSwap(0, 1, (UInt32 *)&no_paging_space_action_in_progress)) {
 
                        if (no_paging_space_action()) {
+#if DEVELOPMENT || DEBUG
+                               if (kill_on_no_paging_space == TRUE) {
+                                       /*
+                                        * Since we are choosing to always kill a process, we don't need the
+                                        * "out of application memory" dialog box in this mode. And, hence we won't
+                                        * send the knote.
+                                        */
+                                       no_paging_space_action_in_progress = 0;
+                                       return;
+                               }
+#endif /* DEVELOPMENT || DEBUG */
                                memorystatus_send_low_swap_note();
                        }
 
@@ -411,6 +427,13 @@ vm_compressor_init(void)
        vm_size_t       c_compressed_record_sbuf_size = 0;
 #endif /* RECORD_THE_COMPRESSED_DATA */
 
+#if DEVELOPMENT || DEBUG
+       char bootarg_name[32];
+       if (PE_parse_boot_argn("-kill_on_no_paging_space", bootarg_name, sizeof (bootarg_name))) {
+               kill_on_no_paging_space = TRUE;
+       }
+#endif /* DEVELOPMENT || DEBUG */
+
        /*
         * ensure that any pointer that gets created from
         * the vm_page zone can be packed properly
index 21d449cde24ca10e52eb9a3afdb2169293e31f8b..ae31a40380aa7d577d45b9ad2f980456cd326b2c 100644 (file)
@@ -4582,6 +4582,24 @@ handle_copy_delay:
        if (real_map != map)
                vm_map_unlock(real_map);
 
+       if (__improbable(object == compressor_object ||
+                        object == kernel_object ||
+                        object == vm_submap_object)) {
+               /*
+                * These objects are explicitly managed and populated by the
+                * kernel.  The virtual ranges backed by these objects should
+                * either have wired pages or "holes" that are not supposed to
+                * be accessed at all until they get explicitly populated.
+                * We should never have to resolve a fault on a mapping backed
+                * by one of these VM objects and providing a zero-filled page
+                * would be wrong here, so let's fail the fault and let the
+                * caller crash or recover.
+                */
+               vm_object_unlock(object);
+               kr = KERN_MEMORY_ERROR;
+               goto done;
+       }
+
        assert(object != compressor_object);
        assert(object != kernel_object);
        assert(object != vm_submap_object);
index 80f88aae4e5b909f4e29f39c2ec768afb5ca28dd..69150e2a77be38abf9a8785fab13b36da2ebed50 100644 (file)
@@ -3210,6 +3210,7 @@ vm_map_enter_mem_object_helper(
                                vm_object_offset_t      copy_offset;
                                int                     copy_vm_alias;
 
+                               copy_object = VME_OBJECT(copy_entry);
                                copy_offset = VME_OFFSET(copy_entry);
                                copy_size = (copy_entry->vme_end -
                                             copy_entry->vme_start);
@@ -3241,7 +3242,57 @@ vm_map_enter_mem_object_helper(
                                        vm_map_reference(copy_submap);
                                        vm_map_unlock(copy_submap);
                                        copy_object = (vm_object_t) copy_submap;
+                               } else if (!copy &&
+                                          copy_object != VM_OBJECT_NULL &&
+                                          (copy_entry->needs_copy ||
+                                           copy_object->shadowed ||
+                                           (!copy_object->true_share &&
+                                            !copy_entry->is_shared &&
+                                            copy_object->vo_size > copy_size))) {
+                                       /*
+                                        * We need to resolve our side of this
+                                        * "symmetric" copy-on-write now; we
+                                        * need a new object to map and share,
+                                        * instead of the current one which
+                                        * might still be shared with the
+                                        * original mapping.
+                                        *
+                                        * Note: A "vm_map_copy_t" does not
+                                        * have a lock but we're protected by
+                                        * the named entry's lock here.
+                                        */
+                                       // assert(copy_object->copy_strategy == MEMORY_OBJECT_COPY_SYMMETRIC);
+                                       VME_OBJECT_SHADOW(copy_entry, copy_size);
+                                       if (!copy_entry->needs_copy &&
+                                           copy_entry->protection & VM_PROT_WRITE) {
+                                               vm_prot_t prot;
+
+                                               prot = copy_entry->protection & ~VM_PROT_WRITE;
+                                               vm_object_pmap_protect(copy_object,
+                                                                      copy_offset,
+                                                                      copy_size,
+                                                                      PMAP_NULL,
+                                                                      0,
+                                                                      prot);
+                                       }
+
+                                       copy_entry->needs_copy = FALSE;
+                                       copy_entry->is_shared = TRUE;
+                                       copy_object = VME_OBJECT(copy_entry);
+                                       copy_offset = VME_OFFSET(copy_entry);
+                                       vm_object_lock(copy_object);
+                                       vm_object_reference_locked(copy_object);
+                                       if (copy_object->copy_strategy == MEMORY_OBJECT_COPY_SYMMETRIC) {
+                                               /* we're about to make a shared mapping of this object */
+                                               copy_object->copy_strategy = MEMORY_OBJECT_COPY_DELAY;
+                                               copy_object->true_share = TRUE;
+                                       }
+                                       vm_object_unlock(copy_object);
                                } else {
+                                       /*
+                                        * We already have the right object
+                                        * to map.
+                                        */
                                        copy_object = VME_OBJECT(copy_entry);
                                        vm_object_reference(copy_object);
                                }
@@ -3252,6 +3303,14 @@ vm_map_enter_mem_object_helper(
                                remap_flags |= VM_FLAGS_OVERWRITE;
                                remap_flags &= ~VM_FLAGS_ANYWHERE;
                                remap_flags |= VM_MAKE_TAG(copy_vm_alias);
+                               if (!copy && !copy_entry->is_sub_map) {
+                                       /*
+                                        * copy-on-write should have been
+                                        * resolved at this point, or we would
+                                        * end up sharing instead of copying.
+                                        */
+                                       assert(!copy_entry->needs_copy);
+                               }
                                kr = vm_map_enter(target_map,
                                                  &copy_addr,
                                                  copy_size,
@@ -9651,10 +9710,12 @@ vm_map_copyin_internal(
                 *      Attempt non-blocking copy-on-write optimizations.
                 */
 
-               if (src_destroy && 
-                   (src_object == VM_OBJECT_NULL || 
-                    (src_object->internal && !src_object->true_share
-                     && !map_share))) {
+               if (src_destroy &&
+                   (src_object == VM_OBJECT_NULL ||
+                    (src_object->internal &&
+                     src_object->copy_strategy != MEMORY_OBJECT_COPY_DELAY &&
+                     !src_object->true_share &&
+                     !map_share))) {
                        /*
                         * If we are destroying the source, and the object
                         * is internal, we can move the object reference
@@ -15522,6 +15583,15 @@ vm_map_set_64bit(vm_map_t map)
        map->max_offset = (vm_map_offset_t)MACH_VM_MAX_ADDRESS;
 }
 
+/*
+ * Expand the maximum size of an existing map.
+ */
+void
+vm_map_set_jumbo(vm_map_t map)
+{
+       (void) map;
+}
+
 vm_map_offset_t
 vm_compute_max_offset(boolean_t is64)
 {
index 9dc270a009ce9dbafdea05f00678b6ae6c27af68..52869a1b4d15ae78c0fdf5963cab0567cb7d8c26 100644 (file)
@@ -1224,6 +1224,9 @@ extern void               vm_map_set_64bit(
 extern void            vm_map_set_32bit(
                                vm_map_t                map);
 
+extern void            vm_map_set_jumbo(
+                               vm_map_t                map);
+
 extern boolean_t       vm_map_has_hard_pagezero(
                                vm_map_t                map,
                                vm_map_offset_t         pagezero_size);
index 72b525fdd76d7b5f9cc6ee82f2242c58a7ce43aa..de9542c3a78352922084ca1c801d251cf75f3554 100644 (file)
@@ -822,7 +822,8 @@ vm_io_reprioritize_init(void)
 
        io_reprioritize_req_zone = zinit(sizeof(struct io_reprioritize_req),
                                         MAX_IO_REPRIORITIZE_REQS * sizeof(struct io_reprioritize_req),
-                                        4096, "io_reprioritize_req");  
+                                        4096, "io_reprioritize_req");
+       zone_change(io_reprioritize_req_zone, Z_COLLECT, FALSE);
 
        result = kernel_thread_start_priority(io_reprioritize_thread, NULL, 95 /* MAXPRI_KERNEL */, &thread);
         if (result == KERN_SUCCESS) {
@@ -4743,6 +4744,19 @@ vm_object_compressor_pager_create(
                return;
        }
 
+       if ((uint32_t) (object->vo_size/PAGE_SIZE) !=
+           (object->vo_size/PAGE_SIZE)) {
+#if DEVELOPMENT || DEBUG
+               printf("vm_object_compressor_pager_create(%p): "
+                      "object size 0x%llx >= 0x%llx\n",
+                      object,
+                      (uint64_t) object->vo_size,
+                      0x0FFFFFFFFULL*PAGE_SIZE);
+#endif /* DEVELOPMENT || DEBUG */
+               vm_object_paging_end(object);
+               return;
+       }
+
        /*
         *      Indicate that a memory object has been assigned
         *      before dropping the lock, to prevent a race.
@@ -4753,15 +4767,6 @@ vm_object_compressor_pager_create(
                
        vm_object_unlock(object);
 
-       if ((uint32_t) (object->vo_size/PAGE_SIZE) !=
-           (object->vo_size/PAGE_SIZE)) {
-               panic("vm_object_compressor_pager_create(%p): "
-                     "object size 0x%llx >= 0x%llx\n",
-                     object,
-                     (uint64_t) object->vo_size,
-                     0x0FFFFFFFFULL*PAGE_SIZE);
-       }
-
        /*
         *      Create the [internal] pager, and associate it with this object.
         *
@@ -6607,9 +6612,15 @@ vm_object_purgable_control(
        }
 
        new_state = *state & VM_PURGABLE_STATE_MASK;
-       if (new_state == VM_PURGABLE_VOLATILE &&
-           object->volatile_empty) {
-               new_state = VM_PURGABLE_EMPTY;
+       if (new_state == VM_PURGABLE_VOLATILE) {
+               if (old_state == VM_PURGABLE_EMPTY) {
+                       /* what's been emptied must stay empty */
+                       new_state = VM_PURGABLE_EMPTY;
+               }
+               if (object->volatile_empty) {
+                       /* debugging mode: go straight to empty */
+                       new_state = VM_PURGABLE_EMPTY;
+               }
        }
 
        switch (new_state) {
@@ -6689,11 +6700,8 @@ vm_object_purgable_control(
                                }
                        }
                }
-                                              
-               if (old_state == VM_PURGABLE_EMPTY &&
-                   object->resident_page_count == 0 &&
-                   object->pager == NULL)
-                       break;
+
+               assert(old_state != VM_PURGABLE_EMPTY);
 
                purgeable_q_t queue;
         
@@ -6825,13 +6833,6 @@ vm_object_purgable_control(
                        }
                }
 
-               if (old_state == new_state) {
-                       /* nothing changes */
-                       break;
-               }
-
-               assert(old_state == VM_PURGABLE_NONVOLATILE ||
-                      old_state == VM_PURGABLE_VOLATILE);
                if (old_state == VM_PURGABLE_VOLATILE) {
                        purgeable_q_t old_queue;
 
index 01a9f4506fef06093a46ea4ecfb8d7c82253875b..b94d1962d8812b5e796a5d9289204ca4c38bdf72 100644 (file)
@@ -1646,7 +1646,6 @@ vm_pageout_scan(void)
        boolean_t       force_anonymous = FALSE;
        int             anons_grabbed = 0;
        int             page_prev_q_state = 0;
-       boolean_t       requeue_insert_first = FALSE;
 #if CONFIG_BACKGROUND_QUEUE
        boolean_t       ignore_reference = FALSE;
 #endif
@@ -2873,7 +2872,6 @@ consider_inactive:
                force_anonymous = FALSE;
                
                page_prev_q_state = m->vm_page_q_state;
-               requeue_insert_first = FALSE;
                /*
                 * we just found this page on one of our queues...
                 * it can't also be on the pageout queue, so safe
@@ -2928,9 +2926,6 @@ consider_inactive:
                                if (page_prev_q_state == VM_PAGE_ON_INACTIVE_CLEANED_Q)
                                        vm_pageout_cleaned_nolock++;
 
-                               if (page_prev_q_state == VM_PAGE_ON_SPECULATIVE_Q)
-                                       requeue_insert_first = TRUE;
-
                                pmap_clear_reference(VM_PAGE_GET_PHYS_PAGE(m));
                                m->reference = FALSE;
 
@@ -3014,12 +3009,12 @@ consider_inactive:
 
                        if (page_prev_q_state == VM_PAGE_ON_INACTIVE_CLEANED_Q)
                                vm_pageout_cleaned_busy++;
-                       
 requeue_page:
-                       if (requeue_insert_first)
-                               vm_page_enqueue_inactive(m, TRUE);
-                       else
+                       if (page_prev_q_state == VM_PAGE_ON_SPECULATIVE_Q)
                                vm_page_enqueue_inactive(m, FALSE);
+                       else
+                               vm_page_activate(m);
+
 #if CONFIG_BACKGROUND_QUEUE
                        if (ignore_reference == TRUE) {
                                if (m_object->internal)
@@ -3433,7 +3428,7 @@ throttle_inactive:
                                        vm_object_unlock(object);
                                        object = VM_OBJECT_NULL;
                                        vm_page_unlock_queues();
-                                       
+
                                        VM_DEBUG_CONSTANT_EVENT(vm_pageout_jetsam, VM_PAGEOUT_JETSAM, DBG_FUNC_START,
                                               vm_page_active_count, vm_page_inactive_count, vm_page_free_count, vm_page_free_count);
 
@@ -4546,6 +4541,10 @@ extern vm_map_offset_t vm_page_fake_buckets_start, vm_page_fake_buckets_end;
 #define FBDP_TEST_COLLAPSE_COMPRESSOR 0
 #define FBDP_TEST_WIRE_AND_EXTRACT 0
 #define FBDP_TEST_PAGE_WIRE_OVERFLOW 0
+#define FBDP_TEST_KERNEL_OBJECT_FAULT 0
+
+#if FBDP_TEST_KERNEL_OBJECT_FAULT
+#endif /* FBDP_TEST_KERNEL_OBJECT_FAULT */
 
 #if FBDP_TEST_COLLAPSE_COMPRESSOR
 extern boolean_t vm_object_collapse_compressor_allowed;
@@ -5067,6 +5066,11 @@ vm_pageout(void)
              fbdp_object, fbdp_page);
 #endif /* FBDP_TEST_PAGE_WIRE_OVERFLOW */
 
+#if FBDP_TEST_KERNEL_OBJECT_FAULT
+       {
+       }
+#endif /* FBDP_TEST_KERNEL_OBJECT_FAULT */
+
        vm_pageout_continue();
 
        /*
index ae49332095f3f93145abdb33792dbf0a8677ddbe..8c12eb600ec7bfd30a8fd7371dad5cfe283c8a89 100644 (file)
@@ -73,6 +73,8 @@ extern mach_port_name_t ipc_port_copyout_send(
        ipc_space_t     space);
 extern task_t port_name_to_task(
        mach_port_name_t name);
+extern task_t port_name_to_task_inspect(
+       mach_port_name_t name);
 #endif /* _IPC_IPC_PORT_H_ */
 
 extern ipc_space_t  get_task_ipcspace(
index 160d306072f1893a020da0abdb8580d7cf899694..ed19cd33708664657584af2d20ef893f2a5b6c98 100644 (file)
@@ -6523,6 +6523,7 @@ hibernate_vm_lock_queues(void)
     vm_object_lock(compressor_object);
     vm_page_lock_queues();
     lck_mtx_lock(&vm_page_queue_free_lock);
+    lck_mtx_lock(&vm_purgeable_queue_lock);
 
     if (vm_page_local_q) {
        uint32_t  i;
@@ -6545,6 +6546,7 @@ hibernate_vm_unlock_queues(void)
            VPL_UNLOCK(&lq->vpl_lock);
        }
     }
+    lck_mtx_unlock(&vm_purgeable_queue_lock);
     lck_mtx_unlock(&vm_page_queue_free_lock);
     vm_page_unlock_queues();
     vm_object_unlock(compressor_object);
index 161b397c306c5e440e3b3728d9c561ab8be912c9..0736226fbb6814dac438f5be4e3e91ab11f1e3bf 100644 (file)
@@ -253,14 +253,18 @@ ovbcopy(
 
 uint64_t reportphyreaddelayabs;
 uint32_t reportphyreadosbt;
+#if DEVELOPMENT || DEBUG
+uint32_t phyreadpanic = 1;
+#else
+uint32_t phyreadpanic = 0;
+#endif
 
-static inline unsigned int
-ml_phys_read_data(pmap_paddr_t paddr, int size)
-{
-       unsigned int result = 0;
+__private_extern__ uint64_t
+ml_phys_read_data(pmap_paddr_t paddr, int size) {
+       uint64_t result = 0;
        unsigned char s1;
        unsigned short s2;
-       boolean_t istate;
+       boolean_t istate, timeread = FALSE;
        uint64_t sabs, eabs;
 
        if (__improbable(!physmap_enclosed(paddr)))
@@ -269,6 +273,7 @@ ml_phys_read_data(pmap_paddr_t paddr, int size)
        if (__improbable(reportphyreaddelayabs != 0)) {
                istate = ml_set_interrupts_enabled(FALSE);
                sabs = mach_absolute_time();
+               timeread = TRUE;
        }
 
         switch (size) {
@@ -283,16 +288,24 @@ ml_phys_read_data(pmap_paddr_t paddr, int size)
         case 4:
                result = *(volatile unsigned int *)PHYSMAP_PTOV(paddr);
                break;
+       case 8:
+               result = *(volatile unsigned long long *)PHYSMAP_PTOV(paddr);
+               break;
        default:
                panic("Invalid size %d for ml_phys_read_data\n", size);
                break;
         }
 
-       if (__improbable(reportphyreaddelayabs != 0)) {
+       if (__improbable(timeread == TRUE)) {
                eabs = mach_absolute_time();
                (void)ml_set_interrupts_enabled(istate);
 
-               if ((eabs - sabs) > reportphyreaddelayabs) {
+               if (__improbable((eabs - sabs) > reportphyreaddelayabs)) {
+                       if (phyreadpanic) {
+                               panic_io_port_read();
+                               panic("Read from physical addr 0x%llx took %llu ns, result: 0x%llx (start: %llu, end: %llu), ceiling: %llu", paddr, (eabs - sabs), result, sabs, eabs, reportphyreaddelayabs);
+                       }
+
                        if (reportphyreadosbt) {
                                OSReportWithBacktrace("ml_phys_read_data took %lluus\n", (eabs - sabs) / 1000);
                        }
@@ -307,51 +320,48 @@ ml_phys_read_data(pmap_paddr_t paddr, int size)
 }
 
 static unsigned long long
-ml_phys_read_long_long(pmap_paddr_t paddr )
-{
-       if (!physmap_enclosed(paddr))
-               panic("%s: 0x%llx out of bounds\n", __FUNCTION__, paddr);
-       return *(volatile unsigned long long *)PHYSMAP_PTOV(paddr);
+ml_phys_read_long_long(pmap_paddr_t paddr) {
+       return ml_phys_read_data(paddr, 8);
 }
 
 unsigned int ml_phys_read( vm_offset_t paddr)
 {
-        return ml_phys_read_data((pmap_paddr_t)paddr, 4);
+        return (unsigned int) ml_phys_read_data((pmap_paddr_t)paddr, 4);
 }
 
 unsigned int ml_phys_read_word(vm_offset_t paddr) {
 
-        return ml_phys_read_data((pmap_paddr_t)paddr, 4);
+        return (unsigned int) ml_phys_read_data((pmap_paddr_t)paddr, 4);
 }
 
 unsigned int ml_phys_read_64(addr64_t paddr64)
 {
-        return ml_phys_read_data((pmap_paddr_t)paddr64, 4);
+        return (unsigned int) ml_phys_read_data((pmap_paddr_t)paddr64, 4);
 }
 
 unsigned int ml_phys_read_word_64(addr64_t paddr64)
 {
-        return ml_phys_read_data((pmap_paddr_t)paddr64, 4);
+        return (unsigned int) ml_phys_read_data((pmap_paddr_t)paddr64, 4);
 }
 
 unsigned int ml_phys_read_half(vm_offset_t paddr)
 {
-        return ml_phys_read_data((pmap_paddr_t)paddr, 2);
+        return (unsigned int) ml_phys_read_data((pmap_paddr_t)paddr, 2);
 }
 
 unsigned int ml_phys_read_half_64(addr64_t paddr64)
 {
-        return ml_phys_read_data((pmap_paddr_t)paddr64, 2);
+        return (unsigned int) ml_phys_read_data((pmap_paddr_t)paddr64, 2);
 }
 
 unsigned int ml_phys_read_byte(vm_offset_t paddr)
 {
-        return ml_phys_read_data((pmap_paddr_t)paddr, 1);
+        return (unsigned int) ml_phys_read_data((pmap_paddr_t)paddr, 1);
 }
 
 unsigned int ml_phys_read_byte_64(addr64_t paddr64)
 {
-        return ml_phys_read_data((pmap_paddr_t)paddr64, 1);
+        return (unsigned int) ml_phys_read_data((pmap_paddr_t)paddr64, 1);
 }
 
 unsigned long long ml_phys_read_double(vm_offset_t paddr)
index ff941d2e23ab5cd0e1bc3a495a94b8cb78d3369a..cb643816851259087aac2b0a9c89cd9b980b10f1 100644 (file)
@@ -3236,3 +3236,18 @@ void pmap_advise_pagezero_range(pmap_t lpmap, uint64_t low_bound) {
                mp_enable_preemption();
        }
 }
+
+void pmap_verify_noncacheable(uintptr_t vaddr) {
+       pt_entry_t *ptep = NULL;
+       ptep = pmap_pte(kernel_pmap, vaddr);
+       if (ptep == NULL) {
+               panic("pmap_verify_noncacheable: no translation for 0x%lx", vaddr);
+       }
+       /* Non-cacheable OK */
+       if (*ptep & (INTEL_PTE_NCACHE))
+               return;
+       /* Write-combined OK */
+       if (*ptep & (INTEL_PTE_PTA))
+               return;
+       panic("pmap_verify_noncacheable: IO read from a cacheable address? address: 0x%lx, PTE: %p, *PTE: 0x%llx", vaddr, ptep, *ptep);
+}
index 33a8db7741e7693dcdfca07571d2afb18e986bc3..5a010bc372784afebae9bbf043f97c05de8258ea 100644 (file)
@@ -105,9 +105,14 @@ PE_parse_boot_argn_internal(
                        goto gotit;
 
                if (arg_boolean) {
-                       if (!force_string){
-                               argnumcpy(1, arg_ptr, max_len);
-                               arg_found = TRUE;
+                       if (!force_string) {
+                               if (max_len > 0) {
+                                       argnumcpy(1, arg_ptr, max_len);/* max_len of 0 performs no copy at all*/
+                                       arg_found = TRUE;
+                               }
+                               else if (max_len == 0) {        
+                                       arg_found = TRUE;
+                               }
                        }
                        break;
                } else {
@@ -119,23 +124,39 @@ PE_parse_boot_argn_internal(
                        }
                        if ('_' == *arg_string) /* Force a string copy if the argument name begins with an underscore */
                        {
-                               int hacklen = 17 > max_len ? 17 : max_len;
-                               argstrcpy2 (++cp, (char *)arg_ptr, hacklen - 1); /* Hack - terminate after 16 characters */
-                               arg_found = TRUE;
+                               if (max_len > 0) {
+                                       int hacklen = 17 > max_len ? 17 : max_len;
+                                       argstrcpy2 (++cp, (char *)arg_ptr, hacklen - 1); /* Hack - terminate after 16 characters */
+                                       arg_found = TRUE;
+                               }
+                               else if (max_len == 0) {
+                                       arg_found = TRUE;
+                               }
                                break;
                        }
                        switch ((force_string && *cp == '=') ? STR : getval(cp, &val, isargsep, FALSE))
                        {
                                case NUM:
-                                       argnumcpy(val, arg_ptr, max_len);
-                                       arg_found = TRUE;
+                                       if (max_len > 0) {
+                                               argnumcpy(val, arg_ptr, max_len);
+                                               arg_found = TRUE;
+                                       }
+                                       else if (max_len == 0) {
+                                               arg_found = TRUE;
+                                       }
                                        break;
                                case STR:
-                                       if(max_len > 0) //max_len of 0 performs no copy at all
-                                               argstrcpy2(++cp, (char *)arg_ptr, max_len - 1);
-                                       else if(max_len == -1) // unreachable on embedded
+                                       if (max_len > 0) {
+                                               argstrcpy2(++cp, (char *)arg_ptr, max_len - 1);/*max_len of 0 performs no copy at all*/
+                                               arg_found = TRUE;
+                                       }
+                                       else if (max_len == 0) {
+                                               arg_found = TRUE;
+                                       }
+                                       else if (max_len == -1) { /* unreachable on embedded */
                                                argstrcpy(++cp, (char *)arg_ptr);
-                                       arg_found = TRUE;
+                                               arg_found = TRUE;
+                                       }
                                        break;
                        }
                        goto gotit;
index c9f720e21cfcba3eaa82a696e82efce1c7d69b51..d1d51da432897c998ee60b1bd00dfa548dbf80f1 100644 (file)
@@ -39,6 +39,7 @@
 #include <machine/pal_routines.h>
 #include <i386/proc_reg.h>
 #include <os/log_private.h>
+#include <libkern/section_keywords.h>
 
 /* Globals */
 void (*PE_kputc)(char c);
@@ -47,9 +48,9 @@ void (*PE_kputc)(char c);
 /* DEBUG kernel starts with true serial, but
  * may later disable or switch to video
  * console */
-unsigned int disable_serial_output = FALSE;
+SECURITY_READ_ONLY_LATE(unsigned int) disable_serial_output = FALSE;
 #else
-unsigned int disable_serial_output = TRUE;
+SECURITY_READ_ONLY_LATE(unsigned int) disable_serial_output = TRUE;
 #endif
 
 decl_simple_lock_data(static, kprintf_lock)
index f056487a044ce0a798318ad729fd744266a7c829..91a10f867f8e7196a9d6b90c89286882fd72e43a 100644 (file)
  *       Polled-mode 16x50 UART driver.
  */
 
+#include <machine/machine_routines.h>
 #include <pexpert/protos.h>
 #include <pexpert/pexpert.h>
 
-/* standard port addresses */
+struct pe_serial_functions {
+    void            (*uart_init) (void);
+    void            (*uart_set_baud_rate) (int unit, uint32_t baud_rate);
+    int             (*tr0) (void);
+    void            (*td0) (int c);
+    int             (*rr0) (void);
+    int             (*rd0) (void);
+};
+
+static struct pe_serial_functions *gPESF;
+
+static int uart_initted = 0;   /* 1 if init'ed */
+
+#define DEFAULT_UART_BAUD_RATE 115200
+
+static unsigned uart_baud_rate = DEFAULT_UART_BAUD_RATE;
+
+// =============================================================================
+// Legacy UART support using IO transactions to COM1 or COM2
+// =============================================================================
+
+#define LEGACY_UART_PORT_ADDR   COM1_PORT_ADDR
+#define LEGACY_UART_CLOCK       1843200   /* 1.8432 MHz clock */
+
+#define IO_WRITE(r, v)  outb(LEGACY_UART_PORT_ADDR + UART_##r, v)
+#define IO_READ(r)      inb(LEGACY_UART_PORT_ADDR + UART_##r)
+
 enum {
     COM1_PORT_ADDR = 0x3f8,
     COM2_PORT_ADDR = 0x2f8
 };
 
-/* UART register offsets */
 enum {
     UART_RBR = 0,  /* receive buffer Register   (R) */
     UART_THR = 0,  /* transmit holding register (W) */
@@ -77,133 +103,330 @@ enum {
     UART_LSR_THRE  = 0x20
 };
 
-static unsigned uart_baud_rate = 115200;
-#define UART_PORT_ADDR  COM1_PORT_ADDR
-
-#define UART_CLOCK  1843200   /* 1.8432 MHz clock */
-
-#define WRITE(r, v)  outb(UART_PORT_ADDR + UART_##r, v)
-#define READ(r)      inb(UART_PORT_ADDR + UART_##r)
-#define DELAY(x)     { volatile int _d_; for (_d_ = 0; _d_ < (10000*x); _d_++) ; }
-
-static int uart_initted = 0;   /* 1 if init'ed */
-
 static int
-uart_probe( void )
+legacy_uart_probe( void )
 {
     /* Verify that the Scratch Register is accessible */
 
-    WRITE( SCR, 0x5a );
-    if (READ(SCR) != 0x5a) return 0;
-    WRITE( SCR, 0xa5 );
-    if (READ(SCR) != 0xa5) return 0;
+    IO_WRITE( SCR, 0x5a );
+    if (IO_READ(SCR) != 0x5a) return 0;
+    IO_WRITE( SCR, 0xa5 );
+    if (IO_READ(SCR) != 0xa5) return 0;
     return 1;
 }
 
 static void
-uart_set_baud_rate( unsigned long baud_rate )
+legacy_uart_set_baud_rate( __unused int unit, uint32_t baud_rate )
 {
-    const unsigned char lcr = READ( LCR );
+    const unsigned char lcr = IO_READ( LCR );
     unsigned long       div;
 
     if (baud_rate == 0) baud_rate = 9600;
-    div = UART_CLOCK / 16 / baud_rate;
-    WRITE( LCR, lcr | UART_LCR_DLAB );
-    WRITE( DLM, (unsigned char)(div >> 8) );
-    WRITE( DLL, (unsigned char) div );
-    WRITE( LCR, lcr & ~UART_LCR_DLAB);
+    div = LEGACY_UART_CLOCK / 16 / baud_rate;
+    IO_WRITE( LCR, lcr | UART_LCR_DLAB );
+    IO_WRITE( DLM, (unsigned char)(div >> 8) );
+    IO_WRITE( DLL, (unsigned char) div );
+    IO_WRITE( LCR, lcr & ~UART_LCR_DLAB);
+}
+
+static int
+legacy_uart_tr0( void )
+{
+    return (IO_READ(LSR) & UART_LSR_THRE);
+}
+
+static void
+legacy_uart_td0( int c )
+{
+    IO_WRITE( THR, c );
 }
 
 static void
-uart_putc( char c )
+legacy_uart_init( void )
 {
-    if (!uart_initted) return;
+    /* Disable hardware interrupts */
+
+    IO_WRITE( MCR, 0 );
+    IO_WRITE( IER, 0 );
+
+    /* Disable FIFO's for 16550 devices */
+
+    IO_WRITE( FCR, 0 );
+
+    /* Set for 8-bit, no parity, DLAB bit cleared */
+
+    IO_WRITE( LCR, UART_LCR_8BITS );
+
+    /* Set baud rate */
 
-    /* Wait for THR empty */
-    while ( !(READ(LSR) & UART_LSR_THRE) ) DELAY(1);
+    gPESF->uart_set_baud_rate ( 0, uart_baud_rate );
 
-    WRITE( THR, c );
+    /* Assert DTR# and RTS# lines (OUT2?) */
+
+    IO_WRITE( MCR, UART_MCR_DTR | UART_MCR_RTS );
+
+    /* Clear any garbage in the input buffer */
+
+    IO_READ( RBR );
+
+    uart_initted = 1;
 }
 
 static int
-uart_getc( void )
+legacy_uart_rr0( void ) 
 {
-    /*
-     * This function returns:
-     * -1 : no data
-     * -2 : receiver error
-     * >0 : character received
-     */
-
     unsigned char lsr;
 
-    if (!uart_initted) return -1;
-
-    lsr = READ( LSR );
+    lsr = IO_READ( LSR );
 
     if ( lsr & (UART_LSR_FE | UART_LSR_PE | UART_LSR_OE) )
     {
-        READ( RBR ); /* discard */
-        return -2;
+        IO_READ( RBR ); /* discard */
+        return 0;
     }
 
-    if ( lsr & UART_LSR_DR )
+    return (lsr & UART_LSR_DR);
+}
+
+static int
+legacy_uart_rd0( void ) 
+{
+    return IO_READ( RBR );
+}
+
+static struct pe_serial_functions legacy_uart_serial_functions = {
+    .uart_init = legacy_uart_init,
+    .uart_set_baud_rate = legacy_uart_set_baud_rate,
+    .tr0 = legacy_uart_tr0,
+    .td0 = legacy_uart_td0,
+    .rr0 = legacy_uart_rr0,
+    .rd0 = legacy_uart_rd0
+};
+
+// =============================================================================
+// MMIO UART (using PCH LPSS UART2)
+// =============================================================================
+
+#define MMIO_UART2_BASE_LEGACY  0xFE034000
+#define MMIO_UART2_BASE         0xFE036000
+
+#define MMIO_WRITE(r, v)  ml_phys_write_word(mmio_uart_base + MMIO_UART_##r, v)
+#define MMIO_READ(r)      ml_phys_read_word(mmio_uart_base + MMIO_UART_##r)
+
+enum {
+    MMIO_UART_RBR = 0x0,   /* receive buffer Register   (R) */
+    MMIO_UART_THR = 0x0,   /* transmit holding register (W) */
+    MMIO_UART_DLL = 0x0,   /* DLAB = 1, divisor latch (LSB) */
+    MMIO_UART_IER = 0x4,   /* interrupt enable register     */
+    MMIO_UART_DLM = 0x4,   /* DLAB = 1, divisor latch (MSB) */
+    MMIO_UART_FCR = 0x8,   /* fifo control register (W)     */
+    MMIO_UART_LCR = 0xc,   /* line control register         */
+    MMIO_UART_MCR = 0x10,  /* modem control register        */
+    MMIO_UART_LSR = 0x14,  /* line status register          */
+    MMIO_UART_SCR = 0x1c   /* scratch register              */
+};
+
+static vm_offset_t mmio_uart_base = 0;
+static int
+mmio_uart_present( void )
+{
+    MMIO_WRITE( SCR, 0x5a );
+    if (MMIO_READ(SCR) != 0x5a) return 0;
+    MMIO_WRITE( SCR, 0xa5 );
+    if (MMIO_READ(SCR) != 0xa5) return 0;
+
+    return 1;
+}
+
+static int
+mmio_uart_probe( void )
+{
+    unsigned new_mmio_uart_base = 0;
+
+    // if specified, mmio_uart overrides all probing
+    if (PE_parse_boot_argn("mmio_uart", &new_mmio_uart_base, sizeof (new_mmio_uart_base)))
     {
-        return READ( RBR );
+        // mmio_uart=0 will disable mmio_uart support
+        if (new_mmio_uart_base == 0) {
+            return 0;
+        }
+
+        mmio_uart_base = new_mmio_uart_base;
+        return 1;
     }
 
-    return -1;
+    // probe the two possible MMIO_UART2 addresses
+    mmio_uart_base = MMIO_UART2_BASE;
+    if (mmio_uart_present()) {
+      return 1;
+    }
+
+    mmio_uart_base = MMIO_UART2_BASE_LEGACY;
+    if (mmio_uart_present()) {
+      return 1;
+    }
+
+    // no mmio uart found
+    return 0;
+}
+
+static void
+mmio_uart_set_baud_rate( __unused int unit, __unused uint32_t baud_rate )
+{
+    const unsigned char lcr = MMIO_READ( LCR );
+    unsigned long       div;
+
+    if (baud_rate == 0) baud_rate = 9600;
+    div = LEGACY_UART_CLOCK / 16 / baud_rate;
+
+    MMIO_WRITE( LCR, lcr | UART_LCR_DLAB );
+    MMIO_WRITE( DLM, (unsigned char)(div >> 8) );
+    MMIO_WRITE( DLL, (unsigned char) div );
+    MMIO_WRITE( LCR, lcr & ~UART_LCR_DLAB);
+}
+
+static int
+mmio_uart_tr0( void )
+{
+    return (MMIO_READ(LSR) & UART_LSR_THRE);
 }
 
-int serial_init( void )
+static void
+mmio_uart_td0( int c )
 {
-    unsigned serial_baud_rate = 0;
-       
-    if ( uart_probe() == 0 ) return 0;
+    MMIO_WRITE( THR, c );
+}
 
+static void
+mmio_uart_init( void )
+{
     /* Disable hardware interrupts */
 
-    WRITE( MCR, 0 );
-    WRITE( IER, 0 );
+    MMIO_WRITE( MCR, 0 );
+    MMIO_WRITE( IER, 0 );
 
     /* Disable FIFO's for 16550 devices */
 
-    WRITE( FCR, 0 );
+    MMIO_WRITE( FCR, 0 );
 
     /* Set for 8-bit, no parity, DLAB bit cleared */
 
-    WRITE( LCR, UART_LCR_8BITS );
+    MMIO_WRITE( LCR, UART_LCR_8BITS );
 
-    /* Set baud rate - use the supplied boot-arg if available */
+    /* Leave baud rate as set by firmware unless serialbaud boot-arg overrides */
 
-    if (PE_parse_boot_argn("serialbaud", &serial_baud_rate, sizeof (serial_baud_rate)))
+    if (uart_baud_rate != DEFAULT_UART_BAUD_RATE) 
     {
-           /* Valid divisor? */
-           if (!((UART_CLOCK / 16) % serial_baud_rate)) {
-                   uart_baud_rate = serial_baud_rate;
-           }
+        gPESF->uart_set_baud_rate ( 0, uart_baud_rate );
     }
-    uart_set_baud_rate( uart_baud_rate );
 
     /* Assert DTR# and RTS# lines (OUT2?) */
 
-    WRITE( MCR, UART_MCR_DTR | UART_MCR_RTS );
+    MMIO_WRITE( MCR, UART_MCR_DTR | UART_MCR_RTS );
 
     /* Clear any garbage in the input buffer */
 
-    READ( RBR );
+    MMIO_READ( RBR );
 
     uart_initted = 1;
+}
 
-    return 1;
+static int
+mmio_uart_rr0( void ) 
+{
+    unsigned char lsr;
+
+    lsr = MMIO_READ( LSR );
+
+    if ( lsr & (UART_LSR_FE | UART_LSR_PE | UART_LSR_OE) )
+    {
+        MMIO_READ( RBR ); /* discard */
+        return 0;
+    }
+    
+    return (lsr & UART_LSR_DR);
+}
+
+static int
+mmio_uart_rd0( void ) 
+{
+    return MMIO_READ( RBR );
+}
+
+static struct pe_serial_functions mmio_uart_serial_functions = {
+    .uart_init = mmio_uart_init,
+    .uart_set_baud_rate = mmio_uart_set_baud_rate,
+    .tr0 = mmio_uart_tr0,
+    .td0 = mmio_uart_td0,
+    .rr0 = mmio_uart_rr0,
+    .rd0 = mmio_uart_rd0
+};
+
+// =============================================================================
+// Generic serial support below
+// =============================================================================
+
+int
+serial_init( void )
+{
+    unsigned new_uart_baud_rate = 0;
+
+    if (PE_parse_boot_argn("serialbaud", &new_uart_baud_rate, sizeof (new_uart_baud_rate)))
+    {
+        /* Valid divisor? */
+        if (!((LEGACY_UART_CLOCK / 16) % new_uart_baud_rate)) {
+            uart_baud_rate = new_uart_baud_rate;
+        }
+    }
+
+    if ( mmio_uart_probe() )
+    {
+        gPESF = &mmio_uart_serial_functions;
+        gPESF->uart_init();
+        return 1;
+    }
+    else if ( legacy_uart_probe() )
+    {
+        gPESF = &legacy_uart_serial_functions;
+        gPESF->uart_init();
+        return 1;
+    }
+    else
+    {
+        return 0;
+    }
+
+}
+
+static void
+uart_putc(char c)
+{
+    if (uart_initted) {
+        while (!gPESF->tr0());  /* Wait until THR is empty. */
+        gPESF->td0(c);
+    }
+}
+
+static int
+uart_getc(void)
+{
+    if (uart_initted) {
+        if (!gPESF->rr0())
+            return -1;
+        return gPESF->rd0();
+    }
+    return -1;
 }
 
-void serial_putc( char c )
+void
+serial_putc( char c )
 {
     uart_putc(c);
 }
 
-int serial_getc( void )
+int
+serial_getc( void )
 {
     return uart_getc();
 }
index e64a43dd41676a2f7195e762fc08196ffdbcbce5..ef711a32b26f3f44bd0a67ca0fce6dd50893f70c 100644 (file)
@@ -273,6 +273,8 @@ int mac_mount_check_snapshot_create(vfs_context_t ctx, struct mount *mp,
            const char *name);
 int    mac_mount_check_snapshot_delete(vfs_context_t ctx, struct mount *mp,
            const char *name);
+int    mac_mount_check_snapshot_revert(vfs_context_t ctx, struct mount *mp,
+           const char *name);
 int    mac_mount_check_remount(vfs_context_t ctx, struct mount *mp);
 int    mac_mount_check_setattr(vfs_context_t ctx, struct mount *mp,
            struct vfs_attr *vfa);
index de9ab798a18a8c06b886fa67c6a5eec0a7fd8bda..dad8d90171cea2a57c013ffe09580f7179e4e456 100644 (file)
@@ -1822,6 +1822,23 @@ typedef int mpo_mount_check_snapshot_delete_t(
        struct mount *mp,
        const char *name
 );
+/**
+  @brief Access control check for fs_snapshot_revert
+  @param cred Subject credential
+  @mp Filesystem mount point to revert to snapshot
+  @name Name of snapshot to revert to
+
+  Determine whether the subject identified by the credential can
+  revert the filesystem at the given mount point to the named snapshot.
+
+  @return Return 0 if access is granted, otherwise an appropriate value
+  for errno should be returned.
+*/
+typedef int mpo_mount_check_snapshot_revert_t(
+       kauth_cred_t cred,
+       struct mount *mp,
+       const char *name
+);
 /**
   @brief Access control check remounting a filesystem
   @param cred Subject credential
@@ -6171,7 +6188,7 @@ typedef void mpo_reserved_hook_t(void);
  * Please note that this should be kept in sync with the check assumptions
  * policy in bsd/kern/policy_check.c (policy_ops struct).
  */
-#define MAC_POLICY_OPS_VERSION 46 /* inc when new reserved slots are taken */
+#define MAC_POLICY_OPS_VERSION 47 /* inc when new reserved slots are taken */
 struct mac_policy_ops {
        mpo_audit_check_postselect_t            *mpo_audit_check_postselect;
        mpo_audit_check_preselect_t             *mpo_audit_check_preselect;
@@ -6440,7 +6457,7 @@ struct mac_policy_ops {
        mpo_sysvshm_label_recycle_t             *mpo_sysvshm_label_recycle;
 
        mpo_reserved_hook_t                     *mpo_reserved8;
-       mpo_reserved_hook_t                     *mpo_reserved9;
+       mpo_mount_check_snapshot_revert_t       *mpo_mount_check_snapshot_revert;
        mpo_vnode_check_getattr_t               *mpo_vnode_check_getattr;
        mpo_mount_check_snapshot_create_t       *mpo_mount_check_snapshot_create;
        mpo_mount_check_snapshot_delete_t       *mpo_mount_check_snapshot_delete;
index be3830804377695ce55f6799dad37489c020502e..8a57039ced6ddfe17f20e5fd185f551a50a0d450 100644 (file)
@@ -1960,6 +1960,26 @@ mac_mount_check_snapshot_delete(vfs_context_t ctx, struct mount *mp,
        return (error);
 }
 
+int
+mac_mount_check_snapshot_revert(vfs_context_t ctx, struct mount *mp,
+    const char *name)
+{
+       kauth_cred_t cred;
+       int error;
+
+#if SECURITY_MAC_CHECK_ENFORCE
+       /* 21167099 - only check if we allow write */
+       if (!mac_vnode_enforce)
+               return 0;
+#endif
+       if (!mac_context_check_enforce(ctx, MAC_VNODE_ENFORCE))
+               return 0;
+
+       cred = vfs_context_ucred(ctx);
+       MAC_CHECK(mount_check_snapshot_revert, cred, mp, name);
+       return (error);
+}
+
 int
 mac_mount_check_remount(vfs_context_t ctx, struct mount *mp)
 {
index b751795ae387e286bae70c7bfbe675a2a288deab..8d645e687fe600c6f8c9060eb0a11a599448df05 100644 (file)
@@ -416,6 +416,7 @@ def cast(obj, target_type):
         print "ERROR: You cannot cast an 'int' to %s, please use kern.GetValueFromAddress() for such purposes." % str(target_type) 
     raise TypeError("object of type %s cannot be casted to %s" % (str(type(obj)), str(target_type)))
 
+
 _value_types_cache={}
 
 def gettype(target_type):
@@ -429,20 +430,36 @@ def gettype(target_type):
     """
     global _value_types_cache
     target_type = str(target_type).strip()
-    if target_type not in _value_types_cache:
-        tmp_type = None
-        if target_type.endswith('*') :
-            tmp_type = LazyTarget.GetTarget().FindFirstType(target_type.rstrip('*').strip())
-            if not tmp_type.IsValid():
-                raise NameError('Unable to Cast to type '+target_type)
-            tmp_type = tmp_type.GetPointerType()
-        else :
-            tmp_type = LazyTarget.GetTarget().FindFirstType(target_type)
-            if not tmp_type.IsValid():
-                raise NameError('Unable to Cast to type '+target_type)
-        _value_types_cache[target_type] = tmp_type
+    if target_type in _value_types_cache:
+        return _value_types_cache[target_type]
+
+    tmp_type = None
+    requested_type_is_pointer = False
+    if target_type.endswith('*') :
+        requested_type_is_pointer = True
+
+    # tmp_type = LazyTarget.GetTarget().FindFirstType(target_type.rstrip('*').strip())
+    search_type = target_type.rstrip('*').strip()
+    type_arr = [t for t in LazyTarget.GetTarget().FindTypes(search_type)]
+
+    # After the sort, the struct type with more fields will be at index [0].
+    # This hueristic helps selecting struct type with more fields compared to ones with "opaque" members
+    type_arr.sort(reverse=True, key=lambda x: x.GetNumberOfFields())
+    if len(type_arr) > 0:
+        tmp_type = type_arr[0]
+    else:
+        raise NameError('Unable to find type '+target_type)
+
+    if not tmp_type.IsValid():
+        raise NameError('Unable to Cast to type '+target_type)
+
+    if requested_type_is_pointer:
+        tmp_type = tmp_type.GetPointerType()
+    _value_types_cache[target_type] = tmp_type
+
     return _value_types_cache[target_type]
 
+
 def getfieldoffset(struct_type, field_name):
     """ Returns the byte offset of a field inside a given struct
         params:
index 70039d2da0980b170f4751491f7b12526c3741d0..bb96a17cd29e9e8db902a7d94920e59d2b26bf9f 100644 (file)
@@ -43,7 +43,7 @@ class CommandOutput(object):
        will be printed/saved only if it matches the expression. 
        The command header will not be filtered in any case.
     """
-    def __init__(self, CommandResult):
+    def __init__(self, cmd_name, CommandResult):
         """ Create a new instance to handle command output.
         params:
                 CommandResult : SBCommandReturnObject result param from lldb's command invocation. 
@@ -53,6 +53,7 @@ class CommandOutput(object):
         self.FILTER=False
         self.pluginRequired = False
         self.pluginName = None
+        self.cmd_name = cmd_name
         self.resultObj = CommandResult
         self.immediateOutput = False
         self.verbose_level = 0
@@ -61,9 +62,13 @@ class CommandOutput(object):
 
     def write(self, s):
         """ Handler for all commands output. By default just print to stdout """
-        if self.FILTER and not self.reg.search(s): return
-        if self.FILTER : s+="\n"
-        if self.fhandle != None: self.fhandle.write(s)
+        if self.FILTER and not self.reg.search(s):
+            return
+        if self.FILTER:
+            s += "\n"
+
+        if self.fhandle != None:
+            self.fhandle.write(s)
         else:
             if self.immediateOutput:
                 sys.__stdout__.write(s)
@@ -82,7 +87,7 @@ class CommandOutput(object):
         if self.fhandle != None :
             self.fhandle.close()
     
-    def setOptions(self,cmdargs, cmdoptions =''):
+    def setOptions(self, cmdargs, cmdoptions =''):
         """ parse the arguments passed to the command 
             param : 
                 cmdargs => [] of <str> (typically args.split())
@@ -107,7 +112,7 @@ class CommandOutput(object):
                 self.fname=os.path.normpath(os.path.expanduser(a.strip()))
                 self.fhandle=open(self.fname,"w")
                 print "saving results in file ",str(a)
-                self.fhandle.write("(lldb)%s \n" % " ".join(cmdargs))
+                self.fhandle.write("(lldb)%s %s \n" % (self.cmd_name, " ".join(cmdargs)))
             elif o == "-s" and len(a) > 0:
                 self.reg = re.compile(a.strip(),re.MULTILINE|re.DOTALL)
                 self.FILTER=True
index 4a771880db9ab9f00592917e0a6c6d0085ef60eb..a97b1d96dee82f46c92731c795888dac6518c595 100644 (file)
@@ -40,7 +40,7 @@ def GetObjectSummary(obj):
         vtype_str = ""
     if hasattr(obj, 'retainCount'):
         retCount = (obj.retainCount & 0xffff)
-        cntnrRetCount = (retCount >> 16)
+        cntnrRetCount = (obj.retainCount >> 16)
         out_string = "`object 0x{0: <16x}, vt 0x{1: <16x}{2:s}, retain count {3:d}, container retain {4:d}` ".format(obj, vt, vtype_str, retCount, cntnrRetCount)
     else:
         out_string = "`object 0x{0: <16x}, vt 0x{1: <16x}{2:s}` ".format(obj, vt, vtype_str)
index 05ac5d52157e54f622ed5b904e77c28a5032e030..4ef6a75974fd550b1fb4e602bf375405339838f2 100755 (executable)
@@ -81,6 +81,7 @@ kcdata_type_def = {
     'STACKSHOT_KCTYPE_STACKSHOT_DURATION': 0x91a,
     'STACKSHOT_KCTYPE_STACKSHOT_FAULT_STATS': 0x91b,
     'STACKSHOT_KCTYPE_KERNELCACHE_LOADINFO': 0x91c,
+    'STACKSHOT_KCTYPE_THREAD_WAITINFO' : 0x91d,
 
     'KCDATA_TYPE_BUFFER_END':      0xF19158ED,
 
@@ -935,6 +936,15 @@ KNOWN_TYPES_COLLECTION[GetTypeForName('STACKSHOT_KCTYPE_STACKSHOT_FAULT_STATS')]
             ),
             'stackshot_fault_stats')
 
+KNOWN_TYPES_COLLECTION[GetTypeForName('STACKSHOT_KCTYPE_THREAD_WAITINFO')] = KCTypeDescription(GetTypeForName('STACKSHOT_KCTYPE_THREAD_WAITINFO'),
+            (
+                        KCSubTypeElement.FromBasicCtype('owner', KCSUBTYPE_TYPE.KC_ST_UINT64, 0),
+                        KCSubTypeElement.FromBasicCtype('waiter', KCSUBTYPE_TYPE.KC_ST_UINT64, 8),
+                        KCSubTypeElement.FromBasicCtype('context', KCSUBTYPE_TYPE.KC_ST_UINT64, 16),
+                        KCSubTypeElement.FromBasicCtype('wait_type', KCSUBTYPE_TYPE.KC_ST_UINT8, 24)
+            ),
+            'thread_waitinfo')
+
 #KNOWN_TYPES_COLLECTION[0x907] = KCSubTypeElement('donating_pids', KCSUBTYPE_TYPE.KC_ST_UINT32, 4, 0, 0, KCSubTypeElement._get_naked_element_value)
 KNOWN_TYPES_COLLECTION[GetTypeForName('TASK_CRASHINFO_PID')] = KCSubTypeElement('pid', KCSUBTYPE_TYPE.KC_ST_INT32, 4, 0, 0)
 KNOWN_TYPES_COLLECTION[GetTypeForName('TASK_CRASHINFO_PPID')] = KCSubTypeElement('ppid', KCSUBTYPE_TYPE.KC_ST_INT32, 4, 0, 0)
index 1f07e5d35d74ea61168d43a47b24cbb91a417398..05f538e3d662f51201f03c82b9120ae53e3c1646 100644 (file)
@@ -93,14 +93,14 @@ def ShowKdebugTypefilter(cmd_args=None):
     """
 
     if cmd_args:
-        print GetKdebugTypefilter.header
-        print '-' * len(GetKdebugTypefilter.header)
-
         typefilter = kern.GetValueFromAddress(cmd_args[0], 'typefilter_t')
         if unsigned(typefilter) == 0:
             raise ArgumentError('argument provided is NULL')
 
-        print GetKdebugTypefilter()
+        print GetKdebugTypefilter.header
+        print '-' * len(GetKdebugTypefilter.header)
+
+        print GetKdebugTypefilter(typefilter)
         return
 
     typefilter = kern.globals.kdbg_typefilter
@@ -110,3 +110,142 @@ def ShowKdebugTypefilter(cmd_args=None):
     print GetKdebugTypefilter.header
     print '-' * len(GetKdebugTypefilter.header)
     print GetKdebugTypefilter(typefilter)
+
+def GetKdebugStatus():
+    """ Get a string summary of the kdebug subsystem.
+    """
+    out = ''
+
+    kdebug_flags = kern.globals.kd_ctrl_page.kdebug_flags
+    out += 'kdebug flags: {}\n'.format(xnudefines.GetStateString(xnudefines.kdebug_flags_strings, kdebug_flags))
+    events = kern.globals.nkdbufs
+    buf_mb = events * (64 if kern.arch == 'x86_64' or kern.arch == 'arm64' else 32) / 1000000
+    out += 'events allocated: {:<d} ({:<d} MB)\n'.format(events, buf_mb)
+    out += 'enabled: {}\n'.format('yes' if kern.globals.kdebug_enable != 0 else 'no')
+    if kdebug_flags & xnudefines.kdebug_typefilter_check:
+        out += 'typefilter:\n'
+        out += GetKdebugTypefilter.header + '\n'
+        out += '-' * len(GetKdebugTypefilter.header) + '\n'
+        typefilter = kern.globals.kdbg_typefilter
+        if unsigned(typefilter) != 0:
+            out += GetKdebugTypefilter(typefilter)
+
+    return out
+
+@lldb_command('showkdebug')
+def ShowKdebug(cmd_args=None):
+    """ Show the current kdebug state.
+
+        usage: showkdebug
+    """
+
+    print GetKdebugSummary()
+
+@lldb_type_summary(['kperf_timer'])
+@header('{:<10s} {:<7s} {:<20s}'.format('period-ns', 'action', 'pending'))
+def GetKperfTimerSummary(timer):
+    """ Get a string summary of a kperf timer.
+
+        params:
+            timer: the kperf_timer object to get a summary of
+    """
+    return '{:<10d} {:<7d} {:<20x}\n'.format(
+        kern.GetNanotimeFromAbstime(timer.period), timer.actionid, timer.pending_cpus)
+
+@lldb_type_summary(['action'])
+@header('{:<10s} {:<20s} {:<20s}'.format('pid-filter', 'user-data', 'samplers'))
+def GetKperfActionSummary(action):
+    """ Get a string summary of a kperf action.
+
+        params:
+            action: the action object to get a summary of
+    """
+    samplers = xnudefines.GetStateString(xnudefines.kperf_samplers_strings, action.sample)
+    return '{:<10s} {:<20x} {:<20s}\n'.format(
+        '-' if action.pid_filter < 0 else str(action.pid_filter), action.userdata, samplers)
+
+def GetKperfStatus():
+    """ Get a string summary of the kperf subsystem.
+    """
+    out = ''
+
+    kperf_status = kern.globals.sampling_status
+    out += 'sampling: '
+    if kperf_status == 0:
+        out += 'off\n'
+    elif kperf_status == 1:
+        out += 'on\n'
+    elif kperf_status == 2:
+        out += 'shutting down\n'
+    else:
+        out += 'unknown\n'
+
+    pet = 0# kern.globals.pet_running
+    pet_timer_id = kern.globals.pet_timer_id
+    if pet != 0:
+        pet_idle_rate = kern.globals.pet_idle_rate
+        out += 'legacy PET is active (timer = {:<d}, idle rate = {:<d})\n'.format(pet_timer_id, pet_idle_rate)
+    else:
+        out += 'legacy PET is off\n'
+
+    lw_pet = kern.globals.kperf_lightweight_pet_active
+    if lw_pet != 0:
+        lw_pet_gen = kern.globals.kperf_pet_gen
+        out += 'lightweight PET is active (timer = {:<d}, generation count = {:<d})\n'.format(pet_timer_id, lw_pet_gen)
+    else:
+        out += 'lightweight PET is off\n'
+
+    actions = kern.globals.actionc
+    actions_arr = kern.globals.actionv
+
+    out += 'actions:\n'
+    out += '{:<5s} '.format('id') + GetKperfActionSummary.header + '\n'
+    for i in xrange(0, actions):
+        out += '{:<5d} '.format(i) + GetKperfActionSummary(actions_arr[i])
+
+    timers = kern.globals.kperf_timerc
+    timers_arr = kern.globals.kperf_timerv
+
+    out += 'timers:\n'
+    out += '{:<5s} '.format('id') + GetKperfTimerSummary.header + '\n'
+    for i in xrange(0, timers):
+        out += '{:<5d} '.format(i) + GetKperfTimerSummary(timers_arr[i])
+
+    return out
+
+def GetKtraceStatus():
+    """ Get a string summary of the ktrace subsystem.
+    """
+    out = ''
+
+    state = kern.globals.ktrace_state
+    if state == GetEnumValue('ktrace_state::KTRACE_STATE_OFF'):
+        out += 'ktrace is off\n'
+    else:
+        out += 'ktrace is active ('
+        if state == GetEnumValue('ktrace_state::KTRACE_STATE_FG'):
+            out += 'foreground)'
+        else:
+            out += 'background)'
+        out += '\n'
+        owner = kern.globals.ktrace_last_owner_execname
+        out += 'owned by: {0: <s}\n'.format(owner)
+        active_mask = kern.globals.ktrace_active_mask
+        out += 'active systems: {:<#x}\n'.format(active_mask)
+
+    return out
+
+@lldb_command('showktrace')
+def ShowKtrace(cmd_args=None):
+    """ Show the current ktrace state, including subsystems.
+
+        usage: showktrace
+    """
+
+    print GetKtraceStatus()
+    print ' '
+    print 'kdebug:'
+    print GetKdebugStatus()
+    print ' '
+    print 'kperf:'
+    print GetKperfStatus()
index 45a771980f656163c857f51419de33d6d5e7f762..a0994b00e506aec518e3a4245e87a5bd9a95a9d2 100644 (file)
@@ -3299,3 +3299,64 @@ def ShowJetsamSnapshot(cmd_args=None, cmd_options={}):
     return
 
 # EndMacro: showjetsamsnapshot
+
+# Macro: showvnodecleanblk/showvnodedirtyblk
+
+def _GetBufSummary(buf):
+    """ Get a summary of important information out of a buf_t.
+    """
+    initial = "(struct buf) {0: <#0x} ="
+
+    # List all of the fields in this buf summary.
+    entries = [buf.b_hash, buf.b_vnbufs, buf.b_freelist, buf.b_timestamp, buf.b_whichq,
+        buf.b_flags, buf.b_lflags, buf.b_error, buf.b_bufsize, buf.b_bcount, buf.b_resid,
+        buf.b_dev, buf.b_datap, buf.b_lblkno, buf.b_blkno, buf.b_iodone, buf.b_vp,
+        buf.b_rcred, buf.b_wcred, buf.b_upl, buf.b_real_bp, buf.b_act, buf.b_drvdata,
+        buf.b_fsprivate, buf.b_transaction, buf.b_dirtyoff, buf.b_dirtyend, buf.b_validoff,
+        buf.b_validend, buf.b_redundancy_flags, buf.b_proc, buf.b_attr]
+
+    # Join an (already decent) string representation of each field
+    # with newlines and indent the region.
+    joined_strs = "\n".join([str(i).rstrip() for i in entries]).replace('\n', "\n    ")
+
+    # Add the total string representation to our title and return it.
+    out_str = initial.format(int(buf)) + " {\n    " + joined_strs + "\n}\n\n"
+    return out_str
+
+def _ShowVnodeBlocks(dirty=True, cmd_args=None):
+    """ Display info about all [dirty|clean] blocks in a vnode.
+    """
+    if cmd_args == None or len(cmd_args) < 1:
+        print "Please provide a valid vnode argument."
+        return
+
+    vnodeval = kern.GetValueFromAddress(cmd_args[0], 'vnode *')
+    list_head = vnodeval.v_cleanblkhd;
+    if dirty:
+        list_head = vnodeval.v_dirtyblkhd
+
+    print "Blocklist for vnode {}:".format(cmd_args[0])
+
+    i = 0
+    for buf in IterateListEntry(list_head, 'struct buf *', 'b_hash'):
+        # For each block (buf_t) in the appropriate list,
+        # ask for a summary and print it.
+        print "---->\nblock {}: ".format(i) + _GetBufSummary(buf)
+        i += 1
+    return
+
+@lldb_command('showvnodecleanblk')
+def ShowVnodeCleanBlocks(cmd_args=None):
+    """ Display info about all clean blocks in a vnode.
+        usage: showvnodecleanblk <address of vnode>
+    """
+    _ShowVnodeBlocks(False, cmd_args)
+
+@lldb_command('showvnodedirtyblk')
+def ShowVnodeDirtyBlocks(cmd_args=None):
+    """ Display info about all dirty blocks in a vnode.
+        usage: showvnodedirtyblk <address of vnode>
+    """
+    _ShowVnodeBlocks(True, cmd_args)
+
+# EndMacro: showvnodecleanblk/showvnodedirtyblk
index 9b73223f6d2a3adc72802345ea94ecdddb168770..9b5638b24bca74a0a98a505e23092e1c1845cf81 100644 (file)
@@ -441,17 +441,18 @@ def _PmapL4Walk(pmap_addr_val,vaddr, ept_pmap, verbose_level = vSCRIPT):
 
     return paddr
 
-def _PmapWalkARMLevel1Section(tte, vaddr, verbose_level = vSCRIPT):
-    paddr = 0
+def PmapDecodeTTEARM(tte, level, verbose_level):
+    """ Display the bits of an ARM translation table or page table entry
+        in human-readable form.
+        tte: integer value of the TTE/PTE
+        level: translation table level.  Valid values are 1 or 2.
+        verbose_level: verbosity. vHUMAN, vSCRIPT, vDETAIL
+    """
     out_string = ""
-    #Supersection or just section?
-    if (tte & 0x40000) == 0x40000:
-        paddr = ( (tte & 0xFF000000) | (vaddr & 0x00FFFFFF) )
-    else:
-        paddr = ( (tte & 0xFFF00000) | (vaddr & 0x000FFFFF) )
+    if level == 1 and (tte & 0x3) == 0x2:
+        if verbose_level < vSCRIPT:
+            return
 
-    if verbose_level >= vSCRIPT:
-        out_string += "{0: <#020x}\n\t{1: <#020x}\n\t".format(addressof(tte), tte)
         #bit [1:0] evaluated in PmapWalkARM
         # B bit 2
         b_bit = (tte & 0x4) >> 2
@@ -502,7 +503,89 @@ def _PmapWalkARMLevel1Section(tte, vaddr, verbose_level = vSCRIPT):
         else:
             out_string += " secure"
 
+    elif level == 1 and (tte & 0x3) == 0x1:
+
+        if verbose_level >= vSCRIPT:
+            # bit [1:0] evaluated in PmapWalkARM
+            # NS bit 3
+            if tte & 0x8:
+                out_string += ' no-secure'
+            else:
+                out_string += ' secure'
+            #Domain bit [8:5]
+            out_string += " domain({:d})".format(((tte & 0x1e0) >> 5))
+            # IMP bit 9
+            out_string += " imp({:d})".format( ((tte & 0x200) >> 9))
+            out_string += "\n"
+
+    elif level == 2:
+        pte = tte
+        if verbose_level >= vSCRIPT:
+            if (pte & 0x3) == 0x0:
+                out_string += " invalid"
+            else:
+                if (pte & 0x3) == 0x1:
+                    out_string += " large"
+                    # XN bit 15
+                    if pte & 0x8000 == 0x8000:
+                        out_string+= " no-execute"
+                    else:
+                        out_string += " execute"
+                else:
+                    out_string += " small"
+                    # XN bit 0
+                    if (pte & 0x1) == 0x01:
+                        out_string += " no-execute"
+                    else:
+                        out_string += " execute"
+                # B bit 2
+                b_bit = (pte & 0x4) >> 2
+                c_bit = (pte & 0x8) >> 3
+                # AP bit 9 and [5:4], merged to a single 3-bit value
+                access = (pte & 0x30) >> 4 | (pte & 0x200) >> 7
+                out_string += xnudefines.arm_level2_access_strings[access]
+
+                #TEX bit [14:12] for large, [8:6] for small
+                tex_bits = ((pte & 0x1c0) >> 6)
+                if (pte & 0x3) == 0x1:
+                    tex_bits = ((pte & 0x7000) >> 12)
+
+                # Print TEX, C , B alltogether
+                out_string += " TEX:C:B({:d}{:d}{:d}:{:d}:{:d})".format(
+                                                                        1 if (tex_bits & 0x4) else 0,
+                                                                        1 if (tex_bits & 0x2) else 0,
+                                                                        1 if (tex_bits & 0x1) else 0,
+                                                                        c_bit,
+                                                                        b_bit
+                                                                        )
+                # S bit 10
+                if pte & 0x400 :
+                    out_string += " shareable"
+                else:
+                    out_string += " not-shareable"
+
+                # nG bit 11
+                if pte & 0x800:
+                    out_string += " not-global"
+                else:
+                    out_string += " global"
+    
     print out_string
+
+
+def _PmapWalkARMLevel1Section(tte, vaddr, verbose_level = vSCRIPT):
+    paddr = 0
+    #Supersection or just section?
+    if (tte & 0x40000) == 0x40000:
+        paddr = ( (tte & 0xFF000000) | (vaddr & 0x00FFFFFF) )
+    else:
+        paddr = ( (tte & 0xFFF00000) | (vaddr & 0x000FFFFF) )
+
+    if verbose_level >= vSCRIPT:
+        print "{0: <#020x}\n\t{1: <#020x}\n\t".format(addressof(tte), tte),
+
+    PmapDecodeTTEARM(tte, 1, verbose_level)
+
     return paddr
 
 
@@ -518,82 +601,27 @@ def _PmapWalkARMLevel2(tte, vaddr, verbose_level = vSCRIPT):
     pte_index = (vaddr >> 12) & 0xFF
     pte_base_val = kern.GetValueFromAddress(pte_base, 'pt_entry_t *')
     pte = pte_base_val[pte_index]
-    out_string = ''
+
+    paddr = 0
+    if pte & 0x2:
+        paddr = (unsigned(pte) & 0xFFFFF000) | (vaddr & 0xFFF)
+
     if verbose_level >= vSCRIPT:
-        out_string += "{0: <#020x}\n\t{1: <#020x}\n\t".format(addressof(tte), tte)
-        # bit [1:0] evaluated in PmapWalkARM
-        # NS bit 3
-        if tte & 0x8:
-            out_string += ' no-secure'
-        else:
-            out_string += ' secure'
-        #Domain bit [8:5]
-        out_string += " domain({:d})".format(((tte & 0x1e0) >> 5))
-        # IMP bit 9
-        out_string += " imp({:d})".format( ((tte & 0x200) >> 9))
-        out_string += "\n"
+        print "{0: <#020x}\n\t{1: <#020x}\n\t".format(addressof(tte), tte),
+
+    PmapDecodeTTEARM(tte, 1, verbose_level)
     if verbose_level >= vSCRIPT:
-        out_string += "second-level table (index {:d}):\n".format(pte_index)
+        print "second-level table (index {:d}):".format(pte_index)
     if verbose_level >= vDETAIL:
         for i in range(256):
             tmp = pte_base_val[i]
-            out_string += "{0: <#020x}:\t{1: <#020x}\n".format(addressof(tmp), unsigned(tmp))
-
-    paddr = 0
-    if pte & 0x2:
-        paddr = (unsigned(pte) & 0xFFFFF000) | (vaddr & 0xFFF)
+            print "{0: <#020x}:\t{1: <#020x}".format(addressof(tmp), unsigned(tmp))
 
     if verbose_level >= vSCRIPT:
-        out_string += " {0: <#020x}\n\t{1: <#020x}\n\t".format(addressof(pte), unsigned(pte))
-        if (pte & 0x3) == 0x0:
-            out_string += " invalid"
-        else:
-            if (pte & 0x3) == 0x1:
-                out_string += " large"
-                # XN bit 15
-                if pte & 0x8000 == 0x8000:
-                    out_string+= " no-execute"
-                else:
-                    out_string += " execute"
-            else:
-                out_string += " small"
-                # XN bit 0
-                if (pte & 0x1) == 0x01:
-                    out_string += " no-execute"
-                else:
-                    out_string += " execute"
-            # B bit 2
-            b_bit = (pte & 0x4) >> 2
-            c_bit = (pte & 0x8) >> 3
-            # AP bit 9 and [5:4], merged to a single 3-bit value
-            access = (pte & 0x30) >> 4 | (pte & 0x200) >> 7
-            out_string += xnudefines.arm_level2_access_strings[access]
-
-            #TEX bit [14:12] for large, [8:6] for small
-            tex_bits = ((pte & 0x1c0) >> 6)
-            if (pte & 0x3) == 0x1:
-                tex_bits = ((pte & 0x7000) >> 12)
-
-            # Print TEX, C , B alltogether
-            out_string += " TEX:C:B({:d}{:d}{:d}:{:d}:{:d})".format(
-                                                                    1 if (tex_bits & 0x4) else 0,
-                                                                    1 if (tex_bits & 0x2) else 0,
-                                                                    1 if (tex_bits & 0x1) else 0,
-                                                                    c_bit,
-                                                                    b_bit
-                                                                    )
-            # S bit 10
-            if pte & 0x400 :
-                out_string += " shareable"
-            else:
-                out_string += " not-shareable"
+        print " {0: <#020x}\n\t{1: <#020x}\n\t".format(addressof(pte), unsigned(pte)),
+
+    PmapDecodeTTEARM(pte, 2, verbose_level)
 
-            # nG bit 11
-            if pte & 0x800:
-                out_string += " not-global"
-            else:
-                out_string += " global"
-    print out_string
     return paddr
     #end of level 2 walking of arm
 
@@ -606,12 +634,15 @@ def PmapWalkARM(pmap, vaddr, verbose_level = vHUMAN):
     """
     paddr = 0
     # shift by TTESHIFT (20) to get tte index
-    tte_index = ((vaddr - unsigned(pmap.min)) >> 20 )
+    # Assume all L1 indexing starts at VA 0...for our purposes it does,
+    # as that's where all user pmaps start, and the kernel pmap contains
+    # 4 L1 pages (the lower 2 of which are unused after bootstrap)
+    tte_index = vaddr >> 20
     tte = pmap.tte[tte_index]
     if verbose_level >= vSCRIPT:
         print "First-level table (index {:d}):".format(tte_index)
     if verbose_level >= vDETAIL:
-        for i in range(0, 4096):
+        for i in range(0, pmap.tte_index_max):
             ptr = unsigned(addressof(pmap.tte[i]))
             val = unsigned(pmap.tte[i])
             print "{0: <#020x}:\t {1: <#020x}".format(ptr, val)
@@ -683,6 +714,11 @@ def PmapTTnIndexARM64(vaddr, level):
     return (vaddr & PmapIndexMaskARM64(level)) // PmapIndexDivideARM64(level)
 
 def PmapDecodeTTEARM64(tte, level):
+    """ Display the bits of an ARM64 translation table or page table entry
+        in human-readable form.
+        tte: integer value of the TTE/PTE
+        level: translation table level.  Valid values are 1, 2, or 3.
+    """
     assert(type(tte) == long)
     assert(type(level) == int)
     assert_64bit(tte)
@@ -869,3 +905,349 @@ def PmapWalkHelper(cmd_args=None):
     addr = unsigned(kern.GetValueFromAddress(cmd_args[1], 'void *'))
     PmapWalk(pmap, addr, config['verbosity'])
     return
+
+@lldb_command('decode_tte')
+def DecodeTTE(cmd_args=None):
+    """ Decode the bits in the TTE/PTE value specified <tte_val> for translation level <level>
+        Syntax: (lldb) decode_tte <tte_val> <level>
+    """
+    if cmd_args == None or len(cmd_args) < 2:
+        raise ArgumentError("Too few arguments to decode_tte.")
+    if kern.arch == 'arm':
+        PmapDecodeTTEARM(kern.GetValueFromAddress(cmd_args[0], "unsigned long"), ArgumentStringToInt(cmd_args[1]), vSCRIPT)
+    elif kern.arch == 'arm64':
+        PmapDecodeTTEARM64(long(kern.GetValueFromAddress(cmd_args[0], "unsigned long")), ArgumentStringToInt(cmd_args[1]))
+    else:
+        raise NotImplementedError("decode_tte does not support {0}".format(kern.arch))
+
+def PVWalkARM(pa):
+    """ Walk a physical-to-virtual reverse mapping list maintained by the arm pmap
+        pa: physical address (NOT page number).  Does not need to be page-aligned 
+    """
+    vm_first_phys = unsigned(kern.globals.vm_first_phys)
+    vm_last_phys = unsigned(kern.globals.vm_last_phys)
+    if pa < vm_first_phys or pa >= vm_last_phys:
+        raise ArgumentError("PA {:#x} is outside range of managed physical addresses: [{:#x}, {:#x})".format(pa, vm_first_phys, vm_last_phys))
+    page_size = kern.globals.arm_hardware_page_size
+    pn = (pa - unsigned(kern.globals.vm_first_phys)) / page_size
+    pvh = unsigned(kern.globals.pv_head_table[pn])
+    pvh_type = pvh & 0x3
+    if pvh_type == 0:
+        print "PVH type: NULL"
+        return
+    elif pvh_type == 3:
+        print "PVH type: page-table descriptor"
+        return
+    elif pvh_type == 2:
+        ptep = pvh & ~0x3
+        print "PVH type: single PTE"
+        print "PTE {:#x}: {:#x}".format(ptep, dereference(kern.GetValueFromAddress(ptep, 'pt_entry_t *')))
+    elif pvh_type == 1:
+        pvep = pvh & ~0x3
+        print "PVH type: PTE list"
+        while pvep != 0:
+            pve = kern.GetValueFromAddress(pvep, "pv_entry_t *")
+            if unsigned(pve.pve_next) & 0x1:
+                pve_str = ' (alt acct) '
+            else:
+                pve_str = ''
+            pvep = unsigned(pve.pve_next) & ~0x1
+            ptep = unsigned(pve.pve_ptep) & ~0x3
+            print "PTE {:#x}{:s}: {:#x}".format(ptep, pve_str, dereference(kern.GetValueFromAddress(ptep, 'pt_entry_t *')))
+
+@lldb_command('pv_walk')
+def PVWalk(cmd_args=None):
+    """ Show mappings for <physical_address> tracked in the PV list.
+        Syntax: (lldb) pv_walk <physical_address>
+    """
+    if cmd_args == None or len(cmd_args) < 1:
+        raise ArgumentError("Too few arguments to pv_walk.")
+    if kern.arch != 'arm' and kern.arch != 'arm64':
+        raise NotImplementedError("pv_walk does not support {0}".format(kern.arch))
+    PVWalkARM(kern.GetValueFromAddress(cmd_args[0], 'unsigned long'))
+
+def ShowPTEARM(pte):
+    """ Display vital information about an ARM page table entry
+        pte: kernel virtual address of the PTE.  Should be L3 PTE.  May also work with L2 TTEs for certain devices.
+    """
+    page_size = kern.globals.arm_hardware_page_size
+    pn = (pte - unsigned(kern.globals.gVirtBase) + unsigned(kern.globals.gPhysBase) - unsigned(kern.globals.vm_first_phys)) / page_size
+    pvh = kern.globals.pv_head_table[pn]
+    pvh_type = pvh & 0x3
+    if pvh_type != 0x3 and pvh_type != 0x0:
+        raise ValueError("PV head {:#x} does not correspond to a page-table descriptor".format(pvh))
+    ptd = kern.GetValueFromAddress(pvh & ~0x3, 'pt_desc_t *')
+    print "descriptor: {:#x}".format(ptd)
+    print "pmap: {:#x}".format(ptd.pmap)
+    pt_index = (pte % kern.globals.page_size) / page_size
+    pte_pgoff = pte % page_size
+    if kern.arch == 'arm64':
+        pte_pgoff = pte_pgoff / 8
+        nttes = page_size / 8
+    else:
+        pte_pgoff = pte_pgoff / 4
+        nttes = page_size / 4
+    if ptd.pt_cnt[pt_index].refcnt == 0x8000:
+        level = 2
+        granule = nttes * page_size
+    else:
+        level = 3
+        granule = page_size
+    print "maps VA: {:#x}".format(long(unsigned(ptd.pt_map[pt_index].va)) + (pte_pgoff * granule))
+    pteval = long(unsigned(dereference(kern.GetValueFromAddress(unsigned(pte), 'pt_entry_t *'))))
+    print "value: {:#x}".format(pteval)
+    if kern.arch == 'arm64':
+        print "level: {:d}".format(level)
+        PmapDecodeTTEARM64(pteval, level)
+    elif kern.arch == 'arm':
+        PmapDecodeTTEARM(pteval, 2, vSCRIPT)
+
+@lldb_command('showpte')
+def ShowPTE(cmd_args=None):
+    """ Display vital information about the page table entry at VA <pte>
+        Syntax: (lldb) showpte <pte_va>
+    """
+    if cmd_args == None or len(cmd_args) < 1:
+        raise ArgumentError("Too few arguments to showpte.")
+    if kern.arch != 'arm' and kern.arch != 'arm64':
+        raise NotImplementedError("showpte does not support {0}".format(kern.arch))
+    ShowPTEARM(kern.GetValueFromAddress(cmd_args[0], 'unsigned long'))
+
+def FindMappingAtLevelARM(pmap, tt, nttes, level, action):
+    """ Perform the specified action for all valid mappings in an ARM translation table
+        pmap: owner of the translation table
+        tt: translation table or page table
+        nttes: number of entries in tt
+        level: translation table level, 1 or 2
+        action: callback for each valid TTE
+    """
+    for i in range(nttes):
+        try:
+            tte = tt[i]
+            if level == 1:
+                if tte & 0x3 == 0x1:
+                    type = 'table'
+                    granule = 1024
+                    paddr = tte & 0xFFFFFC00
+                elif tte & 0x3 == 0x2:
+                    type = 'block'
+                    if (tte & 0x40000) == 0x40000:
+                        granule = 1 << 24
+                        paddr = tte & 0xFF000000
+                    else:
+                        granule = 1 << 20
+                        paddr = tte & 0xFFF00000
+                else:
+                    continue
+            elif (tte & 0x3) == 0x1:
+                type = 'entry'
+                granule = 1 << 16
+                paddr = tte & 0xFFFF0000
+            elif (tte & 0x3) != 0:
+                type = 'entry' 
+                granule = 1 << 12
+                paddr = tte & 0xFFFFF000
+            else:
+                continue
+            action(pmap, level, type, addressof(tt[i]), paddr, granule)
+            if level == 1 and (tte & 0x3) == 0x1:
+                tt_next = kern.GetValueFromAddress(kern.PhysToKernelVirt(paddr), 'tt_entry_t *')
+                FindMappingAtLevelARM(pmap, tt_next, granule / 4, level + 1, action)
+        except Exception as exc:
+            print "Unable to access tte {:#x}".format(unsigned(addressof(tt[i])))
+
+def FindMappingAtLevelARM64(pmap, tt, nttes, level, action):
+    """ Perform the specified action for all valid mappings in an ARM64 translation table
+        pmap: owner of the translation table
+        tt: translation table or page table
+        nttes: number of entries in tt
+        level: translation table level, 1 2 or 3
+        action: callback for each valid TTE
+    """
+    page_size = kern.globals.arm_hardware_page_size
+    page_offset_mask = (page_size - 1)
+    page_base_mask = ((1 << ARM64_VMADDR_BITS) - 1) & (~page_offset_mask)
+    for i in range(nttes):
+        try:
+            tte = tt[i]
+            if tte & 0x1 == 0x1:
+                if tte & 0x2 == 0x2:
+                    if level < 3:
+                        type = 'table'
+                    else:
+                        type = 'entry'
+                    granule = page_size
+                    paddr = tte & page_base_mask
+                elif level < 3:
+                    type = 'block'
+                    granule = PmapBlockOffsetMaskARM64(level) + 1
+                    paddr = tte & PmapBlockBaseMaskARM64(level)
+                else:
+                    continue
+                action(pmap, level, type, addressof(tt[i]), paddr, granule)
+                if level < 3 and (tte & 0x2 == 0x2):
+                    tt_next = kern.GetValueFromAddress(kern.PhysToKernelVirt(paddr), 'tt_entry_t *')
+                    FindMappingAtLevelARM64(pmap, tt_next, granule / ARM64_TTE_SIZE, level + 1, action)
+        except Exception as exc:
+            print "Unable to access tte {:#x}".format(unsigned(addressof(tt[i]))) 
+
+def ScanPageTables(action, targetPmap=None):
+    """ Perform the specified action for all valid mappings in all page tables,
+        optionally restricted to a single pmap.
+        pmap: pmap whose page table should be scanned.  If None, all pmaps on system will be scanned.
+    """
+    print "Scanning all available translation tables.  This may take a long time..."
+    def ScanPmap(pmap, action):
+        if kern.arch == 'arm64':
+            granule = kern.globals.arm64_root_pgtable_num_ttes * 8
+        elif kern.arch == 'arm':
+            granule = pmap.tte_index_max * 4
+        action(pmap, 1, 'root', pmap.tte, unsigned(pmap.ttep), granule)
+        if kern.arch == 'arm64':
+            FindMappingAtLevelARM64(pmap, pmap.tte, kern.globals.arm64_root_pgtable_num_ttes, kern.globals.arm64_root_pgtable_level, action)
+        elif kern.arch == 'arm':
+            FindMappingAtLevelARM(pmap, pmap.tte, pmap.tte_index_max, 1, action)
+
+    if targetPmap is not None:
+        ScanPmap(kern.GetValueFromAddress(targetPmap, 'pmap_t'), action)
+    else:
+        for pmap in IterateQueue(kern.globals.map_pmap_list, 'pmap_t', 'pmaps'):
+            ScanPmap(pmap, action)        
+
+@lldb_command('showallmappings')
+def ShowAllMappings(cmd_args=None):
+    """ Find and display all available mappings on the system for
+        <physical_address>.  Optionally only searches the pmap
+        specified by [<pmap>]
+        Syntax: (lldb) showallmappings <physical_address> [<pmap>]
+        WARNING: this macro can take a long time (up to 30min.) to complete!
+    """
+    if cmd_args == None or len(cmd_args) < 1:
+        raise ArgumentError("Too few arguments to showallmappings.")
+    if kern.arch != 'arm' and kern.arch != 'arm64':
+        raise NotImplementedError("showallmappings does not support {0}".format(kern.arch))
+    pa = kern.GetValueFromAddress(cmd_args[0], 'unsigned long')
+    targetPmap = None
+    if len(cmd_args) > 1:
+        targetPmap = cmd_args[1]
+    def printMatchedMapping(pmap, level, type, tte, paddr, granule):
+        if paddr <= pa < (paddr + granule):
+            print "pmap: {:#x}: L{:d} {:s} at {:#x}: [{:#x}, {:#x})".format(pmap, level, type, unsigned(tte), paddr, paddr + granule)
+    ScanPageTables(printMatchedMapping, targetPmap)
+
+def checkPVList(pmap, level, type, tte, paddr, granule):
+    """ Checks an ARM physical-to-virtual mapping list for consistency error.
+        pmap: owner of the translation table
+        level: translation table level.  PV lists will only be checked for L2 (arm32) or L3 (arm64) tables.
+        type: unused
+        tte: KVA of PTE to check for presence in PV list.  If None, presence check will be skipped.
+        paddr: physical address whose PV list should be checked.  Need not be page-aligned.
+        granule: unused
+    """
+    vm_first_phys = unsigned(kern.globals.vm_first_phys)
+    vm_last_phys = unsigned(kern.globals.vm_last_phys)
+    page_size = kern.globals.arm_hardware_page_size
+    if kern.arch == 'arm64':
+        page_offset_mask = (page_size - 1)
+        page_base_mask = ((1 << ARM64_VMADDR_BITS) - 1) & (~page_offset_mask)
+        paddr = paddr & page_base_mask
+        max_level = 3
+    elif kern.arch == 'arm':
+        page_base_mask = 0xFFFFF000
+        paddr = paddr & page_base_mask
+        max_level = 2
+    if level < max_level or paddr < vm_first_phys or paddr >= vm_last_phys:
+        return
+    pn = (paddr - vm_first_phys) / page_size
+    pvh = unsigned(kern.globals.pv_head_table[pn])
+    pvh_type = pvh & 0x3
+    if pmap is not None:
+        pmap_str = "pmap: {:#x}: ".format(pmap)
+    else:
+        pmap_str = ''
+    if tte is not None:
+        tte_str = "pte {:#x} ({:#x}): ".format(unsigned(tte), paddr)
+    else:
+        tte_str = "paddr {:#x}: ".format(paddr) 
+    if pvh_type == 0 or pvh_type == 3:
+        print "{:s}{:s}unexpected PVH type {:d}".format(pmap_str, tte_str, pvh_type)
+    elif pvh_type == 2:
+        ptep = pvh & ~0x3
+        if tte is not None and ptep != unsigned(tte):
+            print "{:s}{:s}PVH mismatch ({:#x})".format(pmap_str, tte_str, ptep)
+        try:
+            pte = long(unsigned(dereference(kern.GetValueFromAddress(ptep, 'pt_entry_t *')))) & page_base_mask 
+            if (pte != paddr):
+                print "{:s}{:s}PVH {:#x} maps wrong page ({:#x}) ".format(pmap_str, tte_str, ptep, pte)
+        except Exception as exc:
+            print "{:s}{:s}Unable to read PVH {:#x}".format(pmap_str, tte_str, ptep)
+    elif pvh_type == 1:
+        pvep = pvh & ~0x3
+        tte_match = False
+        while pvep != 0:
+            pve = kern.GetValueFromAddress(pvep, "pv_entry_t *")
+            pvep = unsigned(pve.pve_next) & ~0x1
+            ptep = unsigned(pve.pve_ptep) & ~0x3
+            if tte is not None and ptep == unsigned(tte):
+                tte_match = True
+            try:
+                pte = long(unsigned(dereference(kern.GetValueFromAddress(ptep, 'pt_entry_t *')))) & page_base_mask 
+                if (pte != paddr):
+                    print "{:s}{:s}PVE {:#x} maps wrong page ({:#x}) ".format(pmap_str, tte_str, ptep, pte)
+            except Exception as exc:
+                print "{:s}{:s}Unable to read PVE {:#x}".format(pmap_str, tte_str, ptep)
+        if tte is not None and not tte_match:
+            print "{:s}{:s}not found in PV list".format(pmap_str, tte_str, paddr)
+
+@lldb_command('pv_check', 'P')
+def PVCheck(cmd_args=None, cmd_options={}):
+    """ Check the physical-to-virtual mapping for a given PTE or physical address
+        Syntax: (lldb) pv_check <addr> [-p]
+            -P        : Interpret <addr> as a physical address rather than a PTE
+    """
+    if cmd_args == None or len(cmd_args) < 1:
+        raise ArgumentError("Too few arguments to showallmappings.")
+    if kern.arch == 'arm':
+        level = 2
+    elif kern.arch == 'arm64':
+        level = 3
+    else:
+        raise NotImplementedError("showallmappings does not support {0}".format(kern.arch))
+    if "-P" in cmd_options:
+        pte = None
+        pa = long(unsigned(kern.GetValueFromAddress(cmd_args[0], "unsigned long")))
+    else:
+        pte = kern.GetValueFromAddress(cmd_args[0], 'pt_entry_t *')
+        pa = long(unsigned(dereference(pte)))
+    checkPVList(None, level, None, pte, pa, None)
+
+@lldb_command('check_pmaps')
+def CheckPmapIntegrity(cmd_args=None):
+    """ Performs a system-wide integrity check of all PTEs and associated PV lists.
+        Optionally only checks the pmap specified by [<pmap>]
+        Syntax: (lldb) check_pmaps [<pmap>]
+        WARNING: this macro can take a HUGE amount of time (several hours) if you do not
+        specify [pmap] to limit it to a single pmap.  It will also give false positives
+        for kernel_pmap, as we do not create PV entries for static kernel mappings on ARM.
+        Use of this macro without the [<pmap>] argument is heavily discouraged.
+    """
+    if kern.arch != 'arm' and kern.arch != 'arm64':
+        raise NotImplementedError("showallmappings does not support {0}".format(kern.arch))
+    targetPmap = None
+    if len(cmd_args) > 0:
+        targetPmap = cmd_args[0]
+    ScanPageTables(checkPVList, targetPmap)
+
+@lldb_command('pmapsforledger')
+def PmapsForLedger(cmd_args=None):
+    """ Find and display all pmaps currently using <ledger>.
+        Syntax: (lldb) pmapsforledger <ledger>
+    """
+    if cmd_args == None or len(cmd_args) < 1:
+        raise ArgumentError("Too few arguments to pmapsforledger.")
+    if kern.arch != 'arm' and kern.arch != 'arm64':
+        raise NotImplementedError("pmapsforledger does not support {0}".format(kern.arch))
+    ledger = kern.GetValueFromAddress(cmd_args[0], 'ledger_t')
+    for pmap in IterateQueue(kern.globals.map_pmap_list, 'pmap_t', 'pmaps'):
+        if pmap.ledger == ledger:
+            print "pmap: {:#x}".format(pmap)
index 5420349e4bf14ec05ba885118322e7f1f2d61908..906d47a7ff05b1ebe334ad1509c44a7eb8465a37 100644 (file)
@@ -238,6 +238,19 @@ def GetTaskSummary(task, showcorpse=False):
         out_string += " " + GetKCDataSummary(task.corpse_info)
     return out_string
 
+def GetThreadName(thread):
+    """ Get the name of a thread, if possible.  Returns the empty string
+        otherwise.
+    """
+    if int(thread.uthread) != 0:
+        uthread = Cast(thread.uthread, 'uthread *')
+        if int(uthread.pth_name) != 0 :
+            th_name_strval = Cast(uthread.pth_name, 'char *')
+            if len(str(th_name_strval)) > 0 :
+                return str(th_name_strval)
+
+    return ''
+
 @lldb_type_summary(['thread *', 'thread_t'])
 @header("{0: <24s} {1: <10s} {2: <20s} {3: <6s} {4: <6s} {5: <15s} {6: <15s} {7: <8s} {8: <12s} {9: <32s} {10: <20s} {11: <20s} {12: <20s}".format('thread', 'thread_id', 'processor', 'base', 'pri', 'sched_mode', 'io_policy', 'state', 'ast', 'waitq', 'wait_event', 'wmesg', 'thread_name'))
 def GetThreadSummary(thread):
@@ -267,7 +280,6 @@ def GetThreadSummary(thread):
     if int(thread.static_param) : 
         thread_ptr_str+="[WQ]"
     thread_id = hex(thread.thread_id)
-    thread_name = ''
     processor = hex(thread.last_processor)
     base_priority = str(int(thread.base_pri))
     sched_priority = str(int(thread.sched_pri))
@@ -288,14 +300,10 @@ def GetThreadSummary(thread):
         sched_mode+=" BG"
     
     io_policy_str = ""
+    thread_name = GetThreadName(thread)
     if int(thread.uthread) != 0:
         uthread = Cast(thread.uthread, 'uthread *')
-        #check for thread name
-        if int(uthread.pth_name) != 0 :
-            th_name_strval = Cast(uthread.pth_name, 'char *')
-            if len(str(th_name_strval)) > 0 :
-                thread_name = str(th_name_strval)
-        
+
         #check for io_policy flags 
         if int(uthread.uu_flag) & 0x400:
             io_policy_str+='RAGE '
@@ -612,6 +620,12 @@ def GetProcSummary(proc):
         wq_idle_threads = -1
         wq_req_threads = -1
     process_name = str(proc.p_comm)
+    if process_name == 'xpcproxy':
+        for thread in IterateQueue(task.threads, 'thread *', 'task_threads'):
+            thread_name = GetThreadName(thread)
+            if thread_name:
+                process_name += ' (' + thread_name + ')'
+                break
     out_string += format_string.format(pid, proc_addr, " ".join([proc_rage_str, io_policy_str]), wq_num_threads, wq_idle_threads, wq_req_threads, process_name)
     return out_string
 
@@ -1060,6 +1074,23 @@ def ShowAllTasks(cmd_args=None, cmd_options={}):
         print out_str
     ZombTasks()
 
+@lldb_command('taskforpmap')
+def TaskForPmap(cmd_args=None):
+    """ Find the task whose pmap corresponds to <pmap>.
+        Syntax: (lldb) taskforpmap <pmap>
+            Multiple -v's can be specified for increased verbosity
+    """
+    if cmd_args == None or len(cmd_args) < 1:
+        raise ArgumentError("Too few arguments to taskforpmap.")
+    pmap = kern.GetValueFromAddress(cmd_args[0], 'pmap_t')
+    print GetTaskSummary.header + " " + GetProcSummary.header
+    for tasklist in [kern.tasks, kern.terminated_tasks]:
+        for t in tasklist:
+            if t.map.pmap == pmap:
+                pval = Cast(t.bsd_info, 'proc *')
+                out_str = GetTaskSummary(t) + " " + GetProcSummary(pval)
+                print out_str
+
 @lldb_command('showterminatedtasks') 
 def ShowTerminatedTasks(cmd_args=None):
     """  Routine to print a summary listing of all the terminated tasks
index fbb0494bc85f45f843c164d7c192dd6f6611c03f..eaa3bcc00b362d3cc96478fee972550c5b942c1d 100644 (file)
@@ -398,7 +398,7 @@ def dsymForUUID(uuid):
     """
     import subprocess
     import plistlib
-    output = subprocess.check_output(["/usr/local/bin/dsymForUUID", uuid])
+    output = subprocess.check_output(["/usr/local/bin/dsymForUUID", "--copyExecutable", uuid])
     if output:
         # because of <rdar://12713712>
         #plist = plistlib.readPlistFromString(output)
index f93fd476d4b255cf6139bd00a051e6906d91079b..b8bcc6bede8b5d705bd1cd07dafc9cd90cfa4d50 100644 (file)
@@ -85,7 +85,7 @@ def lldb_command(cmd_name, option_string = ''):
     def _cmd(obj):
         def _internal_command_function(debugger, command, result, internal_dict):
             global config, lldb_run_command_state
-            stream = CommandOutput(result)
+            stream = CommandOutput(cmd_name, result)
             # need to avoid printing on stdout if called from lldb_run_command.
             if 'active' in lldb_run_command_state and lldb_run_command_state['active']:
                 debuglog('Running %s from lldb_run_command' % command)
@@ -616,7 +616,7 @@ def ShowPanicLog(cmd_args=None, cmd_options={}):
         if p_char == '\n':
             if not in_binary_data_region:
                 num_print_bytes += 1
-                print out_str
+                print out_str[:-1]
             if (out_str.find("Data: BEGIN>>") >= 0):
                 in_binary_data_region = True
                 pos += binary_data_bytes_to_skip - 1
index 604c2791ce409c350970b9ed2ecdf260212e93a2..9aa59c68fbed11c9e2254b404a321c28b111a4c2 100644 (file)
 """
 import os, re
 
+def GetStateString(strings_dict, state):
+    """ Turn a dictionary from flag value to flag name and a state mask with
+        those flags into a space-separated string of names.
+
+        params:
+            strings_dict: a dictionary of flag values to flag names
+            state: the value to get the state string of
+        return:
+            a space separated list of flag names present in state
+    """
+    max_mask = max(strings_dict.keys())
+
+    first = True
+    output = ''
+    mask = 0x1
+    while mask <= max_mask:
+        bit = int(state & mask)
+        if bit and bit in strings_dict:
+            if not first:
+                output += ' '
+            else:
+                first = False
+            output += strings_dict[int(state & mask)]
+        mask = mask << 1
+
+    return output
+
+kdebug_flags_strings = { 0x00100000: 'RANGECHECK',
+                         0x00200000: 'VALCHECK',
+                         0x00400000: 'TYPEFILTER_CHECK',
+                         0x80000000: 'BUFINIT' }
+kdebug_typefilter_check = 0x00400000
+
+kperf_samplers_strings = { 1 << 0: 'TH_INFO',
+                           1 << 1: 'TH_SNAP',
+                           1 << 2: 'KSTACK',
+                           1 << 3: 'USTACK',
+                           1 << 4: 'PMC_THREAD',
+                           1 << 5: 'PMC_CPU',
+                           1 << 6: 'PMC_CONFIG',
+                           1 << 7: 'MEMINFO',
+                           1 << 8: 'TH_SCHED',
+                           1 << 9: 'TH_DISP',
+                           1 << 10: 'TK_SNAP' }
+
 lcpu_self = 0xFFFE
 arm_level2_access_strings = [ " noaccess",
                               " supervisor(readwrite) user(noaccess)",
index 9080b3347b12fd8c6e0a8390dbc77813db9ec2a1..ce8f8ec547b57c8c200363aeed0b9723240b32fc 100644 (file)
@@ -32,7 +32,8 @@ COMMON_TARGETS = unit_tests \
                jitter                  \
                perf_index              \
                darwintests             \
-               unixconf
+               unixconf                \
+               testkext/pgokext.kext
 
 IPHONE_TARGETS =
 
@@ -52,6 +53,12 @@ all: $(BATS_TARGET) $(TARGETS)
 
 always:
 
+# NOTE: RC_ARCHES nonsense is here because code signing will fail on kexts if we include a i386 slice
+# <rdar://problem/29878263> CoreOSLobo: xnu_tests-4026 fails to codesign
+
+$(DSTSUBPATH)/testkext/pgokext.kext: always
+       xcodebuild -configuration Debug -project $(SRCROOT)/testkext/testkext.xcodeproj -target pgokext DSTROOT=$(DSTSUBPATH)/testkext SYMROOT=$(SYMROOT)/testkext SRCROOT=$(SRCROOT)/testkext OBJROOT=$(OBJROOT)/testkext SDKROOT=$(SDKROOT) RC_ARCHS="$(subst i386,,$(RC_ARCHS))" install
+
 $(DSTSUBPATH)/%: always
        $(_v)echo Building $@
        $(_v)mkdir -p $@
index f706e13b7fe48c3c12540a03031aacb22794e47c..760e5154516835492eaef4767f5365bf51c1b9ba 100644 (file)
@@ -15,8 +15,12 @@ include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.common
 
 OTHER_CFLAGS  = -Weverything -Wno-gnu-union-cast -Wno-missing-field-initializers -Wno-partial-availability
 OTHER_CFLAGS += -Wno-missing-noreturn -Wno-vla -Wno-reserved-id-macro -Wno-documentation-unknown-command
-OTHER_CFLAGS += -Wno-padded -Wno-used-but-marked-unused
+OTHER_CFLAGS += -Wno-padded -Wno-used-but-marked-unused -Wno-covered-switch-default
 OTHER_CFLAGS += --std=gnu11 -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
+OTHER_CFLAGS += -DT_NAMESPACE=xnu
+
+CODESIGN:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign)
+CODESIGN_ALLOCATE:=$(shell xcrun -sdk "$(TARGETSDK)" -find codesign_allocate)
 
 # to have custom compiler flags to
 # target: OTHER_CFLAGS += <my flags>
@@ -24,11 +28,22 @@ OTHER_CFLAGS += --std=gnu11 -isystem $(SDKROOT)/System/Library/Frameworks/System
 backtracing: OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
 backtracing: OTHER_LDFLAGS += -framework CoreSymbolication
 
+data_protection: OTHER_LDFLAGS += -framework IOKit
+
 kdebug: INVALID_ARCHS = i386
 kdebug: OTHER_LDFLAGS = -lktrace
 
 EXCLUDED_SOURCES += kperf_helpers.c
 
+ifeq ($(PLATFORM),iPhoneOS)
+CONFIG_FREEZE_DEFINE:= -DCONFIG_FREEZE
+else
+CONFIG_FREEZE_DEFINE:=
+EXCLUDED_SOURCES += jumbo_va_spaces_28530648.c
+endif
+
+perf_compressor: OTHER_CFLAGS += $(CONFIG_FREEZE_DEFINE)
+
 kperf: INVALID_ARCHS = i386
 kperf: OTHER_CFLAGS += kperf_helpers.c
 kperf: OTHER_CFLAGS += -F $(SDKROOT)/System/Library/PrivateFrameworks
@@ -45,7 +60,35 @@ mach_get_times: OTHER_LDFLAGS += -ldarwintest_utils
 perf_exit: OTHER_LDFLAGS = -lktrace
 perf_exit: INVALID_ARCHS = i386
 
+task_inspect: CODE_SIGN_ENTITLEMENTS = task_inspect.entitlements
+task_inspect: OTHER_CFLAGS += -DENTITLED=1
+
+CUSTOM_TARGETS += perf_exit_proc
+
+perf_exit_proc:
+       $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) perf_exit_proc.c -o $(SYMROOT)/perf_exit_proc
+
+install-perf_exit_proc: perf_exit_proc
+       mkdir -p $(INSTALLDIR)
+       cp $(SYMROOT)/perf_exit_proc $(INSTALLDIR)/
+
+perf_kdebug: INVALID_ARCHS = i386
+
 stackshot_idle_25570396: INVALID_ARCHS = i386
 stackshot_idle_25570396: OTHER_LDFLAGS += -lkdd -framework Foundation
 
+stackshot_block_owner_14362384: INVALID_ARCHS = i386
+stackshot_block_owner_14362384: OTHER_LDFLAGS += -framework Foundation -lpthread -lkdd
+
+ifeq ($(PLATFORM),iPhoneOS)
+OTHER_TEST_TARGETS += jumbo_va_spaces_28530648_unentitled
+jumbo_va_spaces_28530648: CODE_SIGN_ENTITLEMENTS = jumbo_va_spaces_28530648.entitlements
+jumbo_va_spaces_28530648: OTHER_CFLAGS += -DENTITLED=1
+jumbo_va_spaces_28530648: OTHER_LDFLAGS += -ldarwintest_utils
+
+jumbo_va_spaces_28530648_unentitled: OTHER_LDFLAGS += -ldarwintest_utils
+jumbo_va_spaces_28530648_unentitled: jumbo_va_spaces_28530648.c
+       $(CC) $(DT_CFLAGS) $(OTHER_CFLAGS) $(CFLAGS) $(DT_LDFLAGS) $(OTHER_LDFLAGS) $(LDFLAGS) $< -o $(SYMROOT)/$@
+endif
+
 include $(DEVELOPER_DIR)/AppleInternal/Makefiles/darwintest/Makefile.targets
index bc0161fdda07afa0540ef5023462355152fda827..614ec12b6d627a863e5f4b5f6efb0f558c338409 100644 (file)
@@ -161,10 +161,12 @@ backtrace_thread(void *arg)
 }
 
 T_DECL(backtrace_user, "test that the kernel can backtrace user stacks",
-    T_META_ALL_VALID_ARCHS(YES))
+    T_META_CHECK_LEAKS(false), T_META_ALL_VALID_ARCHS(true))
 {
     pthread_t thread;
 
     T_QUIET; T_ASSERT_POSIX_ZERO(pthread_create(&thread, NULL, backtrace_thread,
         NULL), "create additional thread to backtrace");
+
+    T_QUIET; T_ASSERT_POSIX_ZERO(pthread_join(thread, NULL), NULL);
 }
diff --git a/tools/tests/darwintests/data_protection.c b/tools/tests/darwintests/data_protection.c
new file mode 100644 (file)
index 0000000..f39fe0f
--- /dev/null
@@ -0,0 +1,1152 @@
+#include <darwintest.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/mount.h>
+#include <sys/wait.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <IOKit/IOKitLib.h>
+#include <Kernel/IOKit/crypto/AppleKeyStoreDefs.h>
+#include <Kernel/sys/content_protection.h>
+
+#define CPT_IO_SIZE      4096
+#define CPT_AKS_BUF_SIZE 256
+#define CPT_MAX_PASS_LEN 64
+
+#define GET_PROT_CLASS(fd) \
+       fcntl((fd), F_GETPROTECTIONCLASS)
+
+#define SET_PROT_CLASS(fd, prot_class) \
+       fcntl((fd), F_SETPROTECTIONCLASS, (prot_class))
+
+#define KEYSTORECTL_PATH  "/usr/local/bin/keystorectl"
+#define KEYBAGDTEST_PATH  "/usr/local/bin/keybagdTest"
+#define TEMP_DIR_TEMPLATE "/tmp/data_protection_test.XXXXXXXX"
+#define TEST_PASSCODE     "IAmASecurePassword"
+
+int g_fd           = -1;
+int g_dir_fd       = -1;
+int g_subdir_fd    = -1;
+int g_passcode_set = 0;
+
+char g_test_tempdir[PATH_MAX] = TEMP_DIR_TEMPLATE;
+char g_filepath[PATH_MAX]     = "";
+char g_dirpath[PATH_MAX]      = "";
+char g_subdirpath[PATH_MAX]   = "";
+
+int apple_key_store(
+       uint32_t command,
+       uint64_t * inputs,
+       uint32_t input_count,
+       void * input_structs,
+       size_t input_struct_count,
+       uint64_t * outputs,
+       uint32_t * output_count
+);
+int spawn_proc(char * const command[]);
+int supports_content_prot();
+char* dp_class_num_to_string(int num);
+int lock_device(void);
+int unlock_device(char * passcode);
+int set_passcode(char * new_passcode, char * old_passcode);
+int clear_passcode(char * passcode);
+int has_passcode(void);
+void setup(void);
+void cleanup(void);
+
+T_DECL(data_protection,
+       "Verify behavior of the various data protection classes") {
+       int local_result = -1;
+       int new_prot_class = -1;
+       int old_prot_class = -1;
+       int current_byte = 0;
+       char rd_buffer[CPT_IO_SIZE];
+       char wr_buffer[CPT_IO_SIZE];
+
+       setup();
+
+       /*
+        * Ensure we can freely read and change
+        * protection classes when unlocked.
+        */
+       for(
+               new_prot_class = PROTECTION_CLASS_A;
+               new_prot_class <= PROTECTION_CLASS_F;
+               new_prot_class++
+       ) {
+               T_ASSERT_NE(
+                       old_prot_class = GET_PROT_CLASS(g_fd),
+                       -1,
+                       "Get protection class when locked"
+               );
+               T_WITH_ERRNO;
+               T_ASSERT_NE(
+                       SET_PROT_CLASS(g_fd, new_prot_class),
+                       -1,
+                       "Should be able to change protection "
+                       "from %s to %s while unlocked",
+                       dp_class_num_to_string(old_prot_class),
+                       dp_class_num_to_string(new_prot_class)
+               );
+       }
+
+       /* Query the filesystem for the default CP level (Is it C?) */
+#ifndef F_GETDEFAULTPROTLEVEL
+#define F_GETDEFAULTPROTLEVEL 79
+#endif
+
+       T_WITH_ERRNO;
+       T_ASSERT_NE(
+               old_prot_class = fcntl(g_fd, F_GETDEFAULTPROTLEVEL),
+               -1,
+               "Get default protection level for filesystem"
+       );
+
+       /* XXX: Do we want to do anything with the level? What should it be? */
+
+       /*
+        * files are allowed to move into F, but not out of it. They can also
+        * only do so when they do not have content.
+        */
+       close(g_fd);
+       unlink(g_filepath);
+
+       /* re-create the file */
+       T_WITH_ERRNO;
+       T_ASSERT_GE(
+               g_fd = open(g_filepath, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC),
+               0,
+               "Recreate test file"
+       );
+
+       /* Try making a class A file while locked. */
+       T_ASSERT_EQ(lock_device(), 0, "*** Lock device ***");
+
+       T_WITH_ERRNO;
+       T_ASSERT_EQ(
+               SET_PROT_CLASS(g_fd, PROTECTION_CLASS_A),
+               -1,
+               "Should not be able to change protection "
+               "from class D to class A when locked"
+       );
+       T_ASSERT_EQ(unlock_device(TEST_PASSCODE), 0, "*** Unlock device ***");
+
+       /* Attempt opening/IO to a class A file while unlocked. */
+       T_WITH_ERRNO;
+       T_ASSERT_EQ(
+               SET_PROT_CLASS(g_fd, PROTECTION_CLASS_A),
+               0,
+               "Should be able to change protection "
+               "from class D to class A when unlocked"
+       );
+
+       close(g_fd);
+
+       T_WITH_ERRNO;
+       T_ASSERT_GE(
+               g_fd = open(g_filepath, O_RDWR|O_CLOEXEC),
+               0,
+               "Should be able to open a class A file when unlocked");
+
+       /*
+        * TODO: Write specific data we can check for. If we're going to do
+        * that, the write scheme should be deliberately ugly.
+        */
+       current_byte = 0;
+
+       while(current_byte < CPT_IO_SIZE) {
+               local_result = pwrite(
+                       g_fd,
+                       &wr_buffer[current_byte],
+                       CPT_IO_SIZE - current_byte,
+                       current_byte
+               );
+
+               T_WITH_ERRNO;
+               T_ASSERT_NE(
+                       local_result,
+                       -1,
+                       "Should be able to write to "
+                       "a class A file when unlocked"
+               );
+
+               current_byte += local_result;
+       }
+
+       current_byte = 0;
+
+       while(current_byte < CPT_IO_SIZE) {
+               local_result = pread(
+                       g_fd,
+                       &rd_buffer[current_byte],
+                       CPT_IO_SIZE - current_byte,
+                       current_byte
+               );
+
+               T_WITH_ERRNO;
+               T_ASSERT_NE(
+                       local_result,
+                       -1,
+                       "Should be able to read from "
+                       "a class A file when unlocked"
+               );
+
+               current_byte += local_result;
+       }
+
+       /*
+        * Again, but now while locked; and try to change the file class
+        * as well.
+        */
+       T_ASSERT_EQ(lock_device(), 0, "*** Lock device ***");
+
+       T_ASSERT_LE(
+               pread(g_fd, rd_buffer, CPT_IO_SIZE, 0),
+               0,
+               "Should not be able to read from a class A file when locked"
+       );
+
+       T_ASSERT_LE(
+               pwrite(g_fd, wr_buffer, CPT_IO_SIZE, 0),
+               0,
+               "Should not be able to write to a class A file when locked"
+       );
+
+       T_ASSERT_EQ(
+               SET_PROT_CLASS(g_fd, PROTECTION_CLASS_D),
+               -1,
+               "Should not be able to change protection "
+               "from class A to class D when locked"
+       );
+
+       /* Try to open and truncate the file. */
+       close(g_fd);
+
+       T_ASSERT_EQ(
+               g_fd = open(g_filepath, O_RDWR|O_TRUNC|O_CLOEXEC),
+               -1,
+               "Should not be able to open and truncate "
+               "a class A file when locked"
+       );
+
+       /* Try to open the file */
+       T_ASSERT_EQ(
+               g_fd = open(g_filepath, O_RDWR|O_CLOEXEC),
+               -1,
+               "Should not be able to open a class A file when locked"
+       );
+
+       /* What about class B files? */
+       T_ASSERT_EQ(unlock_device(TEST_PASSCODE), 0, "*** Unlock device ***");
+
+       T_ASSERT_GE(
+               g_fd = open(g_filepath, O_RDWR|O_CLOEXEC),
+               0,
+               "Should be able to open a class A file when unlocked"
+       );
+
+       T_WITH_ERRNO;
+       T_ASSERT_EQ(
+               SET_PROT_CLASS(g_fd, PROTECTION_CLASS_D),
+               0,
+               "Should be able to change protection "
+               "class from A to D when unlocked"
+       );
+
+       T_ASSERT_EQ(lock_device(), 0, "*** Lock device ***");
+
+       /* Can we create a class B file while locked? */
+       T_ASSERT_EQ(
+               SET_PROT_CLASS(g_fd, PROTECTION_CLASS_B),
+               0,
+               "Should be able to change protection "
+               "class from D to B when locked"
+       );
+
+       T_ASSERT_EQ(
+               GET_PROT_CLASS(g_fd),
+               PROTECTION_CLASS_B,
+               "File should now have class B protection"
+       );
+
+       /*
+        * We should also be able to read/write to the
+        * file descriptor while it is open.
+        */
+       current_byte = 0;
+
+       while(current_byte < CPT_IO_SIZE) {
+               local_result = pwrite(
+                       g_fd,
+                       &wr_buffer[current_byte],
+                       CPT_IO_SIZE - current_byte,
+                       current_byte
+               );
+
+               T_WITH_ERRNO;
+               T_ASSERT_NE(
+                       local_result,
+                       -1,
+                       "Should be able to write to a "
+                       "new class B file when locked"
+               );
+
+               current_byte += local_result;
+       }
+
+       current_byte = 0;
+
+       while(current_byte < CPT_IO_SIZE) {
+               local_result = pread(
+                       g_fd,
+                       &rd_buffer[current_byte],
+                       CPT_IO_SIZE - current_byte,
+                       current_byte
+               );
+
+               T_ASSERT_NE(
+                       local_result,
+                       -1,
+                       "Should be able to read from a "
+                       "new class B file when locked"
+               );
+
+               current_byte += local_result;
+       }
+
+       /* We should not be able to open a class B file under lock. */
+       close(g_fd);
+       T_WITH_ERRNO;
+       T_ASSERT_EQ(
+               g_fd = open(g_filepath, O_RDWR|O_CLOEXEC),
+               -1,
+               "Should not be able to open a class B file when locked"
+       );
+
+       unlink(g_filepath);
+
+       /* We still need to test directory semantics. */
+       T_WITH_ERRNO;
+       T_ASSERT_NE(
+               mkdir(g_dirpath, 0x0777),
+               -1,
+               "Should be able to create a new directory when locked"
+       );
+
+       /* The newly created directory should not have a protection class. */
+       T_ASSERT_NE(
+               g_dir_fd = open(g_dirpath, O_RDONLY|O_CLOEXEC),
+               -1,
+               "Should be able to open an unclassed directory when locked"
+       );
+
+       T_ASSERT_TRUE(
+               GET_PROT_CLASS(g_dir_fd) == PROTECTION_CLASS_D ||
+               GET_PROT_CLASS(g_dir_fd) == PROTECTION_CLASS_DIR_NONE,
+               "Directory protection class sholud be D or NONE"
+       );
+
+       T_ASSERT_EQ(
+               SET_PROT_CLASS(g_dir_fd, PROTECTION_CLASS_A),
+               0,
+               "Should be able to change a directory from "
+               "class D to class A while locked"
+       );
+
+       T_ASSERT_EQ(
+               SET_PROT_CLASS(g_dir_fd, PROTECTION_CLASS_D),
+               0,
+               "Should be able to change a directory from "
+               "class A to class D while locked"
+       );
+
+       /*
+        * Do all files created in the directory properly inherit the
+        * directory's protection class?
+        */
+       T_SETUPBEGIN;
+       T_ASSERT_LT(
+               strlcpy(g_filepath, g_dirpath, PATH_MAX),
+               PATH_MAX,
+               "Construct path for file in the directory"
+       );
+       T_ASSERT_LT(
+               strlcat(g_filepath, "test_file", PATH_MAX),
+               PATH_MAX,
+               "Construct path for file in the directory"
+       );
+       T_SETUPEND;
+
+       T_ASSERT_EQ(unlock_device(TEST_PASSCODE), 0, "*** Unlock device ***");
+
+       for(
+               new_prot_class = PROTECTION_CLASS_A;
+               new_prot_class <= PROTECTION_CLASS_D;
+               new_prot_class++
+       ) {
+               int getclass_dir;
+
+               T_WITH_ERRNO;
+               T_ASSERT_NE(
+                       old_prot_class = GET_PROT_CLASS(g_dir_fd),
+                       -1,
+                       "Get protection class for the directory"
+               );
+
+               T_WITH_ERRNO;
+               T_ASSERT_EQ(
+                       SET_PROT_CLASS(g_dir_fd, new_prot_class),
+                       0,
+                       "Should be able to change directory "
+                       "protection from %s to %s",
+                       dp_class_num_to_string(old_prot_class),
+                       dp_class_num_to_string(new_prot_class)
+               );
+
+               T_EXPECT_EQ(
+                       getclass_dir = GET_PROT_CLASS(g_dir_fd),
+                       new_prot_class,
+                       "Get protection class for the directory"
+               );
+
+               T_WITH_ERRNO;
+               T_ASSERT_GE(
+                       g_fd = open(g_filepath, O_CREAT|O_EXCL|O_CLOEXEC, 0777),
+                       0,
+                       "Should be able to create file in "
+                       "%s directory when unlocked",
+                       dp_class_num_to_string(new_prot_class)
+               );
+
+               T_WITH_ERRNO;
+               T_ASSERT_NE(
+                       local_result = GET_PROT_CLASS(g_fd),
+                       -1,
+                       "Get the new file's protection class"
+               );
+
+               T_ASSERT_EQ(
+                       local_result,
+                       new_prot_class,
+                       "File should have %s protection",
+                       dp_class_num_to_string(new_prot_class)
+               );
+
+               close(g_fd);
+               unlink(g_filepath);
+       }
+
+       /* Do we disallow creation of a class F directory? */
+       T_ASSERT_NE(
+               SET_PROT_CLASS(g_dir_fd, PROTECTION_CLASS_F),
+               0,
+               "Should not be able to create class F directory"
+       );
+
+       /*
+        * Are class A and class B semantics followed for when
+        * we create these files during lock?
+        */
+       T_WITH_ERRNO;
+       T_ASSERT_EQ(
+               SET_PROT_CLASS(g_dir_fd, PROTECTION_CLASS_A),
+               0,
+               "Should be able to change protection "
+               "from class F to class A when unlocked"
+       );
+
+       T_ASSERT_EQ(lock_device(), 0, "*** Lock device ***");
+
+       T_ASSERT_EQ(
+               g_fd = open(g_filepath, O_CREAT|O_EXCL|O_CLOEXEC, 0777),
+               -1,
+               "Should not be able to create a new file "
+               "in a class A directory when locked"
+       );
+
+       T_ASSERT_EQ(unlock_device(TEST_PASSCODE), 0, "*** Unlock device ***");
+
+       T_WITH_ERRNO;
+       T_ASSERT_EQ(
+               SET_PROT_CLASS(g_dir_fd, PROTECTION_CLASS_B),
+               0,
+               "Should be able to change directory "
+               "from class A to class B when unlocked"
+       );
+
+       T_ASSERT_EQ(lock_device(), 0, "*** Lock device ***");
+
+       T_ASSERT_GE(
+               g_fd = open(g_filepath, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, 0777),
+               0,
+               "Should be able to create a new file "
+               "in class B directory when locked"
+       );
+
+       T_ASSERT_NE(
+               local_result = GET_PROT_CLASS(g_fd),
+               -1,
+               "Get the new file's protection class"
+       );
+
+       T_ASSERT_EQ(
+               local_result,
+               PROTECTION_CLASS_B,
+               "File should inherit protection class of class B directory"
+       );
+
+       /* What happens when we try to create new subdirectories? */
+       T_ASSERT_EQ(unlock_device(TEST_PASSCODE), 0, "*** Unlock device ***");
+
+       for(
+               new_prot_class = PROTECTION_CLASS_A;
+               new_prot_class <= PROTECTION_CLASS_D;
+               new_prot_class++
+       ) {
+               T_WITH_ERRNO;
+               T_ASSERT_EQ(
+                       SET_PROT_CLASS(g_dir_fd, new_prot_class),
+                       0,
+                       "Change directory to %s",
+                       dp_class_num_to_string(new_prot_class)
+               );
+
+               T_WITH_ERRNO;
+               T_ASSERT_NE(
+                       mkdir(g_subdirpath, 0x0777),
+                       -1,
+                       "Create subdirectory in %s directory",
+                       dp_class_num_to_string(new_prot_class)
+               );
+
+               T_WITH_ERRNO;
+               T_ASSERT_NE(
+                       g_subdir_fd = open(g_subdirpath, O_RDONLY|O_CLOEXEC),
+                       -1,
+                       "Should be able to open subdirectory in %s directory",
+                       dp_class_num_to_string(new_prot_class)
+               );
+
+               T_ASSERT_NE(
+                       local_result = GET_PROT_CLASS(g_subdir_fd),
+                       -1,
+                       "Get protection class of new subdirectory "
+                       "of %s directory",
+                       dp_class_num_to_string(new_prot_class)
+               );
+
+               T_ASSERT_EQ(
+                       local_result,
+                       new_prot_class,
+                       "New subdirectory should have same class as %s parent",
+                       dp_class_num_to_string(new_prot_class)
+               );
+
+               close(g_subdir_fd);
+               rmdir(g_subdirpath);
+       }
+}
+
+void
+setup(void) {
+       int ret = 0;
+       int local_result = -1;
+
+       T_SETUPBEGIN;
+
+       T_ATEND(cleanup);
+
+       T_WITH_ERRNO;
+       T_ASSERT_NOTNULL(
+               mkdtemp(g_test_tempdir),
+               "Create temporary directory for test"
+       );
+       T_LOG("Test temp dir: %s", g_test_tempdir);
+
+       T_ASSERT_NE(
+               local_result = supports_content_prot(),
+               -1,
+               "Get content protection support status"
+       );
+
+       if(local_result == 0) {
+               T_SKIP("Data protection not supported on this system");
+       }
+
+       T_ASSERT_NE(
+               has_passcode(),
+               -1,
+               "No passcode set"
+       );
+
+       T_ASSERT_EQ(
+               set_passcode(TEST_PASSCODE, NULL),
+               0,
+               "Set test passcode"
+       );
+
+       bzero(g_filepath, PATH_MAX);
+       bzero(g_dirpath, PATH_MAX);
+       bzero(g_subdirpath, PATH_MAX);
+
+       ret |= (strlcat(g_filepath, g_test_tempdir, PATH_MAX) == PATH_MAX);
+       ret |= (strlcat(g_filepath, "/", PATH_MAX) == PATH_MAX);
+       ret |= (strlcpy(g_dirpath, g_filepath, PATH_MAX) == PATH_MAX);
+       ret |= (strlcat(g_filepath, "test_file", PATH_MAX) == PATH_MAX);
+       ret |= (strlcat(g_dirpath, "test_dir/", PATH_MAX) == PATH_MAX);
+       ret |= (strlcpy(g_subdirpath, g_dirpath, PATH_MAX) == PATH_MAX);
+       ret |= (strlcat(g_subdirpath, "test_subdir/", PATH_MAX) == PATH_MAX);
+
+       T_QUIET;
+       T_ASSERT_EQ(ret, 0, "Initialize test path strings");
+
+       T_WITH_ERRNO;
+       T_ASSERT_GE(
+               g_fd = open(g_filepath, O_CREAT|O_EXCL|O_RDWR|O_CLOEXEC, 0777),
+               0,
+               "Create test file"
+       );
+
+       T_SETUPEND;
+}
+
+void
+cleanup(void) {
+       T_LOG("Cleaning up…");
+
+       if(g_subdir_fd >= 0) {
+               T_LOG("Cleanup: closing fd %d", g_subdir_fd);
+               close(g_subdir_fd);
+       }
+
+       if(g_subdirpath[0]) {
+               T_LOG("Cleanup: removing %s", g_subdirpath);
+               rmdir(g_subdirpath);
+       }
+
+       if(g_fd >= 0) {
+               T_LOG("Cleanup: closing fd %d", g_fd);
+               close(g_fd);
+       }
+
+       if(g_filepath[0]) {
+               T_LOG("Cleanup: removing %s", g_filepath);
+               unlink(g_filepath);
+       }
+
+       if(g_dir_fd >= 0) {
+               T_LOG("Cleanup: closing fd %d", g_dir_fd);
+               close(g_dir_fd);
+       }
+
+       if(g_dirpath[0]) {
+               T_LOG("Cleanup: removing %s", g_dirpath);
+               rmdir(g_dirpath);
+       }
+
+       if(strcmp(g_test_tempdir, TEMP_DIR_TEMPLATE)) {
+               T_LOG("Cleanup: removing %s", g_test_tempdir);
+               rmdir(g_test_tempdir);
+       }
+
+       if(g_passcode_set) {
+               T_LOG("Cleanup: unlocking device");
+               if(unlock_device(TEST_PASSCODE)) {
+                       T_LOG("Warning: failed to unlock device in cleanup");
+               }
+
+               T_LOG("Cleanup: clearing passcode");
+               if(clear_passcode(TEST_PASSCODE)) {
+                       T_LOG("Warning: failed to clear passcode in cleanup");
+               }
+       }
+}
+
+int
+set_passcode(char * new_passcode, char * old_passcode) {
+       int result = -1;
+
+#ifdef KEYBAG_ENTITLEMENTS
+       /* If we're entitled, we can set the passcode ourselves. */
+       uint64_t inputs[] = {device_keybag_handle};
+       uint32_t input_count = (sizeof(inputs) / sizeof(*inputs));
+       void * input_structs = NULL;
+       size_t input_struct_count = 0;
+       char buffer[CPT_AKS_BUF_SIZE];
+       char * buffer_ptr = buffer;
+       uint32_t old_passcode_len = 0;
+       uint32_t new_passcode_len = 0;
+
+       T_LOG("%s(): using keybag entitlements", __func__);
+
+       old_passcode_len = strnlen(old_passcode, CPT_MAX_PASS_LEN);
+       new_passcode_len = strnlen(new_passcode, CPT_MAX_PASS_LEN);
+
+       if((old_passcode == NULL) || (old_passcode_len == CPT_MAX_PASS_LEN)) {
+               old_passcode = "";
+               old_passcode_len = 0;
+       }
+       if((new_passcode == NULL) || (new_passcode_len == CPT_MAX_PASS_LEN)) {
+               new_passcode = "";
+               new_passcode_len = 0;
+       }
+
+       *((uint32_t *) buffer_ptr) = ((uint32_t) 2);
+       buffer_ptr += sizeof(uint32_t);
+
+       *((uint32_t *) buffer_ptr) = old_passcode_len;
+       buffer_ptr += sizeof(uint32_t);
+
+       memcpy(buffer_ptr, old_passcode, old_passcode_len);
+       buffer_ptr += ((old_passcode_len + sizeof(uint32_t) - 1) &
+               ~(sizeof(uint32_t) - 1));
+
+       *((uint32_t *) buffer_ptr) = new_passcode_len;
+       buffer_ptr += sizeof(uint32_t);
+
+       memcpy(buffer_ptr, new_passcode, new_passcode_len);
+       buffer_ptr += ((new_passcode_len + sizeof(uint32_t) - 1) &
+               ~(sizeof(uint32_t) - 1));
+
+       input_structs = buffer;
+       input_struct_count = (buffer_ptr - buffer);
+
+       result = apple_key_store(
+               kAppleKeyStoreKeyBagSetPasscode,
+               inputs,
+               input_count,
+               input_structs,
+               input_struct_count,
+               NULL,
+               NULL
+       );
+#else
+       /*
+        * If we aren't entitled, we'll need to use
+        * keystorectl to set the passcode.
+        */
+       T_LOG("%s(): using keystorectl", __func__);
+
+       if(
+               (old_passcode == NULL) ||
+               (strnlen(old_passcode, CPT_MAX_PASS_LEN) == CPT_MAX_PASS_LEN)
+       ) {
+               old_passcode = "";
+       }
+
+       if(
+               (new_passcode == NULL) ||
+               (strnlen(new_passcode, CPT_MAX_PASS_LEN) == CPT_MAX_PASS_LEN)
+       ) {
+               new_passcode = "";
+       }
+
+       char * const keystorectl_args[] = {
+               KEYSTORECTL_PATH,
+               "change-password",
+               old_passcode,
+               new_passcode,
+               NULL
+       };
+       result = spawn_proc(keystorectl_args);
+#endif /* KEYBAG_ENTITLEMENTS */
+       if(result == 0 && new_passcode != NULL) {
+               g_passcode_set = 1;
+       } else if(result == 0 && new_passcode == NULL) {
+               g_passcode_set = 0;
+       }
+
+       return(result);
+}
+
+int
+clear_passcode(char * passcode) {
+       /*
+        * For the moment, this will set the passcode to the empty string
+        * (a known value); this will most likely need to change, or running
+        * this test may ruin everything™
+        */
+       return set_passcode(NULL, passcode);
+}
+
+int
+has_passcode(void) {
+       return set_passcode(NULL, NULL);
+}
+
+int
+lock_device(void) {
+       int result = -1;
+
+       /*
+        * Pass in the path to keybagdTest instead. By doing this, we bypass
+        * the shortcut to get in to the keybag via IOKit and instead use the
+        * pre-existing command line tool.
+        *
+        * This also goes through the normal "lock → locking (10s) → locked"
+        * flow that would normally occuring during system runtime when the
+        * lock button is depressed. To ensure that our single threaded test
+        * works properly in this case, poll until we can't create a class A
+        * file to be safe.
+        */
+       char * const kbd_args[] = {KEYBAGDTEST_PATH, "lock", NULL};
+       result = spawn_proc(kbd_args);
+       if(result) {
+               return result;
+       }
+
+       /*
+        * Delete the file if it is present. Note that this may fail if the
+        * file is actually not there. So don't bomb out if we can't delete
+        * this file right now.
+        */
+       (void) unlink("/private/var/foo_test_file");
+
+       while(1) {
+               int dp_fd;
+
+               dp_fd = open_dprotected_np(
+                       "/private/var/foo_test_file",
+                       O_RDWR|O_CREAT,
+                       PROTECTION_CLASS_A,
+                       0
+               );
+
+               if(dp_fd >= 0) {
+                       /* delete it and sleep */
+                       close(dp_fd);
+                       result = unlink("/private/var/foo_test_file");
+
+                       if(result) {
+                               return result;
+                       }
+
+                       sync();
+                       sleep(1);
+               } else {
+                       /* drop out of our polling loop. */
+                       break;
+               }
+       }
+
+       /*
+        * Note that our loop breakout condition is whether or not we can
+        * create a class A file, so that loop may execute up to 10 times
+        * (due to the 10s grace period). By the time we get here, we assume
+        * that we didn't hit any of the error cases above.
+        */
+
+       return 0;
+}
+
+int
+unlock_device(char * passcode) {
+       int result = -1;
+
+#ifdef  KEYBAG_ENTITLEMENTS
+       /* If we're entitled, we can unlock the device ourselves. */
+       uint64_t inputs[] = {device_keybag_handle};
+       uint32_t input_count = (sizeof(inputs) / sizeof(*inputs));
+       size_t input_struct_count = 0;
+
+       T_LOG("%s(): using keybag entitlements", __func__);
+
+       input_struct_count = strnlen(passcode, CPT_MAX_PASS_LEN);
+       if((passcode == NULL) || (input_struct_count == CPT_MAX_PASS_LEN)) {
+               passcode = "";
+               input_struct_count = 0;
+       }
+
+       result = apple_key_store(
+               kAppleKeyStoreKeyBagUnlock,
+               inputs,
+               input_count,
+               passcode,
+               input_struct_count,
+               NULL,
+               NULL
+       );
+#else
+       /*
+        * If we aren't entitled, we'll need to use
+        * keystorectl to unlock the device.
+        */
+       T_LOG("%s(): using keystorectl", __func__);
+
+       if(
+               (passcode == NULL) ||
+               (strnlen(passcode, CPT_MAX_PASS_LEN) == CPT_MAX_PASS_LEN)
+       ) {
+               passcode = "";
+       }
+
+       char * const keystorectl_args[] = {
+               KEYSTORECTL_PATH, "unlock", passcode, NULL
+       };
+
+       result = spawn_proc(keystorectl_args);
+#endif /* KEYBAG_ENTITLEMENTS */
+
+       return(result);
+}
+
+/*
+ * Code based on Mobile Key Bag; specifically
+ * MKBDeviceSupportsContentProtection and
+ * MKBDeviceFormattedForContentProtection.
+ *
+ * We want to verify that we support content protection, and that
+ * we are formatted for it.
+ */
+int
+supports_content_prot(void) {
+       int local_result = -1;
+       int result = -1;
+       uint32_t buffer_size = 1;
+       char buffer[buffer_size];
+       io_registry_entry_t defaults = IO_OBJECT_NULL;
+       kern_return_t k_result = KERN_FAILURE;
+       struct statfs statfs_results;
+
+       defaults = IORegistryEntryFromPath(
+               kIOMasterPortDefault,
+               kIODeviceTreePlane ":/defaults"
+       );
+
+       if(defaults == IO_OBJECT_NULL) {
+               /* Assume data protection is unsupported */
+               T_LOG(
+                       "%s(): no defaults entry in IORegistry",
+                       __func__
+               );
+               return 0;
+       }
+
+       k_result = IORegistryEntryGetProperty(
+               defaults,
+               "content-protect",
+               buffer,
+               &buffer_size
+       );
+
+       if(k_result != KERN_SUCCESS) {
+               /* Assume data protection is unsupported */
+               T_LOG(
+                       "%s(): no content-protect property in IORegistry",
+                       __func__
+               );
+               return 0;
+       }
+
+       /*
+        * At this point, we SUPPORT content protection… but are we
+        * formatted for it? This is ugly; we should be testing the file
+        * system we'll be testing in, not just /tmp/.
+        */
+       local_result = statfs(g_test_tempdir, &statfs_results);
+
+       if(local_result == -1) {
+               T_LOG(
+                       "%s(): failed to statfs the test directory, errno = %s",
+                       __func__, strerror(errno)
+               );
+               return -1;
+       } else if(statfs_results.f_flags & MNT_CPROTECT) {
+               return 1;
+       } else {
+               T_LOG(
+                       "%s(): filesystem not formatted for data protection",
+                       __func__
+               );
+               return 0;
+       }
+}
+
+/*
+ * Shamelessly ripped from keystorectl routines;
+ * a wrapper for invoking the AKS user client.
+ */
+int
+apple_key_store(uint32_t command,
+                uint64_t * inputs,
+                uint32_t input_count,
+                void * input_structs,
+                size_t input_struct_count,
+                uint64_t * outputs,
+                uint32_t * output_count) {
+       int result = -1;
+       io_connect_t connection = IO_OBJECT_NULL;
+       io_registry_entry_t apple_key_bag_service = IO_OBJECT_NULL;
+       kern_return_t k_result = KERN_FAILURE;
+       IOReturn io_result = IO_OBJECT_NULL;
+
+       apple_key_bag_service = IOServiceGetMatchingService(
+               kIOMasterPortDefault,
+               IOServiceMatching(kAppleKeyStoreServiceName)
+       );
+       if(apple_key_bag_service == IO_OBJECT_NULL) {
+               T_LOG(
+                       "%s: failed to match kAppleKeyStoreServiceName",
+                       __func__
+               );
+               goto end;
+       }
+
+       k_result = IOServiceOpen(
+               apple_key_bag_service,
+               mach_task_self(),
+               0,
+               &connection
+       );
+       if(k_result != KERN_SUCCESS) {
+               T_LOG(
+                       "%s: failed to open AppleKeyStore: "
+                       "IOServiceOpen() returned %d",
+                       __func__, k_result
+               );
+               goto end;
+       }
+
+       k_result = IOConnectCallMethod(
+               connection,
+               kAppleKeyStoreUserClientOpen,
+               NULL, 0, NULL, 0, NULL, NULL, NULL, NULL
+       );
+       if(k_result != KERN_SUCCESS) {
+               T_LOG(
+                       "%s: call to AppleKeyStore method "
+                       "kAppleKeyStoreUserClientOpen failed",
+                       __func__
+               );
+               goto close;
+       }
+
+       io_result = IOConnectCallMethod(
+               connection, command, inputs, input_count, input_structs,
+               input_struct_count, outputs, output_count, NULL, NULL
+       );
+       if(io_result != kIOReturnSuccess) {
+               T_LOG("%s: call to AppleKeyStore method %d failed", __func__);
+               goto close;
+       }
+
+       result = 0;
+
+close:
+       IOServiceClose(apple_key_bag_service);
+end:
+       return(result);
+}
+
+/*
+ * Just a wrapper around fork/exec for separate
+ * cmds that may require entitlements.
+ */
+int
+spawn_proc(char * const command[]) {
+       int child_result = -1;
+       int result = -1;
+       pid_t child = -1;
+
+       T_LOG("Spawning %s", command[0]);
+
+       child = fork();
+
+       if(child == -1) {
+               T_LOG("%s(%s): fork() failed", __func__, command[0]);
+               return 1;
+       } else if(child == 0) {
+               /*
+                * TODO: This keeps keystorectl from bombarding us with key
+                * state changes, but there must be a better way of doing
+                * this; killing stderr is a bit nasty, and if keystorectl
+                * fails, we want all the information we can get.
+                */
+               fclose(stderr);
+               fclose(stdin);
+
+               /*
+                * Use the first argument in 'command' array as the path to
+                * execute, as it could be invoking keystorectl OR keybagdTest
+                * depending on whether or not we need to apply a grace period.
+                * In the "lock" case we must use keybagdTest to ensure it's
+                * giving people the grace period.
+                */
+               execv(command[0], command);
+               T_WITH_ERRNO;
+               T_ASSERT_FAIL("child failed to execv %s", command[0]);
+       }
+
+       if(waitpid(child, &child_result, 0) != child) {
+               T_LOG(
+                       "%s(%s): waitpid(%d) failed",
+                       __func__, command[0], child
+               );
+               return 1;
+       } else if(WEXITSTATUS(child_result)) {
+               T_LOG(
+                       "%s(%s): child exited %d",
+                       __func__, command[0], WEXITSTATUS(child_result)
+               );
+               return 1;
+       }
+
+       return 0;
+}
+
+char*
+dp_class_num_to_string(int num) {
+       switch(num) {
+               case 0:
+                       return "unclassed";
+               case PROTECTION_CLASS_A:
+                       return "class A";
+               case PROTECTION_CLASS_B:
+                       return "class B";
+               case PROTECTION_CLASS_C:
+                       return "class C";
+               case PROTECTION_CLASS_D:
+                       return "class D";
+               case PROTECTION_CLASS_E:
+                       return "class E";
+               case PROTECTION_CLASS_F:
+                       return "class F";
+               default:
+                       return "<unknown class>";
+       }
+}
+
+#if 0
+int device_lock_state(void) {
+       /*
+        * TODO: Actually implement this.
+        *
+        * We fail if a passcode already exists, and the methods being used
+        * to lock/unlock the device in this test appear to be synchronous…
+        * do we need this function?
+        */
+       int result = -1;
+
+       return(result);
+}
+
+/* Determines if we will try to test class C semanatics. */
+int unlocked_since_boot() {
+       /*
+        * TODO: Actually implement this.
+        *
+        * The actual semantics for CP mean that even with this primative,
+        * we would need to set a passcode and then reboot the device in
+        * order to test this; this function will probably be rather
+        * worthless as a result.
+        */
+       int result = 1;
+
+       return(result);
+}
+#endif
+
index 1e2429427175041db60d65dbc7fa1f0fe45c6e24..e2b8c3a1945d765834036b09e0eb255d6d955095 100644 (file)
@@ -7,7 +7,7 @@
 extern int __gettimeofday(struct timeval *, struct timezone *);
 
 T_DECL(gettimeofday, "gettimeofday()",
-          T_META_CHECK_LEAKS(NO), T_META_ALL_VALID_ARCHS(YES))
+          T_META_CHECK_LEAKS(false), T_META_ALL_VALID_ARCHS(true), T_META_LTEPHASE(LTE_POSTINIT))
 {
        struct timeval tv_a, tv_b, tv_c;
 
@@ -29,7 +29,7 @@ T_DECL(gettimeofday, "gettimeofday()",
 extern int __gettimeofday_with_mach(struct timeval *, struct timezone *, uint64_t *mach_time);
 
 T_DECL(gettimeofday_with_mach, "gettimeofday_with_mach()",
-          T_META_CHECK_LEAKS(NO), T_META_ALL_VALID_ARCHS(YES))
+          T_META_CHECK_LEAKS(false), T_META_ALL_VALID_ARCHS(true))
 {
        struct timeval gtod_ts;
 
index d57465c628e957f32b542028b2e2505e225a27f1..c4463b3c41219a59d41f3fab522e505dacc17e8e 100644 (file)
@@ -28,7 +28,7 @@ static void do_test(int notify_type, void (^trigger_block)(void)){
        mach_msg_destroy(&message.hdr);
 }
 
-T_DECL(host_notify_calendar_change, "host_request_notification(HOST_NOTIFY_CALENDAR_CHANGE)", T_META_CHECK_LEAKS(NO))
+T_DECL(host_notify_calendar_change, "host_request_notification(HOST_NOTIFY_CALENDAR_CHANGE)", T_META_CHECK_LEAKS(false), T_META_LTEPHASE(LTE_POSTINIT))
 {
        do_test(HOST_NOTIFY_CALENDAR_CHANGE, ^{
                struct timeval tm;
@@ -38,7 +38,7 @@ T_DECL(host_notify_calendar_change, "host_request_notification(HOST_NOTIFY_CALEN
        });
 }
 
-T_DECL(host_notify_calendar_set, "host_request_notification(HOST_NOTIFY_CALENDAR_SET)", T_META_CHECK_LEAKS(NO))
+T_DECL(host_notify_calendar_set, "host_request_notification(HOST_NOTIFY_CALENDAR_SET)", T_META_CHECK_LEAKS(false), T_META_LTEPHASE(LTE_POSTINIT))
 {
        do_test(HOST_NOTIFY_CALENDAR_SET, ^{
                struct timeval tm;
diff --git a/tools/tests/darwintests/jumbo_va_spaces_28530648.c b/tools/tests/darwintests/jumbo_va_spaces_28530648.c
new file mode 100644 (file)
index 0000000..eaf6745
--- /dev/null
@@ -0,0 +1,53 @@
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+#include <darwintest.h>
+#include <darwintest_utils.h>
+
+
+#define GB (1ULL * 1024 * 1024 * 1024)
+
+/*
+ * This test expects the entitlement to be the enabling factor for a process to
+ * allocate at least this many GB of VA space. i.e. with the entitlement, n GB
+ * must be allocatable; whereas without it, it must be less.
+ */
+#define ALLOC_TEST_GB 12
+
+T_DECL(jumbo_va_spaces_28530648,
+       "Verify that the \"dynamic-codesigning\" entitlement is required to utilize an extra-large "
+       "VA space on arm64",
+       T_META_NAMESPACE("xnu.vm"),
+       T_META_CHECK_LEAKS(false))
+{
+       int     i;
+       void    *res;
+
+       if (!dt_64_bit_kernel()) {
+               T_SKIP("This test is only applicable to arm64");
+       }
+
+       T_LOG("Attemping to allocate VA space in 1 GB chunks.");
+
+       for (i = 0; i < (ALLOC_TEST_GB * 2); i++) {
+               res = mmap(NULL, 1 * GB, PROT_NONE, MAP_PRIVATE | MAP_ANON, 0, 0);
+               if (res == MAP_FAILED) {
+                       if (errno != ENOMEM) {
+                               T_WITH_ERRNO;
+                               T_LOG("mmap failed: stopped at %d of %d GB allocated", i, ALLOC_TEST_GB);
+                       }
+                       break;
+               } else {
+                       T_LOG("%d: %p\n", i, res);
+               }
+       }
+
+#if defined(ENTITLED)
+       T_EXPECT_GE_INT(i, ALLOC_TEST_GB, "Allocate at least %d GB of VA space", ALLOC_TEST_GB);
+#else
+       T_EXPECT_LT_INT(i, ALLOC_TEST_GB, "Not permitted to allocate %d GB of VA space", ALLOC_TEST_GB);
+#endif
+}
diff --git a/tools/tests/darwintests/jumbo_va_spaces_28530648.entitlements b/tools/tests/darwintests/jumbo_va_spaces_28530648.entitlements
new file mode 100644 (file)
index 0000000..9a1d0fb
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>dynamic-codesigning</key>
+       <true/>
+</dict>
+</plist>
index ea1f049e57aeb92f2d9538f4135056534b3d4eea..5eb0ff6c2c71f1488454a808ba8aeb6bd66a5a3e 100644 (file)
@@ -18,7 +18,7 @@
 #define TRACE_DEBUGID (0xfedfed00U)
 
 T_DECL(kdebug_trace_syscall, "test that kdebug_trace(2) emits correct events",
-       T_META_ASROOT(YES))
+       T_META_ASROOT(true))
 {
     ktrace_session_t s;
     dispatch_time_t timeout;
@@ -60,7 +60,7 @@ T_DECL(kdebug_trace_syscall, "test that kdebug_trace(2) emits correct events",
 
 T_DECL(kdebug_signpost_syscall,
     "test that kdebug_signpost(2) emits correct events",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     ktrace_session_t s;
     __block int single_seen = 0;
@@ -140,7 +140,7 @@ T_DECL(kdebug_signpost_syscall,
 
 T_DECL(kdebug_wrapping,
     "ensure that wrapping traces lost events and no events prior to the wrap",
-    T_META_ASROOT(YES), T_META_CHECK_LEAKS(NO))
+    T_META_ASROOT(true), T_META_CHECK_LEAKS(false))
 {
     ktrace_session_t s;
     __block int events = 0;
@@ -342,7 +342,7 @@ expect_dyld_events(ktrace_session_t s, const char *name, uint32_t base_code,
 }
 
 T_DECL(dyld_events, "test that dyld registering libraries emits events",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     ktrace_session_t s;
     dyld_kernel_image_info_t info;
@@ -359,6 +359,7 @@ T_DECL(dyld_events, "test that dyld registering libraries emits events",
 
     s = ktrace_session_create();
     T_ASSERT_NOTNULL(s, NULL);
+    T_ASSERT_POSIX_ZERO(ktrace_filter_pid(s, getpid()), NULL);
 
     expect_dyld_events(s, "mapping", DBG_DYLD_UUID_MAP_A, map_uuid,
         MAP_LOAD_ADDR, &map_fsid, &map_fsobjid, saw_mapping);
@@ -436,17 +437,13 @@ is_development_kernel(void)
     static bool is_development;
 
     dispatch_once(&is_development_once, ^(void) {
-        host_debug_info_internal_data_t info;
-        mach_msg_type_number_t count = HOST_DEBUG_INFO_INTERNAL_COUNT;
-        kern_return_t kr;
-
-        kr = host_info(mach_host_self(), HOST_DEBUG_INFO_INTERNAL,
-            (host_info_t)(void *)&info, &count);
-        if (kr != KERN_SUCCESS && kr != KERN_NOT_SUPPORTED) {
-            T_ASSERT_FAIL("check for development kernel failed %d", kr);
-        }
+        int dev;
+        size_t dev_size = sizeof(dev);
 
-        is_development = (kr == KERN_SUCCESS);
+        T_QUIET;
+        T_ASSERT_POSIX_SUCCESS(sysctlbyname("kern.development", &dev,
+                                            &dev_size, NULL, 0), NULL);
+        is_development = (dev != 0);
     });
 
     return is_development;
@@ -511,10 +508,11 @@ expect_filtered_event(struct trace_point *tp, unsigned int *events)
 }
 
 T_DECL(kernel_events, "ensure kernel macros work",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     ktrace_session_t s;
 
+
     s = ktrace_session_create();
     T_QUIET; T_ASSERT_NOTNULL(s, NULL);
 
@@ -531,10 +529,17 @@ T_DECL(kernel_events, "ensure kernel macros work",
     });
 
     ktrace_set_completion_handler(s, ^(void) {
-        T_EXPECT_EQ(rel_seen, EXP_KERNEL_EVENTS, NULL);
-        T_EXPECT_EQ(dev_seen, is_development_kernel() ? EXP_KERNEL_EVENTS : 0U,
-            NULL);
-        T_EXPECT_EQ(filt_seen, EXP_KERNEL_EVENTS, NULL);
+        /*
+         * Development-only events are only filtered if running on an embedded
+         * OS.
+         */
+        unsigned dev_exp;
+        dev_exp = EXP_KERNEL_EVENTS;
+
+        T_EXPECT_EQ(rel_seen, EXP_KERNEL_EVENTS,
+                "release and development events seen");
+        T_EXPECT_EQ(dev_seen, dev_exp, "development-only events seen/not seen");
+        T_EXPECT_EQ(filt_seen, EXP_KERNEL_EVENTS, "filter-only events seen");
         ktrace_session_destroy(s);
         T_END;
     });
@@ -550,7 +555,7 @@ T_DECL(kernel_events, "ensure kernel macros work",
 }
 
 T_DECL(kernel_events_filtered, "ensure that the filtered kernel macros work",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     ktrace_session_t s;
 
index 74cc5782eaf8781b4bc9a594e8a66bbd6da1c978..93015cd5aa20428436866841f01b2065e9c7b4be 100644 (file)
@@ -82,7 +82,7 @@ static int wait_for_sleep() {
        return -1;
 }
 
-T_DECL(kevent_continuous_time_periodic_tick, "kevent(EVFILT_TIMER with NOTE_MACH_CONTINUOUS_TIME)"){
+T_DECL(kevent_continuous_time_periodic_tick, "kevent(EVFILT_TIMER with NOTE_MACH_CONTINUOUS_TIME)", T_META_LTEPHASE(LTE_POSTINIT)){
        mach_timebase_info(&tb_info);
        int kq;
        T_ASSERT_POSIX_SUCCESS((kq = kqueue()), NULL);
@@ -130,7 +130,7 @@ T_DECL(kevent_continuous_time_periodic_tick, "kevent(EVFILT_TIMER with NOTE_MACH
        T_ASSERT_POSIX_ZERO(close(kq), NULL);
 }
 
-T_DECL(kevent_continuous_time_absolute, "kevent(EVFILT_TIMER with NOTE_MACH_CONTINUOUS_TIME and NOTE_ABSOLUTE)"){
+T_DECL(kevent_continuous_time_absolute, "kevent(EVFILT_TIMER with NOTE_MACH_CONTINUOUS_TIME and NOTE_ABSOLUTE)", T_META_LTEPHASE(LTE_POSTINIT)){
        mach_timebase_info(&tb_info);
 
        int kq;
@@ -182,7 +182,7 @@ T_DECL(kevent_continuous_time_absolute, "kevent(EVFILT_TIMER with NOTE_MACH_CONT
        T_ASSERT_POSIX_ZERO(close(kq), NULL);
 }
 
-T_DECL(kevent_continuous_time_pops, "kevent(EVFILT_TIMER with NOTE_MACH_CONTINUOUS_TIME with multiple pops)"){
+T_DECL(kevent_continuous_time_pops, "kevent(EVFILT_TIMER with NOTE_MACH_CONTINUOUS_TIME with multiple pops)", T_META_LTEPHASE(LTE_POSTINIT)){
        // have to throttle rate at which pmset is called
        sleep(2);
 
index 6e2c17b030ddcc3cf28fdf485d39fcc4d98d84fe..a37ed39e2db100520cee2b32dfda32336e0e8225 100644 (file)
@@ -114,7 +114,7 @@ expect_kdebug_trigger(const char *filter_desc, const uint32_t *debugids,
     (KDBG_EVENTID(TRIGGER_CLASS, TRIGGER_SUBCLASS, TRIGGER_CODE))
 
 T_DECL(kdebug_trigger_classes, "test that kdebug trigger samples on classes",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     const uint32_t class_debugids[] = {
         KDBG_EVENTID(TRIGGER_CLASS, 1, 1),
@@ -130,7 +130,7 @@ T_DECL(kdebug_trigger_classes, "test that kdebug trigger samples on classes",
 
 T_DECL(kdebug_trigger_subclasses,
     "test that kdebug trigger samples on subclasses",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     const uint32_t subclass_debugids[] = {
         KDBG_EVENTID(TRIGGER_CLASS, TRIGGER_SUBCLASS, 0),
@@ -145,7 +145,7 @@ T_DECL(kdebug_trigger_subclasses,
 }
 
 T_DECL(kdebug_trigger_debugids, "test that kdebug trigger samples on debugids",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     const uint32_t debugids[] = {
         TRIGGER_DEBUGID
@@ -162,7 +162,7 @@ T_DECL(kdebug_trigger_debugids, "test that kdebug trigger samples on debugids",
  */
 
 T_DECL(kdbg_callstacks, "test that the kdbg_callstacks samples on syscalls",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     ktrace_session_t s;
     __block bool saw_user_stack = false;
@@ -288,7 +288,7 @@ expect_stacks_traced(void (^cb)(void))
 }
 
 T_DECL(pet, "test that PET mode samples kernel and user stacks",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     configure_kperf_stacks_timer(-1, 10);
     T_ASSERT_POSIX_SUCCESS(kperf_timer_pet_set(0), NULL);
@@ -302,7 +302,7 @@ T_DECL(pet, "test that PET mode samples kernel and user stacks",
 
 T_DECL(lightweight_pet,
     "test that lightweight PET mode samples kernel and user stacks",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     int set = 1;
 
index 37773a57fc163e7ac87df0cbc2573051156da6de..f48931af228220715129f96b626d6fd1595d7e6a 100644 (file)
@@ -43,11 +43,18 @@ expect_frame(const char **bt, unsigned int bt_len, CSSymbolRef symbol,
 }
 
 /*
- * Expect to see user and kernel stacks with a known signature.
+ * Expect to see either user or kernel stacks on thread with ID `tid` with a
+ * signature of `bt` of length `bt_len`.  Updates `stacks_seen` when stack
+ * is found.
+ *
+ * Can also allow stacks to be larger than the signature -- additional frames
+ * near the current PC will be ignored.  This allows stacks to potentially be
+ * in the middle of a signalling system call (which signals that it is safe to
+ * start sampling).
  */
 static void
 expect_backtrace(ktrace_session_t s, uint64_t tid, unsigned int *stacks_seen,
-    bool kern, const char **bt, unsigned int bt_len)
+    bool kern, const char **bt, unsigned int bt_len, unsigned int allow_larger_by)
 {
     CSSymbolicatorRef symb;
     uint32_t hdr_debugid;
@@ -55,6 +62,7 @@ expect_backtrace(ktrace_session_t s, uint64_t tid, unsigned int *stacks_seen,
     __block unsigned int stacks = 0;
     __block unsigned int frames = 0;
     __block unsigned int hdr_frames = 0;
+    __block unsigned int allow_larger = allow_larger_by;
 
     if (kern) {
         static CSSymbolicatorRef kern_symb;
@@ -88,6 +96,7 @@ expect_backtrace(ktrace_session_t s, uint64_t tid, unsigned int *stacks_seen,
             return;
         }
 
+        T_LOG("found stack from thread %#lx", tp->threadid);
         stacks++;
         if (!(tp->arg1 & 1)) {
             T_FAIL("invalid %s stack on thread %#lx", kern ? "kernel" : "user",
@@ -99,8 +108,14 @@ expect_backtrace(ktrace_session_t s, uint64_t tid, unsigned int *stacks_seen,
         /* ignore extra link register or value pointed to by stack pointer */
         hdr_frames -= 1;
 
-        T_QUIET; T_EXPECT_EQ(hdr_frames, bt_len,
+        T_QUIET; T_EXPECT_GE(hdr_frames, bt_len,
             "number of frames in header");
+        T_QUIET; T_EXPECT_LE(hdr_frames, bt_len + allow_larger,
+            "number of frames in header");
+        if (hdr_frames > bt_len && allow_larger > 0) {
+            allow_larger = hdr_frames - bt_len;
+            hdr_frames = bt_len;
+        }
 
         T_LOG("%s stack seen", kern ? "kernel" : "user");
         frames = 0;
@@ -111,7 +126,15 @@ expect_backtrace(ktrace_session_t s, uint64_t tid, unsigned int *stacks_seen,
             return;
         }
 
-        for (int i = 0; i < 4 && frames < hdr_frames; i++, frames++) {
+        int i = 0;
+
+        if (frames == 0 && hdr_frames > bt_len) {
+            /* skip frames near the PC */
+            i = (int)allow_larger;
+            allow_larger -= 4;
+        }
+
+        for (; i < 4 && frames < hdr_frames; i++, frames++) {
             unsigned long addr = (&tp->arg1)[i];
             CSSymbolRef symbol = CSSymbolicatorGetSymbolWithAddressAtTime(
                 symb, addr, kCSNow);
@@ -137,15 +160,16 @@ expect_backtrace(ktrace_session_t s, uint64_t tid, unsigned int *stacks_seen,
  * backtrace).
  */
 static int __attribute__((noinline,not_tail_called))
-recurse_a(bool spin, unsigned int frames);
+recurse_a(dispatch_semaphore_t spinning, unsigned int frames);
 static int __attribute__((noinline,not_tail_called))
-recurse_b(bool spin, unsigned int frames);
+recurse_b(dispatch_semaphore_t spinning, unsigned int frames);
 
 static int __attribute__((noinline,not_tail_called))
-recurse_a(bool spin, unsigned int frames)
+recurse_a(dispatch_semaphore_t spinning, unsigned int frames)
 {
     if (frames == 0) {
-        if (spin) {
+        if (spinning) {
+            dispatch_semaphore_signal(spinning);
             for (;;);
         } else {
             kdebug_trace(TRIGGERING_DEBUGID, 0, 0, 0, 0);
@@ -153,14 +177,15 @@ recurse_a(bool spin, unsigned int frames)
         }
     }
 
-    return recurse_b(spin, frames - 1) + 1;
+    return recurse_b(spinning, frames - 1) + 1;
 }
 
 static int __attribute__((noinline,not_tail_called))
-recurse_b(bool spin, unsigned int frames)
+recurse_b(dispatch_semaphore_t spinning, unsigned int frames)
 {
     if (frames == 0) {
-        if (spin) {
+        if (spinning) {
+            dispatch_semaphore_signal(spinning);
             for (;;);
         } else {
             kdebug_trace(TRIGGERING_DEBUGID, 0, 0, 0, 0);
@@ -168,7 +193,7 @@ recurse_b(bool spin, unsigned int frames)
         }
     }
 
-    return recurse_a(spin, frames - 1) + 1;
+    return recurse_a(spinning, frames - 1) + 1;
 }
 
 #define USER_FRAMES       (12)
@@ -204,17 +229,29 @@ static const char *kernel_bt[KERNEL_FRAMES] = {
 #error "architecture unsupported"
 #endif /* defined(__arm__) */
 
-static dispatch_once_t backtrace_start_once;
-static dispatch_semaphore_t backtrace_start;
+static dispatch_once_t backtrace_once;
+static dispatch_semaphore_t backtrace_started;
+static dispatch_semaphore_t backtrace_go;
 
+/*
+ * Another thread to run with a known backtrace.
+ *
+ * Take a semaphore that will be signalled when the thread is spinning at the
+ * correct frame.  If the semaphore is NULL, don't spin and instead make a
+ * kdebug_trace system call, which can trigger a deterministic backtrace itself.
+ */
 static void *
 backtrace_thread(void *arg)
 {
-    bool spin;
+    dispatch_semaphore_t notify_spinning;
     unsigned int calls;
 
-    spin = (bool)arg;
-    dispatch_semaphore_wait(backtrace_start, DISPATCH_TIME_FOREVER);
+    notify_spinning = (dispatch_semaphore_t)arg;
+
+    dispatch_semaphore_signal(backtrace_started);
+    if (!notify_spinning) {
+        dispatch_semaphore_wait(backtrace_go, DISPATCH_TIME_FOREVER);
+    }
 
     /*
      * backtrace_thread, recurse_a, recurse_b, ...[, __kdebug_trace64]
@@ -222,7 +259,7 @@ backtrace_thread(void *arg)
      * Always make one less call for this frame (backtrace_thread).
      */
     calls = USER_FRAMES - RECURSE_START_OFFSET - 1 /* backtrace_thread */;
-    if (spin) {
+    if (notify_spinning) {
         /*
          * Spinning doesn't end up calling __kdebug_trace64.
          */
@@ -231,23 +268,36 @@ backtrace_thread(void *arg)
 
     T_LOG("backtrace thread calling into %d frames (already at %d frames)",
         calls, RECURSE_START_OFFSET);
-    (void)recurse_a(spin, calls);
+    (void)recurse_a(notify_spinning, calls);
     return NULL;
 }
 
 static uint64_t
-create_backtrace_thread(bool spin)
+create_backtrace_thread(dispatch_semaphore_t notify_spinning)
 {
-    pthread_t thread;
+    pthread_t thread = NULL;
     uint64_t tid;
 
-    dispatch_once(&backtrace_start_once, ^(void) {
-        backtrace_start = dispatch_semaphore_create(0);
+    dispatch_once(&backtrace_once, ^{
+        backtrace_started = dispatch_semaphore_create(0);
+        T_QUIET; T_ASSERT_NOTNULL(backtrace_started, NULL);
+
+        if (!notify_spinning) {
+            backtrace_go = dispatch_semaphore_create(0);
+            T_QUIET; T_ASSERT_NOTNULL(backtrace_go, NULL);
+        }
     });
 
     T_QUIET; T_ASSERT_POSIX_ZERO(pthread_create(&thread, NULL, backtrace_thread,
-        (void *)spin), NULL);
+        (void *)notify_spinning), NULL);
+    T_QUIET; T_ASSERT_NOTNULL(thread, "backtrace thread created");
+    dispatch_semaphore_wait(backtrace_started, DISPATCH_TIME_FOREVER);
+
     T_QUIET; T_ASSERT_POSIX_ZERO(pthread_threadid_np(thread, &tid), NULL);
+    T_QUIET; T_ASSERT_NE(tid, UINT64_C(0),
+        "backtrace thread created does not have ID 0");
+
+    T_LOG("starting thread with ID 0x%" PRIx64, tid);
 
     return tid;
 }
@@ -255,16 +305,16 @@ create_backtrace_thread(bool spin)
 static void
 start_backtrace_thread(void)
 {
-    T_QUIET; T_ASSERT_NOTNULL(backtrace_start,
+    T_QUIET; T_ASSERT_NOTNULL(backtrace_go,
         "thread to backtrace created before starting it");
-    dispatch_semaphore_signal(backtrace_start);
+    dispatch_semaphore_signal(backtrace_go);
 }
 
 #define TEST_TIMEOUT_NS (5 * NSEC_PER_SEC)
 
 T_DECL(kdebug_trigger_backtraces,
     "test that backtraces from kdebug trigger are correct",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     static unsigned int stacks_seen = 0;
     ktrace_session_t s;
@@ -276,9 +326,9 @@ T_DECL(kdebug_trigger_backtraces,
 
     T_ASSERT_POSIX_ZERO(ktrace_filter_pid(s, getpid()), NULL);
 
-    tid = create_backtrace_thread(false);
-    expect_backtrace(s, tid, &stacks_seen, false, user_bt, USER_FRAMES);
-    expect_backtrace(s, tid, &stacks_seen, true, kernel_bt, KERNEL_FRAMES);
+    tid = create_backtrace_thread(NULL);
+    expect_backtrace(s, tid, &stacks_seen, false, user_bt, USER_FRAMES, 0);
+    expect_backtrace(s, tid, &stacks_seen, true, kernel_bt, KERNEL_FRAMES, 0);
 
     /*
      * The triggering event must be traced (and thus registered with libktrace)
@@ -315,6 +365,7 @@ T_DECL(kdebug_trigger_backtraces,
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, TEST_TIMEOUT_NS),
         dispatch_get_main_queue(), ^(void)
     {
+        T_LOG("ending test after timeout");
         ktrace_end(s, 0);
     });
 
@@ -323,11 +374,12 @@ T_DECL(kdebug_trigger_backtraces,
 
 T_DECL(user_backtraces_timer,
     "test that user backtraces on a timer are correct",
-    T_META_ASROOT(YES))
+    T_META_ASROOT(true))
 {
     static unsigned int stacks_seen = 0;
     ktrace_session_t s;
     uint64_t tid;
+    dispatch_semaphore_t wait_for_spinning = dispatch_semaphore_create(0);
 
     s = ktrace_session_create();
     T_QUIET; T_ASSERT_NOTNULL(s, "ktrace_session_create");
@@ -336,9 +388,9 @@ T_DECL(user_backtraces_timer,
 
     configure_kperf_stacks_timer(getpid(), 10);
 
-    tid = create_backtrace_thread(true);
-    /* not calling kdebug_trace(2) on the last frame */
-    expect_backtrace(s, tid, &stacks_seen, false, user_bt, USER_FRAMES - 1);
+    tid = create_backtrace_thread(wait_for_spinning);
+    /* potentially calling dispatch function and system call */
+    expect_backtrace(s, tid, &stacks_seen, false, user_bt, USER_FRAMES - 1, 2);
 
     ktrace_set_completion_handler(s, ^(void) {
         T_EXPECT_GE(stacks_seen, 1U, "saw at least one stack");
@@ -349,13 +401,15 @@ T_DECL(user_backtraces_timer,
 
     T_QUIET; T_ASSERT_POSIX_SUCCESS(kperf_sample_set(1), NULL);
 
-    T_ASSERT_POSIX_ZERO(ktrace_start(s, dispatch_get_main_queue()), NULL);
+    /* wait until the thread that will be backtraced is spinning */
+    dispatch_semaphore_wait(wait_for_spinning, DISPATCH_TIME_FOREVER);
 
-    start_backtrace_thread();
+    T_ASSERT_POSIX_ZERO(ktrace_start(s, dispatch_get_main_queue()), NULL);
 
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, TEST_TIMEOUT_NS),
         dispatch_get_main_queue(), ^(void)
     {
+        T_LOG("ending test after timeout");
         ktrace_end(s, 0);
     });
 
@@ -363,6 +417,6 @@ T_DECL(user_backtraces_timer,
 }
 
 /* TODO test kernel stacks in all modes */
-/* TODO PET mode backtracing */
+/* TODO legacy PET mode backtracing */
 /* TODO test deep stacks, further than 128 frames, make sure they are truncated */
 /* TODO test constrained stacks */
index 4bcd3fc537c4c6f3be1d073a972c038036723be5..a2e30174acdf999c306eee91c6b0cd915fc8a02b 100644 (file)
@@ -108,7 +108,7 @@ kevent_one_shot(int kq, int fd, int filter)
        T_ASSERT_POSIX_ZERO(retval, "ONESHOT kevent for fd %d, filter %d", fd, filter);
 }
 
-T_DECL(kqueue_fifo_18776047, "Tests kqueue, kevent for watching a fifo.", T_META("owner", "Core Kernel Team"))
+T_DECL(kqueue_fifo_18776047, "Tests kqueue, kevent for watching a fifo.", T_META_LTEPHASE(LTE_POSTINIT))
 {
        struct kevent kev[1];
        int read_fd, write_fd, kq;
index 85a1f85e05f3de842b6cb1ee20df877766ae7a82..ad0ac326528763593a10197486efe0c2ba671439 100644 (file)
@@ -8,7 +8,7 @@
 #include <darwintest.h>
 
 T_DECL(mach_boottime_usec, "mach_boottime_usec()",
-               T_META_ALL_VALID_ARCHS(YES))
+               T_META_ALL_VALID_ARCHS(true), T_META_LTEPHASE(LTE_POSTINIT))
 {
        uint64_t bt_usec = mach_boottime_usec();
 
index 1afdb6d449cf8393eed57fa71e5f8f40a0103307..d83ed377a942002bfb2bb149454e0492ccb8ecfb 100644 (file)
@@ -27,7 +27,7 @@ update(uint64_t *a, uint64_t *c) {
 }
 
 T_DECL(mct_monotonic, "Testing mach_continuous_time returns sane, monotonic values",
-               T_META_ALL_VALID_ARCHS(YES))
+               T_META_ALL_VALID_ARCHS(true))
 {
        mach_timebase_info(&tb_info);
 
@@ -159,7 +159,7 @@ T_DECL(mct_settimeofday, "Testing mach_continuous_time behavior over settimeofda
 }
 
 T_DECL(mct_aproximate, "Testing mach_continuous_approximate_time()",
-               T_META_ALL_VALID_ARCHS(YES))
+               T_META_ALL_VALID_ARCHS(true))
 {
        mach_timebase_info(&tb_info);
 
index 915602b5068f3086ce1cb97ccc7fe851bba96d8d..c40badada71831c8e9e24fb264a54a9223ae5b1a 100644 (file)
@@ -11,7 +11,7 @@
 #define timespec2nanosec(ts) ((uint64_t)((ts)->tv_sec) * NSEC_PER_SEC + (uint64_t)((ts)->tv_nsec))
 
 T_DECL(mach_get_times, "mach_get_times()",
-          T_META_CHECK_LEAKS(NO), T_META_ALL_VALID_ARCHS(YES))
+          T_META_CHECK_LEAKS(false), T_META_ALL_VALID_ARCHS(true))
 {
        const int ITERATIONS = 500000 * dt_ncpu();
        struct timespec gtod_ts;
index ad0a5c779dcb7ca6f08da74cb64425c2f086f07a..51f3bb4d9ff9f9dcc45459b2cfe82d580164edbf 100644 (file)
@@ -5,7 +5,7 @@
 extern kern_return_t mach_timebase_info_trap(mach_timebase_info_t info);
 
 T_DECL(mach_timebase_info, "mach_timebase_info(_trap)",
-               T_META_ALL_VALID_ARCHS(YES))
+               T_META_ALL_VALID_ARCHS(true), T_META_LTEPHASE(LTE_POSTINIT))
 {
        mach_timebase_info_data_t a, b, c;
 
diff --git a/tools/tests/darwintests/perf_compressor.c b/tools/tests/darwintests/perf_compressor.c
new file mode 100644 (file)
index 0000000..b404a97
--- /dev/null
@@ -0,0 +1,245 @@
+#ifdef T_NAMESPACE
+#undef T_NAMESPACE
+#endif
+#include <darwintest.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/sysctl.h>
+
+T_GLOBAL_META(
+       T_META_NAMESPACE("xnu.vm.perf"),
+       T_META_CHECK_LEAKS(false)
+);
+
+enum {
+       ALL_ZEROS,
+       MOSTLY_ZEROS,
+       RANDOM,
+       TYPICAL
+};
+
+void allocate_zero_pages(char **buf, int num_pages, int vmpgsize);
+void allocate_mostly_zero_pages(char **buf, int num_pages, int vmpgsize);
+void allocate_random_pages(char **buf, int num_pages, int vmpgsize);
+void allocate_representative_pages(char **buf, int num_pages, int vmpgsize);
+void allocate_pages(int size_mb, int page_type);
+void run_compressor_test(int size_mb, int page_type);
+
+void allocate_zero_pages(char **buf, int num_pages, int vmpgsize) {
+       int i;
+
+       for (i = 0; i < num_pages; i++) {
+               buf[i] = (char*)malloc((size_t)vmpgsize * sizeof(char));
+               memset(buf[i], 0, vmpgsize);
+       }
+}
+
+void allocate_mostly_zero_pages(char **buf, int num_pages, int vmpgsize) {
+       int i, j;
+
+       for (i = 0; i < num_pages; i++) {
+               buf[i] = (char*)malloc((size_t)vmpgsize * sizeof(char));
+               memset(buf[i], 0, vmpgsize);
+               for (j = 0; j < 40; j++) {
+                       buf[i][j] = (char)(j+1);
+               }
+       }
+}
+
+void allocate_random_pages(char **buf, int num_pages, int vmpgsize) {
+       int fd, i;
+
+       fd = open("/dev/random", O_RDONLY);
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(fd, "open /dev/random failed [%s]\n", strerror(errno));
+
+       for (i = 0; i < num_pages; i++) {
+               buf[i] = (char*)malloc((size_t)vmpgsize * sizeof(char));
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(read(fd, buf[i], (size_t)vmpgsize),
+                               "read from /dev/random failed [%s]\n", strerror(errno));
+       }
+       close(fd);
+}
+
+// Gives us the compression ratio we see in the typical case (~2.7)
+void allocate_representative_pages(char **buf, int num_pages, int vmpgsize) {
+       int i, j;
+       char val;
+
+       for (j = 0; j < num_pages; j++) {
+               buf[j] = (char*)malloc((size_t)vmpgsize * sizeof(char));
+               val = 0;
+               for (i = 0; i < vmpgsize; i += 16) {
+                       memset(&buf[j][i], val, 16);
+                       if (i < 3700 * (vmpgsize / 4096)) {
+                               val++;
+                       }
+               }
+       }
+}
+
+void allocate_pages(int size_mb, int page_type) {
+       int num_pages = 0;
+       int vmpgsize, i, j;
+       char **buf;
+       size_t vmpgsize_length;
+
+       vmpgsize_length = sizeof(vmpgsize);
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(sysctlbyname("vm.pagesize", &vmpgsize, &vmpgsize_length, NULL, 0),
+                       "failed to query vm.pagesize");
+       if (vmpgsize == 0) {
+               T_FAIL("vm.pagesize set to zero");
+       }
+
+       num_pages = size_mb * 1024 * 1024 / vmpgsize;
+       buf = (char**)malloc(sizeof(char*) * (size_t)num_pages);
+
+       // Switch on the type of page requested
+       switch(page_type) {
+               case ALL_ZEROS:
+                       allocate_zero_pages(buf, num_pages, vmpgsize);
+                       break;
+               case MOSTLY_ZEROS:
+                       allocate_mostly_zero_pages(buf, num_pages, vmpgsize);
+                       break;
+               case RANDOM:
+                       allocate_random_pages(buf, num_pages, vmpgsize);
+                       break;
+               case TYPICAL:
+                       allocate_representative_pages(buf, num_pages, vmpgsize);
+                       break;
+               default:
+                       T_FAIL("unknown page type");
+                       break;
+       }
+
+       for(j = 0; j < num_pages; j++) {
+               i = buf[j][1];
+       }
+}
+
+
+void run_compressor_test(int size_mb, int page_type) {
+
+#ifndef CONFIG_FREEZE
+       T_SKIP("Task freeze not supported.");
+#endif
+
+       dt_stat_t r = dt_stat_create("(input bytes / compressed bytes)", "compression_ratio");
+       dt_stat_time_t s = dt_stat_time_create("compressor_latency");
+
+       while (!dt_stat_stable(s)) {
+               pid_t pid;
+               int parent_pipe[2], child_pipe[2];
+
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(pipe(parent_pipe), "pipe failed");
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(pipe(child_pipe), "pipe failed");
+
+               pid = fork();
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(pid, "fork failed with %d", errno);
+
+               if (pid == 0) {
+                       int val = 1;
+
+                       close(child_pipe[0]);
+                       close(parent_pipe[1]);
+                       allocate_pages(size_mb, page_type);
+
+                       // Indicates to the parent that the child has finished allocating pages
+                       write(child_pipe[1], &val, sizeof(val));
+
+                       // Parent is done with the freeze, ok to exit now
+                       read(parent_pipe[0], &val, sizeof(val));
+                       if (val != 2) {
+                               T_FAIL("pipe read error");
+                       }
+                       close(child_pipe[1]);
+                       close(parent_pipe[0]);
+                       exit(0);
+
+               } else {
+                       int val, ret;
+                       int64_t compressed_before, compressed_after, input_before, input_after;
+                       dt_stat_token start_token;
+                       size_t length = sizeof(compressed_before);
+
+                       close(child_pipe[1]);
+                       close(parent_pipe[0]);
+
+                       // Wait for the child to finish allocating pages
+                       read(child_pipe[0], &val, sizeof(val));
+                       if (val != 1) {
+                               T_FAIL("pipe read error");
+                       }
+                       // Just to be extra sure that the child has finished allocating all of its pages
+                       usleep(100);
+
+                       T_LOG("attempting to freeze pid %d\n", pid);
+
+                       T_QUIET; T_ASSERT_POSIX_SUCCESS(sysctlbyname("vm.compressor_compressed_bytes", &compressed_before, &length, NULL, 0),
+                                       "failed to query vm.compressor_compressed_bytes");
+                       T_QUIET; T_ASSERT_POSIX_SUCCESS(sysctlbyname("vm.compressor_input_bytes", &input_before, &length, NULL, 0),
+                                       "failed to query vm.compressor_input_bytes");
+
+                       start_token = dt_stat_time_begin(s);
+                       ret = sysctlbyname("kern.memorystatus_freeze", NULL, NULL, &pid, (size_t)sizeof(int));
+                       dt_stat_time_end(s, start_token);
+
+                       T_QUIET; T_ASSERT_POSIX_SUCCESS(sysctlbyname("vm.compressor_compressed_bytes", &compressed_after, &length, NULL, 0),
+                                       "failed to query vm.compressor_compressed_bytes");
+                       T_QUIET; T_ASSERT_POSIX_SUCCESS(sysctlbyname("vm.compressor_input_bytes", &input_after, &length, NULL, 0),
+                                       "failed to query vm.compressor_input_bytes");
+
+                       T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "sysctl kern.memorystatus_freeze failed on pid %d", pid);
+
+                       dt_stat_add(r, (double)(input_after - input_before)/(double)(compressed_after - compressed_before));
+
+                       val = 2;
+                       // Ok for the child to exit now
+                       write(parent_pipe[1], &val, sizeof(val));
+                       usleep(100);
+
+                       close(child_pipe[0]);
+                       close(parent_pipe[1]);
+               }
+       }
+
+       dt_stat_finalize(s);
+       dt_stat_finalize(r);
+}
+
+// Numbers for 10MB and above are fairly reproducible. Anything smaller shows a lot of variation.
+T_DECL(compr_10MB_zero, "Compressor latencies") {
+       run_compressor_test(10, ALL_ZEROS);
+}
+
+T_DECL(compr_10MB_mostly_zero, "Compressor latencies") {
+       run_compressor_test(10, MOSTLY_ZEROS);
+}
+
+T_DECL(compr_10MB_random, "Compressor latencies") {
+       run_compressor_test(10, RANDOM);
+}
+
+T_DECL(compr_10MB_typical, "Compressor latencies") {
+       run_compressor_test(10, TYPICAL);
+}
+
+T_DECL(compr_100MB_zero, "Compressor latencies") {
+       run_compressor_test(100, ALL_ZEROS);
+}
+
+T_DECL(compr_100MB_mostly_zero, "Compressor latencies") {
+       run_compressor_test(100, MOSTLY_ZEROS);
+}
+
+T_DECL(compr_100MB_random, "Compressor latencies") {
+       run_compressor_test(100, RANDOM);
+}
+
+T_DECL(compr_100MB_typical, "Compressor latencies") {
+       run_compressor_test(100, TYPICAL);
+}
+
index d45a6481b59d77e9044198aee1e5d71c01684c13..052b942c3efd5b8e15968ca905e4cd5cf0010310 100644 (file)
@@ -1,15 +1,35 @@
+#ifdef T_NAMESPACE
+#undef T_NAMESPACE
+#endif
+#include <darwintest.h>
+
 #include <sys/kdebug.h>
 #include <ktrace.h>
 #include <spawn.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#include <darwintest.h>
+T_GLOBAL_META(
+       T_META_NAMESPACE("xnu.perf.exit"),
+       T_META_ASROOT(true),
+       T_META_LTEPHASE(LTE_SINGLEUSER)
+);
+
+// From osfmk/kern/sched.h
+#define BASEPRI_FOREGROUND 47
+#define BASEPRI_USER_INITIATED 37
+#define BASEPRI_UTILITY 20
+#define MAXPRI_THROTTLE 4
 
 // From bsd/sys/proc_internal.h
 #define PID_MAX 99999
 
-T_DECL(exit, "exit(2) time from syscall start to end", T_META_TYPE_PERF, T_META_CHECK_LEAKS(NO)) {
+#define EXIT_BINARY "perf_exit_proc"
+#define EXIT_BINARY_PATH "./" EXIT_BINARY
+
+void run_exit_test(int proc_wired_mem, int thread_priority, int nthreads);
+
+void run_exit_test(int proc_wired_mem, int thread_priority, int nthreads) {
        _Atomic static int ended = 0;
        dispatch_queue_t spawn_queue;
 
@@ -25,17 +45,20 @@ T_DECL(exit, "exit(2) time from syscall start to end", T_META_TYPE_PERF, T_META_
        if (session == NULL) {
                T_FAIL("Error creating ktrace session");
        }
-       
+
+       spawn_queue = dispatch_queue_create("spawn_queue", NULL);
+
        ktrace_set_completion_handler(session, ^{
                free(begin_ts);
                dt_stat_finalize(s);
+               dispatch_release(spawn_queue);
                T_END;
        });
 
        ktrace_set_signal_handler(session);
 
        // We are only interested by the process we launched
-       ktrace_filter_process(session, "true");
+       ktrace_filter_process(session, EXIT_BINARY);
 
        ktrace_events_single(session, (BSDDBG_CODE(DBG_BSD_EXCP_SC, 1) | DBG_FUNC_START), ^(ktrace_event_t e) {
                pid_t pid = ktrace_get_pid_for_thread(session, e->threadid);
@@ -67,14 +90,19 @@ T_DECL(exit, "exit(2) time from syscall start to end", T_META_TYPE_PERF, T_META_
        if (ret != 0) {
                T_FAIL("Error starting ktrace");
        }
-       
+
        // Spawn processes continuously until the test is over
-       spawn_queue = dispatch_queue_create("spawn_queue", NULL);
        dispatch_async(spawn_queue, ^(void) {
+               char priority_buf[32], nthreads_buf[32], mem_buf[32];
+
+               snprintf(priority_buf, 32, "%d", thread_priority);
+               snprintf(nthreads_buf, 32, "%d", nthreads);
+               snprintf(mem_buf, 32, "%d", proc_wired_mem);
+
+               char *args[] = {EXIT_BINARY_PATH, priority_buf, nthreads_buf, mem_buf, NULL};
+               int status;
                while (!ended) {
                        pid_t pid;
-                       int status;
-                       char *args[] = {"/usr/bin/true", NULL};
                        int err = posix_spawn(&pid, args[0], NULL, NULL, args, NULL);
                        if (err)
                                T_FAIL("posix_spawn returned %d", err);
@@ -82,8 +110,56 @@ T_DECL(exit, "exit(2) time from syscall start to end", T_META_TYPE_PERF, T_META_
                        waitpid(pid, &status, 0);
                        if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
                                T_FAIL("Child process of posix_spawn failed to run");
+
+                       // Avoid saturating the CPU with new processes
+                       usleep(1);
                }
        });
 
        dispatch_main();
 }
+
+
+T_DECL(exit, "exit(2) time from syscall start to end") {
+       run_exit_test(0, BASEPRI_FOREGROUND, 0);
+}
+
+T_DECL(exit_pri_4, "exit(2) time at priority 4 (throttled)") {
+       run_exit_test(0, MAXPRI_THROTTLE, 0);
+}
+
+T_DECL(exit_pri_20, "exit(2) time at priority 20 (utility)") {
+       run_exit_test(0, BASEPRI_UTILITY, 0);
+}
+
+T_DECL(exit_pri_37, "exit(2) time at priority 37 (user initiated)") {
+       run_exit_test(0, BASEPRI_USER_INITIATED, 0);
+}
+
+T_DECL(exit_10_threads, "exit(2) time with 10 threads") {
+       run_exit_test(0, BASEPRI_FOREGROUND, 10);
+}
+
+
+T_DECL(exit_1mb, "exit(2) time with 1MB of wired memory") {
+       run_exit_test(10000000, BASEPRI_FOREGROUND, 0);
+}
+
+T_DECL(exit_10mb, "exit(2) time with 10MB of wired memory") {
+       run_exit_test(10000000, BASEPRI_FOREGROUND, 0);
+}
+
+/*
+T_DECL(exit_100_threads, "exit(2) time with 100 threads", T_META_TIMEOUT(1800)) {
+       run_exit_test(0, BASEPRI_FOREGROUND, 100);
+}
+
+T_DECL(exit_1000_threads, "exit(2) time with 1000 threads", T_META_TIMEOUT(1800)) {
+       run_exit_test(0, BASEPRI_FOREGROUND, 1000);
+}
+
+T_DECL(exit_100mb, "exit(2) time with 100MB of wired memory", T_META_TIMEOUT(1800)) {
+       run_exit_test(100000000, BASEPRI_FOREGROUND, 0);
+}
+*/
+
diff --git a/tools/tests/darwintests/perf_exit_proc.c b/tools/tests/darwintests/perf_exit_proc.c
new file mode 100644 (file)
index 0000000..fa157cd
--- /dev/null
@@ -0,0 +1,109 @@
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include <mach/mach.h>
+#include <mach/mach_vm.h>
+
+static void* loop(__attribute__ ((unused)) void *arg) {
+       while (1) {
+
+       }
+}
+
+
+static int run_additional_threads(int nthreads) {
+       for (int i = 0; i < nthreads; i++) {
+               pthread_t pthread;
+               int err;
+               
+               err = pthread_create(&pthread, NULL, loop, NULL);
+               if (err) {
+                       return err;
+               }
+       }
+
+       return 0;
+}
+
+static int allocate_and_wire_memory(mach_vm_size_t size) {
+       int err;
+       task_t task = mach_task_self();
+       mach_vm_address_t addr;
+
+       if (size <= 0)
+               return 0;
+
+       err = mach_vm_allocate(task, &addr, size, VM_FLAGS_ANYWHERE);
+       if (err != KERN_SUCCESS) {
+               printf("mach_vm_allocate returned non-zero: %s\n", mach_error_string(err));
+               return err;
+       }
+       err = mach_vm_protect(task, addr, size, 0, VM_PROT_READ | VM_PROT_WRITE);;
+       if (err != KERN_SUCCESS) {
+               printf("mach_vm_protect returned non-zero: %s\n", mach_error_string(err));
+               return err;
+       }
+       host_t host_priv_port;
+       err = host_get_host_priv_port(mach_host_self(), &host_priv_port);
+       if (err != KERN_SUCCESS) {
+               printf("host_get_host_priv_port retruned non-zero: %s\n", mach_error_string(err));
+               return err;
+       }
+       err = mach_vm_wire(host_priv_port, task, addr, size, VM_PROT_READ | VM_PROT_WRITE);
+       if (err != KERN_SUCCESS) {
+               printf("mach_vm_wire returned non-zero: %s\n", mach_error_string(err));
+               return err;
+       }
+
+       return 0;
+}
+
+static int set_thread_priority(int priority) {
+       struct sched_param param;
+       int policy;
+
+       int err = pthread_getschedparam(pthread_self(), &policy, &param);
+       if (err) return err;
+
+       param.sched_priority = priority;
+
+       err = pthread_setschedparam(pthread_self(), policy, &param);
+       if (err) return err;
+       
+       return 0;
+}
+
+int main(int argc, char *argv[]) {
+       int priority = 47, nthreads = 0;
+       int err;
+       mach_vm_size_t wired_mem = 0;
+
+       if (argc > 1) {
+               priority = (int)strtoul(argv[1], NULL, 10);
+       }
+       if (argc > 2) {
+               nthreads = (int)strtoul(argv[2], NULL, 10);
+       }
+       if (argc > 3) {
+               wired_mem = (mach_vm_size_t)strtoul(argv[3], NULL, 10);
+       }
+       
+       err = allocate_and_wire_memory(wired_mem);
+       if (err) {
+               return err;
+       }
+
+       err = set_thread_priority(priority);
+       if (err) {
+               return err;
+       }
+
+       err = run_additional_threads(nthreads);
+       if (err) {
+               return err;
+       }
+
+       return 0;
+}
diff --git a/tools/tests/darwintests/perf_kdebug.c b/tools/tests/darwintests/perf_kdebug.c
new file mode 100644 (file)
index 0000000..1dc98d8
--- /dev/null
@@ -0,0 +1,163 @@
+#ifdef T_NAMESPACE
+#undef T_NAMESPACE
+#endif
+#include <darwintest.h>
+
+#include <sys/kdebug.h>
+#include <sys/sysctl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+T_GLOBAL_META(
+       T_META_NAMESPACE("xnu.perf.kdebug"),
+       T_META_ASROOT(true),
+       T_META_CHECK_LEAKS(false)
+);
+
+//
+// Helper functions for direct control over the kernel trace facility.
+//
+
+static void _sysctl_reset() {
+       int mib[] = { CTL_KERN, KERN_KDEBUG, KERN_KDREMOVE };
+       if(sysctl(mib, 3, NULL, NULL, NULL, 0)) {
+               T_FAIL("KERN_KDREMOVE sysctl failed");
+       }
+}
+
+static void _sysctl_setbuf(uint32_t capacity) {
+       int mib[] = { CTL_KERN, KERN_KDEBUG, KERN_KDSETBUF, (int)capacity };
+       if (sysctl(mib, 4, NULL, NULL, NULL, 0)) {
+               T_FAIL("KERN_KDSETBUF sysctl failed");
+       }
+}
+
+static void _sysctl_setup() {
+       int mib[] = { CTL_KERN, KERN_KDEBUG, KERN_KDSETUP };
+       if (sysctl(mib, 3, NULL, NULL, NULL, 0)) {
+               T_FAIL("KERN_KDSETUP sysctl failed");
+       }
+}
+
+static void _sysctl_enable(int value)
+{
+       int mib[] = { CTL_KERN, KERN_KDEBUG, KERN_KDENABLE, value };
+       if (sysctl(mib, 4, NULL, NULL, NULL, 0) < 0) {
+               T_FAIL("KERN_KDENABLE sysctl failed");
+       }
+}
+
+static void _sysctl_enable_typefilter(uint8_t* type_filter_bitmap) {
+       int mib[] = { CTL_KERN, KERN_KDEBUG, KERN_KDSET_TYPEFILTER };
+       size_t needed = KDBG_TYPEFILTER_BITMAP_SIZE;
+       if(sysctl(mib, 3, type_filter_bitmap, &needed, NULL, 0)) {
+               T_FAIL("KERN_KDSET_TYPEFILTER sysctl failed");
+       }
+}
+
+static void _sysctl_nowrap(bool is_nowrap) {
+       int mib[] = { CTL_KERN, KERN_KDEBUG, is_nowrap ? KERN_KDEFLAGS : KERN_KDDFLAGS, KDBG_NOWRAP };
+       if (sysctl(mib, 4, NULL, NULL, NULL, 0)) {
+               T_FAIL("KDBG_NOWRAP sysctl failed");
+       }
+}
+
+static void enable_tracing(bool value) {
+       _sysctl_enable(value ? KDEBUG_ENABLE_TRACE : 0);
+}
+
+static void enable_typefilter_all_reject() {
+       uint8_t type_filter_bitmap[KDBG_TYPEFILTER_BITMAP_SIZE];
+       memset(type_filter_bitmap, 0, sizeof(type_filter_bitmap));
+       _sysctl_enable_typefilter(type_filter_bitmap);
+}
+
+static void enable_typefilter_all_pass() {
+       uint8_t type_filter_bitmap[KDBG_TYPEFILTER_BITMAP_SIZE];
+       memset(type_filter_bitmap, 0xff, sizeof(type_filter_bitmap));
+       _sysctl_enable_typefilter(type_filter_bitmap);
+}
+
+static void loop_kdebug_trace(dt_stat_time_t s) {
+       do {
+               dt_stat_token start = dt_stat_time_begin(s);
+               for (uint32_t i = 0; i<100; i++) {
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+                       kdebug_trace(0x97000000 | DBG_FUNC_NONE, i, i, i, i);
+               }
+               dt_stat_time_end_batch(s, 1000, start);
+       } while (!dt_stat_stable(s));
+}
+
+static void loop_getppid(dt_stat_time_t s) {
+       do {
+               dt_stat_token start = dt_stat_time_begin(s);
+               for (uint32_t i = 0; i<100; i++) {
+                       getppid();
+                       getppid();
+                       getppid();
+                       getppid();
+                       getppid();
+                       getppid();
+                       getppid();
+                       getppid();
+                       getppid();
+                       getppid();
+               }
+               dt_stat_time_end_batch(s, 1000, start);
+       } while (!dt_stat_stable(s));
+}
+
+static void test(const char* test_name, void (^pretest_setup)(void), void (*test)(dt_stat_time_t s)) {
+       _sysctl_reset();
+       _sysctl_setbuf(1000000);
+       _sysctl_nowrap(false);
+       _sysctl_setup();
+
+       pretest_setup();
+
+       dt_stat_time_t s = dt_stat_time_create("%s", test_name);
+
+       test(s);
+
+       _sysctl_reset();
+       dt_stat_finalize(s);
+}
+
+//
+// Begin tests...
+//
+
+T_DECL(kdebug_trace_baseline_syscall,
+       "Test the latency of a syscall while kernel tracing is disabled") {
+       test("kdebug_trace_baseline_syscall", ^{ enable_tracing(false); }, loop_getppid);
+}
+
+T_DECL(kdebug_trace_kdbg_disabled,
+       "Test the latency of kdebug_trace while kernel tracing is disabled") {
+       test("kdebug_trace_kdbg_disabled", ^{ enable_tracing(false); }, loop_kdebug_trace);
+}
+
+T_DECL(kdebug_trace_kdbg_enabled,
+       "Test the latency of kdebug_trace while kernel tracing is enabled with no typefilter") {
+       test("kdebug_trace_kdbg_enabled", ^{ enable_tracing(true); }, loop_kdebug_trace);
+}
+
+T_DECL(kdebug_trace_kdbg_enabled_typefilter_pass,
+       "Test the latency of kdebug_trace while kernel tracing is enabled with a typefilter that passes the event") {
+       test("kdebug_trace_kdbg_enabled_typefilter_pass", ^{ enable_tracing(true); enable_typefilter_all_pass(); }, loop_kdebug_trace);
+}
+
+T_DECL(kdebug_trace_kdbg_enabled_typefilter_reject,
+       "Test the latency of kdebug_trace while kernel tracing is enabled with a typefilter that rejects the event") {
+       test("kdebug_trace_kdbg_enabled_typefilter_reject", ^{ enable_tracing(true); enable_typefilter_all_reject(); }, loop_kdebug_trace);
+}
index c52605ff042fa40f2c2e7a5193ce0691f3311bc2..13a85fff7250cc031800766637a5de8ccd107eb6 100644 (file)
@@ -1,8 +1,16 @@
+#ifdef T_NAMESPACE
+#undef T_NAMESPACE
+#endif
 #include <darwintest.h>
+
 #include <spawn.h>
 #include <stdlib.h>
 #include <unistd.h>
 
+T_GLOBAL_META(
+       T_META_NAMESPACE("xnu.perf.fork"),
+       T_META_CHECK_LEAKS(false)
+);
 
 #define SPAWN_MEASURE_LOOP(s) \
        char *args[] = {"/usr/bin/true", NULL}; \
@@ -22,7 +30,7 @@
                } \
        }
 
-T_DECL(posix_spawn_platform_binary_latency, "posix_spawn platform binary latency", T_META_TYPE_PERF, T_META_CHECK_LEAKS(NO)) {
+T_DECL(posix_spawn_platform_binary_latency, "posix_spawn platform binary latency") {
        {
                dt_stat_time_t s = dt_stat_time_create("time");
                SPAWN_MEASURE_LOOP(s);
@@ -53,7 +61,7 @@ T_DECL(posix_spawn_platform_binary_latency, "posix_spawn platform binary latency
                } \
        }
 
-T_DECL(fork, "fork latency", T_META_TYPE_PERF, T_META_CHECK_LEAKS(NO)) {
+T_DECL(fork, "fork latency") {
        {
                dt_stat_time_t s = dt_stat_time_create("time");
                FORK_MEASURE_LOOP(s);
diff --git a/tools/tests/darwintests/poll.c b/tools/tests/darwintests/poll.c
new file mode 100644 (file)
index 0000000..8ff8806
--- /dev/null
@@ -0,0 +1,129 @@
+#ifdef T_NAMESPACE
+#undef T_NAMESPACE
+#endif
+#include <darwintest.h>
+
+#include <dispatch/dispatch.h>
+#include <fcntl.h>
+#include <mach/mach.h>
+#include <poll.h>
+#include <stdint.h>
+#include <unistd.h>
+
+T_GLOBAL_META(T_META_NAMESPACE("xnu.poll"));
+
+#define SLEEP_TIME_SECS 1
+#define POLL_TIMEOUT_MS 1800
+static_assert(POLL_TIMEOUT_MS > (SLEEP_TIME_SECS * 1000),
+               "poll timeout should be longer than sleep time");
+
+/*
+ * This matches the behavior of other UNIXes, but is under-specified in POSIX.
+ *
+ * See <rdar://problem/28372390>.
+ */
+T_DECL(sleep_with_no_fds,
+               "poll() called with no fds provided should act like sleep")
+{
+       uint64_t begin_time, sleep_time, poll_time;
+       struct pollfd pfd = { 0 };
+
+       begin_time = mach_absolute_time();
+       sleep(SLEEP_TIME_SECS);
+       sleep_time = mach_absolute_time() - begin_time;
+       T_LOG("sleep(%d) ~= %llu mach absolute time units", SLEEP_TIME_SECS, sleep_time);
+
+       begin_time = mach_absolute_time();
+       T_ASSERT_POSIX_SUCCESS(poll(&pfd, 0, POLL_TIMEOUT_MS),
+                       "poll() with 0 events and timeout %d ms", POLL_TIMEOUT_MS);
+       poll_time = mach_absolute_time() - begin_time;
+
+       T_EXPECT_GT(poll_time, sleep_time,
+                       "poll(... %d) should wait longer than sleep(1)", POLL_TIMEOUT_MS);
+}
+
+#define LAUNCHD_PATH "/sbin/launchd"
+#define PIPE_DIR_TIMEOUT_SECS 1
+
+/*
+ * See <rdar://problem/28539155>.
+ */
+T_DECL(directories,
+               "poll() with directories should return an error")
+{
+       int file, dir, pipes[2];
+       struct pollfd pfd[] = {
+               { .events = POLLIN },
+               { .events = POLLIN },
+               { .events = POLLIN },
+       };
+
+       file = open(LAUNCHD_PATH, O_RDONLY | O_NONBLOCK);
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(file, "open(%s)", LAUNCHD_PATH);
+       dir = open(".", O_RDONLY | O_NONBLOCK);
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(dir, "open(\".\")");
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(pipe(pipes), NULL);
+
+       /* just directory */
+       pfd[0].fd = dir;
+       T_EXPECT_POSIX_SUCCESS(poll(pfd, 1, -1), "poll() with a directory");
+       T_QUIET; T_EXPECT_TRUE(pfd[0].revents & POLLNVAL,
+                       "directory should be an invalid event");
+
+       /* file and directory */
+       pfd[0].fd = file; pfd[0].revents = 0;
+       pfd[1].fd = dir; pfd[1].revents = 0;
+       T_EXPECT_POSIX_SUCCESS(poll(pfd, 2, -1),
+                       "poll() with a file and directory");
+       T_QUIET; T_EXPECT_TRUE(pfd[0].revents & POLLIN, "file should be readable");
+       T_QUIET; T_EXPECT_TRUE(pfd[1].revents & POLLNVAL,
+                       "directory should be an invalid event");
+
+       /* directory and file */
+       pfd[0].fd = dir; pfd[0].revents = 0;
+       pfd[1].fd = file; pfd[1].revents = 0;
+       T_EXPECT_POSIX_SUCCESS(poll(pfd, 2, -1),
+                       "poll() with a directory and a file");
+       T_QUIET; T_EXPECT_TRUE(pfd[0].revents & POLLNVAL,
+                       "directory should be an invalid event");
+       T_QUIET; T_EXPECT_TRUE(pfd[1].revents & POLLIN, "file should be readable");
+
+       /* file and pipe */
+       pfd[0].fd = file; pfd[0].revents = 0;
+       pfd[1].fd = pipes[0]; pfd[0].revents = 0;
+       T_EXPECT_POSIX_SUCCESS(poll(pfd, 2, -1),
+                       "poll() with a file and pipe");
+       T_QUIET; T_EXPECT_TRUE(pfd[0].revents & POLLIN, "file should be readable");
+       T_QUIET; T_EXPECT_FALSE(pfd[1].revents & POLLIN,
+                       "pipe should not be readable");
+
+       /* file, directory, and pipe */
+       pfd[0].fd = file; pfd[0].revents = 0;
+       pfd[1].fd = dir; pfd[1].revents = 0;
+       pfd[2].fd = pipes[0]; pfd[2].revents = 0;
+       T_EXPECT_POSIX_SUCCESS(poll(pfd, 3, -1),
+                       "poll() with a file, directory, and pipe");
+       T_QUIET; T_EXPECT_TRUE(pfd[0].revents & POLLIN, "file should be readable");
+       T_QUIET; T_EXPECT_TRUE(pfd[1].revents & POLLNVAL,
+                       "directory should be an invalid event");
+       T_QUIET; T_EXPECT_FALSE(pfd[2].revents & POLLIN, "pipe should not be readable");
+
+       /* directory and pipe */
+       __block bool timed_out = true;
+       pfd[0].fd = dir; pfd[0].revents = 0;
+       pfd[1].fd = pipes[0]; pfd[1].revents = 0;
+       dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
+                       PIPE_DIR_TIMEOUT_SECS * NSEC_PER_SEC),
+                       dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
+               T_ASSERT_FALSE(timed_out, "poll timed out after %d seconds",
+                               PIPE_DIR_TIMEOUT_SECS);
+       });
+
+       T_EXPECT_POSIX_SUCCESS(poll(pfd, 3, -1),
+                       "poll() with a directory and pipe");
+       timed_out = false;
+
+       T_QUIET; T_EXPECT_TRUE(pfd[0].revents & POLLNVAL,
+                       "directory should be an invalid event");
+       T_QUIET; T_EXPECT_FALSE(pfd[1].revents & POLLIN, "pipe should not be readable");
+}
diff --git a/tools/tests/darwintests/poll_select_kevent_paired_fds.c b/tools/tests/darwintests/poll_select_kevent_paired_fds.c
new file mode 100644 (file)
index 0000000..732e00a
--- /dev/null
@@ -0,0 +1,919 @@
+#ifdef T_NAMESPACE
+#undef T_NAMESPACE
+#endif
+#include <darwintest.h>
+#include <darwintest_multiprocess.h>
+
+#include <assert.h>
+#include <dispatch/dispatch.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <poll.h>
+#include <pthread.h>
+#include <pthread/workqueue_private.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/event.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sysexits.h>
+#include <unistd.h>
+#include <util.h>
+#include <System/sys/event.h> /* kevent_qos */
+
+T_GLOBAL_META(T_META_NAMESPACE("xnu.poll_select_kevent_paired_fds"));
+
+/*
+ * Test to validate that monitoring a PTY device, FIFO, pipe, or socket pair in
+ * a dispatch source, kqueue, poll, or select delivers read events within and
+ * between processes as expected.
+ *
+ * This test catches issues with watching special devices in kqueue(),
+ * which has tricky special cases for character devices like PTYs.
+ *
+ * It also exercises the path to wake up a dispatch worker thread from the
+ * special device kqueue event, which is also a special case in kqueue().
+ *
+ * See rdar://problem/26240299&26220074&26226862&28625427 for examples and
+ * history.
+ */
+
+#define EXPECTED_STRING    "abcdefghijklmnopqrstuvwxyz. ABCDEFGHIJKLMNOPQRSTUVWXYZ. 1234567890"
+#define EXPECTED_LEN       strlen(EXPECTED_STRING)
+
+#define READ_SETUP_TIMEOUT_SECS       2
+#define WRITE_TIMEOUT_SECS            4
+#define READ_TIMEOUT_SECS             2
+#define INCREMENTAL_WRITE_SLEEP_USECS 50
+
+enum fd_pair {
+       PTY_PAIR,
+       FIFO_PAIR,
+       PIPE_PAIR,
+       SOCKET_PAIR
+};
+
+enum write_mode {
+       FULL_WRITE,
+       INCREMENTAL_WRITE,
+       KEVENT_INCREMENTAL_WRITE,
+       KEVENT64_INCREMENTAL_WRITE,
+       KEVENT_QOS_INCREMENTAL_WRITE,
+       WORKQ_INCREMENTAL_WRITE,
+       DISPATCH_INCREMENTAL_WRITE
+};
+
+enum read_mode {
+       POLL_READ,
+       SELECT_READ,
+       KEVENT_READ,
+       KEVENT64_READ,
+       KEVENT_QOS_READ,
+       WORKQ_READ,
+       DISPATCH_READ
+};
+
+union mode {
+       enum read_mode rd;
+       enum write_mode wr;
+};
+
+static struct {
+       enum fd_pair fd_pair;
+       enum write_mode wr_mode;
+       int wr_fd;
+       enum read_mode rd_mode;
+       int rd_fd;
+
+       enum writer_kind {
+               THREAD_WRITER, /* sem */
+               PROCESS_WRITER /* fd */
+       } wr_kind;
+       union {
+               dispatch_semaphore_t sem;
+               struct {
+                       int in_fd;
+                       int out_fd;
+               };
+       } wr_wait;
+       dispatch_semaphore_t wr_finished;
+       dispatch_semaphore_t rd_finished;
+} shared;
+
+static bool handle_reading(enum fd_pair fd_pair, int fd);
+static bool handle_writing(enum fd_pair fd_pair, int fd);
+static void drive_kq(bool reading, union mode mode, enum fd_pair fd_pair,
+               int fd);
+
+#pragma mark writing
+
+static void
+wake_writer(void)
+{
+       T_LOG("waking writer");
+
+       switch (shared.wr_kind) {
+       case THREAD_WRITER:
+               dispatch_semaphore_signal(shared.wr_wait.sem);
+               break;
+       case PROCESS_WRITER: {
+               char tmp = 'a';
+               close(shared.wr_wait.out_fd);
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(write(
+                               shared.wr_wait.in_fd, &tmp, 1), NULL);
+               break;
+       }
+       }
+}
+
+static void
+writer_wait(void)
+{
+       switch (shared.wr_kind) {
+       case THREAD_WRITER:
+               T_QUIET; T_ASSERT_EQ(dispatch_semaphore_wait(
+                               shared.wr_wait.sem,
+                               dispatch_time(DISPATCH_TIME_NOW,
+                               READ_SETUP_TIMEOUT_SECS * NSEC_PER_SEC)), 0L,
+                               NULL);
+               break;
+       case PROCESS_WRITER: {
+               char tmp;
+               close(shared.wr_wait.in_fd);
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(read(
+                               shared.wr_wait.out_fd, &tmp, 1), NULL);
+               break;
+       }
+       }
+
+       T_LOG("writer woken up, starting to write");
+}
+
+static bool
+handle_writing(enum fd_pair __unused fd_pair, int fd)
+{
+       static unsigned int cur_char = 0;
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(write(fd,
+                       &(EXPECTED_STRING[cur_char]), 1), NULL);
+       cur_char++;
+
+       return (cur_char < EXPECTED_LEN);
+}
+
+#define EXPECTED_QOS QOS_CLASS_USER_INITIATED
+
+static void
+reenable_workq(int fd, int16_t filt)
+{
+       struct kevent_qos_s events[] = {{
+               .ident = (uint64_t)fd,
+               .filter = filt,
+               .flags = EV_ENABLE | EV_UDATA_SPECIFIC | EV_DISPATCH,
+               .qos = (int32_t)_pthread_qos_class_encode(EXPECTED_QOS,
+                               0, 0),
+               .fflags = NOTE_LOWAT,
+               .data = 1
+       }};
+
+       int kev = kevent_qos(-1, events, 1, events, 1, NULL, NULL,
+                       KEVENT_FLAG_WORKQ | KEVENT_FLAG_ERROR_EVENTS);
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(kev, "reenable workq in kevent_qos");
+}
+
+static void
+workqueue_write_fn(void ** __unused buf, int * __unused count)
+{
+       // T_MAYFAIL;
+       // T_QUIET; T_ASSERT_EFFECTIVE_QOS_EQ(EXPECTED_QOS,
+                       // "writer thread should be woken up at correct QoS");
+       if (!handle_writing(shared.fd_pair, shared.wr_fd)) {
+               /* finished handling the fd, tear down the source */
+               dispatch_semaphore_signal(shared.wr_finished);
+               return;
+       }
+
+       reenable_workq(shared.wr_fd, EVFILT_WRITE);
+}
+
+static void
+workqueue_fn(pthread_priority_t __unused priority)
+{
+       T_ASSERT_FAIL("workqueue function callback was called");
+}
+
+static void
+drive_kq(bool reading, union mode mode, enum fd_pair fd_pair, int fd)
+{
+       struct timespec timeout = { .tv_sec = READ_TIMEOUT_SECS };
+       int kev = -1;
+
+       struct kevent events;
+       EV_SET(&events, fd, reading ? EVFILT_READ : EVFILT_WRITE, EV_ADD,
+                       NOTE_LOWAT, 1, NULL);
+       struct kevent64_s events64;
+       EV_SET64(&events64, fd, reading ? EVFILT_READ : EVFILT_WRITE, EV_ADD,
+                       NOTE_LOWAT, 1, 0, 0, 0);
+       struct kevent_qos_s events_qos[] = {{
+               .ident = (uint64_t)fd,
+               .filter = reading ? EVFILT_READ : EVFILT_WRITE,
+               .flags = EV_ADD,
+               .fflags = NOTE_LOWAT,
+               .data = 1
+       }, {
+               .ident = 0,
+               .filter = EVFILT_TIMER,
+               .flags = EV_ADD,
+               .fflags = NOTE_SECONDS,
+               .data = READ_TIMEOUT_SECS
+       }};
+
+       /* determine which variant of kevent to use */
+       enum read_mode which_kevent;
+       if (reading) {
+               which_kevent = mode.rd;
+       } else {
+               if (mode.wr == KEVENT_INCREMENTAL_WRITE) {
+                       which_kevent = KEVENT_READ;
+               } else if (mode.wr == KEVENT64_INCREMENTAL_WRITE) {
+                       which_kevent = KEVENT64_READ;
+               } else if (mode.wr == KEVENT_QOS_INCREMENTAL_WRITE) {
+                       which_kevent = KEVENT_QOS_READ;
+               } else {
+                       T_ASSERT_FAIL("unexpected mode: %d", mode.wr);
+                       __builtin_unreachable();
+               }
+       }
+
+       int kq_fd = kqueue();
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(kq_fd, "kqueue");
+
+       switch (which_kevent) {
+       case KEVENT_READ:
+               kev = kevent(kq_fd, &events, 1, NULL, 0, NULL);
+               break;
+       case KEVENT64_READ:
+               kev = kevent64(kq_fd, &events64, 1, NULL, 0, 0, NULL);
+               break;
+       case KEVENT_QOS_READ:
+               kev = kevent_qos(kq_fd, events_qos, 2, NULL, 0, NULL, NULL, 0);
+               break;
+       case POLL_READ: /* FALLTHROUGH */
+       case SELECT_READ: /* FALLTHROUGH */
+       case DISPATCH_READ: /* FALLTHROUGH */
+       case WORKQ_READ: /* FALLTHROUGH */
+       default:
+               T_ASSERT_FAIL("unexpected mode: %d", reading ? mode.rd : mode.wr);
+               break;
+       }
+
+       if (reading) {
+               wake_writer();
+       } else {
+               writer_wait();
+       }
+
+       for (;;) {
+               switch (which_kevent) {
+               case KEVENT_READ:
+                       kev = kevent(kq_fd, NULL, 0, &events, 1, &timeout);
+                       break;
+               case KEVENT64_READ:
+                       kev = kevent64(kq_fd, NULL, 0, &events64, 1, 0, &timeout);
+                       break;
+               case KEVENT_QOS_READ:
+                       kev = kevent_qos(kq_fd, NULL, 0, events_qos, 2, NULL, NULL, 0);
+
+                       /* check for a timeout */
+                       for (int i = 0; i < kev; i++) {
+                               if (events_qos[i].filter == EVFILT_TIMER) {
+                                       kev = 0;
+                               }
+                       }
+                       break;
+               case POLL_READ: /* FALLTHROUGH */
+               case SELECT_READ: /* FALLTHROUGH */
+               case DISPATCH_READ: /* FALLTHROUGH */
+               case WORKQ_READ: /* FALLTHROUGH */
+               default:
+                       T_ASSERT_FAIL("unexpected mode: %d", reading ? mode.rd : mode.wr);
+                       break;
+               }
+
+               if (kev == -1 && errno == EINTR) {
+                       T_LOG("kevent was interrupted");
+                       continue;
+               }
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(kev, "kevent");
+               /* <rdar://problem/28747760> */
+               if (shared.fd_pair == PTY_PAIR) {
+                       T_MAYFAIL;
+               }
+               T_QUIET; T_ASSERT_NE(kev, 0, "kevent timed out");
+
+               if (reading) {
+                       if (!handle_reading(fd_pair, fd)) {
+                               break;
+                       }
+               } else {
+                       if (!handle_writing(fd_pair, fd)) {
+                               break;
+                       }
+               }
+       }
+
+       close(kq_fd);
+}
+
+static void *
+write_to_fd(void * __unused ctx)
+{
+       ssize_t bytes_wr = 0;
+
+       writer_wait();
+
+       switch (shared.wr_mode) {
+       case FULL_WRITE:
+               do {
+                       if (bytes_wr == -1) {
+                               T_LOG("write from child was interrupted");
+                       }
+                       bytes_wr = write(shared.wr_fd, EXPECTED_STRING,
+                                       EXPECTED_LEN);
+               } while (bytes_wr == -1 && errno == EINTR);
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(bytes_wr, "write");
+               T_QUIET; T_ASSERT_EQ(bytes_wr, (ssize_t)EXPECTED_LEN,
+                               "wrote enough bytes");
+               break;
+
+       case INCREMENTAL_WRITE:
+               for (unsigned int i = 0; i < EXPECTED_LEN ; i++) {
+                       T_QUIET;
+                       T_ASSERT_POSIX_SUCCESS(write(shared.wr_fd,
+                                       &(EXPECTED_STRING[i]), 1), NULL);
+                       usleep(INCREMENTAL_WRITE_SLEEP_USECS);
+               }
+               break;
+
+       case KEVENT_INCREMENTAL_WRITE: /* FALLTHROUGH */
+       case KEVENT64_INCREMENTAL_WRITE: /* FALLTHROUGH */
+       case KEVENT_QOS_INCREMENTAL_WRITE: {
+               union mode mode = { .wr = shared.wr_mode };
+               drive_kq(false, mode, shared.fd_pair, shared.wr_fd);
+               break;
+       }
+
+       case WORKQ_INCREMENTAL_WRITE: {
+               int changes = 1;
+
+               shared.wr_finished = dispatch_semaphore_create(0);
+               T_QUIET; T_ASSERT_NOTNULL(shared.wr_finished,
+                               "dispatch_semaphore_create");
+
+               T_QUIET; T_ASSERT_POSIX_ZERO(_pthread_workqueue_init_with_kevent(
+                               workqueue_fn, workqueue_write_fn, 0, 0), NULL);
+
+               struct kevent_qos_s events[] = {{
+                       .ident = (uint64_t)shared.wr_fd,
+                       .filter = EVFILT_WRITE,
+                       .flags = EV_ADD | EV_UDATA_SPECIFIC | EV_DISPATCH | EV_VANISHED,
+                       .fflags = NOTE_LOWAT,
+                       .data = 1,
+                       .qos = (int32_t)_pthread_qos_class_encode(EXPECTED_QOS,
+                                       0, 0)
+               }};
+
+               for (;;) {
+                       int kev = kevent_qos(-1, changes == 0 ? NULL : events, changes,
+                                       events, 1, NULL, NULL,
+                                       KEVENT_FLAG_WORKQ | KEVENT_FLAG_ERROR_EVENTS);
+                       if (kev == -1 && errno == EINTR) {
+                               changes = 0;
+                               T_LOG("kevent_qos was interrupted");
+                               continue;
+                       }
+
+                       T_QUIET; T_ASSERT_POSIX_SUCCESS(kev, "kevent_qos");
+                       break;
+               }
+               break;
+       }
+
+       case DISPATCH_INCREMENTAL_WRITE: {
+               dispatch_source_t write_src;
+
+               shared.wr_finished = dispatch_semaphore_create(0);
+               T_QUIET; T_ASSERT_NOTNULL(shared.wr_finished,
+                               "dispatch_semaphore_create");
+
+               write_src = dispatch_source_create(DISPATCH_SOURCE_TYPE_WRITE,
+                               (uintptr_t)shared.wr_fd, 0, NULL);
+               T_QUIET; T_ASSERT_NOTNULL(write_src,
+                               "dispatch_source_create(DISPATCH_SOURCE_TYPE_WRITE ...)");
+
+               dispatch_block_t handler = dispatch_block_create_with_qos_class(
+                               DISPATCH_BLOCK_ENFORCE_QOS_CLASS, EXPECTED_QOS, 0, ^{
+                       // T_MAYFAIL;
+                       // T_QUIET; T_ASSERT_EFFECTIVE_QOS_EQ(EXPECTED_QOS,
+                                       // "write handler block should run at correct QoS");
+                       if (!handle_writing(shared.fd_pair, shared.wr_fd)) {
+                               /* finished handling the fd, tear down the source */
+                               dispatch_source_cancel(write_src);
+                               dispatch_release(write_src);
+                               dispatch_semaphore_signal(shared.wr_finished);
+                       }
+               });
+
+               dispatch_source_set_event_handler(write_src, handler);
+               dispatch_activate(write_src);
+
+               break;
+       }
+
+       default:
+               T_ASSERT_FAIL("unrecognized write mode: %d", shared.wr_mode);
+               break;
+       }
+
+       if (shared.wr_finished) {
+               long sem_timed_out = dispatch_semaphore_wait(shared.wr_finished,
+                               dispatch_time(DISPATCH_TIME_NOW,
+                               WRITE_TIMEOUT_SECS * NSEC_PER_SEC));
+               dispatch_release(shared.wr_finished);
+               /* <rdar://problem/28747760> */
+               if (shared.fd_pair == PTY_PAIR) {
+                       T_MAYFAIL;
+               }
+               T_QUIET; T_ASSERT_EQ(sem_timed_out, 0L,
+                               "write side semaphore timed out after %d seconds",
+                               WRITE_TIMEOUT_SECS);
+       }
+
+       T_LOG("writer finished, closing fd");
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(close(shared.wr_fd), NULL);
+       return NULL;
+}
+
+#pragma mark reading
+
+#define BUF_LEN 1024
+static char final_string[BUF_LEN];
+static size_t final_length;
+
+/*
+ * Read from the master PTY descriptor.
+ *
+ * Returns false if EOF is encountered, and true otherwise.
+ */
+static bool
+handle_reading(enum fd_pair fd_pair, int fd)
+{
+       char read_buf[BUF_LEN] = { 0 };
+       ssize_t bytes_rd = 0;
+
+       do {
+               if (bytes_rd == -1) {
+                       T_LOG("read was interrupted, retrying");
+               }
+               bytes_rd = read(fd, read_buf, sizeof(read_buf) - 1);
+       } while (bytes_rd == -1 && errno == EINTR);
+
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(bytes_rd, "reading from file");
+       T_QUIET; T_ASSERT_LE(bytes_rd, (ssize_t)EXPECTED_LEN,
+                       "read too much from file");
+
+       if (bytes_rd == 0) {
+               T_LOG("read EOF from file");
+               return false;
+       }
+
+       read_buf[bytes_rd] = '\0';
+       strlcpy(&(final_string[final_length]), read_buf,
+                       sizeof(final_string) - final_length);
+       final_length += (size_t)bytes_rd;
+
+       // T_LOG("read %zd bytes: '%s'", bytes_rd, read_buf);
+
+       T_QUIET; T_ASSERT_LE(final_length, EXPECTED_LEN,
+                       "should not read more from file than what can be sent");
+
+       /* FIFOs don't (and TTYs may not) send EOF when the write side closes */
+       if (final_length == strlen(EXPECTED_STRING) &&
+                       (fd_pair == FIFO_PAIR || fd_pair == PTY_PAIR))
+       {
+               T_LOG("read all expected bytes from %s",
+                               fd_pair == FIFO_PAIR ? "FIFO" : "PTY");
+               return false;
+       }
+       return true;
+}
+
+static void
+workqueue_read_fn(void ** __unused buf, int * __unused count)
+{
+       // T_MAYFAIL;
+       // T_QUIET; T_ASSERT_EFFECTIVE_QOS_EQ(EXPECTED_QOS,
+                       // "reader thread should be requested at correct QoS");
+       if (!handle_reading(shared.fd_pair, shared.rd_fd)) {
+               dispatch_semaphore_signal(shared.rd_finished);
+       }
+
+       reenable_workq(shared.rd_fd, EVFILT_READ);
+}
+
+static void
+read_from_fd(int fd, enum fd_pair fd_pair, enum read_mode mode)
+{
+       int fd_flags;
+
+       T_LOG("reader setting up");
+
+       bzero(final_string, sizeof(final_string));
+
+       fd_flags = fcntl(fd, F_GETFL, 0);
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(fd_flags, "fcntl(F_GETFL)");
+
+       if (!(fd_flags & O_NONBLOCK)) {
+               T_QUIET;
+               T_ASSERT_POSIX_SUCCESS(fcntl(fd, F_SETFL,
+                       fd_flags | O_NONBLOCK), NULL);
+       }
+
+       switch (mode) {
+       case POLL_READ: {
+               struct pollfd fds[] = { { .fd = fd, .events = POLLIN } };
+               wake_writer();
+               for (;;) {
+                       fds[0].revents = 0;
+                       int pol = poll(fds, 1, READ_TIMEOUT_SECS * 1000);
+                       T_QUIET; T_ASSERT_POSIX_SUCCESS(pol, "poll");
+                       /* <rdar://problem/28747760> */
+                       if (shared.fd_pair == PTY_PAIR) {
+                               T_MAYFAIL;
+                       }
+                       T_QUIET; T_ASSERT_NE(pol, 0,
+                                       "poll should not time out after %d seconds, read %zd out "
+                                       "of %zu bytes",
+                                       READ_TIMEOUT_SECS, final_length, strlen(EXPECTED_STRING));
+                       T_QUIET; T_ASSERT_FALSE(fds[0].revents & POLLERR,
+                                       "should not see an error on the device");
+
+                       if (!handle_reading(fd_pair, fd)) {
+                               break;
+                       }
+               }
+               break;
+       }
+
+       case SELECT_READ:
+               wake_writer();
+
+               for (;;) {
+                       struct timeval tv = { .tv_sec = READ_TIMEOUT_SECS };
+
+                       fd_set read_fd;
+                       FD_ZERO(&read_fd);
+                       FD_SET(fd, &read_fd);
+                       fd_set err_fd;
+                       FD_ZERO(&err_fd);
+                       FD_SET(fd, &err_fd);
+
+                       int sel = select(fd + 1, &read_fd, NULL, NULL/*&err_fd*/, &tv);
+                       if (sel == -1 && errno == EINTR) {
+                               T_LOG("select interrupted");
+                               continue;
+                       }
+                       (void)fd_pair;
+
+                       T_QUIET; T_ASSERT_POSIX_SUCCESS(sel, "select");
+
+                       /* <rdar://problem/28747760> */
+                       if (shared.fd_pair == PTY_PAIR) {
+                               T_MAYFAIL;
+                       }
+                       T_QUIET; T_ASSERT_NE(sel, 0,
+                               "select waited for %d seconds and timed out",
+                               READ_TIMEOUT_SECS);
+
+                       if (fd_pair == PTY_PAIR) {
+                               /*
+                                * XXX sometimes a PTY doesn't send EOF when the writer closes
+                                */
+                               T_MAYFAIL;
+                       }
+                       /* didn't fail or time out, therefore data is ready */
+                       T_QUIET; T_ASSERT_NE(FD_ISSET(fd, &read_fd), 0,
+                                       "select should show reading fd as readable");
+
+                       if (!handle_reading(fd_pair, fd)) {
+                               break;
+                       }
+               }
+               break;
+
+       case KEVENT_READ: /* FALLTHROUGH */
+       case KEVENT64_READ: /* FALLTHROUGH */
+       case KEVENT_QOS_READ: {
+               union mode rd_mode = { .rd = shared.rd_mode };
+               drive_kq(true, rd_mode, fd_pair, shared.rd_fd);
+               break;
+       }
+
+       case WORKQ_READ: {
+               T_QUIET; T_ASSERT_POSIX_ZERO(_pthread_workqueue_init_with_kevent(
+                               workqueue_fn, workqueue_read_fn, 0, 0), NULL);
+
+               shared.rd_finished = dispatch_semaphore_create(0);
+               T_QUIET; T_ASSERT_NOTNULL(shared.rd_finished,
+                               "dispatch_semaphore_create");
+
+               int changes = 1;
+               struct kevent_qos_s events[] = {{
+                       .ident = (uint64_t)shared.rd_fd,
+                       .filter = EVFILT_READ,
+                       .flags = EV_ADD | EV_UDATA_SPECIFIC | EV_DISPATCH | EV_VANISHED,
+                       .fflags = NOTE_LOWAT,
+                       .data = 1,
+                       .qos = (int32_t)_pthread_qos_class_encode(EXPECTED_QOS,
+                                       0, 0)
+               }};
+
+               for (;;) {
+                       int kev = kevent_qos(-1, changes == 0 ? NULL : events, changes,
+                                       events, 1, NULL, NULL,
+                                       KEVENT_FLAG_WORKQ | KEVENT_FLAG_ERROR_EVENTS);
+                       if (kev == -1 && errno == EINTR) {
+                               changes = 0;
+                               T_LOG("kevent_qos was interrupted");
+                               continue;
+                       }
+
+                       T_QUIET; T_ASSERT_POSIX_SUCCESS(kev, "kevent_qos");
+                       break;
+               }
+
+               wake_writer();
+               break;
+       }
+
+       case DISPATCH_READ: {
+               dispatch_source_t read_src;
+
+               shared.rd_finished = dispatch_semaphore_create(0);
+               T_QUIET; T_ASSERT_NOTNULL(shared.rd_finished,
+                               "dispatch_semaphore_create");
+
+               read_src = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ,
+                               (uintptr_t)fd, 0, NULL);
+               T_QUIET; T_ASSERT_NOTNULL(read_src,
+                               "dispatch_source_create(DISPATCH_SOURCE_TYPE_READ)");
+
+               dispatch_block_t handler = dispatch_block_create_with_qos_class(
+                               DISPATCH_BLOCK_ENFORCE_QOS_CLASS, EXPECTED_QOS, 0, ^{
+                       // T_MAYFAIL;
+                       // T_QUIET; T_ASSERT_EFFECTIVE_QOS_EQ(EXPECTED_QOS,
+                                       // "read handler block should run at correct QoS");
+
+                       if (!handle_reading(fd_pair, fd)) {
+                               /* finished handling the fd, tear down the source */
+                               dispatch_source_cancel(read_src);
+                               dispatch_release(read_src);
+                               dispatch_semaphore_signal(shared.rd_finished);
+                       }
+               });
+
+               dispatch_source_set_event_handler(read_src, handler);
+               dispatch_activate(read_src);
+
+               wake_writer();
+               break;
+       }
+
+       default:
+               T_ASSERT_FAIL("unrecognized read mode: %d", mode);
+               break;
+       }
+
+       if (shared.rd_finished) {
+               long timed_out = dispatch_semaphore_wait(shared.rd_finished,
+                               dispatch_time(DISPATCH_TIME_NOW,
+                               READ_TIMEOUT_SECS * NSEC_PER_SEC));
+               /* <rdar://problem/28747760> */
+               if (shared.fd_pair == PTY_PAIR) {
+                       T_MAYFAIL;
+               }
+               T_QUIET; T_ASSERT_EQ(timed_out, 0L,
+                               "reading timed out after %d seconds", READ_TIMEOUT_SECS);
+
+       }
+
+       T_EXPECT_EQ_STR(final_string, EXPECTED_STRING,
+                       "reader should receive valid string");
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(close(fd), NULL);
+}
+
+#pragma mark file setup
+
+static void
+fd_pair_init(enum fd_pair fd_pair, int *rd_fd, int *wr_fd)
+{
+       switch (fd_pair) {
+       case PTY_PAIR:
+               T_ASSERT_POSIX_SUCCESS(openpty(rd_fd, wr_fd, NULL, NULL, NULL),
+                               NULL);
+               break;
+
+       case FIFO_PAIR: {
+               char fifo_path[] = "/tmp/async-io-fifo.XXXXXX";
+               T_QUIET; T_ASSERT_NOTNULL(mktemp(fifo_path), NULL);
+
+               T_ASSERT_POSIX_SUCCESS(mkfifo(fifo_path, 0700), "mkfifo(%s, 0700)",
+                               fifo_path);
+               /*
+                * Opening the read side of a pipe will block until the write
+                * side opens -- use O_NONBLOCK.
+                */
+               *rd_fd = open(fifo_path, O_RDONLY | O_NONBLOCK);
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(*rd_fd, "open(... O_RDONLY)");
+               *wr_fd = open(fifo_path, O_WRONLY | O_NONBLOCK);
+               T_QUIET; T_ASSERT_POSIX_SUCCESS(*wr_fd, "open(... O_WRONLY)");
+               break;
+       }
+
+       case PIPE_PAIR: {
+               int pipe_fds[2];
+               T_ASSERT_POSIX_SUCCESS(pipe(pipe_fds), NULL);
+               *rd_fd = pipe_fds[0];
+               *wr_fd = pipe_fds[1];
+               break;
+       }
+
+       case SOCKET_PAIR: {
+               int sock_fds[2];
+               T_ASSERT_POSIX_SUCCESS(socketpair(AF_UNIX, SOCK_STREAM, 0, sock_fds),
+                               NULL);
+               *rd_fd = sock_fds[0];
+               *wr_fd = sock_fds[1];
+               break;
+       }
+
+       default:
+               T_ASSERT_FAIL("unknown descriptor pair type: %d", fd_pair);
+               break;
+       }
+
+       T_QUIET; T_ASSERT_NE(*rd_fd, -1, "reading descriptor");
+       T_QUIET; T_ASSERT_NE(*wr_fd, -1, "writing descriptor");
+}
+
+#pragma mark single process
+
+static void
+drive_threads(enum fd_pair fd_pair, enum read_mode rd_mode,
+               enum write_mode wr_mode)
+{
+       pthread_t thread;
+
+       shared.fd_pair = fd_pair;
+       shared.rd_mode = rd_mode;
+       shared.wr_mode = wr_mode;
+       fd_pair_init(fd_pair, &(shared.rd_fd), &(shared.wr_fd));
+
+       shared.wr_kind = THREAD_WRITER;
+       shared.wr_wait.sem = dispatch_semaphore_create(0);
+
+       T_QUIET;
+       T_ASSERT_POSIX_ZERO(pthread_create(&thread, NULL, write_to_fd, NULL),
+                       NULL);
+       T_LOG("created writer thread");
+
+       read_from_fd(shared.rd_fd, fd_pair, rd_mode);
+       T_END;
+}
+
+#pragma mark multiple processes
+
+static void __attribute__((noreturn))
+drive_processes(enum fd_pair fd_pair, enum read_mode rd_mode, enum write_mode wr_mode)
+{
+       shared.fd_pair = fd_pair;
+       shared.rd_mode = rd_mode;
+       shared.wr_mode = wr_mode;
+       fd_pair_init(fd_pair, &(shared.rd_fd), &(shared.wr_fd));
+
+       shared.wr_kind = PROCESS_WRITER;
+       int fds[2];
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(pipe(fds), NULL);
+       shared.wr_wait.out_fd = fds[0];
+       shared.wr_wait.in_fd = fds[1];
+
+       T_LOG("starting subprocesses");
+       dt_helper_t helpers[2] = {
+               dt_fork_helper("reader_helper"),
+               dt_fork_helper("writer_helper")
+       };
+
+       close(shared.rd_fd);
+       close(shared.wr_fd);
+
+       dt_run_helpers(helpers, 2, 50000);
+}
+
+T_HELPER_DECL(reader_helper, "Read asynchronously")
+{
+       close(shared.wr_fd);
+       read_from_fd(shared.rd_fd, shared.fd_pair, shared.rd_mode);
+       T_END;
+}
+
+T_HELPER_DECL(writer_helper, "Write asynchronously")
+{
+       close(shared.rd_fd);
+       write_to_fd(NULL);
+}
+
+#pragma mark tests
+
+#define WR_DECL_PROCESSES(desc_name, fd_pair, write_name, write_str, \
+                               write_mode, read_name, read_mode) \
+               T_DECL(processes_##desc_name##_##read_name##_##write_name, "read changes to a " \
+                               #desc_name " with " #read_name " and writing " #write_str \
+                               " across two processes") \
+               { \
+                       drive_processes(fd_pair, read_mode, write_mode); \
+               }
+#define WR_DECL_THREADS(desc_name, fd_pair, write_name, write_str, \
+                               write_mode, read_name, read_mode) \
+               T_DECL(threads_##desc_name##_##read_name##_##write_name, "read changes to a " \
+                               #desc_name " with " #read_name " and writing " #write_str) \
+               { \
+                       drive_threads(fd_pair, read_mode, write_mode); \
+               }
+
+#define WR_DECL(desc_name, fd_pair, write_name, write_str, write_mode, \
+               read_name, read_mode) \
+               WR_DECL_PROCESSES(desc_name, fd_pair, write_name, write_str, \
+                               write_mode, read_name, read_mode) \
+               WR_DECL_THREADS(desc_name, fd_pair, write_name, write_str, \
+                               write_mode, read_name, read_mode)
+
+#define RD_DECL_SAFE(desc_name, fd_pair, read_name, read_mode) \
+               WR_DECL(desc_name, fd_pair, full, "the full string", FULL_WRITE, \
+                               read_name, read_mode) \
+               WR_DECL(desc_name, fd_pair, incremental, "incrementally", \
+                               INCREMENTAL_WRITE, read_name, read_mode)
+
+#define RD_DECL_DISPATCH_ONLY(suffix, desc_name, fd_pair, read_name, \
+                               read_mode) \
+               WR_DECL##suffix(desc_name, fd_pair, incremental_dispatch, \
+                               "incrementally with a dispatch source", \
+                               DISPATCH_INCREMENTAL_WRITE, read_name, read_mode)
+#define RD_DECL_WORKQ_ONLY(suffix, desc_name, fd_pair, read_name, \
+                               read_mode) \
+               WR_DECL##suffix(desc_name, fd_pair, incremental_workq, \
+                               "incrementally with the workqueue", \
+                               WORKQ_INCREMENTAL_WRITE, read_name, read_mode)
+
+#define RD_DECL(desc_name, fd_pair, read_name, read_mode) \
+               RD_DECL_SAFE(desc_name, fd_pair, read_name, read_mode) \
+               RD_DECL_DISPATCH_ONLY(, desc_name, fd_pair, read_name, read_mode)
+               // RD_DECL_WORKQ_ONLY(, desc_name, fd_pair, read_name, read_mode)
+
+/*
+ * dispatch_source tests cannot share the same process as other workqueue
+ * tests.
+ */
+#define RD_DECL_DISPATCH(desc_name, fd_pair, read_name, read_mode) \
+               RD_DECL_SAFE(desc_name, fd_pair, read_name, read_mode) \
+               RD_DECL_DISPATCH_ONLY(, desc_name, fd_pair, read_name, read_mode) \
+               RD_DECL_WORKQ_ONLY(_PROCESSES, desc_name, fd_pair, read_name, \
+                               read_mode)
+
+/*
+ * Workqueue tests cannot share the same process as other workqueue or
+ * dispatch_source tests.
+#define RD_DECL_WORKQ(desc_name, fd_pair, read_name, read_mode) \
+               RD_DECL_SAFE(desc_name, fd_pair, read_name, read_mode) \
+               RD_DECL_DISPATCH_ONLY(_PROCESSES, desc_name, fd_pair, read_name, \
+                               read_mode) \
+               RD_DECL_WORKQ_ONLY(_PROCESSES, desc_name, fd_pair, read_name, \
+                               read_mode)
+ */
+
+#define PAIR_DECL(desc_name, fd_pair) \
+       RD_DECL(desc_name, fd_pair, poll, POLL_READ) \
+       RD_DECL(desc_name, fd_pair, select, SELECT_READ) \
+       RD_DECL(desc_name, fd_pair, kevent, KEVENT_READ) \
+       RD_DECL(desc_name, fd_pair, kevent64, KEVENT64_READ) \
+       RD_DECL(desc_name, fd_pair, kevent_qos, KEVENT_QOS_READ) \
+       RD_DECL_DISPATCH(desc_name, fd_pair, dispatch_source, DISPATCH_READ)
+       // RD_DECL_WORKQ(desc_name, fd_pair, workq, WORKQ_READ)
+
+PAIR_DECL(tty, PTY_PAIR)
+PAIR_DECL(pipe, PIPE_PAIR)
+PAIR_DECL(fifo, FIFO_PAIR)
+PAIR_DECL(socket, SOCKET_PAIR)
index 3bcc8d810ab4a48dd72d7063650731083b6627de..aad5ee62d95e11e6b69b6fb2bfd48b7a5d53fabe 100644 (file)
@@ -50,10 +50,9 @@ static int fork_and_wait_for_segfault() {
 #endif
 
 T_DECL(
-    proc_core_name_24152432, 
-    "Tests behavior of core dump when kern.corefile ends in %, e.g., /cores/core.%", 
-    T_META("owner", "Core Kernel Team"),
-    T_META_ASROOT(YES))
+    proc_core_name_24152432,
+    "Tests behavior of core dump when kern.corefile ends in %, e.g., /cores/core.%",
+    T_META_ASROOT(true))
 {
 #if TARGET_OS_OSX
        int ret, pid;
index 9bc57437d0008c8f96252c631650794063d310d9..470d5ca4ede4c45f13869a2bcae4182f6cd04623 100644 (file)
@@ -5,19 +5,19 @@
 
 #define NUM_PROC_UUID_POLICY_FLAGS 4
 
-T_DECL(proc_uuid_policy_26567533, "Tests passing a NULL uuid in (uap->uuid).", T_META("owner", "Core Kernel Team"))
+T_DECL(proc_uuid_policy_26567533, "Tests passing a NULL uuid in (uap->uuid).", T_META_LTEPHASE(LTE_POSTINIT))
 {
        int i, ret;
        uuid_t null_uuid;
        memset(null_uuid, 0, sizeof(uuid_t));
 
-       uint32_t policy_flags[] = { 
-               PROC_UUID_POLICY_FLAGS_NONE, 
-               PROC_UUID_NO_CELLULAR, 
-               PROC_UUID_NECP_APP_POLICY, 
-               PROC_UUID_ALT_DYLD_POLICY 
+       uint32_t policy_flags[] = {
+               PROC_UUID_POLICY_FLAGS_NONE,
+               PROC_UUID_NO_CELLULAR,
+               PROC_UUID_NECP_APP_POLICY,
+               PROC_UUID_ALT_DYLD_POLICY
        };
-       
+
        for (i = 0; i < NUM_PROC_UUID_POLICY_FLAGS; i++) {
                T_LOG("Testing policy add with flag value 0x%x", policy_flags[i]);
 
@@ -39,5 +39,4 @@ T_DECL(proc_uuid_policy_26567533, "Tests passing a NULL uuid in (uap->uuid).", T
                T_WITH_ERRNO;
                T_ASSERT_TRUE(errno = EINVAL, "errno is %d", errno);
        }
-       T_PASS("proc_uuid_policy_26567533 PASSED");
 }
diff --git a/tools/tests/darwintests/pwrite_avoid_sigxfsz_28581610.c b/tools/tests/darwintests/pwrite_avoid_sigxfsz_28581610.c
new file mode 100644 (file)
index 0000000..9c39e55
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * testname: pwrite_avoid_sigxfsz_28581610
+ */
+
+#include <darwintest.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <sys/resource.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#define TMP_FILE_PATH "/tmp/test_pwrite"
+
+static sigjmp_buf xfsz_jmpbuf;
+
+void xfsz_signal(int);
+
+void
+xfsz_signal(__unused int signo)
+{
+       siglongjmp(xfsz_jmpbuf, 1);
+}
+
+T_DECL(pwrite, "Tests avoiding SIGXFSZ with pwrite and odd offsets",
+               T_META_ASROOT(true))
+{
+       int fd, x;
+       off_t ret;
+       struct stat f_stat;
+       struct rlimit crl;
+       static const int offs[] = { -1, -1 * 1024, -1 * 1024 * 16, -1 * 1024 * 1024 * 16, 0 };
+       static unsigned char buffer[1048576];
+
+       T_SETUPBEGIN;
+       /* We expect zero SIGXFSZ signals because we have no file size limits */
+       crl.rlim_cur = crl.rlim_max = RLIM_INFINITY;
+       ret = setrlimit(RLIMIT_FSIZE, &crl);
+       T_ASSERT_POSIX_SUCCESS(ret, "setting infinite file size limit");
+
+       /* we just needed root to setup unlimited file size */
+       remove(TMP_FILE_PATH);
+       setuid(5000);
+
+       /* We just want an empty regular file to test with */
+       fd = open(TMP_FILE_PATH, O_RDWR | O_CREAT | O_EXCL, 0777);
+       T_ASSERT_POSIX_SUCCESS(fd, "opening fd on temp file %s.", TMP_FILE_PATH);
+
+       /* sanity check that this new file is really zero bytes in size */
+       ret = fstat(fd, &f_stat);
+       T_ASSERT_POSIX_SUCCESS(ret, "stat() fd on temp file.");
+       T_ASSERT_TRUE(0 == f_stat.st_size, "ensure %s is empty", TMP_FILE_PATH);
+
+       /* sanity check that ftruncate() considers negative offsets an error */
+       for (x = 0; offs[x] != 0; x++) {
+               ret = ftruncate(fd, offs[x]);
+               T_ASSERT_TRUE(((ret == -1) && (errno == EINVAL)),
+                               "negative offset %d", offs[x]);
+       }
+
+       T_SETUPEND;
+
+       /* we want to get the EFBIG errno but without a SIGXFSZ signal */
+    T_EXPECTFAIL;
+       if (!sigsetjmp(xfsz_jmpbuf, 1)) {
+               signal(SIGXFSZ, xfsz_signal);
+               ret = pwrite(fd, buffer, sizeof buffer, LONG_MAX);
+               T_ASSERT_TRUE(((ret == -1) && (errno == EFBIG)),
+                               "large offset %d", 13);
+       } else {
+               signal(SIGXFSZ, SIG_DFL);
+               T_FAIL("%s unexpected SIGXFSZ with offset %lX",
+                "<rdar://problem/28581610>", LONG_MAX);
+       }
+
+       /* Negative offsets are invalid, no SIGXFSZ signals required */
+       for (x = 0; offs[x] != 0; x++) {
+        /* only -1 gives the correct result */
+        if (-1 != offs[x]) {
+            T_EXPECTFAIL;
+        }
+
+               if (!sigsetjmp(xfsz_jmpbuf, 1)) {
+                       signal(SIGXFSZ, xfsz_signal);
+                       ret = pwrite(fd, buffer, sizeof buffer, offs[x]);
+                       T_ASSERT_TRUE(((ret == -1) && (errno == EINVAL)),
+                                       "negative offset %d", offs[x]);
+               } else {
+                       signal(SIGXFSZ, SIG_DFL);
+                       T_FAIL("%s unexpected SIGXFSZ with negative offset %d",
+                   "<rdar://problem/28581610>", offs[x]);
+               }
+       }
+
+       remove(TMP_FILE_PATH);
+}
diff --git a/tools/tests/darwintests/regression_17272465.c b/tools/tests/darwintests/regression_17272465.c
new file mode 100644 (file)
index 0000000..ed2dc10
--- /dev/null
@@ -0,0 +1,25 @@
+#include <darwintest.h>
+#include <stdio.h>
+#include <mach/mach.h>
+#include <mach/host_priv.h>
+
+
+T_DECL(regression_17272465,
+       "Test for host_set_special_port Mach port over-release, rdr: 17272465", T_META_CHECK_LEAKS(false))
+{
+       kern_return_t kr;
+       mach_port_t port = MACH_PORT_NULL;
+
+       T_SETUPBEGIN;
+       T_QUIET;
+       T_ASSERT_MACH_SUCCESS(mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port), NULL);
+       T_QUIET;
+       T_ASSERT_MACH_SUCCESS(mach_port_insert_right(mach_task_self(), port, port, MACH_MSG_TYPE_MAKE_SEND), NULL);
+       T_SETUPEND;
+
+       (void)host_set_special_port(mach_host_self(), 30, port);
+       (void)host_set_special_port(mach_host_self(), 30, port);
+       (void)host_set_special_port(mach_host_self(), 30, port);
+
+       T_PASS("No panic occurred");
+}
index ef6ddd24cdd96caacdd1010c6a02ff0cbb0c1d7f..b39b936ea7f20a779d465905c6813f47c47360de 100644 (file)
@@ -3,7 +3,7 @@
 #include <sys/socket.h>
 #include <unistd.h>
 
-T_DECL(socket_poll_close_25786011, "Tests an invalid poll call to a socket and then calling close.", T_META("owner", "Core Kernel Team"))
+T_DECL(socket_poll_close_25786011, "Tests an invalid poll call to a socket and then calling close.", T_META_LTEPHASE(LTE_POSTINIT))
 {
        int my_socket, ret;
 
diff --git a/tools/tests/darwintests/stackshot_block_owner_14362384.m b/tools/tests/darwintests/stackshot_block_owner_14362384.m
new file mode 100644 (file)
index 0000000..a139561
--- /dev/null
@@ -0,0 +1,756 @@
+#ifdef T_NAMESPACE
+#undef T_NAMESPACE
+#endif
+#include <darwintest.h>
+
+#include <kdd.h>
+#include <kern/kcdata.h>
+#include <kern/debug.h>
+#include <kern/block_hint.h>
+#include <mach/mach.h>
+#include <mach/mach_init.h>
+#include <mach/mach_traps.h>
+#include <mach/message.h>
+#include <mach/port.h>
+#include <mach/semaphore.h>
+#include <mach/task.h>
+#include <os/lock.h>
+#include <pthread.h>
+#include <sys/sysctl.h>
+#include <sys/stackshot.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+T_GLOBAL_META(
+        T_META_NAMESPACE("xnu.scheduler"),
+        T_META_ASROOT(true)
+);
+
+#include <Foundation/Foundation.h>
+
+#define SENDS_TO_BLOCK 6
+#define NUMRETRIES 5
+#define KRWLCK_STORES_EXCL_OWNER 0
+
+#define KMUTEX_SYSCTL_CHECK_EXISTS   0
+#define KMUTEX_SYSCTL_ACQUIRE_WAIT   1
+#define KMUTEX_SYSCTL_ACQUIRE_NOWAIT 2
+#define KMUTEX_SYSCTL_SIGNAL         3
+#define KMUTEX_SYSCTL_TEARDOWN       4
+
+#define KRWLCK_SYSCTL_CHECK_EXISTS    0
+#define KRWLCK_SYSCTL_RACQUIRE_NOWAIT 1
+#define KRWLCK_SYSCTL_RACQUIRE_WAIT   2
+#define KRWLCK_SYSCTL_WACQUIRE_NOWAIT 3
+#define KRWLCK_SYSCTL_WACQUIRE_WAIT   4
+#define KRWLCK_SYSCTL_SIGNAL          5
+#define KRWLCK_SYSCTL_TEARDOWN        6
+
+static const char kmutex_ctl[] = "debug.test_MutexOwnerCtl";
+static const char krwlck_ctl[] = "debug.test_RWLockOwnerCtl";
+
+static mach_port_t send = MACH_PORT_NULL;
+static mach_port_t recv = MACH_PORT_NULL;
+
+static void *
+take_stackshot(uint32_t extra_flags, uint64_t since_timestamp)
+{
+       void * stackshot;
+       int ret, retries;
+       uint32_t stackshot_flags = STACKSHOT_SAVE_LOADINFO |
+                                       STACKSHOT_GET_GLOBAL_MEM_STATS |
+                                       STACKSHOT_SAVE_IMP_DONATION_PIDS |
+                                       STACKSHOT_KCDATA_FORMAT;
+
+       if (since_timestamp != 0)
+               stackshot_flags |= STACKSHOT_COLLECT_DELTA_SNAPSHOT;
+
+       stackshot_flags |= extra_flags;
+
+       stackshot = stackshot_config_create();
+       T_QUIET; T_ASSERT_NOTNULL(stackshot, "Allocating stackshot config");
+
+       ret = stackshot_config_set_flags(stackshot, stackshot_flags);
+       T_ASSERT_POSIX_ZERO(ret, "Setting flags on stackshot config");
+
+       ret = stackshot_config_set_pid(stackshot, getpid());
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Setting target pid on stackshot config");
+
+       if (since_timestamp != 0) {
+               ret = stackshot_config_set_delta_timestamp(stackshot, since_timestamp);
+               T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Setting prev snapshot time on stackshot config");
+       }
+
+       for (retries = NUMRETRIES; retries > 0; retries--) {
+               ret = stackshot_capture_with_config(stackshot);
+               T_QUIET; T_ASSERT_TRUE(ret == 0 || ret == EBUSY || ret == ETIMEDOUT,
+                               "Attempting to take stackshot (error %d)...", ret);
+               if (retries == 0 && (ret == EBUSY || ret == ETIMEDOUT))
+                       T_ASSERT_FAIL("Failed to take stackshot after %d retries: got %d (%s)", NUMRETRIES, ret, strerror(ret));
+               if (ret == 0)
+                       break;
+       }
+       return stackshot;
+}
+
+// waitinfo can be NULL, but len must be non-null and point to the length of the waitinfo array.
+// when the function returns, len will be set to the number of waitinfo structs found in the stackshot.
+static void
+find_blocking_info(void * stackshot, struct stackshot_thread_waitinfo *waitinfo, int *len)
+{
+       void *buf;
+       uint32_t t, buflen;
+       NSError *error = nil;
+       NSMutableDictionary *parsed_container;
+       NSArray *parsed_waitinfo;
+
+       T_QUIET; T_ASSERT_NOTNULL(len, "Length pointer shouldn't be NULL");
+       int oldlen = *len;
+       *len = 0;
+
+       buf = stackshot_config_get_stackshot_buffer(stackshot);
+       T_QUIET; T_ASSERT_NOTNULL(buf, "Getting stackshot buffer");
+       buflen = stackshot_config_get_stackshot_size(stackshot);
+
+       kcdata_iter_t iter = kcdata_iter(buf, buflen);
+
+       T_QUIET; T_ASSERT_TRUE(kcdata_iter_type(iter) == KCDATA_BUFFER_BEGIN_STACKSHOT ||
+                       kcdata_iter_type(iter) == KCDATA_BUFFER_BEGIN_DELTA_STACKSHOT,
+                       "Checking start of stackshot buffer");
+
+       iter = kcdata_iter_next(iter);
+       KCDATA_ITER_FOREACH(iter)
+       {
+               t = kcdata_iter_type(iter);
+
+               if (t != KCDATA_TYPE_CONTAINER_BEGIN) {
+                       continue;
+               }
+
+               if (kcdata_iter_container_type(iter) != STACKSHOT_KCCONTAINER_TASK) {
+                       continue;
+               }
+
+               parsed_container = parseKCDataContainer(&iter, &error);
+               T_QUIET; T_ASSERT_TRUE(!error, "Error while parsing container: %d (%s)",
+                               (int)error.code, [error.domain UTF8String]);
+               T_QUIET; T_ASSERT_TRUE(parsed_container && !error, "Parsing container");
+
+               parsed_waitinfo = parsed_container[@"task_snapshots"][@"thread_waitinfo"];
+               for (id elem in parsed_waitinfo) {
+                       /* check to see that tid matches expected idle status */
+                       uint8_t type = [elem[@"wait_type"] unsignedCharValue];
+                       if (type != kThreadWaitNone) {
+                               if (waitinfo && *len < oldlen) {
+                                       struct stackshot_thread_waitinfo *curr = &waitinfo[*len];
+                                       curr->wait_type = type;
+                                       curr->owner     = [elem[@"owner"] unsignedLongLongValue];
+                                       curr->waiter    = [elem[@"waiter"] unsignedLongLongValue];
+                                       curr->context   = [elem[@"context"] unsignedLongLongValue];
+                               }
+                               (*len)++;
+                       }
+               }
+               [parsed_container release];
+       }
+}
+
+/* perform various actions with a mutex in kernel memory. note that, since we aren't allowed
+ * to go to user space while still holding a mutex, the lock-acquiring actions in this kernel
+ * sysctl will either lock and immediately release the lock, or lock and wait until a semaphore
+ * is signalled, then unlock. if called with CHECK_EXISTS, returns whether or not the sysctl
+ * exist in the kernel (to determine if we're running with CONFIG_XNUPOST defined). Else,
+ * returns 1. */
+static int kmutex_action(int action)
+{
+       int ret;
+       if (action == KMUTEX_SYSCTL_CHECK_EXISTS) {
+               ret = sysctlbyname(krwlck_ctl, NULL, NULL, NULL, 0);
+               return !(ret == -1);
+       }
+
+       char * action_name = "";
+       switch(action) {
+               case KMUTEX_SYSCTL_ACQUIRE_WAIT:
+                       action_name = "lock (and wait)";
+                       break;
+               case KMUTEX_SYSCTL_ACQUIRE_NOWAIT:
+                       action_name = "lock";
+                       break;
+               case KMUTEX_SYSCTL_SIGNAL:
+                       action_name = "signal to holder of";
+                       break;
+               case KMUTEX_SYSCTL_TEARDOWN:
+                       action_name = "tear down";
+                       break;
+               default:
+                       T_ASSERT_FAIL("Somebody passed the wrong argument to kmutex_action: %d", action);
+                       break;
+       }
+
+       ret = sysctlbyname(kmutex_ctl, NULL, NULL, &action, sizeof(int));
+       T_ASSERT_POSIX_SUCCESS(ret, "sysctl: %s kernel mutex", action_name);
+       return 1;
+}
+
+static void
+sysctl_kmutex_test_match(uint64_t context)
+{
+       int ret;
+       unsigned long long unslid_kmutex_address;
+       size_t addrsize = sizeof(unslid_kmutex_address);
+
+       ret = sysctlbyname(kmutex_ctl, &unslid_kmutex_address, &addrsize, NULL, 0);
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "Getting unslid location of kernel mutex. Size is %llu",
+                       (unsigned long long)addrsize);
+       T_EXPECT_EQ(context, unslid_kmutex_address,
+                       "Context should match unslid location of mutex in kernel memory");
+}
+
+/* We don't really care what goes into these messages, we're just sending something to a port. */
+static void
+msg_send_helper(mach_port_t remote_port)
+{
+       int ret;
+        mach_msg_header_t * msg = NULL;
+
+        ret = vm_allocate(mach_task_self(),
+                            (vm_address_t *)&msg,
+                            PAGE_SIZE,
+                            VM_MAKE_TAG(VM_MEMORY_MACH_MSG) | TRUE);
+
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Allocating vm page %p", (void*)msg);
+        msg->msgh_bits = MACH_MSGH_BITS_SET(MACH_MSG_TYPE_COPY_SEND, 0, 0, 0);
+       msg->msgh_size = PAGE_SIZE;
+        msg->msgh_remote_port = remote_port;
+        msg->msgh_local_port = MACH_PORT_NULL;
+        msg->msgh_voucher_port = MACH_PORT_NULL;
+        ret = mach_msg(msg,
+                       MACH_SEND_MSG | MACH_MSG_OPTION_NONE,
+                       PAGE_SIZE,
+                        0,
+                        MACH_PORT_NULL,
+                        MACH_MSG_TIMEOUT_NONE,
+                        MACH_PORT_NULL);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Sending message to port %d", remote_port);
+
+        vm_deallocate(mach_task_self(), (vm_address_t)msg, PAGE_SIZE);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Deallocating vm page %p", (void*)msg);
+}
+
+static void
+msg_recv_helper(mach_port_t local_port)
+{
+       int ret;
+       mach_msg_size_t size = 2*PAGE_SIZE;
+       mach_msg_header_t * msg = NULL;
+        ret = vm_allocate(mach_task_self(),
+                          (vm_address_t *)&msg,
+                         size,
+                          VM_MAKE_TAG(VM_MEMORY_MACH_MSG) | TRUE );
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Allocating page %p for message", (void*)msg);
+
+       ret = mach_msg(msg,
+                       MACH_RCV_MSG,
+                       0,
+                       size,
+                       local_port,
+                       MACH_MSG_TIMEOUT_NONE,
+                       MACH_PORT_NULL);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Received message on port %d", local_port);
+        ret = vm_deallocate(mach_task_self(), (vm_address_t)msg, PAGE_SIZE);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Deallocating page %p", (void*)msg);
+}
+
+/* perform various actions with a rwlock in kernel memory. note that, since we aren't allowed
+ * to go to user space while still holding a rwlock, the lock-acquiring actions in this kernel
+ * sysctl will either lock and immediately release the lock, or lock and wait until a semaphore
+ * is signalled, then unlock. if called with CHECK_EXISTS, returns whether or not the sysctl
+ * exist in the kernel (to determine if we're running with CONFIG_XNUPOST defined). Else,
+ * returns 1. */
+static int
+krwlck_action(int action)
+{
+       int ret;
+       if (action == KRWLCK_SYSCTL_CHECK_EXISTS) {
+               ret = sysctlbyname(krwlck_ctl, NULL, NULL, NULL, 0);
+               return !(ret == -1);
+       }
+
+       char * action_name = "";
+       switch(action) {
+               case KRWLCK_SYSCTL_RACQUIRE_NOWAIT:
+                       action_name = "shared lock";
+                       break;
+               case KRWLCK_SYSCTL_RACQUIRE_WAIT:
+                       action_name = "shared lock (and wait)";
+                       break;
+               case KRWLCK_SYSCTL_WACQUIRE_NOWAIT:
+                       action_name = "exclusive lock";
+                       break;
+               case KRWLCK_SYSCTL_WACQUIRE_WAIT:
+                       action_name = "exclusive lock (and wait)";
+                       break;
+               case KRWLCK_SYSCTL_SIGNAL:
+                       action_name = "signal to holder of";
+                       break;
+               case KRWLCK_SYSCTL_TEARDOWN:
+                       action_name = "tear down";
+                       break;
+               default:
+                       T_ASSERT_FAIL("Somebody passed the wrong argument to krwlck_action: %d", action);
+                       break;
+       }
+
+       ret = sysctlbyname(krwlck_ctl, NULL, NULL, &action, sizeof(int));
+       T_ASSERT_POSIX_SUCCESS(ret, "sysctl: %s kernel rwlock", action_name);
+       return 1;
+}
+
+static void
+sysctl_krwlck_test_match(uint64_t context)
+{
+       int ret;
+       unsigned long long unslid_krwlck_address;
+       size_t addrsize = sizeof(unslid_krwlck_address);
+
+       ret = sysctlbyname(krwlck_ctl, &unslid_krwlck_address, &addrsize, NULL, 0);
+       T_QUIET; T_ASSERT_POSIX_SUCCESS(ret, "Getting unslid location of kernel rwlock");
+       T_EXPECT_EQ(context, unslid_krwlck_address, "Context should match unslid location of rwlock in kernel memory");
+}
+
+/* "Grabbing" threads: only purpose is to grab a sync primitive and hang. */
+
+static void *
+kmutex_grabbing_thread(void * arg)
+{
+       (void)arg;
+       kmutex_action(KMUTEX_SYSCTL_ACQUIRE_NOWAIT);
+       return NULL;
+}
+
+static void *
+kmutex_grab_and_wait_thread(void * arg)
+{
+       (void)arg;
+       kmutex_action(KMUTEX_SYSCTL_ACQUIRE_WAIT);
+       return NULL;
+}
+
+static void *
+sem_grabbing_thread(void * arg)
+{
+       semaphore_t *sem = (semaphore_t *)arg;
+       semaphore_wait(*sem);
+       return NULL;
+}
+
+static void *
+msg_blocking_thread(void * arg)
+{
+       (void)arg;
+       msg_recv_helper(send);
+
+       for (int i = 0; i < SENDS_TO_BLOCK; i++)
+               msg_send_helper(recv); // will block on send until message is received
+       return NULL;
+}
+
+static void *
+ulock_blocking_thread(void * arg)
+{
+       os_unfair_lock_t oul = (os_unfair_lock_t)arg;
+       os_unfair_lock_lock(oul);
+       os_unfair_lock_unlock(oul);
+       return NULL;
+}
+
+// acquires a kernel rwlock for writing, and then waits on a kernel semaphore.
+static void *
+krwlck_write_waiting_thread(void * arg)
+{
+       (void)arg;
+       krwlck_action(KRWLCK_SYSCTL_WACQUIRE_WAIT);
+       return NULL;
+}
+
+// attempts to acquire a kernel rwlock for reading, and doesn't wait on a semaphore afterwards.
+static void *
+krwlck_read_grabbing_thread(void * arg)
+{
+       (void)arg;
+       krwlck_action(KRWLCK_SYSCTL_RACQUIRE_NOWAIT);
+       return NULL;
+}
+
+static void *
+pthread_mutex_blocking_thread(void * arg)
+{
+       pthread_mutex_t *mtx = (pthread_mutex_t *)arg;
+       pthread_mutex_lock(mtx);
+       pthread_mutex_unlock(mtx);
+       return NULL;
+}
+
+static void *
+pthread_rwlck_blocking_thread(void * arg)
+{
+       pthread_rwlock_t *rwlck = (pthread_rwlock_t *)arg;
+       pthread_rwlock_rdlock(rwlck);
+       pthread_rwlock_unlock(rwlck);
+       return NULL;
+}
+
+static void *
+pthread_cond_blocking_thread(void * arg)
+{
+       pthread_mutex_t mtx  = PTHREAD_MUTEX_INITIALIZER;
+       pthread_cond_t *cond = (pthread_cond_t *)arg;
+       pthread_cond_wait(cond, &mtx);
+       pthread_mutex_unlock(&mtx);
+       return NULL;
+}
+
+/*
+ * Uses a debug sysctl to initialize a kernel mutex.
+ *
+ * The 'waiting' thread grabs this kernel mutex, and immediately waits on a kernel semaphore.
+ * The 'grabbing' thread just attempts to lock the kernel mutex.
+ * When the semaphore is signalled, the 'waiting' thread will unlock the kernel mutex,
+ * giving the opportunity for the 'grabbing' thread to lock it and then immediately unlock it.
+ * This allows us to create a situation in the kernel where we know a thread to be blocked
+ * on a kernel mutex.
+ */
+static void
+test_kmutex_blocking(void)
+{
+       int ret;
+       int len = 2;
+       struct stackshot_thread_waitinfo waitinfo[len];
+       uint64_t thread_id;
+       pthread_t grabbing, waiting;
+
+       T_LOG("Starting %s", __FUNCTION__);
+       ret = pthread_create(&waiting, NULL, kmutex_grab_and_wait_thread, NULL); // thread will block until we signal it
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Spawning grab and wait thread");
+       sleep(1); // give time for thread to block
+       ret = pthread_create(&grabbing, NULL, kmutex_grabbing_thread, NULL); // thread should immediately block
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Spawning waiting thread");
+       sleep(3); // give (lots of) time for thread to give up spinning on lock
+
+       void * stackshot = take_stackshot(STACKSHOT_THREAD_WAITINFO, 0);
+       find_blocking_info(stackshot, (struct stackshot_thread_waitinfo *)&waitinfo, &len);
+
+       T_EXPECT_EQ(len, 2, "There should only be two blocking threads");
+       for (int i = 0; i < len; i++) {
+               struct stackshot_thread_waitinfo *curr = &waitinfo[i];
+               if (curr->wait_type == kThreadWaitSemaphore)
+                       continue;
+               T_EXPECT_EQ(curr->wait_type, kThreadWaitKernelMutex, "Wait type should match expected KernelMutex value");
+               ret = pthread_threadid_np(waiting, &thread_id); // this is the thread that currently holds the kernel mutex
+               T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Getting integer value of thread id");
+               T_EXPECT_EQ(curr->owner, thread_id, "Thread ID of blocking thread should match 'owner' field in stackshot");
+               sysctl_kmutex_test_match(curr->context);
+       }
+
+       kmutex_action(KMUTEX_SYSCTL_SIGNAL); // waiting thread should now unblock.
+       ret = pthread_join(waiting, NULL);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Joining on waiting thread");
+       ret = pthread_join(grabbing, NULL);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Joining on grabber thread");
+       kmutex_action(KMUTEX_SYSCTL_TEARDOWN);
+       stackshot_config_dealloc(stackshot);
+}
+
+/* Initialize a userspace semaphore, and spawn a thread to block on it. */
+static void
+test_semaphore_blocking(void)
+{
+       int ret;
+       semaphore_t sem;
+       struct stackshot_thread_waitinfo waitinfo;
+       int len = 1;
+       uint64_t pid;
+
+       T_LOG("Starting %s", __FUNCTION__);
+       ret = semaphore_create(mach_task_self(), &sem, SYNC_POLICY_FIFO, 0);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Creating semaphore");
+       pthread_t tid;
+       ret = pthread_create(&tid, NULL, sem_grabbing_thread, (void*)&sem); // thread should immediately block
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Creating semaphore grabbing thread");
+
+       sleep(1); // give time for thread to block
+
+       void * stackshot = take_stackshot(STACKSHOT_THREAD_WAITINFO, 0);
+       find_blocking_info(stackshot, (struct stackshot_thread_waitinfo *)&waitinfo, &len);
+       T_EXPECT_EQ(len, 1, "Only one blocking thread should exist");
+       T_EXPECT_EQ(waitinfo.wait_type, kThreadWaitSemaphore, "Wait type should match expected Semaphore value");
+
+       pid = (uint64_t)getpid();
+       T_EXPECT_EQ(waitinfo.owner, pid, "Owner value should match process ID");
+
+       ret = semaphore_signal(sem);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Signalling semaphore");
+       ret = pthread_join(tid, NULL);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Joining on grabber thread");
+       ret = semaphore_destroy(mach_task_self(), sem);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Destroying semaphore");
+       stackshot_config_dealloc(stackshot);
+}
+
+/* Spawn a process to send a message to, and block while both sending and receiving in different contexts. */
+static void
+test_mach_msg_blocking(void)
+{
+       int ret;
+       pthread_t tid;
+       void *stackshot;
+       struct stackshot_thread_waitinfo waitinfo;
+       int len = 1;
+
+       T_LOG("Starting %s", __FUNCTION__);
+       ret = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &send);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Allocating send port");
+       ret = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &recv);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Allocating recv port");
+       ret = mach_port_insert_right(mach_task_self(), send, send, MACH_MSG_TYPE_MAKE_SEND);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Getting send right to send port");
+       ret = mach_port_insert_right(mach_task_self(), recv, recv, MACH_MSG_TYPE_MAKE_SEND);
+       T_QUIET; T_ASSERT_MACH_SUCCESS(ret, "Getting send right to recv port");
+
+       ret = pthread_create(&tid, NULL, msg_blocking_thread, (void*)&send); // thread should block on recv soon
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Creating message blocking thread");
+
+       sleep(1); // give time for thread to block
+       stackshot = take_stackshot(STACKSHOT_THREAD_WAITINFO, 0);
+       find_blocking_info(stackshot, (struct stackshot_thread_waitinfo *)&waitinfo, &len);
+
+       T_EXPECT_EQ(len, 1, "Only one blocking thread should exist");
+       T_EXPECT_EQ(waitinfo.wait_type, kThreadWaitPortReceive, "Wait type should match expected PortReceive value");
+       stackshot_config_dealloc(stackshot);
+
+       msg_send_helper(send); // ping! msg_blocking_thread will now try to send us stuff, and block until we receive.
+
+       sleep(1); // give time for thread to block
+       stackshot = take_stackshot(STACKSHOT_THREAD_WAITINFO, 0);
+       find_blocking_info(stackshot, (struct stackshot_thread_waitinfo *)&waitinfo, &len);
+       T_EXPECT_EQ(len, 1, "Only one blocking thread should exist");
+       T_EXPECT_EQ(waitinfo.wait_type, kThreadWaitPortSend, "Wait type should match expected PortSend value");
+       stackshot_config_dealloc(stackshot);
+
+       msg_recv_helper(recv); // thread should block until we receive one of its messages
+       ret = pthread_join(tid, NULL);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Joining on blocking thread");
+}
+
+static void
+test_ulock_blocking(void)
+{
+       int ret;
+       void *stackshot;
+       uint64_t thread_id;
+       pthread_t tid;
+       struct os_unfair_lock_s ouls = OS_UNFAIR_LOCK_INIT;
+       os_unfair_lock_t oul = &ouls;
+       struct stackshot_thread_waitinfo waitinfo;
+       int len = 1;
+
+       T_LOG("Starting %s", __FUNCTION__);
+       os_unfair_lock_lock(oul);
+       ret = pthread_create(&tid, NULL, ulock_blocking_thread, (void*)oul);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Creating ulock blocking thread");
+       sleep(3); // give time for thread to spawn, fall back to kernel for contention, and block
+
+       stackshot = take_stackshot(STACKSHOT_THREAD_WAITINFO, 0);
+       find_blocking_info(stackshot, (struct stackshot_thread_waitinfo *)&waitinfo, &len);
+       T_EXPECT_EQ(len, 1, "Only one blocking thread should exist");
+       T_EXPECT_EQ(waitinfo.wait_type, kThreadWaitUserLock, "Wait type should match expected UserLock value");
+       stackshot_config_dealloc(stackshot);
+
+       os_unfair_lock_unlock(oul);
+       ret = pthread_join(tid, NULL); // wait for thread to unblock and exit
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Joining on blocking thread");
+
+       ret = pthread_threadid_np(NULL, &thread_id); // this thread is the "owner" of the ulock
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Getting integer value of thread id");
+       T_EXPECT_EQ(waitinfo.owner, thread_id, "Thread ID of blocking thread should match 'owner' field in stackshot");
+       return;
+}
+
+static void
+test_krwlock_blocking(void)
+{
+       int ret;
+       void *stackshot;
+       uint64_t thread_id;
+       pthread_t waiting, grabbing;
+       int len = 2;
+       struct stackshot_thread_waitinfo waitinfo[len];
+
+       T_LOG("Starting %s", __FUNCTION__);
+       // this thread should spawn, acquire a kernel rwlock for write, and then wait on a semaphore
+       ret = pthread_create(&waiting, NULL, krwlck_write_waiting_thread, NULL);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Creating krwlck write waiting thread");
+       sleep(1); // give time for thread to block
+       // this thread should spawn and try to acquire the same kernel rwlock for read, but block
+       ret = pthread_create(&grabbing, NULL, krwlck_read_grabbing_thread, NULL);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Creating krwlck read grabbing thread");
+       sleep(1); // give time for thread to block
+
+       stackshot = take_stackshot(STACKSHOT_THREAD_WAITINFO, 0);
+       find_blocking_info(stackshot, (struct stackshot_thread_waitinfo *)&waitinfo, &len);
+
+       T_EXPECT_EQ(len, 2, "There should only be two blocking threads");
+       for (int i = 0; i < len; i++) {
+               struct stackshot_thread_waitinfo *curr = &waitinfo[i];
+               if (curr->wait_type == kThreadWaitSemaphore)
+                       continue;
+               T_EXPECT_EQ(curr->wait_type, kThreadWaitKernelRWLockRead, "Wait type should match expected KRWLockRead value");
+               sysctl_krwlck_test_match(curr->context);
+
+#if KRWLCK_STORES_EXCL_OWNER /* A future planned enhancement */
+               ret = pthread_threadid_np(waiting, &thread_id); // this is the thread that currently holds the kernel mutex
+               T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Getting integer value of thread id");
+               T_EXPECT_EQ(curr->owner, thread_id, "Thread ID of blocking thread should match 'owner' field in stackshot");
+#endif /* RWLCK_STORES_EXCL_OWNER */
+       }
+
+       krwlck_action(KRWLCK_SYSCTL_SIGNAL); // pthread should now unblock & finish
+       ret = pthread_join(waiting, NULL);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Joining on waiting thread");
+       ret = pthread_join(grabbing, NULL);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Joining on grabbing thread");
+       krwlck_action(KRWLCK_SYSCTL_TEARDOWN);
+       stackshot_config_dealloc(stackshot);
+}
+
+static void
+test_pthread_mutex_blocking(void)
+{
+       int ret;
+       void *stackshot;
+       uint64_t thread_id;
+       pthread_t tid;
+       struct stackshot_thread_waitinfo waitinfo;
+       pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+       int len = 1;
+
+       T_LOG("Starting %s", __FUNCTION__);
+
+       pthread_mutex_lock(&mtx);
+       ret = pthread_create(&tid, NULL, pthread_mutex_blocking_thread, (void*)&mtx);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Creating pthread mutex blocking thread");
+       sleep(2); // give time for thread to block
+
+       stackshot = take_stackshot(STACKSHOT_THREAD_WAITINFO, 0);
+       find_blocking_info(stackshot, (struct stackshot_thread_waitinfo *)&waitinfo, &len);
+       T_EXPECT_EQ(len, 1, "Only one blocking thread should exist");
+       T_EXPECT_EQ(waitinfo.wait_type, kThreadWaitPThreadMutex,
+                       "Wait type should match expected PThreadMutex value");
+       stackshot_config_dealloc(stackshot);
+
+       pthread_mutex_unlock(&mtx);
+       ret = pthread_join(tid, NULL); // wait for thread to unblock and exit
+
+       ret = pthread_threadid_np(NULL, &thread_id); // this thread is the "owner" of the mutex
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Getting integer value of thread id");
+       T_EXPECT_EQ(waitinfo.owner, thread_id,
+                       "Thread ID of blocking thread should match 'owner' field in stackshot");
+       T_EXPECT_EQ(waitinfo.context, (uint64_t)&mtx,
+                       "Userspace address of mutex should match 'context' field in stackshot");
+}
+
+static void
+test_pthread_rwlck_blocking(void)
+{
+       int ret;
+       void *stackshot;
+       pthread_t tid;
+       struct stackshot_thread_waitinfo waitinfo;
+       pthread_rwlock_t rwlck = PTHREAD_RWLOCK_INITIALIZER;
+       int len = 1;
+
+       T_LOG("Starting %s", __FUNCTION__);
+       pthread_rwlock_wrlock(&rwlck);
+       ret = pthread_create(&tid, NULL, pthread_rwlck_blocking_thread, (void*)&rwlck);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Creating pthread rwlck blocking thread");
+       sleep(2);
+
+       stackshot = take_stackshot(STACKSHOT_THREAD_WAITINFO, 0);
+       find_blocking_info(stackshot, (struct stackshot_thread_waitinfo *)&waitinfo, &len);
+       T_EXPECT_EQ(len, 1, "Only one blocking thread should exist");
+       T_EXPECT_EQ(waitinfo.wait_type, kThreadWaitPThreadRWLockRead,
+                       "Wait type should match expected PThreadRWLockRead value");
+       stackshot_config_dealloc(stackshot);
+
+       pthread_rwlock_unlock(&rwlck);
+       ret = pthread_join(tid, NULL); // wait for thread to unblock and exit
+       T_EXPECT_EQ(waitinfo.context, (uint64_t)&rwlck,
+                       "Userspace address of rwlck should match 'context' field in stackshot");
+}
+
+static void
+test_pthread_cond_blocking(void)
+{
+       int ret;
+       void *stackshot;
+       pthread_t tid;
+       pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+       struct stackshot_thread_waitinfo waitinfo;
+       int len = 1;
+
+       T_LOG("Starting %s", __FUNCTION__);
+       ret = pthread_create(&tid, NULL, pthread_cond_blocking_thread, (void*)&cond);
+       T_QUIET; T_ASSERT_POSIX_ZERO(ret, "Creating pthread condvar blocking thread");
+       sleep(2);
+
+       stackshot = take_stackshot(STACKSHOT_THREAD_WAITINFO, 0);
+       find_blocking_info(stackshot, (struct stackshot_thread_waitinfo *)&waitinfo, &len);
+       T_EXPECT_EQ(len, 1, "Only one blocking thread should exist");
+       T_EXPECT_EQ(waitinfo.wait_type, kThreadWaitPThreadCondVar,
+                       "Wait type should match expected PThreadCondVar value");
+       stackshot_config_dealloc(stackshot);
+
+       pthread_cond_signal(&cond);
+       ret = pthread_join(tid, NULL); // wait for thread to unblock and exit
+       T_EXPECT_EQ(waitinfo.context, (uint64_t)&cond,
+                       "Userspace address of condvar should match 'context' field in stackshot");
+       pthread_cond_destroy(&cond);
+}
+
+/*
+ *
+ * Test declarations
+ *
+ */
+
+T_DECL(stackshot_block_owner_klocks, "tests stackshot block owner for kernel locks") {
+       /* check to see if kmutex sysctl exists before running kmutex test */
+       if (kmutex_action(KMUTEX_SYSCTL_CHECK_EXISTS))
+               test_kmutex_blocking();
+       /* check to see if krwlck sysctl exists before running krwlck test */
+       if (krwlck_action(KRWLCK_SYSCTL_CHECK_EXISTS))
+               test_krwlock_blocking();
+       test_ulock_blocking();
+}
+
+T_DECL(stackshot_block_owner_pthread_mutex, "tests stackshot block owner: pthread mutex") {
+       test_pthread_mutex_blocking();
+}
+
+T_DECL(stackshot_block_owner_pthread_rwlck, "tests stackshot block owner: pthread rw locks") {
+       test_pthread_rwlck_blocking();
+}
+
+T_DECL(stackshot_block_owner_pthread_condvar, "tests stackshot block owner: pthread condvar") {
+       test_pthread_cond_blocking();
+}
+
+T_DECL(stackshot_block_owner_semaphore, "tests stackshot block owner: semaphore") {
+       test_semaphore_blocking();
+}
+
+T_DECL(stackshot_block_owner_mach_msg, "tests stackshot block owner: mach messaging") {
+       test_mach_msg_blocking();
+}
index 471dcb034655884e01678305d8ee2cce91c32309..87ec2d0dfb5ce04ca1549bd587096155a2b8925c 100644 (file)
@@ -240,7 +240,7 @@ spinning_non_work_queue_thread(void * ignored)
        return NULL;
 }
 
-T_DECL(stackshot_idle_25570396, "Tests that stackshot can properly recognize idle and non-idle threads", T_META("owner", "Core Kernel Team"))
+T_DECL(stackshot_idle_25570396, "Tests that stackshot can properly recognize idle and non-idle threads", T_META_ASROOT(true))
 {
        int ret;
        uint64_t initial_stackshot_time;
diff --git a/tools/tests/darwintests/task_inspect.c b/tools/tests/darwintests/task_inspect.c
new file mode 100644 (file)
index 0000000..468ae8e
--- /dev/null
@@ -0,0 +1,132 @@
+#include <darwintest.h>
+
+#include <mach/host_priv.h>
+#include <mach/mach.h>
+#include <mach/mach_types.h>
+#include <mach/mach_vm.h>
+#include <mach/processor_set.h>
+#include <mach/task.h>
+#include <sys/sysctl.h>
+#include <unistd.h>
+
+T_GLOBAL_META(T_META_NAMESPACE("xnu.ipc"));
+
+/*
+ * Attempt to inspect kernel_task using a task_inspect_t.  Interact with the
+ * kernel in the same way top(1) and lsmp(1) do.
+ */
+
+static void
+check_secure_kernel(void)
+{
+       int secure_kern = 0;
+       size_t secure_kern_size = sizeof(secure_kern);
+
+       T_ASSERT_POSIX_SUCCESS(sysctlbyname("kern.secure_kernel", &secure_kern,
+                       &secure_kern_size, NULL, 0), NULL);
+
+       if (secure_kern) {
+               T_SKIP("secure kernel: processor_set_tasks will not return kernel_task");
+       }
+}
+
+static void
+attempt_kernel_inspection(task_t task)
+{
+       pid_t pid = (pid_t)-1;
+       mach_msg_type_number_t i, count, thcnt;
+       struct task_basic_info_64 ti;
+       thread_act_array_t threads;
+
+       T_QUIET;
+       T_EXPECT_MACH_SUCCESS(pid_for_task(task, &pid), NULL);
+       T_LOG("Checking pid %d", pid);
+
+       if (pid != 0) {
+               return;
+       }
+
+       T_LOG("found kernel_task, attempting to inspect");
+
+       count = TASK_BASIC_INFO_64_COUNT;
+       T_EXPECT_MACH_SUCCESS(task_info(task, TASK_BASIC_INFO_64, (task_info_t)&ti,
+                                       &count), "task_info(... TASK_BASIC_INFO_64 ...)");
+
+       T_EXPECT_MACH_SUCCESS(task_threads(task, &threads, &thcnt), "task_threads");
+       T_LOG("Found %d kernel threads.", thcnt);
+       for (i = 0; i < thcnt; i++) {
+               thread_basic_info_data_t basic_info;
+               mach_msg_type_number_t bi_count = THREAD_BASIC_INFO_COUNT;
+               T_EXPECT_MACH_SUCCESS(thread_info(threads[i], THREAD_BASIC_INFO,
+                                                 (thread_info_t)&basic_info, &bi_count),
+                                     "thread_info(... THREAD_BASIC_INFO ...)");
+               (void)mach_port_deallocate(mach_task_self(), threads[i]);
+       }
+       mach_vm_deallocate(mach_task_self(),
+                          (mach_vm_address_t)(uintptr_t)threads,
+                          thcnt * sizeof(*threads));
+
+       ipc_info_space_basic_t basic_info;
+       T_EXPECT_MACH_SUCCESS(mach_port_space_basic_info(task, &basic_info), "mach_port_space_basic_info");
+
+       ipc_info_space_t info_space;
+       ipc_info_name_array_t table;
+       ipc_info_tree_name_array_t tree;
+       mach_msg_type_number_t tblcnt = 0, treecnt = 0;
+       T_EXPECT_MACH_SUCCESS(mach_port_space_info(task, &info_space, &table,
+                                                  &tblcnt, &tree, &treecnt), "mach_port_space_info");
+       if (tblcnt > 0) {
+               mach_vm_deallocate(mach_task_self(),
+                                  (mach_vm_address_t)(uintptr_t)table,
+                                  tblcnt * sizeof(*table));
+       }
+       if (treecnt > 0) {
+               mach_vm_deallocate(mach_task_self(),
+                                  (mach_vm_address_t)(uintptr_t)tree,
+                                  treecnt * sizeof(*tree));
+       }
+
+       T_END;
+}
+
+T_DECL(inspect_kernel_task,
+               "ensure that kernel task can be inspected",
+               T_META_CHECK_LEAKS(false),
+               T_META_ASROOT(true))
+{
+       processor_set_name_array_t psets;
+       processor_set_t pset;
+       task_array_t tasks;
+       mach_msg_type_number_t i, j, tcnt, pcnt = 0;
+       mach_port_t self = mach_host_self();
+
+       check_secure_kernel();
+
+       T_ASSERT_MACH_SUCCESS(host_processor_sets(self, &psets, &pcnt),
+                       NULL);
+
+       for (i = 0; i < pcnt; i++) {
+               T_ASSERT_MACH_SUCCESS(host_processor_set_priv(self, psets[i], &pset), NULL);
+               T_LOG("Checking pset %d/%d", i, pcnt - 1);
+
+               tcnt = 0;
+               T_ASSERT_MACH_SUCCESS(processor_set_tasks(pset, &tasks, &tcnt), NULL);
+
+               for (j = 0; j < tcnt; j++) {
+                       attempt_kernel_inspection(tasks[j]);
+                       mach_port_deallocate(self, tasks[j]);
+               }
+
+               /* free tasks array */
+               mach_vm_deallocate(mach_task_self(),
+                                  (mach_vm_address_t)(uintptr_t)tasks,
+                                  tcnt * sizeof(*tasks));
+               mach_port_deallocate(mach_task_self(), pset);
+               mach_port_deallocate(mach_task_self(), psets[i]);
+       }
+       mach_vm_deallocate(mach_task_self(),
+                          (mach_vm_address_t)(uintptr_t)psets,
+                          pcnt * sizeof(*psets));
+
+       T_FAIL("could not find kernel_task in list of tasks returned");
+}
diff --git a/tools/tests/darwintests/task_inspect.entitlements b/tools/tests/darwintests/task_inspect.entitlements
new file mode 100644 (file)
index 0000000..d9cb98b
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>com.apple.system-task-ports</key>
+       <true/>
+</dict>
+</plist>
index 600aae2356962862c053f8b4d8c8cca2e7bfa52d..24e246ad027ff062e0722a4673873a959cf3583f 100644 (file)
@@ -10,7 +10,7 @@
 #include <mach/mach.h>
 #include <darwintest.h>
 
-T_DECL(voucher_entry, "voucher_entry", T_META_CHECK_LEAKS(NO), T_META_ALL_VALID_ARCHS(YES))
+T_DECL(voucher_entry, "voucher_entry", T_META_CHECK_LEAKS(false), T_META_ALL_VALID_ARCHS(true))
 {
        kern_return_t kr        = KERN_SUCCESS;
        mach_voucher_t voucher  = MACH_VOUCHER_NULL;
diff --git a/tools/tests/darwintests/xnu_quick_test.c b/tools/tests/darwintests/xnu_quick_test.c
new file mode 100644 (file)
index 0000000..5e2e667
--- /dev/null
@@ -0,0 +1,52 @@
+#define T_NAMESPACE xnu.quicktest
+
+#include <darwintest.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+
+/*  **************************************************************************************************************
+ *     Test fork wait4, and exit system calls.
+ *  **************************************************************************************************************
+ */
+T_DECL(fork_wait4_exit_test, 
+       "Tests forking off a process and waiting for the child to exit", T_META_CHECK_LEAKS(false))
+{
+       int                             my_err, my_status;
+    pid_t                      my_pid, my_wait_pid;
+       struct rusage   my_usage;
+       char *                  g_target_path="/";
+
+       /* spin off another process */
+       T_ASSERT_NE(my_pid = fork(), -1, "Fork off a process");
+       
+       if ( my_pid == 0 ) {
+               struct stat             my_sb;
+               
+               /* child process does very little then exits */
+               my_err = stat( &g_target_path[0], &my_sb );
+               T_WITH_ERRNO;
+        T_ASSERT_TRUE(my_err == 0, "stat call with path: \"%s\" returned \"%d\"", &g_target_path[0], errno);
+               exit( 44 );
+       }
+       
+       /* parent process waits for child to exit */
+       T_ASSERT_NE(my_wait_pid = wait4( my_pid, &my_status, 0, &my_usage ), -1,
+               "Wait for child to exit\n");
+
+       /* wait4 should return our child's pid when it exits */
+       T_ASSERT_EQ(my_wait_pid, my_pid, 
+               "wait4 should return our child's pid when it exits");
+       
+       /* kind of just guessing on these values so if this fails we should take a closer 
+        * look at the returned rusage structure. 
+        */
+        T_ASSERT_FALSE(( my_usage.ru_utime.tv_sec > 1 || 
+               my_usage.ru_stime.tv_sec > 1 || my_usage.ru_majflt > 1000 ||
+               my_usage.ru_msgsnd > 100 ), "wait4 returned rusage structure");
+
+       T_ASSERT_TRUE(( WIFEXITED( my_status ) && WEXITSTATUS( my_status ) == 44 ),
+               "check if wait4 returns right exit status");
+}
diff --git a/tools/tests/mktimer/Makefile b/tools/tests/mktimer/Makefile
new file mode 100644 (file)
index 0000000..c26b6ae
--- /dev/null
@@ -0,0 +1,27 @@
+include ../Makefile.common
+
+OBJROOT?=$(shell /bin/pwd)
+
+CC:=$(shell xcrun -sdk "$(SDKROOT)" -find cc)
+
+ifdef RC_ARCHS
+    ARCHS:=$(RC_ARCHS)
+  else
+    ifeq "$(Embedded)" "YES"
+      ARCHS:=armv7 armv7s arm64
+    else
+      ARCHS:=x86_64 i386
+  endif
+endif
+
+DSTROOT?=$(shell /bin/pwd)
+
+CFLAGS:=$(patsubst %, -arch %,$(ARCHS)) -g -Wall -Os -isysroot $(SDKROOT) -framework CoreFoundation
+
+all: $(DSTROOT)/mktimer_test
+
+$(DSTROOT)/mktimer_test: $(OBJROOT)/mktimer_test.c
+       $(CC) -o $@ $^ $(CFLAGS)
+
+clean:
+       rm -rf $(DSTROOT)/mktimer_test $(DSTROOT)/mk_timer_test.dSYM
diff --git a/tools/tests/mktimer/mktimer_test.c b/tools/tests/mktimer/mktimer_test.c
new file mode 100644 (file)
index 0000000..43326a1
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2016 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@
+ */
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <unistd.h>
+#include <mach/mach.h>
+#include <mach/mach_time.h>
+
+/* These externs can be removed once the prototypes make it to the SDK */
+extern mach_port_name_t mk_timer_create(void);
+extern kern_return_t mk_timer_arm(mach_port_name_t name, uint64_t expire_time);
+
+#define MK_TIMER_CRITICAL (1)
+extern kern_return_t    mk_timer_arm_leeway(mach_port_name_t  name,
+    uint64_t          mk_timer_flags,
+    uint64_t          mk_timer_expire_time,
+    uint64_t          mk_timer_leeway);
+
+struct mach_timebase_info tbinfo;
+double conversion;
+
+mach_port_t timerPort;
+
+uint64_t interval_abs = 1000000000;
+
+uint32_t use_leeway = 0;
+uint32_t report = 1000;
+
+uint64_t on, lastfire = 0, totaljitter = 0, max_jitter = 0, min_jitter = ~0ULL, jiterations = 0, leeway_ns = 0, leeway_abs = 0;
+uint64_t deadline;
+
+void cfmcb(CFMachPortRef port, void *msg, CFIndex size, void *msginfo) {
+       uint64_t ctime = mach_absolute_time();
+       uint64_t jitter = 0;
+
+       if (deadline) {
+               jitter = (ctime - deadline);
+               if (jitter > max_jitter) {
+                       max_jitter = jitter;
+               }
+
+               if (jitter < min_jitter) {
+                       min_jitter = jitter;
+               }
+
+               totaljitter += jitter;
+               if ((++jiterations % report) == 0) {
+                       printf("max_jitter: %g (ns), min_jitter: %g (ns), average_jitter: %g (ns)\n", max_jitter * conversion, min_jitter * conversion, ((double)totaljitter/(double)jiterations) * conversion);
+                       max_jitter = 0; min_jitter = ~0ULL; jiterations = 0; totaljitter = 0;
+               }
+       }
+
+       deadline = mach_absolute_time() + interval_abs;
+
+       if (use_leeway) {
+               mk_timer_arm_leeway(timerPort, MK_TIMER_CRITICAL, deadline, leeway_abs);
+       } else {
+               mk_timer_arm(timerPort, deadline);
+       }
+}
+
+int main(int argc, char **argv) {
+       if (argc != 4) {
+               printf("Usage: mktimer_test <interval_ns> <use leeway trap> <leeway_ns>\n");
+               return 0;
+       }
+
+       on = strtoul(argv[1], NULL, 0);
+       use_leeway = strtoul(argv[2], NULL, 0);
+
+       mach_timebase_info(&tbinfo);
+       conversion = ((double)tbinfo.numer / (double) tbinfo.denom);
+
+       leeway_ns = strtoul(argv[3], NULL, 0);
+
+       leeway_abs = leeway_ns / conversion;
+       printf("Interval in ns: %llu, timebase conversion: %g, use leeway syscall: %d, leeway_ns: %llu\n", on, conversion, !!use_leeway, leeway_ns);
+
+       interval_abs = on / conversion;
+
+       uint64_t cID = 0;
+       CFMachPortContext context = (CFMachPortContext){
+               1,
+               (void *)cID,
+               NULL,
+               NULL,
+               NULL,
+       };
+
+       timerPort = mk_timer_create();
+       CFMachPortRef port = CFMachPortCreateWithPort(NULL, timerPort, cfmcb, &context, NULL);
+       CFRunLoopSourceRef eventSource = CFMachPortCreateRunLoopSource(NULL, port, -1);
+       CFRunLoopAddSource(CFRunLoopGetCurrent(), eventSource, kCFRunLoopDefaultMode);
+       CFRelease(eventSource);
+
+       if (use_leeway) {
+               mk_timer_arm_leeway(timerPort, MK_TIMER_CRITICAL, mach_absolute_time() + interval_abs, leeway_abs);
+       } else  {
+               mk_timer_arm(timerPort, mach_absolute_time() + interval_abs);
+       }
+
+       for (;;) {
+               CFRunLoopRun();
+       }
+       return 0;
+}
diff --git a/tools/tests/testkext/pgokext/Info.plist b/tools/tests/testkext/pgokext/Info.plist
new file mode 100644 (file)
index 0000000..d2068c5
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>en</string>
+       <key>CFBundleExecutable</key>
+       <string>$(EXECUTABLE_NAME)</string>
+       <key>CFBundleIdentifier</key>
+       <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleName</key>
+       <string>$(PRODUCT_NAME)</string>
+       <key>CFBundlePackageType</key>
+       <string>KEXT</string>
+       <key>CFBundleShortVersionString</key>
+       <string>1.0</string>
+       <key>CFBundleVersion</key>
+       <string>1</string>
+       <key>OSBundleLibraries</key>
+       <dict>
+               <key>com.apple.kpi.bsd</key>
+               <string>12.0</string>
+               <key>com.apple.kpi.libkern</key>
+               <string>11.2</string>
+               <key>com.apple.kpi.mach</key>
+               <string>11.2</string>
+       </dict>
+</dict>
+</plist>
diff --git a/tools/tests/testkext/pgokext/pgokext.c b/tools/tests/testkext/pgokext/pgokext.c
new file mode 100644 (file)
index 0000000..ae82578
--- /dev/null
@@ -0,0 +1,22 @@
+//
+//  pgokext.c
+//  pgokext
+//
+//  Created by Lawrence D'Anna on 12/15/16.
+//
+//
+
+#include <mach/mach_types.h>
+
+kern_return_t pgokext_start(kmod_info_t * ki, void *d);
+kern_return_t pgokext_stop(kmod_info_t *ki, void *d);
+
+kern_return_t pgokext_start(kmod_info_t * ki, void *d)
+{
+    return KERN_SUCCESS;
+}
+
+kern_return_t pgokext_stop(kmod_info_t *ki, void *d)
+{
+    return KERN_SUCCESS;
+}
index a1fab81db4da2f9949af3765e89cc92eab3a513e..a896406839d6ac6af95c7d6e6a87804971748627 100644 (file)
@@ -7,11 +7,15 @@
        objects = {
 
 /* Begin PBXBuildFile section */
+               086FC22B1E0347E700A7EBEF /* pgokext.c in Sources */ = {isa = PBXBuildFile; fileRef = 086FC22A1E0347E700A7EBEF /* pgokext.c */; };
                C68D22B30EB2441400C3A06C /* testvmx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C68D22B20EB2441400C3A06C /* testvmx.cpp */; };
                C6CBD9CE1225B9FF00F317B5 /* testthreadcall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6CBD9CD1225B9FF00F317B5 /* testthreadcall.cpp */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+               086FC2281E0347E700A7EBEF /* pgokext.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = pgokext.kext; sourceTree = BUILT_PRODUCTS_DIR; };
+               086FC22A1E0347E700A7EBEF /* pgokext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pgokext.c; sourceTree = "<group>"; };
+               086FC22C1E0347E700A7EBEF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
                8DA8362C06AD9B9200E5AC22 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = "<absolute>"; };
                C68D22A80EB243BC00C3A06C /* testvmx.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = testvmx.kext; sourceTree = BUILT_PRODUCTS_DIR; };
                C68D22A90EB243BC00C3A06C /* testvmx-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "testvmx-Info.plist"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
+               086FC2241E0347E700A7EBEF /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                C68D22A60EB243BC00C3A06C /* Frameworks */ = {
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+               086FC2291E0347E700A7EBEF /* pgokext */ = {
+                       isa = PBXGroup;
+                       children = (
+                               086FC22A1E0347E700A7EBEF /* pgokext.c */,
+                               086FC22C1E0347E700A7EBEF /* Info.plist */,
+                       );
+                       path = pgokext;
+                       sourceTree = "<group>";
+               };
                089C166AFE841209C02AAC07 /* testkext */ = {
                        isa = PBXGroup;
                        children = (
                                247142CAFF3F8F9811CA285C /* Source */,
                                8DA8362C06AD9B9200E5AC22 /* Kernel.framework */,
+                               086FC2291E0347E700A7EBEF /* pgokext */,
                                19C28FB6FE9D52B211CA2CBB /* Products */,
                        );
                        name = testkext;
@@ -56,6 +77,7 @@
                        children = (
                                C68D22A80EB243BC00C3A06C /* testvmx.kext */,
                                C6CBD9C31225B98F00F317B5 /* testthreadcall.kext */,
+                               086FC2281E0347E700A7EBEF /* pgokext.kext */,
                        );
                        name = Products;
                        sourceTree = "<group>";
                };
 /* End PBXGroup section */
 
+/* Begin PBXHeadersBuildPhase section */
+               086FC2251E0347E700A7EBEF /* Headers */ = {
+                       isa = PBXHeadersBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXHeadersBuildPhase section */
+
 /* Begin PBXNativeTarget section */
+               086FC2271E0347E700A7EBEF /* pgokext */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = 086FC22F1E0347E700A7EBEF /* Build configuration list for PBXNativeTarget "pgokext" */;
+                       buildPhases = (
+                               086FC2231E0347E700A7EBEF /* Sources */,
+                               086FC2241E0347E700A7EBEF /* Frameworks */,
+                               086FC2251E0347E700A7EBEF /* Headers */,
+                               086FC2261E0347E700A7EBEF /* Resources */,
+                       );
+                       buildRules = (
+                       );
+                       dependencies = (
+                       );
+                       name = pgokext;
+                       productName = pgokext;
+                       productReference = 086FC2281E0347E700A7EBEF /* pgokext.kext */;
+                       productType = "com.apple.product-type.kernel-extension";
+               };
                C68D22A70EB243BC00C3A06C /* testvmx */ = {
                        isa = PBXNativeTarget;
                        buildConfigurationList = C68D22AC0EB243BD00C3A06C /* Build configuration list for PBXNativeTarget "testvmx" */;
 /* Begin PBXProject section */
                089C1669FE841209C02AAC07 /* Project object */ = {
                        isa = PBXProject;
+                       attributes = {
+                               TargetAttributes = {
+                                       086FC2271E0347E700A7EBEF = {
+                                               CreatedOnToolsVersion = 8.3;
+                                               ProvisioningStyle = Automatic;
+                                       };
+                               };
+                       };
                        buildConfigurationList = 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "testkext" */;
                        compatibilityVersion = "Xcode 3.1";
                        developmentRegion = English;
                        targets = (
                                C68D22A70EB243BC00C3A06C /* testvmx */,
                                C6CBD9C21225B98F00F317B5 /* testthreadcall */,
+                               086FC2271E0347E700A7EBEF /* pgokext */,
                        );
                };
 /* End PBXProject section */
 
 /* Begin PBXResourcesBuildPhase section */
+               086FC2261E0347E700A7EBEF /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                C68D22A50EB243BC00C3A06C /* Resources */ = {
                        isa = PBXResourcesBuildPhase;
                        buildActionMask = 2147483647;
 /* End PBXResourcesBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
+               086FC2231E0347E700A7EBEF /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               086FC22B1E0347E700A7EBEF /* pgokext.c in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
                C68D22A40EB243BC00C3A06C /* Sources */ = {
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
 /* End PBXSourcesBuildPhase section */
 
 /* Begin XCBuildConfiguration section */
+               086FC22D1E0347E700A7EBEF /* Debug */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               CLANG_ANALYZER_NONNULL = YES;
+                               CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+                               CLANG_CXX_LIBRARY = "libc++";
+                               CLANG_ENABLE_MODULES = YES;
+                               CLANG_ENABLE_OBJC_ARC = YES;
+                               CLANG_WARN_BOOL_CONVERSION = YES;
+                               CLANG_WARN_CONSTANT_CONVERSION = YES;
+                               CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+                               CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+                               CLANG_WARN_EMPTY_BODY = YES;
+                               CLANG_WARN_ENUM_CONVERSION = YES;
+                               CLANG_WARN_INFINITE_RECURSION = YES;
+                               CLANG_WARN_INT_CONVERSION = YES;
+                               CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+                               CLANG_WARN_SUSPICIOUS_MOVE = YES;
+                               CLANG_WARN_UNREACHABLE_CODE = YES;
+                               CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+                               CODE_SIGN_IDENTITY = "";
+                               COPY_PHASE_STRIP = NO;
+                               DEBUG_INFORMATION_FORMAT = dwarf;
+                               ENABLE_STRICT_OBJC_MSGSEND = YES;
+                               ENABLE_TESTABILITY = YES;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_NO_COMMON_BLOCKS = YES;
+                               GCC_PREPROCESSOR_DEFINITIONS = (
+                                       "DEBUG=1",
+                                       "$(inherited)",
+                               );
+                               GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+                               GCC_WARN_UNDECLARED_SELECTOR = YES;
+                               GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+                               GCC_WARN_UNUSED_FUNCTION = YES;
+                               INFOPLIST_FILE = pgokext/Info.plist;
+                               INSTALL_PATH = /;
+                               MACOSX_DEPLOYMENT_TARGET = 10.13;
+                               MODULE_NAME = com.apple.pgokext;
+                               MODULE_START = pgokext_start;
+                               MODULE_STOP = pgokext_stop;
+                               MODULE_VERSION = 1.0.0d1;
+                               MTL_ENABLE_DEBUG_INFO = YES;
+                               OTHER_CFLAGS = "-fprofile-instr-generate";
+                               PRODUCT_BUNDLE_IDENTIFIER = com.apple.pgokext;
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                               SDKROOT = macosx;
+                               WRAPPER_EXTENSION = kext;
+                       };
+                       name = Debug;
+               };
+               086FC22E1E0347E700A7EBEF /* Release */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               ALWAYS_SEARCH_USER_PATHS = NO;
+                               CLANG_ANALYZER_NONNULL = YES;
+                               CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+                               CLANG_CXX_LIBRARY = "libc++";
+                               CLANG_ENABLE_MODULES = YES;
+                               CLANG_ENABLE_OBJC_ARC = YES;
+                               CLANG_WARN_BOOL_CONVERSION = YES;
+                               CLANG_WARN_CONSTANT_CONVERSION = YES;
+                               CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+                               CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+                               CLANG_WARN_EMPTY_BODY = YES;
+                               CLANG_WARN_ENUM_CONVERSION = YES;
+                               CLANG_WARN_INFINITE_RECURSION = YES;
+                               CLANG_WARN_INT_CONVERSION = YES;
+                               CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+                               CLANG_WARN_SUSPICIOUS_MOVE = YES;
+                               CLANG_WARN_UNREACHABLE_CODE = YES;
+                               CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+                               CODE_SIGN_IDENTITY = "";
+                               COPY_PHASE_STRIP = NO;
+                               DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+                               ENABLE_NS_ASSERTIONS = NO;
+                               ENABLE_STRICT_OBJC_MSGSEND = YES;
+                               GCC_NO_COMMON_BLOCKS = YES;
+                               GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+                               GCC_WARN_UNDECLARED_SELECTOR = YES;
+                               GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+                               GCC_WARN_UNUSED_FUNCTION = YES;
+                               INFOPLIST_FILE = pgokext/Info.plist;
+                               INSTALL_PATH = /;
+                               MACOSX_DEPLOYMENT_TARGET = 10.13;
+                               MODULE_NAME = com.apple.pgokext;
+                               MODULE_START = pgokext_start;
+                               MODULE_STOP = pgokext_stop;
+                               MODULE_VERSION = 1.0.0d1;
+                               MTL_ENABLE_DEBUG_INFO = NO;
+                               OTHER_CFLAGS = "-fprofile-instr-generate";
+                               PRODUCT_BUNDLE_IDENTIFIER = com.apple.pgokext;
+                               PRODUCT_NAME = "$(TARGET_NAME)";
+                               SDKROOT = macosx;
+                               WRAPPER_EXTENSION = kext;
+                       };
+                       name = Release;
+               };
                1DEB91DE08733DB10010E9CD /* Debug */ = {
                        isa = XCBuildConfiguration;
                        buildSettings = {
 /* End XCBuildConfiguration section */
 
 /* Begin XCConfigurationList section */
+               086FC22F1E0347E700A7EBEF /* Build configuration list for PBXNativeTarget "pgokext" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               086FC22D1E0347E700A7EBEF /* Debug */,
+                               086FC22E1E0347E700A7EBEF /* Release */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Release;
+               };
                1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "testkext" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (