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 file 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 ] |
18 | mod arch; |
19 | mod conv; |
20 | mod reg; |
21 | #[cfg (any(feature = "time" , feature = "process" , target_arch = "x86" ))] |
22 | mod vdso; |
23 | #[cfg (any(feature = "time" , feature = "process" , target_arch = "x86" ))] |
24 | mod vdso_wrappers; |
25 | |
26 | #[cfg (feature = "event" )] |
27 | pub(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 | ))] |
42 | pub(crate) mod fs; |
43 | pub(crate) mod io; |
44 | #[cfg (feature = "io_uring" )] |
45 | pub(crate) mod io_uring; |
46 | #[cfg (feature = "mm" )] |
47 | pub(crate) mod mm; |
48 | #[cfg (feature = "mount" )] |
49 | pub(crate) mod mount; |
50 | #[cfg (all(feature = "fs" , not(feature = "mount" )))] |
51 | pub(crate) mod mount; // for deprecated mount functions in "fs" |
52 | #[cfg (feature = "net" )] |
53 | pub(crate) mod net; |
54 | #[cfg (any( |
55 | feature = "param" , |
56 | feature = "process" , |
57 | feature = "runtime" , |
58 | feature = "time" , |
59 | target_arch = "x86" , |
60 | ))] |
61 | pub(crate) mod param; |
62 | #[cfg (feature = "pipe" )] |
63 | pub(crate) mod pipe; |
64 | #[cfg (feature = "process" )] |
65 | pub(crate) mod process; |
66 | #[cfg (feature = "pty" )] |
67 | pub(crate) mod pty; |
68 | #[cfg (feature = "rand" )] |
69 | pub(crate) mod rand; |
70 | #[cfg (feature = "runtime" )] |
71 | pub(crate) mod runtime; |
72 | #[cfg (feature = "shm" )] |
73 | pub(crate) mod shm; |
74 | #[cfg (feature = "system" )] |
75 | pub(crate) mod system; |
76 | #[cfg (feature = "termios" )] |
77 | pub(crate) mod termios; |
78 | #[cfg (feature = "thread" )] |
79 | pub(crate) mod thread; |
80 | #[cfg (feature = "time" )] |
81 | pub(crate) mod time; |
82 | |
83 | pub(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`. |
91 | pub(crate) mod c; |
92 | |
93 | // Private modules used by multiple public modules. |
94 | #[cfg (any(feature = "procfs" , feature = "process" , feature = "runtime" ))] |
95 | pub(crate) mod pid; |
96 | #[cfg (any(feature = "process" , feature = "thread" ))] |
97 | pub(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 | ))] |
113 | pub(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. |
117 | const MAX_IOV: usize = linux_raw_sys::general::UIO_MAXIOV as usize; |
118 | |