]> git.proxmox.com Git - rustc.git/blame - library/std/src/sys/mod.rs
New upstream version 1.68.2+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
2b03887a 25pub mod common;
cdc7bbd5 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::*;
c295e0f8
XL
34 } else if #[cfg(target_os = "solid_asp3")] {
35 mod solid;
36 pub use self::solid::*;
e74abb32
XL
37 } else if #[cfg(target_os = "hermit")] {
38 mod hermit;
39 pub use self::hermit::*;
48663c56 40 } else if #[cfg(target_os = "wasi")] {
532ac7d7
XL
41 mod wasi;
42 pub use self::wasi::*;
3c0e092e 43 } else if #[cfg(target_family = "wasm")] {
ff7c6d11
XL
44 mod wasm;
45 pub use self::wasm::*;
0731742a
XL
46 } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
47 mod sgx;
48 pub use self::sgx::*;
ff7c6d11 49 } else {
3dfed10e
XL
50 mod unsupported;
51 pub use self::unsupported::*;
ff7c6d11
XL
52 }
53}
54
17df50a5
XL
55// Import essential modules from platforms used in `std::os` when documenting.
56//
57// Note that on some platforms those modules don't compile
58// (missing things in `libc` which is empty), so they are not included in `std::os` and can be
59// omitted here as well.
ff7c6d11 60
60c5eb7d 61#[cfg(doc)]
17df50a5
XL
62#[cfg(not(any(
63 all(target_arch = "wasm32", not(target_os = "wasi")),
64 all(target_vendor = "fortanix", target_env = "sgx")
65)))]
dc9dc135 66cfg_if::cfg_if! {
17df50a5
XL
67 if #[cfg(not(windows))] {
68 // On non-Windows platforms (aka linux/osx/etc) pull in a "minimal"
ff7c6d11 69 // amount of windows goop which ends up compiling
17df50a5 70
ff7c6d11
XL
71 #[macro_use]
72 #[path = "windows/compat.rs"]
17df50a5 73 pub mod compat;
ff7c6d11
XL
74
75 #[path = "windows/c.rs"]
17df50a5 76 pub mod c;
6a06907d
XL
77 }
78}