rustix/backend/linux_raw/
mod.rs

1//! The linux_raw backend.
2//!
3//! This makes Linux syscalls directly, without going through libc.
4//!
5//! # Safety
6//!
7//! These files performs raw system calls, and sometimes passes them
8//! uninitialized memory buffers. The signatures in this module are currently
9//! manually maintained and must correspond with the signatures of the actual
10//! Linux syscalls.
11//!
12//! Some of this could be auto-generated from the Linux header file
13//! <linux/syscalls.h>, but we often need more information than it provides,
14//! such as which pointers are array slices, out parameters, or in-out
15//! parameters, which integers are owned or borrowed file descriptors, etc.
16
17#[macro_use]
18mod arch;
19mod conv;
20mod reg;
21#[cfg(any(feature = "time", feature = "process", target_arch = "x86"))]
22mod vdso;
23#[cfg(any(feature = "time", feature = "process", target_arch = "x86"))]
24mod vdso_wrappers;
25
26#[cfg(feature = "event")]
27pub(crate) mod event;
28#[cfg(any(
29    feature = "fs",
30    all(
31        not(feature = "use-libc-auxv"),
32        not(feature = "use-explicitly-provided-auxv"),
33        any(
34            feature = "param",
35            feature = "process",
36            feature = "runtime",
37            feature = "time",
38            target_arch = "x86",
39        )
40    )
41))]
42pub(crate) mod fs;
43pub(crate) mod io;
44#[cfg(feature = "io_uring")]
45pub(crate) mod io_uring;
46#[cfg(feature = "mm")]
47pub(crate) mod mm;
48#[cfg(feature = "mount")]
49pub(crate) mod mount;
50#[cfg(all(feature = "fs", not(feature = "mount")))]
51pub(crate) mod mount; // for deprecated mount functions in "fs"
52#[cfg(feature = "net")]
53pub(crate) mod net;
54#[cfg(any(
55    feature = "param",
56    feature = "process",
57    feature = "runtime",
58    feature = "time",
59    target_arch = "x86",
60))]
61pub(crate) mod param;
62#[cfg(feature = "pipe")]
63pub(crate) mod pipe;
64#[cfg(feature = "process")]
65pub(crate) mod process;
66#[cfg(feature = "pty")]
67pub(crate) mod pty;
68#[cfg(feature = "rand")]
69pub(crate) mod rand;
70#[cfg(feature = "runtime")]
71pub(crate) mod runtime;
72#[cfg(feature = "shm")]
73pub(crate) mod shm;
74#[cfg(feature = "system")]
75pub(crate) mod system;
76#[cfg(feature = "termios")]
77pub(crate) mod termios;
78#[cfg(feature = "thread")]
79pub(crate) mod thread;
80#[cfg(feature = "time")]
81pub(crate) mod time;
82
83pub(crate) mod fd {
84    pub use crate::maybe_polyfill::os::fd::{
85        AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd,
86    };
87}
88
89// The linux_raw backend doesn't use actual libc, so we define selected
90// libc-like definitions in a module called `c`.
91pub(crate) mod c;
92
93// Private modules used by multiple public modules.
94#[cfg(any(feature = "procfs", feature = "process", feature = "runtime"))]
95pub(crate) mod pid;
96#[cfg(any(feature = "process", feature = "thread"))]
97pub(crate) mod prctl;
98#[cfg(any(
99    feature = "fs",
100    feature = "process",
101    feature = "thread",
102    all(
103        not(feature = "use-libc-auxv"),
104        not(feature = "use-explicitly-provided-auxv"),
105        any(
106            feature = "param",
107            feature = "runtime",
108            feature = "time",
109            target_arch = "x86",
110        )
111    )
112))]
113pub(crate) mod ugid;
114
115/// The maximum number of buffers that can be passed into a vectored I/O system
116/// call on the current platform.
117const MAX_IOV: usize = linux_raw_sys::general::UIO_MAXIOV as usize;