1//! OS-specific functionality.
2
3#![stable(feature = "os", since = "1.0.0")]
4#![allow(missing_docs, nonstandard_style, missing_debug_implementations)]
5
6pub mod raw;
7
8// The code below could be written clearer using `cfg_if!`. However, the items below are
9// publicly exported by `std` and external tools can have trouble analysing them because of the use
10// of a macro that is not vendored by Rust and included in the toolchain.
11// See https://github.com/rust-analyzer/rust-analyzer/issues/6038.
12
13// On certain platforms right now the "main modules" modules that are
14// documented don't compile (missing things in `libc` which is empty),
15// so just omit them with an empty module and add the "unstable" attribute.
16
17// Unix, linux, wasi and windows are handled a bit differently.
18#[cfg(all(
19 doc,
20 any(
21 all(target_arch = "wasm32", not(target_os = "wasi")),
22 all(target_vendor = "fortanix", target_env = "sgx")
23 )
24))]
25#[unstable(issue = "none", feature = "std_internals")]
26pub mod unix {}
27#[cfg(all(
28 doc,
29 any(
30 all(target_arch = "wasm32", not(target_os = "wasi")),
31 all(target_vendor = "fortanix", target_env = "sgx")
32 )
33))]
34#[unstable(issue = "none", feature = "std_internals")]
35pub mod linux {}
36#[cfg(all(
37 doc,
38 any(
39 all(target_arch = "wasm32", not(target_os = "wasi")),
40 all(target_vendor = "fortanix", target_env = "sgx")
41 )
42))]
43#[unstable(issue = "none", feature = "std_internals")]
44pub mod wasi {}
45#[cfg(all(
46 doc,
47 any(
48 all(target_arch = "wasm32", not(target_os = "wasi")),
49 all(target_vendor = "fortanix", target_env = "sgx")
50 )
51))]
52#[unstable(issue = "none", feature = "std_internals")]
53pub mod windows {}
54
55// unix
56#[cfg(not(all(
57 doc,
58 any(
59 all(target_arch = "wasm32", not(target_os = "wasi")),
60 all(target_vendor = "fortanix", target_env = "sgx")
61 )
62)))]
63#[cfg(all(not(target_os = "hermit"), any(unix, doc)))]
64pub mod unix;
65
66// linux
67#[cfg(not(all(
68 doc,
69 any(
70 all(target_arch = "wasm32", not(target_os = "wasi")),
71 all(target_vendor = "fortanix", target_env = "sgx")
72 )
73)))]
74#[cfg(any(target_os = "linux", doc))]
75pub mod linux;
76
77// wasi
78#[cfg(not(all(
79 doc,
80 any(
81 all(target_arch = "wasm32", not(target_os = "wasi")),
82 all(target_vendor = "fortanix", target_env = "sgx")
83 )
84)))]
85#[cfg(any(target_os = "wasi", doc))]
86pub mod wasi;
87
88// windows
89#[cfg(not(all(
90 doc,
91 any(
92 all(target_arch = "wasm32", not(target_os = "wasi")),
93 all(target_vendor = "fortanix", target_env = "sgx")
94 )
95)))]
96#[cfg(any(windows, doc))]
97pub mod windows;
98
99// Others.
100#[cfg(target_os = "aix")]
101pub mod aix;
102#[cfg(target_os = "android")]
103pub mod android;
104#[cfg(target_os = "dragonfly")]
105pub mod dragonfly;
106#[cfg(target_os = "emscripten")]
107pub mod emscripten;
108#[cfg(target_os = "espidf")]
109pub mod espidf;
110#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
111pub mod fortanix_sgx;
112#[cfg(target_os = "freebsd")]
113pub mod freebsd;
114#[cfg(target_os = "fuchsia")]
115pub mod fuchsia;
116#[cfg(target_os = "haiku")]
117pub mod haiku;
118#[cfg(target_os = "hermit")]
119pub mod hermit;
120#[cfg(target_os = "horizon")]
121pub mod horizon;
122#[cfg(target_os = "hurd")]
123pub mod hurd;
124#[cfg(target_os = "illumos")]
125pub mod illumos;
126#[cfg(target_os = "ios")]
127pub mod ios;
128#[cfg(target_os = "l4re")]
129pub mod l4re;
130#[cfg(target_os = "macos")]
131pub mod macos;
132#[cfg(target_os = "netbsd")]
133pub mod netbsd;
134#[cfg(target_os = "nto")]
135pub mod nto;
136#[cfg(target_os = "openbsd")]
137pub mod openbsd;
138#[cfg(target_os = "redox")]
139pub mod redox;
140#[cfg(target_os = "solaris")]
141pub mod solaris;
142#[cfg(target_os = "solid_asp3")]
143pub mod solid;
144#[cfg(target_os = "tvos")]
145#[path = "ios/mod.rs"]
146pub(crate) mod tvos;
147#[cfg(target_os = "uefi")]
148pub mod uefi;
149#[cfg(target_os = "vita")]
150pub mod vita;
151#[cfg(target_os = "vxworks")]
152pub mod vxworks;
153#[cfg(target_os = "watchos")]
154pub(crate) mod watchos;
155#[cfg(target_os = "xous")]
156pub mod xous;
157
158#[cfg(any(unix, target_os = "wasi", doc))]
159pub mod fd;
160
161#[cfg(any(target_os = "linux", target_os = "android", doc))]
162mod net;
163