about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-02-27 02:34:31 +0100
committerGitHub <noreply@github.com>2021-02-27 02:34:31 +0100
commitb664e4bdb5dd29a95f170e204ac010b3157ff0dd (patch)
tree4c04477ee42a42928315997a5471ed1b8dfa2e0a /library/std/src
parent5c7b383e59111718b344abf21fa3edf13a68a68f (diff)
parentf291131f2e992aff2d491e93445c6278c82b898b (diff)
downloadrust-b664e4bdb5dd29a95f170e204ac010b3157ff0dd.tar.gz
rust-b664e4bdb5dd29a95f170e204ac010b3157ff0dd.zip
Rollup merge of #82473 - de-vri-es:android-x86-accept4, r=m-ou-se
Use libc::accept4 on Android instead of raw syscall.

This PR replaces the use of a raw `accept4` syscall with `libc::accept4`. This was originally added (by me) because `std` couldn't update to the latest `libc` with `accept4` support for android. By now, libc is already on 0.2.85, so the workaround can be removed.

`@rustbot` label +O-android +T-libs-impl
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sys/unix/net.rs8
1 files changed, 1 insertions, 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);