+#define _DARWIN_FEATURE_UNIX_CONFORMANCE 3
+#endif
+
+#if defined(DRIVERKIT) && !defined(KERNEL)
+/*
+ * __DRIVERKIT_LIBC__ indicates to the C++ standard library headers and
+ * similar components that only the restricted set of standard C library
+ * functionality and headers for the DriverKit userspace driver environment
+ * are available.
+ */
+#define __DRIVERKIT_LIBC__ 1
+#endif /* defined(DRIVERKIT) && !defined(KERNEL) */
+
+/*
+ * This macro casts away the qualifier from the variable
+ *
+ * Note: use at your own risk, removing qualifiers can result in
+ * catastrophic run-time failures.
+ */
+#ifndef __CAST_AWAY_QUALIFIER
+#define __CAST_AWAY_QUALIFIER(variable, qualifier, type) (type) (long)(variable)
+#endif
+
+/*
+ * __XNU_PRIVATE_EXTERN is a linkage decoration indicating that a symbol can be
+ * used from other compilation units, but not other libraries or executables.
+ */
+#ifndef __XNU_PRIVATE_EXTERN
+#define __XNU_PRIVATE_EXTERN __attribute__((visibility("hidden")))
+#endif
+
+/*
+ * Architecture validation for current SDK
+ */
+#if !defined(__sys_cdefs_arch_unknown__) && defined(__i386__)
+#elif !defined(__sys_cdefs_arch_unknown__) && defined(__x86_64__)
+#elif !defined(__sys_cdefs_arch_unknown__) && defined(__arm__)
+#elif !defined(__sys_cdefs_arch_unknown__) && defined(__arm64__)
+#else
+#error Unsupported architecture
+#endif
+
+#ifdef XNU_KERNEL_PRIVATE
+/*
+ * Selectively ignore cast alignment warnings
+ */
+#define __IGNORE_WCASTALIGN(x) _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wcast-align\"") \
+ x; \
+ _Pragma("clang diagnostic pop")
+#endif
+
+#if defined(PRIVATE) || defined(KERNEL)
+/*
+ * Check if __probable and __improbable have already been defined elsewhere.
+ * These macros inform the compiler (and humans) about which branches are likely
+ * to be taken.
+ */
+#if !defined(__probable) && !defined(__improbable)
+#define __probable(x) __builtin_expect(!!(x), 1)
+#define __improbable(x) __builtin_expect(!!(x), 0)
+#endif /* !defined(__probable) && !defined(__improbable) */
+
+#if defined(__cplusplus)
+#define __container_of(ptr, type, field) __extension__({ \
+ const typeof(((type *)nullptr)->field) *__ptr = (ptr); \
+ (type *)((uintptr_t)__ptr - offsetof(type, field)); \
+ })
+#else
+#define __container_of(ptr, type, field) __extension__({ \
+ const typeof(((type *)NULL)->field) *__ptr = (ptr); \
+ (type *)((uintptr_t)__ptr - offsetof(type, field)); \
+ })
+#endif
+
+#endif /* KERNEL || PRIVATE */
+
+#define __compiler_barrier() __asm__ __volatile__("" ::: "memory")
+
+#if __has_attribute(enum_extensibility)
+#define __enum_open __attribute__((__enum_extensibility__(open)))
+#define __enum_closed __attribute__((__enum_extensibility__(closed)))
+#else
+#define __enum_open
+#define __enum_closed
+#endif // __has_attribute(enum_extensibility)
+
+#if __has_attribute(flag_enum)
+#define __enum_options __attribute__((__flag_enum__))
+#else
+#define __enum_options
+#endif
+
+/*
+ * Similar to OS_ENUM/OS_CLOSED_ENUM/OS_OPTIONS/OS_CLOSED_OPTIONS
+ *
+ * This provides more advanced type checking on compilers supporting
+ * the proper extensions, even in C.
+ */
+#if __has_feature(objc_fixed_enum) || __has_extension(cxx_fixed_enum) || \
+ __has_extension(cxx_strong_enums)
+#define __enum_decl(_name, _type, ...) \
+ typedef enum : _type __VA_ARGS__ __enum_open _name
+#define __enum_closed_decl(_name, _type, ...) \
+ typedef enum : _type __VA_ARGS__ __enum_closed _name
+#define __options_decl(_name, _type, ...) \
+ typedef enum : _type __VA_ARGS__ __enum_open __enum_options _name
+#define __options_closed_decl(_name, _type, ...) \
+ typedef enum : _type __VA_ARGS__ __enum_closed __enum_options _name
+#else
+#define __enum_decl(_name, _type, ...) \
+ typedef _type _name; enum __VA_ARGS__ __enum_open
+#define __enum_closed_decl(_name, _type, ...) \
+ typedef _type _name; enum __VA_ARGS__ __enum_closed
+#define __options_decl(_name, _type, ...) \
+ typedef _type _name; enum __VA_ARGS__ __enum_open __enum_options
+#define __options_closed_decl(_name, _type, ...) \
+ typedef _type _name; enum __VA_ARGS__ __enum_closed __enum_options