1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#![allow(clippy::undocumented_unsafe_blocks)]
#![allow(clippy::useless_conversion)]
#[cfg(not(any(windows, target_os = "wasi")))]
#[macro_use]
mod weak;
mod conv;
mod offset;
#[cfg(windows)]
mod io_lifetimes;
#[cfg(not(windows))]
#[cfg(not(feature = "std"))]
pub(crate) mod fd {
pub(crate) use super::c::c_int as LibcFd;
pub use crate::io::fd::*;
}
#[cfg(windows)]
pub(crate) mod fd {
pub use super::io_lifetimes::*;
}
#[cfg(not(windows))]
#[cfg(feature = "std")]
pub(crate) mod fd {
pub use io_lifetimes::*;
#[cfg(target_os = "wasi")]
#[allow(unused_imports)]
pub(crate) use super::c::c_int as LibcFd;
#[cfg(unix)]
#[allow(unused_imports)]
pub(crate) use std::os::unix::io::RawFd as LibcFd;
#[cfg(unix)]
pub use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
#[cfg(target_os = "wasi")]
pub use std::os::wasi::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
}
#[cfg(windows)]
#[path = "winsock_c.rs"]
pub(crate) mod c;
#[cfg(not(windows))]
pub(crate) use libc as c;
#[cfg(not(windows))]
pub(crate) mod fs;
pub(crate) mod io;
#[cfg(any(target_os = "android", target_os = "linux"))]
#[cfg(feature = "io_uring")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "io_uring")))]
pub(crate) mod io_uring;
#[cfg(not(any(windows, target_os = "wasi")))]
#[cfg(feature = "mm")]
pub(crate) mod mm;
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(feature = "net")]
pub(crate) mod net;
#[cfg(not(windows))]
#[cfg(any(
feature = "param",
feature = "runtime",
feature = "time",
target_arch = "x86",
))]
pub(crate) mod param;
#[cfg(not(windows))]
pub(crate) mod process;
#[cfg(not(windows))]
#[cfg(feature = "rand")]
pub(crate) mod rand;
#[cfg(not(any(windows, target_os = "wasi")))]
#[cfg(feature = "termios")]
pub(crate) mod termios;
#[cfg(not(windows))]
#[cfg(feature = "thread")]
pub(crate) mod thread;
#[cfg(not(windows))]
pub(crate) mod time;
#[cfg(all(unix, target_env = "gnu"))]
pub(crate) fn if_glibc_is_less_than_2_25() -> bool {
weak! { fn getrandom(*mut c::c_void, c::size_t, c::c_uint) -> c::ssize_t }
getrandom.get().is_none()
}