Skip to content

Commit

Permalink
Remove work around for Android simulator
Browse files Browse the repository at this point in the history
Use accept4 instead.
  • Loading branch information
Thomasdezeeuw committed Jun 9, 2024
1 parent 5200f6c commit f5616fd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
7 changes: 1 addition & 6 deletions src/sys/unix/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream,
// On platforms that support it we can use `accept4(2)` to set `NONBLOCK`
// and `CLOEXEC` in the call to accept the connection.
#[cfg(any(
// Android x86's seccomp profile forbids calls to `accept4(2)`
// See https://github.com/tokio-rs/mio/issues/1445 for details
all(not(target_arch="x86"), target_os = "android"),
target_os = "android",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "illumos",
Expand Down Expand Up @@ -93,7 +91,6 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream,
target_os = "vita",
target_os = "hermit",
target_os = "nto",
all(target_arch = "x86", target_os = "android"),
))]
let stream = {
syscall!(accept(
Expand All @@ -106,9 +103,7 @@ pub(crate) fn accept(listener: &net::TcpListener) -> io::Result<(net::TcpStream,
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
syscall!(fcntl(s.as_raw_fd(), libc::F_SETFD, libc::FD_CLOEXEC))?;

// See https://github.com/tokio-rs/mio/issues/1450
#[cfg(any(
all(target_arch = "x86", target_os = "android"),
target_os = "espidf",
target_os = "vita",
target_os = "hermit",
Expand Down
6 changes: 0 additions & 6 deletions src/sys/unix/uds/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So
target_os = "espidf",
target_os = "vita",
target_os = "nto",
// Android x86's seccomp profile forbids calls to `accept4(2)`
// See https://github.com/tokio-rs/mio/issues/1445 for details
all(target_arch = "x86", target_os = "android"),
)))]
let socket = {
let flags = libc::SOCK_NONBLOCK | libc::SOCK_CLOEXEC;
Expand All @@ -70,7 +67,6 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So
target_os = "espidf",
target_os = "vita",
target_os = "nto",
all(target_arch = "x86", target_os = "android")
))]
let socket = syscall!(accept(
listener.as_raw_fd(),
Expand All @@ -84,9 +80,7 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
syscall!(fcntl(socket, libc::F_SETFD, libc::FD_CLOEXEC))?;

// See https://github.com/tokio-rs/mio/issues/1450
#[cfg(any(
all(target_arch = "x86", target_os = "android"),
target_os = "espidf",
target_os = "vita",
target_os = "nto",
Expand Down

0 comments on commit f5616fd

Please sign in to comment.