diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 07:03:34 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-05-10 07:03:34 +0000 |
commit | da9b642c0d6e00f3c00c8e4a2dff774bbbdd0fbc (patch) | |
tree | f3d75d88bf9648065ba9b0add52ffad4f795ca82 /src | |
parent | ac26036f346cc3eab333781d76395933faf6daf6 (diff) | |
parent | 01e59128a5539731b50682a79bf107f30f42f170 (diff) | |
download | mio-da9b642c0d6e00f3c00c8e4a2dff774bbbdd0fbc.tar.gz |
Snap for 8564071 from 01e59128a5539731b50682a79bf107f30f42f170 to mainline-wifi-releaseaml_wif_331910020aml_wif_331810010aml_wif_331710030aml_wif_331613000aml_wif_331511020aml_wif_331414000aml_wif_331310070aml_wif_331112000aml_wif_331016070aml_wif_330910030aml_wif_330810040android13-mainline-wifi-release
Change-Id: If827c96f097cb567501344bdd8d6a681c06f15f6
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/sys/unix/selector/epoll.rs | 2 | ||||
-rw-r--r-- | src/sys/unix/selector/kqueue.rs | 2 | ||||
-rw-r--r-- | src/sys/unix/selector/mod.rs | 10 |
4 files changed, 13 insertions, 3 deletions
@@ -1,4 +1,4 @@ -#![doc(html_root_url = "https://docs.rs/mio/0.7.11")] +#![doc(html_root_url = "https://docs.rs/mio/0.7.13")] #![deny( missing_docs, missing_debug_implementations, diff --git a/src/sys/unix/selector/epoll.rs b/src/sys/unix/selector/epoll.rs index 76ee7f9..38667d6 100644 --- a/src/sys/unix/selector/epoll.rs +++ b/src/sys/unix/selector/epoll.rs @@ -41,7 +41,7 @@ impl Selector { } pub fn try_clone(&self) -> io::Result<Selector> { - syscall!(dup(self.ep)).map(|ep| Selector { + syscall!(fcntl(self.ep, libc::F_DUPFD_CLOEXEC, super::LOWEST_FD)).map(|ep| Selector { // It's the same selector, so we use the same id. #[cfg(debug_assertions)] id: self.id, diff --git a/src/sys/unix/selector/kqueue.rs b/src/sys/unix/selector/kqueue.rs index 34f5340..b36a537 100644 --- a/src/sys/unix/selector/kqueue.rs +++ b/src/sys/unix/selector/kqueue.rs @@ -87,7 +87,7 @@ impl Selector { } pub fn try_clone(&self) -> io::Result<Selector> { - syscall!(dup(self.kq)).map(|kq| Selector { + syscall!(fcntl(self.kq, libc::F_DUPFD_CLOEXEC, super::LOWEST_FD)).map(|kq| Selector { // It's the same selector, so we use the same id. #[cfg(debug_assertions)] id: self.id, diff --git a/src/sys/unix/selector/mod.rs b/src/sys/unix/selector/mod.rs index 7525898..b73d645 100644 --- a/src/sys/unix/selector/mod.rs +++ b/src/sys/unix/selector/mod.rs @@ -33,3 +33,13 @@ mod kqueue; target_os = "openbsd" ))] pub(crate) use self::kqueue::{event, Event, Events, Selector}; + +/// Lowest file descriptor used in `Selector::try_clone`. +/// +/// # Notes +/// +/// Usually fds 0, 1 and 2 are standard in, out and error. Some application +/// 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. +const LOWEST_FD: libc::c_int = 3; |