1//! Platform-dependent platform abstraction.
2//!
3//! The `std::sys` module is the abstracted interface through which
4//! `std` talks to the underlying operating system. It has different
5//! implementations for different operating system families, today
6//! just Unix and Windows, and initial support for Redox.
7//!
8//! The centralization of platform-specific code in this module is
9//! enforced by the "platform abstraction layer" tidy script in
10//! `tools/tidy/src/pal.rs`.
11//!
12//! This module is closely related to the platform-independent system
13//! integration code in `std::sys_common`. See that module's
14//! documentation for details.
15//!
16//! In the future it would be desirable for the independent
17//! implementations of this module to be extracted to their own crates
18//! that `std` can link to, thus enabling their implementation
19//! out-of-tree via crate replacement. Though due to the complex
20//! inter-dependencies within `std` that will be a challenging goal to
21//! achieve.
2223#![allow(missing_debug_implementations)]
2425pub mod common;
2627cfg_if::cfg_if! {
28if #[cfg(unix)] {
29mod unix;
30pub use self::unix::*;
31 } else if #[cfg(windows)] {
32mod windows;
33pub use self::windows::*;
34 } else if #[cfg(target_os = "solid_asp3")] {
35mod solid;
36pub use self::solid::*;
37 } else if #[cfg(target_os = "hermit")] {
38mod hermit;
39pub use self::hermit::*;
40 } else if #[cfg(target_os = "trusty")] {
41mod trusty;
42pub use self::trusty::*;
43 } else if #[cfg(all(target_os = "wasi", target_env = "p2"))] {
44mod wasip2;
45pub use self::wasip2::*;
46 } else if #[cfg(target_os = "wasi")] {
47mod wasi;
48pub use self::wasi::*;
49 } else if #[cfg(target_family = "wasm")] {
50mod wasm;
51pub use self::wasm::*;
52 } else if #[cfg(target_os = "xous")] {
53mod xous;
54pub use self::xous::*;
55 } else if #[cfg(target_os = "uefi")] {
56mod uefi;
57pub use self::uefi::*;
58 } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
59mod sgx;
60pub use self::sgx::*;
61 } else if #[cfg(target_os = "teeos")] {
62mod teeos;
63pub use self::teeos::*;
64 } else if #[cfg(target_os = "zkvm")] {
65mod zkvm;
66pub use self::zkvm::*;
67 } else {
68mod unsupported;
69pub use self::unsupported::*;
70 }
71}
7273cfg_if::cfg_if! {
74// Fuchsia components default to full backtrace.
75if #[cfg(target_os = "fuchsia")] {
76pub const FULL_BACKTRACE_DEFAULT: bool = true;
77 } else {
78pub const FULL_BACKTRACE_DEFAULT: bool = false;
79 }
80}
8182#[cfg(not(target_os = "uefi"))]
83pub type RawOsError = i32;