diff options
| author | Maarten de Vries <maarten@de-vri.es> | 2021-02-24 12:24:36 +0100 |
|---|---|---|
| committer | Maarten de Vries <maarten@de-vri.es> | 2021-02-24 12:24:36 +0100 |
| commit | 3ac62cafa39c73f5594e9c43add2c89f50cef3f5 (patch) | |
| tree | 931203b9679ae2c89f102d09326359dab0d50d16 /library/std/src/sys/unix/net.rs | |
| parent | 6b56603e35b39c9f6cc76782330e5e415f9e43d5 (diff) | |
| download | rust-3ac62cafa39c73f5594e9c43add2c89f50cef3f5.tar.gz rust-3ac62cafa39c73f5594e9c43add2c89f50cef3f5.zip | |
Use libc::accept4 on Android instead of raw syscall.
Diffstat (limited to 'library/std/src/sys/unix/net.rs')
| -rw-r--r-- | library/std/src/sys/unix/net.rs | 8 |
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); |
