From 960cb6964a91c086c455a8d27c3ad5c8f0b61915 Mon Sep 17 00:00:00 2001 From: Maarten de Vries Date: Wed, 24 Feb 2021 13:25:36 +0100 Subject: [PATCH] Disable use of accept4 on x86 Android. On x86 before Linux 4.3, accept4 is not a separate syscall. Instead, it can be called using `socketcall(SYS_ACCEPT4, ...). Rather than implementing that here, just fall back to `accept`. --- library/std/src/sys/unix/net.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs index 7198a2f08d668..1df90c18c7c76 100644 --- a/library/std/src/sys/unix/net.rs +++ b/library/std/src/sys/unix/net.rs @@ -208,7 +208,7 @@ impl Socket { Ok(Socket(FileDesc::new(fd))) // While the Android kernel supports the syscall, // it is not included in all versions of Android's libc. - } else if #[cfg(target_os = "android")] { + } else if #[cfg(all(target_os = "android", not(target_arch = "x86")))] { let fd = cvt_r(|| unsafe { libc::syscall(libc::SYS_accept4, self.0.raw(), storage, len, libc::SOCK_CLOEXEC) })?;