1#[allow(unused_macros)]
5macro_rules! syscall {
6 ($fn: ident ( $($arg: expr),* $(,)* ) ) => {{
7 #[allow(unused_unsafe)]
8 let res = unsafe { libc::$fn($($arg, )*) };
9 if res < 0 {
10 Err(std::io::Error::last_os_error())
11 } else {
12 Ok(res)
13 }
14 }};
15}
16
17cfg_os_poll! {
18 #[cfg_attr(all(
19 not(mio_unsupported_force_poll_poll),
20 any(
21 target_os = "android",
22 target_os = "illumos",
23 target_os = "linux",
24 target_os = "redox",
25 )
26 ), path = "selector/epoll.rs")]
27 #[cfg_attr(all(
28 not(mio_unsupported_force_poll_poll),
29 any(
30 target_os = "dragonfly",
31 target_os = "freebsd",
32 target_os = "ios",
33 target_os = "macos",
34 target_os = "netbsd",
35 target_os = "openbsd",
36 target_os = "tvos",
37 target_os = "visionos",
38 target_os = "watchos",
39 )
40 ), path = "selector/kqueue.rs")]
41 #[cfg_attr(any(
42 mio_unsupported_force_poll_poll,
43 target_os = "aix",
44 target_os = "espidf",
45 target_os = "fuchsia",
46 target_os = "haiku",
47 target_os = "hermit",
48 target_os = "hurd",
49 target_os = "nto",
50 target_os = "solaris",
51 target_os = "vita",
52 target_os = "cygwin",
53 target_os = "wasi",
54 ), path = "selector/poll.rs")]
55 mod selector;
56 pub(crate) use self::selector::*;
57
58 #[cfg_attr(all(
59 not(mio_unsupported_force_waker_pipe),
60 any(
61 target_os = "android",
62 target_os = "espidf",
63 target_os = "fuchsia",
64 target_os = "hermit",
65 target_os = "illumos",
66 target_os = "linux",
67 )
68 ), path = "waker/eventfd.rs")]
69 #[cfg_attr(all(
70 not(mio_unsupported_force_waker_pipe),
71 not(mio_unsupported_force_poll_poll), any(
73 target_os = "freebsd",
74 target_os = "ios",
75 target_os = "macos",
76 target_os = "tvos",
77 target_os = "visionos",
78 target_os = "watchos",
79 )
80 ), path = "waker/kqueue.rs")]
81 #[cfg_attr(any(
82 mio_unsupported_force_waker_pipe,
84 all(
85 mio_unsupported_force_poll_poll,
87 any(
88 target_os = "freebsd",
89 target_os = "ios",
90 target_os = "macos",
91 target_os = "tvos",
92 target_os = "visionos",
93 target_os = "watchos",
94 ),
95 ),
96 target_os = "aix",
97 target_os = "dragonfly",
98 target_os = "haiku",
99 target_os = "hurd",
100 target_os = "netbsd",
101 target_os = "nto",
102 target_os = "openbsd",
103 target_os = "redox",
104 target_os = "solaris",
105 target_os = "vita",
106 target_os = "cygwin",
107 all(target_os = "wasi", target_env = "p1")
108 ), path = "waker/pipe.rs")]
109 #[cfg_attr(all(target_os = "wasi", not(target_env = "p1")), path = "waker/single_threaded.rs")]
110 mod waker;
111 #[cfg(feature = "os-ext")]
115 mod sourcefd;
116 #[cfg(feature = "os-ext")]
117 pub use self::sourcefd::SourceFd;
118
119 cfg_net! {
120 mod net;
121
122 pub(crate) mod tcp;
123 pub(crate) mod udp;
124 #[cfg(not(any(target_os = "hermit", target_os = "wasi")))]
125 pub(crate) mod uds;
126 }
127
128 #[cfg(all(
129 any(
130 feature = "os-ext",
132 mio_unsupported_force_waker_pipe,
134 all(
135 mio_unsupported_force_poll_poll,
137 any(
138 target_os = "freebsd",
139 target_os = "ios",
140 target_os = "macos",
141 target_os = "tvos",
142 target_os = "visionos",
143 target_os = "watchos",
144 ),
145 ),
146 target_os = "aix",
148 target_os = "dragonfly",
149 target_os = "haiku",
150 target_os = "hurd",
151 target_os = "netbsd",
152 target_os = "nto",
153 target_os = "openbsd",
154 target_os = "redox",
155 target_os = "solaris",
156 target_os = "vita",
157 target_os = "cygwin",
158 ),
159 not(target_os = "hermit"),
160 not(target_os = "wasi"),
161 ))]
162 pub(crate) mod pipe;
163}
164
165cfg_not_os_poll! {
166 cfg_os_ext! {
167 mod sourcefd;
168 pub use self::sourcefd::SourceFd;
169 }
170}