diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2020-12-19 12:13:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-19 12:13:03 +0100 |
| commit | b090451646904006ac41b2b99e532489d89ea837 (patch) | |
| tree | b0a5ec423dc42f5bf6dcf533b90f8c67a69e9b99 /lib/libc/include/x86_64-macos-gnu/dispatch | |
| parent | 506af7e52e0985b410ea089bf5fa3247ab2377cb (diff) | |
| parent | 3f81ddb735bfc8e6fb1776df7407ace213816252 (diff) | |
| download | zig-b090451646904006ac41b2b99e532489d89ea837.tar.gz zig-b090451646904006ac41b2b99e532489d89ea837.zip | |
Merge pull request #7318 from kubkon/cc-macho
stage1: cross compile to x86_64 and arm64 macOS from anywhere with LLVM
Diffstat (limited to 'lib/libc/include/x86_64-macos-gnu/dispatch')
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/base.h | 306 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/block.h | 2 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/data.h | 278 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/dispatch.h | 2 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/group.h | 2 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/io.h | 597 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/object.h | 2 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/once.h | 125 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/queue.h | 2 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/semaphore.h | 2 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/source.h | 2 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/time.h | 136 | ||||
| -rw-r--r-- | lib/libc/include/x86_64-macos-gnu/dispatch/workloop.h | 2 |
13 files changed, 8 insertions, 1450 deletions
diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/base.h b/lib/libc/include/x86_64-macos-gnu/dispatch/base.h deleted file mode 100644 index 8ede9615bc..0000000000 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/base.h +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2008-2012 Apple Inc. All rights reserved. - * - * @APPLE_APACHE_LICENSE_HEADER_START@ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @APPLE_APACHE_LICENSE_HEADER_END@ - */ - -#ifndef __DISPATCH_BASE__ -#define __DISPATCH_BASE__ - -#ifndef __DISPATCH_INDIRECT__ -#error "Please #include <dispatch/dispatch.h> instead of this file directly." -#endif - -#ifndef __has_builtin -#define __has_builtin(x) 0 -#endif -#ifndef __has_include -#define __has_include(x) 0 -#endif -#ifndef __has_feature -#define __has_feature(x) 0 -#endif -#ifndef __has_attribute -#define __has_attribute(x) 0 -#endif -#ifndef __has_extension -#define __has_extension(x) 0 -#endif - -#if __GNUC__ -#define DISPATCH_NORETURN __attribute__((__noreturn__)) -#define DISPATCH_NOTHROW __attribute__((__nothrow__)) -#define DISPATCH_NONNULL1 __attribute__((__nonnull__(1))) -#define DISPATCH_NONNULL2 __attribute__((__nonnull__(2))) -#define DISPATCH_NONNULL3 __attribute__((__nonnull__(3))) -#define DISPATCH_NONNULL4 __attribute__((__nonnull__(4))) -#define DISPATCH_NONNULL5 __attribute__((__nonnull__(5))) -#define DISPATCH_NONNULL6 __attribute__((__nonnull__(6))) -#define DISPATCH_NONNULL7 __attribute__((__nonnull__(7))) -#if __clang__ && __clang_major__ < 3 -// rdar://problem/6857843 -#define DISPATCH_NONNULL_ALL -#else -#define DISPATCH_NONNULL_ALL __attribute__((__nonnull__)) -#endif -#define DISPATCH_SENTINEL __attribute__((__sentinel__)) -#define DISPATCH_PURE __attribute__((__pure__)) -#define DISPATCH_CONST __attribute__((__const__)) -#define DISPATCH_WARN_RESULT __attribute__((__warn_unused_result__)) -#define DISPATCH_MALLOC __attribute__((__malloc__)) -#define DISPATCH_ALWAYS_INLINE __attribute__((__always_inline__)) -#define DISPATCH_UNAVAILABLE __attribute__((__unavailable__)) -#define DISPATCH_UNAVAILABLE_MSG(msg) __attribute__((__unavailable__(msg))) -#elif defined(_MSC_VER) -#define DISPATCH_NORETURN __declspec(noreturn) -#define DISPATCH_NOTHROW __declspec(nothrow) -#define DISPATCH_NONNULL1 -#define DISPATCH_NONNULL2 -#define DISPATCH_NONNULL3 -#define DISPATCH_NONNULL4 -#define DISPATCH_NONNULL5 -#define DISPATCH_NONNULL6 -#define DISPATCH_NONNULL7 -#define DISPATCH_NONNULL_ALL -#define DISPATCH_SENTINEL -#define DISPATCH_PURE -#define DISPATCH_CONST -#if (_MSC_VER >= 1700) -#define DISPATCH_WARN_RESULT _Check_return_ -#else -#define DISPATCH_WARN_RESULT -#endif -#define DISPATCH_MALLOC -#define DISPATCH_ALWAYS_INLINE __forceinline -#define DISPATCH_UNAVAILABLE -#define DISPATCH_UNAVAILABLE_MSG(msg) -#else -/*! @parseOnly */ -#define DISPATCH_NORETURN -/*! @parseOnly */ -#define DISPATCH_NOTHROW -/*! @parseOnly */ -#define DISPATCH_NONNULL1 -/*! @parseOnly */ -#define DISPATCH_NONNULL2 -/*! @parseOnly */ -#define DISPATCH_NONNULL3 -/*! @parseOnly */ -#define DISPATCH_NONNULL4 -/*! @parseOnly */ -#define DISPATCH_NONNULL5 -/*! @parseOnly */ -#define DISPATCH_NONNULL6 -/*! @parseOnly */ -#define DISPATCH_NONNULL7 -/*! @parseOnly */ -#define DISPATCH_NONNULL_ALL -/*! @parseOnly */ -#define DISPATCH_SENTINEL -/*! @parseOnly */ -#define DISPATCH_PURE -/*! @parseOnly */ -#define DISPATCH_CONST -/*! @parseOnly */ -#define DISPATCH_WARN_RESULT -/*! @parseOnly */ -#define DISPATCH_MALLOC -/*! @parseOnly */ -#define DISPATCH_ALWAYS_INLINE -/*! @parseOnly */ -#define DISPATCH_UNAVAILABLE -/*! @parseOnly */ -#define DISPATCH_UNAVAILABLE_MSG(msg) -#endif - -#define DISPATCH_LINUX_UNAVAILABLE() - -#ifdef __FreeBSD__ -#define DISPATCH_FREEBSD_UNAVAILABLE() \ - DISPATCH_UNAVAILABLE_MSG( \ - "This interface is unavailable on FreeBSD systems") -#else -#define DISPATCH_FREEBSD_UNAVAILABLE() -#endif - -#ifndef DISPATCH_ALIAS_V2 -#if TARGET_OS_MAC -#define DISPATCH_ALIAS_V2(sym) __asm__("_" #sym "$V2") -#else -#define DISPATCH_ALIAS_V2(sym) -#endif -#endif - -#if defined(_WIN32) -#if defined(__cplusplus) -#define DISPATCH_EXPORT extern "C" __declspec(dllimport) -#else -#define DISPATCH_EXPORT extern __declspec(dllimport) -#endif -#elif __GNUC__ -#define DISPATCH_EXPORT extern __attribute__((visibility("default"))) -#else -#define DISPATCH_EXPORT extern -#endif - -#if __GNUC__ -#define DISPATCH_INLINE static __inline__ -#else -#define DISPATCH_INLINE static inline -#endif - -#if __GNUC__ -#define DISPATCH_EXPECT(x, v) __builtin_expect((x), (v)) -#define dispatch_compiler_barrier() __asm__ __volatile__("" ::: "memory") -#else -#define DISPATCH_EXPECT(x, v) (x) -#define dispatch_compiler_barrier() do { } while (0) -#endif - -#if __has_attribute(not_tail_called) -#define DISPATCH_NOT_TAIL_CALLED __attribute__((__not_tail_called__)) -#else -#define DISPATCH_NOT_TAIL_CALLED -#endif - -#if __has_builtin(__builtin_assume) -#define DISPATCH_COMPILER_CAN_ASSUME(expr) __builtin_assume(expr) -#else -#define DISPATCH_COMPILER_CAN_ASSUME(expr) ((void)(expr)) -#endif - -#if __has_attribute(noescape) -#define DISPATCH_NOESCAPE __attribute__((__noescape__)) -#else -#define DISPATCH_NOESCAPE -#endif - -#if __has_attribute(cold) -#define DISPATCH_COLD __attribute__((__cold__)) -#else -#define DISPATCH_COLD -#endif - -#if __has_feature(assume_nonnull) -#define DISPATCH_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") -#define DISPATCH_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") -#else -#define DISPATCH_ASSUME_NONNULL_BEGIN -#define DISPATCH_ASSUME_NONNULL_END -#endif - -#if !__has_feature(nullability) -#ifndef _Nullable -#define _Nullable -#endif -#ifndef _Nonnull -#define _Nonnull -#endif -#ifndef _Null_unspecified -#define _Null_unspecified -#endif -#endif - -#ifndef DISPATCH_RETURNS_RETAINED_BLOCK -#if __has_attribute(ns_returns_retained) -#define DISPATCH_RETURNS_RETAINED_BLOCK __attribute__((__ns_returns_retained__)) -#else -#define DISPATCH_RETURNS_RETAINED_BLOCK -#endif -#endif - -#if __has_attribute(enum_extensibility) -#define __DISPATCH_ENUM_ATTR __attribute__((__enum_extensibility__(open))) -#define __DISPATCH_ENUM_ATTR_CLOSED __attribute__((__enum_extensibility__(closed))) -#else -#define __DISPATCH_ENUM_ATTR -#define __DISPATCH_ENUM_ATTR_CLOSED -#endif // __has_attribute(enum_extensibility) - -#if __has_attribute(flag_enum) -#define __DISPATCH_OPTIONS_ATTR __attribute__((__flag_enum__)) -#else -#define __DISPATCH_OPTIONS_ATTR -#endif // __has_attribute(flag_enum) - - -#if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums) || \ - __has_extension(cxx_fixed_enum) || defined(_WIN32) -#define DISPATCH_ENUM(name, type, ...) \ - typedef enum : type { __VA_ARGS__ } __DISPATCH_ENUM_ATTR name##_t -#define DISPATCH_OPTIONS(name, type, ...) \ - typedef enum : type { __VA_ARGS__ } __DISPATCH_OPTIONS_ATTR __DISPATCH_ENUM_ATTR name##_t -#else -#define DISPATCH_ENUM(name, type, ...) \ - enum { __VA_ARGS__ } __DISPATCH_ENUM_ATTR; typedef type name##_t -#define DISPATCH_OPTIONS(name, type, ...) \ - enum { __VA_ARGS__ } __DISPATCH_OPTIONS_ATTR __DISPATCH_ENUM_ATTR; typedef type name##_t -#endif // __has_feature(objc_fixed_enum) ... - - - -#if __has_feature(enumerator_attributes) -#define DISPATCH_ENUM_API_AVAILABLE(...) API_AVAILABLE(__VA_ARGS__) -#define DISPATCH_ENUM_API_DEPRECATED(...) API_DEPRECATED(__VA_ARGS__) -#define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...) \ - API_DEPRECATED_WITH_REPLACEMENT(__VA_ARGS__) -#else -#define DISPATCH_ENUM_API_AVAILABLE(...) -#define DISPATCH_ENUM_API_DEPRECATED(...) -#define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...) -#endif - -#ifdef __swift__ -#define DISPATCH_SWIFT3_OVERLAY 1 -#else // __swift__ -#define DISPATCH_SWIFT3_OVERLAY 0 -#endif // __swift__ - -#if __has_feature(attribute_availability_swift) -#define DISPATCH_SWIFT_UNAVAILABLE(_msg) \ - __attribute__((__availability__(swift, unavailable, message=_msg))) -#else -#define DISPATCH_SWIFT_UNAVAILABLE(_msg) -#endif - -#if DISPATCH_SWIFT3_OVERLAY -#define DISPATCH_SWIFT3_UNAVAILABLE(_msg) DISPATCH_SWIFT_UNAVAILABLE(_msg) -#else -#define DISPATCH_SWIFT3_UNAVAILABLE(_msg) -#endif - -#if __has_attribute(swift_private) -#define DISPATCH_REFINED_FOR_SWIFT __attribute__((__swift_private__)) -#else -#define DISPATCH_REFINED_FOR_SWIFT -#endif - -#if __has_attribute(swift_name) -#define DISPATCH_SWIFT_NAME(_name) __attribute__((__swift_name__(#_name))) -#else -#define DISPATCH_SWIFT_NAME(_name) -#endif - -#ifndef __cplusplus -#define DISPATCH_TRANSPARENT_UNION __attribute__((__transparent_union__)) -#else -#define DISPATCH_TRANSPARENT_UNION -#endif - -typedef void (*dispatch_function_t)(void *_Nullable); - -#endif diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/block.h b/lib/libc/include/x86_64-macos-gnu/dispatch/block.h index 4d6f5b5489..5a28f48ce4 100644 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/block.h +++ b/lib/libc/include/x86_64-macos-gnu/dispatch/block.h @@ -425,4 +425,4 @@ DISPATCH_ASSUME_NONNULL_END #endif // __BLOCKS__ -#endif // __DISPATCH_BLOCK__ +#endif // __DISPATCH_BLOCK__
\ No newline at end of file diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/data.h b/lib/libc/include/x86_64-macos-gnu/dispatch/data.h deleted file mode 100644 index 8250669183..0000000000 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/data.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) 2009-2013 Apple Inc. All rights reserved. - * - * @APPLE_APACHE_LICENSE_HEADER_START@ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @APPLE_APACHE_LICENSE_HEADER_END@ - */ - -#ifndef __DISPATCH_DATA__ -#define __DISPATCH_DATA__ - -#ifndef __DISPATCH_INDIRECT__ -#error "Please #include <dispatch/dispatch.h> instead of this file directly." -#include <dispatch/base.h> // for HeaderDoc -#endif - -DISPATCH_ASSUME_NONNULL_BEGIN - -__BEGIN_DECLS - -/*! @header - * Dispatch data objects describe contiguous or sparse regions of memory that - * may be managed by the system or by the application. - * Dispatch data objects are immutable, any direct access to memory regions - * represented by dispatch objects must not modify that memory. - */ - -/*! - * @typedef dispatch_data_t - * A dispatch object representing memory regions. - */ -DISPATCH_DATA_DECL(dispatch_data); - -/*! - * @var dispatch_data_empty - * @discussion The singleton dispatch data object representing a zero-length - * memory region. - */ -#define dispatch_data_empty \ - DISPATCH_GLOBAL_OBJECT(dispatch_data_t, _dispatch_data_empty) -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT struct dispatch_data_s _dispatch_data_empty; - -/*! - * @const DISPATCH_DATA_DESTRUCTOR_DEFAULT - * @discussion The default destructor for dispatch data objects. - * Used at data object creation to indicate that the supplied buffer should - * be copied into internal storage managed by the system. - */ -#define DISPATCH_DATA_DESTRUCTOR_DEFAULT NULL - -#ifdef __BLOCKS__ -/*! @parseOnly */ -#define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \ - DISPATCH_EXPORT const dispatch_block_t _dispatch_data_destructor_##name -#else -#define DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(name) \ - DISPATCH_EXPORT const dispatch_function_t \ - _dispatch_data_destructor_##name -#endif /* __BLOCKS__ */ - -/*! - * @const DISPATCH_DATA_DESTRUCTOR_FREE - * @discussion The destructor for dispatch data objects created from a malloc'd - * buffer. Used at data object creation to indicate that the supplied buffer - * was allocated by the malloc() family and should be destroyed with free(3). - */ -#define DISPATCH_DATA_DESTRUCTOR_FREE (_dispatch_data_destructor_free) -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(free); - -/*! - * @const DISPATCH_DATA_DESTRUCTOR_MUNMAP - * @discussion The destructor for dispatch data objects that have been created - * from buffers that require deallocation with munmap(2). - */ -#define DISPATCH_DATA_DESTRUCTOR_MUNMAP (_dispatch_data_destructor_munmap) -API_AVAILABLE(macos(10.9), ios(7.0)) -DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(munmap); - -#ifdef __BLOCKS__ -/*! - * @function dispatch_data_create - * Creates a dispatch data object from the given contiguous buffer of memory. If - * a non-default destructor is provided, ownership of the buffer remains with - * the caller (i.e. the bytes will not be copied). The last release of the data - * object will result in the invocation of the specified destructor on the - * specified queue to free the buffer. - * - * If the DISPATCH_DATA_DESTRUCTOR_FREE destructor is provided the buffer will - * be freed via free(3) and the queue argument ignored. - * - * If the DISPATCH_DATA_DESTRUCTOR_DEFAULT destructor is provided, data object - * creation will copy the buffer into internal memory managed by the system. - * - * @param buffer A contiguous buffer of data. - * @param size The size of the contiguous buffer of data. - * @param queue The queue to which the destructor should be submitted. - * @param destructor The destructor responsible for freeing the data when it - * is no longer needed. - * @result A newly created dispatch data object. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_data_t -dispatch_data_create(const void *buffer, - size_t size, - dispatch_queue_t _Nullable queue, - dispatch_block_t _Nullable destructor); -#endif /* __BLOCKS__ */ - -/*! - * @function dispatch_data_get_size - * Returns the logical size of the memory region(s) represented by the specified - * dispatch data object. - * - * @param data The dispatch data object to query. - * @result The number of bytes represented by the data object. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_PURE DISPATCH_NONNULL1 DISPATCH_NOTHROW -size_t -dispatch_data_get_size(dispatch_data_t data); - -/*! - * @function dispatch_data_create_map - * Maps the memory represented by the specified dispatch data object as a single - * contiguous memory region and returns a new data object representing it. - * If non-NULL references to a pointer and a size variable are provided, they - * are filled with the location and extent of that region. These allow direct - * read access to the represented memory, but are only valid until the returned - * object is released. Under ARC, if that object is held in a variable with - * automatic storage, care needs to be taken to ensure that it is not released - * by the compiler before memory access via the pointer has been completed. - * - * @param data The dispatch data object to map. - * @param buffer_ptr A pointer to a pointer variable to be filled with the - * location of the mapped contiguous memory region, or - * NULL. - * @param size_ptr A pointer to a size_t variable to be filled with the - * size of the mapped contiguous memory region, or NULL. - * @result A newly created dispatch data object. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED -DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_data_t -dispatch_data_create_map(dispatch_data_t data, - const void *_Nullable *_Nullable buffer_ptr, - size_t *_Nullable size_ptr); - -/*! - * @function dispatch_data_create_concat - * Returns a new dispatch data object representing the concatenation of the - * specified data objects. Those objects may be released by the application - * after the call returns (however, the system might not deallocate the memory - * region(s) described by them until the newly created object has also been - * released). - * - * @param data1 The data object representing the region(s) of memory to place - * at the beginning of the newly created object. - * @param data2 The data object representing the region(s) of memory to place - * at the end of the newly created object. - * @result A newly created object representing the concatenation of the - * data1 and data2 objects. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_RETURNS_RETAINED -DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_data_t -dispatch_data_create_concat(dispatch_data_t data1, dispatch_data_t data2); - -/*! - * @function dispatch_data_create_subrange - * Returns a new dispatch data object representing a subrange of the specified - * data object, which may be released by the application after the call returns - * (however, the system might not deallocate the memory region(s) described by - * that object until the newly created object has also been released). - * - * @param data The data object representing the region(s) of memory to - * create a subrange of. - * @param offset The offset into the data object where the subrange - * starts. - * @param length The length of the range. - * @result A newly created object representing the specified - * subrange of the data object. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED -DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_data_t -dispatch_data_create_subrange(dispatch_data_t data, - size_t offset, - size_t length); - -#ifdef __BLOCKS__ -/*! - * @typedef dispatch_data_applier_t - * A block to be invoked for every contiguous memory region in a data object. - * - * @param region A data object representing the current region. - * @param offset The logical offset of the current region to the start - * of the data object. - * @param buffer The location of the memory for the current region. - * @param size The size of the memory for the current region. - * @result A Boolean indicating whether traversal should continue. - */ -typedef bool (^dispatch_data_applier_t)(dispatch_data_t region, - size_t offset, - const void *buffer, - size_t size); - -/*! - * @function dispatch_data_apply - * Traverse the memory regions represented by the specified dispatch data object - * in logical order and invoke the specified block once for every contiguous - * memory region encountered. - * - * Each invocation of the block is passed a data object representing the current - * region and its logical offset, along with the memory location and extent of - * the region. These allow direct read access to the memory region, but are only - * valid until the passed-in region object is released. Note that the region - * object is released by the system when the block returns, it is the - * responsibility of the application to retain it if the region object or the - * associated memory location are needed after the block returns. - * - * @param data The data object to traverse. - * @param applier The block to be invoked for every contiguous memory - * region in the data object. - * @result A Boolean indicating whether traversal completed - * successfully. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW -bool -dispatch_data_apply(dispatch_data_t data, - DISPATCH_NOESCAPE dispatch_data_applier_t applier); -#endif /* __BLOCKS__ */ - -/*! - * @function dispatch_data_copy_region - * Finds the contiguous memory region containing the specified location among - * the regions represented by the specified object and returns a copy of the - * internal dispatch data object representing that region along with its logical - * offset in the specified object. - * - * @param data The dispatch data object to query. - * @param location The logical position in the data object to query. - * @param offset_ptr A pointer to a size_t variable to be filled with the - * logical offset of the returned region object to the - * start of the queried data object. - * @result A newly created dispatch data object. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_RETURNS_RETAINED -DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_data_t -dispatch_data_copy_region(dispatch_data_t data, - size_t location, - size_t *offset_ptr); - -__END_DECLS - -DISPATCH_ASSUME_NONNULL_END - -#endif /* __DISPATCH_DATA__ */ diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/dispatch.h b/lib/libc/include/x86_64-macos-gnu/dispatch/dispatch.h index df9beb93d4..7d5356aab6 100644 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/dispatch.h +++ b/lib/libc/include/x86_64-macos-gnu/dispatch/dispatch.h @@ -72,4 +72,4 @@ #undef __DISPATCH_INDIRECT__ -#endif +#endif
\ No newline at end of file diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/group.h b/lib/libc/include/x86_64-macos-gnu/dispatch/group.h index 8d74ada2e4..bb9bad30e3 100644 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/group.h +++ b/lib/libc/include/x86_64-macos-gnu/dispatch/group.h @@ -276,4 +276,4 @@ __END_DECLS DISPATCH_ASSUME_NONNULL_END -#endif +#endif
\ No newline at end of file diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/io.h b/lib/libc/include/x86_64-macos-gnu/dispatch/io.h deleted file mode 100644 index db9733d829..0000000000 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/io.h +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Copyright (c) 2009-2013 Apple Inc. All rights reserved. - * - * @APPLE_APACHE_LICENSE_HEADER_START@ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @APPLE_APACHE_LICENSE_HEADER_END@ - */ - -#ifndef __DISPATCH_IO__ -#define __DISPATCH_IO__ - -#ifndef __DISPATCH_INDIRECT__ -#error "Please #include <dispatch/dispatch.h> instead of this file directly." -#include <dispatch/base.h> // for HeaderDoc -#endif - -DISPATCH_ASSUME_NONNULL_BEGIN - -__BEGIN_DECLS - -/*! @header - * Dispatch I/O provides both stream and random access asynchronous read and - * write operations on file descriptors. One or more dispatch I/O channels may - * be created from a file descriptor as either the DISPATCH_IO_STREAM type or - * DISPATCH_IO_RANDOM type. Once a channel has been created the application may - * schedule asynchronous read and write operations. - * - * The application may set policies on the dispatch I/O channel to indicate the - * desired frequency of I/O handlers for long-running operations. - * - * Dispatch I/O also provides a memory management model for I/O buffers that - * avoids unnecessary copying of data when pipelined between channels. Dispatch - * I/O monitors the overall memory pressure and I/O access patterns for the - * application to optimize resource utilization. - */ - -/*! - * @typedef dispatch_fd_t - * Native file descriptor type for the platform. - */ -#if defined(_WIN32) -typedef intptr_t dispatch_fd_t; -#else -typedef int dispatch_fd_t; -#endif - -/*! - * @functiongroup Dispatch I/O Convenience API - * Convenience wrappers around the dispatch I/O channel API, with simpler - * callback handler semantics and no explicit management of channel objects. - * File descriptors passed to the convenience API are treated as streams, and - * scheduling multiple operations on one file descriptor via the convenience API - * may incur more overhead than by using the dispatch I/O channel API directly. - */ - -#ifdef __BLOCKS__ -/*! - * @function dispatch_read - * Schedule a read operation for asynchronous execution on the specified file - * descriptor. The specified handler is enqueued with the data read from the - * file descriptor when the operation has completed or an error occurs. - * - * The data object passed to the handler will be automatically released by the - * system when the handler returns. It is the responsibility of the application - * to retain, concatenate or copy the data object if it is needed after the - * handler returns. - * - * The data object passed to the handler will only contain as much data as is - * currently available from the file descriptor (up to the specified length). - * - * If an unrecoverable error occurs on the file descriptor, the handler will be - * enqueued with the appropriate error code along with a data object of any data - * that could be read successfully. - * - * An invocation of the handler with an error code of zero and an empty data - * object indicates that EOF was reached. - * - * The system takes control of the file descriptor until the handler is - * enqueued, and during this time file descriptor flags such as O_NONBLOCK will - * be modified by the system on behalf of the application. It is an error for - * the application to modify a file descriptor directly while it is under the - * control of the system, but it may create additional dispatch I/O convenience - * operations or dispatch I/O channels associated with that file descriptor. - * - * @param fd The file descriptor from which to read the data. - * @param length The length of data to read from the file descriptor, - * or SIZE_MAX to indicate that all of the data currently - * available from the file descriptor should be read. - * @param queue The dispatch queue to which the handler should be - * submitted. - * @param handler The handler to enqueue when data is ready to be - * delivered. - * param data The data read from the file descriptor. - * param error An errno condition for the read operation or - * zero if the read was successful. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL3 DISPATCH_NONNULL4 DISPATCH_NOTHROW -void -dispatch_read(dispatch_fd_t fd, - size_t length, - dispatch_queue_t queue, - void (^handler)(dispatch_data_t data, int error)); - -/*! - * @function dispatch_write - * Schedule a write operation for asynchronous execution on the specified file - * descriptor. The specified handler is enqueued when the operation has - * completed or an error occurs. - * - * If an unrecoverable error occurs on the file descriptor, the handler will be - * enqueued with the appropriate error code along with the data that could not - * be successfully written. - * - * An invocation of the handler with an error code of zero indicates that the - * data was fully written to the channel. - * - * The system takes control of the file descriptor until the handler is - * enqueued, and during this time file descriptor flags such as O_NONBLOCK will - * be modified by the system on behalf of the application. It is an error for - * the application to modify a file descriptor directly while it is under the - * control of the system, but it may create additional dispatch I/O convenience - * operations or dispatch I/O channels associated with that file descriptor. - * - * @param fd The file descriptor to which to write the data. - * @param data The data object to write to the file descriptor. - * @param queue The dispatch queue to which the handler should be - * submitted. - * @param handler The handler to enqueue when the data has been written. - * param data The data that could not be written to the I/O - * channel, or NULL. - * param error An errno condition for the write operation or - * zero if the write was successful. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NONNULL3 DISPATCH_NONNULL4 -DISPATCH_NOTHROW -void -dispatch_write(dispatch_fd_t fd, - dispatch_data_t data, - dispatch_queue_t queue, - void (^handler)(dispatch_data_t _Nullable data, int error)); -#endif /* __BLOCKS__ */ - -/*! - * @functiongroup Dispatch I/O Channel API - */ - -/*! - * @typedef dispatch_io_t - * A dispatch I/O channel represents the asynchronous I/O policy applied to a - * file descriptor. I/O channels are first class dispatch objects and may be - * retained and released, suspended and resumed, etc. - */ -DISPATCH_DECL(dispatch_io); - -/*! - * @typedef dispatch_io_type_t - * The type of a dispatch I/O channel: - * - * @const DISPATCH_IO_STREAM A dispatch I/O channel representing a stream of - * bytes. Read and write operations on a channel of this type are performed - * serially (in order of creation) and read/write data at the file pointer - * position that is current at the time the operation starts executing. - * Operations of different type (read vs. write) may be performed simultaneously. - * Offsets passed to operations on a channel of this type are ignored. - * - * @const DISPATCH_IO_RANDOM A dispatch I/O channel representing a random - * access file. Read and write operations on a channel of this type may be - * performed concurrently and read/write data at the specified offset. Offsets - * are interpreted relative to the file pointer position current at the time the - * I/O channel is created. Attempting to create a channel of this type for a - * file descriptor that is not seekable will result in an error. - */ -#define DISPATCH_IO_STREAM 0 -#define DISPATCH_IO_RANDOM 1 - -typedef unsigned long dispatch_io_type_t; - -#ifdef __BLOCKS__ -/*! - * @function dispatch_io_create - * Create a dispatch I/O channel associated with a file descriptor. The system - * takes control of the file descriptor until the channel is closed, an error - * occurs on the file descriptor or all references to the channel are released. - * At that time the specified cleanup handler will be enqueued and control over - * the file descriptor relinquished. - * - * While a file descriptor is under the control of a dispatch I/O channel, file - * descriptor flags such as O_NONBLOCK will be modified by the system on behalf - * of the application. It is an error for the application to modify a file - * descriptor directly while it is under the control of a dispatch I/O channel, - * but it may create additional channels associated with that file descriptor. - * - * @param type The desired type of I/O channel (DISPATCH_IO_STREAM - * or DISPATCH_IO_RANDOM). - * @param fd The file descriptor to associate with the I/O channel. - * @param queue The dispatch queue to which the handler should be submitted. - * @param cleanup_handler The handler to enqueue when the system - * relinquishes control over the file descriptor. - * param error An errno condition if control is relinquished - * because channel creation failed, zero otherwise. - * @result The newly created dispatch I/O channel or NULL if an error - * occurred (invalid type specified). - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT -DISPATCH_NOTHROW -dispatch_io_t -dispatch_io_create(dispatch_io_type_t type, - dispatch_fd_t fd, - dispatch_queue_t queue, - void (^cleanup_handler)(int error)); - -/*! - * @function dispatch_io_create_with_path - * Create a dispatch I/O channel associated with a path name. The specified - * path, oflag and mode parameters will be passed to open(2) when the first I/O - * operation on the channel is ready to execute and the resulting file - * descriptor will remain open and under the control of the system until the - * channel is closed, an error occurs on the file descriptor or all references - * to the channel are released. At that time the file descriptor will be closed - * and the specified cleanup handler will be enqueued. - * - * @param type The desired type of I/O channel (DISPATCH_IO_STREAM - * or DISPATCH_IO_RANDOM). - * @param path The absolute path to associate with the I/O channel. - * @param oflag The flags to pass to open(2) when opening the file at - * path. - * @param mode The mode to pass to open(2) when creating the file at - * path (i.e. with flag O_CREAT), zero otherwise. - * @param queue The dispatch queue to which the handler should be - * submitted. - * @param cleanup_handler The handler to enqueue when the system - * has closed the file at path. - * param error An errno condition if control is relinquished - * because channel creation or opening of the - * specified file failed, zero otherwise. - * @result The newly created dispatch I/O channel or NULL if an error - * occurred (invalid type or non-absolute path specified). - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED -DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_io_t -dispatch_io_create_with_path(dispatch_io_type_t type, - const char *path, int oflag, mode_t mode, - dispatch_queue_t queue, - void (^cleanup_handler)(int error)); - -/*! - * @function dispatch_io_create_with_io - * Create a new dispatch I/O channel from an existing dispatch I/O channel. - * The new channel inherits the file descriptor or path name associated with - * the existing channel, but not its channel type or policies. - * - * If the existing channel is associated with a file descriptor, control by the - * system over that file descriptor is extended until the new channel is also - * closed, an error occurs on the file descriptor, or all references to both - * channels are released. At that time the specified cleanup handler will be - * enqueued and control over the file descriptor relinquished. - * - * While a file descriptor is under the control of a dispatch I/O channel, file - * descriptor flags such as O_NONBLOCK will be modified by the system on behalf - * of the application. It is an error for the application to modify a file - * descriptor directly while it is under the control of a dispatch I/O channel, - * but it may create additional channels associated with that file descriptor. - * - * @param type The desired type of I/O channel (DISPATCH_IO_STREAM - * or DISPATCH_IO_RANDOM). - * @param io The existing channel to create the new I/O channel from. - * @param queue The dispatch queue to which the handler should be submitted. - * @param cleanup_handler The handler to enqueue when the system - * relinquishes control over the file descriptor - * (resp. closes the file at path) associated with - * the existing channel. - * param error An errno condition if control is relinquished - * because channel creation failed, zero otherwise. - * @result The newly created dispatch I/O channel or NULL if an error - * occurred (invalid type specified). - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED -DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_io_t -dispatch_io_create_with_io(dispatch_io_type_t type, - dispatch_io_t io, - dispatch_queue_t queue, - void (^cleanup_handler)(int error)); - -/*! - * @typedef dispatch_io_handler_t - * The prototype of I/O handler blocks for dispatch I/O operations. - * - * @param done A flag indicating whether the operation is complete. - * @param data The data object to be handled. - * @param error An errno condition for the operation. - */ -typedef void (^dispatch_io_handler_t)(bool done, dispatch_data_t _Nullable data, - int error); - -/*! - * @function dispatch_io_read - * Schedule a read operation for asynchronous execution on the specified I/O - * channel. The I/O handler is enqueued one or more times depending on the - * general load of the system and the policy specified on the I/O channel. - * - * Any data read from the channel is described by the dispatch data object - * passed to the I/O handler. This object will be automatically released by the - * system when the I/O handler returns. It is the responsibility of the - * application to retain, concatenate or copy the data object if it is needed - * after the I/O handler returns. - * - * Dispatch I/O handlers are not reentrant. The system will ensure that no new - * I/O handler instance is invoked until the previously enqueued handler block - * has returned. - * - * An invocation of the I/O handler with the done flag set indicates that the - * read operation is complete and that the handler will not be enqueued again. - * - * If an unrecoverable error occurs on the I/O channel's underlying file - * descriptor, the I/O handler will be enqueued with the done flag set, the - * appropriate error code and a NULL data object. - * - * An invocation of the I/O handler with the done flag set, an error code of - * zero and an empty data object indicates that EOF was reached. - * - * @param channel The dispatch I/O channel from which to read the data. - * @param offset The offset relative to the channel position from which - * to start reading (only for DISPATCH_IO_RANDOM). - * @param length The length of data to read from the I/O channel, or - * SIZE_MAX to indicate that data should be read until EOF - * is reached. - * @param queue The dispatch queue to which the I/O handler should be - * submitted. - * @param io_handler The I/O handler to enqueue when data is ready to be - * delivered. - * param done A flag indicating whether the operation is complete. - * param data An object with the data most recently read from the - * I/O channel as part of this read operation, or NULL. - * param error An errno condition for the read operation or zero if - * the read was successful. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL4 DISPATCH_NONNULL5 -DISPATCH_NOTHROW -void -dispatch_io_read(dispatch_io_t channel, - off_t offset, - size_t length, - dispatch_queue_t queue, - dispatch_io_handler_t io_handler); - -/*! - * @function dispatch_io_write - * Schedule a write operation for asynchronous execution on the specified I/O - * channel. The I/O handler is enqueued one or more times depending on the - * general load of the system and the policy specified on the I/O channel. - * - * Any data remaining to be written to the I/O channel is described by the - * dispatch data object passed to the I/O handler. This object will be - * automatically released by the system when the I/O handler returns. It is the - * responsibility of the application to retain, concatenate or copy the data - * object if it is needed after the I/O handler returns. - * - * Dispatch I/O handlers are not reentrant. The system will ensure that no new - * I/O handler instance is invoked until the previously enqueued handler block - * has returned. - * - * An invocation of the I/O handler with the done flag set indicates that the - * write operation is complete and that the handler will not be enqueued again. - * - * If an unrecoverable error occurs on the I/O channel's underlying file - * descriptor, the I/O handler will be enqueued with the done flag set, the - * appropriate error code and an object containing the data that could not be - * written. - * - * An invocation of the I/O handler with the done flag set and an error code of - * zero indicates that the data was fully written to the channel. - * - * @param channel The dispatch I/O channel on which to write the data. - * @param offset The offset relative to the channel position from which - * to start writing (only for DISPATCH_IO_RANDOM). - * @param data The data to write to the I/O channel. The data object - * will be retained by the system until the write operation - * is complete. - * @param queue The dispatch queue to which the I/O handler should be - * submitted. - * @param io_handler The I/O handler to enqueue when data has been delivered. - * param done A flag indicating whether the operation is complete. - * param data An object of the data remaining to be - * written to the I/O channel as part of this write - * operation, or NULL. - * param error An errno condition for the write operation or zero - * if the write was successful. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NONNULL4 -DISPATCH_NONNULL5 DISPATCH_NOTHROW -void -dispatch_io_write(dispatch_io_t channel, - off_t offset, - dispatch_data_t data, - dispatch_queue_t queue, - dispatch_io_handler_t io_handler); -#endif /* __BLOCKS__ */ - -/*! - * @typedef dispatch_io_close_flags_t - * The type of flags you can set on a dispatch_io_close() call - * - * @const DISPATCH_IO_STOP Stop outstanding operations on a channel when - * the channel is closed. - */ -#define DISPATCH_IO_STOP 0x1 - -typedef unsigned long dispatch_io_close_flags_t; - -/*! - * @function dispatch_io_close - * Close the specified I/O channel to new read or write operations; scheduling - * operations on a closed channel results in their handler returning an error. - * - * If the DISPATCH_IO_STOP flag is provided, the system will make a best effort - * to interrupt any outstanding read and write operations on the I/O channel, - * otherwise those operations will run to completion normally. - * Partial results of read and write operations may be returned even after a - * channel is closed with the DISPATCH_IO_STOP flag. - * The final invocation of an I/O handler of an interrupted operation will be - * passed an ECANCELED error code, as will the I/O handler of an operation - * scheduled on a closed channel. - * - * @param channel The dispatch I/O channel to close. - * @param flags The flags for the close operation. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW -void -dispatch_io_close(dispatch_io_t channel, dispatch_io_close_flags_t flags); - -#ifdef __BLOCKS__ -/*! - * @function dispatch_io_barrier - * Schedule a barrier operation on the specified I/O channel; all previously - * scheduled operations on the channel will complete before the provided - * barrier block is enqueued onto the global queue determined by the channel's - * target queue, and no subsequently scheduled operations will start until the - * barrier block has returned. - * - * If multiple channels are associated with the same file descriptor, a barrier - * operation scheduled on any of these channels will act as a barrier across all - * channels in question, i.e. all previously scheduled operations on any of the - * channels will complete before the barrier block is enqueued, and no - * operations subsequently scheduled on any of the channels will start until the - * barrier block has returned. - * - * While the barrier block is running, it may safely operate on the channel's - * underlying file descriptor with fsync(2), lseek(2) etc. (but not close(2)). - * - * @param channel The dispatch I/O channel to schedule the barrier on. - * @param barrier The barrier block. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW -void -dispatch_io_barrier(dispatch_io_t channel, dispatch_block_t barrier); -#endif /* __BLOCKS__ */ - -/*! - * @function dispatch_io_get_descriptor - * Returns the file descriptor underlying a dispatch I/O channel. - * - * Will return -1 for a channel closed with dispatch_io_close() and for a - * channel associated with a path name that has not yet been open(2)ed. - * - * If called from a barrier block scheduled on a channel associated with a path - * name that has not yet been open(2)ed, this will trigger the channel open(2) - * operation and return the resulting file descriptor. - * - * @param channel The dispatch I/O channel to query. - * @result The file descriptor underlying the channel, or -1. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_fd_t -dispatch_io_get_descriptor(dispatch_io_t channel); - -/*! - * @function dispatch_io_set_high_water - * Set a high water mark on the I/O channel for all operations. - * - * The system will make a best effort to enqueue I/O handlers with partial - * results as soon the number of bytes processed by an operation (i.e. read or - * written) reaches the high water mark. - * - * The size of data objects passed to I/O handlers for this channel will never - * exceed the specified high water mark. - * - * The default value for the high water mark is unlimited (i.e. SIZE_MAX). - * - * @param channel The dispatch I/O channel on which to set the policy. - * @param high_water The number of bytes to use as a high water mark. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW -void -dispatch_io_set_high_water(dispatch_io_t channel, size_t high_water); - -/*! - * @function dispatch_io_set_low_water - * Set a low water mark on the I/O channel for all operations. - * - * The system will process (i.e. read or write) at least the low water mark - * number of bytes for an operation before enqueueing I/O handlers with partial - * results. - * - * The size of data objects passed to intermediate I/O handler invocations for - * this channel (i.e. excluding the final invocation) will never be smaller than - * the specified low water mark, except if the channel has an interval with the - * DISPATCH_IO_STRICT_INTERVAL flag set or if EOF or an error was encountered. - * - * I/O handlers should be prepared to receive amounts of data significantly - * larger than the low water mark in general. If an I/O handler requires - * intermediate results of fixed size, set both the low and and the high water - * mark to that size. - * - * The default value for the low water mark is unspecified, but must be assumed - * to be such that intermediate handler invocations may occur. - * If I/O handler invocations with partial results are not desired, set the - * low water mark to SIZE_MAX. - * - * @param channel The dispatch I/O channel on which to set the policy. - * @param low_water The number of bytes to use as a low water mark. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW -void -dispatch_io_set_low_water(dispatch_io_t channel, size_t low_water); - -/*! - * @typedef dispatch_io_interval_flags_t - * Type of flags to set on dispatch_io_set_interval() - * - * @const DISPATCH_IO_STRICT_INTERVAL Enqueue I/O handlers at a channel's - * interval setting even if the amount of data ready to be delivered is inferior - * to the low water mark (or zero). - */ -#define DISPATCH_IO_STRICT_INTERVAL 0x1 - -typedef unsigned long dispatch_io_interval_flags_t; - -/*! - * @function dispatch_io_set_interval - * Set a nanosecond interval at which I/O handlers are to be enqueued on the - * I/O channel for all operations. - * - * This allows an application to receive periodic feedback on the progress of - * read and write operations, e.g. for the purposes of displaying progress bars. - * - * If the amount of data ready to be delivered to an I/O handler at the interval - * is inferior to the channel low water mark, the handler will only be enqueued - * if the DISPATCH_IO_STRICT_INTERVAL flag is set. - * - * Note that the system may defer enqueueing interval I/O handlers by a small - * unspecified amount of leeway in order to align with other system activity for - * improved system performance or power consumption. - * - * @param channel The dispatch I/O channel on which to set the policy. - * @param interval The interval in nanoseconds at which delivery of the I/O - * handler is desired. - * @param flags Flags indicating desired data delivery behavior at - * interval time. - */ -API_AVAILABLE(macos(10.7), ios(5.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW -void -dispatch_io_set_interval(dispatch_io_t channel, - uint64_t interval, - dispatch_io_interval_flags_t flags); - -__END_DECLS - -DISPATCH_ASSUME_NONNULL_END - -#endif /* __DISPATCH_IO__ */ diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/object.h b/lib/libc/include/x86_64-macos-gnu/dispatch/object.h index 7d7f0d09bb..3d89eb1fe6 100644 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/object.h +++ b/lib/libc/include/x86_64-macos-gnu/dispatch/object.h @@ -603,4 +603,4 @@ __END_DECLS DISPATCH_ASSUME_NONNULL_END -#endif +#endif
\ No newline at end of file diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/once.h b/lib/libc/include/x86_64-macos-gnu/dispatch/once.h deleted file mode 100644 index fbce4b111e..0000000000 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/once.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2008-2010 Apple Inc. All rights reserved. - * - * @APPLE_APACHE_LICENSE_HEADER_START@ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @APPLE_APACHE_LICENSE_HEADER_END@ - */ - -#ifndef __DISPATCH_ONCE__ -#define __DISPATCH_ONCE__ - -#ifndef __DISPATCH_INDIRECT__ -#error "Please #include <dispatch/dispatch.h> instead of this file directly." -#include <dispatch/base.h> // for HeaderDoc -#endif - -DISPATCH_ASSUME_NONNULL_BEGIN - -__BEGIN_DECLS - -/*! - * @typedef dispatch_once_t - * - * @abstract - * A predicate for use with dispatch_once(). It must be initialized to zero. - * Note: static and global variables default to zero. - */ -DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") -typedef intptr_t dispatch_once_t; - -#if defined(__x86_64__) || defined(__i386__) || defined(__s390x__) -#define DISPATCH_ONCE_INLINE_FASTPATH 1 -#elif defined(__APPLE__) -#define DISPATCH_ONCE_INLINE_FASTPATH 1 -#else -#define DISPATCH_ONCE_INLINE_FASTPATH 0 -#endif - -/*! - * @function dispatch_once - * - * @abstract - * Execute a block once and only once. - * - * @param predicate - * A pointer to a dispatch_once_t that is used to test whether the block has - * completed or not. - * - * @param block - * The block to execute once. - * - * @discussion - * Always call dispatch_once() before using or testing any variables that are - * initialized by the block. - */ -#ifdef __BLOCKS__ -API_AVAILABLE(macos(10.6), ios(4.0)) -DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW -DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") -void -dispatch_once(dispatch_once_t *predicate, - DISPATCH_NOESCAPE dispatch_block_t block); - -#if DISPATCH_ONCE_INLINE_FASTPATH -DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW -DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") -void -_dispatch_once(dispatch_once_t *predicate, - DISPATCH_NOESCAPE dispatch_block_t block) -{ - if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) { - dispatch_once(predicate, block); - } else { - dispatch_compiler_barrier(); - } - DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l); -} -#undef dispatch_once -#define dispatch_once _dispatch_once -#endif -#endif // DISPATCH_ONCE_INLINE_FASTPATH - -API_AVAILABLE(macos(10.6), ios(4.0)) -DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_NOTHROW -DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") -void -dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context, - dispatch_function_t function); - -#if DISPATCH_ONCE_INLINE_FASTPATH -DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL1 DISPATCH_NONNULL3 -DISPATCH_NOTHROW -DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead") -void -_dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context, - dispatch_function_t function) -{ - if (DISPATCH_EXPECT(*predicate, ~0l) != ~0l) { - dispatch_once_f(predicate, context, function); - } else { - dispatch_compiler_barrier(); - } - DISPATCH_COMPILER_CAN_ASSUME(*predicate == ~0l); -} -#undef dispatch_once_f -#define dispatch_once_f _dispatch_once_f -#endif // DISPATCH_ONCE_INLINE_FASTPATH - -__END_DECLS - -DISPATCH_ASSUME_NONNULL_END - -#endif diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/queue.h b/lib/libc/include/x86_64-macos-gnu/dispatch/queue.h index 4ea1bf2eb0..f644b0266d 100644 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/queue.h +++ b/lib/libc/include/x86_64-macos-gnu/dispatch/queue.h @@ -1671,4 +1671,4 @@ __END_DECLS DISPATCH_ASSUME_NONNULL_END -#endif +#endif
\ No newline at end of file diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/semaphore.h b/lib/libc/include/x86_64-macos-gnu/dispatch/semaphore.h index f5394b45dd..156fb800f3 100644 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/semaphore.h +++ b/lib/libc/include/x86_64-macos-gnu/dispatch/semaphore.h @@ -114,4 +114,4 @@ __END_DECLS DISPATCH_ASSUME_NONNULL_END -#endif /* __DISPATCH_SEMAPHORE__ */ +#endif /* __DISPATCH_SEMAPHORE__ */
\ No newline at end of file diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/source.h b/lib/libc/include/x86_64-macos-gnu/dispatch/source.h index 40453fa3eb..968b9ff89e 100644 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/source.h +++ b/lib/libc/include/x86_64-macos-gnu/dispatch/source.h @@ -777,4 +777,4 @@ __END_DECLS DISPATCH_ASSUME_NONNULL_END -#endif +#endif
\ No newline at end of file diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/time.h b/lib/libc/include/x86_64-macos-gnu/dispatch/time.h deleted file mode 100644 index a1cd2006ef..0000000000 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/time.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2008-2011 Apple Inc. All rights reserved. - * - * @APPLE_APACHE_LICENSE_HEADER_START@ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @APPLE_APACHE_LICENSE_HEADER_END@ - */ - -#ifndef __DISPATCH_TIME__ -#define __DISPATCH_TIME__ - -#ifndef __DISPATCH_INDIRECT__ -#error "Please #include <dispatch/dispatch.h> instead of this file directly." -#include <dispatch/base.h> // for HeaderDoc -#endif - -#include <stdint.h> - -// <rdar://problem/6368156&7563559> -#if TARGET_OS_MAC -#include <mach/clock_types.h> -#endif - -DISPATCH_ASSUME_NONNULL_BEGIN - -#ifdef NSEC_PER_SEC -#undef NSEC_PER_SEC -#endif -#ifdef USEC_PER_SEC -#undef USEC_PER_SEC -#endif -#ifdef NSEC_PER_USEC -#undef NSEC_PER_USEC -#endif -#ifdef NSEC_PER_MSEC -#undef NSEC_PER_MSEC -#endif -#define NSEC_PER_SEC 1000000000ull -#define NSEC_PER_MSEC 1000000ull -#define USEC_PER_SEC 1000000ull -#define NSEC_PER_USEC 1000ull - -__BEGIN_DECLS - -struct timespec; - -/*! - * @typedef dispatch_time_t - * - * @abstract - * A somewhat abstract representation of time; where zero means "now" and - * DISPATCH_TIME_FOREVER means "infinity" and every value in between is an - * opaque encoding. - */ -typedef uint64_t dispatch_time_t; - -enum { - DISPATCH_WALLTIME_NOW DISPATCH_ENUM_API_AVAILABLE - (macos(10.14), ios(12.0), tvos(12.0), watchos(5.0)) = ~1ull, -}; - -#define DISPATCH_TIME_NOW (0ull) -#define DISPATCH_TIME_FOREVER (~0ull) - -/*! - * @function dispatch_time - * - * @abstract - * Create a dispatch_time_t relative to the current value of the default or - * wall time clock, or modify an existing dispatch_time_t. - * - * @discussion - * On Apple platforms, the default clock is based on mach_absolute_time(). - * - * @param when - * An optional dispatch_time_t to add nanoseconds to. If DISPATCH_TIME_NOW is - * passed, then dispatch_time() will use the default clock (which is based on - * mach_absolute_time() on Apple platforms). If DISPATCH_WALLTIME_NOW is used, - * dispatch_time() will use the value returned by gettimeofday(3). - * dispatch_time(DISPATCH_WALLTIME_NOW, delta) is equivalent to - * dispatch_walltime(NULL, delta). - * - * @param delta - * Nanoseconds to add. - * - * @result - * A new dispatch_time_t. - */ -API_AVAILABLE(macos(10.6), ios(4.0)) -DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_time_t -dispatch_time(dispatch_time_t when, int64_t delta); - -/*! - * @function dispatch_walltime - * - * @abstract - * Create a dispatch_time_t using the wall clock. - * - * @discussion - * On Mac OS X the wall clock is based on gettimeofday(3). - * - * @param when - * A struct timespec to add time to. If NULL is passed, then - * dispatch_walltime() will use the result of gettimeofday(3). - * dispatch_walltime(NULL, delta) returns the same value as - * dispatch_time(DISPATCH_WALLTIME_NOW, delta). - * - * @param delta - * Nanoseconds to add. - * - * @result - * A new dispatch_time_t. - */ -API_AVAILABLE(macos(10.6), ios(4.0)) -DISPATCH_EXPORT DISPATCH_WARN_RESULT DISPATCH_NOTHROW -dispatch_time_t -dispatch_walltime(const struct timespec *_Nullable when, int64_t delta); - -__END_DECLS - -DISPATCH_ASSUME_NONNULL_END - -#endif diff --git a/lib/libc/include/x86_64-macos-gnu/dispatch/workloop.h b/lib/libc/include/x86_64-macos-gnu/dispatch/workloop.h index d0b17c2357..dcd1db43cc 100644 --- a/lib/libc/include/x86_64-macos-gnu/dispatch/workloop.h +++ b/lib/libc/include/x86_64-macos-gnu/dispatch/workloop.h @@ -133,4 +133,4 @@ __END_DECLS DISPATCH_ASSUME_NONNULL_END -#endif +#endif
\ No newline at end of file |
