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 target_os = "horizon"
55 ), path = "selector/poll.rs")]
56 mod selector;
57 pub(crate) use self::selector::*;
58
59 #[cfg_attr(all(
60 not(mio_unsupported_force_waker_pipe),
61 any(
62 target_os = "android",
63 target_os = "espidf",
64 target_os = "fuchsia",
65 target_os = "hermit",
66 target_os = "illumos",
67 target_os = "linux",
68 )
69 ), path = "waker/eventfd.rs")]
70 #[cfg_attr(all(
71 not(mio_unsupported_force_waker_pipe),
72 not(mio_unsupported_force_poll_poll), any(
74 target_os = "freebsd",
75 target_os = "ios",
76 target_os = "macos",
77 target_os = "tvos",
78 target_os = "visionos",
79 target_os = "watchos",
80 )
81 ), path = "waker/kqueue.rs")]
82 #[cfg_attr(any(
83 mio_unsupported_force_waker_pipe,
85 all(
86 mio_unsupported_force_poll_poll,
88 any(
89 target_os = "freebsd",
90 target_os = "ios",
91 target_os = "macos",
92 target_os = "tvos",
93 target_os = "visionos",
94 target_os = "watchos",
95 ),
96 ),
97 target_os = "aix",
98 target_os = "dragonfly",
99 target_os = "haiku",
100 target_os = "hurd",
101 target_os = "netbsd",
102 target_os = "nto",
103 target_os = "openbsd",
104 target_os = "redox",
105 target_os = "solaris",
106 target_os = "vita",
107 target_os = "cygwin",
108 all(target_os = "wasi", target_env = "p1")
109 ), path = "waker/pipe.rs")]
110 #[cfg_attr(any(target_os = "horizon", all(target_os = "wasi", not(target_env = "p1"))), path = "waker/single_threaded.rs")]
111 mod waker;
112 #[cfg(feature = "os-ext")]
116 mod sourcefd;
117 #[cfg(feature = "os-ext")]
118 pub use self::sourcefd::SourceFd;
119
120 cfg_net! {
121 mod net;
122
123 pub(crate) mod tcp;
124 pub(crate) mod udp;
125 #[cfg(not(any(target_os = "hermit", target_os = "wasi")))]
126 pub(crate) mod uds;
127 }
128
129 #[cfg(all(
130 any(
131 feature = "os-ext",
133 mio_unsupported_force_waker_pipe,
135 all(
136 mio_unsupported_force_poll_poll,
138 any(
139 target_os = "freebsd",
140 target_os = "ios",
141 target_os = "macos",
142 target_os = "tvos",
143 target_os = "visionos",
144 target_os = "watchos",
145 ),
146 ),
147 target_os = "aix",
149 target_os = "dragonfly",
150 target_os = "haiku",
151 target_os = "hurd",
152 target_os = "netbsd",
153 target_os = "nto",
154 target_os = "openbsd",
155 target_os = "redox",
156 target_os = "solaris",
157 target_os = "vita",
158 target_os = "cygwin",
159 ),
160 not(target_os = "hermit"),
161 not(target_os = "wasi"),
162 ))]
163 pub(crate) mod pipe;
164}
165
166cfg_not_os_poll! {
167 cfg_os_ext! {
168 mod sourcefd;
169 pub use self::sourcefd::SourceFd;
170 }
171}