blob: 40eb41d9d683ed11fe6c2e9d83c4e07ec739634a [file]
// Copyright 2026 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Process and fiber termination (`vx_std::process`).
//!
//! Routes exit strictly through the link-time C-ABI symbol [`__vx_exit`],
//! allowing standalone binaries (`visor_standalone`) to drain unconsumed
//! startup handles and tear down the standalone heap cleanly before invoking
//! `zx_process_exit`, and hosted visor fibers to yield/exit cleanly.
unsafe extern "C" {
/// Terminate the current VX component or guest fiber with exit status `code`.
pub fn __vx_exit(code: i32) -> !;
}
/// Terminate the current VX process or guest fiber with status `code`.
#[curry::verified]
pub fn exit(code: i32) -> ! {
// SAFETY: `__vx_exit` is the runtime-provided termination entrypoint
// accepting an `i32` exit code and never returning.
unsafe { __vx_exit(code) }
}