diff --git a/platform-include/ConditionalMacros.h b/platform-include/ConditionalMacros.h index 21337deb5..5344fb985 100644 --- a/platform-include/ConditionalMacros.h +++ b/platform-include/ConditionalMacros.h @@ -89,7 +89,6 @@ These conditionals specify whether the compiler supports particular types. TYPE_LONGLONG - Compiler supports "long long" 64-bit integers - TYPE_BOOL - Compiler supports "bool" TYPE_EXTENDED - Compiler supports "extended" 80/96 bit floating point TYPE_LONGDOUBLE_IS_DOUBLE - Compiler implements "long double" same as "double" @@ -143,11 +142,6 @@ #endif #define TYPE_LONGLONG 1 - #ifdef __cplusplus - #define TYPE_BOOL 1 - #else - #define TYPE_BOOL 0 - #endif #define FUNCTION_PASCAL 0 #define FUNCTION_DECLSPEC 0 @@ -187,11 +181,6 @@ #else #define TYPE_LONGLONG 0 #endif - #if __option(bool) - #define TYPE_BOOL 1 - #else - #define TYPE_BOOL 0 - #endif #define TYPE_EXTENDED 0 #define TYPE_LONGDOUBLE_IS_DOUBLE 1 @@ -239,9 +228,6 @@ #ifndef TYPE_LONGLONG #define TYPE_LONGLONG 0 #endif - #ifndef TYPE_BOOL - #define TYPE_BOOL 0 - #endif #ifndef FUNCTION_PASCAL #define FUNCTION_PASCAL 0 #endif diff --git a/platform-include/mach/mach_time.h b/platform-include/mach/mach_time.h index 6b03e839f..ab3588bd5 100644 --- a/platform-include/mach/mach_time.h +++ b/platform-include/mach/mach_time.h @@ -33,6 +33,8 @@ #include +#include + struct mach_timebase_info { uint32_t numer; uint32_t denom; diff --git a/platform-include/mach/vm_region.h b/platform-include/mach/vm_region.h index e649f33f4..30d0a3aa5 100644 --- a/platform-include/mach/vm_region.h +++ b/platform-include/mach/vm_region.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2000-2016 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -301,7 +301,7 @@ struct vm_read_entry { vm_size_t size; }; -#if VM32_SUPPORT +#ifdef VM32_SUPPORT struct vm32_read_entry { vm32_address_t address; vm32_size_t size; @@ -313,7 +313,7 @@ struct vm32_read_entry { typedef struct mach_vm_read_entry mach_vm_read_entry_t[VM_MAP_ENTRY_MAX]; typedef struct vm_read_entry vm_read_entry_t[VM_MAP_ENTRY_MAX]; -#if VM32_SUPPORT +#ifdef VM32_SUPPORT typedef struct vm32_read_entry vm32_read_entry_t[VM_MAP_ENTRY_MAX]; #endif diff --git a/platform-include/sys/fcntl.h b/platform-include/sys/fcntl.h index 2de689085..bd47166d8 100644 --- a/platform-include/sys/fcntl.h +++ b/platform-include/sys/fcntl.h @@ -376,7 +376,7 @@ /* file descriptor flags (F_GETFD, F_SETFD) */ #define FD_CLOEXEC 1 /* close-on-exec flag */ -#if PRIVATE +#ifdef PRIVATE #define FD_CLOFORK 2 /* close-on-fork flag */ #endif @@ -394,7 +394,7 @@ #define F_OFD_LOCK 0x400 /* Use "OFD" semantics for lock */ #endif -#if PRIVATE +#ifdef PRIVATE /* * ISOCHRONOUS attempts to sustain a minimum platform-dependent throughput * for the duration of the I/O delivered to the driver. diff --git a/platform-include/xpc/availability.h b/platform-include/xpc/availability.h index dec3a7e10..ca094ba95 100644 --- a/platform-include/xpc/availability.h +++ b/platform-include/xpc/availability.h @@ -110,7 +110,7 @@ __attribute__((availability(macosx, introduced=10.10))) #define XPC_SIMULATOR_AVAILABILITY_STRING(version) \ "Use of this interface on the iOS Simulator requires that its minimum supported OS be OS X v" version " or later." -#if __XPC_BUILDING_XPC__ +#ifdef __XPC_BUILDING_XPC__ #define __XPC_IOS_SIMULATOR_AVAILABLE_STARTING__MAC_10_7 #define __XPC_IOS_SIMULATOR_AVAILABLE_STARTING__MAC_10_8 #define __XPC_IOS_SIMULATOR_AVAILABLE_STARTING__MAC_10_9 diff --git a/platform-include/xpc/base.h b/platform-include/xpc/base.h index 084be511b..44d97f563 100644 --- a/platform-include/xpc/base.h +++ b/platform-include/xpc/base.h @@ -15,11 +15,18 @@ __BEGIN_DECLS #define __has_attribute(x) 0 #endif // !defined(__has_attribute) +#if !defined(__has_feature) +#define __has_feature(x) 0 +#endif // !defined(__has_feature) + +#if !defined(__has_extension) +#define __has_extension(x) 0 +#endif // !defined(__has_extension) + #if __has_include() #include #else // __has_include() #include -#define __XPC_IOS_SIMULATOR_AVAILABLE_STARTING(version) #endif // __has_include() #if XPC_SERVICE_MAIN_IN_LIBXPC @@ -61,6 +68,12 @@ __BEGIN_DECLS #define XPC_NOINLINE __attribute__((noinline)) #define XPC_NOIMPL __attribute__((unavailable)) +#if __has_attribute(noescape) +#define XPC_NOESCAPE __attribute__((__noescape__)) +#else +#define XPC_NOESCAPE +#endif + #if __has_extension(attribute_unavailable_with_message) #define XPC_UNAVAILABLE(m) __attribute__((unavailable(m))) #else // __has_extension(attribute_unavailable_with_message) @@ -78,6 +91,12 @@ __BEGIN_DECLS #define XPC_DEPRECATED(m) __attribute__((deprecated)) #endif // __clang +#if __XPC_TEST__ +#define XPC_TESTSTATIC +#else // __XPC_TEST__ +#define XPC_TESTSTATIC static +#endif // __XPC_TEST__ + #if __has_feature(objc_arc) #define XPC_GIVES_REFERENCE __strong #define XPC_UNRETAINED __unsafe_unretained @@ -89,7 +108,7 @@ __BEGIN_DECLS #else // __has_feature(objc_arc) #define XPC_GIVES_REFERENCE #define XPC_UNRETAINED -#define XPC_BRIDGE(xo) +#define XPC_BRIDGE(xo) (xo) #define XPC_BRIDGEREF_BEGIN(xo) (xo) #define XPC_BRIDGEREF_BEGIN_WITH_REF(xo) (xo) #define XPC_BRIDGEREF_MIDDLE(xo) (xo) @@ -158,7 +177,23 @@ __BEGIN_DECLS #define XPC_DEPRECATED /*! @parseOnly */ #define XPC_UNAVAILABLE(m) -#endif // __GNUC__ +/*! @parseOnly */ +#define XPC_NOESCAPE +#endif // __GNUC__ + +#if __has_feature(assume_nonnull) +#define XPC_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") +#define XPC_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") +#else +#define XPC_ASSUME_NONNULL_BEGIN +#define XPC_ASSUME_NONNULL_END +#endif + +#if __has_feature(nullability_on_arrays) +#define XPC_NONNULL_ARRAY _Nonnull +#else +#define XPC_NONNULL_ARRAY +#endif __END_DECLS diff --git a/platform-include/xpc/xpc.h b/platform-include/xpc/xpc.h index 5e8a27191..df2ca8a5c 100644 --- a/platform-include/xpc/xpc.h +++ b/platform-include/xpc/xpc.h @@ -18,18 +18,19 @@ #include #include -__BEGIN_DECLS - -#ifndef __OSX_AVAILABLE_STARTING -#define __OSX_AVAILABLE_STARTING(x, y) -#endif // __OSX_AVAILABLE_STARTING - #ifndef __XPC_INDIRECT__ #define __XPC_INDIRECT__ #endif // __XPC_INDIRECT__ #include +XPC_ASSUME_NONNULL_BEGIN +__BEGIN_DECLS + +#ifndef __OSX_AVAILABLE_STARTING +#define __OSX_AVAILABLE_STARTING(x, y) +#endif // __OSX_AVAILABLE_STARTING + #define XPC_API_VERSION 20121012 /*! @@ -105,8 +106,7 @@ typedef void (^xpc_handler_t)(xpc_object_t object); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_TYPE(_xpc_type_connection); -//XPC_DECL(xpc_connection); -typedef xpc_object_t xpc_connection_t; +XPC_DECL(xpc_connection); /*! * @typedef xpc_connection_handler_t @@ -320,6 +320,7 @@ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT const char *const _xpc_event_key_name; +XPC_ASSUME_NONNULL_END #ifndef __XPC_BUILDING_XPC__ #include #include @@ -329,7 +330,8 @@ const char *const _xpc_event_key_name; #endif // __BLOCKS__ #undef __XPC_INDIRECT__ #include -#endif // __XPC_BUILDING_XPC__ +#endif // __XPC_BUILDING_XPC__ +XPC_ASSUME_NONNULL_BEGIN #pragma mark XPC Object Protocol /*! @@ -423,7 +425,7 @@ xpc_get_type(xpc_object_t object); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_NONNULL_ALL XPC_WARN_RESULT XPC_RETURNS_RETAINED -xpc_object_t +xpc_object_t _Nullable xpc_copy(xpc_object_t object); /*! @@ -732,7 +734,7 @@ xpc_date_get_value(xpc_object_t xdate); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_object_t -xpc_data_create(const void *bytes, size_t length); +xpc_data_create(const void * _Nullable bytes, size_t length); /*! * @function xpc_data_create_with_dispatch_data @@ -791,7 +793,7 @@ xpc_data_get_length(xpc_object_t xdata); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 -const void * +const void * _Nullable xpc_data_get_bytes_ptr(xpc_object_t xdata); /*! @@ -922,7 +924,7 @@ xpc_string_get_length(xpc_object_t xstring); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 -const char * +const char * _Nullable xpc_string_get_string_ptr(xpc_object_t xstring); #pragma mark UUID @@ -940,9 +942,9 @@ xpc_string_get_string_ptr(xpc_object_t xstring); * A new UUID object. */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) -XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT +XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT XPC_NONNULL1 xpc_object_t -xpc_uuid_create(const uuid_t uuid); +xpc_uuid_create(const uuid_t XPC_NONNULL_ARRAY uuid); /*! * @function xpc_uuid_get_bytes @@ -960,7 +962,7 @@ xpc_uuid_create(const uuid_t uuid); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_NONNULL1 -const uint8_t * +const uint8_t * _Nullable xpc_uuid_get_bytes(xpc_object_t xuuid); #pragma mark File Descriptors @@ -994,7 +996,7 @@ xpc_uuid_get_bytes(xpc_object_t xuuid); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT -xpc_object_t +xpc_object_t _Nullable xpc_fd_create(int fd); /*! @@ -1093,7 +1095,7 @@ xpc_shmem_create(void *region, size_t length); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL size_t -xpc_shmem_map(xpc_object_t xshmem, void **region); +xpc_shmem_map(xpc_object_t xshmem, void * _Nullable * _Nonnull region); #pragma mark Array /*! @@ -1110,7 +1112,7 @@ xpc_shmem_map(xpc_object_t xshmem, void **region); * A Boolean indicating whether iteration should continue. */ #ifdef __BLOCKS__ -typedef bool (^xpc_array_applier_t)(size_t index, xpc_object_t value); +typedef bool (^xpc_array_applier_t)(size_t index, xpc_object_t _Nonnull value); #endif // __BLOCKS__ /*! @@ -1141,7 +1143,7 @@ typedef bool (^xpc_array_applier_t)(size_t index, xpc_object_t value); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_object_t -xpc_array_create(const xpc_object_t *objects, size_t count); +xpc_array_create(const xpc_object_t _Nonnull * _Nullable objects, size_t count); /*! * @function xpc_array_set_value @@ -1252,7 +1254,7 @@ xpc_array_get_value(xpc_object_t xarray, size_t index); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_NONNULL_ALL bool -xpc_array_apply(xpc_object_t xarray, xpc_array_applier_t applier); +xpc_array_apply(xpc_object_t xarray, XPC_NOESCAPE xpc_array_applier_t applier); #endif // __BLOCKS__ #pragma mark Array Primitive Setters @@ -1464,9 +1466,10 @@ xpc_array_set_string(xpc_object_t xarray, size_t index, const char *string); * {@link xpc_array_get_value()}. */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) -XPC_EXPORT XPC_NONNULL1 +XPC_EXPORT XPC_NONNULL1 XPC_NONNULL3 void -xpc_array_set_uuid(xpc_object_t xarray, size_t index, const uuid_t uuid); +xpc_array_set_uuid(xpc_object_t xarray, size_t index, + const uuid_t XPC_NONNULL_ARRAY uuid); /*! * @function xpc_array_set_fd @@ -1514,7 +1517,7 @@ xpc_array_set_fd(xpc_object_t xarray, size_t index, int fd); * {@link xpc_array_get_value()}. The connection is NOT retained by the array. */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) -XPC_EXPORT XPC_NONNULL1 +XPC_EXPORT XPC_NONNULL1 XPC_NONNULL3 void xpc_array_set_connection(xpc_object_t xarray, size_t index, xpc_connection_t connection); @@ -1659,8 +1662,9 @@ xpc_array_get_date(xpc_object_t xarray, size_t index); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 -const void * -xpc_array_get_data(xpc_object_t xarray, size_t index, size_t *length); +const void * _Nullable +xpc_array_get_data(xpc_object_t xarray, size_t index, + size_t * _Nullable length); /*! * @function xpc_array_get_string @@ -1682,7 +1686,7 @@ xpc_array_get_data(xpc_object_t xarray, size_t index, size_t *length); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 -const char * +const char * _Nullable xpc_array_get_string(xpc_object_t xarray, size_t index); /*! @@ -1706,7 +1710,7 @@ xpc_array_get_string(xpc_object_t xarray, size_t index); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 -const uint8_t * +const uint8_t * _Nullable xpc_array_get_uuid(xpc_object_t xarray, size_t index); /*! @@ -1758,9 +1762,63 @@ xpc_array_dup_fd(xpc_object_t xarray, size_t index); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT XPC_NONNULL1 -xpc_connection_t +xpc_connection_t _Nullable xpc_array_create_connection(xpc_object_t xarray, size_t index); +/*! + * @function xpc_array_get_dictionary + * + * @abstract + * Returns the dictionary at the specified index in the array. + * + * @param xarray + * The array object which is to be examined. + * + * @param index + * The index of the value to obtain. This value must lie within the range of + * indexes as specified in xpc_array_set_value(). + * + * @result + * The object at the specified index within the array or NULL if the given + * object was not an XPC array or if the the value at the specified index was + * not a dictionary. + * + * @discussion + * This method does not grant the caller a reference to the underlying object, + * and thus the caller is not responsible for releasing the object. + */ +__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0) +XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL +xpc_object_t _Nullable +xpc_array_get_dictionary(xpc_object_t self, size_t index); + +/*! + * @function xpc_array_get_array + * + * @abstract + * Returns the array at the specified index in the array. + * + * @param xarray + * The array object which is to be examined. + * + * @param index + * The index of the value to obtain. This value must lie within the range of + * indexes as specified in xpc_array_set_value(). + * + * @result + * The object at the specified index within the array or NULL if the given + * object was not an XPC array or if the the value at the specified index was + * not an array. + * + * @discussion + * This method does not grant the caller a reference to the underlying object, + * and thus the caller is not responsible for releasing the object. + */ +__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0) +XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL +xpc_object_t _Nullable +xpc_array_get_array(xpc_object_t self, size_t index); + #pragma mark Dictionary /*! * @typedef xpc_dictionary_applier_t @@ -1776,7 +1834,8 @@ xpc_array_create_connection(xpc_object_t xarray, size_t index); * A Boolean indicating whether iteration should continue. */ #ifdef __BLOCKS__ -typedef bool (^xpc_dictionary_applier_t)(const char *key, xpc_object_t value); +typedef bool (^xpc_dictionary_applier_t)(const char * _Nonnull key, + xpc_object_t _Nonnull value); #endif // __BLOCKS__ /*! @@ -1789,7 +1848,7 @@ typedef bool (^xpc_dictionary_applier_t)(const char *key, xpc_object_t value); * @param keys * An array of C-strings that are to be the keys for the values to be inserted. * Each element of this array is copied into the dictionary's internal storage. - * If any element of this array is NULL, the behavior is undefined. + * Elements of this array may NOT be NULL. * * @param values * A C-array that is parallel to the array of keys, consisting of objects that @@ -1812,8 +1871,8 @@ typedef bool (^xpc_dictionary_applier_t)(const char *key, xpc_object_t value); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_object_t -xpc_dictionary_create(const char * const *keys, const xpc_object_t *values, - size_t count); +xpc_dictionary_create(const char * _Nonnull const * _Nullable keys, + const xpc_object_t _Nullable * _Nullable values, size_t count); /*! * @function xpc_dictionary_create_reply @@ -1837,7 +1896,7 @@ xpc_dictionary_create(const char * const *keys, const xpc_object_t *values, */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT XPC_NONNULL_ALL -xpc_object_t +xpc_object_t _Nullable xpc_dictionary_create_reply(xpc_object_t original); /*! @@ -1862,7 +1921,7 @@ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 void xpc_dictionary_set_value(xpc_object_t xdict, const char *key, - xpc_object_t value); + xpc_object_t _Nullable value); /*! * @function xpc_dictionary_get_value @@ -1887,7 +1946,7 @@ xpc_dictionary_set_value(xpc_object_t xdict, const char *key, */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 XPC_NONNULL2 -xpc_object_t +xpc_object_t _Nullable xpc_dictionary_get_value(xpc_object_t xdict, const char *key); /*! @@ -1935,7 +1994,8 @@ xpc_dictionary_get_count(xpc_object_t xdict); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_NONNULL_ALL bool -xpc_dictionary_apply(xpc_object_t xdict, xpc_dictionary_applier_t applier); +xpc_dictionary_apply(xpc_object_t xdict, + XPC_NOESCAPE xpc_dictionary_applier_t applier); #endif // __BLOCKS__ /*! @@ -1955,7 +2015,7 @@ xpc_dictionary_apply(xpc_object_t xdict, xpc_dictionary_applier_t applier); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL -xpc_connection_t +xpc_connection_t _Nullable xpc_dictionary_get_remote_connection(xpc_object_t xdict); #pragma mark Dictionary Primitive Setters @@ -2090,7 +2150,7 @@ xpc_dictionary_set_date(xpc_object_t xdict, const char *key, int64_t value); * The length of the data. */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) -XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 +XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 XPC_NONNULL3 void xpc_dictionary_set_data(xpc_object_t xdict, const char *key, const void *bytes, size_t length); @@ -2113,7 +2173,7 @@ xpc_dictionary_set_data(xpc_object_t xdict, const char *key, const void *bytes, * {@link xpc_dictionary_get_value()}. */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) -XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 +XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 XPC_NONNULL3 void xpc_dictionary_set_string(xpc_object_t xdict, const char *key, const char *string); @@ -2136,9 +2196,10 @@ xpc_dictionary_set_string(xpc_object_t xdict, const char *key, * with {@link xpc_dictionary_get_value()}. */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) -XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 +XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 XPC_NONNULL3 void -xpc_dictionary_set_uuid(xpc_object_t xdict, const char *key, const uuid_t uuid); +xpc_dictionary_set_uuid(xpc_object_t xdict, const char *key, + const uuid_t XPC_NONNULL_ARRAY uuid); /*! * @function xpc_dictionary_set_fd @@ -2181,7 +2242,7 @@ xpc_dictionary_set_fd(xpc_object_t xdict, const char *key, int fd); * the dictionary. */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) -XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 +XPC_EXPORT XPC_NONNULL1 XPC_NONNULL2 XPC_NONNULL3 void xpc_dictionary_set_connection(xpc_object_t xdict, const char *key, xpc_connection_t connection); @@ -2320,8 +2381,9 @@ xpc_dictionary_get_date(xpc_object_t xdict, const char *key); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 -const void * -xpc_dictionary_get_data(xpc_object_t xdict, const char *key, size_t *length); +const void * _Nullable +xpc_dictionary_get_data(xpc_object_t xdict, const char *key, + size_t * _Nullable length); /*! * @function xpc_dictionary_get_string @@ -2342,7 +2404,7 @@ xpc_dictionary_get_data(xpc_object_t xdict, const char *key, size_t *length); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL -const char * +const char * _Nullable xpc_dictionary_get_string(xpc_object_t xdict, const char *key); /*! @@ -2364,7 +2426,7 @@ xpc_dictionary_get_string(xpc_object_t xdict, const char *key); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL1 XPC_NONNULL2 -const uint8_t * +const uint8_t * _Nullable xpc_dictionary_get_uuid(xpc_object_t xdict, const char *key); /*! @@ -2413,9 +2475,61 @@ xpc_dictionary_dup_fd(xpc_object_t xdict, const char *key); */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_MALLOC XPC_RETURNS_RETAINED XPC_WARN_RESULT XPC_NONNULL_ALL -xpc_connection_t +xpc_connection_t _Nullable xpc_dictionary_create_connection(xpc_object_t xdict, const char *key); +/*! + * @function xpc_dictionary_get_dictionary + * + * @abstract + * Returns the dictionary value for the specified key. + * + * @param xdict + * The dictionary object which is to be examined. + * + * @param key + * The key whose value is to be obtained. + * + * @result + * The object for the specified key within the dictionary. NULL if there is no + * value associated with the specified key, if the given object was not an + * XPC dictionary, or if the object for the specified key is not a dictionary. + * + * @discussion + * This method does not grant the caller a reference to the underlying object, + * and thus the caller is not responsible for releasing the object. + */ +__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0) +XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL +xpc_object_t _Nullable +xpc_dictionary_get_dictionary(xpc_object_t self, const char *key); + +/*! + * @function xpc_dictionary_get_array + * + * @abstract + * Returns the array value for the specified key. + * + * @param xdict + * The dictionary object which is to be examined. + * + * @param key + * The key whose value is to be obtained. + * + * @result + * The object for the specified key within the dictionary. NULL if there is no + * value associated with the specified key, if the given object was not an + * XPC dictionary, or if the object for the specified key is not an array. + * + * @discussion + * This method does not grant the caller a reference to the underlying object, + * and thus the caller is not responsible for releasing the object. + */ +__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0) +XPC_EXPORT XPC_WARN_RESULT XPC_NONNULL_ALL +xpc_object_t _Nullable +xpc_dictionary_get_array(xpc_object_t self, const char *key); + #pragma mark Runtime /*! * @function xpc_main @@ -2467,11 +2581,11 @@ xpc_service_main(int argc, const char *argv[], * and xpc_transaction_end() to inform the XPC runtime about activity that * occurs outside of this common pattern. * - * When the XPC runtime has determined that the service should exit, the event - * handlers for all active peer connections will receive + * On macOS, when the XPC runtime has determined that the service should exit, + * the event handlers for all active peer connections will receive * {@link XPC_ERROR_TERMINATION_IMMINENT} as an indication that they should * unwind their existing transactions. After this error is delivered to a - * connection's event handler, no more messages will be delivered to the + * connection's event handler, no more messages will be delivered to the * connection. */ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) @@ -2523,10 +2637,11 @@ xpc_transaction_end(void); __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0) XPC_EXPORT XPC_NONNULL1 XPC_NONNULL3 void -xpc_set_event_stream_handler(const char *stream, dispatch_queue_t targetq, - xpc_handler_t handler); +xpc_set_event_stream_handler(const char *stream, + dispatch_queue_t _Nullable targetq, xpc_handler_t handler); #endif // __BLOCKS__ __END_DECLS +XPC_ASSUME_NONNULL_END #endif // __XPC_H__ diff --git a/src/libunwind/include/pthread_machdep.h b/src/libunwind/include/pthread_machdep.h new file mode 120000 index 000000000..229a0914b --- /dev/null +++ b/src/libunwind/include/pthread_machdep.h @@ -0,0 +1 @@ +../System/pthread_machdep.h \ No newline at end of file diff --git a/src/sandbox/include/sandbox/private.h b/src/sandbox/include/sandbox/private.h new file mode 120000 index 000000000..944cfc840 --- /dev/null +++ b/src/sandbox/include/sandbox/private.h @@ -0,0 +1 @@ +../../private.h \ No newline at end of file diff --git a/src/sandbox/include/sandbox/sandbox.h b/src/sandbox/include/sandbox/sandbox.h new file mode 120000 index 000000000..40ec2a635 --- /dev/null +++ b/src/sandbox/include/sandbox/sandbox.h @@ -0,0 +1 @@ +../../sandbox.h \ No newline at end of file diff --git a/src/sandbox/private.h b/src/sandbox/private.h index e69de29bb..d9e3509d9 100644 --- a/src/sandbox/private.h +++ b/src/sandbox/private.h @@ -0,0 +1 @@ +#include