peachsim 0.1.1716 → 0.1.1738

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 (282) hide show
  1. package/README.md +21 -3
  2. package/cli/app-bundle-resources.ts +2 -1
  3. package/cli/app-fonts.ts +4 -4
  4. package/cli/app-splash.ts +4 -4
  5. package/cli/app-stubs.ts +17 -0
  6. package/cli/command-registry.ts +1 -0
  7. package/cli/commands/control.ts +83 -822
  8. package/cli/commands/coverage-swift.ts +112 -4
  9. package/cli/commands/daemon.ts +8 -0
  10. package/cli/commands/detox.ts +3 -0
  11. package/cli/commands/doctor.ts +19 -2
  12. package/cli/commands/inspect/actions.ts +74 -14
  13. package/cli/commands/inspect/core.ts +5 -1
  14. package/cli/commands/inspect/settling.ts +5 -2
  15. package/cli/commands/inspect/wait-ready.ts +6 -0
  16. package/cli/commands/inspect.ts +48 -45
  17. package/cli/commands/kotlin.ts +12 -2
  18. package/cli/commands/package.ts +760 -0
  19. package/cli/commands/serve.ts +6 -0
  20. package/cli/commands/shell-url.ts +838 -0
  21. package/cli/commands/swift.ts +42 -102
  22. package/cli/commands/test.ts +20 -0
  23. package/cli/commands/upload.ts +1 -1
  24. package/cli/device-option.ts +1 -1
  25. package/cli/main.ts +13 -1
  26. package/cli/native-input.ts +199 -0
  27. package/cli/outbound-endpoints.ts +26 -1
  28. package/cli/packaged-app-launcher.ts +95 -0
  29. package/cli/scene-video.ts +36 -12
  30. package/detox/index.ts +196 -24
  31. package/dist-lib/agent-daemon-client.cjs +1 -1
  32. package/dist-lib/agent-events.cjs +1 -1
  33. package/dist-lib/attached-projects.cjs +5 -2
  34. package/dist-lib/auth/shared-session.cjs +5 -2
  35. package/dist-lib/backend-origin.cjs +1 -1
  36. package/dist-lib/beta.cjs +1 -1
  37. package/dist-lib/beta.mjs +1 -1
  38. package/dist-lib/bridge-constants.cjs +1 -1
  39. package/dist-lib/bridge-contract-input.cjs +1 -1
  40. package/dist-lib/bridge-contract-input.mjs +1 -1
  41. package/dist-lib/bridge-contract.cjs +1 -1
  42. package/dist-lib/bridge-contract.mjs +1 -1
  43. package/dist-lib/bundle-channel.cjs +39889 -31873
  44. package/dist-lib/capture-contract.cjs +1 -1
  45. package/dist-lib/capture-contract.mjs +1 -1
  46. package/dist-lib/cloud-contract.cjs +1 -1
  47. package/dist-lib/cloud-contract.mjs +1 -1
  48. package/dist-lib/cloud-test-args.cjs +1 -1
  49. package/dist-lib/cloud-test-args.mjs +1 -1
  50. package/dist-lib/cloud.cjs +1 -1
  51. package/dist-lib/cloud.mjs +1 -1
  52. package/dist-lib/config.cjs +1 -1
  53. package/dist-lib/config.mjs +1 -1
  54. package/dist-lib/detox/index.cjs +195 -63
  55. package/dist-lib/dev-bundle-resolution.cjs +14 -13
  56. package/dist-lib/expo-swift-bundle.cjs +18507 -11835
  57. package/dist-lib/expo-swift-metadata.cjs +4 -1
  58. package/dist-lib/expo-swift-metadata.mjs +3 -1
  59. package/dist-lib/home-paths.cjs +27 -3
  60. package/dist-lib/host/bridge-host.cjs +28373 -24090
  61. package/dist-lib/host/fetch-proxy-handler.cjs +235 -225
  62. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  63. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  64. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  65. package/dist-lib/host/websocket-proxy.cjs +1 -1
  66. package/dist-lib/index.cjs +915 -399
  67. package/dist-lib/jump-to-source-babel.cjs +1 -1
  68. package/dist-lib/jump-to-source-native.cjs +1 -1
  69. package/dist-lib/kotlin-host.cjs +335 -47
  70. package/dist-lib/menu.cjs +13 -1
  71. package/dist-lib/menu.mjs +13 -1
  72. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  73. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  74. package/dist-lib/metro-production-bundle.cjs +1 -1
  75. package/dist-lib/metro-production-bundle.mjs +1 -1
  76. package/dist-lib/metro.cjs +918 -411
  77. package/dist-lib/native-app-identity-project.cjs +703 -283
  78. package/dist-lib/native-app-identity-project.mjs +500 -87
  79. package/dist-lib/native-app-identity.cjs +13 -2
  80. package/dist-lib/native-app-identity.mjs +13 -2
  81. package/dist-lib/native-firebase-metadata.cjs +1 -1
  82. package/dist-lib/native-firebase-metadata.mjs +1 -1
  83. package/dist-lib/plist.cjs +1 -1
  84. package/dist-lib/plist.mjs +1 -1
  85. package/dist-lib/profiles.cjs +5 -2
  86. package/dist-lib/public-brand.cjs +1 -1
  87. package/dist-lib/public-origins-lib-esm.json +28 -23
  88. package/dist-lib/public-origins-lib.json +418 -224
  89. package/dist-lib/react-native-host-modules.cjs +35 -2
  90. package/dist-lib/react-native-host-modules.mjs +35 -2
  91. package/dist-lib/reap-browser.cjs +12 -4
  92. package/dist-lib/scripts/dev-server-scanner.cjs +15 -8
  93. package/dist-lib/sdk.cjs +17 -7
  94. package/dist-lib/sdk.mjs +16 -7
  95. package/dist-lib/skills.cjs +44825 -29141
  96. package/dist-lib/swift-compile.cjs +616 -400
  97. package/dist-lib/swift-compile.mjs +528 -315
  98. package/dist-lib/swift-package.cjs +1 -1
  99. package/dist-lib/swift-package.mjs +1 -1
  100. package/dist-lib/swift-submit.cjs +2 -2
  101. package/dist-lib/swift-submit.mjs +2 -2
  102. package/dist-lib/swift-toolchain.cjs +105 -17
  103. package/dist-lib/swift.cjs +1 -1
  104. package/dist-lib/vite-swift.cjs +4660 -2252
  105. package/dist-lib/vite.cjs +248 -234
  106. package/dist-lib/worklet-executable.cjs +1 -1
  107. package/dist-lib/worklet-executable.mjs +1 -1
  108. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +17 -8
  109. package/dist-types/packages/peach-engine/src/engine/canvaskit-renderer.d.ts +1 -0
  110. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +7 -4
  111. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +9 -6
  112. package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +0 -5
  113. package/dist-types/packages/peach-engine/src/engine/memory-counts.d.ts +11 -1
  114. package/dist-types/packages/peach-engine/src/engine/node.d.ts +5 -12
  115. package/dist-types/packages/peach-engine/src/engine/render-damage.d.ts +2 -2
  116. package/dist-types/packages/peach-engine/src/engine/text-first-baseline.d.ts +5 -0
  117. package/dist-types/packages/peach-engine/src/engine/text-paragraph.d.ts +1 -0
  118. package/dist-types/packages/peach-engine/src/engine/types.d.ts +3 -0
  119. package/dist-types/packages/peach-engine/src/native-preview-bundle.d.ts +2 -0
  120. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +9 -0
  121. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  122. package/dist-types/packages/peach-engine/src/render-worker/native-ui-commandContract.d.ts +1 -1
  123. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +7 -2
  124. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
  125. package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +1 -1
  126. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +36 -2
  127. package/dist-types/packages/peach-engine/src/shell-events.d.ts +1 -0
  128. package/dist-types/packages/peach-globals/src/audioBridgeContract.d.ts +5 -0
  129. package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
  130. package/dist-types/packages/peach-globals/src/keyboardBridgeContract.d.ts +11 -0
  131. package/dist-types/packages/peach-globals/src/shellBridgeContract.d.ts +1 -0
  132. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +9 -2
  133. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  134. package/kotlin/README.md +3 -0
  135. package/kotlin/sdk.tar.gz +0 -0
  136. package/package.json +1 -1
  137. package/runtime-companion.json +1 -1
  138. package/scripts/dev-server-scanner.ts +12 -25
  139. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccount.h +55 -0
  140. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountCredential.h +35 -0
  141. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountStore.h +94 -0
  142. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACAccountType.h +53 -0
  143. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/ACError.h +37 -0
  144. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/Accounts.h +13 -0
  145. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Headers/AccountsDefines.h +13 -0
  146. package/sdk/ios/System/Library/Frameworks/Accounts.framework/Modules/module.modulemap +5 -0
  147. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASFoundation.h +52 -0
  148. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +128 -0
  149. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSessionCallback.h +35 -0
  150. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/AuthenticationServices.h +3 -0
  151. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Modules/module.modulemap +5 -0
  152. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFHTTPMessage.h +724 -0
  153. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h +4 -0
  154. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetworkDefs.h +27 -0
  155. package/sdk/ios/System/Library/Frameworks/CFNetwork.framework/Modules/module.modulemap +5 -0
  156. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h +1301 -0
  157. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +3 -1
  158. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +21 -50
  159. package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +6 -6
  160. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +58 -3
  161. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +711 -46
  162. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h +12 -0
  163. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIInterface.h +23 -0
  164. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +7 -9
  165. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIOrientation.h +14 -0
  166. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIStringDrawing.h +12 -0
  167. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIView.h +14 -0
  168. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewAnimating.h +12 -0
  169. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIViewController.h +16 -0
  170. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIWindow.h +2 -0
  171. package/sdk/ios/usr/include/ConditionalMacros.h +619 -0
  172. package/sdk/ios/usr/include/module.modulemap +1 -0
  173. package/sdk/ios/usr/include/objc/objc-sync.h +59 -0
  174. package/sdk/ios/usr/include/os/signpost.h +414 -0
  175. package/sdk/ios/usr/include/os.modulemap +10 -0
  176. package/sdk/ios/usr/include/sys/cdefs.h +5 -0
  177. package/sdk/ios/usr/include/sys/ioccom.h +99 -0
  178. package/sdk/ios/usr/include/sys/syslog.h +236 -0
  179. package/sdk/ios/usr/include/syslog.h +24 -0
  180. package/sdk/ios/wasm/include/errno.h +4 -20
  181. package/sdk/ios/wasm/include/fcntl.h +4 -2
  182. package/sdk/ios/wasm/include/pthread.h +3 -0
  183. package/sdk/ios/wasm/include/setjmp.h +57 -0
  184. package/sdk/ios/wasm/include/stdio.h +24 -0
  185. package/sdk/ios/wasm/include/stdlib.h +32 -7
  186. package/sdk/ios/wasm/include/sys/file.h +7 -0
  187. package/sdk/ios/wasm/include/sys/ioctl.h +6 -0
  188. package/sdk/ios/wasm/include/sys/resource.h +2 -2
  189. package/sdk/ios/wasm/include/sys/syscall.h +9 -0
  190. package/sdk/ios/wasm/include/sys/time.h +10 -0
  191. package/sdk/ios/wasm/include/unistd.h +12 -3
  192. package/sdk/native-hashes.json +4 -3
  193. package/skills/contrast/SKILL.md +2 -1
  194. package/skills/peach-debug/SKILL.md +0 -1
  195. package/skills/peach-perf/SKILL.md +0 -1
  196. package/skills/peach-setup/SKILL.md +0 -1
  197. package/skills/peach-test/SKILL.md +7 -4
  198. package/skills/peach-visual/SKILL.md +0 -1
  199. package/src/admitted-mac-build.ts +3 -0
  200. package/src/android-app-identity.ts +18 -0
  201. package/src/android-autolinking.ts +1 -0
  202. package/src/android-bridge-packages.ts +279 -0
  203. package/src/android-root-module.ts +9 -9
  204. package/src/appPackageContract.ts +83 -0
  205. package/src/bridge-contract.ts +50 -0
  206. package/src/bundle-channel.mjs +41 -6
  207. package/src/cli-runtime.ts +9 -5
  208. package/src/dev-bundle-resolution.ts +7 -27
  209. package/src/dom-source-reference.ts +15 -0
  210. package/src/expo-discovery-cache.ts +134 -26
  211. package/src/expo-kotlin-host.ts +97 -26
  212. package/src/expo-manifest-body.ts +33 -0
  213. package/src/expo-native-workspace.ts +158 -38
  214. package/src/expo-swift-host.ts +350 -75
  215. package/src/expo-swift-ready.ts +5 -1
  216. package/src/expoKotlinContract.ts +12 -2
  217. package/src/expoSwiftContract.ts +10 -0
  218. package/src/generated/swift-c-predefines.json +1 -1
  219. package/src/home-paths.ts +41 -2
  220. package/src/host/app-package-handler.ts +47 -0
  221. package/src/host/bridge-host.ts +8 -0
  222. package/src/host/fetch-proxy-handler.ts +10 -0
  223. package/src/host/staged-host-files.ts +18 -0
  224. package/src/index.ts +3 -0
  225. package/src/kotlin-host.ts +225 -48
  226. package/src/kotlin-instance-source.ts +126 -0
  227. package/src/kotlinSdkContract.ts +2 -1
  228. package/src/menu.ts +14 -0
  229. package/src/native-app-identity-project.ts +7 -2
  230. package/src/native-app-identity.ts +11 -0
  231. package/src/native-firebase-config.ts +24 -1
  232. package/src/native-prebuilt.ts +154 -0
  233. package/src/nitro-adapter.lock.json +270 -270
  234. package/src/nitro-adapter.ts +56 -50
  235. package/src/nitro-bundle.ts +92 -74
  236. package/src/nitro-compile.ts +45 -14
  237. package/src/nitro-dependencies.ts +63 -46
  238. package/src/nitro-source.ts +64 -26
  239. package/src/nitroAdapterContract.ts +146 -98
  240. package/src/nitroContract.ts +71 -21
  241. package/src/react-native-bridge-modules.ts +70 -42
  242. package/src/react-native-host-modules.ts +34 -1
  243. package/src/reactNativeConfigurationContract.ts +14 -0
  244. package/src/reap-browser.ts +15 -3
  245. package/src/sdk.ts +5 -0
  246. package/src/settingsContract.ts +38 -1
  247. package/src/sim-client.ts +4 -1
  248. package/src/storageSnapshotContract.ts +32 -81
  249. package/src/swift-compile.ts +268 -89
  250. package/src/swift-coverage/indexdump.ts +22 -6
  251. package/src/swift-coverage/indexing.ts +4 -4
  252. package/src/swift-coverage/provenance.ts +1 -0
  253. package/src/swift-coverage/sdk.ts +104 -20
  254. package/src/swift-coverage/types.ts +34 -0
  255. package/src/swift-coverage/xcode-asset-symbols.ts +922 -0
  256. package/src/swift-coverage/xcode-assets.ts +89 -131
  257. package/src/swift-coverage/xcode.ts +10 -2
  258. package/src/swift-cxx-reachable.ts +2 -1
  259. package/src/swift-distribution.lock.json +20 -16
  260. package/src/swift-host.ts +98 -22
  261. package/src/swift-icu.ts +1 -1
  262. package/src/swift-link-roots.ts +118 -0
  263. package/src/swift-objc-compile.ts +144 -22
  264. package/src/swift-objc-import.ts +6 -0
  265. package/src/swift-objc-standin.ts +2 -14
  266. package/src/swift-package-manifest.ts +14 -6
  267. package/src/swift-packages.ts +75 -11
  268. package/src/swift-pdf-raster.ts +1 -0
  269. package/src/swift-root-lock.ts +17 -1
  270. package/src/swift-source-pods.ts +2 -10
  271. package/src/swift-standin-emit.ts +597 -57
  272. package/src/swift-standins.ts +599 -56
  273. package/src/swift-submit.ts +7 -1
  274. package/src/swift-toolchain.ts +140 -17
  275. package/src/turbo-bundle.ts +81 -0
  276. package/src/turbo-codegen-intake.ts +91 -0
  277. package/src/turbo-compile.ts +120 -0
  278. package/src/turbo-runtime.lock.json +69 -0
  279. package/src/turbo-source.ts +754 -0
  280. package/src/vite-plugin-one.ts +17 -12
  281. package/src/vite-plugin.ts +28 -15
  282. package/src/xcode-project.ts +223 -22
@@ -0,0 +1,414 @@
1
+ /*
2
+ * Copyright (c) 2017-2018 Apple Inc. All rights reserved.
3
+ */
4
+
5
+ #ifndef __OS_SIGNPOST_H__
6
+ #define __OS_SIGNPOST_H__
7
+
8
+ #include <os/log.h>
9
+
10
+ __BEGIN_DECLS
11
+
12
+ OS_ASSUME_NONNULL_BEGIN
13
+
14
+ /*!
15
+ * @header os_signpost
16
+ *
17
+ * The os_signpost APIs let clients add lightweight instrumentation to
18
+ * code for collection and visualization by performance analysis tooling.
19
+ *
20
+ * Clients of os_signpost can instrument interesting periods of time
21
+ * ('intervals') and single points in time ('events'). Intervals can span
22
+ * processes, be specific to one process, or be specific to a single thread.
23
+ *
24
+ * Intervals and events include an os_log-style format string and arguments
25
+ * which can be used to convey contextual information.
26
+ */
27
+
28
+ #pragma mark - Interval Matching Scope
29
+
30
+ /*!
31
+ * The matching scope for signpost intervals logged with a given os_log_t is
32
+ * specified in that log handles's configuration plist using the
33
+ * 'Signpost-Scope' key and defaults to process-wide scope (i.e. 'Process'
34
+ * value) if unspecified.
35
+ *
36
+ * Signpost interval begin and end matching can have 3 different scopes:
37
+ *
38
+ * - Thread-wide: The search scope for matching begins and ends is restricted to
39
+ * single threads. To set this as the search scope for an os_log_t, set
40
+ * 'Thread' as the string value for the 'Signpost-Scope' key in the
41
+ * os_log_t's configuration plist.
42
+ *
43
+ * - Process-wide (Default value): The search scope for matching begins and ends
44
+ * is restricted to a single process. (i.e. no cross-process intervals)
45
+ * To set this as the search scope for an os_log_t, set
46
+ * 'Process' as the string value for the 'Signpost-Scope' key in the
47
+ * os_log_t's configuration plist or do not specify any 'Signpost-Scope' key-
48
+ * value pair.
49
+ *
50
+ * - System-wide: The search scope for matching begins and ends is not
51
+ * restricted. (i.e. cross-process intervals are possible)
52
+ * To set this as the search scope for an os_log_t, set
53
+ * 'System' as the string value for the 'Signpost-Scope' key in the
54
+ * os_log_t's configuration plist.
55
+ *
56
+ */
57
+
58
+
59
+ #pragma mark - Signpost IDs
60
+
61
+ /*!
62
+ * Disambiguating intervals with signpost IDs
63
+ *
64
+ * Intervals with the same log handle and interval name can be in flight
65
+ * simultaneously. In order for tools to correctly match begin signposts with
66
+ * end signposts, it is necessary to identify each interval with an
67
+ * os_signpost_id_t.
68
+ *
69
+ * If only one interval with a given os_log_t and interval name will ever be in
70
+ * flight at a time, use the os_signpost_t convenience value
71
+ * OS_SIGNPOST_ID_EXCLUSIVE. This can avoid having to share state between begin
72
+ * and end callsites.
73
+ *
74
+ * If there exists some non-pointer uint64_t value that uniquely identifies
75
+ * begin/end pairs, that value can be cast directly to an os_signpost_id_t.
76
+ * Note that the values OS_SIGNPOST_ID_NULL and OS_SIGNPOST_ID_INVALID are
77
+ * reserved and identical values may not be used in this manner.
78
+ *
79
+ * If there exists a pointer which can identify begin/end pairs, an
80
+ * os_signpost_id_t can be generated from that pointer with
81
+ * os_signpost_id_make_with_pointer(). This approach is not applicable to
82
+ * signposts that span process boundaries.
83
+ *
84
+ * If no existing pointer or value is applicable, a new unique value can be
85
+ * generated using the os_signpost_id_generate() function. The returned value
86
+ * is guaranteed to be unique within the matching scope specified on the log
87
+ * handle.
88
+ */
89
+
90
+ /*!
91
+ * @typedef os_signpost_id_t
92
+ *
93
+ * @brief
94
+ * The type to represent a signpost ID.
95
+ *
96
+ * @discussion.
97
+ * Any 64-bit value can be cast to an os_signpost_id_t except for the
98
+ * OS_SIGNPOST_ID_NULL and OS_SIGNPOST_ID_INVALID reserved values.
99
+ *
100
+ * @const OS_SIGNPOST_ID_NULL
101
+ * Represents the null (absent) signpost ID. It is used by the signpost
102
+ * subsystem when a given signpost is disabled.
103
+ *
104
+ * @const OS_SIGNPOST_ID_INVALID
105
+ * Represents an invalid signpost ID, which signals that an error has occurred.
106
+ *
107
+ * @const OS_SIGNPOST_ID_EXCLUSIVE
108
+ * A convenience value for signpost intervals that will never occur
109
+ * concurrently.
110
+ */
111
+ typedef uint64_t os_signpost_id_t;
112
+ #ifndef __swift__
113
+ #define OS_SIGNPOST_ID_NULL ((os_signpost_id_t)0)
114
+ #define OS_SIGNPOST_ID_INVALID ((os_signpost_id_t)~0)
115
+ #define OS_SIGNPOST_ID_EXCLUSIVE ((os_signpost_id_t)0xEEEEB0B5B2B2EEEE)
116
+ #endif
117
+
118
+ /*!
119
+ * @function os_signpost_id_make_with_pointer
120
+ *
121
+ * @abstract
122
+ * Make an os_signpost_id from a pointer value.
123
+ *
124
+ * @discussion
125
+ * Mangles the pointer to create a valid os_signpost_id, including removing
126
+ * address randomization. Checks that the signpost matching scope is not
127
+ * system-wide.
128
+ *
129
+ * @param log
130
+ * Log handle previously created with os_log_create.
131
+ *
132
+ * @param ptr
133
+ * Any pointer that disambiguates among concurrent intervals with the same
134
+ * os_log_t and interval names.
135
+ *
136
+ * @result
137
+ * Returns a valid os_signpost_id_t. Returns OS_SIGNPOST_ID_NULL if signposts
138
+ * are turned off. Returns OS_SIGNPOST_ID_INVALID if the log handle is
139
+ * system-scoped.
140
+ */
141
+ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
142
+ OS_EXPORT OS_NOTHROW
143
+ os_signpost_id_t
144
+ os_signpost_id_make_with_pointer(os_log_t log, const void *_Nullable ptr);
145
+
146
+ #if __OBJC__
147
+ /*!
148
+ * @function os_signpost_id_make_with_id
149
+ *
150
+ * @abstract
151
+ * Make an os_signpost_id from an Objective-C id, as in
152
+ * os_signpost_id_make_with_pointer.
153
+ */
154
+ #define os_signpost_id_make_with_id(log, ptr) \
155
+ os_signpost_id_make_with_pointer(log, (__bridge const void *_Nullable)(ptr))
156
+ #endif /* __OBJC__ */
157
+
158
+ /*!
159
+ * @function os_signpost_id_generate
160
+ *
161
+ * @abstract
162
+ * Generates an ID guaranteed to be unique within the matching scope of the
163
+ * provided log handle.
164
+ *
165
+ * @discussion
166
+ * Each call to os_signpost_id_generate() with a given log handle and its
167
+ * matching scope will return a different os_signpost_id_t.
168
+ *
169
+ * @param log
170
+ * Log handle previously created with os_log_create.
171
+ *
172
+ * @result
173
+ * Returns a valid os_signpost_id_t. Returns OS_SIGNPOST_ID_NULL if signposts
174
+ * are disabled.
175
+ */
176
+ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
177
+ OS_EXPORT OS_NOTHROW OS_WARN_RESULT
178
+ os_signpost_id_t
179
+ os_signpost_id_generate(os_log_t log);
180
+
181
+ #pragma mark - Signpost Enablement
182
+
183
+ /*!
184
+ * @function os_signpost_enabled
185
+ *
186
+ * @abstract
187
+ * Returns true if signpost log messages are enabled for a particular log
188
+ * handle.
189
+ *
190
+ * @discussion
191
+ * Returns true if signpost log messages are enabled for a particular log.
192
+ * Use this to avoid doing expensive argument marshalling leading into a call
193
+ * to os_signpost_*
194
+ *
195
+ * @param log
196
+ * Log handle previously created with os_log_create.
197
+ *
198
+ * @result
199
+ * Returns ‘true’ if signpost log messages are enabled.
200
+ */
201
+ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
202
+ OS_EXPORT OS_NOTHROW OS_PURE OS_WARN_RESULT
203
+ bool
204
+ os_signpost_enabled(os_log_t log);
205
+ #pragma mark - Interval begin/end
206
+
207
+ /*!
208
+ * @function os_signpost_interval_begin
209
+ *
210
+ * @abstract
211
+ * Begins a signposted interval.
212
+ *
213
+ * @param log
214
+ * Log handle previously created with os_log_create.
215
+ *
216
+ * @param interval_id
217
+ * An ID for the event, see Signpost IDs above.
218
+ *
219
+ * @param name
220
+ * The name of this event. This must be a string literal.
221
+ *
222
+ * @param ... (format + arguments)
223
+ * Additional information to include with this signpost. This format string
224
+ * must be a string literal, as with the os_log family of functions.
225
+ */
226
+ #define os_signpost_interval_begin(log, interval_id, name, ...) \
227
+ os_signpost_emit_with_type(log, OS_SIGNPOST_INTERVAL_BEGIN, \
228
+ interval_id, name, ##__VA_ARGS__)
229
+
230
+ /*!
231
+ * @function os_signpost_animation_interval_begin
232
+ *
233
+ * @abstract
234
+ * Begins a signposted interval that is tagged as an animation.
235
+ *
236
+ * @param log
237
+ * Log handle previously created with os_log_create.
238
+ *
239
+ * @param interval_id
240
+ * An ID for the event, see Signpost IDs above.
241
+ *
242
+ * @param name
243
+ * The name of this event. This must be a string literal.
244
+ *
245
+ * @param ... (format + arguments)
246
+ * Additional information to include with this signpost. This format string
247
+ * must be a string literal, as with the os_log family of functions.
248
+ */
249
+ #define os_signpost_animation_interval_begin(log, interval_id, name, ...) \
250
+ _os_signpost_animation_interval_begin(log, interval_id, name, \
251
+ "" __VA_ARGS__)
252
+
253
+ /*!
254
+ * @function os_signpost_interval_end
255
+ *
256
+ * @abstract
257
+ * Ends a signposted interval.
258
+ *
259
+ * @param log
260
+ * The log handle which was provided to os_signpost_interval_begin,
261
+ *
262
+ * @param interval_id
263
+ * The ID for the event which was provided to os_signpost_interval_begin. See
264
+ * Signpost IDs above.
265
+ *
266
+ * @param name
267
+ * The name of the event provided to os_signost_interval_begin. This must be a
268
+ * string literal.
269
+ *
270
+ * @param ... (format + arguments)
271
+ * Additional information to include with this signpost. This format string
272
+ * must be a string literal, as with the os_log family of functions.
273
+ */
274
+ #define os_signpost_interval_end(log, interval_id, name, ...) \
275
+ os_signpost_emit_with_type(log, OS_SIGNPOST_INTERVAL_END, \
276
+ interval_id, name, ##__VA_ARGS__)
277
+
278
+ #pragma mark - Signpost event marking
279
+
280
+ /*!
281
+ * @function os_signpost_event_emit
282
+ *
283
+ * @abstract
284
+ * os_signpost_event_emit marks a point of interest in time with no duration.
285
+ *
286
+ * @param log
287
+ * Log handle previously created with os_log_create.
288
+ *
289
+ * @param event_id
290
+ * An ID for the event, see Signpost IDs above. This ID can be used to convey
291
+ * additional information about the event that is being emitted without
292
+ * incurring extra performance overhead.
293
+ *
294
+ * @param name
295
+ * The name of this event. This must be a string literal.
296
+ *
297
+ * @param ... (format + arguments)
298
+ * Additional information to include with this signpost. This format string
299
+ * must be a string literal, as with the os_log family of functions.
300
+ */
301
+ #define os_signpost_event_emit(log, event_id, name, ...) \
302
+ os_signpost_emit_with_type(log, OS_SIGNPOST_EVENT, \
303
+ event_id, name, ##__VA_ARGS__)
304
+
305
+ #pragma mark - Points of Interest
306
+
307
+ /*!
308
+ * @const OS_LOG_CATEGORY_POINTS_OF_INTEREST
309
+ *
310
+ * Provide this value as the category to os_log_create to indicate that
311
+ * signposts on the resulting log handle provide high-level events that can be
312
+ * used to orient a developer looking at performance data. These will be
313
+ * displayed by default by performance tools like Instruments.app.
314
+ */
315
+ #ifndef __swift__
316
+ #define OS_LOG_CATEGORY_POINTS_OF_INTEREST "PointsOfInterest"
317
+ #endif
318
+
319
+ #pragma mark - Dynamic Tracing
320
+
321
+ /*!
322
+ * @const OS_LOG_CATEGORY_DYNAMIC_TRACING
323
+ *
324
+ * Provide this value as the category to os_log_create to indicate that
325
+ * signposts emitted to the resulting log handle should be disabled by
326
+ * default, reducing the runtime overhead. os_signpost_enabled calls on
327
+ * the resulting log handle will only return 'true' when a performance
328
+ * tool like Instruments.app is recording.
329
+ */
330
+ #if OS_LOG_TARGET_HAS_10_15_FEATURES
331
+ #ifndef __swift__
332
+ #define OS_LOG_CATEGORY_DYNAMIC_TRACING "DynamicTracing"
333
+ #endif
334
+ #endif
335
+
336
+ /*!
337
+ * @const OS_LOG_CATEGORY_DYNAMIC_STACK_TRACING
338
+ *
339
+ * Provide this value as the category to os_log_create to indicate that
340
+ * signposts emitted to the resulting log handle should capture user
341
+ * backtraces. This behavior is more expensive, so os_signpost_enabled
342
+ * will only return 'true' when a performance tool like Instruments.app
343
+ * is recording.
344
+ */
345
+ #if OS_LOG_TARGET_HAS_10_15_FEATURES
346
+ #ifndef __swift__
347
+ #define OS_LOG_CATEGORY_DYNAMIC_STACK_TRACING "DynamicStackTracing"
348
+ #endif
349
+ #endif
350
+
351
+ #pragma mark - Signpost Internals
352
+
353
+ /*!
354
+ * @typedef os_signpost_type_t
355
+ *
356
+ * @brief
357
+ * The type of a signpost tracepoint, do not use directly.
358
+ */
359
+ OS_ENUM(os_signpost_type, uint8_t,
360
+ OS_SIGNPOST_EVENT = 0x00,
361
+ OS_SIGNPOST_INTERVAL_BEGIN = 0x01,
362
+ OS_SIGNPOST_INTERVAL_END = 0x02,
363
+ );
364
+ #ifndef __swift__
365
+ #define OS_SIGNPOST_TYPE_MASK 0x03
366
+ #endif
367
+
368
+ #define _OS_SIGNPOST_ANIMATION_INTERVAL_TAG "isAnimation=YES"
369
+
370
+ #define _os_signpost_animation_interval_begin(log, spid, name, fmt, ...) \
371
+ os_signpost_interval_begin(log, spid, name, \
372
+ fmt " " _OS_SIGNPOST_ANIMATION_INTERVAL_TAG, \
373
+ ##__VA_ARGS__)
374
+
375
+ API_AVAILABLE(macos(10.14), ios(12.0), tvos(12.0), watchos(5.0))
376
+ OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED
377
+ void
378
+ _os_signpost_emit_with_name_impl(void *dso, os_log_t log,
379
+ os_signpost_type_t type, os_signpost_id_t spid, const char *name,
380
+ const char *format, uint8_t *buf, uint32_t size);
381
+
382
+ #define _os_signpost_emit_with_type(emitfn, log, type, spid, name, ...) \
383
+ __extension__({ \
384
+ os_log_t _log_tmp = (log); \
385
+ os_signpost_type_t _type_tmp = (type); \
386
+ os_signpost_id_t _spid_tmp = (spid); \
387
+ if (_spid_tmp != OS_SIGNPOST_ID_NULL && \
388
+ _spid_tmp != OS_SIGNPOST_ID_INVALID && \
389
+ os_signpost_enabled(_log_tmp)) { \
390
+ OS_LOG_CALL_WITH_FORMAT_NAME((emitfn), \
391
+ (&__dso_handle, _log_tmp, _type_tmp, _spid_tmp), \
392
+ name, "" __VA_ARGS__); \
393
+ } \
394
+ })
395
+
396
+ #if OS_LOG_TARGET_HAS_10_14_FEATURES
397
+ #define os_signpost_emit_with_type(log, type, spid, name, ...) \
398
+ _os_signpost_emit_with_type(_os_signpost_emit_with_name_impl, log, \
399
+ type, spid, name, ##__VA_ARGS__)
400
+ #else
401
+ #define os_signpost_emit_with_type(log, type, spid, name, ...) \
402
+ __extension__({ \
403
+ if (_os_signpost_emit_with_name_impl != NULL) { \
404
+ _os_signpost_emit_with_type(_os_signpost_emit_with_name_impl, log, \
405
+ type, spid, name, ##__VA_ARGS__); \
406
+ } \
407
+ })
408
+ #endif
409
+
410
+ OS_ASSUME_NONNULL_END
411
+
412
+ __END_DECLS
413
+
414
+ #endif // __OS_SIGNPOST_H__
@@ -3,4 +3,14 @@ module os [system] {
3
3
  header "os/log.h"
4
4
  export *
5
5
  }
6
+
7
+ explicit module signpost {
8
+ header "os/signpost.h"
9
+ export *
10
+ }
11
+
12
+ module lock {
13
+ header "os/lock.h"
14
+ export *
15
+ }
6
16
  }
@@ -75,6 +75,11 @@
75
75
  #else
76
76
  #define __disable_tail_calls
77
77
  #endif
78
+ #if __has_attribute(not_tail_called)
79
+ #define __not_tail_called __attribute__((__not_tail_called__))
80
+ #else
81
+ #define __not_tail_called
82
+ #endif
78
83
  #if __has_attribute(warn_unused_result)
79
84
  #define __result_use_check __attribute__((__warn_unused_result__))
80
85
  #else
@@ -0,0 +1,99 @@
1
+ /*
2
+ * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3
+ *
4
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5
+ *
6
+ * This file contains Original Code and/or Modifications of Original Code
7
+ * as defined in and that are subject to the Apple Public Source License
8
+ * Version 2.0 (the 'License'). You may not use this file except in
9
+ * compliance with the License. The rights granted to you under the License
10
+ * may not be used to create, or enable the creation or redistribution of,
11
+ * unlawful or unlicensed copies of an Apple operating system, or to
12
+ * circumvent, violate, or enable the circumvention or violation of, any
13
+ * terms of an Apple operating system software license agreement.
14
+ *
15
+ * Please obtain a copy of the License at
16
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
17
+ *
18
+ * The Original Code and all software distributed under the License are
19
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23
+ * Please see the License for the specific language governing rights and
24
+ * limitations under the License.
25
+ *
26
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27
+ */
28
+ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
29
+ /*-
30
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
31
+ * The Regents of the University of California. All rights reserved.
32
+ *
33
+ * Redistribution and use in source and binary forms, with or without
34
+ * modification, are permitted provided that the following conditions
35
+ * are met:
36
+ * 1. Redistributions of source code must retain the above copyright
37
+ * notice, this list of conditions and the following disclaimer.
38
+ * 2. Redistributions in binary form must reproduce the above copyright
39
+ * notice, this list of conditions and the following disclaimer in the
40
+ * documentation and/or other materials provided with the distribution.
41
+ * 3. All advertising materials mentioning features or use of this software
42
+ * must display the following acknowledgement:
43
+ * This product includes software developed by the University of
44
+ * California, Berkeley and its contributors.
45
+ * 4. Neither the name of the University nor the names of its contributors
46
+ * may be used to endorse or promote products derived from this software
47
+ * without specific prior written permission.
48
+ *
49
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59
+ * SUCH DAMAGE.
60
+ *
61
+ * @(#)ioccom.h 8.2 (Berkeley) 3/28/94
62
+ */
63
+
64
+ #ifndef _SYS_IOCCOM_H_
65
+ #define _SYS_IOCCOM_H_
66
+
67
+ #include <sys/_types.h>
68
+
69
+ /*
70
+ * Ioctl's have the command encoded in the lower word, and the size of
71
+ * any in or out parameters in the upper word. The high 3 bits of the
72
+ * upper word are used to encode the in/out status of the parameter.
73
+ */
74
+ #define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
75
+ #define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
76
+ #define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16))
77
+ #define IOCGROUP(x) (((x) >> 8) & 0xff)
78
+
79
+ #define IOCPARM_MAX (IOCPARM_MASK + 1) /* max size of ioctl args */
80
+ /* no parameters */
81
+ #define IOC_VOID (__uint32_t)0x20000000
82
+ /* copy parameters out */
83
+ #define IOC_OUT (__uint32_t)0x40000000
84
+ /* copy parameters in */
85
+ #define IOC_IN (__uint32_t)0x80000000
86
+ /* copy parameters in and out */
87
+ #define IOC_INOUT (IOC_IN|IOC_OUT)
88
+ /* mask for IN/OUT/VOID */
89
+ #define IOC_DIRMASK (__uint32_t)0xe0000000
90
+
91
+ #define _IOC(inout, group, num, len) \
92
+ (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
93
+ #define _IO(g, n) _IOC(IOC_VOID, (g), (n), 0)
94
+ #define _IOR(g, n, t) _IOC(IOC_OUT, (g), (n), sizeof(t))
95
+ #define _IOW(g, n, t) _IOC(IOC_IN, (g), (n), sizeof(t))
96
+ /* this should be _IORW, but stdio got there first */
97
+ #define _IOWR(g, n, t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
98
+
99
+ #endif /* !_SYS_IOCCOM_H_ */