Skip to main content

std/os/
mod.rs

1//! OS-specific functionality.
2
3#![stable(feature = "os", since = "1.0.0")]
4#![allow(missing_docs, nonstandard_style, missing_debug_implementations)]
5#![allow(unsafe_op_in_unsafe_fn)]
6
7pub mod raw;
8
9// # Important platforms
10
11// We always want to show documentation for the most important platforms,
12// so these are handled specially here.
13//
14// FIXME: On certain platforms compilation errors (due to empty `libc`),
15// prevent this, so we substitute an unstable empty module.
16#[cfg(doc)]
17cfg_select! {
18    any(
19        all(target_arch = "wasm32", not(target_os = "wasi")),
20        all(target_vendor = "fortanix", target_env = "sgx")
21    ) => {
22        #[unstable(issue = "none", feature = "std_internals")]
23        pub mod darwin {}
24
25        #[unstable(issue = "none", feature = "std_internals")]
26        pub mod unix {}
27
28        #[unstable(issue = "none", feature = "std_internals")]
29        pub mod linux {}
30
31        #[unstable(issue = "none", feature = "std_internals")]
32        pub mod wasi {}
33
34        #[unstable(issue = "none", feature = "std_internals")]
35        pub mod windows {}
36    }
37    _ => {
38        // important platforms
39        pub mod darwin;
40        pub mod linux;
41        pub mod unix;
42        pub mod wasi;
43        pub mod wasip2;
44        pub mod windows;
45    }
46}
47#[cfg(not(doc))] // to prevent double module declarations
48cfg_select! {
49    target_family = "unix" => {
50        pub mod unix;
51        #[cfg(target_vendor = "apple")]
52        pub mod darwin;
53        #[cfg(target_os = "linux")]
54        pub mod linux;
55    }
56    target_family = "wasm" => {
57        #[cfg(any(target_env = "p1", target_env = "p2"))]
58        pub mod wasi;
59        #[cfg(target_env = "p2")]
60        pub mod wasip2;
61    }
62    target_family = "windows" => {
63        pub mod windows;
64    }
65    _ => { /* handled below */ }
66}
67
68// # Special modules
69
70#[cfg(any(
71    unix,
72    target_os = "hermit",
73    target_os = "trusty",
74    target_os = "wasi",
75    target_os = "motor",
76    doc
77))]
78pub mod fd;
79
80#[cfg(any(target_os = "linux", target_os = "android", target_os = "cygwin", doc))]
81mod net;
82
83// # Ordinary platforms
84// `cfg(doc)` not handled specially
85
86#[cfg(target_os = "aix")]
87pub mod aix;
88#[cfg(target_os = "android")]
89pub mod android;
90#[cfg(target_os = "cygwin")]
91pub mod cygwin;
92#[cfg(target_os = "dragonfly")]
93pub mod dragonfly;
94#[cfg(target_os = "emscripten")]
95pub mod emscripten;
96#[cfg(target_os = "espidf")]
97pub mod espidf;
98#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
99pub mod fortanix_sgx;
100#[cfg(target_os = "freebsd")]
101pub mod freebsd;
102#[cfg(target_os = "fuchsia")]
103pub mod fuchsia;
104#[cfg(target_os = "haiku")]
105pub mod haiku;
106#[cfg(target_os = "hermit")]
107pub mod hermit;
108#[cfg(target_os = "horizon")]
109pub mod horizon;
110#[cfg(target_os = "hurd")]
111pub mod hurd;
112#[cfg(target_os = "illumos")]
113pub mod illumos;
114#[cfg(target_os = "ios")]
115pub mod ios;
116#[cfg(target_os = "l4re")]
117pub mod l4re;
118#[cfg(target_os = "macos")]
119pub mod macos;
120#[cfg(target_os = "motor")]
121pub mod motor;
122#[cfg(target_os = "netbsd")]
123pub mod netbsd;
124#[cfg(target_os = "nto")]
125pub mod nto;
126#[cfg(target_os = "nuttx")]
127pub mod nuttx;
128#[cfg(target_os = "openbsd")]
129pub mod openbsd;
130#[cfg(target_os = "redox")]
131pub mod redox;
132#[cfg(target_os = "rtems")]
133pub mod rtems;
134#[cfg(target_os = "solaris")]
135pub mod solaris;
136#[cfg(target_os = "solid_asp3")]
137pub mod solid;
138#[cfg(target_os = "trusty")]
139pub mod trusty;
140#[cfg(target_os = "uefi")]
141pub mod uefi;
142#[cfg(target_os = "vita")]
143pub mod vita;
144#[cfg(target_os = "vxworks")]
145pub mod vxworks;
146#[cfg(target_os = "xous")]
147pub mod xous;