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`.
This commit is contained in:
Maarten de Vries 2021-02-24 13:25:36 +01:00
parent b631c914cd
commit 695b048aec

View file

@ -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)
})?;