]> git.proxmox.com Git - rustc.git/blame - library/std/src/sys/mod.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / library / std / src / sys / mod.rs
CommitLineData
9fa01778 1//! Platform-dependent platform abstraction.
c30ab7b3
SL
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
8bb4bdeb 6//! just Unix and Windows, and initial support for Redox.
c30ab7b3
SL
7//!
8//! The centralization of platform-specific code in this module is
9//! enforced by the "platform abstraction layer" tidy script in
8bb4bdeb 10//! `tools/tidy/src/pal.rs`.
c30ab7b3
SL
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//!
476ff2be 16//! In the future it would be desirable for the independent
c30ab7b3
SL
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.
22
32a655c1
SL
23#![allow(missing_debug_implementations)]
24
cdc7bbd5
XL
25mod common;
26
dc9dc135 27cfg_if::cfg_if! {
cdc7bbd5 28 if #[cfg(unix)] {
ff7c6d11
XL
29 mod unix;
30 pub use self::unix::*;
31 } else if #[cfg(windows)] {
32 mod windows;
33 pub use self::windows::*;
e74abb32
XL
34 } else if #[cfg(target_os = "hermit")] {
35 mod hermit;
36 pub use self::hermit::*;
48663c56 37 } else if #[cfg(target_os = "wasi")] {
532ac7d7
XL
38 mod wasi;
39 pub use self::wasi::*;
ff7c6d11
XL
40 } else if #[cfg(target_arch = "wasm32")] {
41 mod wasm;
42 pub use self::wasm::*;
0731742a
XL
43 } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
44 mod sgx;
45 pub use self::sgx::*;
ff7c6d11 46 } else {
3dfed10e
XL
47 mod unsupported;
48 pub use self::unsupported::*;
ff7c6d11
XL
49 }
50}
51
17df50a5
XL
52// Import essential modules from platforms used in `std::os` when documenting.
53//
54// Note that on some platforms those modules don't compile
55// (missing things in `libc` which is empty), so they are not included in `std::os` and can be
56// omitted here as well.
ff7c6d11 57
60c5eb7d 58#[cfg(doc)]
17df50a5
XL
59#[cfg(not(any(
60 all(target_arch = "wasm32", not(target_os = "wasi")),
61 all(target_vendor = "fortanix", target_env = "sgx")
62)))]
dc9dc135 63cfg_if::cfg_if! {
17df50a5
XL
64 if #[cfg(not(windows))] {
65 // On non-Windows platforms (aka linux/osx/etc) pull in a "minimal"
ff7c6d11 66 // amount of windows goop which ends up compiling
17df50a5 67
ff7c6d11
XL
68 #[macro_use]
69 #[path = "windows/compat.rs"]
17df50a5 70 pub mod compat;
ff7c6d11
XL
71
72 #[path = "windows/c.rs"]
17df50a5 73 pub mod c;
6a06907d
XL
74 }
75}