layout_private.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright (c) 2014 Apple Inc. All rights reserved.
  3. *
  4. * @APPLE_APACHE_LICENSE_HEADER_START@
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. * @APPLE_APACHE_LICENSE_HEADER_END@
  19. */
  20. #ifndef __DISPATCH_LAYOUT_PRIVATE__
  21. #define __DISPATCH_LAYOUT_PRIVATE__
  22. #ifndef __DISPATCH_INDIRECT__
  23. #error "Please #include <dispatch/private.h> instead of this file directly."
  24. #include <dispatch/base.h> // for HeaderDoc
  25. #endif
  26. __BEGIN_DECLS
  27. API_AVAILABLE(macos(10.6), ios(4.0))
  28. DISPATCH_EXPORT const struct dispatch_queue_offsets_s {
  29. // always add new fields at the end
  30. const uint16_t dqo_version;
  31. const uint16_t dqo_label;
  32. const uint16_t dqo_label_size;
  33. const uint16_t dqo_flags;
  34. const uint16_t dqo_flags_size;
  35. const uint16_t dqo_serialnum;
  36. const uint16_t dqo_serialnum_size;
  37. const uint16_t dqo_width;
  38. const uint16_t dqo_width_size;
  39. const uint16_t dqo_running;
  40. const uint16_t dqo_running_size;
  41. // fields added in dqo_version 5:
  42. const uint16_t dqo_suspend_cnt;
  43. const uint16_t dqo_suspend_cnt_size;
  44. const uint16_t dqo_target_queue;
  45. const uint16_t dqo_target_queue_size;
  46. const uint16_t dqo_priority;
  47. const uint16_t dqo_priority_size;
  48. } dispatch_queue_offsets;
  49. #if DISPATCH_LAYOUT_SPI
  50. /*!
  51. * @group Data Structure Layout SPI
  52. * SPI intended for CoreSymbolication only
  53. */
  54. API_AVAILABLE(macos(10.10), ios(8.0))
  55. DISPATCH_EXPORT const struct dispatch_tsd_indexes_s {
  56. // always add new fields at the end
  57. const uint16_t dti_version;
  58. const uint16_t dti_queue_index;
  59. const uint16_t dti_voucher_index;
  60. const uint16_t dti_qos_class_index;
  61. /* version 3 */
  62. const uint16_t dti_continuation_cache_index;
  63. } dispatch_tsd_indexes;
  64. #if TARGET_OS_MAC
  65. #include <malloc/malloc.h>
  66. API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
  67. DISPATCH_EXPORT const struct dispatch_allocator_layout_s {
  68. const uint16_t dal_version;
  69. /* version 1 */
  70. /* Pointer to the allocator metadata address, points to NULL if unused */
  71. void **const dal_allocator_zone;
  72. /* Magical "isa" for allocations that are on freelists */
  73. void *const *const dal_deferred_free_isa;
  74. /* Size of allocations made in the magazine */
  75. const uint16_t dal_allocation_size;
  76. /* fields used by the enumerator */
  77. const uint16_t dal_magazine_size;
  78. const uint16_t dal_first_allocation_offset;
  79. const uint16_t dal_allocation_isa_offset;
  80. /* Enumerates allocated continuations */
  81. kern_return_t (*dal_enumerator)(task_t remote_task,
  82. const struct dispatch_allocator_layout_s *remote_allocator_layout,
  83. vm_address_t zone_address, memory_reader_t reader,
  84. void (^recorder)(vm_address_t dc_address, void *dc_mem,
  85. size_t size, bool *stop));
  86. } dispatch_allocator_layout;
  87. #endif // TARGET_OS_MAC
  88. #endif // DISPATCH_LAYOUT_SPI
  89. __END_DECLS
  90. #endif // __DISPATCH_LAYOUT_PRIVATE__