Skip to content

Commit

Permalink
Auto merge of #2102 - de-vri-es:linux-arm32-accept4, r=JohnTitor
Browse files Browse the repository at this point in the history
Re-add accept4 for Android on 32 bit ARM.

`accept4` was accidentally removed from 32 bit Android targets except for x86 in #2079. This PR adds it back using the same definition as other non-x86 platforms.
  • Loading branch information
bors committed Mar 5, 2021
2 parents 3a7135f + b98d529 commit 990afbb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/unix/linux_like/android/b32/arm.rs
Expand Up @@ -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
}
}

0 comments on commit 990afbb

Please sign in to comment.