1 //! Platform-dependent platform abstraction.
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.
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`.
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.
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
23 #![allow(missing_debug_implementations)]
30 pub use self::unix::*;
31 } else if #[cfg(windows)] {
33 pub use self::windows::*;
34 } else if #[cfg(target_os = "hermit")] {
36 pub use self::hermit::*;
37 } else if #[cfg(target_os = "wasi")] {
39 pub use self::wasi::*;
40 } else if #[cfg(target_arch = "wasm32")] {
42 pub use self::wasm::*;
43 } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
48 pub use self::unsupported::*;
52 // Import essential modules from platforms used in `std::os` when documenting.
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.
60 all(target_arch = "wasm32", not(target_os = "wasi")),
61 all(target_vendor = "fortanix", target_env = "sgx")
64 if #[cfg(not(windows))] {
65 // On non-Windows platforms (aka linux/osx/etc) pull in a "minimal"
66 // amount of windows goop which ends up compiling
69 #[path = "windows/compat.rs"]
72 #[path = "windows/c.rs"]