Skip to content

Commit

Permalink
Add proper cfg to LOWEST_FD in unix selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Janrupf committed Aug 9, 2022
1 parent 09e66a6 commit 732b398
Showing 1 changed file with 39 additions and 26 deletions.
65 changes: 39 additions & 26 deletions src/sys/unix/selector/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
#[cfg(all(
any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "redox",
),
not(feature = "force-old-poll")
))]
mod epoll;

#[cfg(all(
any(
target_os = "android",
Expand All @@ -19,7 +8,6 @@ mod epoll;
not(feature = "force-old-poll")
))]
pub(crate) use self::epoll::{event, Event, Events, Selector};

#[cfg(all(
any(
target_os = "dragonfly",
Expand All @@ -31,37 +19,47 @@ pub(crate) use self::epoll::{event, Event, Events, Selector};
),
not(feature = "force-old-poll")
))]
mod kqueue;

#[cfg(all(
any(
pub(crate) use self::kqueue::{event, Event, Events, Selector};
#[cfg(any(
not(any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "redox",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
),
not(feature = "force-old-poll")
)),
feature = "force-old-poll"
))]
pub(crate) use self::kqueue::{event, Event, Events, Selector};
pub(crate) use self::poll::{event, Event, Events, Selector};

#[cfg(any(
not(any(
#[cfg(all(
any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "redox",
),
not(feature = "force-old-poll")
))]
mod epoll;

#[cfg(all(
any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
)),
feature = "force-old-poll"
),
not(feature = "force-old-poll")
))]
mod poll;
mod kqueue;

#[cfg(any(
not(any(
Expand All @@ -78,7 +76,7 @@ mod poll;
)),
feature = "force-old-poll"
))]
pub(crate) use self::poll::{event, Event, Events, Selector};
mod poll;

/// Lowest file descriptor used in `Selector::try_clone`.
///
Expand All @@ -88,5 +86,20 @@ pub(crate) use self::poll::{event, Event, Events, Selector};
/// blindly assume this to be true, which means using any one of those a select
/// could result in some interesting and unexpected errors. Avoid that by using
/// an fd that doesn't have a pre-determined usage.
#[cfg(not(feature = "force-old-poll"))]
#[cfg(all(
unix,
any(
target_os = "android",
target_os = "illumos",
target_os = "linux",
target_os = "redox",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd"
),
not(feature = "force-old-poll")
))]
const LOWEST_FD: libc::c_int = 3;

0 comments on commit 732b398

Please sign in to comment.