1#![deny(missing_docs)]
100#![allow(stable_features)]
101#![cfg_attr(linux_raw, deny(unsafe_code))]
102#![cfg_attr(rustc_attrs, feature(rustc_attrs))]
103#![cfg_attr(docsrs, feature(doc_cfg))]
104#![cfg_attr(all(wasi_ext, target_os = "wasi", feature = "std"), feature(wasi_ext))]
105#![cfg_attr(core_ffi_c, feature(core_ffi_c))]
106#![cfg_attr(core_c_str, feature(core_c_str))]
107#![cfg_attr(error_in_core, feature(error_in_core))]
108#![cfg_attr(all(feature = "alloc", alloc_c_string), feature(alloc_c_string))]
109#![cfg_attr(all(feature = "alloc", alloc_ffi), feature(alloc_ffi))]
110#![cfg_attr(not(feature = "std"), no_std)]
111#![cfg_attr(feature = "rustc-dep-of-std", feature(ip))]
112#![cfg_attr(feature = "rustc-dep-of-std", allow(internal_features))]
113#![cfg_attr(
114 any(feature = "rustc-dep-of-std", core_intrinsics),
115 feature(core_intrinsics)
116)]
117#![cfg_attr(asm_experimental_arch, feature(asm_experimental_arch))]
118#![cfg_attr(not(feature = "all-apis"), allow(dead_code))]
119#![allow(clippy::unnecessary_cast)]
121#![allow(clippy::useless_conversion)]
123#![allow(clippy::needless_lifetimes)]
125#![allow(unknown_lints)]
128#![allow(unnecessary_transmutes)]
131#![cfg_attr(
135 any(target_os = "redox", target_os = "wasi", not(feature = "all-apis")),
136 allow(unused_imports)
137)]
138#![cfg_attr(
141 all(
142 target_os = "wasi",
143 target_env = "p2",
144 any(feature = "fs", feature = "mount", feature = "net"),
145 wasip2,
146 ),
147 feature(wasip2)
148)]
149
150#[cfg(all(feature = "alloc", feature = "rustc-dep-of-std"))]
151extern crate rustc_std_workspace_alloc as alloc;
152
153#[cfg(all(feature = "alloc", not(feature = "rustc-dep-of-std")))]
154extern crate alloc;
155
156#[cfg(all(test, static_assertions))]
158#[macro_use]
159#[allow(unused_imports)]
160extern crate static_assertions;
161#[cfg(all(test, not(static_assertions)))]
162#[macro_use]
163#[allow(unused_imports)]
164mod static_assertions;
165
166pub mod buffer;
167#[cfg(not(windows))]
168#[macro_use]
169pub(crate) mod cstr;
170#[macro_use]
171pub(crate) mod utils;
172#[cfg_attr(feature = "std", path = "maybe_polyfill/std/mod.rs")]
174#[cfg_attr(not(feature = "std"), path = "maybe_polyfill/no_std/mod.rs")]
175pub(crate) mod maybe_polyfill;
176#[cfg(test)]
177#[macro_use]
178pub(crate) mod check_types;
179#[macro_use]
180pub(crate) mod bitcast;
181#[cfg(sanitize_memory)]
182pub(crate) mod msan;
183
184#[cfg(any(
190 all(linux_raw, feature = "use-libc-auxv"),
191 all(libc, not(any(windows, target_os = "espidf", target_os = "wasi")))
192))]
193#[macro_use]
194mod weak;
195
196#[cfg_attr(libc, path = "backend/libc/mod.rs")]
198#[cfg_attr(linux_raw, path = "backend/linux_raw/mod.rs")]
199mod backend;
200
201pub mod fd {
215 pub use super::backend::fd::*;
216}
217
218#[cfg(feature = "event")]
220#[cfg_attr(docsrs, doc(cfg(feature = "event")))]
221pub mod event;
222pub mod ffi;
223#[cfg(not(windows))]
224#[cfg(feature = "fs")]
225#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
226pub mod fs;
227pub mod io;
228#[cfg(all(linux_kernel, not(target_os = "android")))]
229#[cfg(feature = "io_uring")]
230#[cfg_attr(docsrs, doc(cfg(feature = "io_uring")))]
231pub mod io_uring;
232pub mod ioctl;
233#[cfg(not(any(
234 windows,
235 target_os = "espidf",
236 target_os = "horizon",
237 target_os = "vita",
238 target_os = "wasi"
239)))]
240#[cfg(feature = "mm")]
241#[cfg_attr(docsrs, doc(cfg(feature = "mm")))]
242pub mod mm;
243#[cfg(linux_kernel)]
244#[cfg(feature = "mount")]
245#[cfg_attr(docsrs, doc(cfg(feature = "mount")))]
246pub mod mount;
247#[cfg(not(target_os = "wasi"))]
248#[cfg(feature = "net")]
249#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
250pub mod net;
251#[cfg(not(any(windows, target_os = "espidf")))]
252#[cfg(feature = "param")]
253#[cfg_attr(docsrs, doc(cfg(feature = "param")))]
254pub mod param;
255#[cfg(not(windows))]
256#[cfg(any(feature = "fs", feature = "mount", feature = "net"))]
257#[cfg_attr(
258 docsrs,
259 doc(cfg(any(feature = "fs", feature = "mount", feature = "net")))
260)]
261pub mod path;
262#[cfg(feature = "pipe")]
263#[cfg_attr(docsrs, doc(cfg(feature = "pipe")))]
264#[cfg(not(any(windows, target_os = "wasi")))]
265pub mod pipe;
266#[cfg(not(windows))]
267#[cfg(feature = "process")]
268#[cfg_attr(docsrs, doc(cfg(feature = "process")))]
269pub mod process;
270#[cfg(not(windows))]
271#[cfg(not(target_os = "wasi"))]
272#[cfg(feature = "pty")]
273#[cfg_attr(docsrs, doc(cfg(feature = "pty")))]
274pub mod pty;
275#[cfg(not(windows))]
276#[cfg(feature = "rand")]
277#[cfg_attr(docsrs, doc(cfg(feature = "rand")))]
278pub mod rand;
279#[cfg(not(any(
280 windows,
281 target_os = "android",
282 target_os = "espidf",
283 target_os = "horizon",
284 target_os = "vita",
285 target_os = "wasi"
286)))]
287#[cfg(feature = "shm")]
288#[cfg_attr(docsrs, doc(cfg(feature = "shm")))]
289pub mod shm;
290#[cfg(not(windows))]
291#[cfg(feature = "stdio")]
292#[cfg_attr(docsrs, doc(cfg(feature = "stdio")))]
293pub mod stdio;
294#[cfg(feature = "system")]
295#[cfg(not(any(windows, target_os = "wasi")))]
296#[cfg_attr(docsrs, doc(cfg(feature = "system")))]
297pub mod system;
298#[cfg(not(any(windows, target_os = "horizon", target_os = "vita")))]
299#[cfg(feature = "termios")]
300#[cfg_attr(docsrs, doc(cfg(feature = "termios")))]
301pub mod termios;
302#[cfg(not(windows))]
303#[cfg(feature = "thread")]
304#[cfg_attr(docsrs, doc(cfg(feature = "thread")))]
305pub mod thread;
306#[cfg(not(any(windows, target_os = "espidf")))]
307#[cfg(feature = "time")]
308#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
309pub mod time;
310
311#[cfg(not(windows))]
313#[cfg(feature = "runtime")]
314#[cfg(linux_raw)]
315#[cfg_attr(not(document_experimental_runtime_api), doc(hidden))]
316#[cfg_attr(docsrs, doc(cfg(feature = "runtime")))]
317pub mod runtime;
318
319#[cfg(not(windows))]
322#[cfg(not(feature = "fs"))]
323#[cfg(all(
324 linux_raw,
325 not(feature = "use-libc-auxv"),
326 not(feature = "use-explicitly-provided-auxv"),
327 any(
328 feature = "param",
329 feature = "runtime",
330 feature = "thread",
331 feature = "time",
332 target_arch = "x86",
333 )
334))]
335#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
336pub(crate) mod fs;
337
338#[cfg(not(windows))]
340#[cfg(not(any(feature = "fs", feature = "mount", feature = "net")))]
341#[cfg(all(
342 linux_raw,
343 not(feature = "use-libc-auxv"),
344 not(feature = "use-explicitly-provided-auxv"),
345 any(
346 feature = "param",
347 feature = "runtime",
348 feature = "thread",
349 feature = "time",
350 target_arch = "x86",
351 )
352))]
353pub(crate) mod path;
354
355#[cfg(not(any(windows, target_os = "espidf")))]
357#[cfg(any(feature = "thread", feature = "time"))]
358mod clockid;
359#[cfg(linux_kernel)]
360#[cfg(any(feature = "io_uring", feature = "runtime"))]
361mod kernel_sigset;
362#[cfg(not(any(windows, target_os = "wasi")))]
363#[cfg(any(
364 feature = "process",
365 feature = "runtime",
366 feature = "termios",
367 feature = "thread",
368 all(bsd, feature = "event"),
369 all(linux_kernel, feature = "net")
370))]
371mod pid;
372#[cfg(any(feature = "process", feature = "thread"))]
373#[cfg(linux_kernel)]
374mod prctl;
375#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))]
376#[cfg(any(
377 feature = "io_uring",
378 feature = "process",
379 feature = "runtime",
380 all(bsd, feature = "event")
381))]
382mod signal;
383#[cfg(any(
384 feature = "fs",
385 feature = "event",
386 feature = "process",
387 feature = "runtime",
388 feature = "thread",
389 feature = "time",
390 all(feature = "event", any(bsd, linux_kernel, windows, target_os = "wasi")),
391 all(
392 linux_raw,
393 not(feature = "use-libc-auxv"),
394 not(feature = "use-explicitly-provided-auxv"),
395 any(
396 feature = "param",
397 feature = "process",
398 feature = "runtime",
399 feature = "time",
400 target_arch = "x86",
401 )
402 )
403))]
404mod timespec;
405#[cfg(not(any(windows, target_os = "wasi")))]
406#[cfg(any(
407 feature = "fs",
408 feature = "process",
409 feature = "thread",
410 all(
411 linux_raw,
412 not(feature = "use-libc-auxv"),
413 not(feature = "use-explicitly-provided-auxv"),
414 any(
415 feature = "param",
416 feature = "runtime",
417 feature = "time",
418 target_arch = "x86",
419 )
420 ),
421 all(linux_kernel, feature = "net")
422))]
423mod ugid;
424
425#[cfg(doc)]
426#[cfg_attr(docsrs, doc(cfg(doc)))]
427pub mod not_implemented;