From 3ac62cafa39c73f5594e9c43add2c89f50cef3f5 Mon Sep 17 00:00:00 2001 From: Maarten de Vries Date: Wed, 24 Feb 2021 12:24:36 +0100 Subject: [PATCH 1/2] Use libc::accept4 on Android instead of raw syscall. --- library/std/src/sys/unix/net.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs index 7198a2f08d6..587ffe15981 100644 --- a/library/std/src/sys/unix/net.rs +++ b/library/std/src/sys/unix/net.rs @@ -195,6 +195,7 @@ impl Socket { // glibc 2.10 and musl 0.9.5. cfg_if::cfg_if! { if #[cfg(any( + target_os = "android", target_os = "dragonfly", target_os = "freebsd", target_os = "illumos", @@ -206,13 +207,6 @@ impl Socket { libc::accept4(self.0.raw(), storage, len, libc::SOCK_CLOEXEC) })?; 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")] { - let fd = cvt_r(|| unsafe { - libc::syscall(libc::SYS_accept4, self.0.raw(), storage, len, libc::SOCK_CLOEXEC) - })?; - Ok(Socket(FileDesc::new(fd as c_int))) } else { let fd = cvt_r(|| unsafe { libc::accept(self.0.raw(), storage, len) })?; let fd = FileDesc::new(fd); From f291131f2e992aff2d491e93445c6278c82b898b Mon Sep 17 00:00:00 2001 From: Maarten de Vries Date: Wed, 24 Feb 2021 12:47:28 +0100 Subject: [PATCH 2/2] Bump minimum libc version to 0.2.85 for std. --- library/std/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 1c738761e8a..275fcc4c292 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -16,7 +16,7 @@ cfg-if = { version = "0.1.8", features = ['rustc-dep-of-std'] } panic_unwind = { path = "../panic_unwind", optional = true } panic_abort = { path = "../panic_abort" } core = { path = "../core" } -libc = { version = "0.2.79", default-features = false, features = ['rustc-dep-of-std'] } +libc = { version = "0.2.85", default-features = false, features = ['rustc-dep-of-std'] } compiler_builtins = { version = "0.1.39" } profiler_builtins = { path = "../profiler_builtins", optional = true } unwind = { path = "../unwind" }