Skip to content

Commit 3ac62ca

Browse files
committed
Use libc::accept4 on Android instead of raw syscall.
1 parent 6b56603 commit 3ac62ca

File tree

1 file changed

+1
-7
lines changed
  • library/std/src/sys/unix

1 file changed

+1
-7
lines changed

library/std/src/sys/unix/net.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ impl Socket {
195195
// glibc 2.10 and musl 0.9.5.
196196
cfg_if::cfg_if! {
197197
if #[cfg(any(
198+
target_os = "android",
198199
target_os = "dragonfly",
199200
target_os = "freebsd",
200201
target_os = "illumos",
@@ -206,13 +207,6 @@ impl Socket {
206207
libc::accept4(self.0.raw(), storage, len, libc::SOCK_CLOEXEC)
207208
})?;
208209
Ok(Socket(FileDesc::new(fd)))
209-
// While the Android kernel supports the syscall,
210-
// it is not included in all versions of Android's libc.
211-
} else if #[cfg(target_os = "android")] {
212-
let fd = cvt_r(|| unsafe {
213-
libc::syscall(libc::SYS_accept4, self.0.raw(), storage, len, libc::SOCK_CLOEXEC)
214-
})?;
215-
Ok(Socket(FileDesc::new(fd as c_int)))
216210
} else {
217211
let fd = cvt_r(|| unsafe { libc::accept(self.0.raw(), storage, len) })?;
218212
let fd = FileDesc::new(fd);

0 commit comments

Comments
 (0)