oscall 0.0.2

Low-level cross-platform interface to operating system services: files, memory mapping, networking and more, with no libc on Linux
Documentation
//! `process` on WASI: a module can exit, and that is all. There are no
//! process identifiers and no way to start another program.

#[link(wasm_import_module = "wasi_snapshot_preview1")]
unsafe extern "C" {
    fn proc_exit(code: i32) -> !;
}

pub(crate) fn id() -> u32 {
    0
}

pub(crate) fn parent_id() -> u32 {
    0
}

pub(crate) fn exit(code: i32) -> ! {
    // SAFETY: ends the instance; nothing runs afterwards.
    unsafe { proc_exit(code) }
}

pub(crate) fn abort() -> ! {
    core::arch::wasm32::unreachable()
}

pub(crate) use none::*;

/// This part is also the `process` of the other WebAssembly backend.
#[path = "../wasi/process_none.rs"]
mod none;

#[cfg(feature = "alloc")]
pub(crate) use spawn::{Child, spawn};

/// This part is also the `process` of the `unsupported` backend.
#[cfg(feature = "alloc")]
#[path = "../wasi/process_spawn.rs"]
mod spawn;