From 8072ed9ad764b3c9227be0f115a510eaffc247ad Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Tue, 5 May 2026 16:32:57 -0700 Subject: [PATCH] feat: stage 1 integration test harness (#353) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: integration tests design proposal Adds docs/integration_tests.md proposing a desktop-only integration suite that drives the Dart `ShorebirdUpdater` API against the real Rust core via FFI, with a fake HTTP server and per-test tempdir state. Describes a new `library_test_hooks` cdylib that reaches into `updater` via a `test-hooks` Cargo feature, so production C API stays clean. Status: design exploration, not a committed plan. * feat: stage 1 integration test harness for shorebird_code_push Lands the test_hooks crate, the Dart-side loader, and one trivial end-to-end test, per docs/integration_tests.md stage 1. Pieces: - New `library_test_hooks` workspace crate (cdylib). Depends on `updater` with a new `test-hooks` Cargo feature that widens the visibility of internal items (currently `testing_reset_config`) for sibling-crate access only — production builds do not enable it. The crate also re-exports `updater::c_api::dart::*` and `updater::c_api::engine::*`, which keeps the rlib's `#[no_mangle]` symbols out of DCE so the resulting cdylib carries both the production C API and the new `shorebird_test_*` hooks. - Workspace `default-members` excludes `library_test_hooks` so plain `cargo build` / `cargo test` invocations don't unify the `test-hooks` feature into production builds. - `shorebird_code_push/test/integration/all_test.dart` (single file, with a header comment explaining why) loads the cdylib via `DynamicLibrary.open`, reassigns the existing `@visibleForTesting` `Updater.bindings` setter, and exercises both surfaces. The build helper shells out to `cargo build -p library_test_hooks`; if it fails, `markTestSkipped` keeps the suite green on machines without a working Rust toolchain. - ffigen config (`ffigen_test_hooks.yaml`) generates the test-only Dart bindings under `test/integration/generated/`, not `lib/`. - CI: `library_test_hooks` is added to the rust_crate matrix, and the shorebird_code_push job triggers on `library/**` and `library_test_hooks/**` so cdylib changes can't break the Dart-side integration suite without CI noticing. Verified locally: 232 Rust unit tests + 42 Dart tests (41 existing + 1 integration) green; clippy/fmt/cspell clean; production cdylib does not contain `shorebird_test_reset` (`nm` confirms feature isolation). Stages 2 (FakePatchServer + golden path) and 3 (adversarial scenarios) land separately. * fix(integration test): early-return on skip and bump per-test timeout Two issues caught by Shorebird CI on PR #353: 1. `markTestSkipped` does not abort test execution — it only flags the test as skipped on its way out. The body kept running and crashed on the `late testHooks` field when the cdylib build had failed in setUpAll. Move the skip check into the test body itself with an early return; drop the (no-op) skip in `setUp`. 2. Default per-test timeout (30s) also covers `setUpAll`. A cold `cargo build -p library_test_hooks` compiles `updater` and ~100 transitive deps, which can run minutes on CI. Bump to 10 minutes via `@Timeout` on the library. Verified locally: passes when cargo is on PATH (1 passed), reports a clean skip and exit 0 when cargo is removed from PATH (1 skipped). * refactor(integration test): drop ! by promoting testHooks to late final `testHooks` was nullable so accessing it after the skipReason check required `!`, and `markTestSkipped(skipReason!)` had the same smell. Make `testHooks` `late final` (non-nullable, throws if read before setUpAll assigns) and pull `skipReason` into a non-null local before use. Same control flow, no bang operators. --- .github/workflows/main.yaml | 11 + Cargo.lock | 9 + Cargo.toml | 8 +- cspell.config.yaml | 5 + docs/integration_tests.md | 349 ++ library/Cargo.toml | 7 + library/src/config.rs | 5 +- library/src/updater.rs | 5 +- library_test_hooks/Cargo.toml | 23 + library_test_hooks/build.rs | 31 + library_test_hooks/cbindgen.toml | 29 + .../include/library_test_hooks.h | 33 + library_test_hooks/src/lib.rs | 41 + shorebird_code_push/ffigen_test_hooks.yaml | 17 + .../test/integration/all_test.dart | 85 + .../generated/test_hooks_bindings.g.dart | 5254 +++++++++++++++++ .../test/integration/helpers/build.dart | 48 + 17 files changed, 5956 insertions(+), 4 deletions(-) create mode 100644 docs/integration_tests.md create mode 100644 library_test_hooks/Cargo.toml create mode 100644 library_test_hooks/build.rs create mode 100644 library_test_hooks/cbindgen.toml create mode 100644 library_test_hooks/include/library_test_hooks.h create mode 100644 library_test_hooks/src/lib.rs create mode 100644 shorebird_code_push/ffigen_test_hooks.yaml create mode 100644 shorebird_code_push/test/integration/all_test.dart create mode 100644 shorebird_code_push/test/integration/generated/test_hooks_bindings.g.dart create mode 100644 shorebird_code_push/test/integration/helpers/build.dart diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 1723174..862f702 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -43,6 +43,13 @@ jobs: - ./.github/workflows/main.yaml - ./.github/actions/flutter_package/action.yaml - shorebird_code_push/** + # Integration tests under shorebird_code_push/test/integration + # build and load the library_test_hooks cdylib, which + # re-exports the production updater C API. A change to + # either crate can break the suite, so trigger the + # flutter package job on those paths too. + - library/** + - library_test_hooks/** - uses: dorny/paths-filter@v4 name: Build Detection @@ -55,6 +62,10 @@ jobs: patch: - ./.github/actions/rust_crate/action.yaml - patch/** + library_test_hooks: + - ./.github/actions/rust_crate/action.yaml + - library/** + - library_test_hooks/** build_rust_crates: needs: changes diff --git a/Cargo.lock b/Cargo.lock index aaa79b3..ebfcda3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -925,6 +925,15 @@ version = "0.2.184" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af" +[[package]] +name = "library_test_hooks" +version = "0.1.0" +dependencies = [ + "cbindgen", + "libc", + "updater", +] + [[package]] name = "linux-raw-sys" version = "0.12.1" diff --git a/Cargo.toml b/Cargo.toml index f202c73..15accaf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,11 @@ [workspace] -members = ["library", "patch"] +members = ["library", "patch", "library_test_hooks"] +# `library_test_hooks` is excluded from default-members so plain +# `cargo build` / `cargo test` invocations don't enable the +# `test-hooks` feature on `updater` (Cargo unifies features within a +# single build). The integration test suite explicitly builds it with +# `cargo build -p library_test_hooks`. +default-members = ["library", "patch"] resolver = "2" [profile.release] diff --git a/cspell.config.yaml b/cspell.config.yaml index b69fb4e..52f1174 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -39,6 +39,7 @@ words: - dllexport - dlopen - EDQUOT + - EACCES - embedders - EOCD - endtemplate @@ -62,8 +63,10 @@ words: - pubspec - repr - reqwest + - rlib - rsplit - rollouts + - RTLD - rustflags - rustls - rustup @@ -77,6 +80,8 @@ words: - ureq - unbootable - unbooted + - unreviewable + - unwritable - usize - Swatinem - taiki diff --git a/docs/integration_tests.md b/docs/integration_tests.md new file mode 100644 index 0000000..2a8cd51 --- /dev/null +++ b/docs/integration_tests.md @@ -0,0 +1,349 @@ +# Integration Tests for the Updater + +Status: design exploration. This is a proposal, not a committed plan. The goal +is to agree on the shape before writing harness code. + +## Why we are talking about this + +Most recent updater bugs have lived at the seam between Rust core, FFI, and +the `shorebird_code_push` Dart wrapper. A non-exhaustive recent sample: + +- `checkForUpdate` returns `upToDate` after a patch-to-release rollback + (shorebirdtech/shorebird#3728, originally #3206). The Rust unit test + passed because it stubbed `currentPatchNumber`. The real FFI path cleared + `last_booted_patch` and made the Dart side compare `null != null`. +- `update()` re-downloads bytes that are deterministically bad on this + device (updater #351; design follow-on shorebirdtech/shorebird#3737). The + Rust-side network hooks made it easy to test the resume logic in + isolation, but not the cross-cycle "we just installed this and it + hash-failed" loop. +- `update()` throwing `UpdateException` for `noUpdate` (shorebird #3681, + updater #334) and for benign `UpdateInProgress` (shorebird #3682, updater + #335). Both reproduced cleanly only when the Dart layer was driving real + Rust state. +- `patches_state.json` write failures on iOS (shorebird #3683). Not all of + this is reproducible on desktop, but the on-disk round-trip part is. + +What these have in common: each one was discoverable only when Dart, FFI, +and on-disk Rust state were all participating. Today we have: + +- **Rust unit tests** with `NetworkHooks::default` swapped for fakes — good + coverage of branching logic, no FFI, no `DynamicLibrary`. +- **Dart unit tests** with `_MockUpdater` swapped in for the FFI wrapper — + good coverage of `ShorebirdUpdaterImpl`, never loads `libupdater`. + +There is no test that drives the Dart `ShorebirdUpdater` API and ends up +reading and writing real bytes via the real Rust network and cache code. + +## Proposal + +Add a desktop-only integration suite that runs: + +``` +ShorebirdUpdater (Dart) + → DynamicLibrary.open("libupdater.dylib") ← real cdylib build + → c_api::dart + c_api::engine ← real FFI + → updater::* + cache::* + network::* ← real Rust + → 127.0.0.1: ← FakePatchServer (Dart shelf) +``` + +Each test gets a fresh tempdir for `app_storage_dir` and `code_cache_dir`, +boots a fresh fake server, calls `shorebird_init`, and then exercises the +Dart `ShorebirdUpdater` API. The `cdylib` build target already exists +(`library/Cargo.toml` lists `cdylib`); today nothing actually loads it. + +This is intentionally narrower than a true end-to-end test. We are *not* +spinning up a Flutter app, *not* exercising the engine integration in +`flutter::shorebird::Updater`, and *not* running on a phone. Those remain +the job of `shorebird preview`, engine smoke tests, and production +telemetry. What we get here is the layer that has been quietly producing +the most bugs. + +## Components to build + +### 1. A test-hooks library target + +Add a new workspace crate, e.g. `library_test_hooks/`, with +`crate-type = ["cdylib"]`. It depends on the `updater` crate as a path +dependency with a `test-hooks` Cargo feature enabled. The crate's job is +to add a small set of test-only `#[no_mangle] pub extern "C"` symbols +that wrap *internal Rust functions* in `updater` — not new C entry +points exposed by the updater crate itself. + +Guiding principle: production packages stay clean. The production C +API in `c_api::dart` and `c_api::engine` does not gain any test-only +symbols. Where the test_hooks cdylib needs to reach behind the C API +(reset the global config, seed an installed patch, force a clock +value), it does so via *Rust-internal* `pub` items in `updater` that +are gated behind the `test-hooks` Cargo feature. Those items already +exist for unit tests (`testing_reset_config`, `test_utils::*`); the +feature flag is what makes them visible to a sibling crate without +also exposing them to production builds. + +Concretely, `library/Cargo.toml` grows: + +```toml +[features] +test-hooks = [] +``` + +and items like `library/src/config.rs:200` move from +`#[cfg(test)] pub fn testing_reset_config(...)` to +`#[cfg(any(test, feature = "test-hooks"))] pub fn testing_reset_config(...)`. + +The test_hooks cdylib then wraps them: + +```rust +#[no_mangle] +pub extern "C" fn shorebird_test_reset() { + updater::testing_reset_config(); +} +``` + +Plus seeding helpers as we need them +(`shorebird_test_install_fake_patch(usize)`, +`shorebird_test_corrupt_patches_state()`, etc.). + +The production C symbols (`shorebird_init`, `shorebird_update_with_result`, +…) come along automatically: the `updater` crate is consumed as an rlib +here, and `#[no_mangle]` exports from an rlib propagate into the +dependent's cdylib. One artifact, `libupdater_test_hooks.{dylib,so,dll}`, +exposes both surfaces. + +Why this way: + +- No test-only C symbols in the cdylib/staticlib that ships inside the + engine. The `test-hooks` feature is opt-in and only the test_hooks + crate enables it. +- All scenarios run in a single Dart process. Reset between tests with + one C call instead of forking a subprocess each time. +- A natural place to add diagnostic / fault-injection hooks later + without touching production code. + +The test_hooks crate also owns the engine-side symbols we need for tests +(`shorebird_init`, `shorebird_report_launch_*`, etc.). They are part of +the engine API today; since this crate's cdylib is never linked into a +Flutter engine build, exposing them here doesn't widen what production +ships. + +### 2. Loading the library: use the existing test seam + +`Updater.bindings` at `shorebird_code_push/lib/src/updater.dart:20` is +already a `@visibleForTesting` static field, and the existing unit +tests reassign it (`shorebird_code_push/test/src/updater_test.dart:25`). +We use the same seam: + +```dart +setUpAll(() async { + final path = await buildTestHooksCdylib(); // cargo build -p library_test_hooks + testHooksLib = DynamicLibrary.open(path); // single handle + Updater.bindings = UpdaterBindings(testHooksLib); // production path uses our lib + testHooks = TestHooksBindings(testHooksLib); // engine + reset symbols +}); +``` + +This is zero changes to `shorebird_code_push`, works the same on Linux, +macOS, and Windows, and produces no `RTLD_GLOBAL` / `LoadLibrary` +platform-specific code in the harness. Static-field initializers in +Dart are lazy, so as long as the override happens in `setUpAll` before +any production code path touches `Updater.bindings`, +`DynamicLibrary.process()` is never called and there is no question of +"will it find the symbols." + +We deliberately keep using the same `Updater` / `UpdaterBindings` types +that production uses. The only Dart-side test-specific code is the +auxiliary `TestHooksBindings` (a separate ffigen-generated file in the +integration-test tree) that exposes the `shorebird_test_*` and +`shorebird_init` / `shorebird_report_launch_*` symbols. + +Locating the artifact: a `tool/build_test_hooks.dart` invoked from +`setUpAll` shells out to `cargo build -p library_test_hooks` and returns +`target/debug/libupdater_test_hooks.{dylib,so,dll}`. Cached across tests +in the same run. + +### 3. Engine + test-hooks bindings live under `test/integration/` + +`library_test_hooks` emits its own header (cbindgen, same pattern as +`updater`), and ffigen generates a `TestHooksBindings` Dart file +inside `shorebird_code_push/test/integration/generated/` — **not** +inside `shorebird_code_push/lib/`. The published package keeps shipping +only the Dart-stable surface; the test-only bindings are part of the +test tree, where their dev-time-only nature is obvious and they don't +contribute to the package's public API. + +### 4. `FakePatchServer` + +A small `package:shelf` server that the test drives. Sketch: + +```dart +final server = await FakePatchServer.start(); +server.enqueuePatch(number: 1, libapp: , releaseLibapp: ); +server.respondToCheckWith(PatchCheckResponse(...)); +server.failNextDownload(after: 1024); // cut off mid-stream +server.serveCorruptedHash(); +``` + +Endpoints we need (today): + +- `POST /api/v1/patches/check` — returns `PatchCheckResponse` JSON. +- `GET ` — serves patch bytes, with `Range` header support so + resume tests are real (`network.rs` already sends `Range: bytes=N-`). +- `POST /api/v1/patches/events` — accepts and records events for assertion. + +`base_url` is read from `shorebird.yaml`, so each test writes a yaml +pointing at the test server's `127.0.0.1:`. + +### 5. Patch fixtures + +Patches are zstd-compressed bipatch files keyed to a specific base +`libapp.so` (or its iOS equivalent). The fake server has to serve real +bytes: a hand-rolled `[0,1,2,3]` will fail `bipatch::Reader::new` and tell +us nothing useful. + +Two options: + +**Option A:** Pre-bake a few patch fixtures and check them in. Simple, +fast tests, but binary diffs are unreviewable and we are stuck with +whatever scenarios we baked in. + +**Option B:** Build patches on the fly using the `patch` workspace crate. +`setUpAll` shells out to `cargo run -p patch` (or links the crate as a +build dependency) to produce a real patch from controlled inputs. Slower +setup; tests stay readable; we can synthesize hash-mismatch scenarios by +swapping bytes after generation. + +Lean B. Cache the compiled `patch` binary across tests. + +### 6. Storage scaffolding + +Each test boots in a fresh tempdir: + +```dart +final tmp = await Directory.systemTemp.createTemp('updater-it-'); +addTearDown(() => tmp.delete(recursive: true)); +final storageDir = Directory('${tmp.path}/storage')..createSync(); +final cacheDir = Directory('${tmp.path}/cache')..createSync(); +``` + +`shorebird_init` is given those paths; we never touch the developer's real +state. Tests can also pre-seed `patches_state.json` to simulate "device +arrives in state X" scenarios without running through the install path. + +## First-cut scenarios + +Each maps to a real bug or a known fragile path: + +| Scenario | Asserts | Maps to | +|---|---|---| +| Server returns no patch | `checkForUpdate` returns `upToDate`, no disk writes | baseline | +| Check + update + report_launch_success | `nextPatchNumber` advances; `current_boot_patch` set after launch cycle | baseline | +| Patch-to-release rollback during running session | `current_boot_patch_number` does not silently go to 0 | shorebird #3728, #3206 | +| Hash mismatch on freshly downloaded patch | Patch is marked bad; subsequent `update()` does not re-fetch | updater #351, shorebird #3737 | +| Download cut off mid-stream | Resume on next `update()` succeeds; bytes match | updater resume tests today, but at the FFI level | +| Concurrent `update()` calls | Second call returns `UpdateInProgress`; does not throw | updater #335, shorebird #3682 | +| `update()` when nothing to do | Returns `noUpdate`; does not throw | updater #334, shorebird #3681 | +| Storage dir becomes unwritable mid-cycle | Defers state write; later cycle recovers | updater #336, #344 | + +Each test is small; the value is having them all run together against the +same harness so future regressions show up here first. + +## Non-goals + +- Phone or emulator coverage. Stays with `shorebird preview` and engine + smoke tests. +- Engine integration (`flutter::shorebird::Updater`). Tested in + `shorebirdtech/flutter`. +- Replacing existing Rust unit tests. They are faster and exhaustively + cover branch logic; this suite is wider, not deeper. +- Network-level fuzzing or fault injection beyond what the fake server + exposes. + +## Open questions + +- **Process model.** All integration tests live in a single file + (e.g. `test/integration/all_test.dart`). `package:test` runs + *files* in parallel isolates by default but *tests within a file* + serially in the same isolate, and `dlopen` loads the test_hooks + cdylib exactly once per process — so every isolate would share the + Rust `OnceCell`. Single file = single isolate = serial + = no contention. The unit tests in the same package keep their + parallelism since they only ever touch `_MockUpdaterBindings` and + never load the real library. + + Add a comment at the top of the integration test file explaining + why everything lives in one file, so a future contributor doesn't + "tidy up" by splitting it without also adding a `dart_test.yaml` + concurrency override. Between tests, `shorebird_test_reset()` + clears the global config; subprocess-per-test stays in the back + pocket only if state leaks turn out to be hard to plug. + + If the suite grows past what's comfortable in one file, the next + step is splitting across files behind a `dart_test.yaml` + concurrency override scoped to `test/integration/`. Not stage 1. +- **Where does the suite live?** Inside `shorebird_code_push/test/integration/`, + as regular `package:test` tests. Two reasons this beats a sibling + workspace package: + + 1. dev_dependencies are private to the package — adding `shelf`, + `path`, etc. has no effect on consumers, so there is no real + "production package contamination" cost. + 2. `Updater.bindings` is `@visibleForTesting`, and that annotation is + package-scoped: the analyzer's `invalid_use_of_visible_for_testing_member` + would fire if a sibling package reached in. We could blanket-`ignore` + it, but that defeats the point of the annotation. Same-package tests + use the seam cleanly. + + Toolchain prerequisites: handle at runtime, not via tags. `setUpAll` + shells out to `cargo build -p library_test_hooks`; if cargo is + missing or the build fails, store a skip reason and have `setUp` + call `markTestSkipped(reason)`. `dart test` runs the suite by + default everywhere — present-and-working machines exercise the + integration tests, environments without a Rust toolchain see them + reported as skipped rather than failed. CI installs Rust on all + three OSes and expects no skips. +- **CI matrix.** Linux, macOS, Windows. All three are required — + Windows is where we have already shipped FFI bugs (updater #344's + parent issue mentioned EACCES paths) and the loading approach above + is platform-neutral, so there is no reason to skip it. +- **Test-only contamination of `shorebird_code_push`.** Goal is zero. + The plan above achieves zero by reusing the existing + `@visibleForTesting` `Updater.bindings` setter that the package's + own unit tests already use. If something in the integration suite + forces a real change to `shorebird_code_push`, that's a flag to + rethink rather than just patch through. +- **Patch fixture build cost.** Will adding `cargo run -p patch` to test + setup make the suite annoyingly slow on cold checkouts? Worth measuring + with one real fixture before committing. +- **Existing tracker?** Searched all Eric-authored issues across + `shorebird` and `_shorebird` from the last week (and broader). No + dedicated tracker. Closest neighbors: shorebird #3341 (on-device + integration tests via shorebird ci, customer-facing — different + thing) and #3737 (per-patch state machine refactor, which would be + much safer to land with this suite in place). This doc is the + tracking artifact. + +## Phasing + +Three deliverables, each independently shippable: + +1. **Test-hooks crate + harness.** New `library_test_hooks` cdylib, + `test-hooks` feature on `updater` to expose `testing_reset_config` + to a sibling crate, ffigen of the test-hooks header, tempdir + scaffolding, the `Updater.bindings = ...` override in `setUpAll`. + One trivial test: init, read `current_boot_patch_number`, reset, + init again. CI green on Linux, macOS, Windows. +2. **Fake server + golden path.** `FakePatchServer`, patch fixture + pipeline, and a single check-then-update-then-launch scenario. +3. **Adversarial scenarios.** Walk down the table above. Each test + should reference the bug it would have caught. + +Stage 1 is the riskiest piece (rlib `#[no_mangle]` propagation across +the three OSes and the reset-between-tests story). Stage 3 is the part +that pays back the investment. + +## Out of scope for this doc + +- Test data hygiene if patch fixtures end up checked in. +- Coverage reporting (CI uses `cargo llvm-cov` for Rust today; Dart-side + coverage from this suite is a bonus, not the goal). +- Performance benchmarking. This is a correctness suite. diff --git a/library/Cargo.toml b/library/Cargo.toml index b990387..5031787 100644 --- a/library/Cargo.toml +++ b/library/Cargo.toml @@ -11,6 +11,13 @@ edition = "2021" # "staticlib" is used by the engine build for linking into libflutter.so crate-type = ["lib", "cdylib", "staticlib"] +[features] +# Exposes a small set of internal Rust items (e.g. `testing_reset_config`) +# to sibling crates that need to drive the updater from a test harness. +# Production builds (the cdylib/staticlib that ships in the engine) do not +# enable this feature; only `library_test_hooks` does. +test-hooks = [] + [dependencies] # Used for error handling for now. anyhow = "1.0.69" diff --git a/library/src/config.rs b/library/src/config.rs index ac5fd9a..2e535cd 100644 --- a/library/src/config.rs +++ b/library/src/config.rs @@ -56,7 +56,10 @@ pub fn set_running_patch_number(patch_number: Option) { } /// Unit tests should call this to reset the config between tests. -#[cfg(test)] +/// Also exposed (via the `test-hooks` Cargo feature) to the +/// `library_test_hooks` cdylib so Dart-side integration tests can reset +/// state between scenarios without spawning a subprocess. +#[cfg(any(test, feature = "test-hooks"))] pub fn testing_reset_config() { with_config_mut(|config| { *config = None; diff --git a/library/src/updater.rs b/library/src/updater.rs index e7c5aa8..fb0ca86 100644 --- a/library/src/updater.rs +++ b/library/src/updater.rs @@ -20,8 +20,9 @@ use crate::network::{ use crate::updater_lock::{with_updater_thread_lock, UpdaterLockState}; use crate::yaml::YamlConfig; -#[cfg(test)] -// Expose testing_reset_config for integration tests. +// Expose testing_reset_config for in-crate unit tests (under #[cfg(test)]) +// and for the `library_test_hooks` sibling crate (under feature = "test-hooks"). +#[cfg(any(test, feature = "test-hooks"))] pub use crate::config::testing_reset_config; #[cfg(test)] pub use crate::network::{DownloadToPathFn, Patch, PatchCheckRequestFn}; diff --git a/library_test_hooks/Cargo.toml b/library_test_hooks/Cargo.toml new file mode 100644 index 0000000..1d645e5 --- /dev/null +++ b/library_test_hooks/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "library_test_hooks" +version = "0.1.0" +edition = "2021" +publish = false + +# Test-only cdylib that wraps the production updater with extra C symbols +# (`shorebird_test_*`) used by Dart integration tests. Never linked into a +# production engine build. The library name is `updater_test_hooks` so the +# artifact ends up as `libupdater_test_hooks.{dylib,so}` / `updater_test_hooks.dll`. +[lib] +name = "updater_test_hooks" +crate-type = ["cdylib"] + +[dependencies] +libc = "0.2.98" +# `test-hooks` widens the visibility of internal items the C symbols below +# call into (e.g. `testing_reset_config`). Production builds of `updater` +# do not enable this feature. +updater = { path = "../library", features = ["test-hooks"] } + +[build-dependencies] +cbindgen = "0.29.2" diff --git a/library_test_hooks/build.rs b/library_test_hooks/build.rs new file mode 100644 index 0000000..fd59bec --- /dev/null +++ b/library_test_hooks/build.rs @@ -0,0 +1,31 @@ +extern crate cbindgen; + +use std::env; +use std::path::PathBuf; + +fn main() { + let crate_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); + + let config_path = crate_dir.join("cbindgen.toml"); + let config = match cbindgen::Config::from_file(&config_path) { + Ok(config) => config, + Err(e) => { + println!("cargo:warning=Error loading {}: {e}", config_path.display()); + return; + } + }; + + let src_path = crate_dir.join("src/lib.rs"); + let result = cbindgen::Builder::new() + .with_src(&src_path) + .with_config(config) + .generate(); + match result { + Ok(contents) => { + contents.write_to_file("include/library_test_hooks.h"); + } + Err(e) => { + println!("cargo:warning=Error generating include/library_test_hooks.h: {e}"); + } + } +} diff --git a/library_test_hooks/cbindgen.toml b/library_test_hooks/cbindgen.toml new file mode 100644 index 0000000..2a4d211 --- /dev/null +++ b/library_test_hooks/cbindgen.toml @@ -0,0 +1,29 @@ +# cbindgen configuration for the test-hooks C surface. +# +# Output: include/library_test_hooks.h — consumed by the Dart integration +# test suite under `shorebird_code_push/test/integration/`. No stability +# guarantee; this header changes as new test hooks are added. +# +# build.rs runs cbindgen with `with_src("src/lib.rs")`. Only the +# `pub extern "C"` items defined directly in this crate appear here — +# the production C surface that flows through from the `updater` rlib +# is documented in `library/include/updater_engine.h` and +# `library/include/updater_dart.h`. +# +# See https://github.com/eqrion/cbindgen/blob/master/docs.md#cbindgentoml +language = "C" +include_guard = "library_test_hooks_h" +autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */" +cpp_compat = true +line_length = 80 + +after_includes = """ +#ifdef _WIN32 +#define SHOREBIRD_EXPORT __declspec(dllexport) +#else +#define SHOREBIRD_EXPORT __attribute__((visibility("default"))) +#endif +""" + +[fn] +prefix = "SHOREBIRD_EXPORT" diff --git a/library_test_hooks/include/library_test_hooks.h b/library_test_hooks/include/library_test_hooks.h new file mode 100644 index 0000000..28e6f4b --- /dev/null +++ b/library_test_hooks/include/library_test_hooks.h @@ -0,0 +1,33 @@ +#ifndef library_test_hooks_h +#define library_test_hooks_h + +/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ + +#include +#include +#include +#include +#ifdef _WIN32 +#define SHOREBIRD_EXPORT __declspec(dllexport) +#else +#define SHOREBIRD_EXPORT __attribute__((visibility("default"))) +#endif + + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +/** + * Resets the updater's global config so the next `shorebird_init` + * starts from scratch. Equivalent to a process restart for state + * purposes — Dart tests call this between scenarios so each test + * runs against a fresh updater. + */ +SHOREBIRD_EXPORT void shorebird_test_reset(void); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif /* library_test_hooks_h */ diff --git a/library_test_hooks/src/lib.rs b/library_test_hooks/src/lib.rs new file mode 100644 index 0000000..e688d84 --- /dev/null +++ b/library_test_hooks/src/lib.rs @@ -0,0 +1,41 @@ +//! Test-only C symbols layered on top of `updater`. +//! +//! This crate exists so Dart integration tests under +//! `shorebird_code_push/test/integration/` can drive the updater +//! end-to-end without bloating the production C API or adding +//! `#[cfg(test)]` symbols to the cdylib that ships in the engine. +//! +//! The crate produces a single `cdylib` artifact +//! (`libupdater_test_hooks.{dylib,so}` / `updater_test_hooks.dll`) that +//! exposes: +//! +//! 1. The production C surface from `updater::c_api::dart` and +//! `updater::c_api::engine`, re-exported so Dart tests can drive a +//! real `shorebird_init` / `shorebird_update_with_result` cycle +//! against tempdir-scoped state. +//! 2. Extra `shorebird_test_*` symbols defined here that wrap +//! Rust-internal items in `updater` (gated behind the `test-hooks` +//! Cargo feature) — currently just `shorebird_test_reset`, with more +//! to come as later stages of the integration suite need them. +//! +//! Production updater builds (the cdylib/staticlib that ships in the +//! engine) do not enable `test-hooks` and never link this crate. + +// Re-export the production C API. This makes the symbols part of this +// crate's public API surface, which prevents the linker from stripping +// them when producing the cdylib (an rlib's `#[no_mangle]` items are +// otherwise eligible for DCE because they aren't roots from this +// crate's perspective). +#[allow(unused_imports)] +pub use updater::c_api::dart::*; +#[allow(unused_imports)] +pub use updater::c_api::engine::*; + +/// Resets the updater's global config so the next `shorebird_init` +/// starts from scratch. Equivalent to a process restart for state +/// purposes — Dart tests call this between scenarios so each test +/// runs against a fresh updater. +#[no_mangle] +pub extern "C" fn shorebird_test_reset() { + updater::testing_reset_config(); +} diff --git a/shorebird_code_push/ffigen_test_hooks.yaml b/shorebird_code_push/ffigen_test_hooks.yaml new file mode 100644 index 0000000..129cf17 --- /dev/null +++ b/shorebird_code_push/ffigen_test_hooks.yaml @@ -0,0 +1,17 @@ +# ffigen config for the integration-test-only `library_test_hooks` C +# surface. Output lives under `test/integration/generated/`, NOT under +# `lib/`, because these bindings are not part of `shorebird_code_push`'s +# public API — they're consumed only by the integration tests. +# +# Regenerate with: +# dart run ffigen --config ffigen_test_hooks.yaml +# +# The header is produced by `cargo build -p library_test_hooks`. If +# the header is stale, run that first. +output: "test/integration/generated/test_hooks_bindings.g.dart" +name: "TestHooksBindings" +headers: + entry-points: + - "../library_test_hooks/include/library_test_hooks.h" +preamble: | + // ignore_for_file: unused_element, unused_field, type=lint diff --git a/shorebird_code_push/test/integration/all_test.dart b/shorebird_code_push/test/integration/all_test.dart new file mode 100644 index 0000000..a581d40 --- /dev/null +++ b/shorebird_code_push/test/integration/all_test.dart @@ -0,0 +1,85 @@ +// All updater integration tests live in this single file. This is +// deliberate: `package:test` parallelizes tests across files via +// isolates, but `dlopen` loads the test_hooks cdylib exactly once per +// process and the updater's `OnceCell` is shared across +// every isolate. Splitting these tests across multiple files would +// require either a `dart_test.yaml` concurrency override scoped to +// `test/integration/`, or a subprocess-per-test runner. +// +// Same file = same isolate = serial = no contention. If the suite +// outgrows one file, see `docs/integration_tests.md` for the +// concurrency-override path. +// +// The unit tests under `test/src/` are unaffected: they only use +// `_MockUpdaterBindings` and never load the real cdylib. + +// `setUpAll` shells out to `cargo build -p library_test_hooks`. On a +// cold checkout that compiles `updater` and its dependencies and can +// take a couple of minutes — well past `package:test`'s default 30s +// per-test timeout, which also covers `setUpAll`. +@Timeout(Duration(minutes: 10)) +library; + +import 'dart:ffi'; + +import 'package:shorebird_code_push/src/generated/updater_bindings.g.dart'; +import 'package:shorebird_code_push/src/updater.dart'; +import 'package:test/test.dart'; + +import 'generated/test_hooks_bindings.g.dart'; +import 'helpers/build.dart'; + +void main() { + // Set in setUpAll exactly when the cdylib build/load failed. The + // pair (`skipReason`, `testHooks`) is contractually mutually + // exclusive: a null `skipReason` means `testHooks` is initialized, + // and tests early-return on a non-null `skipReason` before touching + // `testHooks`. + String? skipReason; + late final TestHooksBindings testHooks; + + setUpAll(() async { + try { + final path = await buildTestHooksCdylib(); + final lib = DynamicLibrary.open(path); + // `Updater.bindings` is `@visibleForTesting` and the package's own + // unit tests reassign it. We do the same here, pointing the + // production code path at our test_hooks cdylib (which re-exports + // the production C API alongside the `shorebird_test_*` hooks). + Updater.bindings = UpdaterBindings(lib); + testHooks = TestHooksBindings(lib); + } on Object catch (e, st) { + skipReason = 'Could not build/load library_test_hooks cdylib.\n$e\n$st'; + } + }); + + group('library_test_hooks', () { + test('exposes both production and test-hook symbols', () { + // `markTestSkipped` only flags the test as skipped — it does not + // abort execution. Early-return after marking, otherwise the body + // below would touch the uninitialized `testHooks` when the + // setUpAll build couldn't run (e.g., no Rust toolchain on the + // host). + final reason = skipReason; + if (reason != null) { + markTestSkipped(reason); + return; + } + + // Test-only symbol layered on top of the production C API. + // Calling on a process with no prior init clears already-empty + // globals — should be a no-op, not a crash. + expect(testHooks.shorebird_test_reset, returnsNormally); + + // Production symbols flow through the same library. With no + // init, `shorebird_current_boot_patch_number` returns the + // `log_on_error` default (0). + const updater = Updater(); + expect(updater.currentPatchNumber(), 0); + expect(updater.nextPatchNumber(), 0); + + // Reset is still callable after exercising production symbols. + expect(testHooks.shorebird_test_reset, returnsNormally); + }); + }); +} diff --git a/shorebird_code_push/test/integration/generated/test_hooks_bindings.g.dart b/shorebird_code_push/test/integration/generated/test_hooks_bindings.g.dart new file mode 100644 index 0000000..ed2b11b --- /dev/null +++ b/shorebird_code_push/test/integration/generated/test_hooks_bindings.g.dart @@ -0,0 +1,5254 @@ +// ignore_for_file: unused_element, unused_field, type=lint + +// AUTO GENERATED FILE, DO NOT EDIT. +// +// Generated by `package:ffigen`. +// ignore_for_file: type=lint, unused_import +import 'dart:ffi' as ffi; + +class TestHooksBindings { + /// Holds the symbol lookup function. + final ffi.Pointer Function(String symbolName) + _lookup; + + /// The symbols are looked up in [dynamicLibrary]. + TestHooksBindings(ffi.DynamicLibrary dynamicLibrary) + : _lookup = dynamicLibrary.lookup; + + /// The symbols are looked up with [lookup]. + TestHooksBindings.fromLookup( + ffi.Pointer Function(String symbolName) + lookup) + : _lookup = lookup; + + ffi.Pointer> signal( + int arg0, + ffi.Pointer> arg1, + ) { + return _signal( + arg0, + arg1, + ); + } + + late final _signalPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer> Function( + ffi.Int, + ffi.Pointer< + ffi.NativeFunction>)>>('signal'); + late final _signal = _signalPtr.asFunction< + ffi.Pointer> Function( + int, ffi.Pointer>)>(); + + int getpriority( + int arg0, + int arg1, + ) { + return _getpriority( + arg0, + arg1, + ); + } + + late final _getpriorityPtr = + _lookup>( + 'getpriority'); + late final _getpriority = + _getpriorityPtr.asFunction(); + + int getiopolicy_np( + int arg0, + int arg1, + ) { + return _getiopolicy_np( + arg0, + arg1, + ); + } + + late final _getiopolicy_npPtr = + _lookup>( + 'getiopolicy_np'); + late final _getiopolicy_np = + _getiopolicy_npPtr.asFunction(); + + int getrlimit( + int arg0, + ffi.Pointer arg1, + ) { + return _getrlimit( + arg0, + arg1, + ); + } + + late final _getrlimitPtr = _lookup< + ffi.NativeFunction)>>( + 'getrlimit'); + late final _getrlimit = + _getrlimitPtr.asFunction)>(); + + int getrusage( + int arg0, + ffi.Pointer arg1, + ) { + return _getrusage( + arg0, + arg1, + ); + } + + late final _getrusagePtr = _lookup< + ffi.NativeFunction)>>( + 'getrusage'); + late final _getrusage = + _getrusagePtr.asFunction)>(); + + int setpriority( + int arg0, + int arg1, + int arg2, + ) { + return _setpriority( + arg0, + arg1, + arg2, + ); + } + + late final _setpriorityPtr = + _lookup>( + 'setpriority'); + late final _setpriority = + _setpriorityPtr.asFunction(); + + int setiopolicy_np( + int arg0, + int arg1, + int arg2, + ) { + return _setiopolicy_np( + arg0, + arg1, + arg2, + ); + } + + late final _setiopolicy_npPtr = + _lookup>( + 'setiopolicy_np'); + late final _setiopolicy_np = + _setiopolicy_npPtr.asFunction(); + + int setrlimit( + int arg0, + ffi.Pointer arg1, + ) { + return _setrlimit( + arg0, + arg1, + ); + } + + late final _setrlimitPtr = _lookup< + ffi.NativeFunction)>>( + 'setrlimit'); + late final _setrlimit = + _setrlimitPtr.asFunction)>(); + + int wait( + ffi.Pointer arg0, + ) { + return _wait( + arg0, + ); + } + + late final _waitPtr = + _lookup)>>('wait'); + late final _wait = _waitPtr.asFunction)>(); + + int waitpid( + int arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _waitpid( + arg0, + arg1, + arg2, + ); + } + + late final _waitpidPtr = _lookup< + ffi.NativeFunction< + pid_t Function(pid_t, ffi.Pointer, ffi.Int)>>('waitpid'); + late final _waitpid = + _waitpidPtr.asFunction, int)>(); + + int waitid( + idtype_t arg0, + Dart__uint32_t arg1, + ffi.Pointer arg2, + int arg3, + ) { + return _waitid( + arg0.value, + arg1, + arg2, + arg3, + ); + } + + late final _waitidPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.UnsignedInt, id_t, ffi.Pointer, + ffi.Int)>>('waitid'); + late final _waitid = _waitidPtr + .asFunction, int)>(); + + int wait3( + ffi.Pointer arg0, + int arg1, + ffi.Pointer arg2, + ) { + return _wait3( + arg0, + arg1, + arg2, + ); + } + + late final _wait3Ptr = _lookup< + ffi.NativeFunction< + pid_t Function( + ffi.Pointer, ffi.Int, ffi.Pointer)>>('wait3'); + late final _wait3 = _wait3Ptr.asFunction< + int Function(ffi.Pointer, int, ffi.Pointer)>(); + + int wait4( + int arg0, + ffi.Pointer arg1, + int arg2, + ffi.Pointer arg3, + ) { + return _wait4( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _wait4Ptr = _lookup< + ffi.NativeFunction< + pid_t Function(pid_t, ffi.Pointer, ffi.Int, + ffi.Pointer)>>('wait4'); + late final _wait4 = _wait4Ptr.asFunction< + int Function(int, ffi.Pointer, int, ffi.Pointer)>(); + + ffi.Pointer alloca( + int __size, + ) { + return _alloca( + __size, + ); + } + + late final _allocaPtr = + _lookup Function(ffi.Size)>>( + 'alloca'); + late final _alloca = + _allocaPtr.asFunction Function(int)>(); + + late final ffi.Pointer ___mb_cur_max = + _lookup('__mb_cur_max'); + + int get __mb_cur_max => ___mb_cur_max.value; + + set __mb_cur_max(int value) => ___mb_cur_max.value = value; + + ffi.Pointer malloc_type_malloc( + int size, + int type_id, + ) { + return _malloc_type_malloc( + size, + type_id, + ); + } + + late final _malloc_type_mallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Size, malloc_type_id_t)>>('malloc_type_malloc'); + late final _malloc_type_malloc = _malloc_type_mallocPtr + .asFunction Function(int, int)>(); + + ffi.Pointer malloc_type_calloc( + int count, + int size, + int type_id, + ) { + return _malloc_type_calloc( + count, + size, + type_id, + ); + } + + late final _malloc_type_callocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Size, ffi.Size, malloc_type_id_t)>>('malloc_type_calloc'); + late final _malloc_type_calloc = _malloc_type_callocPtr + .asFunction Function(int, int, int)>(); + + void malloc_type_free( + ffi.Pointer ptr, + int type_id, + ) { + return _malloc_type_free( + ptr, + type_id, + ); + } + + late final _malloc_type_freePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, malloc_type_id_t)>>('malloc_type_free'); + late final _malloc_type_free = _malloc_type_freePtr + .asFunction, int)>(); + + ffi.Pointer malloc_type_realloc( + ffi.Pointer ptr, + int size, + int type_id, + ) { + return _malloc_type_realloc( + ptr, + size, + type_id, + ); + } + + late final _malloc_type_reallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + malloc_type_id_t)>>('malloc_type_realloc'); + late final _malloc_type_realloc = _malloc_type_reallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer malloc_type_valloc( + int size, + int type_id, + ) { + return _malloc_type_valloc( + size, + type_id, + ); + } + + late final _malloc_type_vallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Size, malloc_type_id_t)>>('malloc_type_valloc'); + late final _malloc_type_valloc = _malloc_type_vallocPtr + .asFunction Function(int, int)>(); + + ffi.Pointer malloc_type_aligned_alloc( + int alignment, + int size, + int type_id, + ) { + return _malloc_type_aligned_alloc( + alignment, + size, + type_id, + ); + } + + late final _malloc_type_aligned_allocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size, + malloc_type_id_t)>>('malloc_type_aligned_alloc'); + late final _malloc_type_aligned_alloc = _malloc_type_aligned_allocPtr + .asFunction Function(int, int, int)>(); + + int malloc_type_posix_memalign( + ffi.Pointer> memptr, + int alignment, + int size, + int type_id, + ) { + return _malloc_type_posix_memalign( + memptr, + alignment, + size, + type_id, + ); + } + + late final _malloc_type_posix_memalignPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, ffi.Size, + ffi.Size, malloc_type_id_t)>>('malloc_type_posix_memalign'); + late final _malloc_type_posix_memalign = + _malloc_type_posix_memalignPtr.asFunction< + int Function(ffi.Pointer>, int, int, int)>(); + + ffi.Pointer malloc_type_zone_malloc( + ffi.Pointer zone, + int size, + int type_id, + ) { + return _malloc_type_zone_malloc( + zone, + size, + type_id, + ); + } + + late final _malloc_type_zone_mallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + malloc_type_id_t)>>('malloc_type_zone_malloc'); + late final _malloc_type_zone_malloc = _malloc_type_zone_mallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer malloc_type_zone_calloc( + ffi.Pointer zone, + int count, + int size, + int type_id, + ) { + return _malloc_type_zone_calloc( + zone, + count, + size, + type_id, + ); + } + + late final _malloc_type_zone_callocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + ffi.Size, malloc_type_id_t)>>('malloc_type_zone_calloc'); + late final _malloc_type_zone_calloc = _malloc_type_zone_callocPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, int, int)>(); + + void malloc_type_zone_free( + ffi.Pointer zone, + ffi.Pointer ptr, + int type_id, + ) { + return _malloc_type_zone_free( + zone, + ptr, + type_id, + ); + } + + late final _malloc_type_zone_freePtr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Pointer, + malloc_type_id_t)>>('malloc_type_zone_free'); + late final _malloc_type_zone_free = _malloc_type_zone_freePtr.asFunction< + void Function(ffi.Pointer, ffi.Pointer, int)>(); + + ffi.Pointer malloc_type_zone_realloc( + ffi.Pointer zone, + ffi.Pointer ptr, + int size, + int type_id, + ) { + return _malloc_type_zone_realloc( + zone, + ptr, + size, + type_id, + ); + } + + late final _malloc_type_zone_reallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + malloc_type_id_t)>>('malloc_type_zone_realloc'); + late final _malloc_type_zone_realloc = + _malloc_type_zone_reallocPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int, int)>(); + + ffi.Pointer malloc_type_zone_valloc( + ffi.Pointer zone, + int size, + int type_id, + ) { + return _malloc_type_zone_valloc( + zone, + size, + type_id, + ); + } + + late final _malloc_type_zone_vallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + malloc_type_id_t)>>('malloc_type_zone_valloc'); + late final _malloc_type_zone_valloc = _malloc_type_zone_vallocPtr.asFunction< + ffi.Pointer Function(ffi.Pointer, int, int)>(); + + ffi.Pointer malloc_type_zone_memalign( + ffi.Pointer zone, + int alignment, + int size, + int type_id, + ) { + return _malloc_type_zone_memalign( + zone, + alignment, + size, + type_id, + ); + } + + late final _malloc_type_zone_memalignPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, ffi.Size, + ffi.Size, malloc_type_id_t)>>('malloc_type_zone_memalign'); + late final _malloc_type_zone_memalign = + _malloc_type_zone_memalignPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, int, int, int)>(); + + ffi.Pointer malloc( + int __size, + ) { + return _malloc( + __size, + ); + } + + late final _mallocPtr = + _lookup Function(ffi.Size)>>( + 'malloc'); + late final _malloc = + _mallocPtr.asFunction Function(int)>(); + + ffi.Pointer calloc( + int __count, + int __size, + ) { + return _calloc( + __count, + __size, + ); + } + + late final _callocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size)>>('calloc'); + late final _calloc = + _callocPtr.asFunction Function(int, int)>(); + + void free( + ffi.Pointer arg0, + ) { + return _free( + arg0, + ); + } + + late final _freePtr = + _lookup)>>( + 'free'); + late final _free = + _freePtr.asFunction)>(); + + ffi.Pointer realloc( + ffi.Pointer __ptr, + int __size, + ) { + return _realloc( + __ptr, + __size, + ); + } + + late final _reallocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size)>>('realloc'); + late final _realloc = _reallocPtr + .asFunction Function(ffi.Pointer, int)>(); + + ffi.Pointer reallocf( + ffi.Pointer __ptr, + int __size, + ) { + return _reallocf( + __ptr, + __size, + ); + } + + late final _reallocfPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Size)>>('reallocf'); + late final _reallocf = _reallocfPtr + .asFunction Function(ffi.Pointer, int)>(); + + ffi.Pointer valloc( + int __size, + ) { + return _valloc( + __size, + ); + } + + late final _vallocPtr = + _lookup Function(ffi.Size)>>( + 'valloc'); + late final _valloc = + _vallocPtr.asFunction Function(int)>(); + + ffi.Pointer aligned_alloc( + int __alignment, + int __size, + ) { + return _aligned_alloc( + __alignment, + __size, + ); + } + + late final _aligned_allocPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Size, ffi.Size)>>('aligned_alloc'); + late final _aligned_alloc = + _aligned_allocPtr.asFunction Function(int, int)>(); + + int posix_memalign( + ffi.Pointer> __memptr, + int __alignment, + int __size, + ) { + return _posix_memalign( + __memptr, + __alignment, + __size, + ); + } + + late final _posix_memalignPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, ffi.Size, + ffi.Size)>>('posix_memalign'); + late final _posix_memalign = _posix_memalignPtr + .asFunction>, int, int)>(); + + void abort() { + return _abort(); + } + + late final _abortPtr = + _lookup>('abort'); + late final _abort = _abortPtr.asFunction(); + + int abs( + int arg0, + ) { + return _abs( + arg0, + ); + } + + late final _absPtr = + _lookup>('abs'); + late final _abs = _absPtr.asFunction(); + + int atexit( + ffi.Pointer> arg0, + ) { + return _atexit( + arg0, + ); + } + + late final _atexitPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>)>>('atexit'); + late final _atexit = _atexitPtr.asFunction< + int Function(ffi.Pointer>)>(); + + int at_quick_exit( + ffi.Pointer> arg0, + ) { + return _at_quick_exit( + arg0, + ); + } + + late final _at_quick_exitPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>)>>( + 'at_quick_exit'); + late final _at_quick_exit = _at_quick_exitPtr.asFunction< + int Function(ffi.Pointer>)>(); + + double atof( + ffi.Pointer arg0, + ) { + return _atof( + arg0, + ); + } + + late final _atofPtr = + _lookup)>>( + 'atof'); + late final _atof = + _atofPtr.asFunction)>(); + + int atoi( + ffi.Pointer arg0, + ) { + return _atoi( + arg0, + ); + } + + late final _atoiPtr = + _lookup)>>( + 'atoi'); + late final _atoi = _atoiPtr.asFunction)>(); + + int atol( + ffi.Pointer arg0, + ) { + return _atol( + arg0, + ); + } + + late final _atolPtr = + _lookup)>>( + 'atol'); + late final _atol = _atolPtr.asFunction)>(); + + int atoll( + ffi.Pointer arg0, + ) { + return _atoll( + arg0, + ); + } + + late final _atollPtr = + _lookup)>>( + 'atoll'); + late final _atoll = + _atollPtr.asFunction)>(); + + ffi.Pointer bsearch( + ffi.Pointer __key, + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _bsearch( + __key, + __base, + __nel, + __width, + __compar, + ); + } + + late final _bsearchPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('bsearch'); + late final _bsearch = _bsearchPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + div_t div( + int arg0, + int arg1, + ) { + return _div( + arg0, + arg1, + ); + } + + late final _divPtr = + _lookup>('div'); + late final _div = _divPtr.asFunction(); + + void exit( + int arg0, + ) { + return _exit( + arg0, + ); + } + + late final _exitPtr = + _lookup>('exit'); + late final _exit = _exitPtr.asFunction(); + + ffi.Pointer getenv( + ffi.Pointer arg0, + ) { + return _getenv( + arg0, + ); + } + + late final _getenvPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('getenv'); + late final _getenv = _getenvPtr + .asFunction Function(ffi.Pointer)>(); + + int labs( + int arg0, + ) { + return _labs( + arg0, + ); + } + + late final _labsPtr = + _lookup>('labs'); + late final _labs = _labsPtr.asFunction(); + + ldiv_t ldiv( + int arg0, + int arg1, + ) { + return _ldiv( + arg0, + arg1, + ); + } + + late final _ldivPtr = + _lookup>('ldiv'); + late final _ldiv = _ldivPtr.asFunction(); + + int llabs( + int arg0, + ) { + return _llabs( + arg0, + ); + } + + late final _llabsPtr = + _lookup>('llabs'); + late final _llabs = _llabsPtr.asFunction(); + + lldiv_t lldiv( + int arg0, + int arg1, + ) { + return _lldiv( + arg0, + arg1, + ); + } + + late final _lldivPtr = + _lookup>( + 'lldiv'); + late final _lldiv = _lldivPtr.asFunction(); + + int mblen( + ffi.Pointer __s, + int __n, + ) { + return _mblen( + __s, + __n, + ); + } + + late final _mblenPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Size)>>('mblen'); + late final _mblen = + _mblenPtr.asFunction, int)>(); + + int mbstowcs( + ffi.Pointer arg0, + ffi.Pointer arg1, + int __n, + ) { + return _mbstowcs( + arg0, + arg1, + __n, + ); + } + + late final _mbstowcsPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('mbstowcs'); + late final _mbstowcs = _mbstowcsPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int mbtowc( + ffi.Pointer arg0, + ffi.Pointer arg1, + int __n, + ) { + return _mbtowc( + arg0, + arg1, + __n, + ); + } + + late final _mbtowcPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('mbtowc'); + late final _mbtowc = _mbtowcPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + void qsort( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _qsort( + __base, + __nel, + __width, + __compar, + ); + } + + late final _qsortPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('qsort'); + late final _qsort = _qsortPtr.asFunction< + void Function( + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + void quick_exit( + int arg0, + ) { + return _quick_exit( + arg0, + ); + } + + late final _quick_exitPtr = + _lookup>('quick_exit'); + late final _quick_exit = _quick_exitPtr.asFunction(); + + int rand() { + return _rand(); + } + + late final _randPtr = _lookup>('rand'); + late final _rand = _randPtr.asFunction(); + + void srand( + int arg0, + ) { + return _srand( + arg0, + ); + } + + late final _srandPtr = + _lookup>('srand'); + late final _srand = _srandPtr.asFunction(); + + double strtod( + ffi.Pointer arg0, + ffi.Pointer> arg1, + ) { + return _strtod( + arg0, + arg1, + ); + } + + late final _strtodPtr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer, + ffi.Pointer>)>>('strtod'); + late final _strtod = _strtodPtr.asFunction< + double Function( + ffi.Pointer, ffi.Pointer>)>(); + + double strtof( + ffi.Pointer arg0, + ffi.Pointer> arg1, + ) { + return _strtof( + arg0, + arg1, + ); + } + + late final _strtofPtr = _lookup< + ffi.NativeFunction< + ffi.Float Function(ffi.Pointer, + ffi.Pointer>)>>('strtof'); + late final _strtof = _strtofPtr.asFunction< + double Function( + ffi.Pointer, ffi.Pointer>)>(); + + int strtol( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtol( + __str, + __endptr, + __base, + ); + } + + late final _strtolPtr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtol'); + late final _strtol = _strtolPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int strtoll( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoll( + __str, + __endptr, + __base, + ); + } + + late final _strtollPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoll'); + late final _strtoll = _strtollPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int strtoul( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoul( + __str, + __endptr, + __base, + ); + } + + late final _strtoulPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoul'); + late final _strtoul = _strtoulPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int strtoull( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoull( + __str, + __endptr, + __base, + ); + } + + late final _strtoullPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoull'); + late final _strtoull = _strtoullPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int system( + ffi.Pointer arg0, + ) { + return _system( + arg0, + ); + } + + late final _systemPtr = + _lookup)>>( + 'system'); + late final _system = + _systemPtr.asFunction)>(); + + int wcstombs( + ffi.Pointer arg0, + ffi.Pointer arg1, + int __n, + ) { + return _wcstombs( + arg0, + arg1, + __n, + ); + } + + late final _wcstombsPtr = _lookup< + ffi.NativeFunction< + ffi.Size Function(ffi.Pointer, ffi.Pointer, + ffi.Size)>>('wcstombs'); + late final _wcstombs = _wcstombsPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + int wctomb( + ffi.Pointer arg0, + int arg1, + ) { + return _wctomb( + arg0, + arg1, + ); + } + + late final _wctombPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.WChar)>>('wctomb'); + late final _wctomb = + _wctombPtr.asFunction, int)>(); + + void _Exit( + int arg0, + ) { + return __Exit( + arg0, + ); + } + + late final __ExitPtr = + _lookup>('_Exit'); + late final __Exit = __ExitPtr.asFunction(); + + int a64l( + ffi.Pointer arg0, + ) { + return _a64l( + arg0, + ); + } + + late final _a64lPtr = + _lookup)>>( + 'a64l'); + late final _a64l = _a64lPtr.asFunction)>(); + + double drand48() { + return _drand48(); + } + + late final _drand48Ptr = + _lookup>('drand48'); + late final _drand48 = _drand48Ptr.asFunction(); + + ffi.Pointer ecvt( + double arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ) { + return _ecvt( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _ecvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('ecvt'); + late final _ecvt = _ecvtPtr.asFunction< + ffi.Pointer Function( + double, int, ffi.Pointer, ffi.Pointer)>(); + + double erand48( + ffi.Pointer arg0, + ) { + return _erand48( + arg0, + ); + } + + late final _erand48Ptr = _lookup< + ffi.NativeFunction< + ffi.Double Function(ffi.Pointer)>>('erand48'); + late final _erand48 = + _erand48Ptr.asFunction)>(); + + ffi.Pointer fcvt( + double arg0, + int arg1, + ffi.Pointer arg2, + ffi.Pointer arg3, + ) { + return _fcvt( + arg0, + arg1, + arg2, + arg3, + ); + } + + late final _fcvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Double, ffi.Int, + ffi.Pointer, ffi.Pointer)>>('fcvt'); + late final _fcvt = _fcvtPtr.asFunction< + ffi.Pointer Function( + double, int, ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer gcvt( + double arg0, + int arg1, + ffi.Pointer arg2, + ) { + return _gcvt( + arg0, + arg1, + arg2, + ); + } + + late final _gcvtPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Double, ffi.Int, ffi.Pointer)>>('gcvt'); + late final _gcvt = _gcvtPtr.asFunction< + ffi.Pointer Function(double, int, ffi.Pointer)>(); + + int getsubopt( + ffi.Pointer> arg0, + ffi.Pointer> arg1, + ffi.Pointer> arg2, + ) { + return _getsubopt( + arg0, + arg1, + arg2, + ); + } + + late final _getsuboptPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Pointer>, + ffi.Pointer>)>>('getsubopt'); + late final _getsubopt = _getsuboptPtr.asFunction< + int Function( + ffi.Pointer>, + ffi.Pointer>, + ffi.Pointer>)>(); + + int grantpt( + int arg0, + ) { + return _grantpt( + arg0, + ); + } + + late final _grantptPtr = + _lookup>('grantpt'); + late final _grantpt = _grantptPtr.asFunction(); + + ffi.Pointer initstate( + int arg0, + ffi.Pointer arg1, + int __size, + ) { + return _initstate( + arg0, + arg1, + __size, + ); + } + + late final _initstatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.UnsignedInt, ffi.Pointer, ffi.Size)>>('initstate'); + late final _initstate = _initstatePtr.asFunction< + ffi.Pointer Function(int, ffi.Pointer, int)>(); + + int jrand48( + ffi.Pointer arg0, + ) { + return _jrand48( + arg0, + ); + } + + late final _jrand48Ptr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer)>>('jrand48'); + late final _jrand48 = + _jrand48Ptr.asFunction)>(); + + ffi.Pointer l64a( + int arg0, + ) { + return _l64a( + arg0, + ); + } + + late final _l64aPtr = + _lookup Function(ffi.Long)>>( + 'l64a'); + late final _l64a = _l64aPtr.asFunction Function(int)>(); + + void lcong48( + ffi.Pointer arg0, + ) { + return _lcong48( + arg0, + ); + } + + late final _lcong48Ptr = _lookup< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer)>>('lcong48'); + late final _lcong48 = + _lcong48Ptr.asFunction)>(); + + int lrand48() { + return _lrand48(); + } + + late final _lrand48Ptr = + _lookup>('lrand48'); + late final _lrand48 = _lrand48Ptr.asFunction(); + + ffi.Pointer mktemp( + ffi.Pointer arg0, + ) { + return _mktemp( + arg0, + ); + } + + late final _mktempPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('mktemp'); + late final _mktemp = _mktempPtr + .asFunction Function(ffi.Pointer)>(); + + int mkstemp( + ffi.Pointer arg0, + ) { + return _mkstemp( + arg0, + ); + } + + late final _mkstempPtr = + _lookup)>>( + 'mkstemp'); + late final _mkstemp = + _mkstempPtr.asFunction)>(); + + int mrand48() { + return _mrand48(); + } + + late final _mrand48Ptr = + _lookup>('mrand48'); + late final _mrand48 = _mrand48Ptr.asFunction(); + + int nrand48( + ffi.Pointer arg0, + ) { + return _nrand48( + arg0, + ); + } + + late final _nrand48Ptr = _lookup< + ffi.NativeFunction< + ffi.Long Function(ffi.Pointer)>>('nrand48'); + late final _nrand48 = + _nrand48Ptr.asFunction)>(); + + int posix_openpt( + int arg0, + ) { + return _posix_openpt( + arg0, + ); + } + + late final _posix_openptPtr = + _lookup>('posix_openpt'); + late final _posix_openpt = _posix_openptPtr.asFunction(); + + ffi.Pointer ptsname( + int arg0, + ) { + return _ptsname( + arg0, + ); + } + + late final _ptsnamePtr = + _lookup Function(ffi.Int)>>( + 'ptsname'); + late final _ptsname = + _ptsnamePtr.asFunction Function(int)>(); + + int ptsname_r( + int fildes, + ffi.Pointer buffer, + int buflen, + ) { + return _ptsname_r( + fildes, + buffer, + buflen, + ); + } + + late final _ptsname_rPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Int, ffi.Pointer, ffi.Size)>>('ptsname_r'); + late final _ptsname_r = + _ptsname_rPtr.asFunction, int)>(); + + int putenv( + ffi.Pointer arg0, + ) { + return _putenv( + arg0, + ); + } + + late final _putenvPtr = + _lookup)>>( + 'putenv'); + late final _putenv = + _putenvPtr.asFunction)>(); + + int random() { + return _random(); + } + + late final _randomPtr = + _lookup>('random'); + late final _random = _randomPtr.asFunction(); + + int rand_r( + ffi.Pointer arg0, + ) { + return _rand_r( + arg0, + ); + } + + late final _rand_rPtr = _lookup< + ffi.NativeFunction)>>( + 'rand_r'); + late final _rand_r = + _rand_rPtr.asFunction)>(); + + ffi.Pointer realpath( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _realpath( + arg0, + arg1, + ); + } + + late final _realpathPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('realpath'); + late final _realpath = _realpathPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + ffi.Pointer seed48( + ffi.Pointer arg0, + ) { + return _seed48( + arg0, + ); + } + + late final _seed48Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer)>>('seed48'); + late final _seed48 = _seed48Ptr.asFunction< + ffi.Pointer Function( + ffi.Pointer)>(); + + int setenv( + ffi.Pointer __name, + ffi.Pointer __value, + int __overwrite, + ) { + return _setenv( + __name, + __value, + __overwrite, + ); + } + + late final _setenvPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Int)>>('setenv'); + late final _setenv = _setenvPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, int)>(); + + void setkey( + ffi.Pointer arg0, + ) { + return _setkey( + arg0, + ); + } + + late final _setkeyPtr = + _lookup)>>( + 'setkey'); + late final _setkey = + _setkeyPtr.asFunction)>(); + + ffi.Pointer setstate( + ffi.Pointer arg0, + ) { + return _setstate( + arg0, + ); + } + + late final _setstatePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer)>>('setstate'); + late final _setstate = _setstatePtr + .asFunction Function(ffi.Pointer)>(); + + void srand48( + int arg0, + ) { + return _srand48( + arg0, + ); + } + + late final _srand48Ptr = + _lookup>('srand48'); + late final _srand48 = _srand48Ptr.asFunction(); + + void srandom( + int arg0, + ) { + return _srandom( + arg0, + ); + } + + late final _srandomPtr = + _lookup>( + 'srandom'); + late final _srandom = _srandomPtr.asFunction(); + + int unlockpt( + int arg0, + ) { + return _unlockpt( + arg0, + ); + } + + late final _unlockptPtr = + _lookup>('unlockpt'); + late final _unlockpt = _unlockptPtr.asFunction(); + + int unsetenv( + ffi.Pointer arg0, + ) { + return _unsetenv( + arg0, + ); + } + + late final _unsetenvPtr = + _lookup)>>( + 'unsetenv'); + late final _unsetenv = + _unsetenvPtr.asFunction)>(); + + int arc4random() { + return _arc4random(); + } + + late final _arc4randomPtr = + _lookup>('arc4random'); + late final _arc4random = _arc4randomPtr.asFunction(); + + void arc4random_addrandom( + ffi.Pointer arg0, + int __datlen, + ) { + return _arc4random_addrandom( + arg0, + __datlen, + ); + } + + late final _arc4random_addrandomPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, ffi.Int)>>('arc4random_addrandom'); + late final _arc4random_addrandom = _arc4random_addrandomPtr + .asFunction, int)>(); + + void arc4random_buf( + ffi.Pointer __buf, + int __nbytes, + ) { + return _arc4random_buf( + __buf, + __nbytes, + ); + } + + late final _arc4random_bufPtr = _lookup< + ffi + .NativeFunction, ffi.Size)>>( + 'arc4random_buf'); + late final _arc4random_buf = _arc4random_bufPtr + .asFunction, int)>(); + + void arc4random_stir() { + return _arc4random_stir(); + } + + late final _arc4random_stirPtr = + _lookup>('arc4random_stir'); + late final _arc4random_stir = + _arc4random_stirPtr.asFunction(); + + int arc4random_uniform( + int __upper_bound, + ) { + return _arc4random_uniform( + __upper_bound, + ); + } + + late final _arc4random_uniformPtr = + _lookup>( + 'arc4random_uniform'); + late final _arc4random_uniform = + _arc4random_uniformPtr.asFunction(); + + ffi.Pointer cgetcap( + ffi.Pointer arg0, + ffi.Pointer arg1, + int arg2, + ) { + return _cgetcap( + arg0, + arg1, + arg2, + ); + } + + late final _cgetcapPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function(ffi.Pointer, + ffi.Pointer, ffi.Int)>>('cgetcap'); + late final _cgetcap = _cgetcapPtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer, int)>(); + + int cgetclose() { + return _cgetclose(); + } + + late final _cgetclosePtr = + _lookup>('cgetclose'); + late final _cgetclose = _cgetclosePtr.asFunction(); + + int cgetent( + ffi.Pointer> arg0, + ffi.Pointer> arg1, + ffi.Pointer arg2, + ) { + return _cgetent( + arg0, + arg1, + arg2, + ); + } + + late final _cgetentPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer>, + ffi.Pointer>, + ffi.Pointer)>>('cgetent'); + late final _cgetent = _cgetentPtr.asFunction< + int Function(ffi.Pointer>, + ffi.Pointer>, ffi.Pointer)>(); + + int cgetfirst( + ffi.Pointer> arg0, + ffi.Pointer> arg1, + ) { + return _cgetfirst( + arg0, + arg1, + ); + } + + late final _cgetfirstPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, + ffi.Pointer>)>>('cgetfirst'); + late final _cgetfirst = _cgetfirstPtr.asFunction< + int Function(ffi.Pointer>, + ffi.Pointer>)>(); + + int cgetmatch( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _cgetmatch( + arg0, + arg1, + ); + } + + late final _cgetmatchPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>('cgetmatch'); + late final _cgetmatch = _cgetmatchPtr + .asFunction, ffi.Pointer)>(); + + int cgetnext( + ffi.Pointer> arg0, + ffi.Pointer> arg1, + ) { + return _cgetnext( + arg0, + arg1, + ); + } + + late final _cgetnextPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, + ffi.Pointer>)>>('cgetnext'); + late final _cgetnext = _cgetnextPtr.asFunction< + int Function(ffi.Pointer>, + ffi.Pointer>)>(); + + int cgetnum( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer arg2, + ) { + return _cgetnum( + arg0, + arg1, + arg2, + ); + } + + late final _cgetnumPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>>('cgetnum'); + late final _cgetnum = _cgetnumPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>(); + + int cgetset( + ffi.Pointer arg0, + ) { + return _cgetset( + arg0, + ); + } + + late final _cgetsetPtr = + _lookup)>>( + 'cgetset'); + late final _cgetset = + _cgetsetPtr.asFunction)>(); + + int cgetstr( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + ) { + return _cgetstr( + arg0, + arg1, + arg2, + ); + } + + late final _cgetstrPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>>('cgetstr'); + late final _cgetstr = _cgetstrPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>(); + + int cgetustr( + ffi.Pointer arg0, + ffi.Pointer arg1, + ffi.Pointer> arg2, + ) { + return _cgetustr( + arg0, + arg1, + arg2, + ); + } + + late final _cgetustrPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>>('cgetustr'); + late final _cgetustr = _cgetustrPtr.asFunction< + int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer>)>(); + + int daemon( + int arg0, + int arg1, + ) { + return _daemon( + arg0, + arg1, + ); + } + + late final _daemonPtr = + _lookup>('daemon'); + late final _daemon = _daemonPtr.asFunction(); + + ffi.Pointer devname( + int arg0, + int arg1, + ) { + return _devname( + arg0, + arg1, + ); + } + + late final _devnamePtr = _lookup< + ffi.NativeFunction Function(dev_t, mode_t)>>( + 'devname'); + late final _devname = + _devnamePtr.asFunction Function(int, int)>(); + + ffi.Pointer devname_r( + int arg0, + int arg1, + ffi.Pointer buf, + int len, + ) { + return _devname_r( + arg0, + arg1, + buf, + len, + ); + } + + late final _devname_rPtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + dev_t, mode_t, ffi.Pointer, ffi.Int)>>('devname_r'); + late final _devname_r = _devname_rPtr.asFunction< + ffi.Pointer Function(int, int, ffi.Pointer, int)>(); + + ffi.Pointer getbsize( + ffi.Pointer arg0, + ffi.Pointer arg1, + ) { + return _getbsize( + arg0, + arg1, + ); + } + + late final _getbsizePtr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>>('getbsize'); + late final _getbsize = _getbsizePtr.asFunction< + ffi.Pointer Function( + ffi.Pointer, ffi.Pointer)>(); + + int getloadavg( + ffi.Pointer arg0, + int __nelem, + ) { + return _getloadavg( + arg0, + __nelem, + ); + } + + late final _getloadavgPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Int)>>('getloadavg'); + late final _getloadavg = + _getloadavgPtr.asFunction, int)>(); + + ffi.Pointer getprogname() { + return _getprogname(); + } + + late final _getprognamePtr = + _lookup Function()>>( + 'getprogname'); + late final _getprogname = + _getprognamePtr.asFunction Function()>(); + + void setprogname( + ffi.Pointer arg0, + ) { + return _setprogname( + arg0, + ); + } + + late final _setprognamePtr = + _lookup)>>( + 'setprogname'); + late final _setprogname = + _setprognamePtr.asFunction)>(); + + int heapsort( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _heapsort( + __base, + __nel, + __width, + __compar, + ); + } + + late final _heapsortPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('heapsort'); + late final _heapsort = _heapsortPtr.asFunction< + int Function( + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + int mergesort( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _mergesort( + __base, + __nel, + __width, + __compar, + ); + } + + late final _mergesortPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('mergesort'); + late final _mergesort = _mergesortPtr.asFunction< + int Function( + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + void psort( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer)>> + __compar, + ) { + return _psort( + __base, + __nel, + __width, + __compar, + ); + } + + late final _psortPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, + ffi.Pointer)>>)>>('psort'); + late final _psort = _psortPtr.asFunction< + void Function( + ffi.Pointer, + int, + int, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, ffi.Pointer)>>)>(); + + void psort_r( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer arg3, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>> + __compar, + ) { + return _psort_r( + __base, + __nel, + __width, + arg3, + __compar, + ); + } + + late final _psort_rPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>)>>('psort_r'); + late final _psort_r = _psort_rPtr.asFunction< + void Function( + ffi.Pointer, + int, + int, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>>)>(); + + void qsort_r( + ffi.Pointer __base, + int __nel, + int __width, + ffi.Pointer arg3, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>> + __compar, + ) { + return _qsort_r( + __base, + __nel, + __width, + arg3, + __compar, + ); + } + + late final _qsort_rPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.Pointer, + ffi.Size, + ffi.Size, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function( + ffi.Pointer, + ffi.Pointer, + ffi.Pointer)>>)>>('qsort_r'); + late final _qsort_r = _qsort_rPtr.asFunction< + void Function( + ffi.Pointer, + int, + int, + ffi.Pointer, + ffi.Pointer< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer, ffi.Pointer, + ffi.Pointer)>>)>(); + + int radixsort( + ffi.Pointer> __base, + int __nel, + ffi.Pointer __table, + int __endbyte, + ) { + return _radixsort( + __base, + __nel, + __table, + __endbyte, + ); + } + + late final _radixsortPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, ffi.Int, + ffi.Pointer, ffi.UnsignedInt)>>('radixsort'); + late final _radixsort = _radixsortPtr.asFunction< + int Function(ffi.Pointer>, int, + ffi.Pointer, int)>(); + + int rpmatch( + ffi.Pointer arg0, + ) { + return _rpmatch( + arg0, + ); + } + + late final _rpmatchPtr = + _lookup)>>( + 'rpmatch'); + late final _rpmatch = + _rpmatchPtr.asFunction)>(); + + int sradixsort( + ffi.Pointer> __base, + int __nel, + ffi.Pointer __table, + int __endbyte, + ) { + return _sradixsort( + __base, + __nel, + __table, + __endbyte, + ); + } + + late final _sradixsortPtr = _lookup< + ffi.NativeFunction< + ffi.Int Function(ffi.Pointer>, ffi.Int, + ffi.Pointer, ffi.UnsignedInt)>>('sradixsort'); + late final _sradixsort = _sradixsortPtr.asFunction< + int Function(ffi.Pointer>, int, + ffi.Pointer, int)>(); + + void sranddev() { + return _sranddev(); + } + + late final _sranddevPtr = + _lookup>('sranddev'); + late final _sranddev = _sranddevPtr.asFunction(); + + void srandomdev() { + return _srandomdev(); + } + + late final _srandomdevPtr = + _lookup>('srandomdev'); + late final _srandomdev = _srandomdevPtr.asFunction(); + + int strtonum( + ffi.Pointer __numstr, + int __minval, + int __maxval, + ffi.Pointer> __errstrp, + ) { + return _strtonum( + __numstr, + __minval, + __maxval, + __errstrp, + ); + } + + late final _strtonumPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, ffi.LongLong, + ffi.LongLong, ffi.Pointer>)>>('strtonum'); + late final _strtonum = _strtonumPtr.asFunction< + int Function(ffi.Pointer, int, int, + ffi.Pointer>)>(); + + int strtoq( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtoq( + __str, + __endptr, + __base, + ); + } + + late final _strtoqPtr = _lookup< + ffi.NativeFunction< + ffi.LongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtoq'); + late final _strtoq = _strtoqPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + int strtouq( + ffi.Pointer __str, + ffi.Pointer> __endptr, + int __base, + ) { + return _strtouq( + __str, + __endptr, + __base, + ); + } + + late final _strtouqPtr = _lookup< + ffi.NativeFunction< + ffi.UnsignedLongLong Function(ffi.Pointer, + ffi.Pointer>, ffi.Int)>>('strtouq'); + late final _strtouq = _strtouqPtr.asFunction< + int Function( + ffi.Pointer, ffi.Pointer>, int)>(); + + late final ffi.Pointer> _suboptarg = + _lookup>('suboptarg'); + + ffi.Pointer get suboptarg => _suboptarg.value; + + set suboptarg(ffi.Pointer value) => _suboptarg.value = value; + + /// Resets the updater's global config so the next `shorebird_init` + /// starts from scratch. Equivalent to a process restart for state + /// purposes — Dart tests call this between scenarios so each test + /// runs against a fresh updater. + void shorebird_test_reset() { + return _shorebird_test_reset(); + } + + late final _shorebird_test_resetPtr = + _lookup>('shorebird_test_reset'); + late final _shorebird_test_reset = + _shorebird_test_resetPtr.asFunction(); +} + +typedef __builtin_va_list = ffi.Pointer; +typedef __gnuc_va_list = __builtin_va_list; +typedef va_list = __builtin_va_list; +typedef int_least8_t = ffi.Int8; +typedef Dartint_least8_t = int; +typedef int_least16_t = ffi.Int16; +typedef Dartint_least16_t = int; +typedef int_least32_t = ffi.Int32; +typedef Dartint_least32_t = int; +typedef int_least64_t = ffi.Int64; +typedef Dartint_least64_t = int; +typedef uint_least8_t = ffi.Uint8; +typedef Dartuint_least8_t = int; +typedef uint_least16_t = ffi.Uint16; +typedef Dartuint_least16_t = int; +typedef uint_least32_t = ffi.Uint32; +typedef Dartuint_least32_t = int; +typedef uint_least64_t = ffi.Uint64; +typedef Dartuint_least64_t = int; +typedef int_fast8_t = ffi.Int8; +typedef Dartint_fast8_t = int; +typedef int_fast16_t = ffi.Int16; +typedef Dartint_fast16_t = int; +typedef int_fast32_t = ffi.Int32; +typedef Dartint_fast32_t = int; +typedef int_fast64_t = ffi.Int64; +typedef Dartint_fast64_t = int; +typedef uint_fast8_t = ffi.Uint8; +typedef Dartuint_fast8_t = int; +typedef uint_fast16_t = ffi.Uint16; +typedef Dartuint_fast16_t = int; +typedef uint_fast32_t = ffi.Uint32; +typedef Dartuint_fast32_t = int; +typedef uint_fast64_t = ffi.Uint64; +typedef Dartuint_fast64_t = int; +typedef __int8_t = ffi.SignedChar; +typedef Dart__int8_t = int; +typedef __uint8_t = ffi.UnsignedChar; +typedef Dart__uint8_t = int; +typedef __int16_t = ffi.Short; +typedef Dart__int16_t = int; +typedef __uint16_t = ffi.UnsignedShort; +typedef Dart__uint16_t = int; +typedef __int32_t = ffi.Int; +typedef Dart__int32_t = int; +typedef __uint32_t = ffi.UnsignedInt; +typedef Dart__uint32_t = int; +typedef __int64_t = ffi.LongLong; +typedef Dart__int64_t = int; +typedef __uint64_t = ffi.UnsignedLongLong; +typedef Dart__uint64_t = int; +typedef __darwin_intptr_t = ffi.Long; +typedef Dart__darwin_intptr_t = int; +typedef __darwin_natural_t = ffi.UnsignedInt; +typedef Dart__darwin_natural_t = int; +typedef __darwin_ct_rune_t = ffi.Int; +typedef Dart__darwin_ct_rune_t = int; + +final class __mbstate_t extends ffi.Union { + @ffi.Array.multi([128]) + external ffi.Array __mbstate8; + + @ffi.LongLong() + external int _mbstateL; +} + +typedef __darwin_mbstate_t = __mbstate_t; +typedef __darwin_ptrdiff_t = ffi.Long; +typedef Dart__darwin_ptrdiff_t = int; +typedef __darwin_size_t = ffi.UnsignedLong; +typedef Dart__darwin_size_t = int; +typedef __darwin_va_list = __builtin_va_list; +typedef __darwin_wchar_t = ffi.Int; +typedef Dart__darwin_wchar_t = int; +typedef __darwin_rune_t = __darwin_wchar_t; +typedef __darwin_wint_t = ffi.Int; +typedef Dart__darwin_wint_t = int; +typedef __darwin_clock_t = ffi.UnsignedLong; +typedef Dart__darwin_clock_t = int; +typedef __darwin_socklen_t = __uint32_t; +typedef __darwin_ssize_t = ffi.Long; +typedef Dart__darwin_ssize_t = int; +typedef __darwin_time_t = ffi.Long; +typedef Dart__darwin_time_t = int; +typedef __darwin_blkcnt_t = __int64_t; +typedef __darwin_blksize_t = __int32_t; +typedef __darwin_dev_t = __int32_t; +typedef __darwin_fsblkcnt_t = ffi.UnsignedInt; +typedef Dart__darwin_fsblkcnt_t = int; +typedef __darwin_fsfilcnt_t = ffi.UnsignedInt; +typedef Dart__darwin_fsfilcnt_t = int; +typedef __darwin_gid_t = __uint32_t; +typedef __darwin_id_t = __uint32_t; +typedef __darwin_ino64_t = __uint64_t; +typedef __darwin_ino_t = __darwin_ino64_t; +typedef __darwin_mach_port_name_t = __darwin_natural_t; +typedef __darwin_mach_port_t = __darwin_mach_port_name_t; +typedef __darwin_mode_t = __uint16_t; +typedef __darwin_off_t = __int64_t; +typedef __darwin_pid_t = __int32_t; +typedef __darwin_sigset_t = __uint32_t; +typedef __darwin_suseconds_t = __int32_t; +typedef __darwin_uid_t = __uint32_t; +typedef __darwin_useconds_t = __uint32_t; + +final class __darwin_pthread_handler_rec extends ffi.Struct { + external ffi + .Pointer)>> + __routine; + + external ffi.Pointer __arg; + + external ffi.Pointer<__darwin_pthread_handler_rec> __next; +} + +final class _opaque_pthread_attr_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([56]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_cond_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([40]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_condattr_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([8]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_mutex_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([56]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_mutexattr_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([8]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_once_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([8]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_rwlock_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([192]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_rwlockattr_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + @ffi.Array.multi([16]) + external ffi.Array __opaque; +} + +final class _opaque_pthread_t extends ffi.Struct { + @ffi.Long() + external int __sig; + + external ffi.Pointer<__darwin_pthread_handler_rec> __cleanup_stack; + + @ffi.Array.multi([8176]) + external ffi.Array __opaque; +} + +typedef __darwin_pthread_attr_t = _opaque_pthread_attr_t; +typedef __darwin_pthread_cond_t = _opaque_pthread_cond_t; +typedef __darwin_pthread_condattr_t = _opaque_pthread_condattr_t; +typedef __darwin_pthread_key_t = ffi.UnsignedLong; +typedef Dart__darwin_pthread_key_t = int; +typedef __darwin_pthread_mutex_t = _opaque_pthread_mutex_t; +typedef __darwin_pthread_mutexattr_t = _opaque_pthread_mutexattr_t; +typedef __darwin_pthread_once_t = _opaque_pthread_once_t; +typedef __darwin_pthread_rwlock_t = _opaque_pthread_rwlock_t; +typedef __darwin_pthread_rwlockattr_t = _opaque_pthread_rwlockattr_t; +typedef __darwin_pthread_t = ffi.Pointer<_opaque_pthread_t>; +typedef intmax_t = ffi.Long; +typedef Dartintmax_t = int; +typedef uintmax_t = ffi.UnsignedLong; +typedef Dartuintmax_t = int; +typedef __darwin_nl_item = ffi.Int; +typedef Dart__darwin_nl_item = int; +typedef __darwin_wctrans_t = ffi.Int; +typedef Dart__darwin_wctrans_t = int; +typedef __darwin_wctype_t = __uint32_t; + +enum idtype_t { + P_ALL(0), + P_PID(1), + P_PGID(2); + + final int value; + const idtype_t(this.value); + + static idtype_t fromValue(int value) => switch (value) { + 0 => P_ALL, + 1 => P_PID, + 2 => P_PGID, + _ => throw ArgumentError('Unknown value for idtype_t: $value'), + }; +} + +typedef pid_t = __darwin_pid_t; +typedef id_t = __darwin_id_t; +typedef sig_atomic_t = ffi.Int; +typedef Dartsig_atomic_t = int; +typedef u_int8_t = ffi.UnsignedChar; +typedef Dartu_int8_t = int; +typedef u_int16_t = ffi.UnsignedShort; +typedef Dartu_int16_t = int; +typedef u_int32_t = ffi.UnsignedInt; +typedef Dartu_int32_t = int; +typedef u_int64_t = ffi.UnsignedLongLong; +typedef Dartu_int64_t = int; +typedef register_t = ffi.Int64; +typedef Dartregister_t = int; +typedef user_addr_t = u_int64_t; +typedef user_size_t = u_int64_t; +typedef user_ssize_t = ffi.Int64; +typedef Dartuser_ssize_t = int; +typedef user_long_t = ffi.Int64; +typedef Dartuser_long_t = int; +typedef user_ulong_t = u_int64_t; +typedef user_time_t = ffi.Int64; +typedef Dartuser_time_t = int; +typedef user_off_t = ffi.Int64; +typedef Dartuser_off_t = int; +typedef syscall_arg_t = u_int64_t; + +final class __darwin_arm_exception_state extends ffi.Struct { + @__uint32_t() + external int __exception; + + @__uint32_t() + external int __fsr; + + @__uint32_t() + external int __far; +} + +final class __darwin_arm_exception_state64 extends ffi.Struct { + @__uint64_t() + external int __far; + + @__uint32_t() + external int __esr; + + @__uint32_t() + external int __exception; +} + +final class __darwin_arm_exception_state64_v2 extends ffi.Struct { + @__uint64_t() + external int __far; + + @__uint64_t() + external int __esr; +} + +final class __darwin_arm_thread_state extends ffi.Struct { + @ffi.Array.multi([13]) + external ffi.Array<__uint32_t> __r; + + @__uint32_t() + external int __sp; + + @__uint32_t() + external int __lr; + + @__uint32_t() + external int __pc; + + @__uint32_t() + external int __cpsr; +} + +final class __darwin_arm_thread_state64 extends ffi.Struct { + @ffi.Array.multi([29]) + external ffi.Array<__uint64_t> __x; + + @__uint64_t() + external int __fp; + + @__uint64_t() + external int __lr; + + @__uint64_t() + external int __sp; + + @__uint64_t() + external int __pc; + + @__uint32_t() + external int __cpsr; + + @__uint32_t() + external int __pad; +} + +final class __darwin_arm_vfp_state extends ffi.Struct { + @ffi.Array.multi([64]) + external ffi.Array<__uint32_t> __r; + + @__uint32_t() + external int __fpscr; +} + +final class __darwin_arm_neon_state64 extends ffi.Opaque {} + +final class __darwin_arm_neon_state extends ffi.Opaque {} + +final class __arm_pagein_state extends ffi.Struct { + @ffi.Int() + external int __pagein_error; +} + +final class __darwin_arm_sme_state extends ffi.Struct { + @__uint64_t() + external int __svcr; + + @__uint64_t() + external int __tpidr2_el0; + + @__uint16_t() + external int __svl_b; +} + +final class __darwin_arm_sve_z_state extends ffi.Struct { + @ffi.Array.multi([16, 256]) + external ffi.Array> __z; +} + +final class __darwin_arm_sve_p_state extends ffi.Struct { + @ffi.Array.multi([16, 32]) + external ffi.Array> __p; +} + +final class __darwin_arm_sme_za_state extends ffi.Struct { + @ffi.Array.multi([4096]) + external ffi.Array __za; +} + +final class __darwin_arm_sme2_state extends ffi.Struct { + @ffi.Array.multi([64]) + external ffi.Array __zt0; +} + +final class __arm_legacy_debug_state extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __bvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __bcr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __wvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __wcr; +} + +final class __darwin_arm_debug_state32 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __bvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __bcr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __wvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint32_t> __wcr; + + @__uint64_t() + external int __mdscr_el1; +} + +final class __darwin_arm_debug_state64 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __bvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __bcr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __wvr; + + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __wcr; + + @__uint64_t() + external int __mdscr_el1; +} + +final class __darwin_arm_cpmu_state64 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array<__uint64_t> __ctrs; +} + +final class __darwin_mcontext32 extends ffi.Struct { + external __darwin_arm_exception_state __es; + + external __darwin_arm_thread_state __ss; + + external __darwin_arm_vfp_state __fs; +} + +final class __darwin_mcontext64 extends ffi.Opaque {} + +typedef mcontext_t = ffi.Pointer<__darwin_mcontext64>; +typedef pthread_attr_t = __darwin_pthread_attr_t; + +final class __darwin_sigaltstack extends ffi.Struct { + external ffi.Pointer ss_sp; + + @__darwin_size_t() + external int ss_size; + + @ffi.Int() + external int ss_flags; +} + +typedef stack_t = __darwin_sigaltstack; + +final class __darwin_ucontext extends ffi.Struct { + @ffi.Int() + external int uc_onstack; + + @__darwin_sigset_t() + external int uc_sigmask; + + external __darwin_sigaltstack uc_stack; + + external ffi.Pointer<__darwin_ucontext> uc_link; + + @__darwin_size_t() + external int uc_mcsize; + + external ffi.Pointer<__darwin_mcontext64> uc_mcontext; +} + +typedef ucontext_t = __darwin_ucontext; +typedef sigset_t = __darwin_sigset_t; +typedef uid_t = __darwin_uid_t; + +final class sigval extends ffi.Union { + @ffi.Int() + external int sival_int; + + external ffi.Pointer sival_ptr; +} + +final class sigevent extends ffi.Struct { + @ffi.Int() + external int sigev_notify; + + @ffi.Int() + external int sigev_signo; + + external sigval sigev_value; + + external ffi.Pointer> + sigev_notify_function; + + external ffi.Pointer sigev_notify_attributes; +} + +final class __siginfo extends ffi.Struct { + @ffi.Int() + external int si_signo; + + @ffi.Int() + external int si_errno; + + @ffi.Int() + external int si_code; + + @pid_t() + external int si_pid; + + @uid_t() + external int si_uid; + + @ffi.Int() + external int si_status; + + external ffi.Pointer si_addr; + + external sigval si_value; + + @ffi.Long() + external int si_band; + + @ffi.Array.multi([7]) + external ffi.Array __pad; +} + +typedef siginfo_t = __siginfo; + +final class __sigaction_u extends ffi.Union { + external ffi.Pointer> + __sa_handler; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function( + ffi.Int, ffi.Pointer<__siginfo>, ffi.Pointer)>> + __sa_sigaction; +} + +final class __sigaction extends ffi.Struct { + external __sigaction_u __sigaction_u$1; + + external ffi.Pointer< + ffi.NativeFunction< + ffi.Void Function(ffi.Pointer, ffi.Int, ffi.Int, + ffi.Pointer, ffi.Pointer)>> sa_tramp; + + @sigset_t() + external int sa_mask; + + @ffi.Int() + external int sa_flags; +} + +final class sigaction extends ffi.Struct { + external __sigaction_u __sigaction_u$1; + + @sigset_t() + external int sa_mask; + + @ffi.Int() + external int sa_flags; +} + +typedef sig_tFunction = ffi.Void Function(ffi.Int); +typedef Dartsig_tFunction = void Function(int); +typedef sig_t = ffi.Pointer>; + +final class sigvec extends ffi.Struct { + external ffi.Pointer> + sv_handler; + + @ffi.Int() + external int sv_mask; + + @ffi.Int() + external int sv_flags; +} + +final class sigstack extends ffi.Struct { + external ffi.Pointer ss_sp; + + @ffi.Int() + external int ss_onstack; +} + +final class timeval extends ffi.Struct { + @__darwin_time_t() + external int tv_sec; + + @__darwin_suseconds_t() + external int tv_usec; +} + +typedef rlim_t = __uint64_t; + +final class rusage extends ffi.Struct { + external timeval ru_utime; + + external timeval ru_stime; + + @ffi.Long() + external int ru_maxrss; + + @ffi.Long() + external int ru_ixrss; + + @ffi.Long() + external int ru_idrss; + + @ffi.Long() + external int ru_isrss; + + @ffi.Long() + external int ru_minflt; + + @ffi.Long() + external int ru_majflt; + + @ffi.Long() + external int ru_nswap; + + @ffi.Long() + external int ru_inblock; + + @ffi.Long() + external int ru_oublock; + + @ffi.Long() + external int ru_msgsnd; + + @ffi.Long() + external int ru_msgrcv; + + @ffi.Long() + external int ru_nsignals; + + @ffi.Long() + external int ru_nvcsw; + + @ffi.Long() + external int ru_nivcsw; +} + +typedef rusage_info_t = ffi.Pointer; + +final class rusage_info_v0 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; +} + +final class rusage_info_v1 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; +} + +final class rusage_info_v2 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; +} + +final class rusage_info_v3 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; + + @ffi.Uint64() + external int ri_cpu_time_qos_default; + + @ffi.Uint64() + external int ri_cpu_time_qos_maintenance; + + @ffi.Uint64() + external int ri_cpu_time_qos_background; + + @ffi.Uint64() + external int ri_cpu_time_qos_utility; + + @ffi.Uint64() + external int ri_cpu_time_qos_legacy; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_initiated; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_interactive; + + @ffi.Uint64() + external int ri_billed_system_time; + + @ffi.Uint64() + external int ri_serviced_system_time; +} + +final class rusage_info_v4 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; + + @ffi.Uint64() + external int ri_cpu_time_qos_default; + + @ffi.Uint64() + external int ri_cpu_time_qos_maintenance; + + @ffi.Uint64() + external int ri_cpu_time_qos_background; + + @ffi.Uint64() + external int ri_cpu_time_qos_utility; + + @ffi.Uint64() + external int ri_cpu_time_qos_legacy; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_initiated; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_interactive; + + @ffi.Uint64() + external int ri_billed_system_time; + + @ffi.Uint64() + external int ri_serviced_system_time; + + @ffi.Uint64() + external int ri_logical_writes; + + @ffi.Uint64() + external int ri_lifetime_max_phys_footprint; + + @ffi.Uint64() + external int ri_instructions; + + @ffi.Uint64() + external int ri_cycles; + + @ffi.Uint64() + external int ri_billed_energy; + + @ffi.Uint64() + external int ri_serviced_energy; + + @ffi.Uint64() + external int ri_interval_max_phys_footprint; + + @ffi.Uint64() + external int ri_runnable_time; +} + +final class rusage_info_v5 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; + + @ffi.Uint64() + external int ri_cpu_time_qos_default; + + @ffi.Uint64() + external int ri_cpu_time_qos_maintenance; + + @ffi.Uint64() + external int ri_cpu_time_qos_background; + + @ffi.Uint64() + external int ri_cpu_time_qos_utility; + + @ffi.Uint64() + external int ri_cpu_time_qos_legacy; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_initiated; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_interactive; + + @ffi.Uint64() + external int ri_billed_system_time; + + @ffi.Uint64() + external int ri_serviced_system_time; + + @ffi.Uint64() + external int ri_logical_writes; + + @ffi.Uint64() + external int ri_lifetime_max_phys_footprint; + + @ffi.Uint64() + external int ri_instructions; + + @ffi.Uint64() + external int ri_cycles; + + @ffi.Uint64() + external int ri_billed_energy; + + @ffi.Uint64() + external int ri_serviced_energy; + + @ffi.Uint64() + external int ri_interval_max_phys_footprint; + + @ffi.Uint64() + external int ri_runnable_time; + + @ffi.Uint64() + external int ri_flags; +} + +final class rusage_info_v6 extends ffi.Struct { + @ffi.Array.multi([16]) + external ffi.Array ri_uuid; + + @ffi.Uint64() + external int ri_user_time; + + @ffi.Uint64() + external int ri_system_time; + + @ffi.Uint64() + external int ri_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_interrupt_wkups; + + @ffi.Uint64() + external int ri_pageins; + + @ffi.Uint64() + external int ri_wired_size; + + @ffi.Uint64() + external int ri_resident_size; + + @ffi.Uint64() + external int ri_phys_footprint; + + @ffi.Uint64() + external int ri_proc_start_abstime; + + @ffi.Uint64() + external int ri_proc_exit_abstime; + + @ffi.Uint64() + external int ri_child_user_time; + + @ffi.Uint64() + external int ri_child_system_time; + + @ffi.Uint64() + external int ri_child_pkg_idle_wkups; + + @ffi.Uint64() + external int ri_child_interrupt_wkups; + + @ffi.Uint64() + external int ri_child_pageins; + + @ffi.Uint64() + external int ri_child_elapsed_abstime; + + @ffi.Uint64() + external int ri_diskio_bytesread; + + @ffi.Uint64() + external int ri_diskio_byteswritten; + + @ffi.Uint64() + external int ri_cpu_time_qos_default; + + @ffi.Uint64() + external int ri_cpu_time_qos_maintenance; + + @ffi.Uint64() + external int ri_cpu_time_qos_background; + + @ffi.Uint64() + external int ri_cpu_time_qos_utility; + + @ffi.Uint64() + external int ri_cpu_time_qos_legacy; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_initiated; + + @ffi.Uint64() + external int ri_cpu_time_qos_user_interactive; + + @ffi.Uint64() + external int ri_billed_system_time; + + @ffi.Uint64() + external int ri_serviced_system_time; + + @ffi.Uint64() + external int ri_logical_writes; + + @ffi.Uint64() + external int ri_lifetime_max_phys_footprint; + + @ffi.Uint64() + external int ri_instructions; + + @ffi.Uint64() + external int ri_cycles; + + @ffi.Uint64() + external int ri_billed_energy; + + @ffi.Uint64() + external int ri_serviced_energy; + + @ffi.Uint64() + external int ri_interval_max_phys_footprint; + + @ffi.Uint64() + external int ri_runnable_time; + + @ffi.Uint64() + external int ri_flags; + + @ffi.Uint64() + external int ri_user_ptime; + + @ffi.Uint64() + external int ri_system_ptime; + + @ffi.Uint64() + external int ri_pinstructions; + + @ffi.Uint64() + external int ri_pcycles; + + @ffi.Uint64() + external int ri_energy_nj; + + @ffi.Uint64() + external int ri_penergy_nj; + + @ffi.Uint64() + external int ri_secure_time_in_system; + + @ffi.Uint64() + external int ri_secure_ptime_in_system; + + @ffi.Uint64() + external int ri_neural_footprint; + + @ffi.Uint64() + external int ri_lifetime_max_neural_footprint; + + @ffi.Uint64() + external int ri_interval_max_neural_footprint; + + @ffi.Array.multi([9]) + external ffi.Array ri_reserved; +} + +typedef rusage_info_current = rusage_info_v6; + +final class rlimit extends ffi.Struct { + @rlim_t() + external int rlim_cur; + + @rlim_t() + external int rlim_max; +} + +final class proc_rlimit_control_wakeupmon extends ffi.Struct { + @ffi.Uint32() + external int wm_flags; + + @ffi.Int32() + external int wm_rate; +} + +final class wait$1 extends ffi.Opaque {} + +typedef ct_rune_t = __darwin_ct_rune_t; +typedef rune_t = __darwin_rune_t; + +final class div_t extends ffi.Struct { + @ffi.Int() + external int quot; + + @ffi.Int() + external int rem; +} + +final class ldiv_t extends ffi.Struct { + @ffi.Long() + external int quot; + + @ffi.Long() + external int rem; +} + +final class lldiv_t extends ffi.Struct { + @ffi.LongLong() + external int quot; + + @ffi.LongLong() + external int rem; +} + +typedef malloc_type_id_t = ffi.UnsignedLongLong; +typedef Dartmalloc_type_id_t = int; + +final class _malloc_zone_t extends ffi.Opaque {} + +typedef malloc_zone_t = _malloc_zone_t; +typedef dev_t = __darwin_dev_t; +typedef mode_t = __darwin_mode_t; + +const int __bool_true_false_are_defined = 1; + +const int true$ = 1; + +const int false$ = 0; + +const int __WORDSIZE = 64; + +const int __has_safe_buffers = 1; + +const int __DARWIN_ONLY_64_BIT_INO_T = 1; + +const int __DARWIN_ONLY_UNIX_CONFORMANCE = 1; + +const int __DARWIN_ONLY_VERS_1050 = 1; + +const int __DARWIN_UNIX03 = 1; + +const int __DARWIN_64_BIT_INO_T = 1; + +const int __DARWIN_VERS_1050 = 1; + +const int __DARWIN_NON_CANCELABLE = 0; + +const String __DARWIN_SUF_EXTSN = '\$DARWIN_EXTSN'; + +const int __DARWIN_C_ANSI = 4096; + +const int __DARWIN_C_FULL = 900000; + +const int __DARWIN_C_LEVEL = 900000; + +const int __STDC_WANT_LIB_EXT1__ = 1; + +const int __DARWIN_NO_LONG_LONG = 0; + +const int _DARWIN_FEATURE_64_BIT_INODE = 1; + +const int _DARWIN_FEATURE_ONLY_64_BIT_INODE = 1; + +const int _DARWIN_FEATURE_ONLY_VERS_1050 = 1; + +const int _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = 1; + +const int _DARWIN_FEATURE_UNIX_CONFORMANCE = 3; + +const int __has_ptrcheck = 0; + +const int __has_bounds_safety_attributes = 0; + +const int __DARWIN_NULL = 0; + +const int __PTHREAD_SIZE__ = 8176; + +const int __PTHREAD_ATTR_SIZE__ = 56; + +const int __PTHREAD_MUTEXATTR_SIZE__ = 8; + +const int __PTHREAD_MUTEX_SIZE__ = 56; + +const int __PTHREAD_CONDATTR_SIZE__ = 8; + +const int __PTHREAD_COND_SIZE__ = 40; + +const int __PTHREAD_ONCE_SIZE__ = 8; + +const int __PTHREAD_RWLOCK_SIZE__ = 192; + +const int __PTHREAD_RWLOCKATTR_SIZE__ = 16; + +const int INT8_MAX = 127; + +const int INT16_MAX = 32767; + +const int INT32_MAX = 2147483647; + +const int INT64_MAX = 9223372036854775807; + +const int INT8_MIN = -128; + +const int INT16_MIN = -32768; + +const int INT32_MIN = -2147483648; + +const int INT64_MIN = -9223372036854775808; + +const int UINT8_MAX = 255; + +const int UINT16_MAX = 65535; + +const int UINT32_MAX = 4294967295; + +const int UINT64_MAX = -1; + +const int INT_LEAST8_MIN = -128; + +const int INT_LEAST16_MIN = -32768; + +const int INT_LEAST32_MIN = -2147483648; + +const int INT_LEAST64_MIN = -9223372036854775808; + +const int INT_LEAST8_MAX = 127; + +const int INT_LEAST16_MAX = 32767; + +const int INT_LEAST32_MAX = 2147483647; + +const int INT_LEAST64_MAX = 9223372036854775807; + +const int UINT_LEAST8_MAX = 255; + +const int UINT_LEAST16_MAX = 65535; + +const int UINT_LEAST32_MAX = 4294967295; + +const int UINT_LEAST64_MAX = -1; + +const int INT_FAST8_MIN = -128; + +const int INT_FAST16_MIN = -32768; + +const int INT_FAST32_MIN = -2147483648; + +const int INT_FAST64_MIN = -9223372036854775808; + +const int INT_FAST8_MAX = 127; + +const int INT_FAST16_MAX = 32767; + +const int INT_FAST32_MAX = 2147483647; + +const int INT_FAST64_MAX = 9223372036854775807; + +const int UINT_FAST8_MAX = 255; + +const int UINT_FAST16_MAX = 65535; + +const int UINT_FAST32_MAX = 4294967295; + +const int UINT_FAST64_MAX = -1; + +const int INTPTR_MAX = 9223372036854775807; + +const int INTPTR_MIN = -9223372036854775808; + +const int UINTPTR_MAX = -1; + +const int INTMAX_MAX = 9223372036854775807; + +const int UINTMAX_MAX = -1; + +const int INTMAX_MIN = -9223372036854775808; + +const int PTRDIFF_MIN = -9223372036854775808; + +const int PTRDIFF_MAX = 9223372036854775807; + +const int SIZE_MAX = -1; + +const int RSIZE_MAX = 9223372036854775807; + +const int WCHAR_MAX = 2147483647; + +const int WCHAR_MIN = -2147483648; + +const int WINT_MIN = -2147483648; + +const int WINT_MAX = 2147483647; + +const int SIG_ATOMIC_MIN = -2147483648; + +const int SIG_ATOMIC_MAX = 2147483647; + +const int __API_TO_BE_DEPRECATED = 100000; + +const int __API_TO_BE_DEPRECATED_MACOS = 100000; + +const int __API_TO_BE_DEPRECATED_MACOSAPPLICATIONEXTENSION = 100000; + +const int __API_TO_BE_DEPRECATED_IOS = 100000; + +const int __API_TO_BE_DEPRECATED_IOSAPPLICATIONEXTENSION = 100000; + +const int __API_TO_BE_DEPRECATED_MACCATALYST = 100000; + +const int __API_TO_BE_DEPRECATED_MACCATALYSTAPPLICATIONEXTENSION = 100000; + +const int __API_TO_BE_DEPRECATED_WATCHOS = 100000; + +const int __API_TO_BE_DEPRECATED_WATCHOSAPPLICATIONEXTENSION = 100000; + +const int __API_TO_BE_DEPRECATED_TVOS = 100000; + +const int __API_TO_BE_DEPRECATED_TVOSAPPLICATIONEXTENSION = 100000; + +const int __API_TO_BE_DEPRECATED_DRIVERKIT = 100000; + +const int __API_TO_BE_DEPRECATED_VISIONOS = 100000; + +const int __API_TO_BE_DEPRECATED_VISIONOSAPPLICATIONEXTENSION = 100000; + +const int __API_TO_BE_DEPRECATED_KERNELKIT = 100000; + +const int __MAC_10_0 = 1000; + +const int __MAC_10_1 = 1010; + +const int __MAC_10_2 = 1020; + +const int __MAC_10_3 = 1030; + +const int __MAC_10_4 = 1040; + +const int __MAC_10_5 = 1050; + +const int __MAC_10_6 = 1060; + +const int __MAC_10_7 = 1070; + +const int __MAC_10_8 = 1080; + +const int __MAC_10_9 = 1090; + +const int __MAC_10_10 = 101000; + +const int __MAC_10_10_2 = 101002; + +const int __MAC_10_10_3 = 101003; + +const int __MAC_10_11 = 101100; + +const int __MAC_10_11_2 = 101102; + +const int __MAC_10_11_3 = 101103; + +const int __MAC_10_11_4 = 101104; + +const int __MAC_10_12 = 101200; + +const int __MAC_10_12_1 = 101201; + +const int __MAC_10_12_2 = 101202; + +const int __MAC_10_12_4 = 101204; + +const int __MAC_10_13 = 101300; + +const int __MAC_10_13_1 = 101301; + +const int __MAC_10_13_2 = 101302; + +const int __MAC_10_13_4 = 101304; + +const int __MAC_10_14 = 101400; + +const int __MAC_10_14_1 = 101401; + +const int __MAC_10_14_4 = 101404; + +const int __MAC_10_14_5 = 101405; + +const int __MAC_10_14_6 = 101406; + +const int __MAC_10_15 = 101500; + +const int __MAC_10_15_1 = 101501; + +const int __MAC_10_15_4 = 101504; + +const int __MAC_10_16 = 101600; + +const int __MAC_11_0 = 110000; + +const int __MAC_11_1 = 110100; + +const int __MAC_11_3 = 110300; + +const int __MAC_11_4 = 110400; + +const int __MAC_11_5 = 110500; + +const int __MAC_11_6 = 110600; + +const int __MAC_12_0 = 120000; + +const int __MAC_12_1 = 120100; + +const int __MAC_12_2 = 120200; + +const int __MAC_12_3 = 120300; + +const int __MAC_12_4 = 120400; + +const int __MAC_12_5 = 120500; + +const int __MAC_12_6 = 120600; + +const int __MAC_12_7 = 120700; + +const int __MAC_13_0 = 130000; + +const int __MAC_13_1 = 130100; + +const int __MAC_13_2 = 130200; + +const int __MAC_13_3 = 130300; + +const int __MAC_13_4 = 130400; + +const int __MAC_13_5 = 130500; + +const int __MAC_13_6 = 130600; + +const int __MAC_13_7 = 130700; + +const int __MAC_14_0 = 140000; + +const int __MAC_14_1 = 140100; + +const int __MAC_14_2 = 140200; + +const int __MAC_14_3 = 140300; + +const int __MAC_14_4 = 140400; + +const int __MAC_14_5 = 140500; + +const int __MAC_14_6 = 140600; + +const int __MAC_14_7 = 140700; + +const int __MAC_15_0 = 150000; + +const int __MAC_15_1 = 150100; + +const int __MAC_15_2 = 150200; + +const int __MAC_15_3 = 150300; + +const int __MAC_15_4 = 150400; + +const int __MAC_15_5 = 150500; + +const int __MAC_15_6 = 150600; + +const int __MAC_16_0 = 160000; + +const int __MAC_26_0 = 260000; + +const int __MAC_26_1 = 260100; + +const int __MAC_26_2 = 260200; + +const int __MAC_26_3 = 260300; + +const int __MAC_26_4 = 260400; + +const int __IPHONE_2_0 = 20000; + +const int __IPHONE_2_1 = 20100; + +const int __IPHONE_2_2 = 20200; + +const int __IPHONE_3_0 = 30000; + +const int __IPHONE_3_1 = 30100; + +const int __IPHONE_3_2 = 30200; + +const int __IPHONE_4_0 = 40000; + +const int __IPHONE_4_1 = 40100; + +const int __IPHONE_4_2 = 40200; + +const int __IPHONE_4_3 = 40300; + +const int __IPHONE_5_0 = 50000; + +const int __IPHONE_5_1 = 50100; + +const int __IPHONE_6_0 = 60000; + +const int __IPHONE_6_1 = 60100; + +const int __IPHONE_7_0 = 70000; + +const int __IPHONE_7_1 = 70100; + +const int __IPHONE_8_0 = 80000; + +const int __IPHONE_8_1 = 80100; + +const int __IPHONE_8_2 = 80200; + +const int __IPHONE_8_3 = 80300; + +const int __IPHONE_8_4 = 80400; + +const int __IPHONE_9_0 = 90000; + +const int __IPHONE_9_1 = 90100; + +const int __IPHONE_9_2 = 90200; + +const int __IPHONE_9_3 = 90300; + +const int __IPHONE_10_0 = 100000; + +const int __IPHONE_10_1 = 100100; + +const int __IPHONE_10_2 = 100200; + +const int __IPHONE_10_3 = 100300; + +const int __IPHONE_11_0 = 110000; + +const int __IPHONE_11_1 = 110100; + +const int __IPHONE_11_2 = 110200; + +const int __IPHONE_11_3 = 110300; + +const int __IPHONE_11_4 = 110400; + +const int __IPHONE_12_0 = 120000; + +const int __IPHONE_12_1 = 120100; + +const int __IPHONE_12_2 = 120200; + +const int __IPHONE_12_3 = 120300; + +const int __IPHONE_12_4 = 120400; + +const int __IPHONE_13_0 = 130000; + +const int __IPHONE_13_1 = 130100; + +const int __IPHONE_13_2 = 130200; + +const int __IPHONE_13_3 = 130300; + +const int __IPHONE_13_4 = 130400; + +const int __IPHONE_13_5 = 130500; + +const int __IPHONE_13_6 = 130600; + +const int __IPHONE_13_7 = 130700; + +const int __IPHONE_14_0 = 140000; + +const int __IPHONE_14_1 = 140100; + +const int __IPHONE_14_2 = 140200; + +const int __IPHONE_14_3 = 140300; + +const int __IPHONE_14_5 = 140500; + +const int __IPHONE_14_6 = 140600; + +const int __IPHONE_14_7 = 140700; + +const int __IPHONE_14_8 = 140800; + +const int __IPHONE_15_0 = 150000; + +const int __IPHONE_15_1 = 150100; + +const int __IPHONE_15_2 = 150200; + +const int __IPHONE_15_3 = 150300; + +const int __IPHONE_15_4 = 150400; + +const int __IPHONE_15_5 = 150500; + +const int __IPHONE_15_6 = 150600; + +const int __IPHONE_15_7 = 150700; + +const int __IPHONE_15_8 = 150800; + +const int __IPHONE_16_0 = 160000; + +const int __IPHONE_16_1 = 160100; + +const int __IPHONE_16_2 = 160200; + +const int __IPHONE_16_3 = 160300; + +const int __IPHONE_16_4 = 160400; + +const int __IPHONE_16_5 = 160500; + +const int __IPHONE_16_6 = 160600; + +const int __IPHONE_16_7 = 160700; + +const int __IPHONE_17_0 = 170000; + +const int __IPHONE_17_1 = 170100; + +const int __IPHONE_17_2 = 170200; + +const int __IPHONE_17_3 = 170300; + +const int __IPHONE_17_4 = 170400; + +const int __IPHONE_17_5 = 170500; + +const int __IPHONE_17_6 = 170600; + +const int __IPHONE_17_7 = 170700; + +const int __IPHONE_18_0 = 180000; + +const int __IPHONE_18_1 = 180100; + +const int __IPHONE_18_2 = 180200; + +const int __IPHONE_18_3 = 180300; + +const int __IPHONE_18_4 = 180400; + +const int __IPHONE_18_5 = 180500; + +const int __IPHONE_18_6 = 180600; + +const int __IPHONE_19_0 = 190000; + +const int __IPHONE_26_0 = 260000; + +const int __IPHONE_26_1 = 260100; + +const int __IPHONE_26_2 = 260200; + +const int __IPHONE_26_3 = 260300; + +const int __IPHONE_26_4 = 260400; + +const int __WATCHOS_1_0 = 10000; + +const int __WATCHOS_2_0 = 20000; + +const int __WATCHOS_2_1 = 20100; + +const int __WATCHOS_2_2 = 20200; + +const int __WATCHOS_3_0 = 30000; + +const int __WATCHOS_3_1 = 30100; + +const int __WATCHOS_3_1_1 = 30101; + +const int __WATCHOS_3_2 = 30200; + +const int __WATCHOS_4_0 = 40000; + +const int __WATCHOS_4_1 = 40100; + +const int __WATCHOS_4_2 = 40200; + +const int __WATCHOS_4_3 = 40300; + +const int __WATCHOS_5_0 = 50000; + +const int __WATCHOS_5_1 = 50100; + +const int __WATCHOS_5_2 = 50200; + +const int __WATCHOS_5_3 = 50300; + +const int __WATCHOS_6_0 = 60000; + +const int __WATCHOS_6_1 = 60100; + +const int __WATCHOS_6_2 = 60200; + +const int __WATCHOS_7_0 = 70000; + +const int __WATCHOS_7_1 = 70100; + +const int __WATCHOS_7_2 = 70200; + +const int __WATCHOS_7_3 = 70300; + +const int __WATCHOS_7_4 = 70400; + +const int __WATCHOS_7_5 = 70500; + +const int __WATCHOS_7_6 = 70600; + +const int __WATCHOS_8_0 = 80000; + +const int __WATCHOS_8_1 = 80100; + +const int __WATCHOS_8_3 = 80300; + +const int __WATCHOS_8_4 = 80400; + +const int __WATCHOS_8_5 = 80500; + +const int __WATCHOS_8_6 = 80600; + +const int __WATCHOS_8_7 = 80700; + +const int __WATCHOS_8_8 = 80800; + +const int __WATCHOS_9_0 = 90000; + +const int __WATCHOS_9_1 = 90100; + +const int __WATCHOS_9_2 = 90200; + +const int __WATCHOS_9_3 = 90300; + +const int __WATCHOS_9_4 = 90400; + +const int __WATCHOS_9_5 = 90500; + +const int __WATCHOS_9_6 = 90600; + +const int __WATCHOS_10_0 = 100000; + +const int __WATCHOS_10_1 = 100100; + +const int __WATCHOS_10_2 = 100200; + +const int __WATCHOS_10_3 = 100300; + +const int __WATCHOS_10_4 = 100400; + +const int __WATCHOS_10_5 = 100500; + +const int __WATCHOS_10_6 = 100600; + +const int __WATCHOS_10_7 = 100700; + +const int __WATCHOS_11_0 = 110000; + +const int __WATCHOS_11_1 = 110100; + +const int __WATCHOS_11_2 = 110200; + +const int __WATCHOS_11_3 = 110300; + +const int __WATCHOS_11_4 = 110400; + +const int __WATCHOS_11_5 = 110500; + +const int __WATCHOS_11_6 = 110600; + +const int __WATCHOS_12_0 = 120000; + +const int __WATCHOS_26_0 = 260000; + +const int __WATCHOS_26_1 = 260100; + +const int __WATCHOS_26_2 = 260200; + +const int __WATCHOS_26_3 = 260300; + +const int __WATCHOS_26_4 = 260400; + +const int __TVOS_9_0 = 90000; + +const int __TVOS_9_1 = 90100; + +const int __TVOS_9_2 = 90200; + +const int __TVOS_10_0 = 100000; + +const int __TVOS_10_0_1 = 100001; + +const int __TVOS_10_1 = 100100; + +const int __TVOS_10_2 = 100200; + +const int __TVOS_11_0 = 110000; + +const int __TVOS_11_1 = 110100; + +const int __TVOS_11_2 = 110200; + +const int __TVOS_11_3 = 110300; + +const int __TVOS_11_4 = 110400; + +const int __TVOS_12_0 = 120000; + +const int __TVOS_12_1 = 120100; + +const int __TVOS_12_2 = 120200; + +const int __TVOS_12_3 = 120300; + +const int __TVOS_12_4 = 120400; + +const int __TVOS_13_0 = 130000; + +const int __TVOS_13_2 = 130200; + +const int __TVOS_13_3 = 130300; + +const int __TVOS_13_4 = 130400; + +const int __TVOS_14_0 = 140000; + +const int __TVOS_14_1 = 140100; + +const int __TVOS_14_2 = 140200; + +const int __TVOS_14_3 = 140300; + +const int __TVOS_14_5 = 140500; + +const int __TVOS_14_6 = 140600; + +const int __TVOS_14_7 = 140700; + +const int __TVOS_15_0 = 150000; + +const int __TVOS_15_1 = 150100; + +const int __TVOS_15_2 = 150200; + +const int __TVOS_15_3 = 150300; + +const int __TVOS_15_4 = 150400; + +const int __TVOS_15_5 = 150500; + +const int __TVOS_15_6 = 150600; + +const int __TVOS_16_0 = 160000; + +const int __TVOS_16_1 = 160100; + +const int __TVOS_16_2 = 160200; + +const int __TVOS_16_3 = 160300; + +const int __TVOS_16_4 = 160400; + +const int __TVOS_16_5 = 160500; + +const int __TVOS_16_6 = 160600; + +const int __TVOS_17_0 = 170000; + +const int __TVOS_17_1 = 170100; + +const int __TVOS_17_2 = 170200; + +const int __TVOS_17_3 = 170300; + +const int __TVOS_17_4 = 170400; + +const int __TVOS_17_5 = 170500; + +const int __TVOS_17_6 = 170600; + +const int __TVOS_18_0 = 180000; + +const int __TVOS_18_1 = 180100; + +const int __TVOS_18_2 = 180200; + +const int __TVOS_18_3 = 180300; + +const int __TVOS_18_4 = 180400; + +const int __TVOS_18_5 = 180500; + +const int __TVOS_18_6 = 180600; + +const int __TVOS_19_0 = 190000; + +const int __TVOS_26_0 = 260000; + +const int __TVOS_26_1 = 260100; + +const int __TVOS_26_2 = 260200; + +const int __TVOS_26_3 = 260300; + +const int __TVOS_26_4 = 260400; + +const int __BRIDGEOS_2_0 = 20000; + +const int __BRIDGEOS_3_0 = 30000; + +const int __BRIDGEOS_3_1 = 30100; + +const int __BRIDGEOS_3_4 = 30400; + +const int __BRIDGEOS_4_0 = 40000; + +const int __BRIDGEOS_4_1 = 40100; + +const int __BRIDGEOS_5_0 = 50000; + +const int __BRIDGEOS_5_1 = 50100; + +const int __BRIDGEOS_5_3 = 50300; + +const int __BRIDGEOS_6_0 = 60000; + +const int __BRIDGEOS_6_2 = 60200; + +const int __BRIDGEOS_6_4 = 60400; + +const int __BRIDGEOS_6_5 = 60500; + +const int __BRIDGEOS_6_6 = 60600; + +const int __BRIDGEOS_7_0 = 70000; + +const int __BRIDGEOS_7_1 = 70100; + +const int __BRIDGEOS_7_2 = 70200; + +const int __BRIDGEOS_7_3 = 70300; + +const int __BRIDGEOS_7_4 = 70400; + +const int __BRIDGEOS_7_6 = 70600; + +const int __BRIDGEOS_8_0 = 80000; + +const int __BRIDGEOS_8_1 = 80100; + +const int __BRIDGEOS_8_2 = 80200; + +const int __BRIDGEOS_8_3 = 80300; + +const int __BRIDGEOS_8_4 = 80400; + +const int __BRIDGEOS_8_5 = 80500; + +const int __BRIDGEOS_8_6 = 80600; + +const int __BRIDGEOS_9_0 = 90000; + +const int __BRIDGEOS_9_1 = 90100; + +const int __BRIDGEOS_9_2 = 90200; + +const int __BRIDGEOS_9_3 = 90300; + +const int __BRIDGEOS_9_4 = 90400; + +const int __BRIDGEOS_9_5 = 90500; + +const int __BRIDGEOS_9_6 = 90600; + +const int __BRIDGEOS_10_0 = 100000; + +const int __BRIDGEOS_10_1 = 100100; + +const int __BRIDGEOS_10_2 = 100200; + +const int __BRIDGEOS_10_3 = 100300; + +const int __BRIDGEOS_10_4 = 100400; + +const int __DRIVERKIT_19_0 = 190000; + +const int __DRIVERKIT_20_0 = 200000; + +const int __DRIVERKIT_21_0 = 210000; + +const int __DRIVERKIT_22_0 = 220000; + +const int __DRIVERKIT_22_4 = 220400; + +const int __DRIVERKIT_22_5 = 220500; + +const int __DRIVERKIT_22_6 = 220600; + +const int __DRIVERKIT_23_0 = 230000; + +const int __DRIVERKIT_23_1 = 230100; + +const int __DRIVERKIT_23_2 = 230200; + +const int __DRIVERKIT_23_3 = 230300; + +const int __DRIVERKIT_23_4 = 230400; + +const int __DRIVERKIT_23_5 = 230500; + +const int __DRIVERKIT_23_6 = 230600; + +const int __DRIVERKIT_24_0 = 240000; + +const int __DRIVERKIT_24_1 = 240100; + +const int __DRIVERKIT_24_2 = 240200; + +const int __DRIVERKIT_24_3 = 240300; + +const int __DRIVERKIT_24_4 = 240400; + +const int __DRIVERKIT_24_5 = 240500; + +const int __DRIVERKIT_24_6 = 240600; + +const int __DRIVERKIT_25_0 = 250000; + +const int __DRIVERKIT_25_1 = 250100; + +const int __DRIVERKIT_25_2 = 250200; + +const int __DRIVERKIT_25_3 = 250300; + +const int __DRIVERKIT_25_4 = 250400; + +const int __VISIONOS_1_0 = 10000; + +const int __VISIONOS_1_1 = 10100; + +const int __VISIONOS_1_2 = 10200; + +const int __VISIONOS_1_3 = 10300; + +const int __VISIONOS_2_0 = 20000; + +const int __VISIONOS_2_1 = 20100; + +const int __VISIONOS_2_2 = 20200; + +const int __VISIONOS_2_3 = 20300; + +const int __VISIONOS_2_4 = 20400; + +const int __VISIONOS_2_5 = 20500; + +const int __VISIONOS_2_6 = 20600; + +const int __VISIONOS_3_0 = 30000; + +const int __VISIONOS_26_0 = 260000; + +const int __VISIONOS_26_1 = 260100; + +const int __VISIONOS_26_2 = 260200; + +const int __VISIONOS_26_3 = 260300; + +const int __VISIONOS_26_4 = 260400; + +const int MAC_OS_X_VERSION_10_0 = 1000; + +const int MAC_OS_X_VERSION_10_1 = 1010; + +const int MAC_OS_X_VERSION_10_2 = 1020; + +const int MAC_OS_X_VERSION_10_3 = 1030; + +const int MAC_OS_X_VERSION_10_4 = 1040; + +const int MAC_OS_X_VERSION_10_5 = 1050; + +const int MAC_OS_X_VERSION_10_6 = 1060; + +const int MAC_OS_X_VERSION_10_7 = 1070; + +const int MAC_OS_X_VERSION_10_8 = 1080; + +const int MAC_OS_X_VERSION_10_9 = 1090; + +const int MAC_OS_X_VERSION_10_10 = 101000; + +const int MAC_OS_X_VERSION_10_10_2 = 101002; + +const int MAC_OS_X_VERSION_10_10_3 = 101003; + +const int MAC_OS_X_VERSION_10_11 = 101100; + +const int MAC_OS_X_VERSION_10_11_2 = 101102; + +const int MAC_OS_X_VERSION_10_11_3 = 101103; + +const int MAC_OS_X_VERSION_10_11_4 = 101104; + +const int MAC_OS_X_VERSION_10_12 = 101200; + +const int MAC_OS_X_VERSION_10_12_1 = 101201; + +const int MAC_OS_X_VERSION_10_12_2 = 101202; + +const int MAC_OS_X_VERSION_10_12_4 = 101204; + +const int MAC_OS_X_VERSION_10_13 = 101300; + +const int MAC_OS_X_VERSION_10_13_1 = 101301; + +const int MAC_OS_X_VERSION_10_13_2 = 101302; + +const int MAC_OS_X_VERSION_10_13_4 = 101304; + +const int MAC_OS_X_VERSION_10_14 = 101400; + +const int MAC_OS_X_VERSION_10_14_1 = 101401; + +const int MAC_OS_X_VERSION_10_14_4 = 101404; + +const int MAC_OS_X_VERSION_10_14_5 = 101405; + +const int MAC_OS_X_VERSION_10_14_6 = 101406; + +const int MAC_OS_X_VERSION_10_15 = 101500; + +const int MAC_OS_X_VERSION_10_15_1 = 101501; + +const int MAC_OS_X_VERSION_10_15_4 = 101504; + +const int MAC_OS_X_VERSION_10_16 = 101600; + +const int MAC_OS_VERSION_11_0 = 110000; + +const int MAC_OS_VERSION_11_1 = 110100; + +const int MAC_OS_VERSION_11_3 = 110300; + +const int MAC_OS_VERSION_11_4 = 110400; + +const int MAC_OS_VERSION_11_5 = 110500; + +const int MAC_OS_VERSION_11_6 = 110600; + +const int MAC_OS_VERSION_12_0 = 120000; + +const int MAC_OS_VERSION_12_1 = 120100; + +const int MAC_OS_VERSION_12_2 = 120200; + +const int MAC_OS_VERSION_12_3 = 120300; + +const int MAC_OS_VERSION_12_4 = 120400; + +const int MAC_OS_VERSION_12_5 = 120500; + +const int MAC_OS_VERSION_12_6 = 120600; + +const int MAC_OS_VERSION_12_7 = 120700; + +const int MAC_OS_VERSION_13_0 = 130000; + +const int MAC_OS_VERSION_13_1 = 130100; + +const int MAC_OS_VERSION_13_2 = 130200; + +const int MAC_OS_VERSION_13_3 = 130300; + +const int MAC_OS_VERSION_13_4 = 130400; + +const int MAC_OS_VERSION_13_5 = 130500; + +const int MAC_OS_VERSION_13_6 = 130600; + +const int MAC_OS_VERSION_13_7 = 130700; + +const int MAC_OS_VERSION_14_0 = 140000; + +const int MAC_OS_VERSION_14_1 = 140100; + +const int MAC_OS_VERSION_14_2 = 140200; + +const int MAC_OS_VERSION_14_3 = 140300; + +const int MAC_OS_VERSION_14_4 = 140400; + +const int MAC_OS_VERSION_14_5 = 140500; + +const int MAC_OS_VERSION_14_6 = 140600; + +const int MAC_OS_VERSION_14_7 = 140700; + +const int MAC_OS_VERSION_15_0 = 150000; + +const int MAC_OS_VERSION_15_1 = 150100; + +const int MAC_OS_VERSION_15_2 = 150200; + +const int MAC_OS_VERSION_15_3 = 150300; + +const int MAC_OS_VERSION_15_4 = 150400; + +const int MAC_OS_VERSION_15_5 = 150500; + +const int MAC_OS_VERSION_15_6 = 150600; + +const int MAC_OS_VERSION_16_0 = 160000; + +const int MAC_OS_VERSION_26_0 = 260000; + +const int MAC_OS_VERSION_26_1 = 260100; + +const int MAC_OS_VERSION_26_2 = 260200; + +const int MAC_OS_VERSION_26_3 = 260300; + +const int MAC_OS_VERSION_26_4 = 260400; + +const int __AVAILABILITY_VERSIONS_VERSION_HASH = 93585900; + +const String __AVAILABILITY_VERSIONS_VERSION_STRING = 'Local'; + +const String __AVAILABILITY_FILE = 'AvailabilityVersions.h'; + +const int __MAC_OS_X_VERSION_MIN_REQUIRED = 260000; + +const int __MAC_OS_X_VERSION_MAX_ALLOWED = 260400; + +const int __ENABLE_LEGACY_MAC_AVAILABILITY = 1; + +const int __DARWIN_WCHAR_MAX = 2147483647; + +const int __DARWIN_WCHAR_MIN = -2147483648; + +const int __DARWIN_WEOF = -1; + +const int _FORTIFY_SOURCE = 2; + +const int __DARWIN_NSIG = 32; + +const int NSIG = 32; + +const int _ARM_SIGNAL_ = 1; + +const int SIGHUP = 1; + +const int SIGINT = 2; + +const int SIGQUIT = 3; + +const int SIGILL = 4; + +const int SIGTRAP = 5; + +const int SIGABRT = 6; + +const int SIGIOT = 6; + +const int SIGEMT = 7; + +const int SIGFPE = 8; + +const int SIGKILL = 9; + +const int SIGBUS = 10; + +const int SIGSEGV = 11; + +const int SIGSYS = 12; + +const int SIGPIPE = 13; + +const int SIGALRM = 14; + +const int SIGTERM = 15; + +const int SIGURG = 16; + +const int SIGSTOP = 17; + +const int SIGTSTP = 18; + +const int SIGCONT = 19; + +const int SIGCHLD = 20; + +const int SIGTTIN = 21; + +const int SIGTTOU = 22; + +const int SIGIO = 23; + +const int SIGXCPU = 24; + +const int SIGXFSZ = 25; + +const int SIGVTALRM = 26; + +const int SIGPROF = 27; + +const int SIGWINCH = 28; + +const int SIGINFO = 29; + +const int SIGUSR1 = 30; + +const int SIGUSR2 = 31; + +const int USER_ADDR_NULL = 0; + +const int __DARWIN_OPAQUE_ARM_THREAD_STATE64 = 0; + +const int SIGEV_NONE = 0; + +const int SIGEV_SIGNAL = 1; + +const int SIGEV_THREAD = 3; + +const int SIGEV_KEVENT = 4; + +const int ILL_NOOP = 0; + +const int ILL_ILLOPC = 1; + +const int ILL_ILLTRP = 2; + +const int ILL_PRVOPC = 3; + +const int ILL_ILLOPN = 4; + +const int ILL_ILLADR = 5; + +const int ILL_PRVREG = 6; + +const int ILL_COPROC = 7; + +const int ILL_BADSTK = 8; + +const int FPE_NOOP = 0; + +const int FPE_FLTDIV = 1; + +const int FPE_FLTOVF = 2; + +const int FPE_FLTUND = 3; + +const int FPE_FLTRES = 4; + +const int FPE_FLTINV = 5; + +const int FPE_FLTSUB = 6; + +const int FPE_INTDIV = 7; + +const int FPE_INTOVF = 8; + +const int SEGV_NOOP = 0; + +const int SEGV_MAPERR = 1; + +const int SEGV_ACCERR = 2; + +const int BUS_NOOP = 0; + +const int BUS_ADRALN = 1; + +const int BUS_ADRERR = 2; + +const int BUS_OBJERR = 3; + +const int TRAP_BRKPT = 1; + +const int TRAP_TRACE = 2; + +const int CLD_NOOP = 0; + +const int CLD_EXITED = 1; + +const int CLD_KILLED = 2; + +const int CLD_DUMPED = 3; + +const int CLD_TRAPPED = 4; + +const int CLD_STOPPED = 5; + +const int CLD_CONTINUED = 6; + +const int POLL_IN = 1; + +const int POLL_OUT = 2; + +const int POLL_MSG = 3; + +const int POLL_ERR = 4; + +const int POLL_PRI = 5; + +const int POLL_HUP = 6; + +const int SA_ONSTACK = 1; + +const int SA_RESTART = 2; + +const int SA_RESETHAND = 4; + +const int SA_NOCLDSTOP = 8; + +const int SA_NODEFER = 16; + +const int SA_NOCLDWAIT = 32; + +const int SA_SIGINFO = 64; + +const int SA_USERTRAMP = 256; + +const int SA_64REGSET = 512; + +const int SA_USERSPACE_MASK = 127; + +const int SIG_BLOCK = 1; + +const int SIG_UNBLOCK = 2; + +const int SIG_SETMASK = 3; + +const int SI_USER = 65537; + +const int SI_QUEUE = 65538; + +const int SI_TIMER = 65539; + +const int SI_ASYNCIO = 65540; + +const int SI_MESGQ = 65541; + +const int SS_ONSTACK = 1; + +const int SS_DISABLE = 4; + +const int MINSIGSTKSZ = 32768; + +const int SIGSTKSZ = 131072; + +const int SV_ONSTACK = 1; + +const int SV_INTERRUPT = 2; + +const int SV_RESETHAND = 4; + +const int SV_NODEFER = 16; + +const int SV_NOCLDSTOP = 8; + +const int SV_SIGINFO = 64; + +const int PRIO_PROCESS = 0; + +const int PRIO_PGRP = 1; + +const int PRIO_USER = 2; + +const int PRIO_DARWIN_THREAD = 3; + +const int PRIO_DARWIN_PROCESS = 4; + +const int PRIO_MIN = -20; + +const int PRIO_MAX = 20; + +const int PRIO_DARWIN_BG = 4096; + +const int PRIO_DARWIN_NONUI = 4097; + +const int RUSAGE_SELF = 0; + +const int RUSAGE_CHILDREN = -1; + +const int RUSAGE_INFO_V0 = 0; + +const int RUSAGE_INFO_V1 = 1; + +const int RUSAGE_INFO_V2 = 2; + +const int RUSAGE_INFO_V3 = 3; + +const int RUSAGE_INFO_V4 = 4; + +const int RUSAGE_INFO_V5 = 5; + +const int RUSAGE_INFO_V6 = 6; + +const int RUSAGE_INFO_CURRENT = 6; + +const int RU_PROC_RUNS_RESLIDE = 1; + +const int RLIM_INFINITY = 9223372036854775807; + +const int RLIM_SAVED_MAX = 9223372036854775807; + +const int RLIM_SAVED_CUR = 9223372036854775807; + +const int RLIMIT_CPU = 0; + +const int RLIMIT_FSIZE = 1; + +const int RLIMIT_DATA = 2; + +const int RLIMIT_STACK = 3; + +const int RLIMIT_CORE = 4; + +const int RLIMIT_AS = 5; + +const int RLIMIT_RSS = 5; + +const int RLIMIT_MEMLOCK = 6; + +const int RLIMIT_NPROC = 7; + +const int RLIMIT_NOFILE = 8; + +const int RLIM_NLIMITS = 9; + +const int _RLIMIT_POSIX_FLAG = 4096; + +const int RLIMIT_WAKEUPS_MONITOR = 1; + +const int RLIMIT_CPU_USAGE_MONITOR = 2; + +const int RLIMIT_THREAD_CPULIMITS = 3; + +const int RLIMIT_FOOTPRINT_INTERVAL = 4; + +const int WAKEMON_ENABLE = 1; + +const int WAKEMON_DISABLE = 2; + +const int WAKEMON_GET_PARAMS = 4; + +const int WAKEMON_SET_DEFAULTS = 8; + +const int WAKEMON_MAKE_FATAL = 16; + +const int CPUMON_MAKE_FATAL = 4096; + +const int FOOTPRINT_INTERVAL_RESET = 1; + +const int IOPOL_TYPE_DISK = 0; + +const int IOPOL_TYPE_VFS_ATIME_UPDATES = 2; + +const int IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = 3; + +const int IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = 4; + +const int IOPOL_TYPE_VFS_TRIGGER_RESOLVE = 5; + +const int IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = 6; + +const int IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = 7; + +const int IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = 8; + +const int IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = 9; + +const int IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = 10; + +const int IOPOL_TYPE_VFS_ENTITLED_RESERVE_ACCESS = 14; + +const int IOPOL_SCOPE_PROCESS = 0; + +const int IOPOL_SCOPE_THREAD = 1; + +const int IOPOL_SCOPE_DARWIN_BG = 2; + +const int IOPOL_DEFAULT = 0; + +const int IOPOL_IMPORTANT = 1; + +const int IOPOL_PASSIVE = 2; + +const int IOPOL_THROTTLE = 3; + +const int IOPOL_UTILITY = 4; + +const int IOPOL_STANDARD = 5; + +const int IOPOL_APPLICATION = 5; + +const int IOPOL_NORMAL = 1; + +const int IOPOL_ATIME_UPDATES_DEFAULT = 0; + +const int IOPOL_ATIME_UPDATES_OFF = 1; + +const int IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = 0; + +const int IOPOL_MATERIALIZE_DATALESS_FILES_OFF = 1; + +const int IOPOL_MATERIALIZE_DATALESS_FILES_ON = 2; + +const int IOPOL_MATERIALIZE_DATALESS_FILES_ORIG = 4; + +const int IOPOL_MATERIALIZE_DATALESS_FILES_BASIC_MASK = 3; + +const int IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = 0; + +const int IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = 1; + +const int IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = 0; + +const int IOPOL_VFS_TRIGGER_RESOLVE_OFF = 1; + +const int IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = 0; + +const int IOPOL_VFS_CONTENT_PROTECTION_IGNORE = 1; + +const int IOPOL_VFS_IGNORE_PERMISSIONS_OFF = 0; + +const int IOPOL_VFS_IGNORE_PERMISSIONS_ON = 1; + +const int IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = 0; + +const int IOPOL_VFS_SKIP_MTIME_UPDATE_ON = 1; + +const int IOPOL_VFS_SKIP_MTIME_UPDATE_IGNORE = 2; + +const int IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = 0; + +const int IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = 1; + +const int IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = 0; + +const int IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = 1; + +const int IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = 0; + +const int IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = 1; + +const int IOPOL_VFS_ENTITLED_RESERVE_ACCESS_OFF = 0; + +const int IOPOL_VFS_ENTITLED_RESERVE_ACCESS_ON = 1; + +const int WNOHANG = 1; + +const int WUNTRACED = 2; + +const int WCOREFLAG = 128; + +const int _WSTOPPED = 127; + +const int WEXITED = 4; + +const int WSTOPPED = 8; + +const int WCONTINUED = 16; + +const int WNOWAIT = 32; + +const int WAIT_ANY = -1; + +const int WAIT_MYPGRP = 0; + +const int _QUAD_HIGHWORD = 1; + +const int _QUAD_LOWWORD = 0; + +const int __DARWIN_LITTLE_ENDIAN = 1234; + +const int __DARWIN_BIG_ENDIAN = 4321; + +const int __DARWIN_PDP_ENDIAN = 3412; + +const int LITTLE_ENDIAN = 1234; + +const int BIG_ENDIAN = 4321; + +const int PDP_ENDIAN = 3412; + +const int __DARWIN_BYTE_ORDER = 1234; + +const int BYTE_ORDER = 1234; + +const int NULL = 0; + +const int EXIT_FAILURE = 1; + +const int EXIT_SUCCESS = 0; + +const int RAND_MAX = 2147483647; + +const int _MALLOC_TYPE_MALLOC_BACKDEPLOY_PUBLIC = 1; diff --git a/shorebird_code_push/test/integration/helpers/build.dart b/shorebird_code_push/test/integration/helpers/build.dart new file mode 100644 index 0000000..4ee82f0 --- /dev/null +++ b/shorebird_code_push/test/integration/helpers/build.dart @@ -0,0 +1,48 @@ +import 'dart:io'; + +/// Builds `library_test_hooks` and returns the absolute path to the +/// resulting cdylib artifact. +/// +/// Throws on any failure (cargo missing, build error, artifact not found). +/// The test entry point catches and translates these into a +/// `markTestSkipped`, so this layer can stay simple. +Future buildTestHooksCdylib() async { + final workspaceRoot = _resolveWorkspaceRoot(); + + final result = await Process.run( + 'cargo', + const ['build', '-p', 'library_test_hooks'], + workingDirectory: workspaceRoot, + ); + + if (result.exitCode != 0) { + throw Exception( + 'cargo build -p library_test_hooks failed (exit ${result.exitCode}):\n' + 'stdout:\n${result.stdout}\n' + 'stderr:\n${result.stderr}', + ); + } + + final artifact = File( + '$workspaceRoot/target/debug/${_artifactName('updater_test_hooks')}', + ); + if (!artifact.existsSync()) { + throw Exception( + 'cargo build succeeded but artifact not found at ${artifact.path}', + ); + } + return artifact.path; +} + +/// Resolves the Cargo workspace root from the test process's cwd. +/// +/// `dart test` runs with cwd = the package root (`shorebird_code_push/`), +/// so the workspace root is one level up. +String _resolveWorkspaceRoot() => Directory.current.parent.path; + +String _artifactName(String libName) { + if (Platform.isMacOS) return 'lib$libName.dylib'; + if (Platform.isLinux) return 'lib$libName.so'; + if (Platform.isWindows) return '$libName.dll'; + throw UnsupportedError('Unsupported platform: ${Platform.operatingSystem}'); +}