@zigc/lib 0.16.0-dev.3013 → 0.16.0-test.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +1 -5
  2. package/compiler/build_runner.zig +10 -5
  3. package/libc/darwin/SDKSettings.json +1 -1
  4. package/libc/darwin/libSystem.tbd +357 -427
  5. package/libc/freebsd/lib/csu/aarch64/crt.h +1 -0
  6. package/libc/freebsd/lib/csu/aarch64/crt1_c.c +33 -0
  7. package/libc/freebsd/lib/csu/aarch64/crt1_s.S +68 -0
  8. package/libc/freebsd/lib/csu/amd64/crt.h +30 -0
  9. package/libc/freebsd/lib/csu/amd64/crt1_c.c +30 -0
  10. package/libc/freebsd/lib/csu/amd64/crt1_s.S +86 -0
  11. package/libc/freebsd/lib/csu/arm/crt.h +1 -0
  12. package/libc/freebsd/lib/csu/arm/crt1_c.c +79 -0
  13. package/libc/freebsd/lib/csu/arm/crt1_s.S +77 -0
  14. package/libc/freebsd/lib/csu/common/crtbegin.c +54 -0
  15. package/libc/freebsd/lib/csu/common/crtbrand.S +55 -0
  16. package/libc/freebsd/lib/csu/common/csu_common.h +50 -0
  17. package/libc/freebsd/lib/csu/common/feature_note.S +47 -0
  18. package/libc/freebsd/lib/csu/common/ignore_init_note.S +48 -0
  19. package/libc/freebsd/lib/csu/common/notes.h +32 -0
  20. package/libc/freebsd/lib/csu/i386/crt.h +30 -0
  21. package/libc/freebsd/lib/csu/i386/crt1_c.c +30 -0
  22. package/libc/freebsd/lib/csu/i386/crt1_s.S +91 -0
  23. package/libc/freebsd/lib/csu/powerpc/crt.h +30 -0
  24. package/libc/freebsd/lib/csu/powerpc/crt1_c.c +89 -0
  25. package/libc/freebsd/lib/csu/powerpc/crtsavres.S +189 -0
  26. package/libc/freebsd/lib/csu/powerpc64/crt.h +30 -0
  27. package/libc/freebsd/lib/csu/powerpc64/crt1_c.c +83 -0
  28. package/libc/freebsd/lib/csu/riscv/crt.h +8 -0
  29. package/libc/freebsd/lib/csu/riscv/crt1_c.c +51 -0
  30. package/libc/freebsd/lib/csu/riscv/crt1_s.S +51 -0
  31. package/libc/freebsd/lib/libc/include/libc_private.h +386 -0
  32. package/libc/include/any-darwin-any/AssertMacros.h +1 -1
  33. package/libc/include/any-darwin-any/AvailabilityInternal.h +10 -10
  34. package/libc/include/any-darwin-any/AvailabilityInternalLegacy.h +1 -1
  35. package/libc/include/any-darwin-any/AvailabilityVersions.h +16 -0
  36. package/libc/include/any-darwin-any/TargetConditionals.h +5 -21
  37. package/libc/include/any-darwin-any/_regex.h +11 -3
  38. package/libc/include/any-darwin-any/copyfile.h +1 -0
  39. package/libc/include/any-darwin-any/dirent.h +32 -2
  40. package/libc/include/any-darwin-any/dispatch/base.h +8 -0
  41. package/libc/include/any-darwin-any/dispatch/dispatch_swift_shims.h +4 -2
  42. package/libc/include/any-darwin-any/dispatch/once.h +2 -1
  43. package/libc/include/any-darwin-any/dispatch/workloop.h +2 -0
  44. package/libc/include/any-darwin-any/glob.h +7 -5
  45. package/libc/include/any-darwin-any/mach/arm/_structs.h +1 -0
  46. package/libc/include/any-darwin-any/mach/arm/exception.h +1 -0
  47. package/libc/include/any-darwin-any/mach/arm/thread_status.h +1 -1
  48. package/libc/include/any-darwin-any/mach/kern_return.h +4 -0
  49. package/libc/include/any-darwin-any/mach/mach_host.h +52 -2
  50. package/libc/include/any-darwin-any/mach/mach_traps.h +5 -1
  51. package/libc/include/any-darwin-any/mach/mach_types.h +4 -0
  52. package/libc/include/any-darwin-any/mach/mach_voucher_types.h +9 -0
  53. package/libc/include/any-darwin-any/mach/machine.h +1 -0
  54. package/libc/include/any-darwin-any/mach/message.h +21 -0
  55. package/libc/include/any-darwin-any/mach/port.h +48 -11
  56. package/libc/include/any-darwin-any/mach/thread_act.h +79 -2
  57. package/libc/include/any-darwin-any/mach/vm_map.h +54 -2
  58. package/libc/include/any-darwin-any/mach/vm_prot.h +0 -1
  59. package/libc/include/any-darwin-any/mach/vm_region.h +8 -0
  60. package/libc/include/any-darwin-any/mach/vm_statistics.h +39 -12
  61. package/libc/include/any-darwin-any/mach/vm_types.h +6 -0
  62. package/libc/include/any-darwin-any/mach-o/loader.h +3 -3
  63. package/libc/include/any-darwin-any/mach_debug/ipc_info.h +1 -0
  64. package/libc/include/any-darwin-any/malloc/malloc.h +0 -2
  65. package/libc/include/any-darwin-any/net/if_var.h +2 -2
  66. package/libc/include/any-darwin-any/signal.h +5 -2
  67. package/libc/include/any-darwin-any/simd/math.h +2 -2
  68. package/libc/include/any-darwin-any/sys/_symbol_aliasing.h +24 -0
  69. package/libc/include/any-darwin-any/sys/attr.h +5 -1
  70. package/libc/include/any-darwin-any/sys/fcntl.h +2 -0
  71. package/libc/include/any-darwin-any/sys/mman.h +3 -4
  72. package/libc/include/any-darwin-any/sys/paths.h +12 -9
  73. package/libc/include/any-darwin-any/sys/proc.h +2 -2
  74. package/libc/include/any-darwin-any/sys/sysctl.h +24 -20
  75. package/libc/include/any-darwin-any/unistd.h +2 -2
  76. package/libc/include/any-darwin-any/xpc/activity.h +7 -7
  77. package/libc/include/any-darwin-any/xpc/connection.h +15 -15
  78. package/libc/include/any-darwin-any/xpc/listener.h +2 -2
  79. package/libc/include/any-darwin-any/xpc/peer_requirement.h +13 -13
  80. package/libc/include/any-darwin-any/xpc/session.h +6 -6
  81. package/libc/include/any-darwin-any/xpc/xpc.h +14 -14
  82. package/libc/netbsd/lib/csu/arch/aarch64/crt0.S +45 -0
  83. package/libc/netbsd/lib/csu/arch/earm/crt0.S +61 -0
  84. package/libc/netbsd/lib/csu/arch/i386/crt0.S +48 -0
  85. package/libc/netbsd/lib/csu/arch/m68k/crt0.S +47 -0
  86. package/libc/netbsd/lib/csu/arch/mips/crt0.S +59 -0
  87. package/libc/netbsd/lib/csu/arch/powerpc/crt0.S +56 -0
  88. package/libc/netbsd/lib/csu/arch/sparc/crt0.S +55 -0
  89. package/libc/netbsd/lib/csu/arch/sparc64/crt0.S +59 -0
  90. package/libc/netbsd/lib/csu/arch/x86_64/crt0.S +48 -0
  91. package/libc/netbsd/lib/csu/common/crt0-common.c +351 -0
  92. package/libc/netbsd/lib/csu/common/crtbegin.c +135 -0
  93. package/libc/netbsd/lib/csu/common/csu-common.h +38 -0
  94. package/libc/netbsd/lib/csu/common/sysident.S +89 -0
  95. package/libc/netbsd/lib/csu/common/sysident_assym.h +17 -0
  96. package/libc/openbsd/lib/csu/aarch64/md_init.h +83 -0
  97. package/libc/openbsd/lib/csu/amd64/md_init.h +80 -0
  98. package/libc/openbsd/lib/csu/arm/md_init.h +112 -0
  99. package/libc/openbsd/lib/csu/crt0.c +76 -0
  100. package/libc/openbsd/lib/csu/crtbegin.c +61 -0
  101. package/libc/openbsd/lib/csu/extern.h +54 -0
  102. package/libc/openbsd/lib/csu/i386/md_init.h +83 -0
  103. package/libc/openbsd/lib/csu/mips64/md_init.h +127 -0
  104. package/libc/openbsd/lib/csu/os-note-elf.h +19 -0
  105. package/libc/openbsd/lib/csu/powerpc/md_init.h +80 -0
  106. package/libc/openbsd/lib/csu/powerpc64/md_init.h +75 -0
  107. package/libc/openbsd/lib/csu/riscv64/md_init.h +74 -0
  108. package/libc/openbsd/lib/csu/sparc64/md_init.h +85 -0
  109. package/package.json +2 -2
  110. package/std/Build/Step/Run.zig +4 -4
  111. package/std/Io/Dir.zig +122 -7
  112. package/std/Io/File.zig +6 -118
  113. package/std/Io/Kqueue.zig +1 -0
  114. package/std/Io/Threaded.zig +50 -46
  115. package/std/Io/Uring.zig +1 -0
  116. package/std/Io/net.zig +4 -0
  117. package/std/Io.zig +3 -3
  118. package/std/Target.zig +1 -1
  119. package/std/c.zig +2 -1
  120. package/std/http/Client.zig +3 -2
  121. package/std/tar.zig +76 -36
@@ -67,6 +67,7 @@
67
67
  #include <sys/cdefs.h>
68
68
  #include <Availability.h>
69
69
  #include <sys/_pthread/_pthread_types.h> /* __darwin_pthread_mutex_t */
70
+ #include <sys/_types/_size_t.h>
70
71
 
71
72
  _LIBC_SINGLE_BY_DEFAULT()
72
73
 
@@ -75,8 +76,8 @@ struct _telldir; /* forward reference */
75
76
  /* structure describing an open directory. */
76
77
  typedef struct {
77
78
  int __dd_fd; /* file descriptor associated with directory */
78
- long __dd_loc; /* offset in current buffer */
79
- long __dd_size; /* amount of data returned */
79
+ size_t __dd_loc; /* offset in current buffer */
80
+ size_t __dd_size; /* amount of data returned */
80
81
  char *_LIBC_COUNT(__dd_len) __dd_buf; /* data buffer */
81
82
  int __dd_len; /* size of data buffer */
82
83
  long __dd_seek; /* magic cookie returned */
@@ -110,6 +111,7 @@ int closedir(DIR *) __DARWIN_ALIAS(closedir);
110
111
  DIR *opendir(const char *) __DARWIN_ALIAS_I(opendir);
111
112
 
112
113
  struct dirent *readdir(DIR *) __DARWIN_INODE64(readdir);
114
+ __deprecated_msg("This function cannot be used safely as it does not take into account the variability of {NAME_MAX}. It is highly recommended that you use readdir(3) instead.")
113
115
  int readdir_r(DIR *, struct dirent *, struct dirent **) __DARWIN_INODE64(readdir_r);
114
116
 
115
117
  void rewinddir(DIR *) __DARWIN_ALIAS_I(rewinddir);
@@ -171,6 +173,34 @@ __END_DECLS
171
173
  #if __DARWIN_C_LEVEL >= __DARWIN_C_FULL
172
174
  __BEGIN_DECLS
173
175
 
176
+ int fdclosedir(DIR *)
177
+ __API_AVAILABLE(macos(26.4), ios(26.4), watchos(26.4), tvos(26.4), visionos(26.4));
178
+
179
+ int fdscandir(int, struct dirent ***,
180
+ int (*)(const struct dirent *), int (*)(const struct dirent **,
181
+ const struct dirent **))
182
+ __DARWIN_INODE64(fdscandir)
183
+ __API_AVAILABLE(macos(26.4), ios(26.4), watchos(26.4), tvos(26.4), visionos(26.4));
184
+ #ifdef __BLOCKS__
185
+ int fdscandir_b(int, struct dirent ***,
186
+ int (^)(const struct dirent *) __scandir_noescape,
187
+ int (^)(const struct dirent **, const struct dirent **) __scandir_noescape)
188
+ __DARWIN_INODE64(fdscandir_b)
189
+ __API_AVAILABLE(macos(26.4), ios(26.4), watchos(26.4), tvos(26.4), visionos(26.4));
190
+ #endif
191
+ int scandirat(int, const char *, struct dirent ***,
192
+ int (*)(const struct dirent *), int (*)(const struct dirent **,
193
+ const struct dirent **))
194
+ __DARWIN_INODE64(scandirat)
195
+ __API_AVAILABLE(macos(26.4), ios(26.4), watchos(26.4), tvos(26.4), visionos(26.4));
196
+ #ifdef __BLOCKS__
197
+ int scandirat_b(int, const char *, struct dirent ***,
198
+ int (^)(const struct dirent *) __scandir_noescape,
199
+ int (^)(const struct dirent **, const struct dirent **) __scandir_noescape)
200
+ __DARWIN_INODE64(scandirat_b)
201
+ __API_AVAILABLE(macos(26.4), ios(26.4), watchos(26.4), tvos(26.4), visionos(26.4));
202
+ #endif
203
+
174
204
  int getdirentries(int, char *_LIBC_COUNT(__nbytes), int __nbytes, long *)
175
205
 
176
206
  #if __DARWIN_64_BIT_INO_T
@@ -222,6 +222,12 @@
222
222
  #define DISPATCH_COLD
223
223
  #endif
224
224
 
225
+ #if __has_attribute(no_sanitize)
226
+ #define DISPATCH_NO_UBSAN __attribute__((no_sanitize("undefined")))
227
+ #else
228
+ #define DISPATCH_NO_UBSAN
229
+ #endif
230
+
225
231
  #if __has_feature(assume_nonnull)
226
232
  #define DISPATCH_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
227
233
  #define DISPATCH_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
@@ -305,11 +311,13 @@
305
311
 
306
312
  #if __has_feature(enumerator_attributes)
307
313
  #define DISPATCH_ENUM_API_AVAILABLE(...) API_AVAILABLE(__VA_ARGS__)
314
+ #define DISPATCH_ENUM_SPI_AVAILABLE(...) API_UNAVAILABLE(__VA_ARGS__)
308
315
  #define DISPATCH_ENUM_API_DEPRECATED(...) API_DEPRECATED(__VA_ARGS__)
309
316
  #define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...) \
310
317
  API_DEPRECATED_WITH_REPLACEMENT(__VA_ARGS__)
311
318
  #else
312
319
  #define DISPATCH_ENUM_API_AVAILABLE(...)
320
+ #define DISPATCH_ENUM_SPI_AVAILABLE(...)
313
321
  #define DISPATCH_ENUM_API_DEPRECATED(...)
314
322
  #define DISPATCH_ENUM_API_DEPRECATED_WITH_REPLACEMENT(...)
315
323
  #endif
@@ -38,7 +38,8 @@ DISPATCH_REFINED_FOR_SWIFT DISPATCH_SWIFT_NAME(DispatchSerialQueue.init(__label:
38
38
  static inline dispatch_queue_serial_t
39
39
  dispatch_serial_queue_create_with_target_4swift(const char *_Nullable DISPATCH_UNSAFE_INDEXABLE label,
40
40
  dispatch_queue_attr_t _Nullable attr, dispatch_queue_t _Nullable target) {
41
- return dispatch_queue_create_with_target(label, attr, target);
41
+ return (dispatch_queue_serial_t)
42
+ dispatch_queue_create_with_target(label, attr, target);
42
43
  }
43
44
 
44
45
  DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
@@ -47,7 +48,8 @@ DISPATCH_REFINED_FOR_SWIFT DISPATCH_SWIFT_NAME(DispatchConcurrentQueue.init(__la
47
48
  static inline dispatch_queue_concurrent_t
48
49
  dispatch_concurrent_queue_create_with_target_4swift(const char *_Nullable DISPATCH_UNSAFE_INDEXABLE label,
49
50
  dispatch_queue_attr_t _Nullable attr, dispatch_queue_t _Nullable target) {
50
- return dispatch_queue_create_with_target(label, attr, target);
51
+ return (dispatch_queue_concurrent_t)
52
+ dispatch_queue_create_with_target(label, attr, target);
51
53
  }
52
54
  #endif
53
55
 
@@ -76,6 +76,7 @@ dispatch_once(dispatch_once_t *predicate,
76
76
 
77
77
  #if DISPATCH_ONCE_INLINE_FASTPATH
78
78
  DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
79
+ DISPATCH_NO_UBSAN
79
80
  DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead")
80
81
  void
81
82
  _dispatch_once(dispatch_once_t *predicate,
@@ -102,7 +103,7 @@ dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context,
102
103
 
103
104
  #if DISPATCH_ONCE_INLINE_FASTPATH
104
105
  DISPATCH_INLINE DISPATCH_ALWAYS_INLINE DISPATCH_NONNULL1 DISPATCH_NONNULL3
105
- DISPATCH_NOTHROW
106
+ DISPATCH_NOTHROW DISPATCH_NO_UBSAN
106
107
  DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead")
107
108
  void
108
109
  _dispatch_once_f(dispatch_once_t *predicate, void *_Nullable context,
@@ -136,6 +136,7 @@ void
136
136
  dispatch_workloop_set_autorelease_frequency(dispatch_workloop_t workloop,
137
137
  dispatch_autorelease_frequency_t frequency);
138
138
 
139
+ #ifdef __APPLE__
139
140
  /*!
140
141
  * @function dispatch_workloop_set_os_workgroup
141
142
  *
@@ -167,6 +168,7 @@ DISPATCH_REFINED_FOR_SWIFT
167
168
  void
168
169
  dispatch_workloop_set_os_workgroup(dispatch_workloop_t workloop,
169
170
  os_workgroup_t workgroup);
171
+ #endif
170
172
 
171
173
  __END_DECLS
172
174
 
@@ -55,14 +55,14 @@ typedef struct {
55
55
  int gl_flags; /* Copy of flags parameter to glob. */
56
56
  char *_LIBC_CSTR *_LIBC_COUNT(gl_matchc) gl_pathv; /* List of paths matching pattern. */
57
57
  /* Copy of errfunc parameter to glob. */
58
- #ifdef __BLOCKS__
59
58
  union {
60
- #endif /* __BLOCKS__ */
61
59
  int (*gl_errfunc)(const char *, int);
62
60
  #ifdef __BLOCKS__
63
61
  int (^gl_errblk)(const char *, int);
62
+ #else
63
+ void *gl_errblk;
64
+ #endif
64
65
  };
65
- #endif /* __BLOCKS__ */
66
66
 
67
67
  /*
68
68
  * Alternate filesystem access methods for glob; replacement
@@ -107,9 +107,11 @@ typedef struct {
107
107
  #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
108
108
  #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
109
109
  #define GLOB_LIMIT 0x1000 /* limit number of returned paths */
110
- #ifdef __BLOCKS__
110
+ #ifdef __APPLE__
111
111
  #define _GLOB_ERR_BLOCK 0x80000000 /* (internal) error callback is a block */
112
- #endif /* __BLOCKS__ */
112
+ #else
113
+ #define _GLOB_ERR_BLOCK 0x08000000 /* (internal) error callback is a block */
114
+ #endif
113
115
 
114
116
  /* source compatibility, these are the old names */
115
117
  #define GLOB_MAXPATH GLOB_LIMIT
@@ -198,6 +198,7 @@ _STRUCT_ARM_THREAD_STATE64
198
198
  #define __DARWIN_ARM_THREAD_STATE64_FLAGS_IB_SIGNED_LR 0x2
199
199
  #define __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_PC 0x4
200
200
  #define __DARWIN_ARM_THREAD_STATE64_FLAGS_KERNEL_SIGNED_LR 0x8
201
+ #define __DARWIN_ARM_THREAD_STATE64_FLAGS_CUSTOM_X18_ABI 0x10
201
202
 
202
203
  #define __DARWIN_ARM_THREAD_STATE64_USER_DIVERSIFIER_MASK 0xff000000
203
204
 
@@ -75,6 +75,7 @@
75
75
  #define EXC_ARM_MTE_TAGCHECK_FAIL 0x106 /* MTE Tag Check failure */
76
76
  #define EXC_ARM_MTE_CANONICAL_FAIL 0x107 /* MTE Canonical Tag access fail */
77
77
 
78
+
78
79
  /*
79
80
  * EXC_BREAKPOINT
80
81
  */
@@ -89,7 +89,7 @@
89
89
  #define ARM_SME_ZA_STATE9 40
90
90
  #define ARM_SME_ZA_STATE10 41
91
91
  #define ARM_SME_ZA_STATE11 42
92
- #define ARM_SME_ZA_STATE12 42
92
+ #define ARM_SME_ZA_STATE12 43
93
93
  #define ARM_SME_ZA_STATE13 44
94
94
  #define ARM_SME_ZA_STATE14 45
95
95
  #define ARM_SME_ZA_STATE15 46
@@ -339,6 +339,10 @@
339
339
  /* A search or query operation did not return a result
340
340
  */
341
341
 
342
+ #define KERN_INVALID_GUARD_OBJECT_SLOT 57
343
+ /* Access to an guarded object slot attempted
344
+ */
345
+
342
346
  #define KERN_RETURN_MAX 0x100
343
347
  /* Maximum return value allowable
344
348
  */
@@ -52,7 +52,7 @@ typedef function_table_entry *function_table_t;
52
52
  #endif /* AUTOTEST */
53
53
 
54
54
  #ifndef mach_host_MSG_COUNT
55
- #define mach_host_MSG_COUNT 35
55
+ #define mach_host_MSG_COUNT 36
56
56
  #endif /* mach_host_MSG_COUNT */
57
57
 
58
58
  #include <Availability.h>
@@ -443,6 +443,23 @@ kern_return_t mach_zone_info_for_zone
443
443
  mach_zone_info_t *info
444
444
  );
445
445
 
446
+ /* Routine mach_memory_info_redacted */
447
+ #ifdef mig_external
448
+ mig_external
449
+ #else
450
+ extern
451
+ #endif /* mig_external */
452
+ kern_return_t mach_memory_info_redacted
453
+ (
454
+ mach_port_t host,
455
+ mach_zone_name_array_t *names,
456
+ mach_msg_type_number_t *namesCnt,
457
+ mach_zone_info_array_t *info,
458
+ mach_msg_type_number_t *infoCnt,
459
+ mach_memory_info_array_t *memory_info,
460
+ mach_msg_type_number_t *memory_infoCnt
461
+ );
462
+
446
463
  __END_DECLS
447
464
 
448
465
  /********************** Caution **************************/
@@ -787,6 +804,16 @@ __END_DECLS
787
804
  #ifdef __MigPackStructs
788
805
  #pragma pack(pop)
789
806
  #endif
807
+
808
+ #ifdef __MigPackStructs
809
+ #pragma pack(push, 4)
810
+ #endif
811
+ typedef struct {
812
+ mach_msg_header_t Head;
813
+ } __Request__mach_memory_info_redacted_t __attribute__((unused));
814
+ #ifdef __MigPackStructs
815
+ #pragma pack(pop)
816
+ #endif
790
817
  #endif /* !__Request__mach_host_subsystem__defined */
791
818
 
792
819
  /* union of all requests */
@@ -821,6 +848,7 @@ union __RequestUnion__mach_host_subsystem {
821
848
  __Request__host_get_multiuser_config_flags_t Request_host_get_multiuser_config_flags;
822
849
  __Request__host_check_multiuser_mode_t Request_host_check_multiuser_mode;
823
850
  __Request__mach_zone_info_for_zone_t Request_mach_zone_info_for_zone;
851
+ __Request__mach_memory_info_redacted_t Request_mach_memory_info_redacted;
824
852
  };
825
853
  #endif /* !__RequestUnion__mach_host_subsystem__defined */
826
854
  /* typedefs for all replies */
@@ -1217,6 +1245,26 @@ union __RequestUnion__mach_host_subsystem {
1217
1245
  #ifdef __MigPackStructs
1218
1246
  #pragma pack(pop)
1219
1247
  #endif
1248
+
1249
+ #ifdef __MigPackStructs
1250
+ #pragma pack(push, 4)
1251
+ #endif
1252
+ typedef struct {
1253
+ mach_msg_header_t Head;
1254
+ /* start of the kernel processed data */
1255
+ mach_msg_body_t msgh_body;
1256
+ mach_msg_ool_descriptor_t names;
1257
+ mach_msg_ool_descriptor_t info;
1258
+ mach_msg_ool_descriptor_t memory_info;
1259
+ /* end of the kernel processed data */
1260
+ NDR_record_t NDR;
1261
+ mach_msg_type_number_t namesCnt;
1262
+ mach_msg_type_number_t infoCnt;
1263
+ mach_msg_type_number_t memory_infoCnt;
1264
+ } __Reply__mach_memory_info_redacted_t __attribute__((unused));
1265
+ #ifdef __MigPackStructs
1266
+ #pragma pack(pop)
1267
+ #endif
1220
1268
  #endif /* !__Reply__mach_host_subsystem__defined */
1221
1269
 
1222
1270
  /* union of all replies */
@@ -1251,6 +1299,7 @@ union __ReplyUnion__mach_host_subsystem {
1251
1299
  __Reply__host_get_multiuser_config_flags_t Reply_host_get_multiuser_config_flags;
1252
1300
  __Reply__host_check_multiuser_mode_t Reply_host_check_multiuser_mode;
1253
1301
  __Reply__mach_zone_info_for_zone_t Reply_mach_zone_info_for_zone;
1302
+ __Reply__mach_memory_info_redacted_t Reply_mach_memory_info_redacted;
1254
1303
  };
1255
1304
  #endif /* !__RequestUnion__mach_host_subsystem__defined */
1256
1305
 
@@ -1282,7 +1331,8 @@ union __ReplyUnion__mach_host_subsystem {
1282
1331
  { "host_set_multiuser_config_flags", 228 },\
1283
1332
  { "host_get_multiuser_config_flags", 229 },\
1284
1333
  { "host_check_multiuser_mode", 230 },\
1285
- { "mach_zone_info_for_zone", 231 }
1334
+ { "mach_zone_info_for_zone", 231 },\
1335
+ { "mach_memory_info_redacted", 235 }
1286
1336
  #endif
1287
1337
 
1288
1338
  #ifdef __AfterMigUserHeader
@@ -299,7 +299,11 @@ extern kern_return_t debug_control_port_for_pid(
299
299
 
300
300
  extern mach_error_t mach_vm_reclaim_update_kernel_accounting_trap(
301
301
  mach_port_name_t target_tport,
302
- uint64_t *bytes_reclaimed);
302
+ uint64_t *bytes_reclaimed,
303
+ uint64_t *next_deadline);
304
+
305
+ extern kern_return_t thread_set_x86_64_compat(
306
+ uint32_t enable);
303
307
 
304
308
 
305
309
  __END_DECLS
@@ -126,6 +126,7 @@ typedef mach_port_t thread_t;
126
126
  typedef mach_port_t thread_act_t;
127
127
  typedef mach_port_t thread_inspect_t;
128
128
  typedef mach_port_t thread_read_t;
129
+ typedef mach_port_t thread_suspension_token_t;
129
130
  typedef mach_port_t ipc_space_t;
130
131
  typedef mach_port_t ipc_space_read_t;
131
132
  typedef mach_port_t ipc_space_inspect_t;
@@ -278,6 +279,9 @@ typedef unsigned int mach_thread_flavor_t;
278
279
  typedef natural_t ledger_item_t;
279
280
  #define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0))
280
281
 
282
+ typedef uint32_t ledger_entry_id_t;
283
+ #define LEDGER_ENTRY_ID_INVALID ((ledger_entry_id_t)0)
284
+
281
285
  typedef int64_t ledger_amount_t;
282
286
  #define LEDGER_LIMIT_INFINITY ((ledger_amount_t)((1ULL << 63) - 1))
283
287
 
@@ -136,6 +136,15 @@ typedef mach_voucher_attr_recipe_command_t *mach_voucher_attr_recipe_command_arr
136
136
  #define MACH_VOUCHER_ATTR_AUTO_REDEEM ((mach_voucher_attr_recipe_command_t)4)
137
137
  #define MACH_VOUCHER_ATTR_SEND_PREPROCESS ((mach_voucher_attr_recipe_command_t)5)
138
138
 
139
+ #if __BUILDING_XNU_LIB_UNITTEST__
140
+ /*
141
+ * These are test-only voucher commands exposed so we have a means to
142
+ * unit test 'allowed voucher command' and 'disallowed voucher command' logic.
143
+ */
144
+ #define MACH_VOUCHER_ATTR_UNIT_TEST_VECTOR_ALLOWED ((mach_voucher_attr_recipe_command_t)6)
145
+ #define MACH_VOUCHER_ATTR_UNIT_TEST_VECTOR_DISALLOWED ((mach_voucher_attr_recipe_command_t)7)
146
+ #endif /* __BUILDING_XNU_LIB_UNITTEST__ */
147
+
139
148
  /* redeem is on its way out? */
140
149
  #define MACH_VOUCHER_ATTR_REDEEM ((mach_voucher_attr_recipe_command_t)10)
141
150
 
@@ -410,6 +410,7 @@ typedef integer_t cpu_threadtype_t;
410
410
  #define CPUFAMILY_ARM_TAHITI 0x75d4acb9
411
411
  #define CPUFAMILY_ARM_TUPAI 0x204526d0
412
412
  #define CPUFAMILY_ARM_HIDRA 0x1d5a87e8
413
+ #define CPUFAMILY_ARM_SOTRA 0xf76c5b1a
413
414
  #define CPUFAMILY_ARM_THERA 0xab345f09
414
415
  #define CPUFAMILY_ARM_TILOS 0x01d7a72b
415
416
 
@@ -296,6 +296,7 @@ typedef struct {
296
296
  unsigned int pad3 : 24;
297
297
  mach_msg_descriptor_type_t type : 8;
298
298
  } mach_msg_type_descriptor_t;
299
+ xnu_static_assert_struct_size(mach_msg_type_descriptor_t, 12);
299
300
 
300
301
  typedef struct {
301
302
  mach_port_t name;
@@ -304,6 +305,7 @@ typedef struct {
304
305
  mach_msg_type_name_t disposition : 8;
305
306
  mach_msg_descriptor_type_t type : 8;
306
307
  } mach_msg_port_descriptor_t;
308
+ xnu_static_assert_struct_size_kernel_user(mach_msg_port_descriptor_t, 16, 12);
307
309
 
308
310
 
309
311
  typedef struct {
@@ -314,6 +316,7 @@ typedef struct {
314
316
  unsigned int pad1: 8;
315
317
  mach_msg_descriptor_type_t type: 8;
316
318
  } mach_msg_ool_descriptor32_t;
319
+ xnu_static_assert_struct_size(mach_msg_ool_descriptor32_t, 12);
317
320
 
318
321
  typedef struct {
319
322
  uint64_t address;
@@ -323,6 +326,7 @@ typedef struct {
323
326
  mach_msg_descriptor_type_t type: 8;
324
327
  mach_msg_size_t size;
325
328
  } mach_msg_ool_descriptor64_t;
329
+ xnu_static_assert_struct_size(mach_msg_ool_descriptor64_t, 16);
326
330
 
327
331
  typedef struct {
328
332
  void *address;
@@ -337,6 +341,7 @@ typedef struct {
337
341
  mach_msg_size_t size;
338
342
  #endif
339
343
  } mach_msg_ool_descriptor_t;
344
+ xnu_static_assert_struct_size_kernel_user64_user32(mach_msg_ool_descriptor_t, 16, 16, 12);
340
345
 
341
346
  typedef struct {
342
347
  uint32_t address;
@@ -346,6 +351,7 @@ typedef struct {
346
351
  mach_msg_type_name_t disposition : 8;
347
352
  mach_msg_descriptor_type_t type : 8;
348
353
  } mach_msg_ool_ports_descriptor32_t;
354
+ xnu_static_assert_struct_size(mach_msg_ool_descriptor32_t, 12);
349
355
 
350
356
  typedef struct {
351
357
  uint64_t address;
@@ -355,6 +361,7 @@ typedef struct {
355
361
  mach_msg_descriptor_type_t type : 8;
356
362
  mach_msg_size_t count;
357
363
  } mach_msg_ool_ports_descriptor64_t;
364
+ xnu_static_assert_struct_size(mach_msg_ool_ports_descriptor64_t, 16);
358
365
 
359
366
  typedef struct {
360
367
  void *address;
@@ -369,6 +376,7 @@ typedef struct {
369
376
  mach_msg_size_t count;
370
377
  #endif
371
378
  } mach_msg_ool_ports_descriptor_t;
379
+ xnu_static_assert_struct_size_kernel_user64_user32(mach_msg_ool_ports_descriptor_t, 16, 16, 12);
372
380
 
373
381
  typedef struct {
374
382
  uint32_t context;
@@ -377,6 +385,7 @@ typedef struct {
377
385
  mach_msg_type_name_t disposition : 8;
378
386
  mach_msg_descriptor_type_t type : 8;
379
387
  } mach_msg_guarded_port_descriptor32_t;
388
+ xnu_static_assert_struct_size(mach_msg_guarded_port_descriptor32_t, 12);
380
389
 
381
390
  typedef struct {
382
391
  uint64_t context;
@@ -385,6 +394,7 @@ typedef struct {
385
394
  mach_msg_descriptor_type_t type : 8;
386
395
  mach_port_name_t name;
387
396
  } mach_msg_guarded_port_descriptor64_t;
397
+ xnu_static_assert_struct_size(mach_msg_guarded_port_descriptor64_t, 16);
388
398
 
389
399
  typedef struct {
390
400
  mach_port_context_t context;
@@ -398,6 +408,7 @@ typedef struct {
398
408
  mach_port_name_t name;
399
409
  #endif /* defined(__LP64__) */
400
410
  } mach_msg_guarded_port_descriptor_t;
411
+ xnu_static_assert_struct_size_kernel_user64_user32(mach_msg_guarded_port_descriptor_t, 16, 16, 12);
401
412
 
402
413
  /*
403
414
  * LP64support - This union definition is not really
@@ -411,10 +422,12 @@ typedef union {
411
422
  mach_msg_type_descriptor_t type;
412
423
  mach_msg_guarded_port_descriptor_t guarded_port;
413
424
  } mach_msg_descriptor_t;
425
+ xnu_static_assert_struct_size_kernel_user64_user32(mach_msg_descriptor_t, 16, 16, 12);
414
426
 
415
427
  typedef struct {
416
428
  mach_msg_size_t msgh_descriptor_count;
417
429
  } mach_msg_body_t;
430
+ xnu_static_assert_struct_size(mach_msg_body_t, 4);
418
431
 
419
432
  #define MACH_MSG_BODY_NULL ((mach_msg_body_t *) 0)
420
433
  #define MACH_MSG_DESCRIPTOR_NULL ((mach_msg_descriptor_t *) 0)
@@ -427,6 +440,7 @@ typedef struct {
427
440
  mach_port_name_t msgh_voucher_port;
428
441
  mach_msg_id_t msgh_id;
429
442
  } mach_msg_header_t;
443
+ xnu_static_assert_struct_size_kernel_user(mach_msg_header_t, 32, 24);
430
444
 
431
445
 
432
446
  #define msgh_reserved msgh_voucher_port
@@ -436,6 +450,7 @@ typedef struct {
436
450
  mach_msg_header_t header;
437
451
  mach_msg_body_t body;
438
452
  } mach_msg_base_t;
453
+ xnu_static_assert_struct_size_kernel_user(mach_msg_base_t, 36, 28);
439
454
 
440
455
 
441
456
  typedef unsigned int mach_msg_trailer_type_t;
@@ -449,6 +464,7 @@ typedef struct {
449
464
  mach_msg_trailer_type_t msgh_trailer_type;
450
465
  mach_msg_trailer_size_t msgh_trailer_size;
451
466
  } mach_msg_trailer_t;
467
+ xnu_static_assert_struct_size(mach_msg_trailer_t, 8);
452
468
 
453
469
  /*
454
470
  * The msgh_seqno field carries a sequence number
@@ -464,6 +480,7 @@ typedef struct {
464
480
  mach_msg_trailer_size_t msgh_trailer_size;
465
481
  mach_port_seqno_t msgh_seqno;
466
482
  } mach_msg_seqno_trailer_t;
483
+ xnu_static_assert_struct_size(mach_msg_seqno_trailer_t, 12);
467
484
 
468
485
  typedef struct {
469
486
  unsigned int val[2];
@@ -475,6 +492,7 @@ typedef struct {
475
492
  mach_port_seqno_t msgh_seqno;
476
493
  security_token_t msgh_sender;
477
494
  } mach_msg_security_trailer_t;
495
+ xnu_static_assert_struct_size(mach_msg_security_trailer_t, 20);
478
496
 
479
497
  /*
480
498
  * The audit token is an opaque token which identifies
@@ -512,6 +530,7 @@ typedef struct {
512
530
  security_token_t msgh_sender;
513
531
  audit_token_t msgh_audit;
514
532
  } mach_msg_audit_trailer_t;
533
+ xnu_static_assert_struct_size(mach_msg_audit_trailer_t, 52);
515
534
 
516
535
  typedef struct {
517
536
  mach_msg_trailer_type_t msgh_trailer_type;
@@ -521,6 +540,7 @@ typedef struct {
521
540
  audit_token_t msgh_audit;
522
541
  mach_port_context_t msgh_context;
523
542
  } mach_msg_context_trailer_t;
543
+ xnu_static_assert_struct_size_kernel_user64_user32(mach_msg_context_trailer_t, 60, 60, 56);
524
544
 
525
545
 
526
546
 
@@ -546,6 +566,7 @@ typedef struct {
546
566
  mach_msg_filter_id msgh_ad;
547
567
  msg_labels_t msgh_labels;
548
568
  } mach_msg_mac_trailer_t;
569
+ xnu_static_assert_struct_size_kernel_user64_user32(mach_msg_mac_trailer_t, 68, 68, 64);
549
570
 
550
571
 
551
572
  #define MACH_MSG_TRAILER_MINIMUM_SIZE sizeof(mach_msg_trailer_t)
@@ -91,6 +91,29 @@
91
91
  #include <mach/boolean.h>
92
92
  #include <mach/machine/vm_types.h>
93
93
 
94
+ /*
95
+ * Helpers to declare and lock down the expected size for structures.
96
+ * Some structures must remain a constant size due to performance or ABI implications.
97
+ * It's not necessarily an issue if you need to bump a size passed to these macros: act judiciously.
98
+ */
99
+ #if __arm64__
100
+ #define xnu_static_assert_struct_size(name, expected_size) _Static_assert(\
101
+ sizeof(name) == expected_size, "struct changed size unexpectedly")
102
+ #else /* __arm64__ */
103
+ /* Don't bother trying to lock down structure sizes on !__arm64__ */
104
+ #define xnu_static_assert_struct_size(name, expected_size) _Static_assert(0 == 0, "no-op assert")
105
+ #endif /* __arm64__ */
106
+
107
+ #define xnu_static_assert_struct_size_kernel_user(name, expected_kernel_size, expected_user_size) \
108
+ xnu_static_assert_struct_size(name, expected_user_size)
109
+ #ifdef __LP64__
110
+ #define xnu_static_assert_struct_size_kernel_user64_user32(name, _kern_size, expected_user64_size, _u32_size) \
111
+ xnu_static_assert_struct_size(name, expected_user64_size)
112
+ #else /* __LP64__ */
113
+ #define xnu_static_assert_struct_size_kernel_user64_user32(name, _kern_size, _u64_size, expected_user32_size) \
114
+ xnu_static_assert_struct_size(name, expected_user32_size)
115
+ #endif /* __LP64__ */
116
+
94
117
  /*
95
118
  * mach_port_name_t - the local identity for a Mach port
96
119
  *
@@ -341,8 +364,8 @@ typedef struct mach_service_port_info * mach_service_port_info_t;
341
364
  */
342
365
  #define MACH_PORT_CONNECTION_PORT_WITH_PORT_ARRAY "com.apple.developer.allow-connection-port-with-port-array"
343
366
 
344
- /* Allows 1p process to create provisional reply port (to be rename to weak reply port) */
345
- #define MACH_PORT_PROVISIONAL_REPLY_ENTITLEMENT "com.apple.private.allow-weak-reply-port"
367
+ /* Allows 1p process to create weak reply port */
368
+ #define MACH_PORT_WEAK_REPLY_ENTITLEMENT "com.apple.private.allow-weak-reply-port"
346
369
 
347
370
  /*
348
371
  * Flags for mach_port_options (used for
@@ -387,7 +410,8 @@ typedef struct mach_service_port_info * mach_service_port_info_t;
387
410
  #define MPO_SERVICE_PORT MPO_SERVICE_PORT
388
411
  #define MPO_CONNECTION_PORT MPO_CONNECTION_PORT
389
412
  #define MPO_REPLY_PORT MPO_REPLY_PORT
390
- #define MPO_PROVISIONAL_REPLY_PORT MPO_PROVISIONAL_REPLY_PORT
413
+ #define MPO_WEAK_REPLY_PORT MPO_WEAK_REPLY_PORT
414
+ #define MPO_NOTIFICATION_PORT MPO_NOTIFICATION_PORT
391
415
  #define MPO_EXCEPTION_PORT MPO_EXCEPTION_PORT
392
416
  #define MPO_CONNECTION_PORT_WITH_PORT_ARRAY MPO_CONNECTION_PORT_WITH_PORT_ARRAY
393
417
  __options_decl(mpo_flags_t, uint32_t, {
@@ -399,13 +423,19 @@ __options_decl(mpo_flags_t, uint32_t, {
399
423
  MPO_CONNECTION_PORT = MPO_MAKE_PORT_TYPE(0, 2), /* 0x800 */
400
424
  /* Designate port as a reply port */
401
425
  MPO_REPLY_PORT = MPO_MAKE_PORT_TYPE(0, 4), /* 0x1000 */
402
- /* Designate port as a provisional (fake) reply port */
403
- MPO_PROVISIONAL_REPLY_PORT = MPO_MAKE_PORT_TYPE(1, 0), /* 0x4000 */
426
+ /* Designate port as a weak (fake) reply port */
427
+ MPO_WEAK_REPLY_PORT = MPO_MAKE_PORT_TYPE(1, 0), /* 0x4000 */
428
+ /* Designate port as a notification port */
429
+ MPO_NOTIFICATION_PORT = MPO_MAKE_PORT_TYPE(1, 1), /* 0x4400 */
404
430
  /* Used for hardened exceptions - immovable */
405
431
  MPO_EXCEPTION_PORT = MPO_MAKE_PORT_TYPE(2, 0), /* 0x8000 */
406
432
  /* Can receive OOL port array descriptors */
407
433
  MPO_CONNECTION_PORT_WITH_PORT_ARRAY = MPO_MAKE_PORT_TYPE(4, 0), /* 0x10000 */
408
434
  });
435
+
436
+ /* For bincompat: weak reply port used to be called provisional reply port */
437
+ #define MPO_PROVISIONAL_REPLY_PORT MPO_WEAK_REPLY_PORT
438
+
409
439
  #define MPO_UNUSED_BITS ~(MPO_OPTIONS_MASK | MPO_PORT_TYPE_MASK)
410
440
 
411
441
  /* Denotes an anonymous service */
@@ -455,7 +485,7 @@ enum mach_port_guard_exception_codes {
455
485
  kGUARD_EXC_SET_CONTEXT = 4,
456
486
  kGUARD_EXC_THREAD_SET_STATE = 5,
457
487
  kGUARD_EXC_EXCEPTION_BEHAVIOR_ENFORCE = 6,
458
- kGUARD_EXC_SERVICE_PORT_VIOLATION_FATAL = 7, /* unused, for future sp defense enablement */
488
+ kGUARD_EXC_SERVICE_PORT_VIOLATION_FATAL = 7,
459
489
  kGUARD_EXC_UNGUARDED = 8,
460
490
  kGUARD_EXC_KOBJECT_REPLY_PORT_SEMANTICS = 9,
461
491
  kGUARD_EXC_REQUIRE_REPLY_PORT_SEMANTICS = 10,
@@ -465,7 +495,7 @@ enum mach_port_guard_exception_codes {
465
495
  kGUARD_EXC_INVALID_NOTIFICATION_REQ = 65,
466
496
  kGUARD_EXC_INVALID_MPO_ENTITLEMENT = 66,
467
497
  kGUARD_EXC_DESCRIPTOR_VIOLATION = 67,
468
- kGUARD_EXC_MSG_FILTERED = 128,
498
+ kGUARD_EXC_MSG_FILTERED = 128,
469
499
  /* start of [optionally] non-fatal guards */
470
500
  kGUARD_EXC_INVALID_RIGHT = 256,
471
501
  kGUARD_EXC_INVALID_NAME = 512,
@@ -481,18 +511,25 @@ enum mach_port_guard_exception_codes {
481
511
  kGUARD_EXC_RCV_INVALID_NAME = 1u << 19,
482
512
  /* start of always non-fatal guards */
483
513
  kGUARD_EXC_RCV_GUARDED_DESC = 0x00100000, /* for development only */
484
- kGUARD_EXC_SERVICE_PORT_VIOLATION_NON_FATAL = 0x00100001, /* unused, for future sp defense enablement */
485
- kGUARD_EXC_PROVISIONAL_REPLY_PORT = 0x00100002, /* unused */
514
+ kGUARD_EXC_SERVICE_PORT_VIOLATION_NON_FATAL = 0x00100001, /* unused */
515
+ kGUARD_EXC_INVALID_NOTIFICATION_PORT = 0x00100006,
516
+ kGUARD_EXC_MACH_EXC_THREAD_SET_STATE = 0x00100007,
517
+ kGUARD_EXC_CV_NOTIFICATION_PORT_REQ = 0x00100008,
518
+ kGUARD_EXC_WEAK_REPLY_PORT = 0x00100002, /* unused */
486
519
  kGUARD_EXC_OOL_PORT_ARRAY_CREATION = 0x00100003, /* unused */
487
- kGUARD_EXC_MOVE_PROVISIONAL_REPLY_PORT = 0x00100004,
520
+ kGUARD_EXC_MOVE_WEAK_REPLY_PORT = 0x00100004,
488
521
  kGUARD_EXC_REPLY_PORT_SINGLE_SO_RIGHT = 0x00100005,
489
522
  kGUARD_EXC_MOD_REFS_NON_FATAL = 1u << 21,
490
- kGUARD_EXC_IMMOVABLE_NON_FATAL = 1u << 22, /* unused*/
523
+ kGUARD_EXC_IMMOVABLE_NON_FATAL = 1u << 22, /* unused */
491
524
  };
492
525
 
493
526
  #define MAX_FATAL_kGUARD_EXC_CODE kGUARD_EXC_MSG_FILTERED
494
527
  #define MAX_OPTIONAL_kGUARD_EXC_CODE kGUARD_EXC_RCV_INVALID_NAME
495
528
 
529
+ /* Temporary! Should be removed after rdar://166892063 */
530
+ #define kGUARD_EXC_PROVISIONAL_REPLY_PORT kGUARD_EXC_WEAK_REPLY_PORT
531
+ #define kGUARD_EXC_MOVE_PROVISIONAL_REPLY_PORT kGUARD_EXC_MOVE_WEAK_REPLY_PORT
532
+
496
533
 
497
534
  /*
498
535
  * Mach port guard flags.