diff options
author | bors <bors@rust-lang.org> | 2021-03-05 14:41:08 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2021-03-05 14:41:08 +0000 |
commit | 990afbb5adf9d6fd8d81202c7613f422ee61cf45 (patch) | |
tree | be3c137779f2af154e1c19f5e2ccd7fbfc84a438 | |
parent | 3a7135f491b8faac564c13e7d0c5fd6b10e03855 (diff) | |
parent | b98d5292b8cfe96213503997d9cd1f3f49bfce40 (diff) | |
download | rust-libc-990afbb5adf9d6fd8d81202c7613f422ee61cf45.tar.gz |
Auto merge of #2102 - de-vri-es:linux-arm32-accept4, r=JohnTitor
Re-add accept4 for Android on 32 bit ARM.
`accept4` was accidentally removed from 32 bit Android targets except for x86 in https://github.com/rust-lang/libc/pull/2079. This PR adds it back using the same definition as other non-x86 platforms.
-rw-r--r-- | src/unix/linux_like/android/b32/arm.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/linux_like/android/b32/arm.rs index aa9beb7652..8a53e53994 100644 --- a/src/unix/linux_like/android/b32/arm.rs +++ b/src/unix/linux_like/android/b32/arm.rs @@ -521,3 +521,19 @@ pub const REG_R14: ::c_int = 14; pub const REG_R15: ::c_int = 15; pub const NGREG: ::c_int = 18; + +f! { + // Sadly, Android before 5.0 (API level 21), the accept4 syscall is not + // exposed by the libc. As work-around, we implement it through `syscall` + // directly. This workaround can be removed if the minimum version of + // Android is bumped. When the workaround is removed, `accept4` can be + // moved back to `linux_like/mod.rs` + pub fn accept4( + fd: ::c_int, + addr: *mut ::sockaddr, + len: *mut ::socklen_t, + flg: ::c_int + ) -> ::c_int { + ::syscall(SYS_accept4, fd, addr, len, flg) as ::c_int + } +} |