1#![cfg_attr(all(target_os = "wasi", target_env = "p2"), feature(wasip2))]
4#![deny(missing_docs)]
104#![allow(stable_features)]
105#![cfg_attr(linux_raw, deny(unsafe_code))]
106#![cfg_attr(rustc_attrs, feature(rustc_attrs))]
107#![cfg_attr(docsrs, feature(doc_cfg))]
108#![cfg_attr(all(wasi_ext, target_os = "wasi", feature = "std"), feature(wasi_ext))]
109#![cfg_attr(core_ffi_c, feature(core_ffi_c))]
110#![cfg_attr(core_c_str, feature(core_c_str))]
111#![cfg_attr(all(feature = "alloc", alloc_c_string), feature(alloc_c_string))]
112#![cfg_attr(all(feature = "alloc", alloc_ffi), feature(alloc_ffi))]
113#![cfg_attr(not(feature = "std"), no_std)]
114#![cfg_attr(feature = "rustc-dep-of-std", feature(ip))]
115#![cfg_attr(feature = "rustc-dep-of-std", allow(internal_features))]
116#![cfg_attr(
117 any(feature = "rustc-dep-of-std", core_intrinsics),
118 feature(core_intrinsics)
119)]
120#![cfg_attr(asm_experimental_arch, feature(asm_experimental_arch))]
121#![cfg_attr(not(feature = "all-apis"), allow(dead_code))]
122#![allow(clippy::unnecessary_cast)]
124#![allow(clippy::useless_conversion)]
126#![cfg_attr(
130 any(target_os = "redox", target_os = "wasi", not(feature = "all-apis")),
131 allow(unused_imports)
132)]
133
134#[cfg(all(feature = "rustc-dep-of-std", feature = "alloc"))]
135extern crate rustc_std_workspace_alloc as alloc;
136
137#[cfg(all(feature = "alloc", not(feature = "rustc-dep-of-std")))]
138extern crate alloc;
139
140#[cfg(all(test, static_assertions))]
142#[macro_use]
143#[allow(unused_imports)]
144extern crate static_assertions;
145#[cfg(all(test, not(static_assertions)))]
146#[macro_use]
147#[allow(unused_imports)]
148mod static_assertions;
149
150mod buffer;
152#[cfg(not(windows))]
153#[macro_use]
154pub(crate) mod cstr;
155#[macro_use]
156pub(crate) mod utils;
157#[cfg_attr(feature = "std", path = "maybe_polyfill/std/mod.rs")]
159#[cfg_attr(not(feature = "std"), path = "maybe_polyfill/no_std/mod.rs")]
160pub(crate) mod maybe_polyfill;
161#[cfg(test)]
162#[macro_use]
163pub(crate) mod check_types;
164#[macro_use]
165pub(crate) mod bitcast;
166
167#[cfg(any(
173 all(linux_raw, feature = "use-libc-auxv"),
174 all(libc, not(any(windows, target_os = "espidf", target_os = "wasi")))
175))]
176#[macro_use]
177mod weak;
178
179#[cfg_attr(libc, path = "backend/libc/mod.rs")]
181#[cfg_attr(linux_raw, path = "backend/linux_raw/mod.rs")]
182#[cfg_attr(wasi, path = "backend/wasi/mod.rs")]
183mod backend;
184
185pub mod fd {
190 use super::backend;
191
192 #[cfg(windows)]
196 pub use backend::fd::{AsRawSocket, AsSocket, FromRawSocket, IntoRawSocket};
197
198 pub use backend::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
199}
200
201#[cfg(feature = "event")]
203#[cfg_attr(docsrs, doc(cfg(feature = "event")))]
204pub mod event;
205pub mod ffi;
206#[cfg(not(windows))]
207#[cfg(feature = "fs")]
208#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
209pub mod fs;
210pub mod io;
211#[cfg(linux_kernel)]
212#[cfg(feature = "io_uring")]
213#[cfg_attr(docsrs, doc(cfg(feature = "io_uring")))]
214pub mod io_uring;
215pub mod ioctl;
216#[cfg(not(any(windows, target_os = "espidf", target_os = "vita", target_os = "wasi")))]
217#[cfg(feature = "mm")]
218#[cfg_attr(docsrs, doc(cfg(feature = "mm")))]
219pub mod mm;
220#[cfg(linux_kernel)]
221#[cfg(feature = "mount")]
222#[cfg_attr(docsrs, doc(cfg(feature = "mount")))]
223pub mod mount;
224#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
225#[cfg(feature = "net")]
226#[cfg_attr(docsrs, doc(cfg(feature = "net")))]
227pub mod net;
228#[cfg(not(any(windows, target_os = "espidf")))]
229#[cfg(feature = "param")]
230#[cfg_attr(docsrs, doc(cfg(feature = "param")))]
231pub mod param;
232#[cfg(not(windows))]
233#[cfg(any(feature = "fs", feature = "mount", feature = "net"))]
234#[cfg_attr(
235 docsrs,
236 doc(cfg(any(feature = "fs", feature = "mount", feature = "net")))
237)]
238pub mod path;
239#[cfg(feature = "pipe")]
240#[cfg_attr(docsrs, doc(cfg(feature = "pipe")))]
241#[cfg(not(any(windows, target_os = "wasi")))]
242pub mod pipe;
243#[cfg(not(windows))]
244#[cfg(feature = "process")]
245#[cfg_attr(docsrs, doc(cfg(feature = "process")))]
246pub mod process;
247#[cfg(feature = "procfs")]
248#[cfg(linux_kernel)]
249#[cfg_attr(docsrs, doc(cfg(feature = "procfs")))]
250pub mod procfs;
251#[cfg(not(windows))]
252#[cfg(not(target_os = "wasi"))]
253#[cfg(feature = "pty")]
254#[cfg_attr(docsrs, doc(cfg(feature = "pty")))]
255pub mod pty;
256#[cfg(not(windows))]
257#[cfg(feature = "rand")]
258#[cfg_attr(docsrs, doc(cfg(feature = "rand")))]
259pub mod rand;
260#[cfg(not(any(
261 windows,
262 target_os = "android",
263 target_os = "espidf",
264 target_os = "vita",
265 target_os = "wasi"
266)))]
267#[cfg(feature = "shm")]
268#[cfg_attr(docsrs, doc(cfg(feature = "shm")))]
269pub mod shm;
270#[cfg(not(windows))]
271#[cfg(feature = "stdio")]
272#[cfg_attr(docsrs, doc(cfg(feature = "stdio")))]
273pub mod stdio;
274#[cfg(feature = "system")]
275#[cfg(not(any(windows, target_os = "wasi")))]
276#[cfg_attr(docsrs, doc(cfg(feature = "system")))]
277pub mod system;
278#[cfg(not(any(windows, target_os = "vita")))]
279#[cfg(feature = "termios")]
280#[cfg_attr(docsrs, doc(cfg(feature = "termios")))]
281pub mod termios;
282#[cfg(not(windows))]
283#[cfg(feature = "thread")]
284#[cfg_attr(docsrs, doc(cfg(feature = "thread")))]
285pub mod thread;
286#[cfg(not(any(windows, target_os = "espidf")))]
287#[cfg(feature = "time")]
288#[cfg_attr(docsrs, doc(cfg(feature = "time")))]
289pub mod time;
290
291#[cfg(not(windows))]
293#[cfg(feature = "runtime")]
294#[cfg(linux_raw)]
295#[cfg_attr(not(document_experimental_runtime_api), doc(hidden))]
296#[cfg_attr(docsrs, doc(cfg(feature = "runtime")))]
297pub mod runtime;
298
299#[cfg(linux_kernel)]
302#[cfg(all(feature = "fs", not(feature = "mount")))]
303pub(crate) mod mount;
304
305#[cfg(not(windows))]
308#[cfg(not(feature = "fs"))]
309#[cfg(all(
310 linux_raw,
311 not(feature = "use-libc-auxv"),
312 not(feature = "use-explicitly-provided-auxv"),
313 any(
314 feature = "param",
315 feature = "process",
316 feature = "runtime",
317 feature = "time",
318 target_arch = "x86",
319 )
320))]
321#[cfg_attr(docsrs, doc(cfg(feature = "fs")))]
322pub(crate) mod fs;
323
324#[cfg(not(windows))]
326#[cfg(not(any(feature = "fs", feature = "mount", feature = "net")))]
327#[cfg(all(
328 linux_raw,
329 not(feature = "use-libc-auxv"),
330 not(feature = "use-explicitly-provided-auxv"),
331 any(
332 feature = "param",
333 feature = "process",
334 feature = "runtime",
335 feature = "time",
336 target_arch = "x86",
337 )
338))]
339pub(crate) mod path;
340
341#[cfg(not(any(windows, target_os = "espidf")))]
343#[cfg(any(feature = "thread", feature = "time", target_arch = "x86"))]
344mod clockid;
345#[cfg(not(any(windows, target_os = "wasi")))]
346#[cfg(any(
347 feature = "procfs",
348 feature = "process",
349 feature = "runtime",
350 feature = "termios",
351 feature = "thread",
352 all(bsd, feature = "event"),
353 all(linux_kernel, feature = "net")
354))]
355mod pid;
356#[cfg(any(feature = "process", feature = "thread"))]
357#[cfg(linux_kernel)]
358mod prctl;
359#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))]
360#[cfg(any(feature = "process", feature = "runtime", all(bsd, feature = "event")))]
361mod signal;
362#[cfg(any(
363 feature = "fs",
364 feature = "process",
365 feature = "runtime",
366 feature = "thread",
367 feature = "time",
368 all(feature = "event", any(bsd, linux_kernel, windows, target_os = "wasi")),
369 all(
370 linux_raw,
371 not(feature = "use-libc-auxv"),
372 not(feature = "use-explicitly-provided-auxv"),
373 any(
374 feature = "param",
375 feature = "process",
376 feature = "runtime",
377 feature = "time",
378 target_arch = "x86",
379 )
380 )
381))]
382mod timespec;
383#[cfg(not(any(windows, target_os = "wasi")))]
384#[cfg(any(
385 feature = "fs",
386 feature = "process",
387 feature = "thread",
388 all(
389 linux_raw,
390 not(feature = "use-libc-auxv"),
391 not(feature = "use-explicitly-provided-auxv"),
392 any(
393 feature = "param",
394 feature = "runtime",
395 feature = "time",
396 target_arch = "x86",
397 )
398 ),
399 all(linux_kernel, feature = "net")
400))]
401mod ugid;