]> git.proxmox.com Git - rustc.git/blob - library/std/src/os/mod.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / library / std / src / 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
6 pub 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")]
26 pub 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")]
35 pub 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")]
44 pub 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")]
53 pub 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(target_os = "hermit")]
64 #[path = "hermit/mod.rs"]
65 pub mod unix;
66 #[cfg(not(all(
67 doc,
68 any(
69 all(target_arch = "wasm32", not(target_os = "wasi")),
70 all(target_vendor = "fortanix", target_env = "sgx")
71 )
72 )))]
73 #[cfg(all(not(target_os = "hermit"), any(unix, doc)))]
74 pub mod unix;
75
76 // linux
77 #[cfg(not(all(
78 doc,
79 any(
80 all(target_arch = "wasm32", not(target_os = "wasi")),
81 all(target_vendor = "fortanix", target_env = "sgx")
82 )
83 )))]
84 #[cfg(any(target_os = "linux", doc))]
85 pub mod linux;
86
87 // wasi
88 #[cfg(not(all(
89 doc,
90 any(
91 all(target_arch = "wasm32", not(target_os = "wasi")),
92 all(target_vendor = "fortanix", target_env = "sgx")
93 )
94 )))]
95 #[cfg(any(target_os = "wasi", doc))]
96 pub mod wasi;
97
98 // windows
99 #[cfg(not(all(
100 doc,
101 any(
102 all(target_arch = "wasm32", not(target_os = "wasi")),
103 all(target_vendor = "fortanix", target_env = "sgx")
104 )
105 )))]
106 #[cfg(any(windows, doc))]
107 pub mod windows;
108
109 // Others.
110 #[cfg(target_os = "android")]
111 pub mod android;
112 #[cfg(target_os = "dragonfly")]
113 pub mod dragonfly;
114 #[cfg(target_os = "emscripten")]
115 pub mod emscripten;
116 #[cfg(target_os = "espidf")]
117 pub mod espidf;
118 #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
119 pub mod fortanix_sgx;
120 #[cfg(target_os = "freebsd")]
121 pub mod freebsd;
122 #[cfg(target_os = "fuchsia")]
123 pub mod fuchsia;
124 #[cfg(target_os = "haiku")]
125 pub mod haiku;
126 #[cfg(target_os = "horizon")]
127 pub mod horizon;
128 #[cfg(target_os = "illumos")]
129 pub mod illumos;
130 #[cfg(target_os = "ios")]
131 pub mod ios;
132 #[cfg(target_os = "l4re")]
133 pub mod l4re;
134 #[cfg(target_os = "macos")]
135 pub mod macos;
136 #[cfg(target_os = "netbsd")]
137 pub mod netbsd;
138 #[cfg(target_os = "openbsd")]
139 pub mod openbsd;
140 #[cfg(target_os = "redox")]
141 pub mod redox;
142 #[cfg(target_os = "solaris")]
143 pub mod solaris;
144
145 #[cfg(target_os = "solid_asp3")]
146 pub mod solid;
147 #[cfg(target_os = "vxworks")]
148 pub mod vxworks;
149
150 #[cfg(any(unix, target_os = "wasi", doc))]
151 mod fd;